plcopen/instance_tagname.ysl2
author Andrey Skvortsov <andrej.skvortzov@gmail.com>
Mon, 18 Apr 2016 18:59:11 +0300
changeset 1479 8f41aa88aa46
parent 1351 a546a63ce1bf
child 1936 b85b13b1c2ec
permissions -rw-r--r--
fix many compilation warnings about static variables used by non-static functions

[CC] plc_main.c -> plc_main.o
/tmp/be/build/plc_main.c:396:40: warning: ?LogBuff? is static but used in inline function ?copy_from_log? which is not static
memcpy((char*)buf + remaining, LogBuff[level], size - remaining);
^
/tmp/be/build/plc_main.c:395:22: warning: ?LogBuff? is static but used in inline function ?copy_from_log? which is not static
memcpy(buf, &LogBuff[level][buffpos], remaining);
^
...

^
/tmp/be/build/plc_debugger.c:825:20: warning: ?retain_offset? is static but used in inline function ?BufferIterator? which is not static
Retain(retain_offset, size, real_value_p);
^
/tmp/be/build/plc_debugger.c:823:47: warning: ?retain_offset? is static but used in inline function ?BufferIterator? which is not static
unsigned int next_retain_offset = retain_offset + size;
^
^
include yslt.yml2
estylesheet xmlns:ppx="http://www.plcopen.org/xml/tc6_0201"
            xmlns:xhtml="http://www.w3.org/1999/xhtml"
            xmlns:ns="instance_tagname_ns" 
            extension-element-prefixes="ns" 
            exclude-result-prefixes="ns" {
    
    param "instance_path";
    
    variable "project" {
        copy "document('project')/project/*";
    }
    
    variable "stdlib" {
        copy "document('stdlib')/stdlib/*";
    }
    variable "extensions" {
        copy "document('extensions')/extensions/*";
    }
    
    function "element_name" {
        param "path";
        choose {
            when "contains($path,'.')" > «substring-before($path,'.')»
            otherwise > «$path»
        }
    }
    
    function "next_path" {
        param "path";
        choose {
            when "contains($path,'.')" > «substring-after($path,'.')»
        }
    }
    
    template "ppx:project" {
        variable "config_name" {
            call "element_name" {
                with "path", "$instance_path";
            }
        }
        apply "ppx:instances/ppx:configurations/ppx:configuration[@name=$config_name]" {
            with "element_path" {
                call "next_path" {
                    with "path", "$instance_path";
                }
            }
        }
    }
    
    template "ppx:configuration" {
        param "element_path";
        choose {
            when "$element_path!=''" {
                variable "child_name" {
                    call "element_name" {
                        with "path", "$element_path";
                    }
                }
                apply "ppx:resource[@name=$child_name] | ppx:globalVars/ppx:variable[@name=$child_name]/ppx:type/*[self::ppx:derived or self::ppx:struct or self::ppx:array]" {
                    with "element_path" {
                        call "next_path" {
                            with "path", "$element_path";
                        }
                    }
                }
            }
            otherwise {
                value "ns:ConfigTagName(@name)";
            }
        }
    }
    
    template "ppx:resource" {
        param "element_path";
        choose {
            when "$element_path!=''" {
                variable "child_name" {
                    call "element_name" {
                        with "path" > «$element_path»
                    }
                }
                apply "ppx:pouInstance[@name=$child_name] | ppx:task/ppx:pouInstance[@name=$child_name] | ppx:globalVars/ppx:variable[@name=$child_name]/ppx:type/*[self::ppx:derived or self::ppx:struct or self::ppx:array]" {
                    with "element_path" {
                        call "next_path" {
                            with "path", "$element_path";
                        }
                    }
                }
            }
            otherwise {
                value "ns:ResourceTagName(ancestor::ppx:configuration/@name, @name)";
            }
        }
    }
    
    template "ppx:pouInstance" {
        param "element_path";
        variable "type_name" > «@typeName»
        apply """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:pous/ppx:pou[@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:pous/ppx:pou[@name=$type_name] |
                 exsl:node-set($extensions)/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name]""" {
            with "element_path", "$element_path";
        }
    }
    
    template "ppx:pou" {
        param "element_path";
        choose {
            when "$element_path!=''" {
                variable "child_name" {
                    call "element_name" {
                        with "path", "$element_path";
                    }
                }
                apply "ppx:interface/*/ppx:variable[@name=$child_name]/ppx:type/*[self::ppx:derived or self::ppx:struct or self::ppx:array]" {
                    with "element_path" {
                        call "next_path" {
                            with "path", "$element_path";
                        }
                    }
                }
                apply "ppx:actions/ppx:action[@name=$child_name] | ppx:transitions/ppx:transition[@name=$child_name]";
            }
            otherwise {
                variable "name" > «@name»
                value "ns:PouTagName($name)";
            }
        }
    }
    
    template "ppx:action" {
        value "ns:ActionTagName(ancestor::ppx:pou/@name, @name)";
    }
    
    template "ppx:transition" {
        value "ns:TransitionTagName(ancestor::ppx:pou/@name, @name)";
    }
    
    template "ppx:dataType" {
        param "element_path";
        apply "ppx:baseType/*[self::ppx:derived or self::ppx:struct or self::ppx:array]" {
            with "element_path", "$element_path";
        }
    }
    
    template "ppx:derived" {
        param "element_path";
        variable "type_name" > «@name»
        apply """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:pous/ppx:pou[@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:pous/ppx:pou[@name=$type_name] |
                 exsl:node-set($extensions)/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name]""" {
            with "element_path", "$element_path";
        }
    }
    
    template "ppx:array" {
        param "element_path";
        apply "ppx:baseType/*[self::ppx:derived or self::ppx:struct or self::ppx:array]" {
            with "element_path", "$element_path";
        }
    }
    
    template "ppx:struct" {
        param "element_path";
        variable "child_name" {
            call "element_name" {
                with "path", "$element_path";
            }
        }
        apply "ppx:variable[@name=$child_name]/ppx:type/*[self::ppx:derived or self::ppx:struct or self::ppx:array]" {
            with "element_path" {
                call "next_path" {
                    with "path", "$element_path";
                }
            }
        }
    }
    
}