regex_parser.h

Thu, 26 Jan 2012 15:55:52 +0100

author
Mike Becker <universe@uap-core.de>
date
Thu, 26 Jan 2012 15:55:52 +0100
changeset 27
95a958e3de88
child 28
72a98cbcb9f1
permissions
-rw-r--r--

added regexp_parser struct and compile function

/*
 * regex_parser.h
 *
 *  Created on: 26.01.2012
 *      Author: Mike
 */

#ifndef REGEX_PARSER_H_
#define REGEX_PARSER_H_

#define REGEX_MAX_LINELENGTH           2048

#include <sys/types.h>
#include <stdbool.h>
#include <regex.h>
#include "string_list.h"

typedef struct {
  string_list_t* pattern_list; /* even entries: start ; odd entries: end */
  regex_t** compiled_patterns;
  unsigned int pattern_match; /* save position of end pattern to match -
                                 NULL when a start pattern shall match first */
  unsigned int matched_lines;
} regex_parser_t;

#ifdef _cplusplus
extern "C" {
#endif

regex_parser_t* new_regex_parser_t();
void destroy_regex_parser_t(regex_parser_t*);

bool regex_parser_matching(regex_parser_t*);
void regex_compile_all(regex_parser_t*);

#ifdef _cplusplus
}
#endif

#endif /* REGEX_PARSER_H_ */

mercurial