On 2006-jul-14, at 02:38, Stuart Sierra wrote:
But POINTER-ADDRESS is not setf-able, is it?
Right. AFAICT, some of the Lisps supported by CFFI don't have mutable pointers.
I want to do this: (defcvar "stack_pointer" :pointer)
(incf (pointer-address *stack-pointer*))
See inc-pointer. <http://common-lisp.net/project/cffi/manual/html_node/ inc_002dpointer.html>
(setf *stack-pointer* (inc-pointer *stack-pointer* 1)) should work. You can abstract that with a simple macro:
(defmacro incf-pointer (place &optional (offset 1)) `(setf ,place (inc-pointer ,place ,offset)))
Any objections to adding this macro to CFFI?