Mercurial > hg > th-libs
comparison th_regex.h @ 664:c5aa9ada1051
s/th_regex_char_t/th_char_t/g
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 27 Jan 2020 07:48:27 +0200 |
parents | ae601363fdad |
children | 7493d4c9ff77 |
comparison
equal
deleted
inserted
replaced
663:284d5b789b7c | 664:c5aa9ada1051 |
---|---|
21 | 21 |
22 // | 22 // |
23 // Definitions | 23 // Definitions |
24 // | 24 // |
25 | 25 |
26 /** @brief th_regex_char_t | |
27 * Character type used by th_regex module. | |
28 */ | |
29 typedef char th_regex_char_t; | |
30 | |
31 | |
32 /** @struct th_regex_t | 26 /** @struct th_regex_t |
33 * Structure containing the tokenized / compiled regular expression. | 27 * Structure containing the tokenized / compiled regular expression. |
34 */ | 28 */ |
35 struct th_regex_t; | 29 struct th_regex_t; |
36 typedef struct th_regex_t th_regex_t; | 30 typedef struct th_regex_t th_regex_t; |
42 */ | 36 */ |
43 typedef struct | 37 typedef struct |
44 { | 38 { |
45 th_llist_t node; ///< Internal linked list data | 39 th_llist_t node; ///< Internal linked list data |
46 | 40 |
47 size_t start; ///< Start offset of the match sequence in @p haystack in @c th_regex_char_t units. | 41 size_t start; ///< Start offset of the match sequence in @p haystack in @c th_char_t units. |
48 size_t len; ///< Length of the match sequence in @p haystack in @c th_regex_char_t units. | 42 size_t len; ///< Length of the match sequence in @p haystack in @c th_char_t units. |
49 } th_regex_match_t; | 43 } th_regex_match_t; |
50 | 44 |
51 | 45 |
52 // Flags for th_regex_match() | 46 // Flags for th_regex_match() |
53 // (not actually used or supported yet :D) | 47 // (not actually used or supported yet :D) |
64 | 58 |
65 | 59 |
66 // | 60 // |
67 // Functions | 61 // Functions |
68 // | 62 // |
69 int th_regex_compile(th_regex_t **pexpr, const th_regex_char_t *pattern); | 63 int th_regex_compile(th_regex_t **pexpr, const th_char_t *pattern); |
70 void th_regex_free(th_regex_t *expr); | 64 void th_regex_free(th_regex_t *expr); |
71 void th_regex_dump(th_ioctx *fh, const int level, const th_regex_t *expr); | 65 void th_regex_dump(th_ioctx *fh, const int level, const th_regex_t *expr); |
72 | 66 |
73 int th_regex_match(const th_regex_t *expr, const th_regex_char_t *haystack, | 67 int th_regex_match(const th_regex_t *expr, const th_char_t *haystack, |
74 size_t *pnmatches, th_regex_match_t **pmatches, const size_t maxmatches, | 68 size_t *pnmatches, th_regex_match_t **pmatches, const size_t maxmatches, |
75 const int flags); | 69 const int flags); |
76 | 70 |
77 void th_regex_free_matches(th_regex_match_t *matches); | 71 void th_regex_free_matches(th_regex_match_t *matches); |
78 | 72 |