1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
|
/* -*- buffer-read-only: t -*- vi: set ro:
*
* DO NOT EDIT THIS FILE (functions.h)
*
* It has been AutoGen-ed
* From the definitions functions.def
* and the template file functions.tpl
*
* Tables of Text Functions for AutoGen
*
* copyright (c) 1992-2012 by Bruce Korb - all rights reserved
*
* AutoGen is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AutoGen is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*
* The 24 AutoGen macros are tagged with special attributes:
*
* A - is invoked via an alias
*
* U - is unnamed. May *not* be explicitly invoked. May not have
* have an alias. These three are used by AutoGen for its purposes.
*
* L - has a special load procedure defined
*
* C - in context. May be explicitly invoked in certain situations.
* For example, "ELSE" may only be specified within an "IF" block.
* Their load procedures are enabled by the block macro (e.g. IF),
* and disabled by the block ending macro (e.g. ENDIF).
* While disabled, the load procedure is the "Bogus" method.
*
* If a function is neither has a special load procedure nor is
* situational, then the "Unknown" load method is applied.
*
* R - has a special remove (unload) procedure
*
* H - has a handler procedure defined. Only these procedures should
* be encountered by the dispatcher during processing.
*
* U L H - BOGUS Out-of-context or unknown functions are bogus.
* L H - BREAK Leave a FOR or WHILE macro
* L H - CASE Select one of several template blocks
* A L - COMMENT A block of comment to be ignored
* L H - CONTINUE Skip to end of a FOR or WHILE macro.
* L H - DEBUG Print debug message to trace output
* L RH - DEFINE Define a user AutoGen macro
* C - ELIF Alternate Conditional Template Block
* C - ELSE Alternate Template Block
* C - ENDDEF Ends a macro definition.
* C - ENDFOR Terminates the @code{FOR} function template block
* C - ENDIF Terminate the @code{IF} Template Block
* C - ENDWHILE Terminate the @code{WHILE} Template Block
* C - ESAC Terminate the @code{CASE} Template Block
* A L H - EXPR Evaluate and emit an Expression
* L H - FOR Emit a template block multiple times
* L H - IF Conditionally Emit a Template Block
* L H - INCLUDE Read in and emit a template block
* H - INVOKE Invoke a User Defined Macro
* L H - RETURN Leave an INVOKE-d (DEFINE) macro
* A C R - SELECT Selection block for CASE function
* U H - TEXT A block of text to be emitted.
* U L H - UNKNOWN Either a user macro or a value name.
* L H - WHILE Conditionally loop over a Template Block
*/
#ifndef AUTOGEN_FUNCTIONS_H_GUARD
#define AUTOGEN_FUNCTIONS_H_GUARD 1
#define FUNC_CT 24
/**
* Enumerate all the AutoGen macro types.
*/
typedef enum {
FTYP_BOGUS, /* Out-of-context or unknown functions are bogus. */
FTYP_BREAK, /* Leave a FOR or WHILE macro */
FTYP_CASE, /* Select one of several template blocks */
FTYP_COMMENT, /* A block of comment to be ignored */
FTYP_CONTINUE, /* Skip to end of a FOR or WHILE macro. */
FTYP_DEBUG, /* Print debug message to trace output */
FTYP_DEFINE, /* Define a user AutoGen macro */
FTYP_ELIF, /* Alternate Conditional Template Block */
FTYP_ELSE, /* Alternate Template Block */
FTYP_ENDDEF, /* Ends a macro definition. */
FTYP_ENDFOR, /* Terminates the @code{FOR} function template block */
FTYP_ENDIF, /* Terminate the @code{IF} Template Block */
FTYP_ENDWHILE, /* Terminate the @code{WHILE} Template Block */
FTYP_ESAC, /* Terminate the @code{CASE} Template Block */
FTYP_EXPR, /* Evaluate and emit an Expression */
FTYP_FOR, /* Emit a template block multiple times */
FTYP_IF, /* Conditionally Emit a Template Block */
FTYP_INCLUDE, /* Read in and emit a template block */
FTYP_INVOKE, /* Invoke a User Defined Macro */
FTYP_RETURN, /* Leave an INVOKE-d (DEFINE) macro */
FTYP_SELECT, /* Selection block for CASE function */
FTYP_TEXT, /* A block of text to be emitted. */
FTYP_UNKNOWN, /* Either a user macro or a value name. */
FTYP_WHILE, /* Conditionally loop over a Template Block */
FTYP_SELECT_COMPARE_FULL = 0x8000, /* *==* */
FTYP_SELECT_COMPARE_SKP_START = 0x8001, /* *== */
FTYP_SELECT_COMPARE_SKP_END = 0x8002, /* ==* */
FTYP_SELECT_COMPARE = 0x8003, /* == */
FTYP_SELECT_EQUIVALENT_FULL = 0x8004, /* *=* */
FTYP_SELECT_EQUIVALENT_SKP_START = 0x8005, /* *= */
FTYP_SELECT_EQUIVALENT_SKP_END = 0x8006, /* =* */
FTYP_SELECT_EQUIVALENT = 0x8007, /* = */
FTYP_SELECT_MATCH_FULL = 0x8008, /* *~~* */
FTYP_SELECT_MATCH_SKP_START = 0x8009, /* *~~ */
FTYP_SELECT_MATCH_SKP_END = 0x800A, /* ~~* */
FTYP_SELECT_MATCH = 0x800B, /* ~~ */
FTYP_SELECT_EQV_MATCH_FULL = 0x800C, /* *~* */
FTYP_SELECT_EQV_MATCH_SKP_START = 0x800D, /* *~ */
FTYP_SELECT_EQV_MATCH_SKP_END = 0x800E, /* ~* */
FTYP_SELECT_EQV_MATCH = 0x800F, /* ~ */
FTYP_SELECT_MATCH_ANYTHING = 0x801C, /* * */
FTYP_SELECT_MATCH_EXISTENCE = 0x801D, /* +E */
FTYP_SELECT_MATCH_NONEXISTENCE = 0x801E /* !E */
} mac_func_t;
/**
* The function processing procedures.
*/
hdlr_proc_t
mFunc_Bogus, mFunc_Break, mFunc_Case, mFunc_Debug, mFunc_Define,
mFunc_Expr, mFunc_For, mFunc_If, mFunc_Include, mFunc_Invoke,
mFunc_Return, mFunc_Text, mFunc_Unknown, mFunc_While;
/**
* Template Loading Functions.
*/
load_proc_t
mLoad_Bogus, mLoad_Case, mLoad_Comment, mLoad_Debug, mLoad_Define,
mLoad_Ending, mLoad_Expr, mLoad_For, mLoad_If, mLoad_Leave,
mLoad_Unknown, mLoad_While;
/* tpParse.c use only * * * * * * * * * * * * * * * */
/**
* Parsing function tables for load processing (template scanning phase).
*/
static load_proc_p_t const base_load_table[ FUNC_CT ] = {
/* BOGUS */ mLoad_Bogus,
/* BREAK */ mLoad_Leave,
/* CASE */ mLoad_Case,
/* COMMENT */ mLoad_Comment,
/* CONTINUE */ mLoad_Leave,
/* DEBUG */ mLoad_Debug,
/* DEFINE */ mLoad_Define,
/* ELIF */ mLoad_Bogus /*dynamic*/,
/* ELSE */ mLoad_Bogus /*dynamic*/,
/* ENDDEF */ mLoad_Bogus /*dynamic*/,
/* ENDFOR */ mLoad_Bogus /*dynamic*/,
/* ENDIF */ mLoad_Bogus /*dynamic*/,
/* ENDWHILE */ mLoad_Bogus /*dynamic*/,
/* ESAC */ mLoad_Bogus /*dynamic*/,
/* EXPR */ mLoad_Expr,
/* FOR */ mLoad_For,
/* IF */ mLoad_If,
/* INCLUDE */ mLoad_Expr,
/* INVOKE */ mLoad_Unknown /*default*/,
/* RETURN */ mLoad_Leave,
/* SELECT */ mLoad_Bogus /*dynamic*/,
/* TEXT */ mLoad_Unknown /*default*/,
/* UNKNOWN */ mLoad_Unknown,
/* WHILE */ mLoad_While
};
/**
* This global pointer is used to switch parsing tables.
* The block functions (CASE, DEFINE, FOR, and IF) change this to point
* to their tables that include relevant additional functions.
*/
load_proc_p_t const * load_proc_table = base_load_table;
/**
* name-to-function type mapping table.
* This table must be sorted alphabetically by the content
* of the naming string.
*/
typedef struct fn_name_type fn_name_type_t;
struct fn_name_type {
size_t cmpLen; /*!< compare length (sans NUL) */
char const * pName; /*!< ptr to name */
mac_func_t fType; /*!< function type enum */
};
/**
* Define all the strings that are used to determine the function enumeration
* number. These are used in a table separated by aliases and sorted by these
* ASCII values.
*/
static char const zFnStrg[142] =
"BREAK\0" "CASE\0" "#\0" "CONTINUE\0" "DEBUG\0"
"DEFINE\0" "ELIF\0" "ELSE\0" "ENDDEF\0" "ENDFOR\0"
"ENDIF\0" "ENDWHILE\0" "ESAC\0" "-\0" "?\0"
"%\0" ";\0" "(\0" "`\0" "\"\0"
"'\0" ".\0" "FOR\0" "IF\0" "INCLUDE\0"
"INVOKE\0" "RETURN\0" "~\0" "=\0" "*\0"
"!\0" "+\0" "WHILE\0";
/**
* The number of names by which the macros go.
* Some have multiple names (aliases, e.g. selection clauses).
*/
#define FUNC_ALIAS_LOW_INDEX 0
#define FUNC_ALIAS_HIGH_INDEX 14
#define FUNC_NAMES_LOW_INDEX 15
#define FUNC_NAMES_HIGH_INDEX 32
#define FUNCTION_NAME_CT 33
/* * * * * * * * tpParse.c use only * * * * * * * * * * * * * * */
/**
* And now, the table separated by aliasing and then sorted by string content
*/
static fn_name_type_t const fn_name_types[ FUNCTION_NAME_CT ] = {
{ 1, zFnStrg +132, FTYP_SELECT },
{ 1, zFnStrg + 91, FTYP_EXPR },
{ 1, zFnStrg + 11, FTYP_COMMENT },
{ 1, zFnStrg + 83, FTYP_EXPR },
{ 1, zFnStrg + 93, FTYP_EXPR },
{ 1, zFnStrg + 87, FTYP_EXPR },
{ 1, zFnStrg +130, FTYP_SELECT },
{ 1, zFnStrg +134, FTYP_SELECT },
{ 1, zFnStrg + 79, FTYP_EXPR },
{ 1, zFnStrg + 95, FTYP_EXPR },
{ 1, zFnStrg + 85, FTYP_EXPR },
{ 1, zFnStrg +128, FTYP_SELECT },
{ 1, zFnStrg + 81, FTYP_EXPR },
{ 1, zFnStrg + 89, FTYP_EXPR },
{ 1, zFnStrg +126, FTYP_SELECT },
{ 5, zFnStrg + 0, FTYP_BREAK },
{ 4, zFnStrg + 6, FTYP_CASE },
{ 8, zFnStrg + 13, FTYP_CONTINUE },
{ 5, zFnStrg + 22, FTYP_DEBUG },
{ 6, zFnStrg + 28, FTYP_DEFINE },
{ 4, zFnStrg + 35, FTYP_ELIF },
{ 4, zFnStrg + 40, FTYP_ELSE },
{ 6, zFnStrg + 45, FTYP_ENDDEF },
{ 6, zFnStrg + 52, FTYP_ENDFOR },
{ 5, zFnStrg + 59, FTYP_ENDIF },
{ 8, zFnStrg + 65, FTYP_ENDWHILE },
{ 4, zFnStrg + 74, FTYP_ESAC },
{ 3, zFnStrg + 97, FTYP_FOR },
{ 2, zFnStrg +101, FTYP_IF },
{ 7, zFnStrg +104, FTYP_INCLUDE },
{ 6, zFnStrg +112, FTYP_INVOKE },
{ 6, zFnStrg +119, FTYP_RETURN },
{ 5, zFnStrg +136, FTYP_WHILE } };
static char const * const ag_fun_names[ FUNC_CT ] = {
"Bogus", zFnStrg+0, zFnStrg+6, "COMMENT", zFnStrg+13,
zFnStrg+22, zFnStrg+28, zFnStrg+35, zFnStrg+40, zFnStrg+45,
zFnStrg+52, zFnStrg+59, zFnStrg+65, zFnStrg+74, "EXPR",
zFnStrg+97, zFnStrg+101, zFnStrg+104, zFnStrg+112, zFnStrg+119,
"SELECT", "Text", "Unknown", zFnStrg+136 };
/* * * * * * * * tpProcess.c use only * * * * * * * * * * * * * */
/**
* Template Processing Function Table
*
* Pointers to the procedure to call when the function code
* is encountered.
*/
static hdlr_proc_p_t const load_procs[ FUNC_CT ] = {
/* BOGUS */ mFunc_Bogus,
/* BREAK */ mFunc_Break,
/* CASE */ mFunc_Case,
/* COMMENT */ mFunc_Bogus,
/* CONTINUE */ mFunc_Break,
/* DEBUG */ mFunc_Debug,
/* DEFINE */ mFunc_Define,
/* ELIF */ mFunc_Bogus,
/* ELSE */ mFunc_Bogus,
/* ENDDEF */ mFunc_Bogus,
/* ENDFOR */ mFunc_Bogus,
/* ENDIF */ mFunc_Bogus,
/* ENDWHILE */ mFunc_Bogus,
/* ESAC */ mFunc_Bogus,
/* EXPR */ mFunc_Expr,
/* FOR */ mFunc_For,
/* IF */ mFunc_If,
/* INCLUDE */ mFunc_Include,
/* INVOKE */ mFunc_Invoke,
/* RETURN */ mFunc_Return,
/* SELECT */ mFunc_Bogus,
/* TEXT */ mFunc_Text,
/* UNKNOWN */ mFunc_Unknown,
/* WHILE */ mFunc_While
};
/* * * * * * * * * * tpLoad.c use only * * * * * * * * * * * * * */
/**
* Template Unloading Function Table
*
* Pointers to the procedure to call when the function code
* is encountered in a template being unloaded.
*/
unload_proc_t mUnload_Define, mUnload_Select;
static unload_proc_p_t const unload_procs[ FUNC_CT ] = {
NULL, NULL, NULL, NULL,
NULL, NULL, mUnload_Define, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
mUnload_Select, NULL, NULL, NULL
};
#define FUNCTION_CKSUM ((unsigned short)0x22FE)
#endif /* AUTOGEN_FUNCTIONS_H_GUARD */
/* functions.h ends here */
|