regex_parser.h

changeset 34
fa9bda32de17
parent 28
72a98cbcb9f1
equal deleted inserted replaced
33:1a2d7298bc82 34:fa9bda32de17
1 /*
2 * regex_parser.h
3 *
4 * Created on: 26.01.2012
5 * Author: Mike
6 */
7
8 #ifndef REGEX_PARSER_H_
9 #define REGEX_PARSER_H_
10
11 #define REGEX_MAX_LINELENGTH 2048
12
13 #include <sys/types.h>
14 #include <stdbool.h>
15 #include <regex.h>
16 #include "string_list.h"
17
18 typedef struct {
19 string_list_t* pattern_list; /* even entries: start ; odd entries: end */
20 regex_t** compiled_patterns;
21 size_t compiled_pattern_count;
22 unsigned int pattern_match; /* save position of end pattern to match -
23 NULL when a start pattern shall match first */
24 unsigned int matched_lines;
25 } regex_parser_t;
26
27 #ifdef _cplusplus
28 extern "C" {
29 #endif
30
31 regex_parser_t* new_regex_parser_t();
32 void destroy_regex_parser_t(regex_parser_t*);
33
34 bool regex_parser_matching(regex_parser_t*);
35 bool regex_compile_all(regex_parser_t*);
36 int regex_parser_do(regex_parser_t*, char*);
37
38 #ifdef _cplusplus
39 }
40 #endif
41
42 #endif /* REGEX_PARSER_H_ */

mercurial