comparison anagram/guisupport/ws.h @ 0:13d2b8934445

Import AnaGram (near-)release tree into Mercurial.
author David A. Holland
date Sat, 22 Dec 2007 17:52:45 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:13d2b8934445
1 /*
2 * AnaGram, A System for Syntax Directed Programming
3 * Copyright 1993-2002 Parsifal Software. All Rights Reserved.
4 * See the file COPYING for license and usage terms.
5 *
6 * ws.h
7 */
8
9 #ifndef WS_H
10 #define WS_H
11
12 #include "agarray.h"
13 #include "dc.h"
14 #include "tsd.h"
15
16 int productions_window_ok(int);
17 dc_ref productions_window(int);
18 int token_usage_window_ok(unsigned);
19 dc_ref token_usage_window(unsigned);
20 dc_ref rule_context_window(int);
21 tsd *build_states_table(unsigned *, int);
22 dc_ref previous_states_window(int);
23 int previous_states_window_ok(int);
24 dc_ref conflict_state_window(unsigned);
25 int keywords_window_ok(int);
26 dc_ref keywords_window(int);
27 int reduction_states_window_ok(int, int);
28 dc_ref reduction_states_window(int, int, int);
29 // this appears to be spurious
30 //int reduction_states_window_ok(int, int, int);
31 tsd *make_stored_trace(int *trace, int depth, int tn);
32 dc_ref aux_trace_window(unsigned);
33 int token_set_window_ok(int);
34 dc_ref token_set_window(int);
35 int char_set_window_ok(int cs);
36 dc_ref char_set_window(int cs);
37
38 class productions_window_dc : public dc {
39 public:
40 unsigned token_number;
41
42 productions_window_dc(unsigned, const AgString);
43 productions_window_dc(productions_window_dc &x)
44 : dc(x), token_number(x.token_number) {}
45
46 virtual void getLine(unsigned) const;
47 virtual void synchCursor(unsigned) const;
48 };
49
50 class rule_list_dc : public dc {
51 public:
52 const AgArray<int> rule_list;
53
54 static MenuOption *auxTable[];
55 virtual MenuOption **getAuxWinMenu(void) {return auxTable;}
56
57 rule_list_dc(const AgArray<int>, const AgString, const AgString);
58 rule_list_dc(rule_list_dc &x)
59 : dc(x), rule_list(x.rule_list) {}
60
61 virtual unsigned token(unsigned);
62
63 virtual void getLine(unsigned) const;
64 virtual void synchCursor(unsigned) const;
65
66 virtual dc_ref expansion_rules(unsigned ln);
67 virtual dc_ref productions(unsigned ln);
68 virtual dc_ref rule_context(unsigned ln);
69 virtual dc_ref set_elements(unsigned ln);
70 virtual dc_ref usage(unsigned ln);
71
72 virtual int expansion_rules_ok(unsigned ln);
73 virtual int productions_ok(unsigned ln);
74 virtual int rule_context_ok(unsigned ln) {return ln != 0;}
75 virtual int set_elements_ok(unsigned ln);
76 virtual int usage_ok(unsigned ln);
77 };
78
79 class rule_context_dc : public rule_list_dc {
80 public:
81 rule_context_dc(const AgArray<int> list, const AgString foot)
82 : rule_list_dc(list, AgString("Rule Context"), foot)
83 {
84 }
85 };
86
87 class usage_dc : public rule_list_dc {
88 public:
89 usage_dc(const AgArray<int> list, const AgString foot)
90 : rule_list_dc(list, "Token Usage", foot)
91 {
92 }
93 };
94
95 class state_list_dc : public dc {
96 public:
97 tsd *state_list;
98 static MenuOption *auxTable[];
99 virtual MenuOption **getAuxWinMenu(void) {return auxTable;}
100
101 state_list_dc(const AgString, tsd*, const AgString);
102 state_list_dc(state_list_dc &x) : dc(x), state_list(x.state_list) {}
103 ~state_list_dc(void) {delete_tsd(state_list);}
104
105 virtual unsigned token(unsigned) const;
106 virtual unsigned rule(unsigned) const;
107 virtual unsigned state(unsigned) const;
108
109 virtual void getLine(unsigned) const;
110 virtual void synchCursor(unsigned) const;
111 virtual dc_ref aux_trace(unsigned ln) {
112 return aux_trace_window(state(ln));
113 }
114 virtual int expansion_rules_ok(unsigned);
115 virtual dc_ref expansion_rules(unsigned);
116 virtual int keywords_ok(unsigned ln) {
117 return keywords_window_ok(state(ln));
118 }
119 virtual dc_ref keywords(unsigned ln) {
120 return keywords_window(state(ln));
121 }
122 virtual int previous_states_ok(unsigned ln) {
123 return previous_states_window_ok(state(ln));
124 }
125 virtual dc_ref previous_states(unsigned ln) {
126 return previous_states_window(state(ln));
127 }
128 virtual int productions_ok(unsigned ln) {
129 return productions_window_ok(token(ln));
130 }
131 virtual dc_ref productions(unsigned ln) {
132 return productions_window(token(ln));
133 }
134 virtual int reduction_states_ok(unsigned);
135 virtual dc_ref reduction_states(unsigned);
136 virtual int rule_context_ok(unsigned ln) { return ln != 0; }
137 virtual dc_ref rule_context(unsigned);
138 virtual int set_elements_ok(unsigned);
139 virtual dc_ref set_elements(unsigned);
140 virtual dc_ref state_expansion(unsigned);
141 virtual int usage_ok(unsigned);
142 virtual dc_ref usage(unsigned);
143 };
144
145 class keywords_dc : public dc {
146 public:
147 static MenuOption *auxTable[];
148 virtual MenuOption **getAuxWinMenu(void) { return auxTable; }
149 unsigned *keyword_list;
150
151 keywords_dc(unsigned *, unsigned, const AgString);
152 keywords_dc(keywords_dc &x)
153 : dc(x), keyword_list(x.keyword_list) {}
154
155 virtual void getLine(unsigned) const;
156 //virtual dc_ref onCloneKey(void) { return new keywords_dc(*this); }
157
158 virtual dc_ref usage(unsigned);
159 virtual int usage_ok(unsigned);
160 };
161
162 #endif /* WS_H */