Переглянути джерело

Revert "Preliminary support for spawning a new task to a specific function"

This reverts commit dad216b4b20dfea43f07187a7ba8b3e0107a6cd5.
Yentl Van Tendeloo 7 роки тому
батько
коміт
697179ac22

BIN
bootstrap/bootstrap.m.gz


+ 2 - 2
bootstrap/core_algorithm.alc

@@ -211,7 +211,7 @@ Boolean function check_login(user_id : String):
 
 	return password == stored_password!
 
-Element function new_task(parameters : Element):
+Void function new_task():
 	String username
 	String user_id
 	String password
@@ -250,7 +250,7 @@ Element function new_task(parameters : Element):
 	user_function_skip_init(user_id)
 
 	// User destroyed already, so just stop execution
-	return create_node()!
+	return!
 
 String function get_entry_id(name : String):
 	Element hierarchy_split

+ 1 - 9
bootstrap/initial_code_task.alc

@@ -1,7 +1,6 @@
 include "bootstrap/primitives.alc"
 include "bootstrap/semi_primitives.alc"
 include "core_algorithm.alh"
-include "utils.alh"
 
 Void mutable function __main():
 	Element root
@@ -26,12 +25,5 @@ Void mutable function __main():
 	exec(root["bootstrap/typing.alc"]["initializers"])
 	exec(root["bootstrap/compiler.alc"]["initializers"])
 	exec(root["bootstrap/json.alc"]["initializers"])
-
-	Element initial_function
-	Element initial_arguments
-	root = read_root()
-	initial_function = root[get_taskname()]["globals"]["initial_function"]
-	initial_arguments = root[get_taskname()]["globals"]["initial_arguments"]
-
-	initial_function(initial_arguments)
+	new_task()
 	return!

+ 0 - 3
bootstrap/task_manager.alc

@@ -33,9 +33,6 @@ Void function task_management():
 			dict_add_fast(task_frame, "IP", dict_read(dict_read(read_root(), "__hierarchy"), "__IP"))
 			dict_add_fast(task_frame, "symbols", create_node())
 
-			dict_add_fast(task_root["globals"], "initial_function", new_task)
-			dict_add_fast(task_root["globals"], "initial_arguments", list_create())
-
 			//Add this only at the end, as otherwise the task will already be detected
 			dict_add_fast(read_root(), taskname, task_root)
 	return!

+ 0 - 92
bootstrap/utils.alc

@@ -2,7 +2,6 @@ include "modelling.alh"
 include "primitives.alh"
 include "object_operations.alh"
 include "model_management.alh"
-include "random.alh"
 
 String function JSON_print(model : Element):
 	String result
@@ -135,94 +134,3 @@ Element function alphabet():
 	list_append(chars, "y")
 	list_append(chars, "z")
 	return chars!
-
-String function spawn_TODO(function : Element, arguments : Element):
-	// Define a new task, with all the required stack information
-	// This is taken from the "task_management" code
-	Element task_root
-	Element task_frame
-	Element output_value
-	Element input_value 
-
-	task_root = create_node()
-	task_frame = create_node()
-	output_value = create_node()
-	input_value = create_node()
-	dict_add_fast(task_root, "frame", task_frame)
-	dict_add_fast(task_root, "globals", create_node())
-	dict_add_fast(task_root, "output", output_value)
-	dict_add_fast(task_root, "last_output", output_value)
-	dict_add_fast(task_root, "input", input_value)
-	dict_add_fast(task_root, "last_input", input_value)
-	dict_add_fast(task_frame, "evalstack", create_node())
-	dict_add_fast(task_frame, "returnvalue", create_node())
-	dict_add_fast(task_frame, "phase", "init")
-	dict_add_fast(task_frame, "IP", dict_read(dict_read(read_root(), "__hierarchy"), "__IP"))
-	dict_add_fast(task_frame, "symbols", create_node())
-
-	log("Setting IP to " + cast_value(function["body"]))
-	log("Has outputs: " + set_to_string(dict_keys(function)))
-
-	if (dict_in(function, "params")):
-		// And add the arguments to the symbol table
-		Element symbols
-		String arg_names_call
-		Element param_dict
-		Integer arg_i
-
-		symbols = task_frame["symbols"]
-		arg_names_call = "abcdefghijklmnopqrstuvwxyz"
-		arg_i = 0
-		param_dict = function["params"]
-		
-		arguments = list_copy(arguments)
-		Element t
-		while (list_len(arguments) > 0):
-			t = create_edge(symbols, list_pop(arguments, 0))
-			create_edge(t, param_dict[arg_names_call[arg_i]])
-			arg_i = arg_i + 1
-
-	// Add this only at the end, as otherwise the task will already be detected and executed
-	String taskname
-	taskname = random_string(30)
-	while (dict_in(read_root(), taskname)):
-		taskname = random_string(30)
-	dict_add_fast(read_root(), taskname, task_root)
-
-	return taskname!
-
-String function spawn(function : Element, arguments : Element):
-	// Define a new task, with all the required stack information
-	// This is taken from the "task_management" code
-	Element task_root
-	Element task_frame
-	Element output_value
-	Element input_value 
-
-	task_root = create_node()
-	task_frame = create_node()
-	output_value = create_node()
-	input_value = create_node()
-	dict_add_fast(task_root, "frame", task_frame)
-	dict_add_fast(task_root, "globals", create_node())
-	dict_add_fast(task_root, "output", output_value)
-	dict_add_fast(task_root, "last_output", output_value)
-	dict_add_fast(task_root, "input", input_value)
-	dict_add_fast(task_root, "last_input", input_value)
-	dict_add_fast(task_frame, "evalstack", create_node())
-	dict_add_fast(task_frame, "returnvalue", create_node())
-	dict_add_fast(task_frame, "phase", "init")
-	dict_add_fast(task_frame, "IP", dict_read(dict_read(read_root(), "__hierarchy"), "__IP"))
-	dict_add_fast(task_frame, "symbols", create_node())
-
-	dict_add_fast(task_root["globals"], "initial_function", function)
-	dict_add_fast(task_root["globals"], "initial_arguments", arguments)
-
-	// Add this only at the end, as otherwise the task will already be detected and executed
-	String taskname
-	taskname = random_string(30)
-	while (dict_in(read_root(), taskname)):
-		taskname = random_string(30)
-	dict_add_fast(read_root(), taskname, task_root)
-
-	return taskname!

+ 0 - 2
interface/HUTN/hutn_compiler/semantics_visitor.py

@@ -563,7 +563,6 @@ class SemanticsVisitor(Visitor):
                                        tree.startpos['column'],
                                        symbol.signature()))
 
-        """
         for i in range(len(expressions)):
             arg_type = self.get_type(expressions[i])
             param_type = symbol.params[i]
@@ -581,7 +580,6 @@ class SemanticsVisitor(Visitor):
             if type(arg_type) != type(param_type):
                 self.perform_implicit_cast(tree, expressions[i], arg_type,
                                            param_type)
-        """
 
         if symbol.name == "__input":
             tree.head = "input"

+ 0 - 1
interface/HUTN/includes/utils.alh

@@ -6,4 +6,3 @@ String function get_taskname()
 Void function sleep(seconds : Float)
 Element function alphabet()
 Element function string_split_nr(str : String, split : String, count : Integer)
-String function spawn(function : Element, arguments : Element)

+ 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:   Fri Nov 10 08:25:42 2017
+Date:   Fri Nov 10 08:46:06 2017
 
 Model author: Yentl Van Tendeloo
 Model name:   MvK Server