task_manager.alc 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. include "io.alh"
  2. include "primitives.alh"
  3. include "metamodels.alh"
  4. include "core_algorithm.alh"
  5. Void function task_management():
  6. String taskname
  7. Element task_root
  8. Element task_frame
  9. Element output_value
  10. Element input_value
  11. // Initialize the basic formalisms before allowing new users
  12. initialize_MMs()
  13. initialize_core()
  14. while (True):
  15. taskname = input()
  16. if (bool_not(dict_in(read_root(), taskname))):
  17. task_root = create_node()
  18. task_frame = create_node()
  19. output_value = create_node()
  20. input_value = create_node()
  21. dict_add_fast(task_root, "frame", task_frame)
  22. dict_add_fast(task_root, "globals", create_node())
  23. dict_add_fast(task_root, "output", output_value)
  24. dict_add_fast(task_root, "last_output", output_value)
  25. dict_add_fast(task_root, "input", input_value)
  26. dict_add_fast(task_root, "last_input", input_value)
  27. dict_add_fast(task_frame, "evalstack", create_node())
  28. dict_add_fast(task_frame, "returnvalue", create_node())
  29. dict_add_fast(task_frame, "phase", "init")
  30. dict_add_fast(task_frame, "IP", dict_read(dict_read(read_root(), "__hierarchy"), "__IP"))
  31. dict_add_fast(task_frame, "symbols", create_node())
  32. //Add this only at the end, as otherwise the task will already be detected
  33. dict_add_fast(read_root(), taskname, task_root)
  34. return!