From 11539792ffcbdba74d6ca63dea2be937d62de7fc Mon Sep 17 00:00:00 2001 From: Xander Date: Fri, 28 Jul 2023 00:57:36 +0200 Subject: Added template init_exec function --- lib/DATS/writer.dats | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'lib/DATS/writer.dats') diff --git a/lib/DATS/writer.dats b/lib/DATS/writer.dats index d5a327b..b7e9973 100644 --- a/lib/DATS/writer.dats +++ b/lib/DATS/writer.dats @@ -3,6 +3,9 @@ staload "lib/SATS/writer.sats" staload "lib/SATS/init.sats" +// when this .dats file not staloaded I get weird error from template function +staload "lib/DATS/init.dats" + #define ATS_DYNLOADFLAG 0 %{^ @@ -48,6 +51,7 @@ in implement _clear_screen(w) = let fun loop {n : nat | n < N - 1} .. (i : int n, w : &writer_t) : void = (put_char('\0', w); if (i < N - 2) then loop(i+1,w)) + val () = w := @{position = 0, color_code = code_value(White,Black)} in loop(0,w); w.position := 0; @@ -103,17 +107,15 @@ in in end end + + implement clear_screen() : void = let val (vbox pf | p) = ref_get_viewptr(writer_ref) + implement init_exec$fwork(v) = _clear_screen(v) in - if p->initialized then - let - prval () = opt_unsome p->obj - val () = _clear_screen(p->obj) - prval () = opt_some p->obj - in - end + if p->initialized then + init_exec (!p) else let prval () = opt_unnone p->obj -- cgit v1.2.3