X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=src%2Fcommon%2Fconfig.h;fp=src%2Fcommon%2Fconfig.h;h=1e7583ed91a03fe1588bdfa97950ed3b4d8f2628;hb=6d657891a5410b7d93cc90f376a3ef27b72b20f6;hp=0000000000000000000000000000000000000000;hpb=9efbcb2400665aa3f54e51486e805711bec07587;p=tpg%2Fopendispense2.git diff --git a/src/common/config.h b/src/common/config.h new file mode 100644 index 0000000..1e7583e --- /dev/null +++ b/src/common/config.h @@ -0,0 +1,32 @@ +/* + * OpenDispense2 + * + * This code is published under the terms of the Acess licence. + * See the file COPYING for details. + * + * config.h - Config Header + */ +#ifndef _CONFIG_H_ +#define _CONFIG_H_ + +#include +extern void CompileRegex(regex_t *Regex, const char *Pattern, int Flags); +extern int RunRegex(regex_t *regex, const char *string, int nMatches, regmatch_t *matches, const char *errorMessage); + +// === HELPER MACROS === +#define _EXPSTR(x) #x +#define EXPSTR(x) _EXPSTR(x) + +#define ASSERT(cnd) do{if(!(cnd)){fprintf(stderr, "ASSERT failed at "__FILE__":"EXPSTR(__LINE__)" - "EXPSTR(cnd)"\n");exit(-1);}}while(0) + + + +// --- Config Database --- +extern void Config_ParseFile(const char *Filename); +extern void Config_AddValue(const char *Key, const char *Value); +extern int Config_GetValueCount(const char *KeyName); +extern const char *Config_GetValue(const char *KeyName, int Index); +extern int Config_GetValue_Bool(const char *KeyName, int Index); +extern int Config_GetValue_Int(const char *KeyName, int Index); + +#endif