summaryrefslogtreecommitdiff
path: root/server/src/macrotool_filehandler.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/macrotool_filehandler.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/macrotool_filehandler.cc')
-rw-r--r--server/src/macrotool_filehandler.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/server/src/macrotool_filehandler.cc b/server/src/macrotool_filehandler.cc
index 524761c..4caa889 100644
--- a/server/src/macrotool_filehandler.cc
+++ b/server/src/macrotool_filehandler.cc
@@ -30,6 +30,7 @@
#include <fstream>
#include <ios>
+#include "macroheaderparser.h"
#include "macroparser.h"
#include "template.h"
@@ -61,9 +62,10 @@ static bool check(std::string file, std::string *name = NULL, std::string *versi
static bool check(std::string file, std::string *name, std::string *version)
{
try {
- MacroParser parser(file, true);
+ MacroHeaderParser parser(file);
parser.parse();
Macro *macro = parser.getMacro();
+
if(!macro) {
printf("Macro malformed!\n");
return false;
@@ -83,14 +85,18 @@ static bool check(std::string file, std::string *name, std::string *version)
return true;
}
+#define SZ 1000
static bool macro_exists(std::string name, std::string version, std::string &clashfile)
{
std::vector<std::string> macrofiles = getMacros();
+
+ for(int prut = 0; prut < SZ; prut++) {
std::vector<std::string>::iterator mfs = macrofiles.begin();
while(mfs != macrofiles.end()) {
std::string macroname = mfs->substr(0, mfs->length() - 4);
- MacroParser parser(macroname);
+ MacroHeaderParser parser(Conf::xml_basedir + "/macros/" + *mfs);
+ //MacroParser parser(macroname);
parser.parse();
Macro *macro = parser.getMacro();
@@ -102,7 +108,8 @@ static bool macro_exists(std::string name, std::string version, std::string &cla
mfs++;
}
-
+ }
+ printf("Parsed %d files\n", macrofiles.size() * SZ);
return false;
}