
New patches:

[fix foreign-struct-*-form thus enable foreign-slot-value optimization
Joerg-Cyril Hoehle <hoehle@users.sourceforge.net>**20051222141506] 
<
> {
hunk ./src/types.lisp 332
 
 (defmethod foreign-struct-slot-value-form (ptr (slot simple-struct-slot))
   "Return a form to get the value of a slot from PTR."
-  ;; TODO: add translation
-  `(mem-ref ,ptr ,(slot-type slot) ,(slot-offset slot)))
+  (let ((type (slot-type slot)))
+    (from-c-form type
+     `(mem-ref ,ptr ,type ,(slot-offset slot)))))
 
 (defmethod (setf foreign-struct-slot-value) (value ptr (slot simple-struct-slot))
   "Set the value of a simple SLOT to VALUE in PTR."
hunk ./src/types.lisp 497
 
 (define-compiler-macro foreign-slot-value (&whole form ptr type slot-name)
   "Optimizer for FOREIGN-SLOT-VALUE when TYPE is constant."
-  (declare (ignore ptr type slot-name))
-  form
-  #+nil;; TODO: foreign-struct-slot-value-form is missing translate-from-c
   (if (and (constantp type) (constantp slot-name))
     (foreign-struct-slot-value-form ptr
        (get-slot-info (eval type) (eval slot-name)))
}
[clisp: inline %mem-ref when given constant type
Joerg-Cyril Hoehle <hoehle@users.sourceforge.net>**20051222141931] 
<
> {
hunk ./src/cffi-clisp.lisp 183
 or Lisp number."
   (ffi:memory-as ptr (convert-foreign-type type) offset))
 
+(define-compiler-macro %mem-ref (&whole form ptr type &optional (offset 0))
+  "Compiler macro to open-code when TYPE is constant."
+  (if (constantp type)
+      `(ffi:memory-as ,ptr ',(convert-foreign-type (eval type)) ,offset)
+      form))
+
 (defun (setf %mem-ref) (value ptr type &optional (offset 0))
   "Set a pointer OFFSET bytes from PTR to an object of built-in
 foreign TYPE to VALUE."
}
[fix foreign-struct-set-form & enable foreign-slot-set optimization
Joerg-Cyril Hoehle <hoehle@users.sourceforge.net>**20051222151302] 
<
> {
hunk ./src/types.lisp 344
 
 (defmethod foreign-struct-slot-set-form (value ptr (slot simple-struct-slot))
   "Return a form to set the value of a simple structure slot."
-  ;; TODO: add translation
-  `(setf (mem-ref ,ptr ,(slot-type slot) ,(slot-offset slot)) ,value))
+  (let ((type (slot-type slot)))
+    `(setf (mem-ref ,ptr ,type ,(slot-offset slot))
+           ,(to-c-form type value))))
 
 ;;;### Aggregate Slots
 
hunk ./src/types.lisp 538
 (define-compiler-macro foreign-slot-set
     (&whole form value ptr type slot-name)
   "Optimizer when TYPE and SLOT-NAME are constant."
-  (declare (ignore value ptr type slot-name))
-  form
-  #+nil;; TODO: foreign-struct-slot-set-form is missing translate-from-c
   (if (and (constantp type) (constantp slot-name))
hunk ./src/types.lisp 539
-    (foreign-struct-slot-set-form ptr
+    (foreign-struct-slot-set-form value ptr
        (get-slot-info (eval type) (eval slot-name)))
     form))
 
}

Context:

[Make typedefs for structs work.
Luis Oliveira <loliveira@common-lisp.net>**20051221170235
 
 - Make get-slot-info (and thus foreign-slot-value) work on typedefs
   to a struct type.
 - Regression test: STRUCT.4
] 
[Use fli:make-pointer instead of fli:*null-pointer*
Luis Oliveira <loliveira@common-lisp.net>**20051221105427
 
 Use FLI:MAKE-POINTER here instead of FLI:*NULL-POINTER* for
 implementing CFFI-SYS:NULL-POINTER since old versions of
 Lispworks don't seem to have the latter.
 
 Patch courtesy of: Vebjorn Ljosa <vebjorn(@)ljosa.com>
] 
[CFFI-SYS-SPEC manual updates & Texinfo idioms
Luis Oliveira <loliveira@common-lisp.net>**20051220043849
   
 Patch from: Stephen Compall <s11@member.fsf.org>
   
 - Use @var for arguments, rather than @code.
 - Use @deftpx for a chain of type defns, rather than repeated @deftp
   blocks.
 - Use @result{} instead of explicit =>.
 - Use @r with appropriate formatting for comments in
   @examples/@lisps. [didn't apply these changes since they didn't
   play well with the colorize script in the HTML output --luis]
 - Introduction: Convert naming convention to a list of general
   conventions, and define "foreign type".
 - Rename the pointer functions.
 - Document new functions.
 - Use new @impnote macro to add notes, so they can be conditionally
   removed from the manual.
] 
[Forgot to export %close-foreign-library from cffi-lispworks.lisp
Luis Oliveira <loliveira@common-lisp.net>**20051220035858] 
[Untabify cffi-ecl.lisp
Luis Oliveira <loliveira@common-lisp.net>**20051215154526] 
[Preliminary support for close-foreign-library
Luis Oliveira <loliveira@common-lisp.net>**20051215095834
 
 Unimplemented for ECL and Corman. Lously implemented in CMUCL (and possibly
 in the other ports too). Not exported.
] 
[Fix parsing of types to match UFFI's behaviour
Luis Oliveira <loliveira@common-lisp.net>**20051214110839
 
 Basically, extra quoting is supposed to be ignored.
 Thus 'foo, ''foo, '''foo, are all valid types.
] 
[Bug fixes
Luis Oliveira <loliveira@common-lisp.net>**20051212053739
 
 - WITH-FOREIGN-OBJECT should eval the type parameter. Fixed this
   as well as the examples and tests that assumed it wasn't evaluated.
 - document WITH-FOREIGN-OBJECT in the manual.
 - removed the pseudo ability to specialize arguments on
   define-type-translator. That didn't quite work, doh.
 - removed dead code from cffi-uffi-compat::foreign-type-size
   specialized on the uffi-array-type.
 - uffi-compat: parse (:array <type>) as (:array <type> 1)
 - uffi-compat: reflect the fact that CFFI:WITH-FOREIGN-OBJECT now
   evaluates the type parameter.
] 
[Fix uffi-compat wrt to the ptr->pointer changes
Luis Oliveira <loliveira@common-lisp.net>**20051211100102] 
[Added GETENV to uffi-compat
Luis Oliveira <loliveira@common-lisp.net>**20051211064557] 
[Oops
Luis Oliveira <loliveira@common-lisp.net>**20051211053118
 
 - Missing comma in define-type-translator.
 - Also, it almost but not quite accepted the method specifiers. Fixed.
] 
[Type translation refactoring
Luis Oliveira <loliveira@common-lisp.net>**20051211052201
 
 - Refactoring of the type translation mechanism, now based on
   generic functions. The only user-visible changes is that you can
   now specialize the on the argument of the translator, and there's
   no type argument now (which was useless too for user-defined types).
 - Don't export define-type-spec-parser since it's useless on its own.
 - The anonymous :enum type is gone.
 - Updated manual.
] 
[Add background info on free'ing callbacks
Joerg-Cyril Hoehle <hoehle@users.sourceforge.net>**20051220111627] 
[cffi-clisp:%defcallback: simplify it
Joerg-Cyril Hoehle <hoehle@users.sourceforge.net>**20051215085649] 
[foreign-slot-value|set compiler-macro update
Joerg-Cyril Hoehle <hoehle@users.sourceforge.net>**20051214133908] 
[use ffi:foreign-variable in foreign-symbol-pointer
Joerg-Cyril Hoehle <hoehle@users.sourceforge.net>**20051214133725] 
[ffi:memory-as is a perfect match for %mem-ref
Joerg-Cyril Hoehle <hoehle@users.sourceforge.net>**20051209172237] 
[Update manual: CMUCL passes all tests.
Luis Oliveira <loliveira@common-lisp.net>**20051209053051] 
[Lots of renaming and 2 new functions
Luis Oliveira <loliveira@common-lisp.net>**20051209022821
 
 - Renamed: null-ptr -> null-pointer, null-ptr-p -> null-pointer,
   inc-ptr -> inc-pointer, with-foreign-ptr -> with-foreign-pointer,
   with-foreign-ptr-as-string -> with-foreign-pointer-as-string,
   foreign-slot-address -> foreign-slot-pointer, 
   get-var-ptr -> get-var-pointer and
   foreign-symbol-ptr -> foreign-symbol-pointer.
 - Updated various references to the old names in the cffi code itself,
   examples, tests and the manual.
 - New functions: cffi(-sys):pointer-address and cffi(-sys):make-pointer.
 - Use these in uffi-compat.
 - Documented them in the manual.
 - New tests: POINTER.1 and POINTER.2
] 
[Remove objects.lisp (new file: late-types.lisp)
Luis Oliveira <loliveira@common-lisp.net>**20051208065807] 
[defcunion :count option for slots
Luis Oliveira <loliveira@common-lisp.net>**20051208063412
 
 - Make the defcunion slots' count option be a keyword
 like defcstruct. Fix the related docs and tests.
] 
[Apply translations for simple slots.
Luis Oliveira <loliveira@common-lisp.net>**20051205014628
 
 - Make the foreign-slot-value method on simple-struct-slot apply the
   adequate type translator. Same thing for the setter.
 - Test this in STRUCT.STRING.1 and STRUCT.STRING.2
] 
[Initial revision
jbielman**20050607202929] 
Patch bundle hash:
b11858b751642ed2189e6c9f83a64765aee43a24
