regex_parser.h

changeset 27
95a958e3de88
child 28
72a98cbcb9f1
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/regex_parser.h	Thu Jan 26 15:55:52 2012 +0100
     1.3 @@ -0,0 +1,40 @@
     1.4 +/*
     1.5 + * regex_parser.h
     1.6 + *
     1.7 + *  Created on: 26.01.2012
     1.8 + *      Author: Mike
     1.9 + */
    1.10 +
    1.11 +#ifndef REGEX_PARSER_H_
    1.12 +#define REGEX_PARSER_H_
    1.13 +
    1.14 +#define REGEX_MAX_LINELENGTH           2048
    1.15 +
    1.16 +#include <sys/types.h>
    1.17 +#include <stdbool.h>
    1.18 +#include <regex.h>
    1.19 +#include "string_list.h"
    1.20 +
    1.21 +typedef struct {
    1.22 +  string_list_t* pattern_list; /* even entries: start ; odd entries: end */
    1.23 +  regex_t** compiled_patterns;
    1.24 +  unsigned int pattern_match; /* save position of end pattern to match -
    1.25 +                                 NULL when a start pattern shall match first */
    1.26 +  unsigned int matched_lines;
    1.27 +} regex_parser_t;
    1.28 +
    1.29 +#ifdef _cplusplus
    1.30 +extern "C" {
    1.31 +#endif
    1.32 +
    1.33 +regex_parser_t* new_regex_parser_t();
    1.34 +void destroy_regex_parser_t(regex_parser_t*);
    1.35 +
    1.36 +bool regex_parser_matching(regex_parser_t*);
    1.37 +void regex_compile_all(regex_parser_t*);
    1.38 +
    1.39 +#ifdef _cplusplus
    1.40 +}
    1.41 +#endif
    1.42 +
    1.43 +#endif /* REGEX_PARSER_H_ */

mercurial