use ptrdiff_t if available, otherwise keep compat with released Guile
authorAndy Wingo <wingo@pobox.com>
Mon, 11 Feb 2013 08:47:04 +0000 (09:47 +0100)
committerAndy Wingo <wingo@pobox.com>
Mon, 11 Feb 2013 08:47:04 +0000 (09:47 +0100)
* figl/gl/types.scm (%ptr): Back-compatible definitions for Guile <
  2.0.8.

figl/gl/types.scm

index cbc7e25..c10d427 100644 (file)
 
 ;; TODO: Taken from Mesa headers for some types below.  Not clear what
 ;; these types are on other platforms.
-(define %ptr ffi:ptrdiff_t)
+(define %ptr
+  (cond
+   ((defined? 'ffi:ptrdiff_t) ffi:ptrdiff_t)
+   ((= (ffi:sizeof '*) 8) ffi:int64)
+   ((= (ffi:sizeof '*) 4) ffi:int32)
+   (else (error "unknown pointer size" (ffi:sizeof '*)))))
 
 (define-simple-foreign-type void ffi:void)
 (define-simple-foreign-type GLbyte ffi:int8)