2 * lablgtksourceview, OCaml binding for the GtkSourceView text widget
4 * Copyright (C) 2005 Stefano Zacchiroli <zack@cs.unibo.it>
6 * This library is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as
8 * published by the Free Software Foundation; either version 2.1 of the
9 * License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
24 #include <gtksourceview/gtksourceview.h>
25 #include <gtksourceview/gtksourcelanguagesmanager.h>
27 #include <caml/mlvalues.h>
28 #include <caml/alloc.h>
29 #include <caml/memory.h>
30 #include <caml/callback.h>
31 #include <caml/fail.h>
32 #include <caml/custom.h>
33 #include <caml/callback.h>
39 #include <ml_gobject.h>
40 #include <ml_gdkpixbuf.h>
45 CAMLprim value ml_gtk_source_language_init(value unit)
46 { /* Since these are declared const, must force gcc to call them! */
47 GType t = gtk_source_language_get_type();
51 CAMLprim value ml_gtk_source_languages_manager_init(value unit)
52 { /* Since these are declared const, must force gcc to call them! */
53 GType t = gtk_source_languages_manager_get_type();
57 CAMLprim value ml_gtk_source_buffer_init(value unit)
58 { /* Since these are declared const, must force gcc to call them! */
59 GType t = gtk_source_buffer_get_type();
63 CAMLprim value ml_gtk_source_view_init(value unit)
64 { /* Since these are declared const, must force gcc to call them! */
65 GType t = gtk_source_view_get_type();
69 static gpointer string_val(value v)
74 GSList *ml_gslist_of_string_list(value list)
76 GSList_val(list, string_val);
80 ml_gtk_source_languages_manager_set_lang_files_dirs(GObject *obj, value list)
82 GSList *gslist = ml_gslist_of_string_list(list);
83 g_object_set_property(obj, "lang-files-dirs", gslist);
87 #define GtkSourceLanguage_val(val) check_cast(GTK_SOURCE_LANGUAGE,val)
88 #define GtkSourceLanguagesManager_val(val)\
89 check_cast(GTK_SOURCE_LANGUAGES_MANAGER,val)
90 #define GtkSourceTagTable_val(val) check_cast(GTK_SOURCE_TAG_TABLE,val)
91 #define GtkSourceBuffer_val(val) check_cast(GTK_SOURCE_BUFFER,val)
92 #define GtkSourceView_val(val) check_cast(GTK_SOURCE_VIEW,val)
93 #define GtkTextIter_val(val) ((GtkTextIter*)MLPointer_val(val))
94 #define Val_option_GtkAny(v) Val_option(v,Val_GtkAny)
95 #define string_list_of_GSList(l) Val_GSList(l, (value_in) Val_string)
96 /* #define GSList_of_string_list(l) GSList_val(l, String_val) */
97 /* #define GSList_of_string_list(l) GSList_val(l, ml_string_val) */
99 ML_2 (_gtk_source_language_new_from_file, String_val,
100 GtkSourceLanguagesManager_val, Val_option_GtkAny)
101 ML_1 (gtk_source_language_get_name, GtkSourceLanguage_val, Val_string)
102 ML_1 (gtk_source_language_get_section, GtkSourceLanguage_val, Val_string)
103 ML_1 (gtk_source_language_get_escape_char, GtkSourceLanguage_val, Val_int)
105 ML_0 (gtk_source_languages_manager_new, Val_GtkAny_sink)
106 ML_2 (gtk_source_languages_manager_get_language_from_mime_type,
107 GtkSourceLanguagesManager_val, String_val,
109 ML_1 (gtk_source_languages_manager_get_lang_files_dirs,
110 GtkSourceLanguagesManager_val, string_list_of_GSList)
112 /* ML_0 (gtk_source_buffer_new, GtkSourceTagTable_val, Val_GtkAny_sink) */
113 /* ML_1 (gtk_source_buffer_new_with_language, GtkSourceLanguage_val,
115 ML_1 (gtk_source_buffer_can_undo, GtkSourceBuffer_val, Val_bool)
116 ML_1 (gtk_source_buffer_can_redo, GtkSourceBuffer_val, Val_bool)
117 ML_1 (gtk_source_buffer_undo, GtkSourceBuffer_val, Unit)
118 ML_1 (gtk_source_buffer_redo, GtkSourceBuffer_val, Unit)
119 ML_1 (gtk_source_buffer_begin_not_undoable_action, GtkSourceBuffer_val, Unit)
120 ML_1 (gtk_source_buffer_end_not_undoable_action, GtkSourceBuffer_val, Unit)
122 ML_0 (gtk_source_view_new, Val_GtkWidget_sink)
123 ML_1 (gtk_source_view_new_with_buffer, GtkSourceBuffer_val, Val_GtkWidget_sink)
125 ML_1 (gtk_source_iter_find_matching_bracket, GtkTextIter_val, Val_bool)