2 * Copyright (C) 1994-1999, Index Data
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.9 1999-05-26 07:49:12 adam
10 * Revision 1.8 1999/02/02 14:50:06 adam
11 * Updated WIN32 code specific sections. Changed header.
13 * Revision 1.7 1997/09/29 09:05:17 adam
14 * Thread safe DFA module. We simply had to put a few static vars to
15 * the DFA_parse structure.
17 * Revision 1.6 1997/09/18 08:59:17 adam
18 * Extra generic handle for the character mapping routines.
20 * Revision 1.5 1997/09/05 15:29:58 adam
21 * Changed prototype for chr_map_input - added const.
22 * Added support for C++, headers uses extern "C" for public definitions.
24 * Revision 1.4 1996/06/04 10:20:03 adam
25 * Added support for character mapping.
27 * Revision 1.3 1996/01/08 09:09:19 adam
28 * Function dfa_parse got 'const' string argument.
29 * New functions to define char mappings made public.
31 * Revision 1.2 1995/01/25 11:30:50 adam
32 * Simple error reporting when parsing regular expressions.
33 * Memory usage reduced.
35 * Revision 1.1 1995/01/24 16:02:53 adam
36 * New private header file in dfa module (dfap.h).
37 * Module no longer uses yacc to parse regular expressions.
51 struct Tnode *root; /* root of regular syntax tree */
52 int position; /* no of positions so far */
53 int rule; /* no of rules so far */
54 BSetHandle *charset; /* character set type */
55 BSet anyset; /* character recognized by `.' */
56 int use_Tnode; /* used Tnodes */
57 int max_Tnode; /* allocated Tnodes */
58 struct Tblock *start; /* start block of Tnodes */
59 struct Tblock *end; /* end block of Tnodes */
69 const unsigned char *expr_ptr;
76 const char **(*cmap)(void *vp, const char **from, int len);
79 typedef struct DFA_stateb_ {
80 struct DFA_stateb_ *next;
81 struct DFA_state *state_block;
85 struct DFA_state *freelist; /* chain of unused (but allocated) states */
86 struct DFA_state *unmarked; /* chain of unmarked DFA states */
87 struct DFA_state *marked; /* chain of marked DFA states */
88 DFA_stateb *statemem; /* state memory */
89 int no; /* no of states (unmarked+marked) */
90 SetType st; /* Position set type */
91 int hash; /* no hash entries in hasharray */
92 struct DFA_state **hasharray; /* hash pointers */
93 struct DFA_state **sortarray; /* sorted DFA states */
94 struct DFA_trans *transmem; /* transition memory */
97 int init_DFA_states (struct DFA_states **dfasp, SetType st, int hash);
98 int rm_DFA_states (struct DFA_states **dfasp);
99 int add_DFA_state (struct DFA_states *dfas, Set *s,
100 struct DFA_state **sp);
101 struct DFA_state *get_DFA_state (struct DFA_states *dfas);
102 void sort_DFA_states (struct DFA_states *dfas);
103 void add_DFA_tran (struct DFA_states *, struct DFA_state *,