targets/__init__.py
changeset 209 08dc3d064cb5
parent 205 ee8d1f4528ef
child 425 f390e9fdd2cf
--- a/targets/__init__.py	Thu Aug 21 13:21:37 2008 +0200
+++ b/targets/__init__.py	Thu Aug 21 17:17:36 2008 +0200
@@ -64,11 +64,14 @@
 for target in DictXSD_target.keys():
     targetchoices += DictXSD_target[target]
 
-def code(target_name):
-    filename = path.join(path.split(__file__)[0], target_name, "plc_%s_main.c"%target_name)
-    if path.exists(filename):
-        return open(filename).read()
-    else:
-        return "#error %s target not implemented !!!\n"%target_name
+def targetcode(target_name, code_name=None):
+    if code_name is None:
+        code_name="plc_%s_main.c"%target_name
+    filename = path.join(path.split(__file__)[0], target_name, code_name)
+    return open(filename).read()
+
+def code(name):
+    filename = path.join(path.split(__file__)[0],name + ".c")
+    return open(filename).read()
 
 from toolchain_gcc import toolchain_gcc
\ No newline at end of file