include "primitives.alh" include "constructors.alh" Element function compilation_manager(): String op_com String name_com Boolean defines_com Element elem_com Element root_com Element node_com Element symbols_com Element keys_com Integer nr_com Integer i_com if (dict_in(dict_read(read_root(), "__hierarchy"), "objects")): root_com = dict_read(dict_read(read_root(), "__hierarchy"), "objects") else: root_com = create_node() dict_add(dict_read(read_root(), "__hierarchy"), "objects", root_com) op_com = input() if (string_eq(op_com, "upload")): name_com = input() node_com = create_node() dict_add(root_com, name_com, node_com) dict_add(node_com, "hash_md5", input()) if (input()): dict_add(node_com, "initializers", construct_top()) else: dict_add(node_com, "initializers", deserialize(input())) symbols_com = create_node() dict_add(node_com, "symbols", symbols_com) while (input()): dict_add(symbols_com, input(), input()) elif (string_eq(op_com, "read_symbols")): name_com = input() node_com = dict_read(dict_read(root_com, name_com), "symbols") keys_com = dict_keys(node_com) String rv rv = "" while (integer_lt(0, read_nr_out(keys_com))): elem_com = set_pop(keys_com) if (dict_read(node_com, elem_com)): rv = string_join(rv, string_join(elem_com, ":1\n")) else: rv = string_join(rv, string_join(elem_com, ":0\n")) output(rv) elif (string_eq(op_com, "read_initializers")): node_com = dict_read(dict_read(root_com, input()), "initializers") output(node_com) elif (string_eq(op_com, "remove_obj")): dict_delete(root_com, input()) elif (string_eq(op_com, "is_defined")): name_com = input() if (dict_in(root_com, name_com)): output(dict_read(dict_read(root_com, name_com), "hash_md5")) else: output(create_node()) else: log("Failed to understand command") return op_com