Function dfa_parse got 'const' string argument.
[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.3  1996-01-08 09:09:19  adam
8  * Function dfa_parse got 'const' string argument.
9  * New functions to define char mappings made public.
10  *
11  * Revision 1.2  1995/01/25  11:30:50  adam
12  * Simple error reporting when parsing regular expressions.
13  * Memory usage reduced.
14  *
15  * Revision 1.1  1995/01/24  16:02:53  adam
16  * New private header file in dfa module (dfap.h).
17  * Module no longer uses yacc to parse regular expressions.
18  *
19  */
20
21 #ifndef DFAP_H
22 #define DFAP_H
23
24 #include <dfa.h>
25
26 struct DFA_parse {
27     struct Tnode *root;       /* root of regular syntax tree */
28     int position;             /* no of positions so far */
29     int rule;                 /* no of rules so far */
30     BSetHandle *charset;      /* character set type */
31     BSet anyset;              /* character recognized by `.' */
32     int use_Tnode;            /* used Tnodes */
33     int max_Tnode;            /* allocated Tnodes */
34     struct Tblock *start;     /* start block of Tnodes */
35     struct Tblock *end;       /* end block of Tnodes */
36     int *charMap;
37     int charMapSize;
38 };
39
40 typedef struct DFA_stateb_ {
41     struct DFA_stateb_ *next;
42     struct DFA_state *state_block;
43 } DFA_stateb;
44
45 struct DFA_states {
46     struct DFA_state *freelist;   /* chain of unused (but allocated) states */
47     struct DFA_state *unmarked;   /* chain of unmarked DFA states */
48     struct DFA_state *marked;     /* chain of marked DFA states */
49     DFA_stateb *statemem;         /* state memory */
50     int no;                       /* no of states (unmarked+marked) */
51     SetType st;                   /* Position set type */
52     int hash;                     /* no hash entries in hasharray */
53     struct DFA_state **hasharray; /* hash pointers */
54     struct DFA_state **sortarray; /* sorted DFA states */
55     struct DFA_trans *transmem;   /* transition memory */
56 };
57
58 int         init_DFA_states (struct DFA_states **dfasp, SetType st, int hash);
59 int         rm_DFA_states   (struct DFA_states **dfasp);
60 int         add_DFA_state   (struct DFA_states *dfas, Set *s,
61                              struct DFA_state **sp);
62 struct DFA_state *get_DFA_state  (struct DFA_states *dfas);
63 void        sort_DFA_states (struct DFA_states *dfas);
64 void        add_DFA_tran    (struct DFA_states *, struct DFA_state *,
65                              int, int, int);
66
67 #endif