2 * Stefano Zacchiroli <zack@cs.unibo.it>
3 * Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>
5 * This file is part of lablgtksourceview, the OCaml binding for the
6 * GtkSourceView widget.
8 * lablgtksourceview is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of the
11 * License, or (at your option) any later version.
13 * lablgtksourceview is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with lablgtksourceview; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
23 * For details, send a mail to the authors.
28 #include <gtksourceview/gtksourceview.h>
30 #include <caml/mlvalues.h>
31 #include <caml/alloc.h>
32 #include <caml/memory.h>
33 #include <caml/callback.h>
34 #include <caml/fail.h>
35 #include <caml/custom.h>
36 #include <caml/callback.h>
42 #include <ml_gobject.h>
43 #include <ml_gdkpixbuf.h>
50 CAMLprim value ml_gtk_sourceview_init(value unit)
52 /* Since these are declared const, must force gcc to call them! */
53 GType t = gtk_source_view_get_type();
57 #define GtkSourceView_val(val) check_cast(GTK_SOURCE_VIEW,val)
59 //#####################################
61 //#define FontManagerId_val(val) Int_val(val)
62 //#define Val_FontManagerId(val) Val_int(val)
64 ///* As ML_1, but the result is optional */
65 //#define OML_1(cname, conv1, conv) \
66 //value ml_##cname (value arg1) { return Val_option_ptr((cname (conv1 (arg1))),conv); }
67 ///* As ML_3, but the result is optional */
68 //#define OML_3(cname, conv1, conv2, conv3, conv) \
69 value ml_##cname (value arg1, value arg2, value arg3) { return Val_option_ptr((cname (conv1 (arg1), conv2 (arg2), conv3 (arg3))),conv); }
70 ///* As ML_2, but the second argument is optional */
71 //#define ML_2O(cname, conv1, conv2, conv) \
72 //value ml_##cname (value arg1, value arg2) \
73 //{ return conv (cname (conv1(arg1), ptr_val_option(arg2,conv2))); }
75 /* ML_1 (gtk_math_view_freeze, GtkMathView_val, Unit)
76 ML_2 (gtk_math_view_load_uri, GtkMathView_val, String_val, Val_bool)
77 ML_3 (gtk_math_view_set_top, GtkMathView_val, Int_val, Int_val, Unit) */
79 ML_1 (gtk_source_view_get_show_line_numbers, GtkSourceView_val,
81 ML_2 (gtk_source_view_set_show_line_numbers, GtkSourceView_val,