equal
deleted
inserted
replaced
3 |
3 |
4 # This file is part of Beremiz, a Integrated Development Environment for |
4 # This file is part of Beremiz, a Integrated Development Environment for |
5 # programming IEC 61131-3 automates supporting plcopen standard and CanFestival. |
5 # programming IEC 61131-3 automates supporting plcopen standard and CanFestival. |
6 # |
6 # |
7 # Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD |
7 # Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD |
|
8 # Copyright (C) 2017: Andrey Skvortsov |
8 # |
9 # |
9 # See COPYING file for copyrights details. |
10 # See COPYING file for copyrights details. |
10 # |
11 # |
11 # This program is free software; you can redistribute it and/or |
12 # This program is free software; you can redistribute it and/or |
12 # modify it under the terms of the GNU General Public License |
13 # modify it under the terms of the GNU General Public License |
25 from xmlclass import * |
26 from xmlclass import * |
26 from types import * |
27 from types import * |
27 import os, re |
28 import os, re |
28 from lxml import etree |
29 from lxml import etree |
29 from collections import OrderedDict |
30 from collections import OrderedDict |
|
31 import util.paths as paths |
30 |
32 |
31 """ |
33 """ |
32 Dictionary that makes the relation between var names in plcopen and displayed values |
34 Dictionary that makes the relation between var names in plcopen and displayed values |
33 """ |
35 """ |
34 VarTypes = {"Local" : "localVars", "Temp" : "tempVars", "Input" : "inputVars", |
36 VarTypes = {"Local" : "localVars", "Temp" : "tempVars", "Input" : "inputVars", |
130 return test_result |
132 return test_result |
131 |
133 |
132 def TextMatched(str1, str2): |
134 def TextMatched(str1, str2): |
133 return str1 and str2 and (str1.upper() == str2.upper()) |
135 return str1 and str2 and (str1.upper() == str2.upper()) |
134 |
136 |
135 PLCOpenParser = GenerateParserFromXSD(os.path.join(os.path.split(__file__)[0], "tc6_xml_v201.xsd")) |
137 PLCOpenParser = GenerateParserFromXSD(paths.AbsNeighbourFile(__file__, "tc6_xml_v201.xsd")) |
136 PLCOpen_XPath = lambda xpath: etree.XPath(xpath, namespaces=PLCOpenParser.NSMAP) |
138 PLCOpen_XPath = lambda xpath: etree.XPath(xpath, namespaces=PLCOpenParser.NSMAP) |
137 |
139 |
138 LOAD_POU_PROJECT_TEMPLATE = """ |
140 LOAD_POU_PROJECT_TEMPLATE = """ |
139 <project xmlns:ns1="http://www.plcopen.org/xml/tc6_0201" |
141 <project xmlns:ns1="http://www.plcopen.org/xml/tc6_0201" |
140 xmlns:xhtml="http://www.w3.org/1999/xhtml" |
142 xmlns:xhtml="http://www.w3.org/1999/xhtml" |
165 <body> |
167 <body> |
166 <%(body_type)s>%%s</%(body_type)s> |
168 <%(body_type)s>%%s</%(body_type)s> |
167 </body> |
169 </body> |
168 </pou>""" % locals() |
170 </pou>""" % locals() |
169 |
171 |
170 PLCOpen_v1_file = open(os.path.join(os.path.split(__file__)[0], "TC6_XML_V10_B.xsd")) |
172 PLCOpen_v1_file = open(paths.AbsNeighbourFile(__file__, "TC6_XML_V10_B.xsd")) |
171 PLCOpen_v1_xml = PLCOpen_v1_file.read() |
173 PLCOpen_v1_xml = PLCOpen_v1_file.read() |
172 PLCOpen_v1_file.close() |
174 PLCOpen_v1_file.close() |
173 PLCOpen_v1_xml = PLCOpen_v1_xml.replace( |
175 PLCOpen_v1_xml = PLCOpen_v1_xml.replace( |
174 "http://www.plcopen.org/xml/tc6.xsd", |
176 "http://www.plcopen.org/xml/tc6.xsd", |
175 "http://www.plcopen.org/xml/tc6_0201") |
177 "http://www.plcopen.org/xml/tc6_0201") |