[cairo-commit] cairo-ocaml/src svg_cairo.mli, 1.2, 1.3 svg_cairo.ml, 1.2, 1.3 ml_svg_cairo.c, 1.2, 1.3 ml_cairo_wrappers.h, 1.8, 1.9 ml_cairo_wrappers.c, 1.3, 1.4 ml_cairo_surface.c, NONE, 1.1 ml_cairo_status.h, 1.3, NONE ml_cairo_status.c, 1.5, 1.6 ml_cairo_ps.c, NONE, 1.1 ml_cairo_png.c, NONE, 1.1 ml_cairo_pdf.c, NONE, 1.1 ml_cairo_pattern.c, NONE, 1.1 ml_cairo_path.c, 1.3, 1.4 ml_cairo_matrix.c, NONE, 1.1 ml_cairo_lablgtk.c, 1.10, 1.11 ml_cairo_ft.c, 1.5, 1.6 ml_cairo_font.c, NONE, 1.1 ml_cairo_channel.h, 1.2, NONE ml_cairo_channel.c, 1.4, NONE ml_cairo_bigarr.c, 1.5, 1.6 ml_cairo.h, 1.8, 1.9 ml_cairo.c, 1.20, 1.21 cairo_ps.mli, NONE, 1.1 cairo_ps.ml, NONE, 1.1 cairo_png.mli, NONE, 1.1 cairo_png.ml, NONE, 1.1 cairo_pdf.mli, NONE, 1.1 cairo_pdf.ml, NONE, 1.1 cairo_lablgtk.mli, 1.4, 1.5 cairo_lablgtk.ml, 1.2, 1.3 cairo_channel.mli, 1.4, NONE cairo_channel.ml, 1.2, NONE cairo_bigarray.mli, 1.3, 1.4 cairo_bigarray.ml, 1.3, 1.4 cairo.mli, 1.15, 1.16 cairo.ml, 1.13, 1.14 Makefile, 1.9, 1.10

Olivier Andrieu commit at pdx.freedesktop.org
Sun May 22 13:03:17 PDT 2005


Committed by: oandrieu

Update of /cvs/cairo/cairo-ocaml/src
In directory gabe:/tmp/cvs-serv2640/src

Modified Files:
	svg_cairo.mli svg_cairo.ml ml_svg_cairo.c ml_cairo_wrappers.h 
	ml_cairo_wrappers.c ml_cairo_status.c ml_cairo_path.c 
	ml_cairo_lablgtk.c ml_cairo_ft.c ml_cairo_bigarr.c ml_cairo.h 
	ml_cairo.c cairo_lablgtk.mli cairo_lablgtk.ml 
	cairo_bigarray.mli cairo_bigarray.ml cairo.mli cairo.ml 
	Makefile 
Added Files:
	ml_cairo_surface.c ml_cairo_ps.c ml_cairo_png.c ml_cairo_pdf.c 
	ml_cairo_pattern.c ml_cairo_matrix.c ml_cairo_font.c 
	cairo_ps.mli cairo_ps.ml cairo_png.mli cairo_png.ml 
	cairo_pdf.mli cairo_pdf.ml 
Removed Files:
	ml_cairo_status.h ml_cairo_channel.h ml_cairo_channel.c 
	cairo_channel.mli cairo_channel.ml 
Log Message:
adapt to cairo big API shakeup


Index: svg_cairo.mli
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/svg_cairo.mli,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- svg_cairo.mli	2 Mar 2005 18:52:29 -0000	1.2
+++ svg_cairo.mli	22 May 2005 20:03:15 -0000	1.3
@@ -6,6 +6,9 @@
 (*  GNU Lesser General Public License version 2.1 (the "LGPL").           *)
 (**************************************************************************)
 
+(** Rendering SVG documents with
+ cairo *)
+
 type status =
     NO_MEMORY
   | IO_ERROR
@@ -20,13 +23,17 @@
 
 external create  : unit -> t = "ml_svg_cairo_create"
 
+(** {3 Parsing} *)
+
 external parse        : t -> string -> unit = "ml_svg_cairo_parse"
 external parse_string : t -> string -> unit = "ml_svg_cairo_parse_buffer"
 
 external parse_chunk_begin : t -> unit = "ml_svg_cairo_parse_chunk_begin"
-external parse_chunk       : t -> string -> unit = "ml_svg_cairo_parse_chunk"
+external parse_chunk       : t -> string -> int -> int -> unit = "ml_svg_cairo_parse_chunk"
 external parse_chunk_end   : t -> unit = "ml_svg_cairo_parse_chunk_end"
 
+(** {3 Rendering} *)
+
 external render : t -> Cairo.t -> unit = "ml_svg_cairo_render"
 
 external set_viewport_dimenstion : t -> int -> int -> unit = "ml_svg_cairo_set_viewport_dimension"

Index: svg_cairo.ml
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/svg_cairo.ml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- svg_cairo.ml	2 Mar 2005 18:52:29 -0000	1.2
+++ svg_cairo.ml	22 May 2005 20:03:15 -0000	1.3
@@ -14,7 +14,7 @@
   | INVALID_CALL
   | PARSE_ERROR
 exception Error of status
-let init = Callback.register "svg_cairo_status_exn" (Error NO_MEMORY)
+let init = Callback.register_exception "svg_cairo_status_exn" (Error NO_MEMORY)
 
 type t
 
@@ -24,7 +24,7 @@
 external parse_string : t -> string -> unit = "ml_svg_cairo_parse_buffer"
 
 external parse_chunk_begin : t -> unit = "ml_svg_cairo_parse_chunk_begin"
-external parse_chunk       : t -> string -> unit = "ml_svg_cairo_parse_chunk"
+external parse_chunk       : t -> string -> int -> int -> unit = "ml_svg_cairo_parse_chunk"
 external parse_chunk_end   : t -> unit = "ml_svg_cairo_parse_chunk_end"
 
 external render : t -> Cairo.t -> unit = "ml_svg_cairo_render"

Index: ml_svg_cairo.c
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/ml_svg_cairo.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ml_svg_cairo.c	2 Mar 2005 18:52:29 -0000	1.2
+++ ml_svg_cairo.c	22 May 2005 20:03:15 -0000	1.3
@@ -6,35 +6,34 @@
 /*  GNU Lesser General Public License version 2.1 (the "LGPL").           */
 /**************************************************************************/
 
-#include <caml/alloc.h>
-#include <caml/memory.h>
-#include <caml/fail.h>
-#include <caml/callback.h>
-#include <caml/custom.h>
+#define CAML_NAME_SPACE
+
+#include "ml_cairo.h"
 
 #include <svg-cairo.h>
 
-#define report_null_pointer failwith("null pointer")
-#include "ml_cairo_wrappers.h"
-#include "ml_cairo.h"
+static value ml_svg_cairo_status (svg_cairo_status_t) Noreturn;
 
 static value
 ml_svg_cairo_status (svg_cairo_status_t s)
 {
   static value *exn;
-  if (s == SVG_CAIRO_STATUS_SUCCESS)
-    return Val_unit;
+  assert (s != SVG_CAIRO_STATUS_SUCCESS);
+
   if (exn == NULL)
     {
       exn = caml_named_value ("svg_cairo_status_exn");
       if (exn == NULL)
-	failwith ("Svg_cairo exception not registered");
+	caml_failwith ("svg-cairo exception");
     }
-  raise_with_arg (*exn, Val_int (s - 1));
+
+  caml_raise_with_arg (*exn, Val_int (s - 1));
 }
 
-Make_Val_final_pointer (svg_cairo_t, Id, svg_cairo_destroy, 100)
-#define svg_cairo_t_val(v) (svg_cairo_t *)Pointer_val(v)
+#define check_svg_cairo_status(s)	if (s != SVG_CAIRO_STATUS_SUCCESS) ml_svg_cairo_status (s)
+
+wMake_Val_final_pointer (svg_cairo_t, svg_cairo_destroy, 0)
+#define svg_cairo_t_val(v)	wPointer_val(svg_cairo_t, v)
 
 CAMLprim value
 ml_svg_cairo_create (value unit)
@@ -42,32 +41,80 @@
   svg_cairo_status_t status;
   svg_cairo_t *s;
   status = svg_cairo_create (&s);
-  ml_svg_cairo_status (status);
+  check_svg_cairo_status (status);
   return Val_svg_cairo_t (s);
 }
 
-ML_2 (svg_cairo_parse, svg_cairo_t_val, String_val, ml_svg_cairo_status)
+CAMLprim value
+ml_svg_cairo_parse (value v, value f)
+{
+  svg_cairo_status_t status;
+  status = svg_cairo_parse (svg_cairo_t_val (v), String_val (f));
+  check_svg_cairo_status (status);
+  return Val_unit;
+}
 
 CAMLprim value
-ml_svg_cairo_parse_buffer (value s, value b)
+ml_svg_cairo_parse_buffer (value v, value b)
 {
-  return ml_svg_cairo_status (svg_cairo_parse_buffer (svg_cairo_t_val (s),
-						      String_val (b),
-						      string_length (b)));
+  svg_cairo_status_t status;
+  status = svg_cairo_parse_buffer (svg_cairo_t_val (v), 
+				   String_val (b),
+				   caml_string_length (b));
+  check_svg_cairo_status (status);
+  return Val_unit;
 }
 
-ML_1 (svg_cairo_parse_chunk_begin, svg_cairo_t_val, ml_svg_cairo_status)
 CAMLprim value
-ml_svg_cairo_parse_chunk (value s, value b)
+ml_svg_cairo_parse_chunk_begin (value v)
 {
-  return ml_svg_cairo_status (svg_cairo_parse_chunk (svg_cairo_t_val (s),
-						     String_val (b),
-						     string_length (b)));
+  svg_cairo_status_t status;
+  status = svg_cairo_parse_chunk_begin (svg_cairo_t_val (v));
+  check_svg_cairo_status (status);
+  return Val_unit;
 }
-ML_1 (svg_cairo_parse_chunk_end, svg_cairo_t_val, ml_svg_cairo_status)
 
-ML_2 (svg_cairo_render, svg_cairo_t_val, cairo_t_val, ml_svg_cairo_status)
-ML_3 (svg_cairo_set_viewport_dimension, svg_cairo_t_val, Unsigned_int_val, Unsigned_int_val, ml_svg_cairo_status)
+CAMLprim value
+ml_svg_cairo_parse_chunk (value v, value b, value o, value l)
+{
+  svg_cairo_status_t status;
+  if (Unsigned_int_val (o) + Unsigned_int_val (l) > caml_string_length (b))
+    caml_invalid_argument ("Svg_cairo.parse_chunk: invalid substring");
+  status = svg_cairo_parse_chunk (svg_cairo_t_val (v), 
+				  String_val (b) + Unsigned_int_val (o),
+				  Unsigned_int_val (l));
+  check_svg_cairo_status (status);
+  return Val_unit;
+}
+
+CAMLprim value
+ml_svg_cairo_parse_chunk_end (value v)
+{
+  svg_cairo_status_t status;
+  status = svg_cairo_parse_chunk_end (svg_cairo_t_val (v));
+  check_svg_cairo_status (status);
+  return Val_unit;
+}
+
+CAMLprim value
+ml_svg_cairo_render (value v, value cr)
+{
+  svg_cairo_status_t status;
+  status = svg_cairo_render (svg_cairo_t_val (v), cairo_t_val (cr));
+  check_svg_cairo_status (status);
+  return Val_unit;
+}
+
+CAMLprim value
+ml_svg_cairo_set_viewport_dimension (value v, value w, value h)
+{
+  svg_cairo_status_t status;
+  status = svg_cairo_set_viewport_dimension (svg_cairo_t_val (v),
+					     Unsigned_int_val (w),
+					     Unsigned_int_val (h));
+  check_svg_cairo_status (status);
+  return Val_unit;
+}
 
 CAMLprim value
 ml_svg_cairo_get_size (value s)
@@ -75,7 +122,7 @@
   int w, h;
   value r;
   svg_cairo_get_size (svg_cairo_t_val (s), &w, &h);
-  r = alloc_small (2, 0);
+  r = caml_alloc_small (2, 0);
   Field (r, 0) = Val_int (w);
   Field (r, 1) = Val_int (h);
   return r;

Index: ml_cairo_wrappers.h
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/ml_cairo_wrappers.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- ml_cairo_wrappers.h	2 Mar 2005 18:52:29 -0000	1.8
+++ ml_cairo_wrappers.h	22 May 2005 20:03:15 -0000	1.9
@@ -6,107 +6,145 @@
 /*  GNU Lesser General Public License version 2.1 (the "LGPL").           */
 /**************************************************************************/
 
-#define Pointer_val(val) ((void*)Field(val,1))
-#define Store_pointer(val, p) (Field(val, 1)=Val_bp(p))
+#define wPointer_val(t, val)	(* ((t **) Data_custom_val(val)))
 
 int ml_pointer_compare (value, value);
 long ml_pointer_hash (value);
 
-#define Make_Val_final_pointer(type, init, final, adv) \
+#define wMake_Val_final_pointer(type, final, adv) \
 static void ml_final_##type (value val) \
-{ if (Field(val,1)) final ((type*)Field(val,1)); } \
+{ type **p = Data_custom_val(val); \
+  if (*p) final (*p); } \
 static struct custom_operations ml_custom_##type = \
-{ #type "/001", ml_final_##type, ml_pointer_compare, \
-  ml_pointer_hash, custom_serialize_default, custom_deserialize_default };\
+{ #type "/001", ml_final_##type, \
+  ml_pointer_compare, ml_pointer_hash, \
+  custom_serialize_default, custom_deserialize_default }; \
 value Val_##type (type *p) \
-{ value ret; if (!p) report_null_pointer; \
-  ret = alloc_custom (&ml_custom_##type, sizeof(value), adv, 1000); \
-  p = init(p); \
-  Field(ret,1) = Val_bp (p); return ret; }
-
-static inline value Val_ptr(void *p)
-{
-  value v;
-  v = alloc_small(2, Abstract_tag);
-  Field(v, 1) = (value) p;
-  return v;
-}
+{ type **store; value ret; \
+  if (!p) report_null_pointer(); \
+  ret = caml_alloc_custom (&ml_custom_##type, sizeof p, adv, 100); \
+  store = Data_custom_val(ret); \
+  *store = p; return ret; }
 
 #ifndef ARCH_ALIGN_DOUBLE
 #define Double_array_val(v)    ((double *)(v))
 #endif
 #define Double_array_length(v) (Wosize_val(v) / Double_wosize)
 
-#define Option_val(v,conv,def) (Is_long(v) ? def : conv(Field((v),0)))
-#define StringOption_val(v) Option_val(v, String_val, NULL)
-
 #define Ignore(x)
 #define Unit(x) ((x), Val_unit)
-#define Id(x) (x)
 
-#define Unsupported(fun) \
-CAMLprim value fun() { failwith("Unsupported backend"); return Val_unit; }
+#define Cairo_Unsupported(fun, msg) \
+CAMLprim value ml_##fun() { caml_failwith (msg); return Val_unit; }
 
-#define ML_0(cname, conv) \
+#define wML_0(cname, conv) \
 CAMLprim value ml_##cname (value unit) { return conv (cname ()); }
-#define ML_1(cname, conv1, conv) \
+#define wML_1(cname, conv1, conv) \
 CAMLprim value ml_##cname (value arg1) { return conv (cname (conv1 (arg1))); }
-#define ML_1_post(cname, conv1, conv, t, post) \
+#define wML_1_post(cname, conv1, conv, t, post) \
 CAMLprim value ml_##cname (value arg1) \
 { t ret = cname (conv1(arg1)); post; return conv(ret); }
-#define ML_2(cname, conv1, conv2, conv) \
+#define wML_2(cname, conv1, conv2, conv) \
 CAMLprim value ml_##cname (value arg1, value arg2) \
 { return conv (cname (conv1(arg1), conv2(arg2))); }
-#define ML_2_post(cname, conv1, conv2, t, conv) \
+#define wML_2_post(cname, conv1, conv2, t, conv) \
 CAMLprim value ml_##cname (value arg1, value arg2) \
 { t ret = cname (conv1(arg1), conv2(arg2)); post; return conv(ret); }
-#define ML_3(cname, conv1, conv2, conv3, conv) \
+#define wML_3(cname, conv1, conv2, conv3, conv) \
 CAMLprim value ml_##cname (value arg1, value arg2, value arg3) \
 { return conv (cname (conv1(arg1), conv2(arg2), conv3(arg3))); }
-#define ML_3_post(cname, conv1, conv2, conv3, conv, t, post) \
+#define wML_3_post(cname, conv1, conv2, conv3, conv, t, post) \
 CAMLprim value ml_##cname (value arg1, value arg2, value arg3) \
 { t ret = cname (conv1(arg1), conv2(arg2), conv3(arg3)); post; return conv(t); }
-#define ML_4(cname, conv1, conv2, conv3, conv4, conv) \
+#define wML_4(cname, conv1, conv2, conv3, conv4, conv) \
 CAMLprim value ml_##cname (value arg1, value arg2, value arg3, value arg4) \
 { return conv (cname (conv1(arg1), conv2(arg2), conv3(arg3), conv4(arg4))); }
-#define ML_4_post(cname, conv1, conv2, conv3, conv4, conv, t, post) \
+#define wML_4_post(cname, conv1, conv2, conv3, conv4, conv, t, post) \
 CAMLprim value ml_##cname (value arg1, value arg2, value arg3, value arg4) \
 { t ret = cname (conv1(arg1), conv2(arg2), conv3(arg3), conv4(arg4)); post; return conv(ret); }
-#define ML_5(cname, conv1, conv2, conv3, conv4, conv5, conv) \
+#define wML_5(cname, conv1, conv2, conv3, conv4, conv5, conv) \
 CAMLprim value ml_##cname (value arg1, value arg2, value arg3, value arg4, \
                            value arg5) \
 { return conv (cname (conv1(arg1), conv2(arg2), conv3(arg3), conv4(arg4), \
 		      conv5(arg5))); }
-#define ML_5_post(cname, conv1, conv2, conv3, conv4, conv5, conv, t, post) \
+#define wML_5_post(cname, conv1, conv2, conv3, conv4, conv5, conv, t, post) \
 CAMLprim value ml_##cname (value arg1, value arg2, value arg3, value arg4, \
                            value arg5) \
 { t ret = cname (conv1(arg1), conv2(arg2), conv3(arg3), conv4(arg4), conv5(arg5)); \
   post; return conv(ret); }
-#define ML_6(cname, conv1, conv2, conv3, conv4, conv5, conv6, conv) \
+#define wML_6(cname, conv1, conv2, conv3, conv4, conv5, conv6, conv) \
 CAMLprim value ml_##cname (value arg1, value arg2, value arg3, value arg4, \
                            value arg5, value arg6) \
 { return conv (cname (conv1(arg1), conv2(arg2), conv3(arg3), conv4(arg4), \
 		      conv5(arg5), conv6(arg6))); }
-#define ML_6_post(cname, conv1, conv2, conv3, conv4, conv5, conv6, conv, t, post) \
+#define wML_6_post(cname, conv1, conv2, conv3, conv4, conv5, conv6, conv, t, post) \
 CAMLprim value ml_##cname (value arg1, value arg2, value arg3, value arg4, \
                            value arg5, value arg6) \
 { t ret = cname (conv1(arg1), conv2(arg2), conv3(arg3), conv4(arg4), \
 		 conv5(arg5), conv6(arg6)); post; return conv(ret); }
-#define ML_7(cname, conv1, conv2, conv3, conv4, conv5, conv6, conv7, conv) \
+#define wML_7(cname, conv1, conv2, conv3, conv4, conv5, conv6, conv7, conv) \
 CAMLprim value ml_##cname (value arg1, value arg2, value arg3, value arg4, \
                            value arg5, value arg6, value arg7) \
 { return conv (cname (conv1(arg1), conv2(arg2), conv3(arg3), conv4(arg4), \
 		      conv5(arg5), conv6(arg6), conv7(arg7))); }
-#define ML_7_post(cname, conv1, conv2, conv3, conv4, conv5, conv6, conv7, conv, t, post) \
+#define wML_7_post(cname, conv1, conv2, conv3, conv4, conv5, conv6, conv7, conv, t, post) \
 CAMLprim value ml_##cname (value arg1, value arg2, value arg3, value arg4, \
                            value arg5, value arg6, value arg7) \
 { t ret = cname (conv1(arg1), conv2(arg2), conv3(arg3), conv4(arg4), \
 		      conv5(arg5), conv6(arg6), conv7(arg7)); post; return conv(ret); }
 
 
-#define ML_bc6(cname) \
+#define wML_bc6(cname) \
 CAMLprim value ml_##cname##_bc (value *argv, int argn) \
 { return ml_##cname(argv[0],argv[1],argv[2],argv[3],argv[4],argv[5]); }
-#define ML_bc7(cname) \
+#define wML_bc7(cname) \
 CAMLprim value ml_##cname##_bc (value *argv, int argn) \
 { return ml_##cname(argv[0],argv[1],argv[2],argv[3],argv[4],argv[5],argv[6]); }
+
+#define wML_0_cairo(cname) \
+CAMLprim value ml_cairo_##cname (value v_cr) \
+{ cairo_##cname (cairo_t_val (v_cr)); \
+  check_cairo_status (v_cr); \
+  return Val_unit; \
+}
+#define wML_1_cairo(cname, conv1) \
+CAMLprim value ml_cairo_##cname (value v_cr, value arg1) \
+{ cairo_##cname (cairo_t_val (v_cr), conv1 (arg1)); \
+  check_cairo_status (v_cr); \
+  return Val_unit; \
+}
+#define wML_2_cairo(cname, conv1, conv2) \
+CAMLprim value ml_cairo_##cname (value v_cr, value arg1, value arg2) \
+{ cairo_##cname (cairo_t_val (v_cr), conv1 (arg1), conv2 (arg2)); \
+  check_cairo_status (v_cr); \
+  return Val_unit; \
+}
+#define wML_3_cairo(cname, conv1, conv2, conv3) \
+CAMLprim value ml_cairo_##cname (value v_cr, value arg1, value arg2, value arg3) \
+{ cairo_##cname (cairo_t_val (v_cr), conv1 (arg1), conv2 (arg2), conv3 (arg3)); \
+  check_cairo_status (v_cr); \
+  return Val_unit; \
+}
+#define wML_4_cairo(cname, conv1, conv2, conv3, conv4) \
+CAMLprim value ml_cairo_##cname (value v_cr, value arg1, value arg2, value arg3, value arg4) \
+{ cairo_##cname (cairo_t_val (v_cr), conv1 (arg1), conv2 (arg2), conv3 (arg3), conv4 (arg4)); \
+  check_cairo_status (v_cr); \
+  return Val_unit; \
+}
+#define wML_5_cairo(cname, conv1, conv2, conv3, conv4, conv5) \
+CAMLprim value ml_cairo_##cname (value v_cr, value arg1, value arg2, value arg3, value arg4, value arg5) \
+{ cairo_##cname (cairo_t_val (v_cr), conv1 (arg1), conv2 (arg2), conv3 (arg3), conv4 (arg4), conv5 (arg5)); \
+  check_cairo_status (v_cr); \
+  return Val_unit; \
+} \
+CAMLprim value ml_cairo_##cname##_bc (value *argv, int argn) \
+{ return ml_cairo_##cname (argv[0],argv[1],argv[2],argv[3],argv[4],argv[5]); }
+#define wML_6_cairo(cname, conv1, conv2, conv3, conv4, conv5, conv6) \
+CAMLprim value ml_cairo_##cname (value v_cr, value arg1, value arg2, value arg3, value arg4, value arg5, value arg6) \
+{ cairo_##cname (cairo_t_val (v_cr), conv1 (arg1), conv2 (arg2), conv3 (arg3), conv4 (arg4), conv5 (arg5), conv6 (arg6)); \
+  check_cairo_status (v_cr); \
+  return Val_unit; \
+} \
+CAMLprim value ml_cairo_##cname##_bc (value *argv, int argn) \
+{ return ml_cairo_##cname (argv[0],argv[1],argv[2],argv[3],argv[4],argv[5], argv[6]); }
+

Index: ml_cairo_wrappers.c
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/ml_cairo_wrappers.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ml_cairo_wrappers.c	2 Mar 2005 18:52:29 -0000	1.3
+++ ml_cairo_wrappers.c	22 May 2005 20:03:15 -0000	1.4
@@ -6,15 +6,16 @@
 /*  GNU Lesser General Public License version 2.1 (the "LGPL").           */
 /**************************************************************************/
 
-#include <caml/mlvalues.h>
+#define CAML_NAME_SPACE
 #include <caml/alloc.h>
+
 #include "ml_cairo_wrappers.h"
 
 int
 ml_pointer_compare (value a, value b)
 {
-  void *p1 = Pointer_val (a);
-  void *p2 = Pointer_val (b);
+  void *p1 = wPointer_val (void, a);
+  void *p2 = wPointer_val (void, b);
   if (p1 == p2)
     return 0;
   else if (p1 < p2)
@@ -26,6 +27,6 @@
 long
 ml_pointer_hash (value a)
 {
-  void *p = Pointer_val (a);
+  void *p = wPointer_val (void, a);
   return (long) p;
 }

--- NEW FILE: ml_cairo_surface.c ---
(This appears to be a binary file; contents omitted.)

--- ml_cairo_status.h DELETED ---

Index: ml_cairo_status.c
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/ml_cairo_status.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- ml_cairo_status.c	2 Mar 2005 18:52:29 -0000	1.5
+++ ml_cairo_status.c	22 May 2005 20:03:15 -0000	1.6
@@ -6,34 +6,41 @@
 /*  GNU Lesser General Public License version 2.1 (the "LGPL").           */
 /**************************************************************************/
 
-#include <cairo.h>
-#include <caml/callback.h>
-#include <caml/fail.h>
-
 #include "ml_cairo.h"
-#include "ml_cairo_status.h"
 
-void
-cairo_treat_status (cairo_status_t status)
+CAMLprim value
+ml_cairo_status (value v_cr)
 {
-  static value *cairo_exn;
+  value v;
+  cairo_status_t status = cairo_status (cairo_t_val (v_cr));
 
-  if (status != CAIRO_STATUS_SUCCESS)
+  if (status == CAIRO_STATUS_SUCCESS)
+    v = Val_unit;
+  else
     {
-      if (cairo_exn == NULL)
-	{
-	  cairo_exn = caml_named_value ("cairo_status_exn");
-	  if (cairo_exn == NULL)
-	    failwith ("cairo exception");
-	}
-      raise_with_arg (*cairo_exn, Val_int (status - 1));
+      v = caml_alloc_small (1, 0);
+      Field (v, 0) = Val_int (status - 1);
     }
+  return v;
 }
 
+wML_1(cairo_status_string, cairo_t_val, caml_copy_string)
+
 void
-check_cairo_status (value cr)
+ml_cairo_treat_status (cairo_status_t status)
 {
-  struct ml_cairo *ml_c = Data_custom_val (cr);
-  if (!ml_c->suspend_exn)
-    cairo_treat_status (cairo_status (ml_c->cr));
+  static value *cairo_exn;
+
+  assert (status != CAIRO_STATUS_SUCCESS);
+
+  if (status == CAIRO_STATUS_NO_MEMORY)
+    caml_raise_out_of_memory ();
+
+  if (cairo_exn == NULL)
+    {
+      cairo_exn = caml_named_value ("cairo_status_exn");
+      if (cairo_exn == NULL)
+	caml_failwith ("cairo exception");
+    }
+  caml_raise_with_arg (*cairo_exn, Val_int (status - 1));
 }

--- NEW FILE: ml_cairo_ps.c ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: ml_cairo_png.c ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: ml_cairo_pdf.c ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: ml_cairo_pattern.c ---
(This appears to be a binary file; contents omitted.)

Index: ml_cairo_path.c
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/ml_cairo_path.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ml_cairo_path.c	2 Mar 2005 18:52:29 -0000	1.3
+++ ml_cairo_path.c	22 May 2005 20:03:15 -0000	1.4
@@ -6,147 +6,86 @@
 /*  GNU Lesser General Public License version 2.1 (the "LGPL").           */
 /**************************************************************************/
 
-#include <caml/mlvalues.h>
-#include <caml/alloc.h>
-#include <caml/memory.h>
-#include <caml/fail.h>
-#include <caml/custom.h>
-#include <caml/callback.h>
-
-#include "ml_cairo_wrappers.h"
-
-#include <cairo.h>
 #include "ml_cairo.h"
-#include "ml_cairo_status.h"
-
 
 #define CAML_MOVE_TO_TAG  0x95006a53L
 #define CAML_LINE_TO_TAG  0x3f23e04dL
 #define CAML_CLOSE_TAG    0x8ca29f31L
 #define CAML_CURVE_TO_TAG 0x84e3bcd7L
 
-struct caml_fold_info
-{
-  value closure;
-  value val;
-};
-
 static value
-make_point (double x, double y)
+ml_cairo_fold_path (cairo_path_t *path, value f, value acc)
 {
-  value p;
-  p = alloc_small (2 * Double_wosize, Double_array_tag);
-  Store_double_field (p, 0, x);
-  Store_double_field (p, 1, y);
-  return p;
-}
+  CAMLparam2(f, acc);
+  CAMLlocal5(var, t, p1, p2, p3);
+  int i;
 
-static void
-ml_cairo_move_to_cb (void *data, double x, double y)
-{
-  struct caml_fold_info *p = data;
-  CAMLparam0 ();
-  CAMLlocal2 (path_elem, point);
-  if (!Is_exception_result (p->val))
+  for (i = 0; i < path->num_data; i += path->data[i].header.length)
     {
-      point = make_point (x, y);
-      path_elem = alloc_small (2, 0);
-      Field (path_elem, 0) = CAML_MOVE_TO_TAG;
-      Field (path_elem, 1) = point;
-      p->val = callback2_exn (p->closure, p->val, path_elem);
-    }
-  CAMLreturn0;
-}
+      cairo_path_data_t *data = &path->data[i];
+      switch (data->header.type)
+	{
+	case CAIRO_PATH_MOVE_TO:
+	  {
+	    p1 = ml_cairo_point (data[1].point.x, data[1].point.y);
+	    var = caml_alloc_small (2, 0);
+	    Field (var, 0) = CAML_MOVE_TO_TAG;
+	    Field (var, 1) = p1;
+	    break;
+	  }
 
-static void
-ml_cairo_line_to_cb (void *data, double x, double y)
-{
-  struct caml_fold_info *p = data;
-  CAMLparam0 ();
-  CAMLlocal2 (path_elem, point);
-  if (!Is_exception_result (p->val))
-    {
-      point = make_point (x, y);
-      path_elem = alloc_small (2, 0);
-      Field (path_elem, 0) = CAML_LINE_TO_TAG;
-      Field (path_elem, 1) = point;
-      p->val = callback2_exn (p->closure, p->val, path_elem);
-    }
-  CAMLreturn0;
-}
+	case CAIRO_PATH_LINE_TO:
+	  {
+	    p1 = ml_cairo_point (data[1].point.x, data[1].point.y);
+	    var = caml_alloc_small (2, 0);
+	    Field (var, 0) = CAML_LINE_TO_TAG;
+	    Field (var, 1) = p1;
+	    break;
+	  }
 
-static void
-ml_cairo_curve_to_cb (void *data,
-		      double x1, double y1,
-		      double x2, double y2, double x3, double y3)
-{
-  struct caml_fold_info *p = data;
-  CAMLparam0 ();
-  CAMLlocal5 (path_elem, tuple, point1, point2, point3);
-  if (!Is_exception_result (p->val))
-    {
-      point1 = make_point (x1, y1);
-      point2 = make_point (x2, y2);
-      point3 = make_point (x3, y3);
-      tuple = alloc_small (3, 0);
-      Field (tuple, 0) = point1;
-      Field (tuple, 1) = point2;
-      Field (tuple, 2) = point3;
-      path_elem = alloc_small (2, 0);
-      Field (path_elem, 0) = CAML_CURVE_TO_TAG;
-      Field (path_elem, 1) = tuple;
-      p->val = callback2_exn (p->closure, p->val, path_elem);
-    }
-  CAMLreturn0;
-}
+	case CAIRO_PATH_CURVE_TO:
+	  {
+	    p1 = ml_cairo_point (data[1].point.x, data[1].point.y);
+	    p2 = ml_cairo_point (data[2].point.x, data[2].point.y);
+	    p3 = ml_cairo_point (data[3].point.x, data[3].point.y);
+	    t = caml_alloc_small (3, 0);
+	    Field (t, 0) = p1;
+	    Field (t, 1) = p2;
+	    Field (t, 2) = p3;
+	    var = caml_alloc_small (2, 0);
+	    Field (var, 0) = CAML_CURVE_TO_TAG;
+	    Field (var, 1) = t;
+	    break;
+	  }
 
-static void
-ml_cairo_close_cb (void *data)
-{
-  struct caml_fold_info *p = data;
-  if (!Is_exception_result (p->val))
-    {
-      p->val = callback2_exn (p->closure, p->val, CAML_CLOSE_TAG);
+	case CAIRO_PATH_CLOSE_PATH:
+	  var = CAML_CLOSE_TAG;
+	  break;
+	}
+
+      acc = caml_callback2_exn (f, acc, var);
+      if (Is_exception_result (acc))
+	break;
     }
+
+  cairo_path_destroy (path);
+
+  if (Is_exception_result (acc))
+    caml_raise (Extract_exception (acc));
+
+  CAMLreturn (acc);
 }
 
 CAMLprim value
-ml_cairo_current_path (value v_cr, value closure, value init)
+ml_cairo_copy_path (value cr, value f, value init)
 {
-  CAMLparam1 (v_cr);
-  CAMLlocalN (v_p, 2);
-  struct caml_fold_info *p = (struct caml_fold_info *) v_p;
-  p->closure = closure;
-  p->val = init;
-  cairo_current_path (cairo_t_val (v_cr),
-		      ml_cairo_move_to_cb,
-		      ml_cairo_line_to_cb,
-		      ml_cairo_curve_to_cb, ml_cairo_close_cb, p);
-  check_cairo_status (v_cr);
-  if (Is_exception_result (p->val))
-    {
-      value ex = Extract_exception (p->val);
-      mlraise (ex);
-    }
-  CAMLreturn (p->val);
+  return ml_cairo_fold_path (cairo_copy_path (cairo_t_val (cr)), f, init);
 }
 
 CAMLprim value
-ml_cairo_current_path_flat (value v_cr, value closure, value init)
+ml_cairo_copy_path_flat (value cr, value f, value init)
 {
-  CAMLparam1 (v_cr);
-  CAMLlocalN (v_p, 2);
-  struct caml_fold_info *p = (struct caml_fold_info *) v_p;
-  p->closure = closure;
-  p->val = init;
-  cairo_current_path_flat (cairo_t_val (v_cr),
-			   ml_cairo_move_to_cb,
-			   ml_cairo_line_to_cb, ml_cairo_close_cb, p);
-  check_cairo_status (v_cr);
-  if (Is_exception_result (p->val))
-    {
-      value ex = Extract_exception (p->val);
-      mlraise (ex);
-    }
-  CAMLreturn (p->val);
+  return ml_cairo_fold_path (cairo_copy_path_flat (cairo_t_val (cr)), f, init);
 }
+
+/* append_path */

--- NEW FILE: ml_cairo_matrix.c ---
(This appears to be a binary file; contents omitted.)

Index: ml_cairo_lablgtk.c
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/ml_cairo_lablgtk.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- ml_cairo_lablgtk.c	2 Mar 2005 18:52:29 -0000	1.10
+++ ml_cairo_lablgtk.c	22 May 2005 20:03:15 -0000	1.11
@@ -6,52 +6,50 @@
 /*  GNU Lesser General Public License version 2.1 (the "LGPL").           */
 /**************************************************************************/
 
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <gdk/gdkx.h>
-
-#include <cairo.h>
-#ifdef CAIRO_HAS_XLIB_SURFACE
+#include "ml_cairo.h"
+#if CAIRO_HAS_XLIB_SURFACE
 # include <cairo-xlib.h>
 #endif
 
-#include <caml/mlvalues.h>
-#include <caml/alloc.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <gdk/gdk.h>
+#include <gdk/gdkx.h>
 
 #include "wrappers.h"
 #include "ml_gobject.h"
 #include "ml_gdkpixbuf.h"
 #include "ml_gdk.h"
 
-#include "ml_cairo.h"
-#include "ml_cairo_status.h"
-
 CAMLprim value
-cairo_lablgtk_of_pixbuf(value pb)
+ml_cairo_lablgtk_of_pixbuf (value pb)
 {
-  value v;
+  static const cairo_user_data_key_t pixbuf_key;
+
   GdkPixbuf *pixbuf = GdkPixbuf_val(pb);
   cairo_format_t format;
   gboolean alpha = gdk_pixbuf_get_has_alpha(pixbuf);
   int nchan = gdk_pixbuf_get_n_channels(pixbuf);
   int bps = gdk_pixbuf_get_bits_per_sample(pixbuf);
+  cairo_surface_t *surf;
 
   if ((nchan == 4) && (bps == 8) && alpha)
     format = CAIRO_FORMAT_ARGB32;
   else 
-    failwith("bad GdkPixbuf format");
+    caml_invalid_argument ("bad GdkPixbuf format");
 
-  v = alloc_small(5, 0);
-  Field(v, 0) = Val_bp(gdk_pixbuf_get_pixels(pixbuf));
-  Field(v, 1) = Val_cairo_format_t(format);
-  Field(v, 2) = Val_int(gdk_pixbuf_get_width(pixbuf));
-  Field(v, 3) = Val_int(gdk_pixbuf_get_height(pixbuf));
-  Field(v, 4) = Val_int(gdk_pixbuf_get_rowstride(pixbuf));
+  surf = cairo_image_surface_create_for_data (gdk_pixbuf_get_pixels (pixbuf),
+					      format,
+					      gdk_pixbuf_get_width(pixbuf),
+					      gdk_pixbuf_get_height(pixbuf),
+					      gdk_pixbuf_get_rowstride(pixbuf));
 
-  return v;
+  ml_cairo_surface_set_user_data (surf, &pixbuf_key, ml_cairo_make_root (pb));
+
+  return Val_cairo_surface_t (surf);
 }
 
 CAMLprim value
-cairo_lablgtk_shuffle_pixels(value pb)
+ml_cairo_lablgtk_shuffle_pixels (value pb)
 {
   GdkPixbuf *pixbuf = GdkPixbuf_val(pb);
   guint w, h, s, i, j;
@@ -61,10 +59,10 @@
 			(gdk_pixbuf_get_n_channels(pixbuf) == 4) &&
 			(gdk_pixbuf_get_bits_per_sample(pixbuf) == 8), Val_unit);
 
-  w = gdk_pixbuf_get_width(pixbuf);
-  h = gdk_pixbuf_get_height(pixbuf);
-  s = gdk_pixbuf_get_rowstride(pixbuf);
-  pixels = gdk_pixbuf_get_pixels(pixbuf);
+  w = gdk_pixbuf_get_width (pixbuf);
+  h = gdk_pixbuf_get_height (pixbuf);
+  s = gdk_pixbuf_get_rowstride (pixbuf);
+  pixels = gdk_pixbuf_get_pixels (pixbuf);
 
   for (i=0; i<h; i++) {
     p = pixels;
@@ -81,53 +79,50 @@
 }
 
 
-#ifdef CAIRO_HAS_XLIB_SURFACE
+#if CAIRO_HAS_XLIB_SURFACE
 CAMLprim value
-cairo_lablgtk_surface_create_for_drawable(value d, value fmt)
+ml_cairo_xlib_surface_create (value d)
 {
-  GdkDrawable *draw = GdkDrawable_val(d);
-  cairo_surface_t *s;
-  
-  s = cairo_xlib_surface_create (
-				 GDK_DRAWABLE_XDISPLAY(draw),
-				 GDK_DRAWABLE_XID(draw),
-				 GDK_VISUAL_XVISUAL(gdk_drawable_get_visual(draw)),
-				 cairo_format_t_val(fmt),
-				 GDK_COLORMAP_XCOLORMAP(gdk_drawable_get_colormap(draw)));
-  return Val_cairo_surface_t(s);
-}
+  static const cairo_user_data_key_t drawable_key;
 
-CAMLprim value
-cairo_lablgtk_set_target_drawable(value cr, value d)
-{
-  cairo_t *c = cairo_t_val(cr);
-  GdkDrawable *draw = GdkDrawable_val(d);
-  GdkDrawable *real_drawable;
-  gint x_offset, y_offset;
+  cairo_surface_t *surface;
+  gint width, height;
+  GdkDrawable *drawable = GdkDrawable_val(d);
+  GdkVisual *visual = gdk_drawable_get_visual (drawable);
+  
+  gdk_drawable_get_size (drawable, &width, &height);
 
-  if (GDK_IS_WINDOW(draw))
-    gdk_window_get_internal_paint_info(GDK_WINDOW(draw),
-				       &real_drawable,
-				       &x_offset, &y_offset);
+  if (visual) 
+    surface = cairo_xlib_surface_create (GDK_DRAWABLE_XDISPLAY (drawable),
+					 GDK_DRAWABLE_XID (drawable),
+					 GDK_VISUAL_XVISUAL (visual),
+					 width, height);
+  else if (gdk_drawable_get_depth (drawable) == 1)
+    surface = 
+      cairo_xlib_surface_create_for_bitmap (GDK_PIXMAP_XDISPLAY (drawable),
+					    GDK_PIXMAP_XID (drawable),
+					    width, height);
   else {
-    real_drawable = draw;
-    x_offset = 0;
-    y_offset = 0;
+    g_warning ("Using Cairo rendering requires the drawable argument to\n"
+	       "have a specified colormap. All windows have a colormap,\n"
+	       "however, pixmaps only have colormap by default if they\n"
+	       "were created with a non-NULL window argument. Otherwise\n"
+	       "a colormap must be set on them with "
+	       "gdk_drawable_set_colormap");
+    surface = NULL;
   }
-    
-  cairo_set_target_drawable(c,
-			    GDK_DRAWABLE_XDISPLAY(real_drawable),
-			    GDK_DRAWABLE_XID(real_drawable));
-  check_cairo_status(cr);
-  cairo_translate(c, -x_offset, -y_offset);
-  check_cairo_status(cr);
 
-  return Val_unit;
+  if (surface != NULL)
+    ml_cairo_surface_set_user_data (surface, &drawable_key, ml_cairo_make_root (d));
+
+  return Val_cairo_surface_t (surface);
 }
 
+ML_3 (cairo_xlib_surface_set_size, cairo_surface_t_val, Int_val, Int_val, Unit)
+
 #else
 
-Unsupported(cairo_lablgtk_surface_create_for_drawable)
-Unsupported(cairo_lablgtk_set_target_drawable)
+Cairo_Unsupported(cairo_xlib_surface_create, "Xlib backend not supported");
+Cairo_Unsupported(cairo_xlib_surface_set_size, "Xlib backend not supported");
 
 #endif /* CAIRO_HAS_XLIB_SURFACE */

Index: ml_cairo_ft.c
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/ml_cairo_ft.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- ml_cairo_ft.c	9 Mar 2005 00:40:22 -0000	1.5
+++ ml_cairo_ft.c	22 May 2005 20:03:15 -0000	1.6
@@ -6,24 +6,11 @@
 /*  GNU Lesser General Public License version 2.1 (the "LGPL").           */
 /**************************************************************************/
 
-#include <caml/mlvalues.h>
-#include <caml/alloc.h>
-#include <caml/memory.h>
-#include <caml/fail.h>
-#include <caml/custom.h>
-#include <caml/callback.h>
-
-#include "ml_cairo_wrappers.h"
-
-#include <cairo.h>
-#ifdef CAIRO_HAS_FT_FONT
-# include <cairo-ft.h>
-#endif
 
 #include "ml_cairo.h"
-#include "ml_cairo_status.h"
 
-#ifdef CAIRO_HAS_FT_FONT
+#if CAIRO_HAS_FT_FONT
+# include <cairo-ft.h>
 
 /* minimal Freetype interface */
 static void

--- NEW FILE: ml_cairo_font.c ---
(This appears to be a binary file; contents omitted.)

--- ml_cairo_channel.h DELETED ---

--- ml_cairo_channel.c DELETED ---

Index: ml_cairo_bigarr.c
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/ml_cairo_bigarr.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- ml_cairo_bigarr.c	2 Mar 2005 18:52:29 -0000	1.5
+++ ml_cairo_bigarr.c	22 May 2005 20:03:15 -0000	1.6
@@ -6,6 +6,8 @@
 /*  GNU Lesser General Public License version 2.1 (the "LGPL").           */
 /**************************************************************************/
 
+#include "ml_cairo.h"
+
 #include <caml/bigarray.h>
 
 unsigned long bigarray_byte_size (struct caml_bigarray *);
@@ -17,7 +19,7 @@
 }
 
 CAMLprim value
-bigarray_kind_float (value v)
+ml_bigarray_kind_float (value v)
 {
   struct caml_bigarray *ba = Bigarray_val (v);
 
@@ -32,3 +34,18 @@
       return Val_false;
     }
 }
+
+CAMLprim value
+ml_cairo_image_surface_create_for_data (value img, value fmt, value w, value h, value stride)
+{
+  static const cairo_user_data_key_t image_data_key;
+  cairo_surface_t *surf;
+  surf = cairo_image_surface_create_for_data (Data_bigarray_val (img),
+					      cairo_format_t_val (fmt),
+					      Int_val (w),
+					      Int_val (h),
+					      Int_val (stride));
+  ml_cairo_surface_set_user_data (surf, &image_data_key, ml_cairo_make_root (img));
+
+  return Val_cairo_surface_t (surf);
+}

Index: ml_cairo.h
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/ml_cairo.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- ml_cairo.h	2 Mar 2005 18:52:29 -0000	1.8
+++ ml_cairo.h	22 May 2005 20:03:15 -0000	1.9
@@ -6,21 +6,69 @@
 /*  GNU Lesser General Public License version 2.1 (the "LGPL").           */
 /**************************************************************************/
 
-struct ml_cairo {
-  cairo_t *cr;
-  int suspend_exn;
-};
-#define cairo_t_val(v) (((struct ml_cairo *) Data_custom_val(v))->cr)
+#include <assert.h>
+#include <string.h>
+
+#define CAML_NAME_SPACE
+
+#include <caml/alloc.h>
+#include <caml/memory.h>
+#include <caml/fail.h>
+#include <caml/custom.h>
+#include <caml/callback.h>
+
+#include "ml_cairo_wrappers.h"
+
+#include <cairo.h>
+
+/* cairo */
+#define cairo_t_val(v)		wPointer_val(cairo_t, v)
 value Val_cairo_t (cairo_t *);
 
+#define cairo_surface_t_val(v)	wPointer_val(cairo_surface_t, v)
+value Val_cairo_surface_t (cairo_surface_t *);
+#define Val_cairo_surface_ref(p)	Val_cairo_surface_t ((cairo_surface_reference(p), p))
+
+#define cairo_pattern_t_val(v)	wPointer_val(cairo_pattern_t, v)
+value Val_cairo_pattern_t (cairo_pattern_t *);
+#define Val_cairo_pattern_ref(p)	Val_cairo_pattern_t ((cairo_pattern_reference(p), p))
+
 #define cairo_format_t_val(v) ((cairo_format_t) Int_val(v))
 #define Val_cairo_format_t(v) Val_int(v)
 
-#define cairo_surface_t_val(v) ((cairo_surface_t *)Pointer_val(v))
-value Val_cairo_surface_t (cairo_surface_t *);
+#define cairo_font_face_t_val(v)	wPointer_val(cairo_font_face_t, v)
+value Val_cairo_font_face_t (cairo_font_face_t *);
+#define Val_cairo_font_face_ref(p)	Val_cairo_font_face_t ((cairo_font_face_reference(p), p))
 
-#define cairo_font_t_val(v) ((cairo_font_t *)Pointer_val(v))
-value Val_cairo_font_t (cairo_font_t *);
+#define cairo_scaled_font_t_val(v)	wPointer_val(cairo_scaled_font_t, v)
+value Val_cairo_scaled_font_t (cairo_scaled_font_t *);
 
-#define cairo_matrix_t_val(v) ((cairo_matrix_t *)Pointer_val(v))
-value Val_cairo_matrix_t (cairo_matrix_t *);
+/* cairo_matrix */
+#ifdef ARCH_ALIGN_DOUBLE
+void	ml_convert_cairo_matrix_in	(value, cairo_matrix_t *);
+value	ml_convert_cairo_matrix_out	(cairo_matrix_t *);
+#else
+# define cairo_matrix_t_val(v)	(cairo_matrix_t *)(v)
+# define cairo_matrix_alloc()	caml_alloc_small (6 * Double_wosize, Double_array_tag)
+# define cairo_copy_matrix(dst, src)	memcpy (Bp_val(dst), Bp_val(src), 6 * Double_wosize * sizeof (value))
+#endif
+
+value	ml_cairo_point	(double, double);
+
+cairo_glyph_t *	ml_convert_cairo_glypth_in	 (value v, int *);
+value	Val_cairo_font_extents	(cairo_font_extents_t *);
+value	Val_cairo_text_extents	(cairo_text_extents_t *);
+
+/* cairo_status */
+void ml_cairo_treat_status (cairo_status_t) Noreturn;
+#define cairo_treat_status(s)   if (s != CAIRO_STATUS_SUCCESS) ml_cairo_treat_status (s)
+#define check_cairo_status(cr)	cairo_treat_status (cairo_status (cairo_t_val (cr)))
+#define report_null_pointer()	ml_cairo_treat_status (CAIRO_STATUS_NULL_POINTER)
+
+/* stream callbacks */
+value	       *ml_cairo_make_closure	(value);
+value	       *ml_cairo_make_root	(value);
+cairo_status_t	ml_cairo_write_func	(void *, const unsigned char *, unsigned int);
+cairo_status_t	ml_cairo_read_func	(void *, unsigned char *, unsigned int);
+
+void		ml_cairo_surface_set_user_data	(cairo_surface_t *, const cairo_user_data_key_t *, value *);

Index: ml_cairo.c
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/ml_cairo.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- ml_cairo.c	9 Mar 2005 00:40:22 -0000	1.20
+++ ml_cairo.c	22 May 2005 20:03:15 -0000	1.21
@@ -6,269 +6,50 @@
 /*  GNU Lesser General Public License version 2.1 (the "LGPL").           */
 /**************************************************************************/
 
-#include <caml/mlvalues.h>
-#include <caml/alloc.h>
-#include <caml/memory.h>
-#include <caml/fail.h>
-#include <caml/custom.h>
-
-#include "ml_cairo_wrappers.h"
-
[...1326 lines suppressed...]
-{
-  cairo_set_target_surface (cairo_t_val (cr), NULL);
-  return Val_unit;
-}
 
-CAMLprim value
-ml_cairo_surface_finalise (value s)
-{
-  cairo_surface_t *surf = cairo_surface_t_val (s);
-  cairo_surface_destroy (surf);
-  Store_pointer (s, NULL);
-  return Val_unit;
-}
+
+wML_3(cairo_image_surface_create, cairo_format_t_val, Int_val, Int_val, Val_cairo_surface_t)
+
+/* image_surface_create_for_data */
+
+wML_1 (cairo_image_surface_get_width, cairo_surface_t_val, Val_int)
+wML_1 (cairo_image_surface_get_height, cairo_surface_t_val, Val_int)

--- NEW FILE: cairo_ps.mli ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: cairo_ps.ml ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: cairo_png.mli ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: cairo_png.ml ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: cairo_pdf.mli ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: cairo_pdf.ml ---
(This appears to be a binary file; contents omitted.)

Index: cairo_lablgtk.mli
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/cairo_lablgtk.mli,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- cairo_lablgtk.mli	2 Mar 2005 18:52:29 -0000	1.4
+++ cairo_lablgtk.mli	22 May 2005 20:03:15 -0000	1.5
@@ -6,16 +6,12 @@
 (*  GNU Lesser General Public License version 2.1 (the "LGPL").           *)
 (**************************************************************************)
 
-(** Support for the X11 backend, via LablGTK *)
+(** Xlib backend, via LablGTK *)
 
-external image_of_pixbuf : GdkPixbuf.pixbuf -> Cairo.image = "cairo_lablgtk_of_pixbuf"
-external shuffle_pixels  : GdkPixbuf.pixbuf -> unit = "cairo_lablgtk_shuffle_pixels"
+type surface = [`Any|`Xlib] Cairo.surface
 
-external surface_create_for_drawable : 
-    [> `drawable] Gobject.obj ->
-    Cairo.format -> Cairo.surface = "cairo_lablgtk_surface_create_for_drawable"
-external set_target_drawable :
-    Cairo.t -> [> `drawable] Gobject.obj -> unit 
-      = "cairo_lablgtk_set_target_drawable"
+external image_of_pixbuf : GdkPixbuf.pixbuf -> Cairo.image_surface = "ml_cairo_lablgtk_of_pixbuf"
+external shuffle_pixels  : GdkPixbuf.pixbuf -> unit = "ml_cairo_lablgtk_shuffle_pixels"
 
-val create : ?target:[> `drawable] Gobject.obj -> unit -> Cairo.t
+external surface_create : [> `drawable] Gobject.obj -> surface = "ml_cairo_xlib_surface_create"
+external surface_set_size : [> `Xlib] Cairo.surface -> int -> int -> unit = "ml_cairo_xlib_surface_set_size"

Index: cairo_lablgtk.ml
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/cairo_lablgtk.ml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- cairo_lablgtk.ml	2 Mar 2005 18:52:29 -0000	1.2
+++ cairo_lablgtk.ml	22 May 2005 20:03:15 -0000	1.3
@@ -6,19 +6,10 @@
 (*  GNU Lesser General Public License version 2.1 (the "LGPL").           *)
 (**************************************************************************)
 
-external image_of_pixbuf : GdkPixbuf.pixbuf -> Cairo.image = "cairo_lablgtk_of_pixbuf"
-external shuffle_pixels  : GdkPixbuf.pixbuf -> unit = "cairo_lablgtk_shuffle_pixels"
+type surface = [`Any|`Xlib] Cairo.surface
 
-external surface_create_for_drawable : 
-    [> `drawable] Gobject.obj ->
-    Cairo.format -> Cairo.surface = "cairo_lablgtk_surface_create_for_drawable"
-external set_target_drawable :
-    Cairo.t -> [> `drawable] Gobject.obj -> unit 
-      = "cairo_lablgtk_set_target_drawable"
+external image_of_pixbuf : GdkPixbuf.pixbuf -> Cairo.image_surface = "ml_cairo_lablgtk_of_pixbuf"
+external shuffle_pixels  : GdkPixbuf.pixbuf -> unit = "ml_cairo_lablgtk_shuffle_pixels"
 
-let create ?target () =
-  let c = Cairo.create () in
-  begin match target with
-  | None -> ()
-  | Some d -> set_target_drawable c d end ;
-  c
+external surface_create : [> `drawable] Gobject.obj -> surface = "ml_cairo_xlib_surface_create"
+external surface_set_size : [> `Xlib] Cairo.surface -> int -> int -> unit = "ml_cairo_xlib_surface_set_size"

--- cairo_channel.mli DELETED ---

--- cairo_channel.ml DELETED ---

Index: cairo_bigarray.mli
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/cairo_bigarray.mli,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- cairo_bigarray.mli	2 Mar 2005 18:52:29 -0000	1.3
+++ cairo_bigarray.mli	22 May 2005 20:03:15 -0000	1.4
@@ -6,18 +6,17 @@
 (*  GNU Lesser General Public License version 2.1 (the "LGPL").           *)
 (**************************************************************************)
 
-(** Support for the in-memory image backend, via Bigarray *)
+(** image backend, via Bigarray *)
 
 open Bigarray
 
 val of_bigarr :
   ('a, 'b, c_layout) Array2.t -> Cairo.format -> 
-  width:int -> height:int -> stride:int -> Cairo.image
+  width:int -> height:int -> stride:int -> Cairo.image_surface
 
-val of_bigarr_32 : alpha:bool -> (int32, int32_elt, c_layout) Array2.t -> Cairo.image
-val of_bigarr_24 : (int, int_elt, c_layout) Array2.t -> Cairo.image
-val of_bigarr_8  : (int, int8_unsigned_elt, c_layout) Array2.t -> Cairo.image
-val of_bigarr_1  : (int, int8_unsigned_elt, c_layout) Array2.t -> Cairo.image
+val of_bigarr_32 : alpha:bool -> (int32, int32_elt, c_layout) Array2.t -> Cairo.image_surface
+val of_bigarr_24 : (int, int_elt, c_layout) Array2.t -> Cairo.image_surface
+val of_bigarr_8  : (int, int8_unsigned_elt, c_layout) Array2.t -> Cairo.image_surface
 
 val write_ppm_int32 : out_channel -> (int32, int32_elt, c_layout) Array2.t -> unit
 val write_ppm_int   : out_channel -> (int,   int_elt,   c_layout) Array2.t -> unit

Index: cairo_bigarray.ml
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/cairo_bigarray.ml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- cairo_bigarray.ml	2 Mar 2005 18:52:29 -0000	1.3
+++ cairo_bigarray.ml	22 May 2005 20:03:15 -0000	1.4
@@ -6,73 +6,49 @@
 (*  GNU Lesser General Public License version 2.1 (the "LGPL").           *)
 (**************************************************************************)
 
-type image = {
-    data   : Obj.t ;
-    format : Cairo.format ;
-    width  : int ;
-    height : int ;
-    stride : int ;
-  }
-
-external conv : image -> Cairo.image = "%identity"
-
 open Bigarray
 
 external bigarray_kind_float : ('a, 'b, c_layout) Array2.t -> bool
-  = "bigarray_kind_float"
+  = "ml_bigarray_kind_float"
 external bigarray_byte_size  : ('a, 'b, c_layout) Array2.t -> int
   = "ml_bigarray_byte_size"
 
-external bigarray_data : ('a, 'b, c_layout) Array2.t -> Obj.t = "%field1"
+
+external image_surface_create : 
+  ('a, 'b, c_layout) Array2.t ->
+  Cairo.format -> width:int -> height:int -> stride:int ->
+  Cairo.image_surface = "ml_cairo_image_surface_create_for_data"
+
 
 let of_bigarr arr format ~width ~height ~stride =
   if bigarray_kind_float arr
   then invalid_arg "wrong Bigarray kind" ;
   if bigarray_byte_size arr < stride * height
   then invalid_arg "Bigarray too small" ;
-  conv { data = bigarray_data arr ;
-	 format = format ;
-	 width = width ;
-	 height = height ;
-	 stride = stride }
+  image_surface_create arr format width height stride
 
 let of_bigarr_32 ~alpha (arr : (int32, int32_elt, c_layout) Array2.t) =
+  let h = Array2.dim1 arr in
   let w = Array2.dim2 arr in
-  conv { data = bigarray_data arr ;
-	 format = if alpha then Cairo.FORMAT_ARGB32 else Cairo.FORMAT_RGB24 ;
-	 width  = w ;
-	 height = Array2.dim1 arr ;
-	 stride = 4 * w ;
-       }
+  of_bigarr arr 
+    (if alpha then Cairo.FORMAT_ARGB32 else Cairo.FORMAT_RGB24)
+    w h (4 * w)
 
 let of_bigarr_24 (arr : (int, int_elt, c_layout) Array2.t) =
   if Sys.word_size <> 32
   then failwith "your ints have 63 bits" ;
+  let h = Array2.dim1 arr in
   let w = Array2.dim2 arr in
-  conv { data = bigarray_data arr ;
-	 format = Cairo.FORMAT_RGB24 ;
-	 width  = w ;
-	 height = Array2.dim1 arr ;
-	 stride = 4 * w ;
-       }
+  of_bigarr arr
+    Cairo.FORMAT_RGB24
+    w h (4 * w)
 
 let of_bigarr_8 (arr : (int, int8_unsigned_elt, c_layout) Array2.t) =
+  let h = Array2.dim1 arr in
   let w = Array2.dim2 arr in
-  conv { data = bigarray_data arr ;
-	 format = Cairo.FORMAT_A8 ;
-	 width  = w ;
-	 height = Array2.dim1 arr ;
-	 stride = w ;
-       }
-
-let of_bigarr_1 (arr : (int, int8_unsigned_elt, c_layout) Array2.t) =
-  let w = Array2.dim2 arr in
-  conv { data = bigarray_data arr ;
-	 format = Cairo.FORMAT_A1 ;
-	 width  = w * 8 ;
-	 height = Array2.dim1 arr ;
-	 stride = w ;
-       }
+  of_bigarr arr
+    Cairo.FORMAT_A8
+    w h w
 
 let output_pixel oc p =
   let r = (p lsr 16) land 0xff in

Index: cairo.mli
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/cairo.mli,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- cairo.mli	9 Mar 2005 00:40:22 -0000	1.15
+++ cairo.mli	22 May 2005 20:03:15 -0000	1.16
@@ -18,190 +18,143 @@
   | INVALID_MATRIX
   | NO_TARGET_SURFACE
   | NULL_POINTER
+  | INVALID_STRING
+  | INVALID_PATH_DATA
+  | READ_ERROR
+  | WRITE_ERROR
+  | SURFACE_FINISHED
+  | SURFACE_TYPE_MISMATCH
+  | BAD_NESTING
 exception Error of status
 val init : unit
 
 (** {3 Types} *)
 
-type point = { mutable x : float ; mutable y : float }
-
 type t
-type surface
-type matrix
-type pattern
-type image
+type -'a surface
+type -'a pattern
+type font_face
 
-type format = 
-  | FORMAT_ARGB32 
-  | FORMAT_RGB24 
-  | FORMAT_A8 
-  | FORMAT_A1
+type point = { x : float ; y : float }
+type matrix = {
+    xx : float ; yx : float ;
+    xy : float ; yy : float ;
+    x0 : float ; y0 : float 
+  }
 
 (** {3 Core API} *)
 
-val create : unit -> t
-external save    : cr:t -> unit = "ml_cairo_save"
-external restore : cr:t -> unit = "ml_cairo_restore"
-external _copy    : dest:t -> src:t -> unit = "ml_cairo_copy"
-val copy : t -> t
+val create : 'a surface -> t
+external save    : t -> unit = "ml_cairo_save"
+external restore : t -> unit = "ml_cairo_restore"
 
 external status : t -> status option = "ml_cairo_status"
 external status_string : t -> string = "ml_cairo_status_string"
 
-external suspend_exn : t -> unit = "ml_cairo_suspend_exn"
-(** The functions operating on cairo values normally raise an [Error] exception 
-    immediately if the operation fails. Calling [suspend_exn] will prevent this 
-    automatic exception-raising. *)
-external resume_exn  : t -> unit = "ml_cairo_resume_exn"
-(** Switch back to exception-raising mode. If the cairo object has an error status, 
-    an exception is raised right away. *)
-external get_suspend_exn : t -> bool = "ml_cairo_get_suspend_exn"
-(** Check the current exception-raising mode. *)
-
-(** {4 Target functions} *)
-
-external set_target_surface : cr:t -> surface:surface -> unit = "ml_cairo_set_target_surface"
-external set_target_image   : cr:t -> image -> unit = "ml_cairo_set_target_image"
-external set_target_ps :
-  cr:t ->
-  file:Cairo_channel.t ->
-  width_inches:float ->
-  height_inches:float ->
-  x_pixels_per_inch:float -> y_pixels_per_inch:float -> unit
-  = "ml_cairo_set_target_ps_bc" "ml_cairo_set_target_ps"
-external set_target_pdf :
-  cr:t ->
-  file:Cairo_channel.t ->
-  width_inches:float ->
-  height_inches:float ->
-  x_pixels_per_inch:float -> y_pixels_per_inch:float -> unit
-  = "ml_cairo_set_target_pdf_bc" "ml_cairo_set_target_pdf"
-external set_target_png :
-  cr:t -> file:Cairo_channel.t -> format -> width:int -> height:int -> unit = "ml_cairo_set_target_png"
-external finalise_target : cr:t -> unit = "ml_cairo_finalise_target"
-
 (** {4 Renderer state} *)
 
 type operator =
     OPERATOR_CLEAR
-  | OPERATOR_SRC
-  | OPERATOR_DST
+
+  | OPERATOR_SOURCE
   | OPERATOR_OVER
-  | OPERATOR_OVER_REVERSE
   | OPERATOR_IN
-  | OPERATOR_IN_REVERSE
   | OPERATOR_OUT
-  | OPERATOR_OUT_REVERSE
   | OPERATOR_ATOP
-  | OPERATOR_ATOP_REVERSE
+
+  | OPERATOR_DEST
+  | OPERATOR_DEST_OVER
+  | OPERATOR_DEST_IN
+  | OPERATOR_DEST_OUT
+  | OPERATOR_DEST_ATOP
+
   | OPERATOR_XOR
   | OPERATOR_ADD
   | OPERATOR_SATURATE
 
-external set_operator : cr:t -> op:operator -> unit = "ml_cairo_set_operator"
-external set_rgb_color :
-  cr:t -> red:float -> green:float -> blue:float -> unit
-  = "ml_cairo_set_rgb_color"
-external set_pattern : cr:t -> pattern:pattern -> unit
-  = "ml_cairo_set_pattern"
-external set_alpha : cr:t -> alpha:float -> unit = "ml_cairo_set_alpha"
-external set_tolerance : cr:t -> tolerance:float -> unit
-  = "ml_cairo_set_tolerance"
-type fill_rule = FILL_RULE_WINDING | FILL_RULE_EVEN_ODD
-external set_fill_rule : cr:t -> fill_rule:fill_rule -> unit
-  = "ml_cairo_set_fill_rule"
-external set_line_width : cr:t -> width:float -> unit
-  = "ml_cairo_set_line_width"
-type line_cap = LINE_CAP_BUTT | LINE_CAP_ROUND | LINE_CAP_SQUARE
-external set_line_cap : cr:t -> line_cap:line_cap -> unit
-  = "ml_cairo_set_line_cap"
-type line_join = LINE_JOIN_MITER | LINE_JOIN_ROUND | LINE_JOIN_BEVEL
-external set_line_join : cr:t -> line_join:line_join -> unit
-  = "ml_cairo_set_line_join"
-external set_dash : cr:t -> dashes:float array -> offset:float -> unit
-  = "ml_cairo_set_dash"
-external set_miter_limit : cr:t -> limit:float -> unit
-  = "ml_cairo_set_miter_limit"
+external set_operator : t -> operator -> unit = "ml_cairo_set_operator"
+
+external set_source_rgb  : t -> red:float -> green:float -> blue:float -> unit = "ml_cairo_set_source_rgb"
+external set_source_rgba : t -> red:float -> green:float -> blue:float -> alpha:float ->unit = "ml_cairo_set_source_rgba"
+external set_source : t -> 'a pattern -> unit = "ml_cairo_set_source"
+external set_source_surface : t -> 'a surface -> float -> float -> unit = "ml_cairo_set_source_surface"
+
+external set_tolerance : t -> float -> unit = "ml_cairo_set_tolerance"
+
+type fill_rule =
+    FILL_RULE_WINDING
+  | FILL_RULE_EVEN_ODD
+external set_fill_rule : t -> fill_rule -> unit = "ml_cairo_set_fill_rule"
+external set_line_width : t -> float -> unit = "ml_cairo_set_line_width"
+type line_cap =
+    LINE_CAP_BUTT
+  | LINE_CAP_ROUND
+  | LINE_CAP_SQUARE
+external set_line_cap : t -> line_cap -> unit = "ml_cairo_set_line_cap"
+type line_join =
+    LINE_JOIN_MITER
+  | LINE_JOIN_ROUND
+  | LINE_JOIN_BEVEL
+external set_line_join : t -> line_join -> unit = "ml_cairo_set_line_join"
+external set_dash : t -> float array -> float -> unit = "ml_cairo_set_dash"
+external set_miter_limit : t -> float -> unit = "ml_cairo_set_miter_limit"
 
 (** {4 Transformations} *)
 
-external translate : cr:t -> tx:float -> ty:float -> unit
-  = "ml_cairo_translate"
-external scale : cr:t -> sx:float -> sy:float -> unit = "ml_cairo_scale"
-external rotate : cr:t -> angle:float -> unit = "ml_cairo_rotate"
-external concat_matrix : cr:t -> matrix:matrix -> unit
-  = "ml_cairo_concat_matrix"
-external set_matrix : cr:t -> matrix:matrix -> unit = "ml_cairo_set_matrix"
-external default_matrix : cr:t -> unit = "ml_cairo_default_matrix"
-external identity_matrix : cr:t -> unit = "ml_cairo_identity_matrix"
+external translate : t -> tx:float -> ty:float -> unit = "ml_cairo_translate"
+external scale : t -> sx:float -> sy:float -> unit = "ml_cairo_scale"
+external rotate : t -> angle:float -> unit = "ml_cairo_rotate"
+external transform : t -> matrix -> unit = "ml_cairo_trasnform"
+external set_matrix : t -> matrix -> unit = "ml_cairo_set_matrix"
+external identity_matrix : t -> unit = "ml_cairo_identity_matrix"
 
-external transform_point : cr:t -> point -> unit
-  = "ml_cairo_transform_point"
-external transform_distance : cr:t -> point -> unit
-  = "ml_cairo_transform_distance"
-external inverse_transform_point : cr:t -> point -> unit
-  = "ml_cairo_inverse_transform_point"
-external inverse_transform_distance : cr:t -> point -> unit
-  = "ml_cairo_inverse_transform_distance"
+external user_to_device : t -> point -> point = "ml_cairo_user_to_device"
+external user_to_device_distance : t -> point -> point = "ml_cairo_user_to_device_distance"
+external device_to_user : t -> point -> point = "ml_cairo_device_to_user"
+external device_to_user_distance : t -> point -> point = "ml_cairo_device_to_user_distance"
 
 (** {4 Paths} *)
 
-external new_path : cr:t -> unit = "ml_cairo_new_path"
-external move_to : cr:t -> x:float -> y:float -> unit = "ml_cairo_move_to"
-val move_to_point : cr:t -> point -> unit
-external line_to : cr:t -> x:float -> y:float -> unit = "ml_cairo_line_to"
-val line_to_point : cr:t -> point -> unit
-external curve_to :
-  cr:t ->
-  x1:float ->
-  y1:float -> x2:float -> y2:float -> x3:float -> y3:float -> unit
-  = "ml_cairo_curve_to_bc" "ml_cairo_curve_to"
-val curve_to_point : cr:t -> point -> point -> point -> unit
-external arc :
-  cr:t ->
-  xc:float ->
-  yc:float -> radius:float -> angle1:float -> angle2:float -> unit
-  = "ml_cairo_arc_bc" "ml_cairo_arc"
-external arc_negative :
-  cr:t ->
-  xc:float ->
-  yc:float -> radius:float -> angle1:float -> angle2:float -> unit
-  = "ml_cairo_arc_negative_bc" "ml_cairo_arc_negative"
-external rel_move_to : cr:t -> dx:float -> dy:float -> unit
-  = "ml_cairo_rel_move_to"
-external rel_line_to : cr:t -> dx:float -> dy:float -> unit
-  = "ml_cairo_rel_line_to"
-external rel_curve_to :
-  cr:t ->
-  dx1:float ->
-  dy1:float -> dx2:float -> dy2:float -> dx3:float -> dy3:float -> unit
-  = "ml_cairo_rel_curve_to_bc" "ml_cairo_rel_curve_to"
-external rectangle :
-  cr:t -> x:float -> y:float -> width:float -> height:float -> unit
-  = "ml_cairo_rectangle"
-external close_path : cr:t -> unit = "ml_cairo_close_path"
-external stroke : cr:t -> unit = "ml_cairo_stroke"
-external fill : cr:t -> unit = "ml_cairo_fill"
+external new_path : t -> unit = "ml_cairo_new_path"
+external move_to : t -> x:float -> y:float -> unit = "ml_cairo_move_to"
+val move_to_point : t -> point -> unit
+external line_to : t -> x:float -> y:float -> unit = "ml_cairo_line_to"
+val line_to_point : t -> point -> unit
+external curve_to : t -> x1:float -> y1:float -> x2:float -> y2:float -> x3:float -> y3:float -> unit = "ml_cairo_curve_to_bc" "ml_cairo_curve_to"
+val curve_to_point : t -> point -> point -> point -> unit
+external arc : t -> xc:float -> yc:float -> radius:float -> angle1:float -> angle2:float -> unit = "ml_cairo_arc_bc" "ml_cairo_arc"
+external arc_negative : t -> xc:float -> yc:float -> radius:float -> angle1:float -> angle2:float -> unit = "ml_cairo_arc_negative_bc" "ml_cairo_arc_negative"
+external rel_move_to : t -> dx:float -> dy:float -> unit = "ml_cairo_rel_move_to"
+external rel_line_to : t -> dx:float -> dy:float -> unit = "ml_cairo_rel_line_to"
+external rel_curve_to : t -> dx1:float -> dy1:float -> dx2:float -> dy2:float -> dx3:float -> dy3:float -> unit = "ml_cairo_rel_curve_to_bc" "ml_cairo_rel_curve_to"
+external rectangle : t -> x:float -> y:float -> width:float -> height:float -> unit = "ml_cairo_rectangle"
+external close_path : t -> unit = "ml_cairo_close_path"
 
-external in_stroke : cr:t -> x:float -> y:float -> bool = "ml_cairo_in_stroke"
-external in_fill : cr:t -> x:float -> y:float -> bool = "ml_cairo_in_fill"
+external paint : t -> unit = "ml_cairo_paint"
+external paint_with_alpha : t -> float -> unit = "ml_cairo_paint_with_alpha"
 
-external stroke_extents : cr:t -> float * float * float * float = "ml_cairo_stroke_extents"
-external fill_extents : cr:t -> float * float * float * float = "ml_cairo_fill_extents"
+external mask : t -> 'a pattern -> unit = "ml_cairo_mask"
+external mask_surface : t -> 'a surface -> surface_x:float -> surface_y:float -> unit = "ml_cairo_mask_surface"
 
-(** {3 Misc stuff I don't know how to categorize} *)
+external stroke : t -> unit = "ml_cairo_stroke"
+external stroke_preserve : t -> unit = "ml_cairo_stroke_preserve"
+external fill : t -> unit = "ml_cairo_fill"
+external fill_preserve : t -> unit = "ml_cairo_fill_preserve"
+external copy_page : t -> unit = "ml_cairo_copy_page"
+external show_page : t -> unit = "ml_cairo_show_page"
 
-external show_surface :
-  cr:t -> surface:surface -> width:int -> height:int -> unit
-  = "ml_cairo_show_surface"
-external copy_page : cr:t -> unit = "ml_cairo_copy_page"
-external show_page : cr:t -> unit = "ml_cairo_show_page"
-external init_clip : cr:t -> unit = "ml_cairo_init_clip"
-external clip : cr:t -> unit = "ml_cairo_clip"
+external in_stroke : t -> point -> bool = "ml_cairo_in_stroke"
+external in_fill : t -> point -> bool = "ml_cairo_in_fill"
+
+external stroke_extents : t -> float * float * float * float = "ml_cairo_stroke_extents"
+external fill_extents : t -> float * float * float * float = "ml_cairo_fill_extents"
+
+external clip : t -> unit = "ml_cairo_clip"
+external clip_preserve : t -> unit = "ml_cairo_clip_preserve"
+external reset_clip : t -> unit = "ml_cairo_reset_clip"
 
 (** {3 Text API} *)
 
-type font
 type glyph = { index : int; glyph_x : float; glyph_y : float; }
 type text_extents = { 
     x_bearing   : float ;
@@ -225,173 +178,131 @@
   | FONT_SLANT_ITALIC 
   | FONT_SLANT_OBLIQUE
 
-external select_font :
-  cr:t -> family:string -> slant:font_slant -> weight:font_weight -> unit
-  = "ml_cairo_select_font"
-external scale_font : cr:t -> scale:float -> unit = "ml_cairo_scale_font"
-external transform_font : cr:t -> matrix:matrix -> unit
-  = "ml_cairo_transform_font"
-external show_text : cr:t -> utf8:string -> unit = "ml_cairo_show_text"
-external show_glyphs : cr:t -> glyph array -> unit
-  = "ml_cairo_show_glyphs"
-external current_font : cr:t -> font = "ml_cairo_current_font"
-external current_font_extents : cr:t -> font_extents
-  = "ml_cairo_current_font_extents"
-external set_font : cr:t -> font:font -> unit = "ml_cairo_set_font"
-external text_extents : t -> utf8:string -> text_extents = "ml_cairo_text_extents"
+external select_font_face : t -> string -> font_slant -> font_weight -> unit = "ml_cairo_select_font_face"
+external set_font_size : t -> float -> unit = "ml_cairo_set_font_size"
+external set_font_matrix : t -> matrix -> unit = "ml_cairo_set_font_matrix"
+external get_font_matrix : t -> matrix = "ml_cairo_get_font_matrix"
+external show_text : t -> string -> unit = "ml_cairo_show_text"
+external show_glyphs : t -> glyph array -> unit = "ml_cairo_show_glyphs"
+external get_font_face : t -> font_face = "ml_cairo_get_font_face"
+external font_extents : t -> font_extents = "ml_cairo_font_extents"
+external set_font_face : t -> font_face -> unit = "ml_cairo_set_font_face"
+external text_extents : t -> string -> text_extents = "ml_cairo_text_extents"
 external glyph_extents : t -> glyph array -> text_extents = "ml_cairo_glyph_extents"
-external text_path : t -> utf8:string -> unit = "ml_cairo_text_path"
+external text_path : t -> string -> unit = "ml_cairo_text_path"
 external glyph_path : t -> glyph array -> unit = "ml_cairo_glyph_path"
 
 (** {4 Renderer state querying} *)
 
-external current_operator : cr:t -> operator = "ml_cairo_current_operator"
-external current_rgb_color : cr:t -> float * float * float
-  = "ml_cairo_current_rgb_color"
-external current_pattern : cr:t -> pattern = "ml_cairo_current_pattern"
-external current_alpha : cr:t -> float = "ml_cairo_current_alpha"
-external current_tolerance : cr:t -> float = "ml_cairo_current_tolerance"
-external current_point : cr:t -> point = "ml_cairo_current_point"
-external current_fill_rule : cr:t -> fill_rule = "ml_cairo_current_fill_rule"
-external current_line_width : cr:t -> float = "ml_cairo_current_line_width"
-external current_line_cap : cr:t -> line_cap = "ml_cairo_current_line_cap"
-external current_line_join : cr:t -> line_join = "ml_cairo_current_line_join"
-external current_miter_limit : cr:t -> float = "ml_cairo_current_miter_limit"
-external current_matrix : cr:t -> matrix:matrix -> unit
-  = "ml_cairo_current_matrix"
-external current_target_surface : cr:t -> surface
-  = "ml_cairo_current_target_surface"
+external get_operator : t -> operator = "ml_cairo_get_operator"
+external get_source : t -> 'a pattern = "ml_cairo_get_source"
+external get_tolerance : t -> float = "ml_cairo_get_tolerance"
+external get_current_point : t -> point = "ml_cairo_get_current_point"
+external get_fill_rule : t -> fill_rule = "ml_cairo_get_fill_rule"
+external get_line_width : t -> float = "ml_cairo_get_line_width"
+external get_line_cap : t -> line_cap = "ml_cairo_get_line_cap"
+external get_line_join : t -> line_join = "ml_cairo_get_line_join"
+external get_miter_limit : t -> float = "ml_cairo_get_miter_limit"
+external get_matrix : t -> matrix = "ml_cairo_get_matrix"
+external get_target : t -> 'a surface = "ml_cairo_get_target"
 
 type flat_path = [
   | `MOVE_TO of point
   | `LINE_TO of point
   | `CLOSE ]
-type basic_path = [
+type path = [
   | flat_path
   | `CURVE_TO of point * point * point ]
-external fold_current_path      : t -> ('a -> [> basic_path] -> 'a) -> 'a -> 'a = "ml_cairo_current_path"
-external fold_current_path_flat : t -> ('a -> [> flat_path] -> 'a) -> 'a -> 'a  = "ml_cairo_current_path_flat"
+external fold_path      : t -> ('a -> [> path] -> 'a) -> 'a -> 'a = "ml_cairo_copy_path"
+external fold_path_flat : t -> ('a -> [> flat_path] -> 'a) -> 'a -> 'a  = "ml_cairo_copy_path_flat"
+
+val append_path : t -> [< path] -> unit
 
 (** {3 Surface API} *)
 
-external surface_create_for_image : image -> surface
-  = "ml_cairo_surface_create_for_image"
-external surface_create_similar :
-  other:surface -> format:format -> width:int -> height:int -> surface
-  = "ml_cairo_surface_create_similar"
-external surface_set_repeat : surface:surface -> repeat:bool -> unit
-  = "ml_cairo_surface_set_repeat"
-external surface_set_matrix : surface:surface -> matrix:matrix -> unit
-  = "ml_cairo_surface_set_matrix"
-external surface_get_matrix : surface:surface -> matrix:matrix -> unit
-  = "ml_cairo_surface_get_matrix"
-type filter =
-    FILTER_FAST
-  | FILTER_GOOD
-  | FILTER_BEST
-  | FILTER_NEAREST
-  | FILTER_BILINEAR
-  | FILTER_GAUSSIAN
-external surface_set_filter : surface:surface -> filter:filter -> unit
-  = "ml_cairo_surface_set_filter"
-external surface_get_filter : surface:surface -> filter
-  = "ml_cairo_surface_get_filter"
-external surface_finalise : surface -> unit = "ml_cairo_surface_finalise"
+type format =
+    FORMAT_ARGB32
+  | FORMAT_RGB24
+  | FORMAT_A8
+  | FORMAT_A1
 
-(** {4 Pattern functions} *)
+external surface_create_similar : 'a surface -> format -> width:int -> height:int -> 'a surface = "ml_cairo_surface_create_similar"
 
-external pattern_create_for_surface : surface -> pattern = "ml_cairo_pattern_create_for_surface"
+external surface_finish : 'a surface -> unit = "ml_cairo_surface_finish"
 
-external pattern_create_linear : x0:float -> y0:float -> x1:float -> y1:float -> pattern 
-  = "ml_cairo_pattern_create_linear"
-external pattern_create_radial : 
-  cx0:float -> cy0:float -> radius0:float ->
-  cx1:float -> cy1:float -> radius1:float -> pattern 
-  = "ml_cairo_pattern_create_radial_bc" "ml_cairo_pattern_create_radial"
+external surface_set_device_offset : 'a surface -> float -> float -> unit = "ml_cairo_surface_set_device_offset"
 
-external pattern_add_color_stop : 
-  pattern -> offset:float -> 
-  red:float -> green:float -> blue:float -> alpha:float -> unit 
-  = "ml_cairo_pattern_add_color_stop_bc" "ml_cairo_pattern_add_color_stop"
+(** {4 Image surface} *)
 
-external pattern_set_matrix : pattern -> matrix -> unit = "ml_cairo_pattern_set_matrix"
-external pattern_get_matrix : pattern -> matrix -> unit = "ml_cairo_pattern_get_matrix"
+type image_surface = [`Any|`Image] surface
 
-type extend =
-  | EXTEND_NONE
-  | EXTEND_REPEAT
-  | EXTEND_REFLECT
-external pattern_set_extend : pattern -> extend -> unit = "ml_cairo_pattern_set_extend"
-external pattern_get_extend : pattern -> extend = "ml_cairo_pattern_get_extend"
-external pattern_set_filter : pattern -> filter -> unit = "ml_cairo_pattern_set_filter"
-external pattern_get_filter : pattern -> filter = "ml_cairo_pattern_get_filter"
+external image_surface_create : format -> width:int -> height:int -> image_surface = "ml_cairo_image_surface_create"
+external image_surface_get_width  : [>`Image] surface -> int = "ml_cairo_image_surface_get_width"
+external image_surface_get_height : [>`Image] surface -> int = "ml_cairo_image_surface_get_height"
 
-(** {4 Image surface} *)
+(** {4 Patterns} *)
 
-external image_surface_create :
-  format:format -> width:int -> height:int -> surface
-  = "ml_cairo_image_surface_create"
-external image_surface_create_for_data : image -> surface
-  = "ml_cairo_image_surface_create_for_data"
+type surface_pattern  = [`Any|`Surface] pattern
+type gradient_pattern = [`Any|`Gradient] pattern
 
-(** {4 PS surface} *)
+type extend = 
+    EXTEND_NONE
+  | EXTEND_REPEAT
+  | EXTEND_REFLECT
 
-external ps_surface_create :
-  file:Cairo_channel.t ->
-  width_inches:float ->
-  height_inches:float ->
-  x_pixels_per_inch:float -> y_pixels_per_inch:float -> surface
-  = "ml_cairo_ps_surface_create"
+type filter =
+    FILTER_FAST
+  | FILTER_GOOD
+  | FILTER_BEST
+  | FILTER_NEAREST
+  | FILTER_BILINEAR
+  | FILTER_GAUSSIAN
 
-(** {4 PDF surface} *)
+(** Patterns functions *)
+module Pattern : sig
+external create_for_surface : 'a surface -> surface_pattern = "ml_cairo_pattern_create_for_surface"
+external create_linear : x0:float -> y0:float -> x1:float -> y1:float -> gradient_pattern = "ml_cairo_pattern_create_linear"
+external create_radial : cx0:float -> cy0:float -> radius0:float -> cx1:float -> cy1:float -> radius1:float -> gradient_pattern = "ml_cairo_pattern_create_radial_bc" "ml_cairo_pattern_create_radial"
 
-external pdf_surface_create :
-  file:Cairo_channel.t ->
-  width_inches:float ->
-  height_inches:float ->
-  x_pixels_per_inch:float -> y_pixels_per_inch:float -> surface
-  = "ml_cairo_pdf_surface_create"
+external add_color_stop_rgb  : [>`Gradient] pattern -> off:float -> red:float -> green:float -> blue:float -> unit = "ml_cairo_pattern_add_color_stop_rgb"
+external add_color_stop_rgba : [>`Gradient] pattern -> off:float -> red:float -> green:float -> blue:float -> alpha:float -> unit = "ml_cairo_pattern_add_color_stop_rgba_bc" "ml_cairo_pattern_add_color_stop_rgba"
 
-(** {4 PNG surface} *)
+external set_matrix : 'a pattern -> matrix -> unit = "ml_cairo_pattern_set_matrix"
+external get_matrix : 'a pattern -> matrix = "ml_cairo_pattern_get_matrix"
 
-external png_surface_create :
-  file:Cairo_channel.t -> format -> width:float -> height:float ->
-    surface = "ml_cairo_png_surface_create"
+external set_extend : [> `Surface] pattern -> extend -> unit = "ml_cairo_pattern_set_extend"
+external get_extend : [> `Surface] pattern -> extend = "ml_cairo_pattern_get_extend"
 
+external set_filter : [> `Surface] pattern -> filter -> unit = "ml_cairo_pattern_set_filter"
+external get_filter : [> `Surface] pattern -> filter = "ml_cairo_pattern_get_filter"
+end
 
 (** {3 Matrix API} *)
 
-external matrix_create : unit -> matrix = "ml_cairo_matrix_create"
-external matrix_copy : matrix:matrix -> other:matrix -> unit
-  = "ml_cairo_matrix_copy"
-external matrix_set_identity : matrix:matrix -> unit
-  = "ml_cairo_matrix_set_identity"
-external matrix_set_affine : matrix:matrix -> float array -> unit
-  = "ml_cairo_matrix_set_affine"
-external matrix_get_affine : matrix:matrix -> float array
-  = "ml_cairo_matrix_get_affine"
+(** Matrix functions *)
+module Matrix : sig
+val init_identity : matrix
+val init_translate : float -> float -> matrix
+val init_scale : float -> float -> matrix
+val init_rotate : float -> matrix
 
-external matrix_translate : matrix:matrix -> tx:float -> ty:float -> unit
-  = "ml_cairo_matrix_translate"
-external matrix_scale : matrix:matrix -> sx:float -> sy:float -> unit
-  = "ml_cairo_matrix_scale"
-external matrix_rotate : matrix:matrix -> radians:float -> unit
-  = "ml_cairo_matrix_rotate"
-external matrix_invert : matrix:matrix -> unit = "ml_cairo_matrix_invert"
-external matrix_multiply : result:matrix -> a:matrix -> b:matrix -> unit
-  = "ml_cairo_matrix_multiply"
+external translate : matrix -> float -> float -> matrix = "ml_cairo_matrix_translate"
+external scale     : matrix -> float -> float -> matrix = "ml_cairo_matrix_scale"
+external rotate    : matrix -> float -> matrix = "ml_cairo_matrix_rotate"
+external invert    : matrix -> matrix = "ml_cairo_matrix_invert"
+external multiply  : matrix -> matrix -> matrix = "ml_cairo_matrix_multiply"
 
-external matrix_transform_distance : matrix:matrix -> point -> unit
-  = "ml_cairo_matrix_transform_distance"
-external matrix_transform_point : matrix:matrix -> point -> unit
-  = "ml_cairo_matrix_transform_point"
+external transform_distance : matrix -> point -> point = "ml_cairo_matrix_transform_distance"
+external transform_point    : matrix -> point -> point = "ml_cairo_matrix_transform_point"
+end
 
-(** {3 Font API}
+(** {3 Scaled Fonts API} *)
 
-   Mostly unusable ATM. It needs other libraries (freetype2/fontconfig). 
-*)
+(** Scaled fonts functions *)
+module Scaled_Font : sig
+type t
 
-external font_extents : font -> matrix -> font_extents
-   = "ml_cairo_font_extents"
-external font_glyph_extents : font -> matrix -> glyph array -> text_extents
-   = "ml_cairo_font_glyph_extents"
+external create : font_face -> matrix -> matrix -> t = "ml_cairo_scaled_font_create"
+external font_extents : t -> font_extents = "ml_cairo_scaled_font_extents"
+external glyph_extents : t -> glyph array -> text_extents = "ml_cairo_scaled_font_glyph_extents"
+end

Index: cairo.ml
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/cairo.ml,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- cairo.ml	9 Mar 2005 00:40:22 -0000	1.13
+++ cairo.ml	22 May 2005 20:03:15 -0000	1.14
@@ -14,145 +14,126 @@
   | INVALID_MATRIX
   | NO_TARGET_SURFACE
   | NULL_POINTER
+  | INVALID_STRING
+  | INVALID_PATH_DATA
+  | READ_ERROR
+  | WRITE_ERROR
+  | SURFACE_FINISHED
+  | SURFACE_TYPE_MISMATCH
+  | BAD_NESTING
 exception Error of status
-let init = Callback.register "cairo_status_exn" (Error NULL_POINTER)
-type format =
-    FORMAT_ARGB32
-  | FORMAT_RGB24
-  | FORMAT_A8
-  | FORMAT_A1
-type image =
-  { data : Obj.t; format : format; width : int; height : int; stride : int }
-type point = { mutable x : float ; mutable y : float }
+let init = Callback.register_exception "cairo_status_exn" (Error NULL_POINTER)
+
 type t
-type surface
-type matrix
-type pattern
-external create : unit -> t = "ml_cairo_create"
-external save : cr:t -> unit = "ml_cairo_save"
-external restore : cr:t -> unit = "ml_cairo_restore"
-external _copy : dest:t -> src:t -> unit = "ml_cairo_copy"
-let copy src = let dest = create () in _copy ~dest ~src ; dest
-external set_target_surface :
-  cr:t -> surface:surface -> unit = "ml_cairo_set_target_surface"
-external set_target_image :
-  cr:t -> image -> unit = "ml_cairo_set_target_image"
-external set_target_ps :
-  cr:t -> file:Cairo_channel.t -> width_inches:float -> height_inches:float ->
-    x_pixels_per_inch:float -> y_pixels_per_inch:float ->
-    unit = "ml_cairo_set_target_ps_bc" "ml_cairo_set_target_ps"
-external set_target_pdf :
-  cr:t -> file:Cairo_channel.t -> width_inches:float -> height_inches:float ->
-    x_pixels_per_inch:float -> y_pixels_per_inch:float ->
-    unit = "ml_cairo_set_target_pdf_bc" "ml_cairo_set_target_pdf"
-external set_target_png :
-  cr:t -> file:Cairo_channel.t -> format -> width:int -> height:int -> unit = "ml_cairo_set_target_png"
+type -'a surface
+type -'a pattern
+type font_face
 
-external suspend_exn : t -> unit = "ml_cairo_suspend_exn"
-external resume_exn  : t -> unit = "ml_cairo_resume_exn"
-external get_suspend_exn : t -> bool = "ml_cairo_get_suspend_exn"
+type point = { x : float ; y : float }
+type matrix = {
+    xx : float ; yx : float ;
+    xy : float ; yy : float ;
+    x0 : float ; y0 : float 
+  }
+
+external create : 'a surface -> t = "ml_cairo_create"
+external save : t -> unit = "ml_cairo_save"
+external restore : t -> unit = "ml_cairo_restore"
 
 type operator =
     OPERATOR_CLEAR
-  | OPERATOR_SRC
-  | OPERATOR_DST
+
+  | OPERATOR_SOURCE
   | OPERATOR_OVER
-  | OPERATOR_OVER_REVERSE
   | OPERATOR_IN
-  | OPERATOR_IN_REVERSE
   | OPERATOR_OUT
-  | OPERATOR_OUT_REVERSE
   | OPERATOR_ATOP
-  | OPERATOR_ATOP_REVERSE
+
+  | OPERATOR_DEST
+  | OPERATOR_DEST_OVER
+  | OPERATOR_DEST_IN
+  | OPERATOR_DEST_OUT
+  | OPERATOR_DEST_ATOP
+
   | OPERATOR_XOR
   | OPERATOR_ADD
   | OPERATOR_SATURATE
-external set_operator : cr:t -> op:operator -> unit = "ml_cairo_set_operator"
-external set_rgb_color :
-  cr:t -> red:float -> green:float -> blue:float ->
-    unit = "ml_cairo_set_rgb_color"
-external set_pattern :
-  cr:t -> pattern:pattern -> unit = "ml_cairo_set_pattern"
-external set_alpha : cr:t -> alpha:float -> unit = "ml_cairo_set_alpha"
-external set_tolerance :
-  cr:t -> tolerance:float -> unit = "ml_cairo_set_tolerance"
+
+external set_operator : t -> operator -> unit = "ml_cairo_set_operator"
+
+external set_source_rgb  : t -> red:float -> green:float -> blue:float -> unit = "ml_cairo_set_source_rgb"
+external set_source_rgba : t -> red:float -> green:float -> blue:float -> alpha:float ->unit = "ml_cairo_set_source_rgba"
+external set_source : t -> 'a pattern -> unit = "ml_cairo_set_source"
+external set_source_surface : t -> 'a surface -> float -> float -> unit = "ml_cairo_set_source_surface"
+
+external set_tolerance : t -> float -> unit = "ml_cairo_set_tolerance"
+
 type fill_rule =
     FILL_RULE_WINDING
   | FILL_RULE_EVEN_ODD
-external set_fill_rule :
-  cr:t -> fill_rule:fill_rule -> unit = "ml_cairo_set_fill_rule"
-external set_line_width :
-  cr:t -> width:float -> unit = "ml_cairo_set_line_width"
+external set_fill_rule : t -> fill_rule -> unit = "ml_cairo_set_fill_rule"
+external set_line_width : t -> float -> unit = "ml_cairo_set_line_width"
 type line_cap =
     LINE_CAP_BUTT
   | LINE_CAP_ROUND
   | LINE_CAP_SQUARE
-external set_line_cap :
-  cr:t -> line_cap:line_cap -> unit = "ml_cairo_set_line_cap"
+external set_line_cap : t -> line_cap -> unit = "ml_cairo_set_line_cap"
 type line_join =
     LINE_JOIN_MITER
   | LINE_JOIN_ROUND
   | LINE_JOIN_BEVEL
-external set_line_join :
-  cr:t -> line_join:line_join -> unit = "ml_cairo_set_line_join"
-external set_dash :
-  cr:t -> dashes:float array -> offset:float -> unit = "ml_cairo_set_dash"
-external set_miter_limit :
-  cr:t -> limit:float -> unit = "ml_cairo_set_miter_limit"
-external translate :
-  cr:t -> tx:float -> ty:float -> unit = "ml_cairo_translate"
-external scale : cr:t -> sx:float -> sy:float -> unit = "ml_cairo_scale"
-external rotate : cr:t -> angle:float -> unit = "ml_cairo_rotate"
-external concat_matrix :
-  cr:t -> matrix:matrix -> unit = "ml_cairo_concat_matrix"
-external set_matrix : cr:t -> matrix:matrix -> unit = "ml_cairo_set_matrix"
-external default_matrix : cr:t -> unit = "ml_cairo_default_matrix"
-external identity_matrix : cr:t -> unit = "ml_cairo_identity_matrix"
-external transform_point :
-  cr:t -> point -> unit = "ml_cairo_transform_point"
-external transform_distance :
-  cr:t -> point -> unit = "ml_cairo_transform_distance"
-external inverse_transform_point :
-  cr:t -> point -> unit = "ml_cairo_inverse_transform_point"
-external inverse_transform_distance :
-  cr:t -> point -> unit = "ml_cairo_inverse_transform_distance"
-external new_path : cr:t -> unit = "ml_cairo_new_path"
-external move_to : cr:t -> x:float -> y:float -> unit = "ml_cairo_move_to"
-let move_to_point ~cr { x = x ; y = y } = move_to ~cr ~x ~y
-external line_to : cr:t -> x:float -> y:float -> unit = "ml_cairo_line_to"
-let line_to_point ~cr { x = x ; y = y } = line_to ~cr ~x ~y
-external curve_to :
-  cr:t -> x1:float -> y1:float -> x2:float -> y2:float -> x3:float ->
-    y3:float -> unit = "ml_cairo_curve_to_bc" "ml_cairo_curve_to"
-let curve_to_point ~cr {x=x1; y=y1} {x=x2; y=y2} {x=x3; y=y3} = curve_to ~cr ~x1 ~y1 ~x2 ~y2 ~x3 ~y3
-external arc :
-  cr:t -> xc:float -> yc:float -> radius:float -> angle1:float ->
-    angle2:float -> unit = "ml_cairo_arc_bc" "ml_cairo_arc"
-external arc_negative :
-  cr:t -> xc:float -> yc:float -> radius:float -> angle1:float ->
-    angle2:float -> unit = "ml_cairo_arc_negative_bc" "ml_cairo_arc_negative"
-external rel_move_to :
-  cr:t -> dx:float -> dy:float -> unit = "ml_cairo_rel_move_to"
-external rel_line_to :
-  cr:t -> dx:float -> dy:float -> unit = "ml_cairo_rel_line_to"
-external rel_curve_to :
-  cr:t -> dx1:float -> dy1:float -> dx2:float -> dy2:float -> dx3:float ->
-    dy3:float -> unit = "ml_cairo_rel_curve_to_bc" "ml_cairo_rel_curve_to"
-external rectangle :
-  cr:t -> x:float -> y:float -> width:float -> height:float ->
-    unit = "ml_cairo_rectangle"
-external close_path : cr:t -> unit = "ml_cairo_close_path"
-external stroke : cr:t -> unit = "ml_cairo_stroke"
-external fill : cr:t -> unit = "ml_cairo_fill"
-external copy_page : cr:t -> unit = "ml_cairo_copy_page"
-external show_page : cr:t -> unit = "ml_cairo_show_page"
-external in_stroke : cr:t -> x:float -> y:float -> bool = "ml_cairo_in_stroke"
-external in_fill : cr:t -> x:float -> y:float -> bool = "ml_cairo_in_fill"
-external stroke_extents : cr:t -> float * float * float * float = "ml_cairo_stroke_extents"
-external fill_extents : cr:t -> float * float * float * float = "ml_cairo_fill_extents"
-external init_clip : cr:t -> unit = "ml_cairo_init_clip"
-external clip : cr:t -> unit = "ml_cairo_clip"
-type font
+external set_line_join : t -> line_join -> unit = "ml_cairo_set_line_join"
+external set_dash : t -> float array -> float -> unit = "ml_cairo_set_dash"
+external set_miter_limit : t -> float -> unit = "ml_cairo_set_miter_limit"
+external translate : t -> tx:float -> ty:float -> unit = "ml_cairo_translate"
+external scale : t -> sx:float -> sy:float -> unit = "ml_cairo_scale"
+external rotate : t -> angle:float -> unit = "ml_cairo_rotate"
+external transform : t -> matrix -> unit = "ml_cairo_trasnform"
+external set_matrix : t -> matrix -> unit = "ml_cairo_set_matrix"
+external identity_matrix : t -> unit = "ml_cairo_identity_matrix"
+external user_to_device : t -> point -> point = "ml_cairo_user_to_device"
+external user_to_device_distance : t -> point -> point = "ml_cairo_user_to_device_distance"
+external device_to_user : t -> point -> point = "ml_cairo_device_to_user"
+external device_to_user_distance : t -> point -> point = "ml_cairo_device_to_user_distance"
+
+external new_path : t -> unit = "ml_cairo_new_path"
+external move_to : t -> x:float -> y:float -> unit = "ml_cairo_move_to"
+let move_to_point cr { x = x ; y = y } = move_to cr ~x ~y
+external line_to : t -> x:float -> y:float -> unit = "ml_cairo_line_to"
+let line_to_point cr { x = x ; y = y } = line_to cr ~x ~y
+external curve_to : t -> x1:float -> y1:float -> x2:float -> y2:float -> x3:float -> y3:float -> unit = "ml_cairo_curve_to_bc" "ml_cairo_curve_to"
+let curve_to_point cr {x=x1; y=y1} {x=x2; y=y2} {x=x3; y=y3} = curve_to cr ~x1 ~y1 ~x2 ~y2 ~x3 ~y3
+external arc : t -> xc:float -> yc:float -> radius:float -> angle1:float -> angle2:float -> unit = "ml_cairo_arc_bc" "ml_cairo_arc"
+external arc_negative : t -> xc:float -> yc:float -> radius:float -> angle1:float -> angle2:float -> unit = "ml_cairo_arc_negative_bc" "ml_cairo_arc_negative"
+external rel_move_to : t -> dx:float -> dy:float -> unit = "ml_cairo_rel_move_to"
+external rel_line_to : t -> dx:float -> dy:float -> unit = "ml_cairo_rel_line_to"
+external rel_curve_to : t -> dx1:float -> dy1:float -> dx2:float -> dy2:float -> dx3:float -> dy3:float -> unit = "ml_cairo_rel_curve_to_bc" "ml_cairo_rel_curve_to"
+external rectangle : t -> x:float -> y:float -> width:float -> height:float -> unit = "ml_cairo_rectangle"
+external close_path : t -> unit = "ml_cairo_close_path"
+
+external paint : t -> unit = "ml_cairo_paint"
+external paint_with_alpha : t -> float -> unit = "ml_cairo_paint_with_alpha"
+
+external mask : t -> 'a pattern -> unit = "ml_cairo_mask"
+external mask_surface : t -> 'a surface -> surface_x:float -> surface_y:float -> unit = "ml_cairo_mask_surface"
+
+external stroke : t -> unit = "ml_cairo_stroke"
+external stroke_preserve : t -> unit = "ml_cairo_stroke_preserve"
+external fill : t -> unit = "ml_cairo_fill"
+external fill_preserve : t -> unit = "ml_cairo_fill_preserve"
+external copy_page : t -> unit = "ml_cairo_copy_page"
+external show_page : t -> unit = "ml_cairo_show_page"
+
+external in_stroke : t -> point -> bool = "ml_cairo_in_stroke"
+external in_fill : t -> point -> bool = "ml_cairo_in_fill"
+
+external stroke_extents : t -> float * float * float * float = "ml_cairo_stroke_extents"
+external fill_extents : t -> float * float * float * float = "ml_cairo_fill_extents"
+external clip : t -> unit = "ml_cairo_clip"
+external clip_preserve : t -> unit = "ml_cairo_clip_preserve"
+external reset_clip : t -> unit = "ml_cairo_reset_clip"
+
+
 type glyph = { index : int; glyph_x : float; glyph_y : float; }
 type text_extents = 
   { x_bearing   : float ;
@@ -174,59 +155,81 @@
     FONT_SLANT_NORMAL
   | FONT_SLANT_ITALIC
   | FONT_SLANT_OBLIQUE
-external select_font :
-  cr:t -> family:string -> slant:font_slant -> weight:font_weight ->
-    unit = "ml_cairo_select_font"
-external scale_font : cr:t -> scale:float -> unit = "ml_cairo_scale_font"
-external transform_font :
-  cr:t -> matrix:matrix -> unit = "ml_cairo_transform_font"
-external show_text : cr:t -> utf8:string -> unit = "ml_cairo_show_text"
-external show_glyphs :
-  cr:t -> glyph array -> unit = "ml_cairo_show_glyphs"
-external current_font : cr:t -> font = "ml_cairo_current_font"
-external current_font_extents :
-  cr:t -> font_extents = "ml_cairo_current_font_extents"
-external set_font : cr:t -> font:font -> unit = "ml_cairo_set_font"
-external text_extents : t -> utf8:string -> text_extents = "ml_cairo_text_extents"
+external select_font_face : t -> string -> font_slant -> font_weight -> unit = "ml_cairo_select_font_face"
+external set_font_size : t -> float -> unit = "ml_cairo_set_font_size"
+external set_font_matrix : t -> matrix -> unit = "ml_cairo_set_font_matrix"
+external get_font_matrix : t -> matrix = "ml_cairo_get_font_matrix"
+external show_text : t -> string -> unit = "ml_cairo_show_text"
+external show_glyphs : t -> glyph array -> unit = "ml_cairo_show_glyphs"
+external get_font_face : t -> font_face = "ml_cairo_get_font_face"
+external font_extents : t -> font_extents = "ml_cairo_font_extents"
+external set_font_face : t -> font_face -> unit = "ml_cairo_set_font_face"
+external text_extents : t -> string -> text_extents = "ml_cairo_text_extents"
 external glyph_extents : t -> glyph array -> text_extents = "ml_cairo_glyph_extents"
-external text_path : t -> utf8:string -> unit = "ml_cairo_text_path"
+external text_path : t -> string -> unit = "ml_cairo_text_path"
 external glyph_path : t -> glyph array -> unit = "ml_cairo_glyph_path"
-external font_extents : font -> matrix -> font_extents = "ml_cairo_font_extents"
-external font_glyph_extents : font -> matrix -> glyph array -> text_extents = "ml_cairo_font_glyph_extents"
-external show_surface :
-  cr:t -> surface:surface -> width:int -> height:int ->
-    unit = "ml_cairo_show_surface"
-external current_operator : cr:t -> operator = "ml_cairo_current_operator"
-external current_rgb_color :
-  cr:t -> float * float * float = "ml_cairo_current_rgb_color"
-external current_pattern : cr:t -> pattern = "ml_cairo_current_pattern"
-external current_alpha : cr:t -> float = "ml_cairo_current_alpha"
-external current_tolerance : cr:t -> float = "ml_cairo_current_tolerance"
-external current_point : cr:t -> point = "ml_cairo_current_point"
-external current_fill_rule : cr:t -> fill_rule = "ml_cairo_current_fill_rule"
-external current_line_width : cr:t -> float = "ml_cairo_current_line_width"
-external current_line_cap : cr:t -> line_cap = "ml_cairo_current_line_cap"
-external current_line_join : cr:t -> line_join = "ml_cairo_current_line_join"
-external current_miter_limit : cr:t -> float = "ml_cairo_current_miter_limit"
-external current_matrix :
-  cr:t -> matrix:matrix -> unit = "ml_cairo_current_matrix"
-external current_target_surface :
-  cr:t -> surface = "ml_cairo_current_target_surface"
+
+external get_operator : t -> operator = "ml_cairo_get_operator"
+external get_source : t -> 'a pattern = "ml_cairo_get_source"
+external get_tolerance : t -> float = "ml_cairo_get_tolerance"
+external get_current_point : t -> point = "ml_cairo_get_current_point"
+external get_fill_rule : t -> fill_rule = "ml_cairo_get_fill_rule"
+external get_line_width : t -> float = "ml_cairo_get_line_width"
+external get_line_cap : t -> line_cap = "ml_cairo_get_line_cap"
+external get_line_join : t -> line_join = "ml_cairo_get_line_join"
+external get_miter_limit : t -> float = "ml_cairo_get_miter_limit"
+external get_matrix : t -> matrix = "ml_cairo_get_matrix"
+external get_target : t -> 'a surface = "ml_cairo_get_target"
+
+type flat_path = [
+  | `MOVE_TO of point
+  | `LINE_TO of point
+  | `CLOSE ]
+type path = [
+  | flat_path
+  | `CURVE_TO of point * point * point ]
+external fold_path      : t -> ('a -> [> path] -> 'a) -> 'a -> 'a = "ml_cairo_copy_path"
+external fold_path_flat : t -> ('a -> [> flat_path] -> 'a) -> 'a -> 'a  = "ml_cairo_copy_path_flat"
+
+let append_path cr = function
+  | `MOVE_TO p -> move_to_point cr p
+  | `LINE_TO p -> line_to_point cr p
+  | `CLOSE -> close_path cr
+  | `CURVE_TO (p1, p2, p3) -> curve_to_point cr p1 p2 p3
 
 external status : t -> status option = "ml_cairo_status"
 external status_string : t -> string = "ml_cairo_status_string"
 
-external surface_create_for_image :
-  image -> surface = "ml_cairo_surface_create_for_image"
-external surface_create_similar :
-  other:surface -> format:format -> width:int -> height:int ->
-    surface = "ml_cairo_surface_create_similar"
-external surface_set_repeat :
-  surface:surface -> repeat:bool -> unit = "ml_cairo_surface_set_repeat"
-external surface_set_matrix :
-  surface:surface -> matrix:matrix -> unit = "ml_cairo_surface_set_matrix"
-external surface_get_matrix :
-  surface:surface -> matrix:matrix -> unit = "ml_cairo_surface_get_matrix"
+
+
+(* surface *)
+type format =
+    FORMAT_ARGB32
+  | FORMAT_RGB24
+  | FORMAT_A8
+  | FORMAT_A1
+
+external surface_create_similar : 'a surface -> format -> width:int -> height:int -> 'a surface = "ml_cairo_surface_create_similar"
+
+external surface_finish : 'a surface -> unit = "ml_cairo_surface_finish"
+
+external surface_set_device_offset : 'a surface -> float -> float -> unit = "ml_cairo_surface_set_device_offset"
+
+
+type image_surface = [`Any|`Image] surface
+
+external image_surface_create : format -> width:int -> height:int -> image_surface = "ml_cairo_image_surface_create"
+external image_surface_get_width  : [>`Image] surface -> int = "ml_cairo_image_surface_get_width"
+external image_surface_get_height : [>`Image] surface -> int = "ml_cairo_image_surface_get_height"
+
+
+
+(* pattern *)
+type extend = 
+    EXTEND_NONE
+  | EXTEND_REPEAT
+  | EXTEND_REFLECT
+
 type filter =
     FILTER_FAST
   | FILTER_GOOD
@@ -234,78 +237,56 @@
   | FILTER_NEAREST
   | FILTER_BILINEAR
   | FILTER_GAUSSIAN
-external surface_set_filter :
-  surface:surface -> filter:filter -> unit = "ml_cairo_surface_set_filter"
-external surface_get_filter : surface:surface -> filter = "ml_cairo_surface_get_filter"
-external pattern_create_for_surface : surface -> pattern = "ml_cairo_pattern_create_for_surface"
-external pattern_create_linear : x0:float -> y0:float -> x1:float -> y1:float -> pattern 
-  = "ml_cairo_pattern_create_linear"
-external pattern_create_radial : 
-  cx0:float -> cy0:float -> radius0:float ->
-  cx1:float -> cy1:float -> radius1:float -> pattern 
-  = "ml_cairo_pattern_create_radial_bc" "ml_cairo_pattern_create_radial"
-external pattern_add_color_stop : 
-  pattern -> offset:float -> 
-  red:float -> green:float -> blue:float -> alpha:float -> unit 
-  = "ml_cairo_pattern_add_color_stop_bc" "ml_cairo_pattern_add_color_stop"
-external pattern_set_matrix : pattern -> matrix -> unit = "ml_cairo_pattern_set_matrix"
-external pattern_get_matrix : pattern -> matrix -> unit = "ml_cairo_pattern_get_matrix"
-type extend =
-  | EXTEND_NONE
-  | EXTEND_REPEAT
-  | EXTEND_REFLECT
-external pattern_set_extend : pattern -> extend -> unit = "ml_cairo_pattern_set_extend"
-external pattern_get_extend : pattern -> extend = "ml_cairo_pattern_get_extend"
-external pattern_set_filter : pattern -> filter -> unit = "ml_cairo_pattern_set_filter"
-external pattern_get_filter : pattern -> filter = "ml_cairo_pattern_get_filter"
-external image_surface_create :
-  format:format -> width:int -> height:int ->
-    surface = "ml_cairo_image_surface_create"
-external image_surface_create_for_data :
-  image -> surface = "ml_cairo_image_surface_create_for_data"
-external ps_surface_create :
-  file:Cairo_channel.t -> width_inches:float -> height_inches:float ->
-    x_pixels_per_inch:float -> y_pixels_per_inch:float ->
-    surface = "ml_cairo_ps_surface_create"
-external pdf_surface_create :
-  file:Cairo_channel.t -> width_inches:float -> height_inches:float ->
-    x_pixels_per_inch:float -> y_pixels_per_inch:float ->
-    surface = "ml_cairo_pdf_surface_create"
-external png_surface_create :
-  file:Cairo_channel.t -> format -> width:float -> height:float ->
-    surface = "ml_cairo_png_surface_create"
 
-external matrix_create : unit -> matrix = "ml_cairo_matrix_create"
-external matrix_copy :
-  matrix:matrix -> other:matrix -> unit = "ml_cairo_matrix_copy"
-external matrix_set_identity :
-  matrix:matrix -> unit = "ml_cairo_matrix_set_identity"
-external matrix_set_affine :
-  matrix:matrix -> float array -> unit = "ml_cairo_matrix_set_affine"
-external matrix_get_affine :
-  matrix:matrix -> float array = "ml_cairo_matrix_get_affine"
-external matrix_translate :
-  matrix:matrix -> tx:float -> ty:float -> unit = "ml_cairo_matrix_translate"
-external matrix_scale :
-  matrix:matrix -> sx:float -> sy:float -> unit = "ml_cairo_matrix_scale"
-external matrix_rotate :
-  matrix:matrix -> radians:float -> unit = "ml_cairo_matrix_rotate"
-external matrix_invert : matrix:matrix -> unit = "ml_cairo_matrix_invert"
-external matrix_multiply :
-  result:matrix -> a:matrix -> b:matrix -> unit = "ml_cairo_matrix_multiply"
-external matrix_transform_distance :
-  matrix:matrix -> point -> unit = "ml_cairo_matrix_transform_distance"
-external matrix_transform_point :
-  matrix:matrix -> point -> unit = "ml_cairo_matrix_transform_point"
-external finalise_target : cr:t -> unit = "ml_cairo_finalise_target"
-external surface_finalise : surface -> unit = "ml_cairo_surface_finalise"
+type surface_pattern  = [`Any|`Surface] pattern
+type gradient_pattern = [`Any|`Gradient] pattern
 
-type flat_path = [
-  | `MOVE_TO of point
-  | `LINE_TO of point
-  | `CLOSE ]
-type basic_path = [
-  | flat_path
-  | `CURVE_TO of point * point * point ]
-external fold_current_path      : t -> ('a -> [> basic_path] -> 'a) -> 'a -> 'a = "ml_cairo_current_path"
-external fold_current_path_flat : t -> ('a -> [> flat_path] -> 'a) -> 'a -> 'a  = "ml_cairo_current_path_flat"
+module Pattern = struct
+external create_for_surface : 'a surface -> surface_pattern = "ml_cairo_pattern_create_for_surface"
+external create_linear : x0:float -> y0:float -> x1:float -> y1:float -> gradient_pattern = "ml_cairo_pattern_create_linear"
+external create_radial : cx0:float -> cy0:float -> radius0:float -> cx1:float -> cy1:float -> radius1:float -> gradient_pattern = "ml_cairo_pattern_create_radial_bc" "ml_cairo_pattern_create_radial"
+
+external add_color_stop_rgb  : [>`Gradient] pattern -> off:float -> red:float -> green:float -> blue:float -> unit = "ml_cairo_pattern_add_color_stop_rgb"
+external add_color_stop_rgba : [>`Gradient] pattern -> off:float -> red:float -> green:float -> blue:float -> alpha:float -> unit = "ml_cairo_pattern_add_color_stop_rgba_bc" "ml_cairo_pattern_add_color_stop_rgba"
+
+external set_matrix : 'a pattern -> matrix -> unit = "ml_cairo_pattern_set_matrix"
+external get_matrix : 'a pattern -> matrix = "ml_cairo_pattern_get_matrix"
+
+external set_extend : [> `Surface] pattern -> extend -> unit = "ml_cairo_pattern_set_extend"
+external get_extend : [> `Surface] pattern -> extend = "ml_cairo_pattern_get_extend"
+
+external set_filter : [> `Surface] pattern -> filter -> unit = "ml_cairo_pattern_set_filter"
+external get_filter : [> `Surface] pattern -> filter = "ml_cairo_pattern_get_filter"
+end
+
+
+(* matrix *)
+module Matrix = struct
+let init_identity = { xx = 1.; yx = 0.; xy = 0.; yy = 1.; x0 = 0.; y0 = 0. }
+let init_translate x y = { xx = 1.; yx = 0.; xy = 0.; yy = 1.; x0 = x; y0 = y }
+let init_scale x y = { xx = x; yx = 0.; xy = 0.; yy = y; x0 = 0.; y0 = 0. }
+let init_rotate a =
+  let s = sin a in
+  let c = cos a in
+  { xx = c; yx = s; xy = ~-. s; yy = c; x0 = 0.; y0 = 0. }
+
+external translate : matrix -> float -> float -> matrix = "ml_cairo_matrix_translate"
+external scale     : matrix -> float -> float -> matrix = "ml_cairo_matrix_scale"
+external rotate    : matrix -> float -> matrix = "ml_cairo_matrix_rotate"
+external invert    : matrix -> matrix = "ml_cairo_matrix_invert"
+external multiply  : matrix -> matrix -> matrix = "ml_cairo_matrix_multiply"
+
+external transform_distance : matrix -> point -> point = "ml_cairo_matrix_transform_distance"
+external transform_point    : matrix -> point -> point = "ml_cairo_matrix_transform_point"
+end
+
+
+
+(* fonts *)
+module Scaled_Font = struct
+type t
+
+external create : font_face -> matrix -> matrix -> t = "ml_cairo_scaled_font_create"
+external font_extents : t -> font_extents = "ml_cairo_scaled_font_extents"
+external glyph_extents : t -> glyph array -> text_extents = "ml_cairo_scaled_font_glyph_extents"
+end

Index: Makefile
===================================================================
RCS file: /cvs/cairo/cairo-ocaml/src/Makefile,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- Makefile	1 Mar 2005 22:19:52 -0000	1.9
+++ Makefile	22 May 2005 20:03:15 -0000	1.10
@@ -25,13 +25,16 @@
 svgcairo     : svg_cairo.cma libmlsvgcairo.a
 svgcairo.opt : svg_cairo.cmxa dllmlsvgcairo.so
 
-cairo_SRC = cairo_channel.mli cairo_channel.ml cairo.mli cairo.ml \
+cairo_SRC = cairo.mli cairo.ml \
             cairo_bigarray.mli cairo_bigarray.ml \
-	    cairo_ft.mli cairo_ft.ml \
+	    cairo_png.mli cairo_png.ml \
+	    cairo_pdf.mli cairo_pdf.ml \
+	    cairo_ps.mli cairo_ps.ml \
             ml_cairo_wrappers.c \
-	    ml_cairo_status.c ml_cairo_channel.c \
-            ml_cairo.c ml_cairo_bigarr.c ml_cairo_path.c \
-	    ml_cairo_ft.c
+            ml_cairo.c ml_cairo_status.c ml_cairo_bigarr.c ml_cairo_path.c \
+	    ml_cairo_surface.c ml_cairo_pattern.c ml_cairo_matrix.c \
+	    ml_cairo_font.c \
+	    ml_cairo_png.c ml_cairo_pdf.c ml_cairo_ps.c
 
 cairo.cma : $(call mlobjs,$(cairo_SRC))
 	$(OCAMLMKLIB) -o cairo -oc mlcairo $^ $(CAIRO_LIBS)
@@ -89,7 +92,7 @@
           for lib in dll*.so ; do \
             ln -s $(INSTALLDIR)/$$lib $(DESTDIR)$(OCAMLLIB)/stublibs ; done ; fi
 
-DOCFILES = cairo_channel.mli cairo.mli cairo_bigarray.mli cairo_ft.mli
+DOCFILES = cairo.mli cairo_bigarray.mli cairo_png.mli cairo_pdf.mli cairo_ps.mli
 ifdef LABLGTKDIR
 DOCFILES += cairo_lablgtk.mli
 ifdef GTKCAIRO_CFLAGS
@@ -111,7 +114,7 @@
 	@$(OCAMLDEP) $^ > $@
 
 -include .depend
-include .depend_c
+-include .depend_c
 
 depend : .depend $(wildcard *.h *.c)
 	gcc -MM -isystem $(OCAMLLIB) -isystem $(C_LABLGTKDIR) $(patsubst -I%,-isystem %,$(GDK_CFLAGS)) $(filter %.c,$^) > .depend_c




More information about the cairo-commit mailing list