Splitted plc_Xenomai_main.c to enable further customization
authorEdouard Tisserant
Fri, 13 Mar 2015 17:19:58 +0100
changeset 1456 e723c1dd6faa
parent 1453 f31353cac197
child 1457 ff7cfce737ca
Splitted plc_Xenomai_main.c to enable further customization
targets/Xenomai/plc_Xenomai_main.c
targets/Xenomai/plc_Xenomai_main.c_noretain
targets/__init__.py
--- a/targets/Xenomai/plc_Xenomai_main.c	Fri Feb 27 00:40:44 2015 +0100
+++ b/targets/Xenomai/plc_Xenomai_main.c	Fri Mar 13 17:19:58 2015 +0100
@@ -363,23 +363,3 @@
     }    /* as plc does not wait for lock. */
 }
 
-int CheckRetainBuffer(void)
-{
-	return 1;
-}
-
-void ValidateRetainBuffer(void)
-{
-}
-
-void InValidateRetainBuffer(void)
-{
-}
-
-void Retain(unsigned int offset, unsigned int count, void *p)
-{
-}
-
-void Remind(unsigned int offset, unsigned int count, void *p)
-{
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/targets/Xenomai/plc_Xenomai_main.c_noretain	Fri Mar 13 17:19:58 2015 +0100
@@ -0,0 +1,20 @@
+int CheckRetainBuffer(void)
+{
+	return 1;
+}
+
+void ValidateRetainBuffer(void)
+{
+}
+
+void InValidateRetainBuffer(void)
+{
+}
+
+void Retain(unsigned int offset, unsigned int count, void *p)
+{
+}
+
+void Remind(unsigned int offset, unsigned int count, void *p)
+{
+}
--- a/targets/__init__.py	Fri Feb 27 00:40:44 2015 +0100
+++ b/targets/__init__.py	Fri Mar 13 17:19:58 2015 +0100
@@ -38,7 +38,9 @@
 
 targets = dict([(name, {"xsd":path.join(_base_path, name, "XSD"), 
                         "class":_GetLocalTargetClassFactory(name),
-                        "code": path.join(path.split(__file__)[0],name,"plc_%s_main.c"%name)})
+                        "code": { fname: path.join(_base_path, name, fname) 
+                                    for fname in listdir(path.join(_base_path, name))
+                                      if fname.startswith("plc_%s_main.c"%name)}})
                 for name in listdir(_base_path) 
                     if path.isdir(path.join(_base_path, name)) 
                        and not name.startswith("__")])
@@ -67,7 +69,9 @@
     return targetchoices
 
 def GetTargetCode(targetname):
-    return open(targets[targetname]["code"]).read()
+    codedesc = targets[targetname]["code"]
+    code = "\n".join([open(fpath).read() for fname, fpath in sorted(codedesc.items())])
+    return code
 
 def GetHeader():
     filename = path.join(path.split(__file__)[0],"beremiz.h")