From 018d1489e6fc0c6363442033abd674f287e6f5cd Mon Sep 17 00:00:00 2001 From: Xander Date: Thu, 27 Jul 2023 23:03:21 +0200 Subject: name change to initializable --- kernel/memory/frame.dats | 11 +++++------ lib/DATS/init.dats | 4 ++-- lib/DATS/writer.dats | 11 ++++++----- lib/SATS/init.sats | 6 +++--- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/kernel/memory/frame.dats b/kernel/memory/frame.dats index fad0420..5a950ad 100644 --- a/kernel/memory/frame.dats +++ b/kernel/memory/frame.dats @@ -10,7 +10,6 @@ staload UN = "prelude/SATS/unsafe.sats" assume frame_allocator = frame_allocator_t - implement containing_address(address): frame_t = @{ counter = $UN.cast{size_t}(address) / i2sz(PAGE_SIZE) @@ -50,8 +49,8 @@ local var allocator_static : frame_allocator_t? prval () = opt_none allocator_static -var allocator = empty(allocator_static) -val allocator_ref = ref_make_viewptr{enablable frame_allocator_t} (view@allocator | addr@allocator) +var allocator = uninitialized(allocator_static) +val allocator_ref = ref_make_viewptr{initializable frame_allocator_t} (view@allocator | addr@allocator) in @@ -66,11 +65,11 @@ in } : frame_allocator_t val (vbox pf | p) = ref_get_viewptr(allocator_ref) in - if not p->enabled then let + if not p->initialized then let prval () = opt_unnone p->obj in p->obj := allocator; - p->enabled := true; + p->initialized := true; (* choose_next_area(b.0 | b.2, !p); *) let prval () = opt_some p->obj in end; end @@ -79,7 +78,7 @@ in implement allocate_frame(bf | b) : frame_t = let val (vbox pf | p) = ref_get_viewptr(allocator_ref) in - if p->enabled then let + if p->initialized then let (* var allocator = p->obj *) prval () = opt_unsome p->obj in diff --git a/lib/DATS/init.dats b/lib/DATS/init.dats index 3bc5034..492d5dc 100644 --- a/lib/DATS/init.dats +++ b/lib/DATS/init.dats @@ -2,8 +2,8 @@ staload "lib/SATS/init.sats" #define ATS_DYNLOADFLAG 0 -implement {vt:viewt@ype} empty (v) = +implement {vt:viewt@ype} uninitialized (v) = let in - @{enabled = false, obj = v}: enablable vt + @{initialized = false, obj = v}: initializable vt end diff --git a/lib/DATS/writer.dats b/lib/DATS/writer.dats index 92314b7..d5a327b 100644 --- a/lib/DATS/writer.dats +++ b/lib/DATS/writer.dats @@ -84,9 +84,10 @@ in // Static variable var _writer : writer_t? prval () = opt_none _writer - var writer = empty(_writer) + var writer = uninitialized(_writer) in - val writer_ref = ref_make_viewptr{enablable writer_t} (view@writer | addr@writer) + // Reference to writer + val writer_ref = ref_make_viewptr{initializable writer_t} (view@writer | addr@writer) end in @@ -95,7 +96,7 @@ in val (vbox pf | p) = ref_get_viewptr(writer_ref) implement string_foreach$fwork (c,env) = put_char(c,env) in - if p->enabled then let + if p->initialized then let prval () = opt_unsome p->obj val _ = $effmask_ref(string_foreach_env (g1ofg0(str),p->obj)) prval () = opt_some p->obj @@ -106,7 +107,7 @@ in implement clear_screen() : void = let val (vbox pf | p) = ref_get_viewptr(writer_ref) in - if p->enabled then + if p->initialized then let prval () = opt_unsome p->obj val () = _clear_screen(p->obj) @@ -117,7 +118,7 @@ in let prval () = opt_unnone p->obj val () = p->obj := @{position = 0, color_code = code_value(White,Black)} - val () = p->enabled := true + val () = p->initialized := true val () = _clear_screen(p->obj) prval () = opt_some p->obj in diff --git a/lib/SATS/init.sats b/lib/SATS/init.sats index 83b5e8d..c9d9d89 100644 --- a/lib/SATS/init.sats +++ b/lib/SATS/init.sats @@ -1,4 +1,4 @@ -viewtypedef enablable (vt:viewt@ype) = - [enabled: bool] @{ enabled = bool enabled, obj = opt (vt, enabled) } +viewtypedef initializable (vt:viewt@ype) = + [initialized: bool] @{ initialized = bool initialized, obj = opt (vt, initialized) } -fun {vt:viewt@ype} empty (v : opt(vt,false)): enablable vt +fun {vt:viewt@ype} uninitialized (v : opt(vt,false)): initializable vt -- cgit v1.2.3