/[cl-cairo2]/cl-cairo2.i
ViewVC logotype

Contents of /cl-cairo2.i

Parent Directory Parent Directory | Revision Log Revision Log


Revision 19 - (hide annotations)
Mon Apr 21 13:01:57 2008 UTC (5 years, 11 months ago) by tpapp
File size: 1779 byte(s)
fixed my-double type coercion to work with new CFFI
1 tpapp 1 %module "cl-cairo2-swig"
2    
3     %ignore CAIRO_VERSION;
4 tpapp 7 %ignore CAIRO_VERSION_STRING;
5 tpapp 1
6     %typemap(cin) double "my-double";
7     /* %typemap(cin) int ":my-int"; */
8    
9     %insert("lisphead") %{
10     (in-package :cl-cairo2)
11    
12 tpapp 19 ;; define our own alias for double float, so we can automatically
13     ;; convert other numerical types in the arguments
14     (define-foreign-type my-double-type ()
15     ()
16     (:actual-type :double)
17     (:simple-parser my-double))
18    
19     (defmethod translate-to-foreign (value (type my-double-type))
20     (coerce value 'double-float))
21 tpapp 1
22     ;; typedefs: we don't want to create all of them automatically,
23     ;; because typedefs for structures confuse with-foreign-slots
24     ;; the ones we don't want are commented out
25     (cffi:defctype cairo_bool_t :int)
26     (cffi:defctype cairo_t :pointer)
27     (cffi:defctype cairo_surface_t :pointer)
28     ;; (cffi:defctype cairo_matrix_t :pointer)
29     (cffi:defctype cairo_pattern_t :pointer)
30     (cffi:defctype cairo_destroy_func_t :pointer)
31     (cffi:defctype cairo_user_data_key_t :pointer)
32     (cffi:defctype cairo_write_func_t :pointer)
33     (cffi:defctype cairo_read_func_t :pointer)
34     ;; (cffi:defctype cairo_rectangle_t :pointer)
35     (cffi:defctype cairo_rectangle_list_t :pointer)
36     (cffi:defctype cairo_scaled_font_t :pointer)
37     (cffi:defctype cairo_font_face_t :pointer)
38     (cffi:defctype cairo_font_options_t :pointer)
39     (cffi:defctype cairo_path_data_t :pointer)
40     (cffi:defctype cairo_path_t :pointer)
41     %}
42    
43     %include /usr/include/cairo/cairo-features.h
44     %include /usr/include/cairo/cairo-deprecated.h
45     %include /usr/include/cairo/cairo.h
46     %include /usr/include/cairo/cairo-ft.h
47     %include /usr/include/cairo/cairo-ps.h
48     %include /usr/include/cairo/cairo-xlib-xrender.h
49     %include /usr/include/cairo/cairo-pdf.h
50     %include /usr/include/cairo/cairo-svg.h
51    
52    

  ViewVC Help
Powered by ViewVC 1.1.5