From b78762c92afee705e618f29f89897db8b45df3dd Mon Sep 17 00:00:00 2001 From: Xander Date: Fri, 28 Jul 2023 21:38:35 +0200 Subject: optional implementation of multboot 1 --- lib/DATS/writer.dats | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'lib/DATS/writer.dats') diff --git a/lib/DATS/writer.dats b/lib/DATS/writer.dats index 9b2fd78..b8625f4 100644 --- a/lib/DATS/writer.dats +++ b/lib/DATS/writer.dats @@ -97,31 +97,27 @@ in in implement put_string (str : string) : void = let - val (vbox pf | p) = ref_get_viewptr(writer_ref) - implement init_exec$fwork(v) = let + implement exec_void$fwork(v) = let implement string_foreach$fwork (c,env) = put_char(c,env) val _ = $effmask_all(string_foreach_env (g1ofg0(str),v)) in end in - init_exec(!p) + $effmask_ref(exec_void(writer_ref)) end implement clear_screen() : void = let - val (vbox pf | p) = ref_get_viewptr(writer_ref) - implement init_exec$fwork(v) = _clear_screen(v) + implement exec_void$fwork(v) = _clear_screen(v) + implement initialize$fwork(v) = + ( + v := @{position = 0, color_code = code_value(White,Black)}; + let prval() = opt_some v in true end + ) in - if p->initialized then - init_exec (!p) - else - let - prval () = opt_unnone p->obj - val () = p->obj := @{position = 0, color_code = code_value(White,Black)} - val () = p->initialized := true - val () = _clear_screen(p->obj) - prval () = opt_some p->obj - in - end + if not writer_ref->initialized then + initialize(writer_ref); + + exec_void(writer_ref) end end -- cgit v1.2.3