Sfoglia il codice sorgente

Add missing files for bootstrapper

Yentl Van Tendeloo 8 anni fa
parent
commit
669e37c18f

+ 23 - 0
bootstrap/user_interface.alc

@@ -0,0 +1,23 @@
+// Do this only in the bootstrapper
+include "io.alh"
+include "primitives.alh"
+include "compilation_manager.alh"
+include "constructors.alh"
+include "modelling.alh"
+
+Void function new_user():
+	Integer interface
+	while (True):
+		interface = input()
+		if (interface == 0):
+			exec(deserialize(input()))
+		elif (interface == 1):
+			exec(construct_unknown())
+		elif (interface == 2):
+			output("DONE")
+		elif (interface == 3):
+			compilation_manager()
+		elif (interface == 4):
+			construct_model()
+		else:
+			log("Unsupported interface!")

+ 35 - 0
bootstrap/user_manager.alc

@@ -0,0 +1,35 @@
+include "io.alh"
+include "primitives.alh"
+
+Void function user_management():
+	String username
+	Element user_root
+	Element user_frame
+	Element output_value
+	Element input_value
+	
+	while (True):
+		username = input()
+		if (string_startswith(username, "__")):
+			username = string_substr(username, 2, string_len(username) - 1)
+			dict_delete(read_root(), username)
+		else:
+			if (bool_not(dict_in(read_root(), username))):
+				user_root = create_node()
+				user_frame = create_node()
+				output_value = create_node()
+				input_value = create_node()
+				dict_add(user_root, "frame", user_frame)
+				dict_add(user_root, "globals", create_node())
+				dict_add(user_root, "output", output_value)
+				dict_add(user_root, "last_output", output_value)
+				dict_add(user_root, "input", input_value)
+				dict_add(user_root, "last_input", input_value)
+				dict_add(user_frame, "evalstack", create_node())
+				dict_add(user_frame, "returnvalue", create_node())
+				dict_add(user_frame, "phase", "init")
+				dict_add(user_frame, "IP", dict_read(dict_read(read_root(), "__hierarchy"), "__IP"))
+				dict_add(user_frame, "symbols", create_node())
+
+				//Add this only at the end, as otherwise the user will already be detected
+				dict_add(read_root(), username, user_root)

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

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

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

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