aboutsummaryrefslogtreecommitdiff
path: root/src/algebra/data.spad.pamphlet
diff options
context:
space:
mode:
Diffstat (limited to 'src/algebra/data.spad.pamphlet')
-rw-r--r--src/algebra/data.spad.pamphlet36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/algebra/data.spad.pamphlet b/src/algebra/data.spad.pamphlet
index 8e8d8ca2..9640d7ad 100644
--- a/src/algebra/data.spad.pamphlet
+++ b/src/algebra/data.spad.pamphlet
@@ -75,6 +75,42 @@ ByteArray() == PrimitiveArray Byte
@
+\section{The DataBuffer domain}
+
+<<domain DATABUF DataBuffer>>=
+)abbrev domain DATABUF DataBuffer
+++ Author: Gabriel Dos Reis
+++ Date Created: August 23, 2008
+++ Description:
+++ This domain provides for a fixed-sized homogeneous data buffer.
+DataBuffer(N: PositiveInteger, T: SetCategory): Public == Private where
+ Public == SetCategory with
+ new: () -> %
+ ++ new() returns a fresly allocated data buffer or length N.
+ elt: (%,NonNegativeInteger) -> T
+ ++ elt(b,i) returns the ith element in buffer `b'. Indexing
+ ++ is 0-based.
+ setelt: (%,NonNegativeInteger,T) -> T
+ ++ setelt(b,i,x) sets the ith entry of data buffer `b' to `x'.
+ ++ Indexing is 0-based.
+ Private == add
+ new() ==
+ makeSimpleArray(getVMType(T)$Lisp,N)$Lisp
+
+ elt(b,i) ==
+ getSimpleArrayEntry(b,i)$Lisp
+
+ setelt(b,i,x) ==
+ setSimpleArrayEntry(b,i,x)$Lisp
+
+ x = y ==
+ EQUAL(x,y)$Lisp
+
+ coerce(b: %): OutputForm ==
+ bracket([elt(b,i)::OutputForm for i in 0..(N-1)])
+@
+
+
\section{License}
<<license>>=
--Copyright (C) 2007-2008, Gabriel Dos Reis.