diff options
author | johnvg | 2001-11-30 15:00:03 +0000 |
---|---|---|
committer | johnvg | 2001-11-30 15:00:03 +0000 |
commit | 1054ca000bbc37a3b6715525cd4af09b0ba9f018 (patch) | |
tree | fad1e52040e57434708439084ab0d7d560daa4f5 /frontend/Heap.icl | |
parent | different representation of selector kind in Selection (diff) |
initPtr modifies the *World
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@909 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'frontend/Heap.icl')
-rw-r--r-- | frontend/Heap.icl | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/frontend/Heap.icl b/frontend/Heap.icl index a9e26b4..1de185d 100644 --- a/frontend/Heap.icl +++ b/frontend/Heap.icl @@ -46,6 +46,27 @@ allocPtr = code { pop_a 2 }; +initPtr :: !(Ptr v) !v !*(Heap v) !*World -> (!.Heap v,!*World); +initPtr p v h w + = code { + push_args 0 2 2 + pop_a 1 + eq_desc _Cons 0 0 + pop_a 1 + jmp_false init_pointer_error + push_a 2 + push_a 2 + fill1_r e_Heap_kPtr 2 0 2 011 +.keep 0 2 + pop_a 2 +.d 2 0 + rtn +:init_pointer_error + pop_a 3 + print "initPtr: Pointer already initialized" + halt +}; +/* initPtr :: !(Ptr v) !v !*(Heap v) -> .Heap v; initPtr p v h = code { @@ -66,6 +87,7 @@ initPtr p v h print "initPtr: Pointer already initialized" halt }; +*/ readPtr :: !(Ptr v) !u:(Heap v) -> (!v,!u:Heap v); readPtr p h = code { |