New private header file in dfa module (dfap.h).
[idzebra-moved-to-github.git] / dfa / dfap.h
1 /*
2  * Copyright (C) 1994, Index Data I/S 
3  * All rights reserved.
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Log: dfap.h,v $
7  * Revision 1.1  1995-01-24 16:02:53  adam
8  * New private header file in dfa module (dfap.h).
9  * Module no longer uses yacc to parse regular expressions.
10  *
11  */
12
13 #ifndef DFAP_H
14 #define DFAP_H
15
16 #include <dfa.h>
17
18 struct DFA_parse {
19     struct Tnode *root;       /* root of regular syntax tree */
20     struct Tnode *top;        /* regular tree top (returned by parse_dfa) */
21     int position;             /* no of positions so far */
22     int rule;                 /* no of rules so far */
23     BSetHandle *charset;      /* character set type */
24     BSet anyset;              /* character recognized by `.' */
25     int use_Tnode;            /* used Tnodes */
26     int max_Tnode;            /* allocated Tnodes */
27     struct Tblock *start;     /* start block of Tnodes */
28     struct Tblock *end;       /* end block of Tnodes */
29 };
30
31 typedef struct DFA_stateb_ {
32     struct DFA_stateb_ *next;
33     struct DFA_state *state_block;
34 } DFA_stateb;
35
36 struct DFA_states {
37     struct DFA_state *freelist;   /* chain of unused (but allocated) states */
38     struct DFA_state *unmarked;   /* chain of unmarked DFA states */
39     struct DFA_state *marked;     /* chain of marked DFA states */
40     DFA_stateb *statemem;         /* state memory */
41     int no;                       /* no of states (unmarked+marked) */
42     SetType st;                   /* Position set type */
43     int hash;                     /* no hash entries in hasharray */
44     struct DFA_state **hasharray; /* hash pointers */
45     struct DFA_state **sortarray; /* sorted DFA states */
46     struct DFA_trans *transmem;   /* transition memory */
47 };
48
49 int         init_DFA_states (struct DFA_states **dfasp, SetType st, int hash);
50 int         rm_DFA_states   (struct DFA_states **dfasp);
51 int         add_DFA_state   (struct DFA_states *dfas, Set *s,
52                              struct DFA_state **sp);
53 struct DFA_state *get_DFA_state  (struct DFA_states *dfas);
54 void        sort_DFA_states (struct DFA_states *dfas);
55 void        add_DFA_tran    (struct DFA_states *, struct DFA_state *,
56                              int, int, int);
57
58 #endif