diff --git a/src/db/db/built-in-macros/pcell_declaration_helper.lym b/src/db/db/built-in-macros/pcell_declaration_helper.lym index 3561cae82..6a9c21f9d 100644 --- a/src/db/db/built-in-macros/pcell_declaration_helper.lym +++ b/src/db/db/built-in-macros/pcell_declaration_helper.lym @@ -314,14 +314,14 @@ module RBA # Starts an operation - pushes the state on the state stack - def start + def _start @state_stack << [ @param_values, @param_states, @layers, @cell, @layout, @layer, @shape ] self._reset_state end # Finishes an operation - pops the state from the state stack - def finish + def _finish if ! @state_stack.empty? @param_values, @param_states, @layers, @cell, @layout, @layer, @shape = @state_stack.pop else @@ -455,13 +455,13 @@ module RBA # implementation of display_text def display_text(parameters) - self.start + self._start @param_values = parameters text = "" begin text = display_text_impl ensure - self.finish + self._finish end text end @@ -478,33 +478,33 @@ module RBA # coerce parameters (make consistent) def coerce_parameters(layout, parameters) - self.start + self._start @param_values = parameters @layout = layout begin coerce_parameters_impl ensure ret = @param_values - self.finish + self._finish end ret end # parameter change callback def callback(layout, name, states) - self.start + self._start @param_states = states @layout = layout begin callback_impl(name) ensure - self.finish + self._finish end end # produce the layout def produce(layout, layers, parameters, cell) - self.start + self._start @layers = layers @cell = cell @param_values = parameters @@ -512,13 +512,13 @@ module RBA begin produce_impl ensure - self.finish + self._finish end end # produce a helper for can_create_from_shape def can_create_from_shape(layout, shape, layer) - self.start + self._start ret = false @layout = layout @shape = shape @@ -526,14 +526,14 @@ module RBA begin ret = can_create_from_shape_impl ensure - self.finish + self._finish end ret end # produce a helper for transformation_from_shape def transformation_from_shape(layout, shape, layer) - self.start + self._start @layout = layout @shape = shape @layer = layer @@ -541,7 +541,7 @@ module RBA begin t = transformation_from_shape_impl ensure - self.finish + self._finish end t end @@ -549,7 +549,7 @@ module RBA # produce a helper for parameters_from_shape # with this helper, the implementation can use the parameter setters def parameters_from_shape(layout, shape, layer) - self.start + self._start @param_values = @param_decls.map { |pd| pd.default } @layout = layout @shape = shape @@ -558,7 +558,7 @@ module RBA parameters_from_shape_impl ensure ret = @param_values - self.finish + self._finish end ret end diff --git a/src/pymod/distutils_src/klayout/db/pcell_declaration_helper.py b/src/pymod/distutils_src/klayout/db/pcell_declaration_helper.py index 3667d3f63..773ff03c7 100644 --- a/src/pymod/distutils_src/klayout/db/pcell_declaration_helper.py +++ b/src/pymod/distutils_src/klayout/db/pcell_declaration_helper.py @@ -130,12 +130,12 @@ def display_text(self, parameters): This function delegates the implementation to self.display_text_impl after configuring the PCellDeclaration object. """ - self.start() + self._start() self._param_values = parameters try: text = self.display_text_impl() finally: - self.finish() + self._finish() return text def get_parameters(self): @@ -147,7 +147,7 @@ def get_parameters(self): """ return self._param_decls - def get_values(self): + def _get_values(self): """ Gets the temporary parameter values used for the current evaluation @@ -158,7 +158,7 @@ def get_values(self): self._param_values = None return v - def init_values(self, values = None, layers = None, states = None): + def _init_values(self, values = None, layers = None, states = None): """ initializes the temporary parameter values for the current evaluation @@ -167,7 +167,7 @@ def init_values(self, values = None, layers = None, states = None): "layers" are the layer indexes corresponding to the layer parameters. """ - self.start() + self._start() self._param_values = None self._param_states = None if states: @@ -180,17 +180,17 @@ def init_values(self, values = None, layers = None, states = None): self._param_values = values self._layers = layers - def start(self): + def _start(self): """ Is called to prepare the environment for an operation - After the operation, "finish" must be called. + After the operation, "_finish" must be called. This method will push the state onto a stack, hence implementing reentrant implementation methods. """ self._state_stack.append( (self._param_values, self._param_states, self._layers, self.cell, self.layout, self.layer, self.shape) ) self._reset_state() - def finish(self): + def _finish(self): """ Is called at the end of an implementation of a PCellDeclaration method """ @@ -235,12 +235,12 @@ def callback(self, layout, name, states): The function delegates the implementation to callback_impl after updating the state of this object with the current parameters. """ - self.init_values(states = states) + self._init_values(states = states) self.layout = layout try: self.callback_impl(name) finally: - self.finish() + self._finish() def coerce_parameters(self, layout, parameters): """ @@ -249,13 +249,13 @@ def coerce_parameters(self, layout, parameters): The function delegates the implementation to coerce_parameters_impl after updating the state of this object with the current parameters. """ - self.init_values(parameters) + self._init_values(parameters) self.layout = layout try: self.coerce_parameters_impl() - parameters = self.get_values() + parameters = self._get_values() finally: - self.finish() + self._finish() return parameters def produce(self, layout, layers, parameters, cell): @@ -265,13 +265,13 @@ def produce(self, layout, layers, parameters, cell): The function delegates the implementation to produce_impl after updating the state of this object with the current parameters. """ - self.init_values(parameters, layers) + self._init_values(parameters, layers) self.cell = cell self.layout = layout try: self.produce_impl() finally: - self.finish() + self._finish() def can_create_from_shape(self, layout, shape, layer): """ @@ -280,14 +280,14 @@ def can_create_from_shape(self, layout, shape, layer): The function delegates the implementation to can_create_from_shape_impl after updating the state of this object with the current parameters. """ - self.start() + self._start() self.layout = layout self.shape = shape self.layer = layer try: ret = self.can_create_from_shape_impl() finally: - self.finish() + self._finish() return ret def transformation_from_shape(self, layout, shape, layer): @@ -297,7 +297,7 @@ def transformation_from_shape(self, layout, shape, layer): The function delegates the implementation to transformation_from_shape_impl after updating the state of this object with the current parameters. """ - self.start() + self._start() self.layout = layout self.shape = shape self.layer = layer @@ -306,7 +306,7 @@ def transformation_from_shape(self, layout, shape, layer): if t is None: t = self._make_default_trans() finally: - self.finish() + self._finish() return t def parameters_from_shape(self, layout, shape, layer): @@ -316,15 +316,15 @@ def parameters_from_shape(self, layout, shape, layer): The function delegates the implementation to parameters_from_shape_impl after updating the state of this object with the current parameters. """ - self.init_values() + self._init_values() self.layout = layout self.shape = shape self.layer = layer try: self.parameters_from_shape_impl() - param = self.get_values() + param = self._get_values() finally: - self.finish() + self._finish() return param def display_text_impl(self):