summaryrefslogtreecommitdiff
path: root/server/src/templateparser.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/templateparser.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/templateparser.cc')
-rw-r--r--server/src/templateparser.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/server/src/templateparser.cc b/server/src/templateparser.cc
index d40bc1e..8db6bbf 100644
--- a/server/src/templateparser.cc
+++ b/server/src/templateparser.cc
@@ -40,11 +40,6 @@
// For vprintf and friends
#include <stdarg.h>
-#ifndef XML
-// For XML
-#include <config.h>
-#endif/*XML*/
-
#include <errno.h>
#include <string.h>
@@ -82,7 +77,11 @@ TemplateParser::TemplateParser(std::string course)
t = new Template();
current_macro = NULL;
+#ifndef TEST_TEMPLATEPARSER
file = Conf::xml_basedir + "/templates/" + course + ".xml";
+#else
+ file = "../xml/templates/" + course + ".xml";
+#endif/*TEST_TEMPLATEPARSER*/
PRACRO_DEBUG(macro, "Using template file: %s\n", file.c_str());
@@ -183,6 +182,7 @@ void print_attributes(std::string prefix,
int main()
{
+ try {
TemplateParser parser("example");
parser.parse();
@@ -217,7 +217,10 @@ int main()
i++;
}
-
+ } catch(Exception &e) {
+ printf("ERROR: %s\n", e.what());
+ return 1;
+ }
return 0;
}