IDZEBRA  2.2.7
dfap.h
Go to the documentation of this file.
1 /* This file is part of the Zebra server.
2  Copyright (C) Index Data
3 
4 Zebra is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
7 version.
8 
9 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 for more details.
13 
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 
18 */
19 
20 
21 
22 #ifndef DFAP_H
23 #define DFAP_H
24 
25 #include <dfa.h>
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 struct DFA_parse {
32  struct Tnode *root; /* root of regular syntax tree */
33  int position; /* no of positions so far */
34  int rule; /* no of rules so far */
35  BSetHandle *charset; /* character set type */
36  BSet anyset; /* character recognized by `.' */
37  int use_Tnode; /* used Tnodes */
38  int max_Tnode; /* allocated Tnodes */
39  struct Tblock *start; /* start block of Tnodes */
40  struct Tblock *end; /* end block of Tnodes */
41  int *charMap;
43  void *cmap_data;
44 
45  unsigned look_ch;
46  int lookahead;
48  int err_code;
50  const unsigned char *expr_ptr;
51 
52  struct Tnode **posar;
53 
56 
57  const char **(*cmap)(void *vp, const char **from, int len);
58 };
59 
60 typedef struct DFA_stateb_ {
61  struct DFA_stateb_ *next;
64 
65 struct DFA_states {
66  struct DFA_state *freelist; /* chain of unused (but allocated) states */
67  struct DFA_state *unmarked; /* chain of unmarked DFA states */
68  struct DFA_state *marked; /* chain of marked DFA states */
69  DFA_stateb *statemem; /* state memory */
70  int no; /* no of states (unmarked+marked) */
71  DFASetType st; /* Position set type */
72  int hash; /* no hash entries in hasharray */
73  struct DFA_state **hasharray; /* hash pointers */
74  struct DFA_state **sortarray; /* sorted DFA states */
75  struct DFA_trans *transmem; /* transition memory */
76 };
77 
78 int init_DFA_states (struct DFA_states **dfasp, DFASetType st, int hash);
79 int rm_DFA_states (struct DFA_states **dfasp);
80 int add_DFA_state (struct DFA_states *dfas, DFASet *s,
81  struct DFA_state **sp);
82 struct DFA_state *get_DFA_state (struct DFA_states *dfas);
83 void sort_DFA_states (struct DFA_states *dfas);
84 void add_DFA_tran (struct DFA_states *, struct DFA_state *,
85  int, int, int);
86 
87 #ifdef __cplusplus
88 }
89 #endif
90 #endif
91 /*
92  * Local variables:
93  * c-basic-offset: 4
94  * c-file-style: "Stroustrup"
95  * indent-tabs-mode: nil
96  * End:
97  * vim: shiftwidth=4 tabstop=8 expandtab
98  */
99 
BSetWord * BSet
Definition: bset.h:28
struct DFA_stateb_ DFA_stateb
void sort_DFA_states(struct DFA_states *dfas)
Definition: states.c:188
void add_DFA_tran(struct DFA_states *, struct DFA_state *, int, int, int)
Definition: states.c:144
int rm_DFA_states(struct DFA_states **dfasp)
Definition: states.c:70
struct DFA_state * get_DFA_state(struct DFA_states *dfas)
Definition: states.c:174
int add_DFA_state(struct DFA_states *dfas, DFASet *s, struct DFA_state **sp)
Definition: states.c:98
int init_DFA_states(struct DFA_states **dfasp, DFASetType st, int hash)
Definition: states.c:36
static struct strmap_entry ** hash(zebra_strmap_t st, const char *name)
Definition: strmap.c:70
Definition: dfap.h:31
int rule
Definition: dfap.h:34
BSet anyset
Definition: dfap.h:36
int max_Tnode
Definition: dfap.h:38
struct Tnode * root
Definition: dfap.h:32
unsigned look_ch
Definition: dfap.h:45
int charMapSize
Definition: dfap.h:42
BSet look_chars
Definition: dfap.h:47
int lookahead
Definition: dfap.h:46
int err_code
Definition: dfap.h:48
struct Tblock * start
Definition: dfap.h:39
BSetHandle * charset
Definition: dfap.h:35
int position
Definition: dfap.h:33
int * charMap
Definition: dfap.h:41
DFASet * followpos
Definition: dfap.h:55
DFASetType poset
Definition: dfap.h:54
struct Tnode ** posar
Definition: dfap.h:52
int inside_string
Definition: dfap.h:49
struct Tblock * end
Definition: dfap.h:40
void * cmap_data
Definition: dfap.h:43
const unsigned char * expr_ptr
Definition: dfap.h:50
int use_Tnode
Definition: dfap.h:37
Definition: dfa.h:42
struct DFA_state * state_block
Definition: dfap.h:62
struct DFA_stateb_ * next
Definition: dfap.h:61
struct DFA_state * unmarked
Definition: dfap.h:67
int no
Definition: dfap.h:70
struct DFA_trans * transmem
Definition: dfap.h:75
struct DFA_state * freelist
Definition: dfap.h:66
struct DFA_state ** hasharray
Definition: dfap.h:73
DFA_stateb * statemem
Definition: dfap.h:69
struct DFA_state ** sortarray
Definition: dfap.h:74
struct DFA_state * marked
Definition: dfap.h:68
int hash
Definition: dfap.h:72
DFASetType st
Definition: dfap.h:71
Definition: dfa.h:35
Definition: dfa.c:57
Definition: dfa.c:43