task_manager.alc 1.2 KB

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