From 6c07f9219bed6ccddc9b65ad40414cf0a9f7d633 Mon Sep 17 00:00:00 2001 From: deva Date: Wed, 16 Aug 2006 23:48:22 +0000 Subject: Finished the Configuration class (Still missing vector though!) Replaced the old MiavConfig class with the new Configuration class in all the the appropriate places. --- lib/Makefile.am | 7 +- lib/configuration.cc | 79 ++++++++ lib/configuration.h | 27 +++ lib/file.cc | 18 +- lib/file.h | 1 - lib/liblua_wrapper.cc | 63 ++++++- lib/liblua_wrapper.h | 9 +- lib/miav_config.cc | 499 -------------------------------------------------- lib/miav_config.h | 102 ----------- 9 files changed, 187 insertions(+), 618 deletions(-) delete mode 100644 lib/miav_config.cc delete mode 100644 lib/miav_config.h diff --git a/lib/Makefile.am b/lib/Makefile.am index a2b9b37..6ee8bf4 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -4,13 +4,14 @@ lib_LTLIBRARIES = libmiav.la libmiav_la_SOURCES = \ aa_socket.cc \ + configuration.cc \ file.cc \ frame.cc \ info.cc \ info_simple.cc \ jpeg_mem_dest.cc \ libdv_wrapper.cc \ - miav_config.cc \ + liblua_wrapper.cc \ mutex.cc \ network.cc \ semaphore.cc \ @@ -25,7 +26,7 @@ libmiav_la_SOURCES = \ EXTRA_DIST = \ aa_socket.h \ - config.h \ + configuration.h \ dv.h \ file.h \ frame.h \ @@ -34,7 +35,7 @@ EXTRA_DIST = \ info_simple.h \ jpeg_mem_dest.h \ libdv_wrapper.h \ - miav_config.h \ + liblua_wrapper.h \ mutex.h \ network.h \ package.h \ diff --git a/lib/configuration.cc b/lib/configuration.cc index dbc0dfd..64153d9 100644 --- a/lib/configuration.cc +++ b/lib/configuration.cc @@ -26,3 +26,82 @@ */ #include "configuration.h" +const char preload[] = +"a = 42.0\n" +"b = 42\n" +"c = 42\n" +"d = \"42\"\n"; + +Configuration::Configuration(char *configfile) +{ + // Preload default values. + lua.loadBuffer((char*)preload); + + // Load the conf file. + lua.loadFile(configfile); +} + +Configuration::~Configuration() +{ +} + +int Configuration::get(char *node, std::string *retval) +{ + try { + *retval = lua.getString(node); + } catch(...) { + return 1; + } + return 0; +} + +int Configuration::get(char *node, std::vector *retval) +{/* + try { + *retval = lua.getString(node); + } catch(...) { + return 1; + } + return 0; + */ + return 1; +} + +int Configuration::get(char *node, double *retval) +{ + try { + *retval = lua.getReal(node); + } catch(...) { + return 1; + } + return 0; +} + +int Configuration::get(char *node, int *retval) +{ + try { + *retval = lua.getInteger(node); + } catch(...) { + return 1; + } + return 0; +} + +int Configuration::get(char *node, bool *retval) +{ + try { + *retval = lua.getBoolean(node); + } catch(...) { + return 1; + } + return 0; +} + +Configuration *MIaV::config = NULL; + +void MIaV::initConfig(Configuration *config) +{ + MIaV::config = config; +} + + diff --git a/lib/configuration.h b/lib/configuration.h index d187531..fba4c01 100644 --- a/lib/configuration.h +++ b/lib/configuration.h @@ -26,4 +26,31 @@ */ #ifndef __MIAV_CONFIGURATION_H__ #define __MIAV_CONFIGURATION_H__ + +#include "liblua_wrapper.h" + +#include +#include + +class Configuration { +public: + Configuration(char *configfile); + ~Configuration(); + + int get(char *node, std::string *retval); + int get(char *node, std::vector *retval); + int get(char *node, double *retval); + int get(char *node, int *retval); + int get(char *node, bool *retval); + +private: + LibLUAWrapper lua; +}; + +// For the global config object +namespace MIaV { + void initConfig(Configuration *config); + extern Configuration *config; +}; + #endif/*__MIAV_CONFIGURATION_H__*/ diff --git a/lib/file.cc b/lib/file.cc index 88e8df1..bba2f5b 100644 --- a/lib/file.cc +++ b/lib/file.cc @@ -24,10 +24,10 @@ * along with MIaV; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include #include "file.h" -#include "miav_config.h" +#include "configuration.h" + #include "info.h" #include @@ -80,8 +80,14 @@ File::~File() MIaV::info->info("[%s]", filelist[cnt].c_str()); } - std::string *trash = MIaV::config->readString("server_trash"); - std::string *later = MIaV::config->readString("server_later"); + // std::string *trash = MIaV::config->readString("server_trash"); + // std::string *later = MIaV::config->readString("server_later"); + std::string trash; + if(MIaV::config->get("server_trash", &trash)) + MIaV::info->error("Could not read [server_trash] symbol from config file."); + std::string later; + if(MIaV::config->get("server_later", &later)) + MIaV::info->error("Could not read [server_later] symbol from config file."); switch(savestate) { case NO_CHANGE: @@ -94,12 +100,12 @@ File::~File() case DELETE: MIaV::info->info("Files in this session is to be deleted (moved to trash)."); - Move((char*)trash->c_str()); + Move((char*)trash.c_str()); break; case LATER: MIaV::info->info("Files in this session is stored for later decisson."); - Move((char*)later->c_str()); + Move((char*)later.c_str()); break; } diff --git a/lib/file.h b/lib/file.h index a7a1cba..8b241b4 100644 --- a/lib/file.h +++ b/lib/file.h @@ -24,7 +24,6 @@ * along with MIaV; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "config.h" #ifndef __MIAV_FILE_H__ #define __MIAV_FILE_H__ diff --git a/lib/liblua_wrapper.cc b/lib/liblua_wrapper.cc index 7f493c5..6535f4e 100644 --- a/lib/liblua_wrapper.cc +++ b/lib/liblua_wrapper.cc @@ -76,6 +76,42 @@ int LibLUAWrapper::loadFile(char *fname) return 0; } +int LibLUAWrapper::loadBuffer(char *buffer) +{ + int s; + + s = luaL_loadstring(L, buffer); + + switch(s) { + case 0: //no errors; + break; + case LUA_ERRSYNTAX: //syntax error during pre-compilation; + case LUA_ERRMEM: //memory allocation error. + error = std::string(lua_tostring(L, lua_gettop(L))); + return 1; + default: + error = std::string("Unknown return value of luaL_loadstring."); + return 1; + } + + s = lua_pcall(L, 0, LUA_MULTRET, 0); + + switch(s) { + case 0: // Success + break; + case LUA_ERRRUN:// a runtime error. + case LUA_ERRMEM:// memory allocation error. For such errors, Lua does not call the error handler function. + case LUA_ERRERR:// error while running the error handler function. + error = std::string(lua_tostring(L, lua_gettop(L))); + return 1; + default: + error = std::string("Unknown return value of lua_pcall."); + return 1; + } + + return 0; +} + int LibLUAWrapper::getInteger(char *name) { lua_getfield(L, LUA_GLOBALSINDEX, name); @@ -134,19 +170,34 @@ std::string LibLUAWrapper::getError() } #ifdef LUA_TEST +// Compile with: +// g++ liblua_wrapper.cc -DLUA_TEST -I /home/deva/lib/lua-5.1.1/include/ -L /home/deva/lib/lua-5.1.1/lib -llua + +const char preload[] = +"a = 42.0\n" +"b = 42\n" +"c = 42\n" +"d = \"42\"\n"; int main() { LibLUAWrapper lua; - if(!lua.loadFile("test.lua")) { - printf("a: %f\n", lua.getReal("a")); - printf("b: %d\n", lua.getInteger("b")); - printf("c: %d\n", lua.getBoolean("c")); - printf("fisk: %s\n", lua.getString("fisk").c_str()); - } else { + if(lua.loadBuffer((char*)preload)) { + fprintf(stderr, "LUA buffer error: %s\n", lua.getError().c_str()); + return 1; + } + + if(lua.loadFile("test.lua")) { fprintf(stderr, "LUA load error: %s\n", lua.getError().c_str()); + return 1; } + + printf("a: %f\n", lua.getReal("a")); + printf("b: %d\n", lua.getInteger("b")); + printf("c: %d\n", lua.getBoolean("c")); + printf("d: %s\n", lua.getString("d").c_str()); + return 0; } diff --git a/lib/liblua_wrapper.h b/lib/liblua_wrapper.h index fed15c1..70eb8a8 100644 --- a/lib/liblua_wrapper.h +++ b/lib/liblua_wrapper.h @@ -37,11 +37,18 @@ public: ~LibLUAWrapper(); /** - * loadFile reads and parses a lue file. + * loadFile reads, parses and runs a lue file. * @return 0 on success 1 on error */ int loadFile(char *fname); + /** + * loadBuffer parses a buffer containing lue code, + * pushes it on the stack, and runs it + * @return 0 on success 1 on error + */ + int loadBuffer(char *buffer); + double getReal(char *name); int getInteger(char *name); bool getBoolean(char *name); diff --git a/lib/miav_config.cc b/lib/miav_config.cc deleted file mode 100644 index 81436cf..0000000 --- a/lib/miav_config.cc +++ /dev/null @@ -1,499 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/*************************************************************************** - * miav_config.cc - * - * Sat Feb 19 14:13:19 CET 2005 - * Copyright 2005 Bent Bisballe - * deva@aasimon.org - ****************************************************************************/ - -/* - * This file is part of MIaV. - * - * MIaV is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MIaV is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with MIaV; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ -#include -#include "miav_config.h" -#include "info.h" - -MiavConfig::MiavConfig(char *file) -{ - configs = NULL; - - filename = string(file); - - // Read config file - FILE* fp = fopen(file, "r"); - - if(!fp) { - if(MIaV::info) MIaV::info->error("Error reading configuration file %s\n", file); - else fprintf(stderr, "Error reading configuration file %s\n", file); - return; - } - fseek(fp, 0, SEEK_END); - int fsz = ftell(fp) + 1; - fseek(fp, 0, SEEK_SET); - - char *raw = (char*)calloc(fsz, 1); - fread(raw, 1, fsz, fp); - - fclose(fp); - - configs = parse(raw); - - free(raw); -} - -MiavConfig::~MiavConfig() -{ - _cfg *die = NULL; - _cfg *cfg = configs; - - while(cfg) { - if(die) free(die); - die = cfg; - cfg = cfg->next; - } - if(die) free(die); -} - -/** - * Prints a reasonable error message when a parse error occurres. - */ -void MiavConfig::parseError(char* msg, _cfg* cfg) -{ - if(MIaV::info) MIaV::info->error("Error parsing file %s at line %d:\n\t%s\n\t%s\n", - filename.c_str(), - cfg->line, - cfg->orig, - msg); - else fprintf(stderr, "Error parsing file %s at line %d:\n\t%s\n\t%s\n", - filename.c_str(), - cfg->line, - cfg->orig, - msg); -} - -_cfg* MiavConfig::readLines(char* raw) -{ - int line = 1; - - _cfg *first = (_cfg*)calloc(1, sizeof(_cfg)); - _cfg *current = first; - _cfg *next = NULL; - - char *nl = strchr(raw, '\n'); - - while(nl != NULL) { - int len = nl - raw; - - current->line = line; - - current->orig = (char*) calloc(len + 1, 1); - strncpy(current->orig, raw, len); - - // Find next newline - raw = nl+1; - nl = strchr(raw, '\n'); - - line++; - - // Add _cfg - if(nl != NULL) { - next = (_cfg*)calloc(1, sizeof(_cfg)); - current->next = next; - current = next; - } else { - current->next = NULL; - } - } - - return first; -} - -_cfg* MiavConfig::parseLines(_cfg *cfg) -{ - if(cfg == NULL) return NULL; - - char *l = cfg->left = (char*)calloc(1, strlen(cfg->orig)); - char *r = cfg->right = (char*)calloc(1, strlen(cfg->orig)); - - char *p = cfg->orig; - - // Skip leftmost whitespace - while(p < cfg->orig + strlen(cfg->orig) && strchr("\t ", *p)) { - p++; - } - - // Empty line, with whitespaces - if(p == cfg->orig + strlen(cfg->orig)) { - _cfg* next = cfg->next; - free(cfg->orig); - free(cfg->left); - free(cfg->right); - free(cfg); - return parseLines(next); - } - - // Parse left side - while(p < cfg->orig + strlen(cfg->orig) && !strchr("\t ", *p)) { - if(strchr("#", *p)) { - if(l != cfg->left) parseError("Incomplete line.", cfg); - _cfg* next = cfg->next; - free(cfg->orig); - free(cfg->left); - free(cfg->right); - free(cfg); - return parseLines(next); - } - - if(strchr("=", *p)) break; - - if(strchr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_", *p)) { - *l = *p; - l++; - } else { - char buf[256]; - sprintf(buf, "Invalid left hand side character at [%s].", p); - parseError(buf, cfg); - _cfg* next = cfg->next; - free(cfg->orig); - free(cfg->left); - free(cfg->right); - free(cfg); - return parseLines(next); - } - - p++; - } - - // Skip whitespace - while(p < cfg->orig + strlen(cfg->orig) && strchr("\t ", *p)) { - p++; - } - - if(*p != '=') { - parseError("Expected '='.", cfg); - _cfg* next = cfg->next; - free(cfg->orig); - free(cfg->left); - free(cfg->right); - free(cfg); - return parseLines(next); - } - p++; // Get past the '=' - - // Skip whitespace - while(p < cfg->orig + strlen(cfg->orig) && strchr("\t ", *p)) { - p++; - } - - // Parse right hand side - int instring = 0; - while(p < cfg->orig + strlen(cfg->orig) && !(strchr("\t ", *p) && instring != 1)) { - if(*p == '\"') instring++; - if(instring > 2) { - parseError("Too many '\"'.", cfg); - _cfg* next = cfg->next; - free(cfg->orig); - free(cfg->left); - free(cfg->right); - free(cfg); - return parseLines(next); - } - - if(instring == 1) { - // Accept all chars - *r= *p; - r++; - } else { - // Accept only those chars valid for the data types. - if(strchr("truefalseyesnoTRUEFALSEYESNO1234567890\",.-", *p)) { - if(*p == ',') *r= '.'; - *r = *p; - r++; - } else if(!strchr("\n", *p)) { - char buf[256]; - sprintf(buf, "Invalid right hand side character at [%s].", p); - parseError(buf, cfg); - _cfg* next = cfg->next; - free(cfg->orig); - free(cfg->left); - free(cfg->right); - free(cfg); - return parseLines(next); - } - if(*p == '#') break; - } - - p++; - } - - // Skip whitespace - while(p < cfg->orig + strlen(cfg->orig) && strchr("\t ", *p)) { - p++; - } - - // Detect if whitespace ocurred inside righthand value. - if(p != cfg->orig + strlen(cfg->orig)) { - parseError("Invalid use of whitespace.", cfg); - _cfg* next = cfg->next; - free(cfg->orig); - free(cfg->left); - free(cfg->right); - free(cfg); - return parseLines(next); - } - - // Check for instring (string not ended) - if(instring == 1) { - parseError("String not closed.", cfg); - _cfg* next = cfg->next; - free(cfg->orig); - free(cfg->left); - free(cfg->right); - free(cfg); - return parseLines(next); - } - - // Check for empty line - if(l == cfg->left && r == cfg->right) { - _cfg* next = cfg->next; - free(cfg->orig); - free(cfg->left); - free(cfg->right); - free(cfg); - return parseLines(next); - } - - // Check for empty left side. - if(l == cfg->left) { - parseError("Empty left side.", cfg); - _cfg* next = cfg->next; - free(cfg->orig); - free(cfg->left); - free(cfg->right); - free(cfg); - return parseLines(next); - } - - // Check for empty right side. - if(r == cfg->right) { - parseError("Empty right side.", cfg); - _cfg* next = cfg->next; - free(cfg->orig); - free(cfg->left); - free(cfg->right); - free(cfg); - return parseLines(next); - } - - cfg->next = parseLines(cfg->next); - return cfg; -} - - -_cfg *MiavConfig::createSemantics(_cfg *cfg) { - if(cfg == NULL) return NULL; - - cfg->type = CONFIG_UNKNOWN; - - // Boolean - true - if(strcasecmp(cfg->right, "yes") == 0 || - strcasecmp(cfg->right, "true") == 0) { - cfg->type = CONFIG_BOOL; - cfg->boolval = true; - } - - // Boolean - false - if(strcasecmp(cfg->right, "no") == 0 || - strcasecmp(cfg->right, "false") == 0) { - cfg->type = CONFIG_BOOL; - cfg->boolval = false; - } - - // String - if(cfg->right[0] == '\"') { - cfg->type = CONFIG_STRING; - cfg->right[strlen(cfg->right) - 1] = '\0'; - cfg->stringval = new string(cfg->right + 1); - - } - - // Number - bool number = true; - char *p = cfg->right; - while(p < cfg->right + strlen(cfg->right)) { - if(!strchr("01234567890.-", *p)) number = false; - p++; - } - - // Integer - if(number && strstr(cfg->right, ".") == NULL ) { - cfg->type = CONFIG_INT; - cfg->intval = atoi(cfg->right); - } - - // Float - if(number && strstr(cfg->right, ".") != NULL) { - cfg->type = CONFIG_FLOAT; - cfg->floatval = atof(cfg->right); - } - - if(cfg->type == CONFIG_UNKNOWN) { - parseError("Unknown type (see 'man miav.conf' for valid right hand sides).", cfg); - _cfg* next = cfg->next; - free(cfg->orig); - free(cfg->left); - free(cfg->right); - free(cfg); - return createSemantics(next); - } - - // Create name - cfg->name = new string(cfg->left); - - cfg->next = createSemantics(cfg->next); - return cfg; -} - - -_cfg* MiavConfig::parse(char* raw) -{ - _cfg *first = readLines(raw); - first = parseLines(first); - - first = createSemantics(first); - - /* - _cfg* cfg = first; - while(cfg) { - printf("Node:\n"); - printf("\tLine: [%d]\n", cfg->line); - printf("\tOrig: [%s]\n", cfg->orig); - printf("\tLeft: [%s]\n", cfg->left); - printf("\tRight: [%s]\n", cfg->right); - - switch(cfg->type) { - case CONFIG_INT: - printf("\tInt value: %d\n", cfg->intval); - break; - case CONFIG_BOOL: - printf("\tBool value: %d\n", cfg->boolval); - break; - case CONFIG_FLOAT: - printf("\tFloat value: %f\n", cfg->floatval); - break; - case CONFIG_STRING: - printf("\tString value: %s\n", cfg->stringval->c_str()); - break; - case CONFIG_UNKNOWN: - printf("\tUnknown type: %s\n", cfg->right); - break; - } - - cfg= cfg->next; - } - */ - return first; -} - -int MiavConfig::readInt(char *node) -{ - _cfg* n = findNode(node); - if(n) { - if(n->type == CONFIG_INT) return n->intval; - parseError("Expected integer.", n); - } - return 0; -} - -bool MiavConfig::readBool(char *node) -{ - _cfg* n = findNode(node); - if(n) { - if(n->type == CONFIG_BOOL) return n->boolval; - if(n->type == CONFIG_INT) return (n->intval != 0); - parseError("Expected boolean.", n); - } - return false; -} - -string *MiavConfig::readString(char *node) -{ - _cfg* n = findNode(node); - if(n) { - if(n->type == CONFIG_STRING) return n->stringval; - parseError("Expected string.", n); - } - return &emptyString; -} - -float MiavConfig::readFloat(char *node) -{ - _cfg* n = findNode(node); - if(n) { - if(n->type == CONFIG_FLOAT) return n->floatval; - if(n->type == CONFIG_INT) return (float)n->intval; - parseError("Expected float.", n); - } - return 0.0f; -} - -_cfg *MiavConfig::findNode(char* node) -{ - _cfg *cfg = configs; - - while(cfg) { - if(!strcmp(node, cfg->name->c_str())) return cfg; - cfg = cfg->next; - } - if(MIaV::info) MIaV::info->error("Missing line in configuration file: \"%s\"!\n", node); - else fprintf(stderr, "Missing line in configuration file: \"%s\"!\n", node); - - return NULL; -} - -// For the global config object. -void MIaV::initConfig(MiavConfig *c) -{ - config = c; -} - -MiavConfig *MIaV::config = NULL; - - -#ifdef __TEST_MIAV_CONFIG - -int main(int argc, char *argv[]) { - if(argc < 2) { - fprintf(stderr, "usage:\n\tmiav_config [filename]\n"); - return 1; - } - - MiavConfig cfg(argv[1]); - printf("Server user: [%s]\n", cfg.readString("server_user")->c_str()); - printf("Resolution: [%f]\n", cfg.readFloat("screensize")); - printf("Resolution (as int): [%d]\n", cfg.readInt("screensize")); - printf("Width: [%d]\n", cfg.readInt("pixel_width")); - printf("Width (as float): [%f]\n", cfg.readFloat("pixel_width")); - printf("Frame quality: [%d]\n", cfg.readInt("frame_quality")); - printf("Skip frames: [%d]\n", cfg.readBool("player_skip_frames")); - printf("Skip frames (as int): [%d]\n", cfg.readInt("player_skip_frames")); - printf("Frame quality (as bool): [%d]\n", cfg.readBool("frame_quality")); - -} - -#endif/* __TEST_MIAV_CONFIG*/ diff --git a/lib/miav_config.h b/lib/miav_config.h deleted file mode 100644 index c97802d..0000000 --- a/lib/miav_config.h +++ /dev/null @@ -1,102 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/*************************************************************************** - * miav_config.h - * - * Sat Feb 19 14:13:19 CET 2005 - * Copyright 2005 Bent Bisballe - * deva@aasimon.org - ****************************************************************************/ - -/* - * This file is part of MIaV. - * - * MIaV is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MIaV is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with MIaV; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ -#include "config.h" -#ifndef __MIAV_MIAV_CONFIG_H__ -#define __MIAV_MIAV_CONFIG_H__ - -#include -using namespace std; - -#include "info.h" -// Cyclic include :( -class Info; - -typedef enum { - CONFIG_UNKNOWN, - CONFIG_INT, - CONFIG_BOOL, - CONFIG_FLOAT, - CONFIG_STRING -} ConfigType; - - -typedef struct __cfg { - // For parsing - char* orig; - int line; - char* left; - char* right; - - // For traversal - string *name; - ConfigType type; - int intval; - bool boolval; - float floatval; - string *stringval; - - struct __cfg* next; -} _cfg; - -class MiavConfig { -public: - MiavConfig(char *file); - ~MiavConfig(); - - int readInt(char *node); - bool readBool(char *node); - string *readString(char *node); - float readFloat(char *node); - -protected: - string filename; - - _cfg *createSemantics(_cfg *cfg); - _cfg* readLines(char* raw); - _cfg* parseLines(_cfg *cfg); - _cfg *parse(char* raw); - string emptyString; - - -#if 0 - _cfg *addConfig(_cfg *parent, char* conf); - char *strip(char* conf); -#endif - - void parseError(char* msg, _cfg *cfg); - _cfg *findNode(char* node); - _cfg *configs; -}; - - -// For the global config object -namespace MIaV { - void initConfig(MiavConfig *config); - extern MiavConfig *config; -}; - -#endif/*__MIAV_MIAV_CONFIG_H__*/ -- cgit v1.2.3