--- a/plugins/c_ext/c_ext.py Thu Sep 24 18:26:11 2009 +0200
+++ b/plugins/c_ext/c_ext.py Thu Sep 24 18:27:45 2009 +0200
@@ -1,11 +1,13 @@
import wx
import os
+from xml.dom import minidom
+import cPickle
+
+from xmlclass import *
+
from plugger import PlugTemplate
from CFileEditor import CFileEditor
-
-from xml.dom import minidom
-from xmlclass import *
-import cPickle
+from PLCControler import PLCControler, LOCATION_PLUGIN, LOCATION_MODULE, LOCATION_GROUP, LOCATION_VAR_INPUT, LOCATION_VAR_OUTPUT, LOCATION_VAR_MEMORY
CFileClasses = GenerateClassesFromXSD(os.path.join(os.path.dirname(__file__), "cext_xsd.xsd"))
@@ -158,6 +160,33 @@
datas.append({"Name" : var.getname(), "Type" : var.gettype(), "Class" : var.getclass()})
return datas
+ def GetVariableLocationTree(self):
+ '''See PlugTemplate.GetVariableLocationTree() for a description.'''
+
+ current_location = ".".join(map(str, self.GetCurrentLocation()))
+
+ vars = []
+ input = output = 0
+ for var in self.CFile.variables.getvariable():
+ var_size = self.GetSizeOfType(var.gettype())
+ if var.getclass() == "input":
+ var_class = LOCATION_VAR_INPUT
+ var_location = "%%I%s%s.%d"%(var_size, current_location, input)
+ input += 1
+ else:
+ var_class = LOCATION_VAR_OUTPUT
+ var_location = "%%Q%s%s.%d"%(var_size, current_location, output)
+ output += 1
+ vars.append({"name": var.getname(),
+ "type": var_class,
+ "size": var_size,
+ "IEC_type": var.gettype(),
+ "location": var_location,
+ "description": "",
+ "children": []})
+
+ return vars
+
def SetPartText(self, name, text):
if name == "Includes":
self.CFile.includes.settext(text)
@@ -237,7 +266,7 @@
"""
current_location = self.GetCurrentLocation()
# define a unique name for the generated C file
- location_str = "_".join(map(lambda x:str(x), current_location))
+ location_str = "_".join(map(str, current_location))
text = "/* Code generated by Beremiz c_ext plugin */\n\n"