From 4c4969d0cb0f817de2aa866a7d8abfde6ecaff82 Mon Sep 17 00:00:00 2001 From: Joshua Allen Date: Sat, 25 Feb 2017 14:20:28 -0500 Subject: initial commit of config parser --- src/survive_config.c | 182 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/survive_config.h | 36 ++++++++++ 2 files changed, 218 insertions(+) create mode 100644 src/survive_config.c create mode 100644 src/survive_config.h (limited to 'src') diff --git a/src/survive_config.c b/src/survive_config.c new file mode 100644 index 0000000..42c2c89 --- /dev/null +++ b/src/survive_config.c @@ -0,0 +1,182 @@ +#include +#include +#include "survive_config.h" + +#define MAX_CONFIG_ENTRIES 100 + +config_val config_values[MAX_CONFIG_ENTRIES]; +static uint16_t used_entries = 0; + +static FILE *config_file = NULL; + +void config_init() { + uint16_t i = 0; + for (i=0;i< Joshua Allen, Under MIT/x11 License. + + +#ifndef _SURVIVE_CONFIG_H +#define _SURVIVE_CONFIG_H + +#include "survive_internal.h" + +typedef enum { + CONFIG_UNKNOWN = 0, + CONFIG_FLOAT = 1, + CONFIG_UINT32 = 2, + CONFIG_STRING = 3 +} cval_type; +/* +typedef union { + uint32_t i; + float f; + } Numeric; +*/ +typedef struct { + char *tag; + cval_type type; + union { + uint32_t i; + float f; + } numeric; + char *str; +} config_val; + + +void config_open(const char* path, const char* mode); +void config_close(); +void config_write_lighthouse(struct BaseStationData* bsd, uint8_t length); + +#endif \ No newline at end of file -- cgit v1.2.3