--- a/LPCBeremiz.py Fri Jun 04 13:09:35 2010 +0200
+++ b/LPCBeremiz.py Fri Jun 04 13:47:02 2010 +0200
@@ -144,13 +144,15 @@
/* LPCBus plugin user variables definition */
/* LPCBus plugin functions */
int __init_%(location_str)s(int argc,char **argv)
@@ -288,13 +290,14 @@
code_str = {"location_str": location_str,
- for variable in _GetVariables(self):
- if variable["declare"] != "":
- code_str["declare_code"] += " %s\n" % variable["declare"]
+ for module in _GetModuleChildren(self): + if module["init"] != "": + code_str["init_code"] += " %s\n" % module["init"] @@ -337,7 +340,7 @@
code_str["publish_code"] += " " + var["Publish"] % ("*" + var["location"]) + "\n"
- Gen_Module_path = os.path.join(buildpath, "Module_%s.c"%location_str)
+ Gen_Module_path = os.path.join(buildpath, "Bus_%s.c"%location_str) module = open(Gen_Module_path,'w')
module.write(BUS_TEXT % code_str)
@@ -1232,7 +1235,7 @@
self.PluginRoot.PluggedChilds["LPCBus"].remove(bus)
- def AddModule(self, parent, iec_channel, name, icon=None):
+ def AddModule(self, parent, iec_channel, name, icode, icon=None): module = self.PluginRoot.GetChildByIECLocation(parent)
return "Error: No parent found\n"
@@ -1245,6 +1248,7 @@
"IEC_Channel": iec_channel,
@@ -1276,7 +1280,13 @@
self.PluginRoot.UpdateProjectVariableLocation(".".join(map(str, old_iec_location)), ".".join(map(str, old_iec_location[:1] + (new_iec_channel,))))
module["IEC_Channel"] = new_iec_channel
+ def ChangeModuleInitCode(self, iec_location, icode): + module = self.PluginRoot.GetChildByIECLocation(iec_location) + return "Error: No module found\n" def RemoveModule(self, parent, iec_channel):
module = self.PluginRoot.GetChildByIECLocation(parent)
@@ -1301,7 +1311,7 @@
- def AddVariable(self, parent, location, name, direction, type, dcode, rcode, pcode, description=""):
+ def AddVariable(self, parent, location, name, direction, type, rcode, pcode, description=""): module = self.PluginRoot.GetChildByIECLocation(parent)
return "Error: No parent found\n"
@@ -1315,12 +1325,11 @@
"type": LOCATION_TYPES[direction],
"description": description,
- def ChangeVariableParams(self, parent, location, new_name, new_direction, new_type, new_dcode, new_rcode, new_pcode, new_description=None):
+ def ChangeVariableParams(self, parent, location, new_name, new_direction, new_type, new_rcode, new_pcode, new_description=None): module = self.PluginRoot.GetChildByIECLocation(parent)
return "Error: No parent found\n"
@@ -1337,7 +1346,6 @@
variable["name"] = new_name
variable["type"] = LOCATION_TYPES[new_direction]
variable["IEC_type"] = new_type
- variable["declare"] = new_dcode
variable["retrieve"] = new_rcode
variable["publish"] = new_pcode
if new_description is not None:
@@ -1434,13 +1442,14 @@
"RenameBus": ([int, str], 0),
"ChangeBusIECChannel": ([int, int], 0),
- "AddModule": ([location, int, str, str], 1),
+ "AddModule": ([location, int, str, str, str], 1), "RenameModule": ([location, str], 0),
"ChangeModuleIECChannel": ([location, int], 0),
+ "ChangeModuleInitCode": ([location, str], 0), "RemoveModule": ([location, int], 0),
"StartGroup": ([location, str, str], 1),
- "AddVariable": ([location, location, str, str, str, str, str, str, str], 1),
- "ChangeVariableParams": ([location, location, str, str, str, str, str, str, str], 1),
+ "AddVariable": ([location, location, str, str, str, str, str, str], 1), + "ChangeVariableParams": ([location, location, str, str, str, str, str, str], 1), "RemoveVariable": ([location, location], 0)}.iteritems():
setattr(LPCBeremiz_Cmd, "do_%s" % function, GetCmdFunction(function, arg_types, opt))