source: branches/home/psmith/restructure/patches/cffi_0.9.2-mem_rw.diff

Last change on this file was 27, checked in by psmith, 18 years ago

Added first steps of YetAnotherRPC protocol

File size: 756 bytes
Line 
158c58,60
2<    #:cancel-finalization))
3---
4>    #:cancel-finalization
5>    #:mem-read-vector
6>    #:mem-write-vector))
7319a322,338
8>
9>
10> ;;from http://common-lisp.net/project/cffi/darcs/cffi/doc/mem-vector.txt
11>
12> (defun mem-read-vector (vector ptr type count &optional (offset 0))
13>   (loop for i below (min count (length vector))
14>      for off from offset by (%foreign-type-size type)
15>      do (setf (aref vector i) (%mem-ref ptr type off))
16>      finally (return i)))
17>
18> (defun mem-write-vector (vector ptr type &optional (count (length vector)) (offset 0))
19>   (loop for i below count
20>       for off from offset by (%foreign-type-size type)
21>             do (%mem-set (aref vector i) ptr type off)
22>                   finally (return i)))
23>
24>
Note: See TracBrowser for help on using the repository browser.