On Fri, 2006-07-14 at 13:30 +0100, Luís Oliveira wrote:
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?
This evaluates the PLACE forms twice. If I follow correctly, this can be more generally solved with a cross-platform setf-expander for POINTER-ADDRESS that requires its PTR arg to be a place, whereupon things like (incf (pointer-address *ptr*)) and any other place-modifier should work.