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