hehe it's all inside the toplevel now

This commit is contained in:
cqc
2021-08-10 20:45:06 -05:00
parent 73d9260b1f
commit a4c10bbf57
7 changed files with 51 additions and 34 deletions

View File

@ -44,6 +44,8 @@ let toplevel_value_bindings : Obj.t String.Map.t ref = ref String.Map.empty
let ppf = ref Format.std_formatter
let eval = ref None
let getvalue name =
try String.Map.find name !toplevel_value_bindings
with Not_found -> fatal_error (name ^ " unbound at toplevel")
@ -2328,7 +2330,7 @@ end
type evalenv = Format.formatter -> string -> unit
let eval lb ppf (text : string) =
let eval_fun lb ppf (text : string) =
Topdirs.std_out := ppf;
(read_interactive_input :=
fun buffer _ ->
@ -2408,4 +2410,5 @@ let init ppf =
Location.input_phrase_buffer := Some phrase_buffer;
Sys.catch_break true;
run_hooks After_setup;
eval lb
eval := Some (eval_fun lb);
eval_fun lb