12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- include "primitives.alh"
- include "constructors.alh"
- Element function compilation_manager():
- String operation
- String object_name
- Element root
- Element node
- if (dict_in(dict_read(read_root(), "__hierarchy"), "objects")):
- root = dict_read(dict_read(read_root(), "__hierarchy"), "objects")
- else:
- root = create_node()
- dict_add(dict_read(read_root(), "__hierarchy"), "objects", root)
- operation = input()
- if (operation == "upload"):
- object_name = input()
- node = create_node()
- dict_add(root, object_name, node)
- dict_add(node, "hash_md5", input())
- if (input()):
- dict_add(node, "initializers", construct_top())
- else:
- dict_add(node, "initializers", deserialize(input()))
- Element symbols
- symbols = create_node()
- dict_add(node, "symbols", symbols)
- while (input()):
- dict_add(symbols, input(), input())
- elif (operation == "read_symbols"):
- Element keys
- object_name = input()
- node = dict_read(dict_read(root, object_name), "symbols")
- keys = dict_keys(node)
- String rv
- rv = ""
- String key
- while (0 < read_nr_out(keys)):
- key = set_pop(keys)
- if (dict_read(node, key)):
- rv = (rv + key) + ":1\n"
- else:
- rv = (rv + key) + ":0\n"
- output(rv)
- elif (operation == "read_initializers"):
- node = dict_read(dict_read(root, input()), "initializers")
- output(node)
- elif (operation == "remove_obj"):
- dict_delete(root, input())
- elif (operation == "is_defined"):
- object_name = input()
- if (dict_in(root, object_name)):
- output(dict_read(dict_read(root, object_name), "hash_md5"))
- else:
- output(create_node())
- else:
- log("Failed to understand command")
- return operation
|