--- a/PLCControler.py Wed Oct 09 10:57:20 2013 +0200
+++ b/PLCControler.py Wed Oct 09 22:00:23 2013 +0200
@@ -189,85 +189,54 @@
# Helpers object for generating pou variable instance list
#-------------------------------------------------------------------------------
-def class_extraction(el, prt):
- if prt in ["pou", "variable"]:
- pou_type = POU_TYPES.get(el.text)
- if pou_type is not None:
- return VAR_CLASS_INFOS[el.text][1]
+def class_extraction(value): "configuration": ITEM_CONFIGURATION,
"resource": ITEM_RESOURCE,
"transition": ITEM_TRANSITION,
- "program": ITEM_PROGRAM}.get(prt)
-PARAM_VALUE_EXTRACTION = {
- "name": lambda el, prt: el.text,
- "class": class_extraction,
- "type": lambda el, prt: None if el.text == "None" else el.text,
- "edit": lambda el, prt: el.text == "True",
- "debug": lambda el, prt: el.text == "True",
- "variables": lambda el, prt: [
- compute_instance_tree(chld)
-def compute_instance_tree(tree):
- PARAM_VALUE_EXTRACTION[el.tag](el, tree.tag)
-class IsEdited(etree.XSLTExtension):
+ "program": ITEM_PROGRAM}.get(value) + if class_type is not None: - def __init__(self, controller, debug):
- etree.XSLTExtension.__init__(self)
- self.Controller = controller
+ pou_type = POU_TYPES.get(value) + if pou_type is not None: - def execute(self, context, self_node, input_node, output_parent):
- typename = input_node.get("name")
- project = self.Controller.GetProject(self.Debug)
- output_parent.text = str(project.getpou(typename) is not None)
-class IsDebugged(etree.XSLTExtension):
+ var_type = VAR_CLASS_INFOS.get(value) + if var_type is not None: - def __init__(self, controller, debug):
- etree.XSLTExtension.__init__(self)
- self.Controller = controller
+class _VariablesTreeItemInfos(object): + __slots__ = ["name", "var_class", "type", "edit", "debug", "variables"] + def __init__(self, *args): + for attr, value in zip(self.__slots__, args): + setattr(self, attr, value if value is not None else "") + return _VariableTreeItem(*[getattr(self, attr) for attr in self.__slots__]) +class VariablesTreeInfosFactory: - def execute(self, context, self_node, input_node, output_parent):
- typename = input_node.get("name")
- project = self.Controller.GetProject(self.Debug)
- pou_infos = project.getpou(typename)
- if pou_infos is not None:
- self.apply_templates(context, pou_infos, output_parent)
- datatype_infos = self.Controller.GetDataType(typename, self.Debug)
- if datatype_infos is not None:
- self.apply_templates(context, datatype_infos, output_parent)
- output_parent.text = "False"
-class PouVariableClass(etree.XSLTExtension):
- def __init__(self, controller, debug):
- etree.XSLTExtension.__init__(self)
- self.Controller = controller
- def execute(self, context, self_node, input_node, output_parent):
- pou_infos = self.Controller.GetPou(input_node.get("name"), self.Debug)
- if pou_infos is not None:
- self.apply_templates(context, pou_infos, output_parent)
- self.process_children(context, output_parent)
-pou_variables_xslt = etree.parse(
- os.path.join(ScriptDirectory, "plcopen", "pou_variables.xslt"))
+ def SetRoot(self, context, *args): + self.Root = _VariablesTreeItemInfos( + *([''] + _translate_args( + [class_extraction, str] + [_BoolValue] * 2, + def AddVariable(self, context, *args): + if self.Root is not None: + self.Root.variables.append(_VariablesTreeItemInfos( + [str, class_extraction, str] + [_BoolValue] * 2, #-------------------------------------------------------------------------------
# Helpers object for generating instances path list
@@ -799,20 +768,28 @@
project = self.GetProject(debug)
+ factory = VariablesTreeInfosFactory() + parser = etree.XMLParser() + parser.resolvers.add(LibraryResolver(self, debug)) pou_variable_xslt_tree = etree.XSLT(
- pou_variables_xslt, extensions = {
- ("pou_vars_ns", "is_edited"): IsEdited(self, debug),
- ("pou_vars_ns", "is_debugged"): IsDebugged(self, debug),
- ("pou_vars_ns", "pou_class"): PouVariableClass(self, debug)})
+ os.path.join(ScriptDirectory, "plcopen", "pou_variables.xslt"), + extensions = {("pou_vars_ns", name): getattr(factory, name) + for name in ["SetRoot", "AddVariable"]}) words = tagname.split("::")
obj = self.GetPou(words[1], debug)
obj = self.GetEditedElement(tagname, debug)
- return compute_instance_tree(
- pou_variable_xslt_tree(obj).getroot())
+ pou_variable_xslt_tree(obj) + return factory.GetRoot() def GetInstanceList(self, root, name, debug = False):
--- a/controls/PouInstanceVariablesPanel.py Wed Oct 09 10:57:20 2013 +0200
+++ b/controls/PouInstanceVariablesPanel.py Wed Oct 09 22:00:23 2013 +0200
@@ -244,27 +244,27 @@
if self.PouInfos is not None:
root = self.VariablesList.AddRoot("")
- for var_infos in self.PouInfos["variables"]:
- if var_infos.get("type", None) is not None:
- text = "%(name)s (%(type)s)" % var_infos
+ for var_infos in self.PouInfos.variables: + if var_infos.type is not None: + text = "%s (%s)" % (var_infos.name, var_infos.type) - text = var_infos["name"]
- if var_infos["class"] in ITEMS_VARIABLE:
- if (not USE_MPL and var_infos["debug"] and self.Debug and
- (self.Controller.IsOfType(var_infos["type"], "ANY_NUM", True) or
- self.Controller.IsOfType(var_infos["type"], "ANY_BIT", True))):
+ if var_infos.var_class in ITEMS_VARIABLE: + if (not USE_MPL and var_infos.debug and self.Debug and + (self.Controller.IsOfType(var_infos.type, "ANY_NUM", True) or + self.Controller.IsOfType(var_infos.type, "ANY_BIT", True))): right_images.append(self.InstanceGraphImage)
- elif var_infos["edit"]:
right_images.append(self.EditImage)
- if var_infos["debug"] and self.Debug:
+ if var_infos.debug and self.Debug: right_images.append(self.DebugInstanceImage)
item = self.VariablesList.AppendItem(root, text)
item.SetRightImages(right_images)
- self.VariablesList.SetItemImage(item, self.ParentWindow.GetTreeImage(var_infos["class"]))
+ self.VariablesList.SetItemImage(item, self.ParentWindow.GetTreeImage(var_infos.var_class)) self.VariablesList.SetPyData(item, var_infos)
self.RefreshInstanceChoice()
@@ -281,7 +281,7 @@
self.InstanceChoice.Append(instance)
self.PouInstance = instances[0]
- if self.PouInfos["class"] in [ITEM_CONFIGURATION, ITEM_RESOURCE]:
+ if self.PouInfos.var_class in [ITEM_CONFIGURATION, ITEM_RESOURCE]: self.InstanceChoice.SetSelection(0)
elif self.PouInstance in instances:
@@ -292,8 +292,8 @@
def RefreshButtons(self):
enabled = self.InstanceChoice.GetSelection() != -1
- self.ParentButton.Enable(enabled and self.PouInfos["class"] != ITEM_CONFIGURATION)
- self.DebugButton.Enable(enabled and self.PouInfos["debug"] and self.Debug)
+ self.ParentButton.Enable(enabled and self.PouInfos.var_class != ITEM_CONFIGURATION) + self.DebugButton.Enable(enabled and self.PouInfos.debug and self.Debug) root = self.VariablesList.GetRootItem()
if root is not None and root.IsOk():
@@ -307,29 +307,29 @@
item, item_cookie = self.VariablesList.GetNextChild(root, item_cookie)
def EditButtonCallback(self, infos):
- var_class = infos["class"]
+ var_class = infos.var_class if var_class == ITEM_RESOURCE:
tagname = self.Controller.ComputeConfigurationResourceName(
self.InstanceChoice.GetStringSelection(),
elif var_class == ITEM_TRANSITION:
tagname = self.Controller.ComputePouTransitionName(
self.PouTagName.split("::")[1],
elif var_class == ITEM_ACTION:
tagname = self.Controller.ComputePouActionName(
self.PouTagName.split("::")[1],
- tagname = self.Controller.ComputePouName(infos["type"])
+ tagname = self.Controller.ComputePouName(infos.type) self.ParentWindow.EditProjectElement(var_class, tagname)
def DebugButtonCallback(self, infos):
if self.InstanceChoice.GetSelection() != -1:
- var_class = infos["class"]
+ var_class = infos.var_class var_path = "%s.%s" % (self.InstanceChoice.GetStringSelection(),
if var_class in ITEMS_VARIABLE:
self.ParentWindow.AddDebugVariable(var_path, force=True)
elif var_class == ITEM_TRANSITION:
@@ -338,35 +338,35 @@
self.Controller.ComputePouTransitionName(
self.PouTagName.split("::")[1],
elif var_class == ITEM_ACTION:
self.ParentWindow.OpenDebugViewer(
self.Controller.ComputePouActionName(
self.PouTagName.split("::")[1],
self.ParentWindow.OpenDebugViewer(
- self.Controller.ComputePouName(infos["type"]))
+ self.Controller.ComputePouName(infos.type)) def DebugButtonDClickCallback(self, infos):
if self.InstanceChoice.GetSelection() != -1:
- if infos["class"] in ITEMS_VARIABLE:
+ if infos.var_class in ITEMS_VARIABLE: self.ParentWindow.AddDebugVariable(
"%s.%s" % (self.InstanceChoice.GetStringSelection(),
def GraphButtonCallback(self, infos):
if self.InstanceChoice.GetSelection() != -1:
- if infos["class"] in ITEMS_VARIABLE:
+ if infos.var_class in ITEMS_VARIABLE: var_path = "%s.%s" % (self.InstanceChoice.GetStringSelection(),
- self.ParentWindow.OpenDebugViewer(infos["class"], var_path, infos["type"])
+ self.ParentWindow.OpenDebugViewer(infos.var_class, var_path, infos.type) def ShowInstanceChoicePopup(self):
self.InstanceChoice.SetFocusFromKbd()
@@ -395,7 +395,7 @@
def OnDebugButtonClick(self, event):
if self.InstanceChoice.GetSelection() != -1:
self.ParentWindow.OpenDebugViewer(
- self.PouInfos["class"],
+ self.PouInfos.var_class, self.InstanceChoice.GetStringSelection(),
@@ -413,20 +413,20 @@
- elif item_infos["class"] not in ITEMS_VARIABLE:
+ elif item_infos.var_class not in ITEMS_VARIABLE: instance_path = self.InstanceChoice.GetStringSelection()
- if item_infos["class"] == ITEM_RESOURCE:
+ if item_infos.var_class == ITEM_RESOURCE: tagname = self.Controller.ComputeConfigurationResourceName(
- tagname = self.Controller.ComputePouName(item_infos["type"])
+ tagname = self.Controller.ComputePouName(item_infos.type) - item_path = "%s.%s" % (instance_path, item_infos["name"])
+ item_path = "%s.%s" % (instance_path, item_infos.name) self.SetPouType(tagname, item_path)
@@ -450,10 +450,10 @@
- elif flags & CT.TREE_HITTEST_ONITEMLABEL and item_infos["class"] in ITEMS_VARIABLE:
+ elif flags & CT.TREE_HITTEST_ONITEMLABEL and item_infos.var_class in ITEMS_VARIABLE: self.ParentWindow.EnsureTabVisible(
self.ParentWindow.DebugVariablePanel)
- item_path = "%s.%s" % (instance_path, item_infos["name"])
+ item_path = "%s.%s" % (instance_path, item_infos.name) data = wx.TextDataObject(str((item_path, "debug")))
dragSource = wx.DropSource(self.VariablesList)
--- a/plcopen/pou_variables.xslt Wed Oct 09 10:57:20 2013 +0200
+++ b/plcopen/pou_variables.xslt Wed Oct 09 22:00:23 2013 +0200
@@ -1,174 +1,299 @@
-<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:ppx="http://www.plcopen.org/xml/tc6_0201"
- extension-element-prefixes="ns"
- exclude-result-prefixes="ns">
+<xsl:stylesheet xmlns:func="http://exslt.org/functions" xmlns:dyn="http://exslt.org/dynamic" xmlns:str="http://exslt.org/strings" xmlns:math="http://exslt.org/math" xmlns:exsl="http://exslt.org/common" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:yml="http://fdik.org/yml" xmlns:set="http://exslt.org/sets" xmlns:ppx="http://www.plcopen.org/xml/tc6_0201" xmlns:ns="pou_vars_ns" xmlns:regexp="http://exslt.org/regular-expressions" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" extension-element-prefixes="ns" version="1.0" exclude-result-prefixes="ns"> + <xsl:output method="xml"/> + <xsl:variable name="space" select="' '"/> + <xsl:param name="autoindent" select="4"/> + <xsl:template match="text()"> + <xsl:param name="_indent" select="0"/> + <xsl:template mode="var_class" match="text()"> + <xsl:param name="_indent" select="0"/> + <xsl:template mode="var_type" match="text()"> + <xsl:param name="_indent" select="0"/> + <xsl:template mode="var_edit" match="text()"> + <xsl:param name="_indent" select="0"/> + <xsl:template mode="var_debug" match="text()"> + <xsl:param name="_indent" select="0"/> + <xsl:variable name="project"> + <xsl:copy-of select="document('project')/project/*"/> + <xsl:variable name="stdlib"> + <xsl:copy-of select="document('stdlib')/stdlib/*"/> + <xsl:variable name="extensions"> + <xsl:copy-of select="document('extensions')/extensions/*"/> + <xsl:template name="add_root"> + <xsl:param name="_indent" select="0"/> + <xsl:param name="class"/> + <xsl:param name="type"/> + <xsl:param name="edit"> + <xsl:text>true</xsl:text> + <xsl:param name="debug"> + <xsl:text>true</xsl:text> + <xsl:value-of select="ns:SetRoot($class, $type, $edit, $debug)"/> <xsl:template match="ppx:pou">
- <class><xsl:value-of select="@pouType"/></class>
- <type><xsl:value-of select="@name"/></type>
- <edit><xsl:text>True</xsl:text></edit>
- <debug><xsl:text>True</xsl:text></debug>
- <xsl:apply-templates select="ppx:interface"/>
- <xsl:apply-templates select="ppx:actions/ppx:action | ppx:transitions/ppx:transition" mode="variable_list"/>
+ <xsl:param name="_indent" select="0"/> + <xsl:call-template name="add_root"> + <xsl:with-param name="class"> + <xsl:value-of select="@pouType"/> + <xsl:with-param name="type"> + <xsl:value-of select="@name"/> + <xsl:apply-templates select="ppx:interface"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + <xsl:apply-templates mode="variable_list" select="ppx:actions/ppx:action | ppx:transitions/ppx:transition"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> <xsl:template match="ppx:action">
- <type><xsl:text>None</xsl:text></type>
- <edit><xsl:text>True</xsl:text></edit>
- <debug><xsl:text>True</xsl:text></debug>
- <xsl:apply-templates select="ancestor::ppx:pou/child::ppx:interface"/>
+ <xsl:param name="_indent" select="0"/> + <xsl:call-template name="add_root"> + <xsl:with-param name="class"> + <xsl:text>action</xsl:text> + <xsl:apply-templates select="ancestor::ppx:pou/child::ppx:interface"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> <xsl:template match="ppx:transition">
- <type><xsl:text>None</xsl:text></type>
- <edit><xsl:text>True</xsl:text></edit>
- <debug><xsl:text>True</xsl:text></debug>
- <xsl:apply-templates select="ancestor::ppx:pou/child::ppx:interface"/>
+ <xsl:param name="_indent" select="0"/> + <xsl:call-template name="add_root"> + <xsl:with-param name="class"> + <xsl:text>transition</xsl:text> + <xsl:apply-templates select="ancestor::ppx:pou/child::ppx:interface"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> <xsl:template match="ppx:configuration">
- <type><xsl:text>None</xsl:text></type>
- <edit><xsl:text>True</xsl:text></edit>
- <debug><xsl:text>False</xsl:text></debug>
- <xsl:apply-templates select="ppx:resource" mode="variable_list"/>
- <xsl:apply-templates select="ppx:globalVars"/>
+ <xsl:param name="_indent" select="0"/> + <xsl:call-template name="add_root"> + <xsl:with-param name="class"> + <xsl:text>configuration</xsl:text> + <xsl:with-param name="debug"> + <xsl:text>false</xsl:text> + <xsl:apply-templates mode="variable_list" select="ppx:resource"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + <xsl:apply-templates select="ppx:globalVars"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> <xsl:template match="ppx:resource">
- <type><xsl:text>None</xsl:text></type>
- <edit><xsl:text>True</xsl:text></edit>
- <debug><xsl:text>False</xsl:text></debug>
- <xsl:apply-templates select="ppx:pouInstance | ppx:task/ppx:pouInstance" mode="variable_list"/>
- <xsl:apply-templates select="ppx:globalVars"/>
+ <xsl:param name="_indent" select="0"/> + <xsl:call-template name="add_root"> + <xsl:with-param name="class"> + <xsl:text>resource</xsl:text> + <xsl:with-param name="debug"> + <xsl:text>false</xsl:text> + <xsl:apply-templates mode="variable_list" select="ppx:pouInstance | ppx:task/ppx:pouInstance"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + <xsl:apply-templates select="ppx:globalVars"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + <xsl:template name="variables_infos"> + <xsl:param name="_indent" select="0"/> + <xsl:param name="var_class"/> + <xsl:for-each select="ppx:variable"> + <xsl:variable name="class"> + <xsl:apply-templates mode="var_class" select="ppx:type"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + <xsl:with-param name="default_class"> + <xsl:value-of select="$var_class"/> + <xsl:variable name="type"> + <xsl:apply-templates mode="var_type" select="ppx:type"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + <xsl:variable name="edit"> + <xsl:apply-templates mode="var_edit" select="ppx:type"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + <xsl:variable name="debug"> + <xsl:apply-templates mode="var_debug" select="ppx:type"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + <xsl:value-of select="ns:AddVariable(@name, $class, $type, $edit, $debug)"/> <xsl:template match="ppx:localVars">
+ <xsl:param name="_indent" select="0"/> <xsl:call-template name="variables_infos">
- <xsl:with-param name="var_class" select="'Local'"/>
+ <xsl:with-param name="var_class"> + <xsl:text>Local</xsl:text> <xsl:template match="ppx:globalVars">
+ <xsl:param name="_indent" select="0"/> <xsl:call-template name="variables_infos">
- <xsl:with-param name="var_class" select="'Global'"/>
+ <xsl:with-param name="var_class"> + <xsl:text>Global</xsl:text> <xsl:template match="ppx:externalVars">
+ <xsl:param name="_indent" select="0"/> <xsl:call-template name="variables_infos">
- <xsl:with-param name="var_class" select="'External'"/>
+ <xsl:with-param name="var_class"> + <xsl:text>External</xsl:text> <xsl:template match="ppx:tempVars">
+ <xsl:param name="_indent" select="0"/> <xsl:call-template name="variables_infos">
- <xsl:with-param name="var_class" select="'Temp'"/>
+ <xsl:with-param name="var_class"> + <xsl:text>Temp</xsl:text> <xsl:template match="ppx:inputVars">
+ <xsl:param name="_indent" select="0"/> <xsl:call-template name="variables_infos">
- <xsl:with-param name="var_class" select="'Input'"/>
+ <xsl:with-param name="var_class"> + <xsl:text>Input</xsl:text> <xsl:template match="ppx:outputVars">
+ <xsl:param name="_indent" select="0"/> <xsl:call-template name="variables_infos">
- <xsl:with-param name="var_class" select="'Output'"/>
+ <xsl:with-param name="var_class"> + <xsl:text>Output</xsl:text> <xsl:template match="ppx:inOutVars">
+ <xsl:param name="_indent" select="0"/> <xsl:call-template name="variables_infos">
- <xsl:with-param name="var_class" select="'InOut'"/>
+ <xsl:with-param name="var_class"> + <xsl:text>InOut</xsl:text> + <xsl:template name="add_variable"> + <xsl:param name="_indent" select="0"/> + <xsl:param name="name"/> + <xsl:param name="class"/> + <xsl:param name="type"/> + <xsl:param name="edit"> + <xsl:text>true</xsl:text> + <xsl:param name="debug"> + <xsl:text>true</xsl:text> + <xsl:value-of select="ns:AddVariable($name, $class, $type, $edit, $debug)"/> + <xsl:template mode="variable_list" match="ppx:action"> + <xsl:param name="_indent" select="0"/> + <xsl:call-template name="add_variable"> + <xsl:with-param name="name"> + <xsl:value-of select="@name"/> + <xsl:with-param name="class"> + <xsl:text>action</xsl:text> + <xsl:template mode="variable_list" match="ppx:transition"> + <xsl:param name="_indent" select="0"/> + <xsl:call-template name="add_variable"> + <xsl:with-param name="name"> + <xsl:value-of select="@name"/> + <xsl:with-param name="class"> + <xsl:text>transition</xsl:text> - <xsl:template name="variables_infos">
- <xsl:param name="var_class"/>
- <xsl:for-each select="ppx:variable">
- <name><xsl:value-of select="@name"/></name>
- <xsl:apply-templates mode="var_class">
- <xsl:with-param name="default_class">
- <xsl:value-of select="$var_class"/>
- <type><xsl:apply-templates mode="var_type"/></type>
- <edit><xsl:apply-templates mode="var_edit"/></edit>
- <debug><xsl:apply-templates mode="var_debug"/></debug>
- <xsl:template match="ppx:transition" mode="variable_list">
- <name><xsl:value-of select="@name"/></name>
- <type><xsl:text>None</xsl:text></type>
- <edit><xsl:text>True</xsl:text></edit>
- <debug><xsl:text>True</xsl:text></debug>
+ <xsl:template mode="variable_list" match="ppx:resource"> + <xsl:param name="_indent" select="0"/> + <xsl:call-template name="add_variable"> + <xsl:with-param name="name"> + <xsl:value-of select="@name"/> + <xsl:with-param name="class"> + <xsl:text>resource</xsl:text> + <xsl:with-param name="debug"> + <xsl:text>false</xsl:text> - <xsl:template match="ppx:action" mode="variable_list">
- <name><xsl:value-of select="@name"/></name>
- <type><xsl:text>None</xsl:text></type>
- <edit><xsl:text>True</xsl:text></edit>
- <debug><xsl:text>True</xsl:text></debug>
- <xsl:template match="ppx:resource" mode="variable_list">
- <name><xsl:value-of select="@name"/></name>
- <type><xsl:text>None</xsl:text></type>
- <edit><xsl:text>True</xsl:text></edit>
- <debug><xsl:text>False</xsl:text></debug>
+ <xsl:template mode="variable_list" match="ppx:pouInstance"> + <xsl:param name="_indent" select="0"/> + <xsl:call-template name="add_variable"> + <xsl:with-param name="name"> + <xsl:value-of select="@name"/> + <xsl:with-param name="class"> + <xsl:text>program</xsl:text> + <xsl:with-param name="type"> + <xsl:value-of select="@typeName"/> - <xsl:template match="ppx:pouInstance" mode="variable_list">
- <name><xsl:value-of select="@name"/></name>
- <type><xsl:value-of select="@typeName"/></type>
- <edit><xsl:text>True</xsl:text></edit>
- <debug><xsl:text>True</xsl:text></debug>
+ <xsl:template mode="var_class" match="*[self::ppx:type or self::ppx:baseType]/ppx:derived"> + <xsl:param name="_indent" select="0"/> + <xsl:param name="default_class"/> + <xsl:variable name="type_name" select="@name"/> + <xsl:variable name="pou_infos"> + <xsl:copy-of select="exsl:node-set($project)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] | exsl:node-set($stdlib)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] | exsl:node-set($extensions)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name]"/> + <xsl:when test="$pou_infos != ''"> + <xsl:apply-templates mode="var_class" select="exsl:node-set($pou_infos)"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + <xsl:value-of select="$default_class"/> - <xsl:template match="*[self::ppx:type or self::ppx:baseType]/ppx:derived" mode="var_class">
- <xsl:param name="default_class"/>
- <xsl:value-of select="$default_class"/>
- <xsl:template match="ppx:pou" mode="var_class">
- <xsl:param name="default_class"/>
+ <xsl:template mode="var_class" match="ppx:pou"> + <xsl:param name="_indent" select="0"/> <xsl:value-of select="@pouType"/>
- <xsl:template match="*[self::ppx:type or self::ppx:baseType]/*" mode="var_class">
+ <xsl:template mode="var_class" match="*[self::ppx:type or self::ppx:baseType]/*"> + <xsl:param name="_indent" select="0"/> <xsl:param name="default_class"/>
<xsl:value-of select="$default_class"/>
- <xsl:template match="*[self::ppx:type or self::ppx:baseType]/ppx:derived" mode="var_type">
+ <xsl:template mode="var_type" match="*[self::ppx:type or self::ppx:baseType]/ppx:derived"> + <xsl:param name="_indent" select="0"/> <xsl:value-of select="@name"/>
- <xsl:template match="*[self::ppx:type or self::ppx:baseType]/ppx:array" mode="var_type">
+ <xsl:template mode="var_type" match="*[self::ppx:type or self::ppx:baseType]/ppx:array"> + <xsl:param name="_indent" select="0"/> <xsl:text>ARRAY [</xsl:text>
<xsl:for-each select="ppx:dimension">
<xsl:value-of select="@lower"/>
@@ -176,44 +301,78 @@
<xsl:value-of select="@upper"/>
<xsl:text>] OF </xsl:text>
- <xsl:apply-templates select="ppx:baseType" mode="var_type"/>
+ <xsl:apply-templates mode="var_type" select="ppx:baseType"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> - <xsl:template match="*[self::ppx:type or self::ppx:baseType]/ppx:string" mode="var_type">
+ <xsl:template mode="var_type" match="*[self::ppx:type or self::ppx:baseType]/ppx:string"> + <xsl:param name="_indent" select="0"/> <xsl:text>STRING</xsl:text>
- <xsl:template match="*[self::ppx:type or self::ppx:baseType]/ppx:wstring" mode="var_type">
+ <xsl:template mode="var_type" match="*[self::ppx:type or self::ppx:baseType]/ppx:wstring"> + <xsl:param name="_indent" select="0"/> <xsl:text>WSTRING</xsl:text>
- <xsl:template match="*[self::ppx:type or self::ppx:baseType]/*" mode="var_type">
+ <xsl:template mode="var_type" match="*[self::ppx:type or self::ppx:baseType]/*"> + <xsl:param name="_indent" select="0"/> <xsl:value-of select="local-name()"/>
- <xsl:template match="*[self::ppx:type or self::ppx:baseType]/ppx:derived" mode="var_edit">
- <xsl:template match="*[self::ppx:type or self::ppx:baseType]/ppx:array" mode="var_edit">
- <xsl:apply-templates select="ppx:baseType" mode="var_edit"/>
+ <xsl:template mode="var_edit" match="*[self::ppx:type or self::ppx:baseType]/ppx:derived"> + <xsl:param name="_indent" select="0"/> + <xsl:variable name="type_name" select="@name"/> + <xsl:variable name="pou_infos"> + <xsl:copy-of select="exsl:node-set($project)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name]"/> + <xsl:when test="$pou_infos != ''"> + <xsl:text>true</xsl:text> + <xsl:text>false</xsl:text> - <xsl:template match="*[self::ppx:type or self::ppx:baseType]/*" mode="var_edit">
- <xsl:text>False</xsl:text>
+ <xsl:template mode="var_edit" match="*[self::ppx:type or self::ppx:baseType]/ppx:array"> + <xsl:param name="_indent" select="0"/> + <xsl:apply-templates mode="var_edit" select="ppx:baseType"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> - <xsl:template match="*[self::ppx:type or self::ppx:baseType]/ppx:derived" mode="var_debug">
- <xsl:template match="ppx:pou" mode="var_debug">
- <xsl:text>True</xsl:text>
+ <xsl:template mode="var_edit" match="*[self::ppx:type or self::ppx:baseType]/*"> + <xsl:param name="_indent" select="0"/> + <xsl:text>false</xsl:text> - <xsl:template match="*[self::ppx:type or self::ppx:baseType]/ppx:array" mode="var_debug">
- <xsl:text>False</xsl:text>
- <xsl:template match="*[self::ppx:type or self::ppx:baseType]/ppx:struct" mode="var_debug">
- <xsl:text>False</xsl:text>
+ <xsl:template mode="var_debug" match="*[self::ppx:type or self::ppx:baseType]/ppx:derived"> + <xsl:param name="_indent" select="0"/> + <xsl:variable name="type_name" select="@name"/> + <xsl:variable name="datatype_infos"> + <xsl:copy-of select="exsl:node-set($project)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] | exsl:node-set($project)/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name] | exsl:node-set($stdlib)/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name] | exsl:node-set($extensions)/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name]"/> + <xsl:when test="$datatype_infos != ''"> + <xsl:apply-templates mode="var_debug" select="exsl:node-set($datatype_infos)"> + <xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/> + <xsl:text>false</xsl:text> - <xsl:template match="*[self::ppx:type or self::ppx:baseType]/*" mode="var_debug">
- <xsl:text>True</xsl:text>
+ <xsl:template mode="var_debug" match="ppx:pou"> + <xsl:param name="_indent" select="0"/> + <xsl:text>true</xsl:text> + <xsl:template mode="var_debug" match="*[self::ppx:type or self::ppx:baseType]/ppx:array"> + <xsl:param name="_indent" select="0"/> + <xsl:text>false</xsl:text> - <xsl:template match="text()"/>
- <xsl:template match="text()" mode="var_class"/>
- <xsl:template match="text()" mode="var_type"/>
- <xsl:template match="text()" mode="var_edit"/>
- <xsl:template match="text()" mode="var_debug"/>
\ No newline at end of file
+ <xsl:template mode="var_debug" match="*[self::ppx:type or self::ppx:baseType]/ppx:struct"> + <xsl:param name="_indent" select="0"/> + <xsl:text>false</xsl:text> + <xsl:template mode="var_debug" match="*[self::ppx:type or self::ppx:baseType]/*"> + <xsl:param name="_indent" select="0"/> + <xsl:text>true</xsl:text>