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