40b7eafacdb27705e6f92636f8066a86c2be1c02 kent Sat Aug 17 10:55:43 2019 -0700 Adding warnHandler and abortHandler arguments to strexEvalAsString in preparation for implementing warn() and error() constructs. diff --git src/inc/strex.h src/inc/strex.h index 403700d..f0c9703 100644 --- src/inc/strex.h +++ src/inc/strex.h @@ -14,21 +14,25 @@ void *symbols, StrexLookup lookup); /* Parse out string expression in s and return root of tree. The fileName and * fileLineNumber are just used in the error message. Ideally they should help * the user navigate to where the problem was. * If symbols is non-null then it and lookup will be used together to complain * about missing variables rather than just generating empty strings when * they are referenced. */ struct strexParse *strexParseFile(char *fileName, void *symbols, StrexLookup lookup); /* Similar to strexParseString, but get input from a file rather than a string */ void strexParseDump(struct strexParse *p, int depth, FILE *f); /* Dump out strexParse tree and children for debugging. Usual depth is 0. */ /* Evaluating a parsed out strex expression */ -char *strexEvalAsString(struct strexParse *p, void *symbols, StrexLookup lookup); + +char *strexEvalAsString(struct strexParse *p, void *symbols, StrexLookup lookup, + void (*warnHandler)(char *warning), void (*abortHandler)() ); /* Evaluating a strex expression on a symbol table with a lookup function for variables and - * return result as a string value. */ + * return result as a string value. The warnHandler and abortHandler are optional, + * and can be used to wrap your own warnings and abort processing onto what strex + * provides. For default behavior just pass in NULL. */ #endif /* STREX_H */