[movitz-cvs] CVS update: movitz/losp/muerte/arrays.lisp

Frode Vatvedt Fjeld ffjeld at common-lisp.net
Fri Sep 24 09:31:19 UTC 2004


Update of /project/movitz/cvsroot/movitz/losp/muerte
In directory common-lisp.net:/tmp/cvs-serv31262

Modified Files:
	arrays.lisp 
Log Message:
Added function copy-vector.

Date: Fri Sep 24 11:31:19 2004
Author: ffjeld

Index: movitz/losp/muerte/arrays.lisp
diff -u movitz/losp/muerte/arrays.lisp:1.43 movitz/losp/muerte/arrays.lisp:1.44
--- movitz/losp/muerte/arrays.lisp:1.43	Wed Sep 22 16:46:38 2004
+++ movitz/losp/muerte/arrays.lisp	Fri Sep 24 11:31:19 2004
@@ -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.43 2004/09/22 14:46:38 ffjeld Exp $
+;;;; $Id: arrays.lisp,v 1.44 2004/09/24 09:31:19 ffjeld Exp $
 ;;;;                
 ;;;;------------------------------------------------------------------
 
@@ -153,6 +153,31 @@
        "Vector has no fill-pointer.")
      (%basic-vector-fill-pointer vector))))
 
+(defun copy-vector (vector)
+  (check-type vector vector)
+  (ecase (vector-element-type vector)
+    (#.(bt:enum-value 'movitz::movitz-vector-element-type :any-t)
+       (%shallow-copy-object
+	vector
+	(+ 2 (movitz-accessor vector movitz-basic-vector num-elements))))
+    (#.(bt:enum-value 'movitz::movitz-vector-element-type :u32)
+       (%shallow-copy-non-pointer-object
+	vector
+	(+ 2 (movitz-accessor vector movitz-basic-vector num-elements))))
+    ((#.(bt:enum-value 'movitz::movitz-vector-element-type :character)
+      #.(bt:enum-value 'movitz::movitz-vector-element-type :u8)
+      #.(bt:enum-value 'movitz::movitz-vector-element-type :code))
+     (%shallow-copy-non-pointer-object
+      vector
+      (+ 2 (truncate (+ 3 (movitz-accessor vector movitz-basic-vector num-elements)) 4))))
+    (#.(bt:enum-value 'movitz::movitz-vector-element-type :u16)
+       (%shallow-copy-non-pointer-object
+	vector
+	(+ 2 (truncate (+ 1 (movitz-accessor vector movitz-basic-vector num-elements)) 2))))
+    (#.(bt:enum-value 'movitz::movitz-vector-element-type :bit)
+       (%shallow-copy-non-pointer-object
+	vector
+	(+ 2 (truncate (+ 31 (movitz-accessor vector movitz-basic-vector num-elements)) 32))))))
 
 (defun (setf fill-pointer) (new-fill-pointer vector)
   (etypecase vector





More information about the Movitz-cvs mailing list