-
Notifications
You must be signed in to change notification settings - Fork 101
Expand file tree
/
Copy pathregex_array.h
More file actions
64 lines (55 loc) · 1.67 KB
/
Copy pathregex_array.h
File metadata and controls
64 lines (55 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* -*-pgsql-c-*- */
/*
*
* pgpool: a language independent connection pool server for PostgreSQL
* written by Tatsuo Ishii
*
* Copyright (c) 2003-2014 PgPool Global Development Group
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby
* granted, provided that the above copyright notice appear in all
* copies and that both that copyright notice and this permission
* notice appear in supporting documentation, and that the name of the
* author not be used in advertising or publicity pertaining to
* distribution of the software without specific, written prior
* permission. The author makes no representations about the
* suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
*/
#ifndef REGEX_ARRAY_H
#define REGEX_ARRAY_H
#include <regex.h>
#define AR_ALLOC_UNIT 16
/*
* Regular expression array
*/
typedef struct
{
int size; /* regex array size */
int pos; /* next regex array index position */
regex_t **regex; /* regular expression array */
} RegArray;
RegArray *create_regex_array(void);
int add_regex_array(RegArray *ar, char *pattern);
int regex_array_match(RegArray *ar, char *pattern);
void destroy_regex_array(RegArray *ar);
/*
* String left-right token type
*/
typedef struct
{
char *left_token;
char *right_token;
double weight_token;
} Left_right_token;
typedef struct
{
int pos;
int size;
Left_right_token *token;
} Left_right_tokens;
Left_right_tokens *create_lrtoken_array(void);
void extract_string_tokens2(char *str, char *delimi, char delimi2, Left_right_tokens *lrtokens);
#endif