summaryrefslogtreecommitdiff
path: root/src/openscad.cc
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2013-04-24 13:17:25 (GMT)
committerMarius Kintel <marius@kintel.net>2013-04-26 21:45:03 (GMT)
commit9b740b558dd627412e01a3521d5372d95e294af2 (patch)
treef34ebfa719303629e27d5fe84c177b5ac38adfbe /src/openscad.cc
parent9a297ecee57549a4eb3919bde4f7b41a548724de (diff)
Further refactoring of scope/context mechanisms. Mostly related to the new FileContext class. Not quite there yet, but almost
Diffstat (limited to 'src/openscad.cc')
-rw-r--r--src/openscad.cc16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/openscad.cc b/src/openscad.cc
index 96dcf4e..6a0d057 100644
--- a/src/openscad.cc
+++ b/src/openscad.cc
@@ -327,6 +327,14 @@ int main(int argc, char **argv)
if (!filename) help(argv[0]);
+ // Top context - this context only holds builtins
+ ModuleContext top_ctx;
+ top_ctx.registerBuiltin();
+ PRINT("Root Context:");
+#if 0 && DEBUG
+ top_ctx.dump(NULL, NULL);
+#endif
+
FileModule *root_module;
ModuleInstantiation root_inst("group");
AbstractNode *root_node;
@@ -348,18 +356,12 @@ int main(int argc, char **argv)
if (!root_module) exit(1);
root_module->handleDependencies();
- ModuleContext root_ctx;
- root_ctx.registerBuiltin();
- PRINT("Root Context:");
-#if 0 && DEBUG
- root_ctx.dump(NULL, NULL);
-#endif
fs::path fpath = boosty::absolute(fs::path(filename));
fs::path fparent = fpath.parent_path();
fs::current_path(fparent);
AbstractNode::resetIndexCounter();
- absolute_root_node = root_module->instantiate(&root_ctx, &root_inst, NULL);
+ absolute_root_node = root_module->instantiate(&top_ctx, &root_inst, NULL);
// Do we have an explicit root node (! modifier)?
if (!(root_node = find_root_tag(absolute_root_node)))
contact: Jan Huwald // Impressum