Browse Source

Fix the use of / in function definition in AL2PY

Yentl Van Tendeloo 7 years ago
parent
commit
9f75ee5c25
2 changed files with 4 additions and 4 deletions
  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
 		Element params
 		String param
 		String param
 		params = dict_keys(model["model"][function]["params"])
 		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):
 		while (set_len(params) > 0):
 			param = set_pop(params)
 			param = set_pop(params)
 			log("  " + param + " --> " + cast_id(model["model"][function]["params"][param]))
 			log("  " + param + " --> " + cast_id(model["model"][function]["params"][param]))
@@ -232,8 +232,8 @@ Boolean function main(model : Element):
 	log("Finding initial function...")
 	log("Finding initial function...")
 	function = set_pop(allInstances(model, "AL/Initial"))
 	function = set_pop(allInstances(model, "AL/Initial"))
 	function = set_pop(allAssociationDestinations(model, function, "AL/initial_funcdef"))
 	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...
 	// 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!
 	// 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)
 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 author: Yentl Van Tendeloo
 Model name:   MvK Server
 Model name:   MvK Server