diff --git a/src/drc/drc/built-in-macros/drc_interpreters.lym b/src/drc/drc/built-in-macros/drc_interpreters.lym index 720b7e963..fbcdd0091 100644 --- a/src/drc/drc/built-in-macros/drc_interpreters.lym +++ b/src/drc/drc/built-in-macros/drc_interpreters.lym @@ -91,7 +91,7 @@ module DRC macro = RBA::Macro::macro_by_path(script) macro || raise("Can't find DRC script #{script} - unable to re-run") - DRCExecutable::new(macro, @interpreter, self.generator("script" => script), params["rdb_index"]) + DRCExecutable::new(macro, @interpreter, self.generator({ "script" => script }, 0), params["rdb_index"]) end @@ -128,7 +128,7 @@ module DRC # Implements the execute method def executable(macro) - DRCExecutable::new(macro, self, @recipe.generator("script" => macro.path)) + DRCExecutable::new(macro, self, @recipe.generator({"script" => macro.path}, 0)) end end @@ -155,7 +155,7 @@ module DRC # Implements the execute method def executable(macro) - DRCExecutable::new(macro, self, @recipe.generator("script" => macro.path)) + DRCExecutable::new(macro, self, @recipe.generator({ "script" => macro.path }, 0)) end end diff --git a/src/gsi/gsi/gsiDeclTl.cc b/src/gsi/gsi/gsiDeclTl.cc index 3f427ae6c..0b891508f 100644 --- a/src/gsi/gsi/gsiDeclTl.cc +++ b/src/gsi/gsi/gsiDeclTl.cc @@ -693,6 +693,16 @@ static Recipe_Impl *make_recipe (const std::string &name, const std::string &des return new Recipe_Impl (name, description); } +static tl::Variant make_impl (Recipe_Impl *recipe, const std::string &generator, const std::map &add_params, int /*dummy*/) +{ + return recipe->make (generator, add_params); +} + +std::string generator_impl (Recipe_Impl *recipe, const std::map ¶ms, int /*dummy*/) +{ + return recipe->generator (params); +} + Class decl_Recipe_Impl ("tl", "Recipe", gsi::constructor ("new", &make_recipe, gsi::arg ("name"), gsi::arg ("description", std::string (), "\"\""), "@brief Creates a new recipe object with the given name and (optional) description" @@ -703,15 +713,23 @@ Class decl_Recipe_Impl ("tl", "Recipe", gsi::method ("description", &Recipe_Impl::description, "@brief Gets the description of the recipe." ) + - gsi::method ("make", &Recipe_Impl::make, gsi::arg ("generator"), gsi::arg ("add_params", std::map (), "{}"), + gsi::method_ext ("make", &make_impl, gsi::arg ("generator"), gsi::arg ("add_params", std::map (), "{}"), gsi::arg ("dummy", 0), "@brief Executes the recipe given by the generator string.\n" "The generator string is the one delivered with \\generator.\n" "Additional parameters can be passed in \"add_params\". They have lower priority than the parameters " "kept inside the generator string." + "\n" + "The dummy argument has been added in version 0.29 and disambiguates between keyword parameters " + "and a single hash argument in Ruby. This is required for Ruby versions before 'real keywords'. Simply " + "add this parameter with any value.\n" ) + - gsi::method ("generator", &Recipe_Impl::generator, gsi::arg ("params"), + gsi::method_ext ("generator", &generator_impl, gsi::arg ("params"), gsi::arg ("dummy", 0), "@brief Delivers the generator string from the given parameters.\n" "The generator string can be used with \\make to re-run the recipe." + "\n" + "The dummy argument has been added in version 0.29 and disambiguates between keyword parameters " + "and a single hash argument in Ruby. This is required for Ruby versions before 'real keywords'. Simply " + "add this parameter with any value.\n" ) + gsi::callback ("executable", &Recipe_Impl::executable, &Recipe_Impl::executable_cb, gsi::arg ("params"), "@brief Reimplement this method to provide an executable object for the actual implementation.\n" diff --git a/src/lvs/lvs/built-in-macros/lvs_interpreters.lym b/src/lvs/lvs/built-in-macros/lvs_interpreters.lym index 2aaf6f1fa..73ff49907 100644 --- a/src/lvs/lvs/built-in-macros/lvs_interpreters.lym +++ b/src/lvs/lvs/built-in-macros/lvs_interpreters.lym @@ -91,7 +91,7 @@ module LVS macro = RBA::Macro::macro_by_path(script) macro || raise("Can't find LVS script #{script} - unable to re-run") - LVSExecutable::new(macro, @interpreter, self.generator("script" => script), params["l2ndb_index"]) + LVSExecutable::new(macro, @interpreter, self.generator({ "script" => script }, 0), params["l2ndb_index"]) end @@ -128,7 +128,7 @@ module LVS # Implements the execute method def executable(macro) - LVSExecutable::new(macro, self, @recipe.generator("script" => macro.path)) + LVSExecutable::new(macro, self, @recipe.generator({ "script" => macro.path }, 0)) end end @@ -155,7 +155,7 @@ module LVS # Implements the execute method def executable(macro) - LVSExecutable::new(macro, self, @recipe.generator("script" => macro.path)) + LVSExecutable::new(macro, self, @recipe.generator({ "script" => macro.path }, 0)) end end diff --git a/src/plugins/tools/view_25d/lay_plugin/built-in-macros/d25_interpreters.lym b/src/plugins/tools/view_25d/lay_plugin/built-in-macros/d25_interpreters.lym index fd8e1bca5..5d0e4ff61 100644 --- a/src/plugins/tools/view_25d/lay_plugin/built-in-macros/d25_interpreters.lym +++ b/src/plugins/tools/view_25d/lay_plugin/built-in-macros/d25_interpreters.lym @@ -92,7 +92,7 @@ module D25 macro = RBA::Macro::macro_by_path(script) macro || raise("Can't find D25 script #{script} - unable to re-run") - D25Executable::new(macro, @interpreter, self.generator("script" => script)) + D25Executable::new(macro, @interpreter, self.generator({ "script" => script }, 0)) end @@ -129,7 +129,7 @@ module D25 # Implements the execute method def executable(macro) - D25Executable::new(macro, self, @recipe.generator("script" => macro.path)) + D25Executable::new(macro, self, @recipe.generator({ "script" => macro.path }, 0)) end end @@ -156,7 +156,7 @@ module D25 # Implements the execute method def executable(macro) - D25Executable::new(macro, self, @recipe.generator("script" => macro.path)) + D25Executable::new(macro, self, @recipe.generator({ "script" => macro.path }, 0)) end end diff --git a/testdata/ruby/tlTest.rb b/testdata/ruby/tlTest.rb index 6a6f996d6..a77b8ae75 100644 --- a/testdata/ruby/tlTest.rb +++ b/testdata/ruby/tlTest.rb @@ -301,10 +301,10 @@ class Tl_TestClass < TestBase assert_equal(my_recipe.name, "rba_test_recipe") assert_equal(my_recipe.description, "description") - g = my_recipe.generator({ "A" => 6, "B" => 7.0 }) + g = my_recipe.generator({ "A" => 6, "B" => 7.0 }, 0) assert_equal(g, "rba_test_recipe: A=#6,B=##7") assert_equal("%g" % RBA::Recipe::make(g), "42") - assert_equal("%g" % RBA::Recipe::make(g, { "C" => 1.5 }).to_s, "63") + assert_equal("%g" % RBA::Recipe::make(g, { "C" => 1.5 }, 0).to_s, "63") my_recipe._destroy my_recipe = nil