Ver código fonte

Remove deprecated functions

Yentl Van Tendeloo 8 anos atrás
pai
commit
adc1d03bcc

+ 0 - 1
bootstrap/bootstrap.py

@@ -103,7 +103,6 @@ def bootstrap():
                     "element_neq": ["Boolean", "Element", "Element"],
                     "read_root": ["Element"],
                     "read_taskroot": ["Element"],
-                    "deserialize": ["Element", "String"],
                     "log": ["String", "String"],
                     "time": ["Float"],
                     "hash": ["String", "String"],

+ 0 - 129
bootstrap/compilation_manager.alc

@@ -1,129 +0,0 @@
-include "primitives.alh"
-include "constructors.alh"
-include "conformance_scd.alh"
-
-Void function compilation_manager():
-	String operation
-	String object_name
-	Element root
-	Element mv_root
-	Element node
-
-	mv_root = read_root()
-	root = mv_root["__hierarchy"]["objects"]
-
-	operation = input()
-	if (operation == "upload"):
-		object_name = input()
-		node = create_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())
-
-		if (dict_in(root, object_name)):
-			// Already exists, so remove first
-			dict_delete(root, object_name)
-		dict_add(root, object_name, node)
-	elif (operation == "read_initializers"):
-		node = root[input()]["initializers"]
-		output(node)
-	elif (operation == "link_and_load"):
-		Element objs
-		String obj
-
-		objs = create_node()
-		obj = input()
-		while (obj != ""):
-			if (dict_in(root, obj)):
-				set_add(objs, obj)
-			else:
-				log("ERROR: couldn't find obj " + obj)
-			obj = input()
-
-		link_and_load(root, input(), objs)
-	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!
-
-String function check_symbols(root : Element, main_function : String, objs : Element):
-	Element symbols
-	String obj
-	Element keys
-	String key
-	Element copy_objs
-
-	// We always need a main variable
-	symbols = create_node()
-	dict_add(symbols, main_function, False)
-
-	// Resolve all symbols
-	copy_objs = set_copy(objs)
-	while (0 < list_len(copy_objs)):
-		obj = set_pop(copy_objs)
-		keys = dict_keys(root[obj]["symbols"])
-		while (0 < list_len(keys)):
-			key = set_pop(keys)
-
-			if (root[obj]["symbols"][key]):
-				// Defines
-				if (bool_not(dict_in(symbols, key))):
-					// Not yet in dictionary
-					dict_add(symbols, key, True)
-				elif (symbols[key]):
-					// Already in dictionary, and it was already defined
-					return "ERROR: multiple definition of symbol " + key!
-				else:
-					// Already in dictionary, but only used
-					dict_delete(symbols, key)
-					dict_add(symbols, key, True)
-			else:
-				// Uses
-				if (bool_not(dict_in(symbols, key))):
-					dict_add(symbols, key, False)
-
-	// Check whether we have everything
-	keys = dict_keys(symbols)
-	while (0 < list_len(keys)):
-		key = set_pop(keys)
-		if (bool_not(symbols[key])):
-			if (bool_not(bool_or(key == "output", key == "input"))):
-				return "ERROR: undefined symbol " + key!
-
-	return "OK"!
-
-Void function link_and_load(root : Element, main_function : String, objs : Element):
-	String obj
-	Element func
-	Element main_f
-	String result
-
-	result = check_symbols(root, main_function, objs)
-	output(result)
-
-	if (result == "OK"):
-		// Symbols verified OK, start execution
-		// Call all initializers in turn
-		while (0 < list_len(objs)):
-			obj = set_pop(objs)
-			func = root[obj]["initializers"]
-			exec(func)
-
-		// Resolve the main function, which should now be in (global) scope, and execute it
-		main_f = resolve(main_function)
-		main_f()
-	return!

+ 0 - 1
bootstrap/initial_code_manager.alc

@@ -5,7 +5,6 @@ Void function __main():
 	Element root
 	root = read_root()
 	root = root["__hierarchy"]["objects"]
-	exec(root["bootstrap/compilation_manager.alc"]["initializers"])
 	exec(root["bootstrap/constructors.alc"]["initializers"])
 	exec(root["bootstrap/library.alc"]["initializers"])
 	exec(root["bootstrap/object_operations.alc"]["initializers"])

+ 0 - 1
bootstrap/initial_code_task.alc

@@ -5,7 +5,6 @@ Void mutable function __main():
 	Element root
 	root = read_root()
 	root = root["__hierarchy"]["objects"]
-	exec(root["bootstrap/compilation_manager.alc"]["initializers"])
 	exec(root["bootstrap/.metamodels.alc"]["initializers"])
 	exec(root["bootstrap/mini_modify.alc"]["initializers"])
 	exec(root["bootstrap/core_algorithm.alc"]["initializers"])

+ 0 - 1
bootstrap/mini_modify.alc

@@ -6,7 +6,6 @@ include "conformance_scd.alh"
 include "io.alh"
 include "metamodels.alh"
 include "modelling.alh"
-include "compilation_manager.alh"
 
 Boolean verbose = True
 

+ 0 - 1
bootstrap/primitives.alc

@@ -72,7 +72,6 @@ String function string_join(a: String, b: String) = ?primitives/string_join
 String function string_get(a: String, b: Integer) = ?primitives/string_get
 Element function string_split(a: String, b: String) = ?primitives/string_split
 Integer function string_len(a: String) = ?primitives/string_len
-Element function deserialize(a: String) = ?primitives/deserialize
 Element function log(a: String) = ?primitives/log
 Element function read_root() = ?primitives/read_root
 Element function read_taskroot() = ?primitives/read_taskroot

+ 0 - 1
interface/HUTN/includes/compilation_manager.alh

@@ -1 +0,0 @@
-Void function compilation_manager()

+ 0 - 1
interface/HUTN/includes/primitives.alh

@@ -79,7 +79,6 @@ String function string_substr(a: String, b: Integer, c: Integer)
 Integer function string_len(a: String) 
 Element function string_split(a: String, b: String) 
 Boolean function string_startswith(a: String, b: String) 
-Element function deserialize(a: String) 
 String function log(a: String)
 Element function read_root()
 Element function read_taskroot()

+ 0 - 69
kernel/modelverse_kernel/primitives.py

@@ -505,75 +505,6 @@ def is_edge(a, **remainder):
     result, = yield [("CNV", [edge[0] is not None])]
     raise PrimitiveFinished(result)
 
-#TODO deprecate
-def deserialize(a, root, **remainder):
-    value, = yield [("RV", [a])]
-    id_mappings = {}
-    complex_primitives = frozenset(["if", "while", "assign", "call", "break", "continue", "return","resolve","access", "constant", "input", "output", "declare", "global"])
-    for l in value.split("\n"):
-        try:
-            graph_type, constructor = l.split(None, 1)
-        except:
-            continue
-        if graph_type == "N":
-            # Node
-            id_mappings[constructor], = yield [("CN", [])]
-        elif graph_type == "V":
-            # Node with Value
-            name, temp = constructor.split("(", 1)
-            string_value = temp[:-1]
-            if string_value in complex_primitives:
-                value = {"value": string_value}
-            else:
-                #TODO this is very dangerous!
-                value = eval(string_value)
-            id_mappings[name], = yield [("CNV", [value])]
-        elif graph_type == "E":
-            # Edge
-            name, temp = constructor.split("(", 1)
-            source, target = temp[:-1].split(",", 1)
-            if target[0] == "?" and target not in id_mappings:
-                hierarchy = target[1:].split("/")
-                current, = yield [("RD", [root, "__hierarchy"])]
-                for i in hierarchy:
-                    current, = yield [("RD", [current, i])]
-                id_mappings[target] = current
-            try:
-                source = int(source)
-            except:
-                source = id_mappings[source]
-            try:
-                target = int(target)
-            except:
-                target = id_mappings[target]
-            # Both nodes will normally be already present in the matching dictionary, so can just pass them along
-            id_mappings[name], = yield [("CE", [source, target])]
-        elif graph_type == "D":
-            source, value, target = constructor.split(",",3)
-            if value in complex_primitives:
-                value = {"value": value}
-            else:
-                #TODO this is very dangerous!
-                value = eval(value)
-            if target[0] == "?" and target not in id_mappings:
-                hierarchy = target[1:].split("/")
-                current, = yield [("RD", [root, "__hierarchy"])]
-                for i in hierarchy:
-                    current, = yield [("RD", [current, i])]
-                id_mappings[target] = current
-            try:
-                source = int(source)
-            except:
-                source = id_mappings[source]
-            try:
-                target = int(target)
-            except:
-                target = id_mappings[target]
-            yield [("CD", [source, value, target])]
-        else:
-            print("Unknown graph type: " + str(graph_type))
-    raise PrimitiveFinished(id_mappings["auto_initial_IP"])
-
 def log(a, **remainder):
     a_value, = yield [("RV", [a])]
     print("== LOG == " + str(a_value))