mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 19:36:18 +01:00
77 lines
3.1 KiB
XML
77 lines
3.1 KiB
XML
<partintro>
|
|
<para>
|
|
Several useful developer tools have been build around GObject technology.
|
|
Next sections briefly introduce them and link to the respective project pages.
|
|
</para>
|
|
</partintro>
|
|
|
|
<chapter id="tools-gob">
|
|
<title>GObject builder</title>
|
|
|
|
<para>
|
|
Writing gobjects can be a tedious task. It requires a lot of typing and just
|
|
doing copy and paste needs care. On obvious idea is to use some sort of
|
|
templates for the class skelletons. Then a tool could generate the real c
|
|
files from them.
|
|
<ulink url="http://www.5z.com/jirka/gob.html">GOB/</ulink> (or GOB2) is suc
|
|
h a tool. It is a preprocessor for making GObjects with inline C code so
|
|
that generated files are not edited.
|
|
Syntax is inspired by Java and Yacc or Lex. The implementation is
|
|
intentionally kept simple, and no C actual code parsing is done.
|
|
</para>
|
|
</chapter>
|
|
|
|
<chapter id="tools-refdb">
|
|
<title>Debugging reference count problems</title>
|
|
|
|
<para>
|
|
The reference counting scheme used by GObject does solve quite
|
|
a few memory management problems but also introduces new sources of bugs.
|
|
In large applications, finding the exact spot where a the reference count
|
|
of an Object is not properly handled can be very difficult. Hopefully,
|
|
there exist at a too named <ulink url="http://refdbg.sf.net/">refdbg/</ulink>
|
|
which can be used to automate the task of tracking down the location
|
|
of invalid code with regard to reference counting. This application
|
|
intercepts the reference counting calls and tries to detect invalid behavior.
|
|
It suports a filter-rule mechanism to let you trace only the objects you are
|
|
interested in and it can be used together with gdb.
|
|
</para>
|
|
</chapter>
|
|
|
|
<chapter id="tools-gtkdoc">
|
|
<title>Writing API docs</title>
|
|
|
|
<para>The API documentation for most of the Glib, GObject, GTK+ and GNOME
|
|
libraries is built with a combination of complex tools. Typically, the part of
|
|
the documentation which describes the behavior of each function is extracted
|
|
from the specially-formatted source code comments by a tool named gtk-doc which
|
|
generates docbook xml and merges this docbook xml with a set of master xml
|
|
docbook files. These xml docbook files are finally processed with xsltproc
|
|
(a small program part of the libxslt library) to generate the final html
|
|
output. Other tools can be used to generate pdf output from the source xml.
|
|
The following code excerpt shows what these comments look like.
|
|
<programlisting>
|
|
/**
|
|
* gtk_widget_freeze_child_notify:
|
|
* @widget: a #GtkWidget
|
|
*
|
|
* Stops emission of "child-notify" signals on @widget. The signals are
|
|
* queued until gtk_widget_thaw_child_notify() is called on @widget.
|
|
*
|
|
* This is the analogue of g_object_freeze_notify() for child properties.
|
|
**/
|
|
void
|
|
gtk_widget_freeze_child_notify (GtkWidget *widget)
|
|
{
|
|
...
|
|
</programlisting>
|
|
</para>
|
|
<para>
|
|
The great thoroughful
|
|
<ulink url="http://developer.gnome.org/arch/doc/authors.html">documentation</ulink>
|
|
on how to setup and use gtk-doc in your
|
|
project is provided on the gnome developer website.
|
|
gtk-doc generates
|
|
</para>
|
|
</chapter>
|