aboutsummaryrefslogtreecommitdiff
path: root/lib/DATS/writer.dats
diff options
context:
space:
mode:
authorXander <xander@biltopia.org>2023-07-28 00:57:36 +0200
committerXander <xander@biltopia.org>2023-07-28 00:57:36 +0200
commit11539792ffcbdba74d6ca63dea2be937d62de7fc (patch)
tree06d1250dcb064a5192aad0de81d81dab83b025fc /lib/DATS/writer.dats
parent018d1489e6fc0c6363442033abd674f287e6f5cd (diff)
downloadats-os-11539792ffcbdba74d6ca63dea2be937d62de7fc.tar.xz
ats-os-11539792ffcbdba74d6ca63dea2be937d62de7fc.zip
Added template init_exec function
Diffstat (limited to 'lib/DATS/writer.dats')
-rw-r--r--lib/DATS/writer.dats16
1 files changed, 9 insertions, 7 deletions
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} .<N-n>. (i : int n, w : &writer_t) :<!wrt> 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<writer_t>(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