Scoper = {} Scoper.get_scope = function(optional_locals_scope = null) scope = {} scope.map = map scope.list = list scope.number = number scope.string = string scope.globals = globals if optional_locals_scope == null then scope.locals = {} else scope.locals = optional_locals_scope end if return scope end function Scoper.shallow_copy = function(obj1, obj2) for i in obj2.indexes obj1[@i] = @obj2[@i] end for end function Scoper.transfer_scope = function(scope) self.shallow_copy(map, scope.map) self.shallow_copy(list, scope.list) self.shallow_copy(number, scope.number) self.shallow_copy(string, scope.string) self.shallow_copy(globals, scope.globals) end function Meta = {} Meta.shell = get_shell Meta.computer = Meta.shell.host_computer // PREPEND_MARK Meta.prepend_code = Meta.computer.File("/home/me/projects/igs/boilerplates/prepend.src").get_content // APPEND_MARK Meta.append_code = Meta.computer.File("/home/me/projects/igs/boilerplates/append.src").get_content // required options: // build_full_path, example /home/me/evals/evalscript.src Meta.init = function(build_full_path = "/home/guest/evalscript.src") self.build_full_path = build_full_path self.build_path = self.build_full_path.split("/")[0:-1].join("/") self.build_name = self.build_full_path.split("/")[-1] self.build_bin_name = self.build_name.split(".")[0] self.build_bin_full_path = self.build_path + "/" + self.build_bin_name end function Meta.eval = function(code, optional_locals_scope = null) eval_script_code = self.prepend_code + char(10) + code + char(10) + self.append_code self.computer.touch(self.build_path, self.build_name) eval_script = self.computer.File(self.build_full_path) eval_script.set_content(eval_script_code) compiler_out = get_shell.build(self.build_full_path, self.build_path) if compiler_out then print compiler_out return end if get_custom_object.parent_scope = Scoper.get_scope(optional_locals_scope) get_shell.launch(self.build_bin_full_path) if get_custom_object.hasIndex("child_scope") then Scoper.transfer_scope(get_custom_object.child_scope) end function Meta.console = function(optional_locals_scope = null) prompt_code = function(line = 0) code = user_input("igs("+line+")> ") if code == "continue" then return 0 if code.len > 0 and code.values[-1] == char(92) then return code[0:-1] + char(10) + prompt_code(line + 1) end if return code end function while true arbitrary_code = prompt_code if not arbitrary_code then return self.eval(arbitrary_code, optional_locals_scope) end while end function