[cl-plus-ssl-cvs] CVS cl+ssl

avodonosov avodonosov at common-lisp.net
Sat Nov 1 05:02:03 UTC 2008


Update of /project/cl-plus-ssl/cvsroot/cl+ssl
In directory cl-net:/tmp/cvs-serv6587

Modified Files:
	ffi-buffer-clisp.lisp 
Log Message:
native buffer and lisp vector. http://common-lisp.net/pipermail/cl-plus-ssl-devel/2008-June/000131.html

--- /project/cl-plus-ssl/cvsroot/cl+ssl/ffi-buffer-clisp.lisp	2007/07/07 15:25:09	1.1
+++ /project/cl-plus-ssl/cvsroot/cl+ssl/ffi-buffer-clisp.lisp	2008/11/01 05:02:01	1.2
@@ -13,13 +13,27 @@
   (setf (ffi:memory-as buf 'ffi:uint8 index) val))
 (defsetf buffer-elt set-buffer-elt)
 
-(defun v/b-replace (vec buf &key (start1 0) end1 (start2 0) (end2 +initial-buffer-size+))
+(declaim
+ (inline calc-buf-end))
+
+;; to calculate non NIL value of the buffer end index
+(defun calc-buf-end (buf-start vec vec-start vec-end)
+  (+ buf-start 
+     (- (or vec-end (length vec))
+        vec-start)))
+
+(defun v/b-replace (vec buf &key (start1 0) end1 (start2 0) end2)
+  (when (null end2)
+    (setf end2 (calc-buf-end start2 vec start1 end1)))
   (replace
    vec
    (ffi:memory-as buf (ffi:parse-c-type `(ffi:c-array ffi:uint8 ,(- end2 start2))) start2)
    :start1 start1
    :end1 end1))
-(defun b/v-replace (buf vec &key (start1 0) (end1 +initial-buffer-size+) (start2 0) end2)
+
+(defun b/v-replace (buf vec &key (start1 0) end1 (start2 0) end2)
+  (when (null end1)
+    (setf end1 (calc-buf-end start1 vec start2 end2)))
   (setf
    (ffi:memory-as buf (ffi:parse-c-type `(ffi:c-array ffi:uint8 ,(- end1 start1))) start1)
    (subseq vec start2 end2)))





More information about the cl-plus-ssl-cvs mailing list