Mercurial > ~dholland > hg > ag > index.cgi
comparison anagram/agcore/config.cpp @ 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 * config.cpp | |
7 */ | |
8 | |
9 #include "agstring.h" | |
10 #include "config.h" | |
11 #include "configparam.h" | |
12 | |
13 //#define INCLUDE_LOGGING | |
14 #include "log.h" | |
15 | |
16 | |
17 #ifdef AG_ON_UNIX | |
18 #define ALL_MASK "*" | |
19 #endif | |
20 | |
21 #ifdef AG_ON_WINDOWS | |
22 #define ALL_MASK "*.*" | |
23 #endif | |
24 | |
25 #ifdef AG_ON_AMIGA | |
26 #define ALL_MASK "#?" | |
27 #endif | |
28 | |
29 //////////////////////////////////////////////////////////// | |
30 | |
31 #undef INTEGER_PARAM | |
32 #undef STRING_PARAM | |
33 #undef SWITCH | |
34 #undef DICT_PARAM | |
35 #undef TOKEN_PARAM | |
36 #undef TEXT_PARAM | |
37 | |
38 #define INTEGER_PARAM(txt,nm) static IntegerParam nm##Param(txt,nm); int nm | |
39 #define STRING_PARAM(txt, nm) static StringParam nm##Param(txt,nm);AgString nm | |
40 #define SWITCH(txt, nm) static ConfigSwitch nm##Param(txt,nm); int nm | |
41 #define CAST_PARAM(txt, nm) static CastParam nm##Param(txt,nm); int nm | |
42 #define TOKEN_PARAM(txt, nm) static TokenParam nm##Param(txt,nm); int nm | |
43 #define TEXT_PARAM(txt, nm) static TextParam nm##Param(txt,nm);AgString nm | |
44 | |
45 SWITCH ("allow macros", allow_macros) = 1; | |
46 SWITCH ("auto init", auto_init) = 1; | |
47 SWITCH ("auto resynch", auto_resynch) = 0; | |
48 | |
49 SWITCH ("backtrack", backtrack) = 1; | |
50 INTEGER_PARAM("bottom margin", bottom_margin) = 3; | |
51 SWITCH ("bright background", bright_background) = 1; | |
52 | |
53 SWITCH ("case sensitive", case_sensitive) = 1; | |
54 STRING_PARAM ("compile command", compile_command) = ""; | |
55 SWITCH ("const data", const_data) = 1; | |
56 TEXT_PARAM ("context type", context_type) ; | |
57 STRING_PARAM ("coverage file name", coverage_file_name) = "#.nrc"; | |
58 | |
59 SWITCH ("declare pcb", declare_pcb) = 1; | |
60 CAST_PARAM ("default input type", default_input_type) ; | |
61 SWITCH ("default reductions", default_reductions) = 1; | |
62 CAST_PARAM ("default token type", default_token_type) ; | |
63 SWITCH ("diagnose errors", diagnose_errors) = 1; | |
64 SWITCH ("distinguish lexemes", distinguish_lexemes) = 0; | |
65 | |
66 STRING_PARAM ("edit command", edit_command) = "ed #.syn"; | |
67 SWITCH ("enable mouse", enable_mouse) = 1; | |
68 STRING_PARAM ("enum constant name", enum_constant_name) = "$_%_token"; | |
69 TOKEN_PARAM ("eof token", eof_token) = 0; | |
70 SWITCH ("error frame", error_frame) = 0; | |
71 TOKEN_PARAM ("error token", error_token) ; | |
72 SWITCH ("error trace", error_trace) = 0; | |
73 SWITCH ("escape backslashes", escape_backslashes) = 0; | |
74 SWITCH ("event driven", event_driven) = 0; | |
75 | |
76 SWITCH ("far tables", far_tables) = 0; | |
77 | |
78 TOKEN_PARAM ("grammar token", grammar_token) = 0; | |
79 | |
80 STRING_PARAM ("header file name", header_file_name) = "#.h"; | |
81 | |
82 SWITCH ("input values", input_values) = 0; | |
83 SWITCH ("iso latin 1", iso_latin_1) = 1; | |
84 | |
85 INTEGER_PARAM("line length", line_length) = 80; | |
86 SWITCH ("line numbers", line_numbers) = 0; | |
87 STRING_PARAM ("line numbers path", line_numbers_path) ; | |
88 SWITCH ("lines and columns", lines_and_columns) = 1; | |
89 | |
90 SWITCH ("main program", main_program) = 1; | |
91 INTEGER_PARAM("max conflicts", max_conflicts) = 50; | |
92 | |
93 SWITCH ("near functions", near_functions) = 0; | |
94 SWITCH ("nest comments", nest_comments) = 0; | |
95 SWITCH ("no cr", no_cr) = 0; | |
96 | |
97 SWITCH ("old style", old_style) = 0; | |
98 | |
99 INTEGER_PARAM("page length", page_length) = 66; | |
100 STRING_PARAM ("parser file name", parser_file_name) = "#.c"; | |
101 TEXT_PARAM ("parser name", parser_name) = "#"; | |
102 CAST_PARAM ("parser stack alignment", parser_stack_alignment) ; | |
103 INTEGER_PARAM("parser stack size", parser_stack_size) = 128; | |
104 SWITCH ("pointer input", pointer_input) = 0; | |
105 TEXT_PARAM ("pointer type", pointer_type) = "unsigned char *"; | |
106 STRING_PARAM ("print file name", print_file_name) = "LPT1"; | |
107 | |
108 SWITCH ("quick reference", quick_reference) = 0; | |
109 | |
110 SWITCH ("reduction choices", reduction_choices) = 0; | |
111 SWITCH ("reentrant parser", reentrant_parser) = 0; | |
112 SWITCH ("rule coverage", rule_coverage) = 0; | |
113 | |
114 INTEGER_PARAM("tab spacing", tab_spacing) = 8; | |
115 SWITCH ("test file binary", test_file_binary) = 0; | |
116 STRING_PARAM ("test file mask", test_file_mask) = ALL_MASK; | |
117 SWITCH ("test range", test_range) = 1; | |
118 SWITCH ("token names", token_names) = 0; | |
119 SWITCH ("token names only", token_names_only) = 0; | |
120 INTEGER_PARAM("top margin", top_margin) = 3; | |
121 SWITCH ("traditional engine", traditional_engine) = 0; | |
122 | |
123 INTEGER_PARAM("video mode", video_mode) = -1; | |
124 | |
125 //////////////////////////////////////////////////////////// | |
126 | |
127 #define PARAM_REF(name) &name##Param | |
128 | |
129 ConfigParam *ConfigParam::table[] = { | |
130 PARAM_REF(allow_macros), | |
131 PARAM_REF(auto_init), | |
132 PARAM_REF(auto_resynch), | |
133 | |
134 PARAM_REF(backtrack), | |
135 PARAM_REF(bottom_margin), | |
136 PARAM_REF(bright_background), | |
137 | |
138 PARAM_REF(case_sensitive), | |
139 PARAM_REF(compile_command), | |
140 PARAM_REF(const_data), | |
141 PARAM_REF(context_type), | |
142 PARAM_REF(coverage_file_name), | |
143 | |
144 PARAM_REF(declare_pcb), | |
145 PARAM_REF(default_input_type), | |
146 PARAM_REF(default_reductions), | |
147 PARAM_REF(default_token_type), | |
148 PARAM_REF(diagnose_errors), | |
149 PARAM_REF(distinguish_lexemes), | |
150 | |
151 PARAM_REF(edit_command), | |
152 PARAM_REF(enable_mouse), | |
153 PARAM_REF(enum_constant_name), | |
154 PARAM_REF(eof_token), | |
155 PARAM_REF(error_frame), | |
156 PARAM_REF(error_token), | |
157 PARAM_REF(error_trace), | |
158 PARAM_REF(escape_backslashes), | |
159 PARAM_REF(event_driven), | |
160 | |
161 PARAM_REF(far_tables), | |
162 | |
163 PARAM_REF(grammar_token), | |
164 | |
165 PARAM_REF(header_file_name), | |
166 | |
167 PARAM_REF(input_values), | |
168 PARAM_REF(iso_latin_1), | |
169 | |
170 PARAM_REF(line_length), | |
171 PARAM_REF(line_numbers), | |
172 PARAM_REF(line_numbers_path), | |
173 PARAM_REF(lines_and_columns), | |
174 | |
175 PARAM_REF(main_program), | |
176 PARAM_REF(max_conflicts), | |
177 | |
178 PARAM_REF(near_functions), | |
179 PARAM_REF(nest_comments), | |
180 PARAM_REF(no_cr), | |
181 | |
182 PARAM_REF(old_style), | |
183 | |
184 PARAM_REF(page_length), | |
185 PARAM_REF(parser_file_name), | |
186 PARAM_REF(parser_name), | |
187 PARAM_REF(parser_stack_alignment), | |
188 PARAM_REF(parser_stack_size), | |
189 PARAM_REF(pointer_input), | |
190 PARAM_REF(pointer_type), | |
191 PARAM_REF(print_file_name), | |
192 | |
193 PARAM_REF(quick_reference), | |
194 | |
195 PARAM_REF(reduction_choices), | |
196 PARAM_REF(reentrant_parser), | |
197 PARAM_REF(rule_coverage), | |
198 | |
199 PARAM_REF(tab_spacing), | |
200 PARAM_REF(test_file_binary), | |
201 PARAM_REF(test_file_mask), | |
202 PARAM_REF(test_range), | |
203 PARAM_REF(token_names), | |
204 PARAM_REF(token_names_only), | |
205 PARAM_REF(top_margin), | |
206 PARAM_REF(traditional_engine), | |
207 //PARAM_REF(trial_copy_code), | |
208 | |
209 PARAM_REF(video_mode), | |
210 }; | |
211 | |
212 int ConfigParam::paramCount = sizeof(ConfigParam::table)/sizeof(ConfigParam *); | |
213 | |
214 #ifdef __IBMCPP__ | |
215 #pragma define(Param<int>) | |
216 #pragma define(Param<AgString>) | |
217 #endif | |
218 | |
219 #ifdef _MSC_VER | |
220 template class Param<int>; | |
221 template class Param<AgString>; | |
222 #endif | |
223 | |
224 #ifdef __GNUC__ | |
225 template class Param<int>; | |
226 template class Param<AgString>; | |
227 #endif | |
228 | |
229 #ifdef __WATCOM_CPLUSPLUS__ | |
230 typedef Param<int> fake1; | |
231 template Param<AgString> fake2; | |
232 #endif | |
233 | |
234 #ifdef __BCPLUSPLUS__ | |
235 #pragma option -Jgd | |
236 typedef Param<int> fake1; | |
237 template Param<AgString> fake2; | |
238 #endif | |
239 |