1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- include "primitives.alh"
- include "constructors.alh"
- Element function read_symbols(root : Element, object_name : String):
- Element keys
- Element node
- String rv
- String key
- node = root[object_name]["symbols"]
- keys = dict_keys(node)
- rv = ""
- while (0 < read_nr_out(keys)):
- key = set_pop(keys)
- if (node[key]):
- rv = (rv + key) + ":1\n"
- else:
- rv = (rv + key) + ":0\n"
- return rv
- Element function compilation_manager():
- String operation
- String object_name
- Element root
- Element mv_root
- Element node
- mv_root = read_root()
- if (dict_in(mv_root["__hierarchy"], "objects")):
- root = mv_root["__hierarchy"]["objects"]
- else:
- root = create_node()
- dict_add(mv_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 == "remove_obj"):
- dict_delete(root, input())
- elif (operation == "read_symbols"):
- output(read_symbols(root, input()))
- elif (operation == "read_initializers"):
- node = root[input()]["initializers"]
- output(node)
- elif (operation == "is_defined"):
- object_name = input()
- if (dict_in(root, object_name)):
- output(root[object_name]["hash_md5"])
- else:
- output(create_node())
- else:
- log("Failed to understand command")
- return operation
|