Re: maketypes.awk and makeenums.pl



On 21 Apr 2001, Martin Baulig wrote:

> Hi Tim,
> 
> remember, we talked about moving maketypes.awk and makeenums.pl
> into glib and installing them at GUADEC ?
> 
> There's now a glib-only version of these scripts in libgnome/tools/;
> would it be possible to have this in glib anytime soon ?

not quite what you have in that tools dir.

i added glib-mkenums as publically installed perl script to glib now,
it's however way more generic than your gnome-makeenums.pl and supports
slight trigraph additions over makeenums.pl (there's a manual page
installed with it, getting into the details of how to use it and what
trigraphs are supported).

glib-mkenums uses text-production options specified by the user, so it
can be used to generate pretty much everything.
gtk/Makefile.am currently contains rules that use glib-mkenums to
generate .defs file entries and C code enum value arrays.
the gtk makefile does not yet use glib-mkenums to generate the type
macros and variables, ideally it would work the pango enum generation
way anyway, where every enum gets its own type installation routine.
(patches into that direction are greatly apprechiated).

i do not intend to install an equivalent to maketypes.awk though,
first, it's a pretty ugly hack, and second people should just code
up normal type installation routines for those as well (rather than
hacking the gtk maketypes.awk version to support boxed_init and
is_refcounted from some home-grown .defs format like you did for libgnome).

here're two quick examples to substitute the maketypes.awk job for
enums (the array generation is as already mentioned in gtk/Makefile.am):

$ # header file generation
$ glib-mkenums --fprod "\n/* --- @filename@ --- */" \
               --eprod "#define GTK_TYPE_ ENUMSHORT@\t    (_gtk_prefix__ enum_name@))\n" \
               --eprod "extern GType _gtk_prefix__ enum_name@;" \
               gtkpacker.h

/* Generated data (by glib-mkenums) */


/* --- gtkpacker.h --- */
#define GTK_TYPE_PACKER_OPTIONS     (_gtk_prefix__gtk_packer_options))
extern GType _gtk_prefix__gtk_packer_options;

/* Generated data ends here */

$ # .c file generation
$ glib-mkenums --fprod "\n/* --- @filename@ --- */"  \
               --eprod "GType _gtk_prefix__ enum_name@ = 0;" \
               gtkpacker.h

/* Generated data (by glib-mkenums) */


/* --- gtkpacker.h --- */
GType _gtk_prefix__gtk_packer_options = 0;

/* Generated data ends here */



> 
> -- 
> Martin Baulig

---
ciaoTJ







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]