Quellcode durchsuchen

Fix the use of / in function definition in AL2PY

Yentl Van Tendeloo vor 7 Jahren
Ursprung
Commit
9f75ee5c25
2 geänderte Dateien mit 4 neuen und 4 gelöschten Zeilen
  1. 3 3
      models/AL_to_py.alc
  2. 1 1
      wrappers/modelverse_SCCD.py

+ 3 - 3
models/AL_to_py.alc

@@ -207,7 +207,7 @@ Boolean function main(model : Element):
 		Element params
 		String param
 		params = dict_keys(model["model"][function]["params"])
-		code = "def func_" + function + "):\n"
+		code = "def func_" + cast_id(model["model"][function]) + "("
 		while (set_len(params) > 0):
 			param = set_pop(params)
 			log("  " + param + " --> " + cast_id(model["model"][function]["params"][param]))
@@ -232,8 +232,8 @@ Boolean function main(model : Element):
 	log("Finding initial function...")
 	function = set_pop(allInstances(model, "AL/Initial"))
 	function = set_pop(allAssociationDestinations(model, function, "AL/initial_funcdef"))
-	log("Initial function: " + function)
-	code = code + "main = func_" + function + "\n"
+	log("Initial function: " + cast_id(model["model"][function])
+	code = code + "main = func_" + cast_id(model["model"][function] + "\n"
 
 	// Found the main function, though we only have the name of the function to assign...
 	// What we can do is reassign main to that function!

+ 1 - 1
wrappers/modelverse_SCCD.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Wed Apr  4 16:40:16 2018
+Date:   Thu Apr  5 07:25:36 2018
 
 Model author: Yentl Van Tendeloo
 Model name:   MvK Server