root/trunk/thirdparty/cl+ssl/ffi-buffer-clisp.lisp

Revision 2698, 0.9 kB (checked in by hans, 10 months ago)

updated cl+ssl from CVS trunk - now with deadlines

Line 
1 (in-package :cl+ssl)
2
3 (defun make-buffer (size)
4   (cffi-sys:%foreign-alloc size))
5
6 (defun buffer-length (buf)
7   (declare (ignore buf))
8   +initial-buffer-size+)
9
10 (defun buffer-elt (buf index)
11   (ffi:memory-as buf 'ffi:uint8 index))
12 (defun set-buffer-elt (buf index val)
13   (setf (ffi:memory-as buf 'ffi:uint8 index) val))
14 (defsetf buffer-elt set-buffer-elt)
15
16 (defun v/b-replace (vec buf &key (start1 0) end1 (start2 0) (end2 +initial-buffer-size+))
17   (replace
18    vec
19    (ffi:memory-as buf (ffi:parse-c-type `(ffi:c-array ffi:uint8 ,(- end2 start2))) start2)
20    :start1 start1
21    :end1 end1))
22 (defun b/v-replace (buf vec &key (start1 0) (end1 +initial-buffer-size+) (start2 0) end2)
23   (setf
24    (ffi:memory-as buf (ffi:parse-c-type `(ffi:c-array ffi:uint8 ,(- end1 start1))) start1)
25    (subseq vec start2 end2)))
26
27 (defmacro with-pointer-to-vector-data ((ptr buf) &body body)
28   `(let ((,ptr ,buf))
29     ,@body))
Note: See TracBrowser for help on using the browser.