regex_parser.h

Thu, 09 Feb 2012 15:56:18 +0100

author
Mike Becker <universe@uap-core.de>
date
Thu, 09 Feb 2012 15:56:18 +0100
changeset 30
d642fdb6745e
parent 28
72a98cbcb9f1
permissions
-rw-r--r--

allow parallel use of -s and -S

/*
 * 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;
  size_t compiled_pattern_count;
  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*);
bool regex_compile_all(regex_parser_t*);
int regex_parser_do(regex_parser_t*, char*);

#ifdef _cplusplus
}
#endif

#endif /* REGEX_PARSER_H_ */

mercurial