summaryrefslogtreecommitdiff
path: root/src/openscad.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/openscad.cc')
-rw-r--r--src/openscad.cc37
1 files changed, 17 insertions, 20 deletions
diff --git a/src/openscad.cc b/src/openscad.cc
index 4ff250d..d708a8e 100644
--- a/src/openscad.cc
+++ b/src/openscad.cc
@@ -70,7 +70,7 @@ namespace po = boost::program_options;
static void help(const char *progname)
{
- fprintf(stderr, "Usage: %s [ { -o output_file } [ -d deps_file ] ]\\\n"
+ fprintf(stderr, "Usage: %s [ -o output_file [ -d deps_file ] ]\\\n"
"%*s[ -m make_command ] [ -D var=val [..] ] filename\n",
progname, int(strlen(progname))+8, "");
exit(1);
@@ -101,8 +101,7 @@ int main(int argc, char **argv)
// (which we don't catch). This gives us stack traces without rerunning in gdb.
CGAL::set_error_behaviour(CGAL::ABORT);
#endif
- initialize_builtin_functions();
- initialize_builtin_modules();
+ Builtins::instance()->initialize();
#ifdef Q_WS_X11
// see <http://qt.nokia.com/doc/4.5/qapplication.html#QApplication-2>:
@@ -124,6 +123,7 @@ int main(int argc, char **argv)
QCoreApplication::setOrganizationName("OpenSCAD");
QCoreApplication::setOrganizationDomain("openscad.org");
QCoreApplication::setApplicationName("OpenSCAD");
+ QCoreApplication::setApplicationVersion(TOSTRING(OPENSCAD_VERSION));
const char *filename = NULL;
const char *output_file = NULL;
@@ -134,6 +134,8 @@ int main(int argc, char **argv)
("help,h", "help message")
("version,v", "print the version")
("o,o", po::value<string>(), "out-file")
+ ("s,s", po::value<string>(), "stl-file")
+ ("x,x", po::value<string>(), "dxf-file")
("d,d", po::value<string>(), "deps-file")
("m,m", po::value<string>(), "makefile")
("D,D", po::value<vector<string> >(), "var=val");
@@ -160,6 +162,16 @@ int main(int argc, char **argv)
if (output_file) help(argv[0]);
output_file = vm["o"].as<string>().c_str();
}
+ if (vm.count("s")) {
+ fprintf(stderr, "DEPRECATED: The -s option is deprecated. Use -o instead.\n");
+ if (output_file) help(argv[0]);
+ output_file = vm["s"].as<string>().c_str();
+ }
+ if (vm.count("x")) {
+ fprintf(stderr, "DEPRECATED: The -x option is deprecated. Use -o instead.\n");
+ if (output_file) help(argv[0]);
+ output_file = vm["x"].as<string>().c_str();
+ }
if (vm.count("d")) {
if (deps_output_file)
help(argv[0]);
@@ -260,21 +272,7 @@ int main(int argc, char **argv)
#ifdef ENABLE_CGAL
Context root_ctx;
- root_ctx.functions_p = &builtin_functions;
- root_ctx.modules_p = &builtin_modules;
- root_ctx.set_variable("$fn", Value(0.0));
- root_ctx.set_variable("$fs", Value(1.0));
- root_ctx.set_variable("$fa", Value(12.0));
- root_ctx.set_variable("$t", Value(0.0));
-
- Value zero3;
- zero3.type = Value::VECTOR;
- zero3.append(new Value(0.0));
- zero3.append(new Value(0.0));
- zero3.append(new Value(0.0));
- root_ctx.set_variable("$vpt", zero3);
- root_ctx.set_variable("$vpr", zero3);
-
+ register_builtin(root_ctx);
AbstractModule *root_module;
ModuleInstantiation root_inst;
@@ -422,8 +420,7 @@ int main(int argc, char **argv)
exit(1);
}
- destroy_builtin_functions();
- destroy_builtin_modules();
+ Builtins::instance(true);
return rc;
}
contact: Jan Huwald // Impressum