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