diff th_regex.h @ 610:a0e8d9c6300b

A bit more work on the regex stuff.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 16 Jan 2020 03:33:11 +0200
parents 566e6ef41f9d
children d191ded8a790
line wrap: on
line diff
--- a/th_regex.h	Thu Jan 16 01:46:19 2020 +0200
+++ b/th_regex.h	Thu Jan 16 03:33:11 2020 +0200
@@ -10,7 +10,9 @@
 #ifndef TH_REGEX_H
 #define TH_REGEX_H
 
-#include "th_util.h"
+#include "th_types.h"
+#include "th_datastruct.h"
+
 
 #ifdef __cplusplus
 extern "C" {
@@ -23,6 +25,13 @@
 typedef char th_regex_char;
 
 
+enum
+{
+    TH_REF_CASEFOLD          = 0x0001,
+    TH_REF_ANCHORED          = 0x0002,
+};
+
+
 struct th_regex_ctx;
 
 typedef struct
@@ -54,7 +63,7 @@
 
 typedef struct
 {
-//    th_llist_t node;
+    th_llist_t node;
     size_t start, len;
 } th_regex_match_node;
 
@@ -62,12 +71,13 @@
 //
 // Functions
 //
-int th_regex_compile(th_regex_ctx **pexpr, const th_regex_char *pattern);
-void th_regex_free(th_regex_ctx *expr);
+int      th_regex_compile(th_regex_ctx **pexpr, const th_regex_char *pattern);
+void     th_regex_free(th_regex_ctx *expr);
 
-int th_regex_match(const th_regex_ctx *expr, const th_regex_char *haystack,
-    BOOL *pmatched, th_regex_match_node **pmatches, const ssize_t max,
-    const int flags);
+int      th_regex_match(const th_regex_ctx *expr, const th_regex_char *haystack,
+         size_t *pnmatches, th_regex_match_node **pmatches, const size_t maxmatches,
+         const int flags);
+void     th_regex_free_matches(th_regex_match_node *matches);
 
 
 #ifdef __cplusplus