summaryrefslogtreecommitdiff
path: root/server/src/macroparser.cc
diff options
context:
space:
mode:
authordeva <deva>2009-07-22 15:00:29 +0000
committerdeva <deva>2009-07-22 15:00:29 +0000
commit7e349e2789a633a6014baea63aeb7932e024c917 (patch)
tree0b7b20adf693e3991f4410368255fd05aa8aab0d /server/src/macroparser.cc
parent8109ada79a24f03e00ebc199ebfdb58e70b054d9 (diff)
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.
Diffstat (limited to 'server/src/macroparser.cc')
-rw-r--r--server/src/macroparser.cc14
1 files changed, 9 insertions, 5 deletions
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;
}