Bugfix: re-run of include-expanded DRC/LVS wasn't working

Reworked include-expansion scheme for DRC/LVS such that
include expansion is done by the interpreter, hence is
also available for re-running the script from the
marker/netlist browser.

This also affects the D25 implementation.
This commit is contained in:
Matthias Koefferlein
2023-08-25 22:49:54 +02:00
parent 304800e4c5
commit e6c9872ea2
5 changed files with 146 additions and 128 deletions
@@ -19,13 +19,15 @@ module D25
class D25Executable < RBA::Executable
def initialize(macro, generator)
def initialize(macro, interpreter, generator)
@d25 = D25Engine::new
@d25._generator = generator
@macro = macro
@interpreter = interpreter
end
def execute
@@ -37,9 +39,11 @@ module D25
begin
encoded_file, expanded_text = @interpreter.include_expansion(@macro)
# No verbosity set in d25 engine - we cannot use the engine's logger
RBA::Logger::verbosity >= 10 && RBA::Logger::info("Running #{@macro.path}")
@d25.instance_eval(@macro.text, @macro.path)
@d25.instance_eval(expanded_text, encoded_file)
rescue => ex
@@ -67,13 +71,40 @@ module D25
end
# A recipe implementation allowing the D25 run to be redone
class D25Recipe < RBA::Recipe
def initialize(interpreter)
super("d25", "D25 recipe")
@interpreter = interpreter
end
def executable(params)
script = params["script"]
if ! script
return
end
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))
end
end
# A DSL implementation for a D25 language (XML format)
class D25Interpreter < RBA::MacroInterpreter
# Constructor
def initialize(recipe)
def initialize
@recipe = recipe
@recipe = D25Recipe::new(self)
# Make the DSL use ruby syntax highlighting
self.syntax_scheme = "ruby"
@@ -98,7 +129,7 @@ module D25
# Implements the execute method
def executable(macro)
D25Executable::new(macro, @recipe.generator("script" => macro.path))
D25Executable::new(macro, self, @recipe.generator("script" => macro.path))
end
end
@@ -107,9 +138,9 @@ module D25
class D25PlainTextInterpreter < RBA::MacroInterpreter
# Constructor
def initialize(recipe)
def initialize
@recipe = recipe
@recipe = D25Recipe::new(self)
# Make the DSL use ruby syntax highlighting
self.syntax_scheme = "ruby"
@@ -125,40 +156,14 @@ module D25
# Implements the execute method
def executable(macro)
D25Executable::new(macro, @recipe.generator("script" => macro.path))
D25Executable::new(macro, self, @recipe.generator("script" => macro.path))
end
end
# A recipe implementation allowing the D25 run to be redone
class D25Recipe < RBA::Recipe
def initialize
super("d25", "D25 recipe")
end
def executable(params)
script = params["script"]
if ! script
return
end
macro = RBA::Macro::macro_by_path(script)
macro || raise("Can't find D25 script #{script} - unable to re-run")
D25Executable::new(macro, self.generator("script" => script))
end
end
# Register the recipe
d25_recipe = D25Recipe::new
# Register the new interpreters
D25Interpreter::new(d25_recipe)
D25PlainTextInterpreter::new(d25_recipe)
D25Interpreter::new
D25PlainTextInterpreter::new
# Creates a new macro category
if RBA::Application::instance