added memory location support to C file pluguin
authorEdouard Tisserant
Wed, 18 May 2011 11:21:10 +0200
changeset 603 e1ef99c609eb
parent 602 6da88269088d
child 604 5b1c92060fc2
added memory location support to C file pluguin
plugins/c_ext/CFileEditor.py
plugins/c_ext/c_ext.py
plugins/c_ext/cext_xsd.xsd
--- a/plugins/c_ext/CFileEditor.py	Mon May 16 12:41:23 2011 +0200
+++ b/plugins/c_ext/CFileEditor.py	Wed May 18 11:21:10 2011 +0200
@@ -529,7 +529,7 @@
                     editor = wx.grid.GridCellTextEditor()
                 elif colname == "Class":
                     editor = wx.grid.GridCellChoiceEditor()
-                    editor.SetParameters("input,output")
+                    editor.SetParameters("input,memory,output")
                 elif colname == "Type":
                     pass
                 else:
@@ -770,6 +770,11 @@
                 for i in xrange(row):
                     if self.Table.GetValueByName(i, "Class") == "input":
                         num += 1
+            elif self.Table.GetValueByName(row, "Class") == "memory":
+                dir = "%M"
+                for i in xrange(row):
+                    if self.Table.GetValueByName(i, "Class") == "memory":
+                        num += 1
             else:
                 dir = "%Q"
                 for i in xrange(row):
--- a/plugins/c_ext/c_ext.py	Mon May 16 12:41:23 2011 +0200
+++ b/plugins/c_ext/c_ext.py	Wed May 18 11:21:10 2011 +0200
@@ -166,13 +166,17 @@
         current_location = ".".join(map(str, self.GetCurrentLocation()))
         
         vars = []
-        input = output = 0
+        input = memory = 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
+            elif var.getclass() == "memory":
+                var_class = LOCATION_VAR_INPUT
+                var_location = "%%M%s%s.%d"%(var_size, current_location, memory)
+                memory += 1
             else:
                 var_class = LOCATION_VAR_OUTPUT
                 var_location = "%%Q%s%s.%d"%(var_size, current_location, output)
@@ -303,12 +307,15 @@
 
         # Adding variables
         vars = []
-        inputs = outputs = 0
+        inputs = memories = outputs = 0
         for variable in self.CFile.variables.variable:
             var = {"Name" : variable.getname(), "Type" : variable.gettype()}
             if variable.getclass() == "input":
                 var["location"] = "__I%s%s_%d"%(self.GetSizeOfType(var["Type"]), location_str, inputs)
                 inputs += 1
+            elif variable.getclass() == "memory":
+                var["location"] = "__M%s%s_%d"%(self.GetSizeOfType(var["Type"]), location_str, memories)
+                memories += 1
             else:
                 var["location"] = "__Q%s%s_%d"%(self.GetSizeOfType(var["Type"]), location_str, outputs)
                 outputs += 1
--- a/plugins/c_ext/cext_xsd.xsd	Mon May 16 12:41:23 2011 +0200
+++ b/plugins/c_ext/cext_xsd.xsd	Wed May 18 11:21:10 2011 +0200
@@ -20,6 +20,7 @@
                     <xsd:simpleType>
                       <xsd:restriction base="xsd:string">
                         <xsd:enumeration value="input"/>
+                        <xsd:enumeration value="memory"/>
                         <xsd:enumeration value="output"/>
                       </xsd:restriction>
                     </xsd:simpleType>