summaryrefslogtreecommitdiff
path: root/tests/cgaltest.cc
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2011-09-03 22:03:16 (GMT)
committerMarius Kintel <marius@kintel.net>2011-09-03 22:03:16 (GMT)
commit821c7df1fe34006ebeb0150cc0a166563d583f25 (patch)
tree3b1891b404583cea57ee4f7f4e17c625f671bfff /tests/cgaltest.cc
parenta5b03ddcf9026dbc60881572419f096ba9ecadab (diff)
Extracted handle_dep() to separate source file
Diffstat (limited to 'tests/cgaltest.cc')
-rw-r--r--tests/cgaltest.cc26
1 files changed, 7 insertions, 19 deletions
diff --git a/tests/cgaltest.cc b/tests/cgaltest.cc
index 9d4ef5d..44e87f9 100644
--- a/tests/cgaltest.cc
+++ b/tests/cgaltest.cc
@@ -25,6 +25,7 @@
#include "myqhash.h"
#include "openscad.h"
+#include "handle_dep.h"
#include "node.h"
#include "module.h"
#include "context.h"
@@ -44,29 +45,15 @@
#include <getopt.h>
#include <iostream>
#include <assert.h>
+#include <sstream>
-QString commandline_commands;
-const char *make_command = NULL;
-QSet<QString> dependencies;
+std::string commandline_commands;
QString currentdir;
QString examplesdir;
QString librarydir;
using std::string;
-void handle_dep(QString filename)
-{
- if (filename.startsWith("/"))
- dependencies.insert(filename);
- else
- dependencies.insert(QDir::currentPath() + QString("/") + filename);
- if (!QFile(filename).exists() && make_command) {
- char buffer[4096];
- snprintf(buffer, 4096, "%s '%s'", make_command, filename.replace("'", "'\\''").toUtf8().data());
- system(buffer); // FIXME: Handle error
- }
-}
-
// FIXME: enforce some maximum cache size (old version had 100K vertices as limit)
QHash<std::string, CGAL_Nef_polyhedron> cache;
@@ -143,15 +130,16 @@ int main(int argc, char **argv)
fprintf(stderr, "Can't open input file `%s'!\n", filename);
exit(1);
} else {
- QString text;
+ std::stringstream text;
char buffer[513];
int ret;
while ((ret = fread(buffer, 1, 512, fp)) > 0) {
buffer[ret] = 0;
- text += buffer;
+ text << buffer;
}
fclose(fp);
- root_module = parse((text+commandline_commands).toAscii().data(), fileInfo.absolutePath().toLocal8Bit(), false);
+ text << commandline_commands;
+ root_module = parse(text.str().c_str(), fileInfo.absolutePath().toLocal8Bit(), false);
if (!root_module) {
exit(1);
}
contact: Jan Huwald // Impressum