(see also my other gauche-bindings)
(here how i created binding for gtk+extra )
This is what I remember, after months of usage.
typedef GtkTextMark GtkSourceMarker;
h2stub was not able to process such typedef into the .stub files. I needed the GtkSourceMarker type recognized to be able to handle function with GtkSourceBuffer argument, I needed to bind the 2 types somehow. So I started hacking on h2stub.scm.
Gauche-gtk is distributed w/ h2s-gtk.scm. Other similar packages gauche-gtksourceview etc. have similar one. This file is a program ..... originally it was h2stubs.scm, but I extracted most of the functionality in a standalone package gauche-h2s
I broke h2stub.scm into several parts (modules), and combined it with my gauche-bdb (berkeley-db binding) to store the information about C gtk+ objects (types & strucst) in a database. (Nowadays I use the generic bdm api, so the backend can be switched)
So, scanning the gtk+ (gnome) headers I obtain:
For new types:
And I added:
The first (original) group of files is fed into `genstub', which produces .h files. When we build bindings which depend on other bindings, we use the DB while scanning the new header files.
And prepare the new .stub files to:
* Example: how I extended today [26 dic 2005]
I looked at /usr/include/gtk-2.0/gtk/gtk.h and also in the /usr/include/gtk-2.0/gtk/ directory, And made a mix of the 2 lists. Some files were not ready, they contain
#ifndef GTK_TEXT_USE_INTERNAL_UNSUPPORTED_APIor
#ifdef GTK_ENABLE_BROKEN
on the other hand, some files in the directory are not listed in
Note: gtktoolbar.h is included twice in gtk/gtk.h (2.8.8).
In summary, the GTKFILES is made by hand.
This works using gobject system's "interface". For use in gauche, we want to convert it into multi-inheritance. So, in gtk-lib.hints:
First, introduce the abstract (gauche) class which implements the "gtk interface"
(input-file "gtkfilechooser.h") (define-opaque GtkFileChooser :gobject) ; (fixme!) why :gobject?
And then use it in multiple-inheritance:
(input-file "gtkfilechooserdialog.h") (define-cclass-fix <gtk-file-chooser-dialog> (add-mixin! "Scm_GtkFileChooserClass"))
Gtk+ provides this function.
The signature of the function is not clear to h2s-gtk.scm (it does not know about C variadic functions), so it does not output a stub definition. Unless we give it more information:
still under the effect of (input-file "gtkfilechooserdialog.h"):
(define-cproc-fix gtk-file-chooser-dialog-new
;(return <gtk-widget> gtk_file_chooser_dialog_new)
(fix-arguments!
'(title::<const-gchar*> parent::<gtk-window> action::<int> first_button_text::<const-gchar*>
response_id::<int>)
))
Similar to gtk-tree-view-column-new-with-attributes