aboutsummaryrefslogtreecommitdiff
path: root/frontend/unsafe_heap.dcl
diff options
context:
space:
mode:
authorjohnvg2001-12-11 12:57:25 +0000
committerjohnvg2001-12-11 12:57:25 +0000
commit02a6a248ff49fcd2ceec1e46eb70d34f8be9870a (patch)
tree4cd4140ce6dad04ad8aadcbdf879b88cb4b3ae59 /frontend/unsafe_heap.dcl
parentremoved type from BasicExpr (diff)
heap module with smaller pointers.
read and write functions do not check whether the pointer belongs to the heap passed as argument. git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@921 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'frontend/unsafe_heap.dcl')
-rw-r--r--frontend/unsafe_heap.dcl36
1 files changed, 36 insertions, 0 deletions
diff --git a/frontend/unsafe_heap.dcl b/frontend/unsafe_heap.dcl
new file mode 100644
index 0000000..1d8db97
--- /dev/null
+++ b/frontend/unsafe_heap.dcl
@@ -0,0 +1,36 @@
+definition module unsafe_heap
+
+import StdClass
+
+:: Heap v = {heap::!.HeapN v}
+:: HeapN v
+:: Ptr v = {pointer::!.(PtrN v)};
+:: PtrN v = Ptr !v;
+
+newHeap :: .Heap v
+
+nilPtr :: Ptr v
+
+isNilPtr :: !(Ptr v) -> Bool
+
+newPtr :: !v !*(Heap v) -> (!.Ptr v,!.Heap v)
+
+readPtr :: !(Ptr v) !u:(Heap v) -> (!v,!u:Heap v)
+
+writePtr :: !(Ptr v) !v !*(Heap v) -> .Heap v
+
+sreadPtr :: !(Ptr v) !(Heap v) -> v
+
+allocPtr :: Ptr v;
+
+initPtr :: !(Ptr v) !v !*(Heap v) !*World -> (!.Heap v,!*World);
+
+ptrToInt :: !(Ptr w) -> Int
+
+(<:=) infixl
+(<:=) heap ptr_and_val :== writePtr ptr val heap
+where
+ (ptr, val) = ptr_and_val
+
+instance == (Ptr a)
+