Initial move to common config code directory
[tpg/opendispense2.git] / src / common / config.h
1 /*
2  * OpenDispense2
3  *
4  * This code is published under the terms of the Acess licence.
5  * See the file COPYING for details.
6  *
7  * config.h - Config Header
8  */
9 #ifndef _CONFIG_H_
10 #define _CONFIG_H_
11
12 #include <regex.h>
13 extern void     CompileRegex(regex_t *Regex, const char *Pattern, int Flags);
14 extern int      RunRegex(regex_t *regex, const char *string, int nMatches, regmatch_t *matches, const char *errorMessage);
15
16 // === HELPER MACROS ===
17 #define _EXPSTR(x)      #x
18 #define EXPSTR(x)       _EXPSTR(x)
19
20 #define ASSERT(cnd) do{if(!(cnd)){fprintf(stderr, "ASSERT failed at "__FILE__":"EXPSTR(__LINE__)" - "EXPSTR(cnd)"\n");exit(-1);}}while(0)
21
22
23
24 // --- Config Database ---
25 extern void     Config_ParseFile(const char *Filename);
26 extern void     Config_AddValue(const char *Key, const char *Value);
27 extern int      Config_GetValueCount(const char *KeyName);
28 extern const char       *Config_GetValue(const char *KeyName, int Index);
29 extern int      Config_GetValue_Bool(const char *KeyName, int Index);
30 extern int      Config_GetValue_Int(const char *KeyName, int Index);
31
32 #endif

UCC git Repository :: git.ucc.asn.au