is_pir_directive
- Returns a non-zero value if the specified name is a PIR directive.
- */ static int is_pir_directive(char *name) {
/* maybe make this a hash or at least a binary search.
* Or, make these "special" macros, and have them expand
* to their own spelling. This would remove the need
* for special code, such as this.
*/
static char * const directives[] = {
".arg",
".begin_call",
".begin_return",
".begin_yield",
".call",
".const",
".end",
".end_call",
".end_return",
".end_yield",
".get_results",
".globalconst",
".HLL",
".HLL_map",
".invocant",
".lex",
".loadlib",
".local",
".meth_call",
".namespace",
".nci_call",
".param",
".return",
".sub",
".yield",
NULL /* needed to easily write loops on this array */
};
/* iter is a pointer to constant "char *" (strings). */
char * const *iter = directives;
while (*iter != NULL) {
if (strcmp(*iter, name) == 0) {
return 1;
}
iter++;
}
return 0;
}
- /*