IDMETA and mk_version.tcl part of Windows package
[idzebra-moved-to-github.git] / dfa / dfap.h
1 /* This file is part of the Zebra server.
2    Copyright (C) 1994-2011 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;
42     int charMapSize;
43     void *cmap_data;
44
45     unsigned look_ch;
46     int lookahead;
47     BSet look_chars;
48     int err_code;
49     int inside_string;
50     const unsigned char *expr_ptr;
51
52     struct Tnode **posar;
53
54     DFASetType poset;
55     DFASet *followpos;
56
57     const char **(*cmap)(void *vp, const char **from, int len);
58 };
59
60 typedef struct DFA_stateb_ {
61     struct DFA_stateb_ *next;
62     struct DFA_state *state_block;
63 } DFA_stateb;
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