[elephant-cvs] CVS elephant/src/memutil

ieslick ieslick at common-lisp.net
Thu Feb 8 23:07:19 UTC 2007


Update of /project/elephant/cvsroot/elephant/src/memutil
In directory clnet:/tmp/cvs-serv2451/src/memutil

Modified Files:
	memutil.lisp 
Log Message:
Checkpoint checkin of db-lisp

--- /project/elephant/cvsroot/elephant/src/memutil/memutil.lisp	2007/02/03 14:07:01	1.21
+++ /project/elephant/cvsroot/elephant/src/memutil/memutil.lisp	2007/02/08 23:07:19	1.22
@@ -41,6 +41,8 @@
 	   #:reset-buffer-stream #:buffer-stream-buffer 
 	   #:buffer-stream-length #:buffer-stream-size
 
+	   #:buffer-read-to-array-offset #:buffer-write-from-array-offset
+
 	   #:buffer-write-byte #:buffer-write-float 
 	   #:buffer-write-double #:buffer-write-string 
            #:buffer-write-int32 #:buffer-write-uint32
@@ -700,6 +702,26 @@
  	  (dotimes (i writable bs) 
  	      (buffer-write-byte (aref bv i) bs))))
 
+(defun buffer-read-to-array-offset (arry offset bs)
+  "Buffer relative; read contents of buffer-stream and write them into array at offset"
+  (declare (type buffer-stream bs)
+	   (type fixnum offset))
+  (let* ((position (buffer-stream-position bs))
+	 (size (buffer-stream-size bs))
+	 (vlen (- size position)))
+    (if (>= vlen 0)
+	(dotimes (i vlen arry)
+	  (setf (aref arry (+ i offset))
+		(buffer-read-byte bs))))))
+
+(defun buffer-write-from-array-offset (arry offset length bs)
+  "Buffer relative; write array contents into buffer stream"
+  (declare (type fixnum offset)
+	   (type buffer-stream bs))
+  (dotimes (i length arry)
+    (buffer-write-byte (aref arry (+ i offset)) bs)))
+  
+
 ;;
 ;; Compatibility
 ;;




More information about the Elephant-cvs mailing list