[movitz-cvs] CVS update: movitz/losp/muerte/arrays.lisp
Frode Vatvedt Fjeld
ffjeld at common-lisp.net
Sat May 21 22:37:53 UTC 2005
Update of /project/movitz/cvsroot/movitz/losp/muerte
In directory common-lisp.net:/tmp/cvs-serv4891
Modified Files:
arrays.lisp
Log Message:
*** empty log message ***
Date: Sun May 22 00:37:53 2005
Author: ffjeld
Index: movitz/losp/muerte/arrays.lisp
diff -u movitz/losp/muerte/arrays.lisp:1.49 movitz/losp/muerte/arrays.lisp:1.50
--- movitz/losp/muerte/arrays.lisp:1.49 Thu Nov 25 03:10:38 2004
+++ movitz/losp/muerte/arrays.lisp Sun May 22 00:37:53 2005
@@ -1,6 +1,6 @@
;;;;------------------------------------------------------------------
;;;;
-;;;; Copyright (C) 2001-2004,
+;;;; Copyright (C) 2001-2005,
;;;; Department of Computer Science, University of Tromso, Norway.
;;;;
;;;; For distribution policy, see the accompanying file COPYING.
@@ -10,7 +10,7 @@
;;;; Author: Frode Vatvedt Fjeld <frodef at acm.org>
;;;; Created at: Sun Feb 11 23:14:04 2001
;;;;
-;;;; $Id: arrays.lisp,v 1.49 2004/11/25 02:10:38 ffjeld Exp $
+;;;; $Id: arrays.lisp,v 1.50 2005/05/21 22:37:53 ffjeld Exp $
;;;;
;;;;------------------------------------------------------------------
@@ -853,6 +853,15 @@
(setf (fill-pointer vector) p)
(aref vector p)))
+(defun vector-read (vector)
+ "Like vector-pop, only in the other direction."
+ (let ((x (aref vector (fill-pointer vector))))
+ (incf (fill-pointer vector))
+ x))
+
+(defun vector-read-more-p (vector)
+ (< (fill-pointer vector) (array-dimension vector 0)))
+
(defun vector-push-extend (new-element vector &optional extension)
(declare (ignore extension))
(check-type vector vector)
@@ -916,3 +925,12 @@
((eq dim '*))
((= dim (array-dimension x d)))
(t (return nil)))))))))
+
+(defun ensure-data-vector (vector start length)
+ (let ((end (typecase vector
+ ((simple-array (unsigned-byte 8) 1)
+ (array-dimension vector 0))
+ (t (error "Not a data vector: ~S" vector)))))
+ (assert (<= (+ start length) end) (vector)
+ "Data vector too small.")
+ vector))
More information about the Movitz-cvs
mailing list