From 7e349e2789a633a6014baea63aeb7932e024c917 Mon Sep 17 00:00:00 2001 From: deva Date: Wed, 22 Jul 2009 15:00:29 +0000 Subject: Changed the way the macros are looked up in the filesystem (now they are parsed and indexed using version numbers). Updated all unit tests, to compile and run again. --- server/src/macroparser.cc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'server/src/macroparser.cc') diff --git a/server/src/macroparser.cc b/server/src/macroparser.cc index 0f7ed76..921e4f0 100644 --- a/server/src/macroparser.cc +++ b/server/src/macroparser.cc @@ -80,15 +80,14 @@ void MacroParser::error(const char* fmt, ...) } -MacroParser::MacroParser(std::string macro, bool abspath) +MacroParser::MacroParser(std::string macrofile) { state = UNDEFINED; m = NULL; current_map = NULL; current_script = NULL; - if(!abspath) file = Conf::xml_basedir + "/macros/" + macro + ".xml"; - else file = macro; + file = macrofile; PRACRO_DEBUG(macro, "Using macro file: %s\n", file.c_str()); @@ -341,7 +340,8 @@ void print_attributes(std::string prefix, int main() { - MacroParser parser("example"); + try { + MacroParser parser("../xml/macros/example.xml"); parser.parse(); Macro *m = parser.getMacro(); @@ -362,7 +362,11 @@ int main() print_attributes("\t\t\t\t\t-", (*mi).attributes); mi++; } - + } catch(Exception &e) { + printf("ERROR: %s\n", e.what()); + return 1; + } + return 0; } -- cgit v1.2.3