]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/DEVEL/lablgtksourceview/ml_gtk_sourceview.c
ocaml 3.09 transition
[helm.git] / helm / DEVEL / lablgtksourceview / ml_gtk_sourceview.c
index 7951cd6fd687fbdf496ec895fc26ef55056f6cb8..965618d2662737c598cbbcad3fae3cacd3bc544f 100644 (file)
@@ -1,26 +1,22 @@
-/* Copyright (C) 2005:
- *     Stefano Zacchiroli     <zack@cs.unibo.it>
- *     Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>
+/*
+ * lablgtksourceview, OCaml binding for the GtkSourceView text widget
  *
- * This file is part of lablgtksourceview, the OCaml binding for the
- * GtkSourceView widget.
+ * Copyright (C) 2005  Stefano Zacchiroli <zack@cs.unibo.it>
  * 
- * lablgtksourceview is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of the
  * License, or (at your option) any later version.
- *
- * lablgtksourceview is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * 
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with lablgtksourceview; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * Lesser General Public License for more details.
  * 
- * For details, send a mail to the authors.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
  */
 
 #include <assert.h>
@@ -46,8 +42,6 @@
 #include <gtk_tags.h>
 #include <gdk_tags.h>
 
-/* Init all */
-
 CAMLprim value ml_gtk_source_language_init(value unit)
 {      /* Since these are declared const, must force gcc to call them! */
     GType t = gtk_source_language_get_type();
@@ -72,14 +66,38 @@ CAMLprim value ml_gtk_source_view_init(value unit)
     return Val_GType(t);
 }
 
+static gpointer string_val(value v)
+{
+       return String_val(v);
+}
+
+GSList *ml_gslist_of_string_list(value list)
+{
+       GSList_val(list, string_val);
+}
+
+/* CAMLprim value
+ml_gtk_source_languages_manager_set_lang_files_dirs(GObject *obj, value list)
+{
+       GSList *gslist = ml_gslist_of_string_list(list);
+       g_object_set_property(obj, "lang-files-dirs", gslist);
+       return Val_unit;
+} */
+
 #define GtkSourceLanguage_val(val) check_cast(GTK_SOURCE_LANGUAGE,val)
 #define GtkSourceLanguagesManager_val(val)\
        check_cast(GTK_SOURCE_LANGUAGES_MANAGER,val)
 #define GtkSourceTagTable_val(val) check_cast(GTK_SOURCE_TAG_TABLE,val)
 #define GtkSourceBuffer_val(val) check_cast(GTK_SOURCE_BUFFER,val)
 #define GtkSourceView_val(val) check_cast(GTK_SOURCE_VIEW,val)
+#define GtkTextIter_val(val) ((GtkTextIter*)MLPointer_val(val))
 #define Val_option_GtkAny(v) Val_option(v,Val_GtkAny)
+#define string_list_of_GSList(l) Val_GSList(l, (value_in) Val_string)
+/* #define GSList_of_string_list(l) GSList_val(l, String_val) */
+/* #define GSList_of_string_list(l) GSList_val(l, ml_string_val) */
 
+ML_2 (_gtk_source_language_new_from_file, String_val,
+               GtkSourceLanguagesManager_val, Val_option_GtkAny)
 ML_1 (gtk_source_language_get_name, GtkSourceLanguage_val, Val_string)
 ML_1 (gtk_source_language_get_section, GtkSourceLanguage_val, Val_string)
 ML_1 (gtk_source_language_get_escape_char, GtkSourceLanguage_val, Val_int)
@@ -88,12 +106,14 @@ ML_0 (gtk_source_languages_manager_new, Val_GtkAny_sink)
 ML_2 (gtk_source_languages_manager_get_language_from_mime_type,
                GtkSourceLanguagesManager_val, String_val,
                Val_option_GtkAny)
+ML_1 (gtk_source_languages_manager_get_lang_files_dirs,
+               GtkSourceLanguagesManager_val, string_list_of_GSList)
 
 /* ML_0 (gtk_source_buffer_new, GtkSourceTagTable_val, Val_GtkAny_sink) */
 /* ML_1 (gtk_source_buffer_new_with_language, GtkSourceLanguage_val,
                Val_GtkAny_sink) */
-ML_1 (gtk_source_buffer_can_undo, GtkSourceBuffer_val, Bool_val)
-ML_1 (gtk_source_buffer_can_redo, GtkSourceBuffer_val, Bool_val)
+ML_1 (gtk_source_buffer_can_undo, GtkSourceBuffer_val, Val_bool)
+ML_1 (gtk_source_buffer_can_redo, GtkSourceBuffer_val, Val_bool)
 ML_1 (gtk_source_buffer_undo, GtkSourceBuffer_val, Unit)
 ML_1 (gtk_source_buffer_redo, GtkSourceBuffer_val, Unit)
 ML_1 (gtk_source_buffer_begin_not_undoable_action, GtkSourceBuffer_val, Unit)
@@ -102,3 +122,5 @@ ML_1 (gtk_source_buffer_end_not_undoable_action, GtkSourceBuffer_val, Unit)
 ML_0 (gtk_source_view_new, Val_GtkWidget_sink)
 ML_1 (gtk_source_view_new_with_buffer, GtkSourceBuffer_val, Val_GtkWidget_sink)
 
+ML_1 (gtk_source_iter_find_matching_bracket, GtkTextIter_val, Val_bool)
+