include "io.alh" include "primitives.alh" include "metamodels.alh" include "core_algorithm.alh" include "random.alh" Void function task_management(): String taskname Element task_root Element task_frame Element output_value Element input_value // Initialize the basic formalisms before allowing new users initialize_MMs() initialize_core() taskname = "task_manager" while (True): if (other_has_output("task_manager")): sleep(0.05) else: // Task is gone, so make sure that we create a new one already while (dict_in(read_root(), taskname)): taskname = cast_string(random_string(20)) 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()) //Add this only at the end, as otherwise the task will already be detected dict_add_fast(read_root(), taskname, task_root) output(taskname) return!