gtk2/gtk/makeenums.awk
Tim Janik a21d063ef8 new functions gtk_selection_data_copy and gtk_selection_data_free.
Tue Jun  9 01:57:23 1998  Tim Janik  <timj@gtk.org>

        * gtk/gtkselection.h:
        * gtk/gtkselection.c: new functions gtk_selection_data_copy and
        gtk_selection_data_free.

        * gtk/gtkwidget.c (gtk_widget_class_init): fixed gtk_signal_new() call
        for "selection_received", which was completely bogus.
        * other fixups to gtk_signal_new() calls all over the place.

        * gtk/gtktypebuiltins.h: types as variables (formerly macros).
        * gtk/gtktypebuiltins_vars.c: type variable implementations.
        * gtk/gtktypebuiltins_ids.c: array entries for builtin type
        declarations.
        * gtk/gtktypebuiltins_evals.c: enum value arrays.
        * gtk/gtk-boxed.defs: gtk and gdk structure definitions, used to build
        gtk.defs.
        * gtk/gtk.defs: generated file with scheme syntax for type definitions
        of gtk and gdk structures and enums.
        * gtk/gtktypeutils.h:
        * gtk/gtktypeutils.c: reworked type ids, so they are variables not
        macros anymore (this fixes binary incompatibility with new enum
        definitions).

        * gtk/gtkwidget.c (gtk_widget_real_key_press_event): proccess possible
        key bindings for this widget.
        * gtk/gtkwindow.c (gtk_window_key_press_event): chain parent class'
        handler.

        * gtk/gtkobject.h:
        * gtk/gtkobject.c: removed gtk_object_class_new_user_signal_no_recurse()
        again. new functions gtk_object_class_user_signal_new () and
        gtk_object_class_user_signal_newv (), to feature the GtkSignalRunType
        flag on the signal creation.
Mon Jun  8 20:52:21 1998  Tim Janik  <timj@gtk.org>

        * gtk/gtkcontainer.h: new signal GtkContainer::set_focus_child.
1998-06-09 07:11:55 +00:00

152 lines
2.8 KiB
Awk

BEGIN {
type_name = ""; # GtkEnumType
type_macro = ""; # GTK_TYPE_ENUM_TYPE
type_ident = ""; # _gtk_enum_type
type_flags = 0;
type_counter = 0;
delete value_names; # GTK_ENUM_VALUE
delete value_nicks; # enum-value
VI = 0;
gen_arrays = 0;
gen_defs = 0;
comment_file = "";
for (i = 1; i < ARGC; i++)
{
if (ARGV[i] == "arrays")
gen_arrays = 1;
else if (ARGV[i] == "defs")
gen_defs = 1;
ARGV[i] = "";
}
if (gen_arrays)
printf ("/* generated by makeenums.awk */\n\n");
else if (gen_defs)
printf (";; generated by makeenums.awk ; -*- scheme -*-\n\n");
else
{
printf ("hm? what do you want me to do?\n") > "/dev/stderr";
exit 1;
}
}
function set_type (set_type_1)
{
type_name = set_type_1;
type_macro = "GTK_TYPE";
type_ident = "";
for (i = 0; i < length (type_name); i++)
{
ch = substr (type_name, i + 1, 1);
Ch = toupper (ch);
if (Ch == ch)
{
type_macro = type_macro "_" Ch;
type_ident = type_ident "_" tolower (ch);
}
else
{
type_macro = type_macro Ch;
type_ident = type_ident ch;
}
}
}
function set_value (set_value_1, set_value_2)
{
value_names[VI] = set_value_1;
value_nicks[VI] = tolower (set_value_2);
while (match (value_nicks[VI], "_"))
sub ("_", "-", value_nicks[VI]);
}
function generate_arrays ()
{
if (gen_arrays)
{
printf ("static GtkEnumValue %s_values[] = {\n", type_ident);
for (i = 0; i < VI; i++)
{
printf (" { %s, \"%s\", \"%s\" },\n",
value_names[i], value_names[i], value_nicks[i]);
}
printf ("};\n");
}
}
function generate_defs ()
{
if (gen_defs)
{
if (comment_file != "")
{
printf ("\n; enumerations from \"%s\"\n", comment_file);
comment_file = "";
}
printf ("\n(define-%s %s",
type_flags ? "flags" : "enum",
type_name);
for (i = 0; i < VI; i++)
{
printf ("\n (%s %s)",
value_nicks[i], value_names[i]);
}
printf (")\n");
}
}
function basename (basename_1)
{
sub ("\"", "", basename_1);
while (match (basename_1, "/"))
sub (".*/", "", basename_1);
sub ("\"", "", basename_1);
return basename_1;
}
# parse keywords
/G_ENUM_E/ {
if ($3 != "+" || $5 != "+")
printf ("huh? G_ENUM_E keyword without arg?\n") > "/dev/stderr";
else
set_type($4);
type_flags = 0;
generate_defs();
generate_arrays();
VI = 0;
}
/G_ENUM_F/ {
if ($3 != "+" || $5 != "+")
printf ("huh? G_ENUM_F keyword without arg?\n") > "/dev/stderr";
else
set_type($4);
type_flags = 1;
generate_defs();
generate_arrays();
VI = 0;
}
/G_ENUM_V/ {
if ($2 != "+" || $4 != "+" || $6 != "+")
printf ("huh? G_ENUM_V keyword without arg?\n") > "/dev/stderr";
else
set_value($3, $5);
VI += 1;
}
# feature per file comments
/# / {
comment_file = basename($3);
}
END {
printf("\n");
}