From 6a87dd5cfa0a272f978e1b22ca59f1c8c55505a7 Mon Sep 17 00:00:00 2001 From: don bright Date: Sat, 20 Apr 2013 14:24:39 -0700 Subject: accept 'layername' and 'filename' in import, WARNING deprecation diff --git a/src/import.cc b/src/import.cc index c9a2b91..927c9d8 100644 --- a/src/import.cc +++ b/src/import.cc @@ -67,6 +67,7 @@ AbstractNode *ImportModule::evaluate(const Context *ctx, const ModuleInstantiati { AssignmentList args; args += Assignment("file", NULL), Assignment("layer", NULL), Assignment("convexity", NULL), Assignment("origin", NULL), Assignment("scale", NULL); + args += Assignment("filename",NULL), Assignment("layername", NULL); // FIXME: This is broken. Tag as deprecated and fix // Map old argnames to new argnames for compatibility @@ -90,6 +91,12 @@ AbstractNode *ImportModule::evaluate(const Context *ctx, const ModuleInstantiati #endif Value v = c.lookup_variable("file"); + if (v.isUndefined()) { + v = c.lookup_variable("filename"); + if (!v.isUndefined()) + PRINT("WARNING: filename= is deprecated. Please use file="); + } + std::string filename = inst->getAbsolutePath(v.isUndefined() ? "" : v.toString()); import_type_e actualtype = this->type; if (actualtype == TYPE_UNKNOWN) { @@ -108,6 +115,11 @@ AbstractNode *ImportModule::evaluate(const Context *ctx, const ModuleInstantiati node->filename = filename; Value layerval = c.lookup_variable("layer", true); + if (layerval.isUndefined()) { + layerval = c.lookup_variable("layername",true); + if (!layerval.isUndefined()) + PRINT("WARNING: layername= is deprecated. Please use layer="); + } node->layername = layerval.isUndefined() ? "" : layerval.toString(); node->convexity = c.lookup_variable("convexity", true).toDouble(); -- cgit v0.10.1