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_source_view_init(value unit)
51 { /* Since these are declared const, must force gcc to call them! */
52 GType t = gtk_source_view_get_type();
56 CAMLprim value ml_gtk_source_buffer_init(value unit)
57 { /* Since these are declared const, must force gcc to call them! */
58 GType t = gtk_source_buffer_get_type();
62 #define GtkSourceView_val(val) check_cast(GTK_SOURCE_VIEW,val)
63 #define GtkSourceBuffer_val(val) check_cast(GTK_SOURCE_BUFFER,val)
65 //#####################################
67 //#define FontManagerId_val(val) Int_val(val)
68 //#define Val_FontManagerId(val) Val_int(val)
70 ///* As ML_1, but the result is optional */
71 //#define OML_1(cname, conv1, conv) \
72 //value ml_##cname (value arg1) { return Val_option_ptr((cname (conv1 (arg1))),conv); }
73 ///* As ML_3, but the result is optional */
74 //#define OML_3(cname, conv1, conv2, conv3, conv) \
75 value ml_##cname (value arg1, value arg2, value arg3) { return Val_option_ptr((cname (conv1 (arg1), conv2 (arg2), conv3 (arg3))),conv); }
76 ///* As ML_2, but the second argument is optional */
77 //#define ML_2O(cname, conv1, conv2, conv) \
78 //value ml_##cname (value arg1, value arg2) \
79 //{ return conv (cname (conv1(arg1), ptr_val_option(arg2,conv2))); }
81 /* ML_1 (gtk_math_view_freeze, GtkMathView_val, Unit)
82 ML_2 (gtk_math_view_load_uri, GtkMathView_val, String_val, Val_bool)
83 ML_3 (gtk_math_view_set_top, GtkMathView_val, Int_val, Int_val, Unit) */
85 /* ML_1 (gtk_source_view_get_show_line_numbers, GtkSourceView_val, Val_bool) */
86 /* ML_2 (gtk_source_view_set_show_line_numbers, GtkSourceView_val, Bool_val, Unit) */
88 ML_1 (gtk_source_buffer_can_undo, GtkSourceBuffer_val, Bool_val)
89 ML_1 (gtk_source_buffer_can_redo, GtkSourceBuffer_val, Bool_val)
90 ML_1 (gtk_source_buffer_undo, GtkSourceBuffer_val, Unit)
91 ML_1 (gtk_source_buffer_redo, GtkSourceBuffer_val, Unit)
92 ML_1 (gtk_source_buffer_begin_not_undoable_action, GtkSourceBuffer_val, Unit)
93 ML_1 (gtk_source_buffer_end_not_undoable_action, GtkSourceBuffer_val, Unit)