diff options
author | Xander <xander@biltopia.org> | 2023-08-08 22:17:40 +0200 |
---|---|---|
committer | Xander <xander@biltopia.org> | 2023-08-08 22:17:40 +0200 |
commit | 245f24890cd78304cf0fd397dda8e72b0a7fbe6b (patch) | |
tree | 7210e4d4489b7281fb9213745b4776846402103b /lib/DATS/writer.dats | |
parent | cef3f6bdddfe768e7a1a84edcec76c11c1634941 (diff) | |
download | ats-os-245f24890cd78304cf0fd397dda8e72b0a7fbe6b.tar.xz ats-os-245f24890cd78304cf0fd397dda8e72b0a7fbe6b.zip |
more refactoring and implemented exec_init
Diffstat (limited to 'lib/DATS/writer.dats')
-rw-r--r-- | lib/DATS/writer.dats | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/DATS/writer.dats b/lib/DATS/writer.dats index b8625f4..6a183c1 100644 --- a/lib/DATS/writer.dats +++ b/lib/DATS/writer.dats @@ -96,6 +96,12 @@ in in + implement initialize$fwork<writer_t>(v) = + ( + v := @{position = 0, color_code = code_value(White,Black)}; + let prval() = opt_some v in true end + ) + implement put_string (str : string) : void = let implement exec_void$fwork<writer_t>(v) = let implement string_foreach$fwork<writer_t> (c,env) = put_char(c,env) @@ -103,21 +109,13 @@ in in end in - $effmask_ref(exec_void<writer_t>(writer_ref)) + $effmask_ref(exec_init<writer_t>(writer_ref)) end implement clear_screen() : void = let implement exec_void$fwork<writer_t>(v) = _clear_screen(v) - implement initialize$fwork<writer_t>(v) = - ( - v := @{position = 0, color_code = code_value(White,Black)}; - let prval() = opt_some v in true end - ) in - if not writer_ref->initialized then - initialize<writer_t>(writer_ref); - - exec_void<writer_t>(writer_ref) + exec_init<writer_t>(writer_ref) end end |