4 This file describes the way that autogeneration
5 works within the GTK+ source code.
7 The following files in the gdk/ subdirectory
13 The following files in the gtk/ subdirectory
17 Description of GTK+ types (and some functions) in a lisp-style
20 Header file including declarations for internal types
21 gtktypebuiltins_vars.c
22 Variables for type values for internal types.
24 Arrays holding information about each internal type.
25 gtktypebuiltins_evals.c
26 Arrays holding mapping between enumeration values
31 Autogenerated signal marshallers
36 gdkkeysyms.h and gdkcursors.h are generated from
37 the corresponding header files
42 by some simple sed scripts. These are not actually
43 run automatically because we want all the keysyms
44 even on systems with a limited set.
45 So the Gdk rule to generate both files (X-derived-headers)
46 only needs to be rerun for every new release of the X Window
49 GTK+ - type definitions
50 =======================
52 The type definitions are generated from several sources:
54 gtk-boxed.defs - definitions for boxed types
58 The makeenums.pl script does a heuristic parse of
59 the header files and extracts all enumerations declarations.
60 It also recognizes a number of pseudo-comments in the
63 Two of these apply to individual enumeration values:
67 This enumeration value should be skipped.
71 The nickname for this value should NICK instead of the
72 normally guessed value. For instance:
75 GTK_TARGET_SAME_APP = 1 << 0, /*< nick=same-app >*/
76 GTK_TARGET_SAME_WIDGET = 1 << 1 /*< nick=same-widget >*/
79 makes the nicks "same-app" and "same-widget", instead of
80 "app" and "widget" that would normally be used.
82 The other two apply to entire enumeration declarations.
86 Specifies the prefix to be removed from the enumeration
87 values to generate nicknames.
91 Specifies that this enumeration is used as a bitfield.
92 (makenums.pl normally guesses this from the presence of values
93 with << operators). For instance:
95 typedef enum /*< flags >*/
97 GDK_IM_PREEDIT_AREA = 0x0001,
98 GDK_IM_PREEDIT_CALLBACKS = 0x0002,
102 makeenums.pl can be run into two modes:
104 1) Generate the gtktypebuiltins_eval.c file (this
105 contains arrays holding the mapping of
106 string <=> enumeration value)
108 2) Generate the enumeration portion of gtk.defs.
110 The enumearation portion is added to the boxed type
111 declarations in gtk-boxed.defs to create gtk.defs.
113 The makeetypes.awk program takes the gtk.defs file, and
114 from that generates various files depending on the
115 third parameter passed to it:
117 macros: gtktypebuiltins.h
118 variables: gtktypebuiltins_vars.c
119 entries: gtktypebuiltins_ids.c
124 The files gtkmarshal.c and gtkmarshal.h include declarations
125 and definitions for the marshallers needed inside of
126 GTK+. The marshallers to be generated are listed in
127 the file gtkmashal.list, which is processed
130 The format of this file is a list of lines:
132 <retval-type>:<arg1-type>,<arg2-type>,<arg3-type>
136 BOOL:POINTER,STRING,STRING,POINTER
138 A marshaller is generated for each line in the file.
139 The possible types are:
156 FOREIGN (gpointer data, GtkDestroyNotify notify)
157 C_CALLBACK (GtkFunction func, gpointer func_data)
158 SIGNAL (GtkSignalFunc f, gpointer data)
159 ARGS (gint n_args, GtkArg *args)
160 CALLBACK (GtkCallBackMarshal marshall,
162 GtkDestroyNotify Notify)
164 Some of these types map to multiple return values - these
165 are marked above with the return types in parantheses.
170 When autogenerating GTK+ files, the autogenerated
171 files are often rebuild resulting in the same result.
173 To prevent unecessary rebuilds of the entire directory, some files
174 that multiple other source files depend on are not actually written
175 to directly. Instead, an intermediate file is written, which
176 is then compared to the old file, and only if it is different
177 is it copied into the final location.