Initial move to common config code directory
[tpg/opendispense2.git] / src / common / config.h
diff --git a/src/common/config.h b/src/common/config.h
new file mode 100644 (file)
index 0000000..1e7583e
--- /dev/null
@@ -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 <regex.h>
+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

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