plcopen/variables_infos.ysl2
author Andrey Skvortsov <andrej.skvortzov@gmail.com>
Fri, 15 Jun 2018 16:12:50 +0300
changeset 2184 bbd2364fbf71
parent 1951 bbd1e1744c91
child 3802 8616ffd7c29d
permissions -rw-r--r--
Add argument to set list of source files to check

This is necessary, in case you want to use docker run in pretxncommit
Mercurial hook. Unfortunately for some reason if hg running in
container can't find just created commit defined by $HG_NODE. And it
throws error 'unknown revision'.

Here is example for hgrc.

[hooks]
pretxncommit.linter = hg status -m -n -a -n -I '**.py' --change $HG_NODE > files.lst && docker run --volume=$PWD:/beremiz --workdir="/beremiz" --volume=$PWD/../CanFestival-3:/CanFestival-3 --memory=1g --entrypoint=/beremiz/tests/tools/check_source.sh skvorl/beremiz-requirements --files-to-check files.lst
1936
b85b13b1c2ec YSLT auto indent trick is useless here, added yslt_noindent.yml2, regenerated XSLT files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 1368
diff changeset
     1
include yslt_noindent.yml2
b85b13b1c2ec YSLT auto indent trick is useless here, added yslt_noindent.yml2, regenerated XSLT files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 1368
diff changeset
     2
istylesheet xmlns:ppx="http://www.plcopen.org/xml/tc6_0201"
1347
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
     3
            xmlns:xhtml="http://www.w3.org/1999/xhtml"
1951
bbd1e1744c91 GetVariableDictionary and GetPouInterfaceReturnType optimized with new VariableInfoCollector based on XSLTModelQuery. Moved corresponding definitions out of PLCControler.py.
Edouard Tisserant
parents: 1936
diff changeset
     4
            xmlns:ns="beremiz" 
1347
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
     5
            extension-element-prefixes="ns" 
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
     6
            exclude-result-prefixes="ns" {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
     7
    
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
     8
    param "tree";
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
     9
    
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    10
    template "text()";
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    11
    
1951
bbd1e1744c91 GetVariableDictionary and GetPouInterfaceReturnType optimized with new VariableInfoCollector based on XSLTModelQuery. Moved corresponding definitions out of PLCControler.py.
Edouard Tisserant
parents: 1936
diff changeset
    12
    variable "project", "ns:GetProject()";
bbd1e1744c91 GetVariableDictionary and GetPouInterfaceReturnType optimized with new VariableInfoCollector based on XSLTModelQuery. Moved corresponding definitions out of PLCControler.py.
Edouard Tisserant
parents: 1936
diff changeset
    13
    
bbd1e1744c91 GetVariableDictionary and GetPouInterfaceReturnType optimized with new VariableInfoCollector based on XSLTModelQuery. Moved corresponding definitions out of PLCControler.py.
Edouard Tisserant
parents: 1936
diff changeset
    14
    variable "stdlib", "ns:GetStdLibs()";
bbd1e1744c91 GetVariableDictionary and GetPouInterfaceReturnType optimized with new VariableInfoCollector based on XSLTModelQuery. Moved corresponding definitions out of PLCControler.py.
Edouard Tisserant
parents: 1936
diff changeset
    15
bbd1e1744c91 GetVariableDictionary and GetPouInterfaceReturnType optimized with new VariableInfoCollector based on XSLTModelQuery. Moved corresponding definitions out of PLCControler.py.
Edouard Tisserant
parents: 1936
diff changeset
    16
    variable "extensions", "ns:GetExtensions()";
bbd1e1744c91 GetVariableDictionary and GetPouInterfaceReturnType optimized with new VariableInfoCollector based on XSLTModelQuery. Moved corresponding definitions out of PLCControler.py.
Edouard Tisserant
parents: 1936
diff changeset
    17
bbd1e1744c91 GetVariableDictionary and GetPouInterfaceReturnType optimized with new VariableInfoCollector based on XSLTModelQuery. Moved corresponding definitions out of PLCControler.py.
Edouard Tisserant
parents: 1936
diff changeset
    18
    variable "all_types", "($project | $stdlib | $extensions)/ppx:types";
bbd1e1744c91 GetVariableDictionary and GetPouInterfaceReturnType optimized with new VariableInfoCollector based on XSLTModelQuery. Moved corresponding definitions out of PLCControler.py.
Edouard Tisserant
parents: 1936
diff changeset
    19
1361
7158aa054226 Fixed bugs when editing resource variables and tasks
Laurent Bessard
parents: 1359
diff changeset
    20
    template "ppx:configuration" {
7158aa054226 Fixed bugs when editing resource variables and tasks
Laurent Bessard
parents: 1359
diff changeset
    21
        apply "ppx:globalVars";
7158aa054226 Fixed bugs when editing resource variables and tasks
Laurent Bessard
parents: 1359
diff changeset
    22
    }
7158aa054226 Fixed bugs when editing resource variables and tasks
Laurent Bessard
parents: 1359
diff changeset
    23
    
7158aa054226 Fixed bugs when editing resource variables and tasks
Laurent Bessard
parents: 1359
diff changeset
    24
    template "ppx:resource" {
7158aa054226 Fixed bugs when editing resource variables and tasks
Laurent Bessard
parents: 1359
diff changeset
    25
        apply "ppx:globalVars";
7158aa054226 Fixed bugs when editing resource variables and tasks
Laurent Bessard
parents: 1359
diff changeset
    26
    }
7158aa054226 Fixed bugs when editing resource variables and tasks
Laurent Bessard
parents: 1359
diff changeset
    27
    
7158aa054226 Fixed bugs when editing resource variables and tasks
Laurent Bessard
parents: 1359
diff changeset
    28
    template "ppx:pou" {
7158aa054226 Fixed bugs when editing resource variables and tasks
Laurent Bessard
parents: 1359
diff changeset
    29
        apply "ppx:interface/*";
7158aa054226 Fixed bugs when editing resource variables and tasks
Laurent Bessard
parents: 1359
diff changeset
    30
    }
7158aa054226 Fixed bugs when editing resource variables and tasks
Laurent Bessard
parents: 1359
diff changeset
    31
    
1347
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    32
    template "ppx:returnType" {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    33
        value "ns:AddTree()";
1361
7158aa054226 Fixed bugs when editing resource variables and tasks
Laurent Bessard
parents: 1359
diff changeset
    34
        apply ".", mode="var_type";
1347
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    35
    }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    36
    
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    37
    function "variables_infos" {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    38
        param "var_class";
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    39
        variable "var_option" {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    40
            choose {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    41
                when "@constant='true' or @constant='1'" > Constant
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    42
                when "@retain='true' or @retain='1'" > Retain
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    43
                when "@nonretain='true' or @nonretain='1'" > Non-Retain
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    44
            }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    45
        }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    46
        foreach "ppx:variable" {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    47
            variable "initial_value" {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    48
                apply "ppx:initialValue";
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    49
            }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    50
            variable "edit" {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    51
                choose {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    52
                    when "$var_class='Global' or $var_class='External'" > true
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    53
                    otherwise {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    54
                        apply "ppx:type", mode="var_edit";
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    55
                    }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    56
                }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    57
            }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    58
            value "ns:AddTree()";
1361
7158aa054226 Fixed bugs when editing resource variables and tasks
Laurent Bessard
parents: 1359
diff changeset
    59
            apply "ppx:type", mode="var_type";
1347
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    60
            value "ns:AddVariable(@name, $var_class, $var_option, @address, $initial_value, $edit, ppx:documentation/xhtml:p/text())";
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    61
        }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    62
    }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    63
    
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    64
    template "ppx:localVars" {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    65
        call "variables_infos" {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    66
            with "var_class" > Local
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    67
        }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    68
    }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    69
    
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    70
    template "ppx:globalVars" {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    71
        call "variables_infos" {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    72
            with "var_class" > Global
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    73
        }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    74
    }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    75
    
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    76
    template "ppx:externalVars" {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    77
        call "variables_infos" {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    78
            with "var_class" > External
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    79
        }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    80
    }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    81
    
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    82
    template "ppx:tempVars" {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    83
        call "variables_infos" {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    84
            with "var_class" > Temp
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    85
        }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    86
    }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    87
    
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    88
    template "ppx:inputVars" {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    89
        call "variables_infos" {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    90
            with "var_class" > Input
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    91
        }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    92
    }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    93
    
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    94
    template "ppx:outputVars" {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    95
        call "variables_infos" {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    96
            with "var_class" > Output
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    97
        }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    98
    }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
    99
    
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   100
    template "ppx:inOutVars" {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   101
        call "variables_infos" {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   102
            with "var_class" > InOut
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   103
        }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   104
    }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   105
    
1361
7158aa054226 Fixed bugs when editing resource variables and tasks
Laurent Bessard
parents: 1359
diff changeset
   106
    template "ppx:pou", mode="var_type" {
7158aa054226 Fixed bugs when editing resource variables and tasks
Laurent Bessard
parents: 1359
diff changeset
   107
        apply "ppx:interface/*[self::ppx:inputVars or self::ppx:inOutVars or self::ppx:outputVars]/ppx:variable", mode="var_type";
7158aa054226 Fixed bugs when editing resource variables and tasks
Laurent Bessard
parents: 1359
diff changeset
   108
    }
7158aa054226 Fixed bugs when editing resource variables and tasks
Laurent Bessard
parents: 1359
diff changeset
   109
    
7158aa054226 Fixed bugs when editing resource variables and tasks
Laurent Bessard
parents: 1359
diff changeset
   110
    template "ppx:variable", mode="var_type" {
1347
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   111
        variable "name" > «@name»
1368
e567e4bee11f Fixed bugs with pou variable infos computation stylesheet
Laurent Bessard
parents: 1361
diff changeset
   112
        value "ns:AddTree()";
1361
7158aa054226 Fixed bugs when editing resource variables and tasks
Laurent Bessard
parents: 1359
diff changeset
   113
        apply "ppx:type", mode="var_type";
1347
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   114
        value "ns:AddVarToTree($name)";
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   115
    }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   116
    
1361
7158aa054226 Fixed bugs when editing resource variables and tasks
Laurent Bessard
parents: 1359
diff changeset
   117
    template "ppx:dataType", mode="var_type" {
7158aa054226 Fixed bugs when editing resource variables and tasks
Laurent Bessard
parents: 1359
diff changeset
   118
        apply "ppx:baseType", mode="var_type";
7158aa054226 Fixed bugs when editing resource variables and tasks
Laurent Bessard
parents: 1359
diff changeset
   119
    }
7158aa054226 Fixed bugs when editing resource variables and tasks
Laurent Bessard
parents: 1359
diff changeset
   120
    
7158aa054226 Fixed bugs when editing resource variables and tasks
Laurent Bessard
parents: 1359
diff changeset
   121
    template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:struct", mode="var_type" {
7158aa054226 Fixed bugs when editing resource variables and tasks
Laurent Bessard
parents: 1359
diff changeset
   122
        apply "ppx:variable", mode="var_type";
7158aa054226 Fixed bugs when editing resource variables and tasks
Laurent Bessard
parents: 1359
diff changeset
   123
    }
7158aa054226 Fixed bugs when editing resource variables and tasks
Laurent Bessard
parents: 1359
diff changeset
   124
    
7158aa054226 Fixed bugs when editing resource variables and tasks
Laurent Bessard
parents: 1359
diff changeset
   125
    template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:derived", mode="var_type" {
1347
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   126
        variable "type_name" > «@name»
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   127
        choose {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   128
            when "$tree='True'" {
1951
bbd1e1744c91 GetVariableDictionary and GetPouInterfaceReturnType optimized with new VariableInfoCollector based on XSLTModelQuery. Moved corresponding definitions out of PLCControler.py.
Edouard Tisserant
parents: 1936
diff changeset
   129
                apply """$all_types/ppx:pous/ppx:pou[@name=$type_name] | \
bbd1e1744c91 GetVariableDictionary and GetPouInterfaceReturnType optimized with new VariableInfoCollector based on XSLTModelQuery. Moved corresponding definitions out of PLCControler.py.
Edouard Tisserant
parents: 1936
diff changeset
   130
                         $all_types/ppx:dataTypes/ppx:dataType[@name=$type_name]""", mode="var_type";
1347
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   131
            }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   132
        }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   133
        value "ns:SetType($type_name)";
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   134
    }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   135
     
1361
7158aa054226 Fixed bugs when editing resource variables and tasks
Laurent Bessard
parents: 1359
diff changeset
   136
    template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:array", mode="var_type" {
7158aa054226 Fixed bugs when editing resource variables and tasks
Laurent Bessard
parents: 1359
diff changeset
   137
        apply "ppx:baseType", mode="var_type";
1347
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   138
        foreach "ppx:dimension" {
1368
e567e4bee11f Fixed bugs with pou variable infos computation stylesheet
Laurent Bessard
parents: 1361
diff changeset
   139
            variable "lower" > «@lower»
e567e4bee11f Fixed bugs with pou variable infos computation stylesheet
Laurent Bessard
parents: 1361
diff changeset
   140
            variable "upper" > «@upper»
e567e4bee11f Fixed bugs with pou variable infos computation stylesheet
Laurent Bessard
parents: 1361
diff changeset
   141
            value "ns:AddDimension($lower, $upper)";
1347
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   142
        }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   143
    }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   144
    
1361
7158aa054226 Fixed bugs when editing resource variables and tasks
Laurent Bessard
parents: 1359
diff changeset
   145
    template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:string", mode="var_type" {
1347
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   146
        variable "name" > STRING
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   147
        value "ns:SetType($name)";
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   148
    }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   149
    
1361
7158aa054226 Fixed bugs when editing resource variables and tasks
Laurent Bessard
parents: 1359
diff changeset
   150
    template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:wstring", mode="var_type" {
1347
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   151
        variable "name" > WSTRING
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   152
        value "ns:SetType($name)";
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   153
    }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   154
    
1361
7158aa054226 Fixed bugs when editing resource variables and tasks
Laurent Bessard
parents: 1359
diff changeset
   155
    template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/*", mode="var_type" {
1347
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   156
        variable "name" > «local-name()»
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   157
        value "ns:SetType($name)";
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   158
    }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   159
    
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   160
    template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:derived", mode="var_edit" {
1368
e567e4bee11f Fixed bugs with pou variable infos computation stylesheet
Laurent Bessard
parents: 1361
diff changeset
   161
        variable "type_name" > «@name»
1951
bbd1e1744c91 GetVariableDictionary and GetPouInterfaceReturnType optimized with new VariableInfoCollector based on XSLTModelQuery. Moved corresponding definitions out of PLCControler.py.
Edouard Tisserant
parents: 1936
diff changeset
   162
        variable "pou_infos", "$all_types/ppx:pous/ppx:pou[@name=$type_name]";
1347
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   163
        choose {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   164
            when "$pou_infos != ''" > false
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   165
            otherwise > true
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   166
        }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   167
    }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   168
    
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   169
    template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/*", mode="var_edit" {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   170
        > true
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   171
    }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   172
    
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   173
    template "ppx:value" {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   174
        choose {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   175
            when "@repetitionValue" {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   176
                > «@repetitionValue»(
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   177
                apply;
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   178
                > )
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   179
            }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   180
            when "@member" {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   181
                 > «@member» := 
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   182
                 apply;
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   183
            }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   184
            otherwise {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   185
                apply;
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   186
            }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   187
        }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   188
    }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   189
    
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   190
    template "ppx:simpleValue" {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   191
        > «@value»
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   192
    }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   193
    
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   194
    function "complex_type_value" {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   195
        param "start_bracket";
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   196
        param "end_bracket";
1359
cce13b237b07 Fixed bug when loading complex type variable initial value
Laurent Bessard
parents: 1347
diff changeset
   197
        > «$start_bracket»
1347
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   198
        foreach "ppx:value" {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   199
            apply ".";
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   200
            choose {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   201
                when "position()!=last()" > , 
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   202
            }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   203
        }
1359
cce13b237b07 Fixed bug when loading complex type variable initial value
Laurent Bessard
parents: 1347
diff changeset
   204
        > «$end_bracket»
1347
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   205
    }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   206
    
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   207
    template "ppx:arrayValue" {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   208
        call "complex_type_value" {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   209
            with "start_bracket" > [
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   210
            with "end_bracket" > ]
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   211
        }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   212
    }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   213
    
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   214
    template "ppx:structValue" {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   215
        call "complex_type_value" {
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   216
            with "start_bracket" > (
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   217
            with "end_bracket" > )
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   218
        }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   219
    }
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   220
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   221
}
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   222
533741e5075c Fixed pou variables information loading stylesheet
Laurent Bessard
parents:
diff changeset
   223
    
1936
b85b13b1c2ec YSLT auto indent trick is useless here, added yslt_noindent.yml2, regenerated XSLT files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 1368
diff changeset
   224