man generate2 (Commandes) - Generate an Ada binding to a GTK+ widget

NAME

generate2 - Generate an Ada binding to a GTK+ widget

SYNOPSIS

generate2 c_file [definition-file unit_name]

generate2 -l c_file [ada_file]

DESCRIPTION

This script reads c_file, a C header file describing a new GTK+ widget, and produces an Ada 95 thick binding to it on standard output. The binding makes it possible to use the widget from within Ada programs, just like other GTK+ widgets.

generate2 does not fully automate the process, although it should really speed things up. You will probably need less than 15 min to create a new binding once you get used to the way GtkAda works. Note that c_file should have the same format as is used by GTK+ itself.

Here are the steps to create a new binding :

•
Give the generate2 script the C header file.
•
For every field in the C structure, the script asks you whether or not you want to create a function to make it accessible from Ada. Answer y or n (the default value is n, just press ENTER). Example:

$ generate2 ../include/gtk/gtkbutton.h > temporary Create a function for the field child (of type GtkWidget*) [n]? Create a function for the field in_button (of type guint) [n]? Create a function for the field button_down (of type guint) [n]?

•
If you answered yes to at least one of the above questions, create a new C file, and move the C part of the temporary file created by generate2 to this C file.
•
Do a gnatchop on the temporary file created by generate2. This should create two Ada files (spec and body).
•
Edit these two files as needed (generally to change some parameters from Gint to Boolean for instance). It can be a little bit tricky when one of your functions returns a GList* or a GSList*. Please have a look at `/usr/share/ada/adainclude/gtkada2/gtk-combo.ads' for examples how to do this.

OPTIONS

-l
Simply list the functions defined in the file (C or Ada). If an ada_file argument is present, the output will only show the differences between the two files.
file_name
name of the C file to parse.
definition_file
The file to parse for interface definition.
unit_name
If present, only the functions including this name will be generated.

EXAMPLES

generate2 ../include/gdk/gdk.h ../include/gdk/gdktypes.h window

generate2 ../include/gtk/gtkframe.h

SEE ALSO

COPYRIGHT FOR THIS MAN PAGE

This man page has been written by Ludovic Brenta for the Debian GNU/Linux distribution, from information given by the GtkAda authors Emmanuel Briot, Joel Brobecker and Arnaud Charlet.

Permission to use, copy, modify, and distribute this documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation.