2 * Copyright (C) 1994-1997, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.5 1997-09-05 15:29:58 adam
8 * Changed prototype for chr_map_input - added const.
9 * Added support for C++, headers uses extern "C" for public definitions.
11 * Revision 1.4 1996/06/04 10:20:03 adam
12 * Added support for character mapping.
14 * Revision 1.3 1996/01/08 09:09:19 adam
15 * Function dfa_parse got 'const' string argument.
16 * New functions to define char mappings made public.
18 * Revision 1.2 1995/01/25 11:30:50 adam
19 * Simple error reporting when parsing regular expressions.
20 * Memory usage reduced.
22 * Revision 1.1 1995/01/24 16:02:53 adam
23 * New private header file in dfa module (dfap.h).
24 * Module no longer uses yacc to parse regular expressions.
34 struct Tnode *root; /* root of regular syntax tree */
35 int position; /* no of positions so far */
36 int rule; /* no of rules so far */
37 BSetHandle *charset; /* character set type */
38 BSet anyset; /* character recognized by `.' */
39 int use_Tnode; /* used Tnodes */
40 int max_Tnode; /* allocated Tnodes */
41 struct Tblock *start; /* start block of Tnodes */
42 struct Tblock *end; /* end block of Tnodes */
45 const char **(*cmap)(const char **from, int len);
48 typedef struct DFA_stateb_ {
49 struct DFA_stateb_ *next;
50 struct DFA_state *state_block;
54 struct DFA_state *freelist; /* chain of unused (but allocated) states */
55 struct DFA_state *unmarked; /* chain of unmarked DFA states */
56 struct DFA_state *marked; /* chain of marked DFA states */
57 DFA_stateb *statemem; /* state memory */
58 int no; /* no of states (unmarked+marked) */
59 SetType st; /* Position set type */
60 int hash; /* no hash entries in hasharray */
61 struct DFA_state **hasharray; /* hash pointers */
62 struct DFA_state **sortarray; /* sorted DFA states */
63 struct DFA_trans *transmem; /* transition memory */
66 int init_DFA_states (struct DFA_states **dfasp, SetType st, int hash);
67 int rm_DFA_states (struct DFA_states **dfasp);
68 int add_DFA_state (struct DFA_states *dfas, Set *s,
69 struct DFA_state **sp);
70 struct DFA_state *get_DFA_state (struct DFA_states *dfas);
71 void sort_DFA_states (struct DFA_states *dfas);
72 void add_DFA_tran (struct DFA_states *, struct DFA_state *,