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