]>
Commit | Line | Data |
---|---|---|
053a78b2 | 1 | /* $Header$ |
2 | * Constants and structures for TOPS-20 style parser | |
3 | * | |
4 | */ | |
5 | ||
6 | /* type codes for nodes & return values in parse tree */ | |
7 | #define NONE 0 | |
8 | #define KEYWORD 1 | |
9 | #define INTEGER 2 | |
10 | #define STRING 3 | |
11 | #define ADDRESS 4 | |
12 | #define PROC 5 | |
13 | #define ERROR 6 | |
14 | #define EXIT 7 | |
15 | #define ABORT 8 | |
16 | ||
17 | ||
18 | /* return codes from single_parse */ | |
19 | #define OK 0 | |
20 | #define MATCH 1 /* exact match found */ | |
21 | #define INCOMP 2 /* incomplete field */ | |
22 | #define AMBIG 3 /* ambiguous response */ | |
23 | #define NOMATCH 4 /* no match */ | |
24 | ||
25 | ||
26 | /* maximum line length for parser */ | |
27 | #define BUFLEN 128 | |
28 | ||
29 | /* the nodes which make up the parse tree */ | |
30 | ||
31 | struct parse_node { | |
32 | char *p_word; /* keyword, data description */ | |
33 | MenuItem *p_menu; /* MMoira menu entry for this command */ | |
34 | struct parse_node *p_peer; /* next node this level */ | |
35 | struct parse_node *p_next; /* next level nodes */ | |
36 | struct parse_node *p_link; /* for temporary chains */ | |
37 | }; | |
38 | ||
39 | ||
40 | #define NULNODE ((struct parse_node *) 0) | |
41 | ||
42 | ||
43 | /* this structure is used for collecting data to pass to parse functions */ | |
44 | ||
45 | #define pval struct pvalst | |
46 | ||
47 | pval { | |
48 | char *p_dat; /* data value or pointer */ | |
49 | int p_free; /* size of data to free */ | |
50 | }; | |
51 | ||
52 | /* how many return values are allowed in a single parse */ | |
53 | #define PMAXDAT 8 |