1998-06-09 07:11:55 +00:00
|
|
|
|
|
|
|
BEGIN {
|
|
|
|
type_name = ""; # GtkEnumType
|
|
|
|
type_macro = ""; # GTK_TYPE_ENUM_TYPE
|
|
|
|
type_ident = ""; # _gtk_enum_type
|
|
|
|
type_counter = 0;
|
|
|
|
gen_macros = 0;
|
|
|
|
gen_entries = 0;
|
|
|
|
gen_vars = 0;
|
|
|
|
|
|
|
|
for (i = 2; i < ARGC; i++)
|
|
|
|
{
|
|
|
|
if (ARGV[i] == "macros")
|
|
|
|
gen_macros = 1;
|
|
|
|
else if (ARGV[i] == "entries")
|
|
|
|
gen_entries = 1;
|
|
|
|
else if (ARGV[i] == "variables")
|
|
|
|
gen_vars = 1;
|
|
|
|
ARGV[i] = "";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gen_macros)
|
This might seem like a large patch, but it isn't that bad, and nothing
should break on Unix/X11.
Win32 merge and general portability stuff:
* acconfig.h,configure.in: Check for <sys/time.h>.
* gdk/win32: New directory (actually, been there for a while).
* gtk/fnmatch.c: Include <glib.h> for G_DIR_SEPARATOR, WIN32 and
NATIVE_WIN32, and use these. Always case fold on Win32. No
backslashed escapes on native Win32.
* gtk/{gtk.def,makefile.msc}: New files.
* gtk/Makefile.am: Add above new files.
* gtk/{gtkaccelgroup,gtkbindings}.c: Include <string.h>
instead of <strings.h>.
* gtk/{gtkcalendar,gtkitemfactory,gtkpreview,gtkrc}.c: Include
config.h. Protect inclusion of <sys/param.h>, <sys/time.h>, and
<unistd.h> appropriately.
* gtk/gtkdnd.c: Merge in Win32 version (which doesn't do much).
Use ABS() (from <glib.h>) instead of abs().
* gtk/gtkfilesel.c: Moved Win32-specific includes after inclusion
of gtk (and thus glib) headers, so that WIN32 will be
defined. With MS C, include <direct.h> for mkdir prototype.
* gtk/gtkitemfactory.c (gtk_item_factory_callback_marshal): Add
some casts, needed by MS C.
* gtk/{gtklayout,gtkplug}.c: Merge in Win32 version (which isn't
implemented).
* gtk/gtkmain.c: Include gdk/gdkx.h for GDK_WINDOWING. Include
<X11/Xlocale.h> only on X11 platform, otherwise <locale.h>. Use
G_SEARCHPATH_SEPARATOR_S and g_module_build_path.
* gtk/gtkmain.h: Mark variables for export/import on Win32.
* gtk/gtkrange.c (gtk_range_motion_notify): Set mods also in case
the event is not a hint, or its window is not the slider. Needed
on Win32, at least.
* gtk/gtkrc.c: Include config.h and gdk/gdkx.h. Use <locale.h>
unless on X11. Skip \r chars, too. Use G_DIR_SEPARATOR and
G_SEARCHPATH_SEPARATOR(_S). Use g_path_is_absolute. On Win32, use
a subdirectory of the Windows directory as gtk system
configuration directory.
* gtk/gtkselection.c: No chunks on Win32.
* gtk/gtksocket.c: Not implemented on Win32.
* gtk/gtkthemes.c (gtk_theme_engine_get): Use g_module_build_path.
* gtk/makeenums.h: Include gdkprivate.h after gdk.h.
* gtk/testrgb.c: Use dynamically allocated buffer. Use GTimers.
1999-03-15 00:03:37 +00:00
|
|
|
{
|
|
|
|
printf ("/* type macros, generated by maketypes.awk */\n");
|
|
|
|
printf ("\n");
|
|
|
|
printf ("#ifdef NATIVE_WIN32\n");
|
|
|
|
printf ("# ifdef GTK_COMPILATION\n");
|
|
|
|
printf ("# define GTKTYPEBUILTINS_VAR __declspec(dllexport)\n");
|
|
|
|
printf ("# else\n");
|
|
|
|
printf ("# define GTKTYPEBUILTINS_VAR extern __declspec(dllimport)\n");
|
|
|
|
printf ("# endif\n");
|
|
|
|
printf ("#else\n");
|
|
|
|
printf ("# define GTKTYPEBUILTINS_VAR extern\n");
|
|
|
|
printf ("#endif\n");
|
|
|
|
printf ("\n");
|
|
|
|
}
|
1998-06-09 07:11:55 +00:00
|
|
|
else if (gen_entries)
|
|
|
|
printf ("/* type entries, generated by maketypes.awk */\n\n");
|
|
|
|
else if (gen_vars)
|
|
|
|
printf ("/* type variables, generated by maketypes.awk */\n\n");
|
|
|
|
else
|
|
|
|
{
|
|
|
|
printf ("hm? what do you want me to do?\n") > "/dev/stderr";
|
|
|
|
exit 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function set_type (set_type_1)
|
|
|
|
{
|
|
|
|
type_counter += 1;
|
|
|
|
type_name = set_type_1;
|
1998-11-26 03:43:24 +00:00
|
|
|
type_macro = "GTK_TYPE_";
|
|
|
|
|
|
|
|
tmp = type_name;
|
|
|
|
# OK, the following is ridiculous, and sed s///g would be far easier
|
|
|
|
gsub ("[A-Z]", "@&", tmp);
|
|
|
|
gsub ("[^A-Z]@", "&_", tmp);
|
|
|
|
gsub ("@", "", tmp);
|
|
|
|
gsub ("[A-Z][A-Z][A-Z][0-9a-z]", "@&", tmp);
|
|
|
|
gsub ("@..", "&_", tmp);
|
1998-06-15 21:27:17 +00:00
|
|
|
gsub ("@", "", tmp);
|
|
|
|
type_macro = type_macro toupper (tmp);
|
1998-11-26 03:43:24 +00:00
|
|
|
type_ident = "_" tolower (tmp);
|
1998-06-15 21:27:17 +00:00
|
|
|
|
1998-06-09 07:11:55 +00:00
|
|
|
sub ("^GTK_TYPE_GTK_", "GTK_TYPE_", type_macro);
|
|
|
|
}
|
|
|
|
|
|
|
|
function generate (generate_1)
|
|
|
|
{
|
|
|
|
if (gen_macros)
|
|
|
|
{
|
This might seem like a large patch, but it isn't that bad, and nothing
should break on Unix/X11.
Win32 merge and general portability stuff:
* acconfig.h,configure.in: Check for <sys/time.h>.
* gdk/win32: New directory (actually, been there for a while).
* gtk/fnmatch.c: Include <glib.h> for G_DIR_SEPARATOR, WIN32 and
NATIVE_WIN32, and use these. Always case fold on Win32. No
backslashed escapes on native Win32.
* gtk/{gtk.def,makefile.msc}: New files.
* gtk/Makefile.am: Add above new files.
* gtk/{gtkaccelgroup,gtkbindings}.c: Include <string.h>
instead of <strings.h>.
* gtk/{gtkcalendar,gtkitemfactory,gtkpreview,gtkrc}.c: Include
config.h. Protect inclusion of <sys/param.h>, <sys/time.h>, and
<unistd.h> appropriately.
* gtk/gtkdnd.c: Merge in Win32 version (which doesn't do much).
Use ABS() (from <glib.h>) instead of abs().
* gtk/gtkfilesel.c: Moved Win32-specific includes after inclusion
of gtk (and thus glib) headers, so that WIN32 will be
defined. With MS C, include <direct.h> for mkdir prototype.
* gtk/gtkitemfactory.c (gtk_item_factory_callback_marshal): Add
some casts, needed by MS C.
* gtk/{gtklayout,gtkplug}.c: Merge in Win32 version (which isn't
implemented).
* gtk/gtkmain.c: Include gdk/gdkx.h for GDK_WINDOWING. Include
<X11/Xlocale.h> only on X11 platform, otherwise <locale.h>. Use
G_SEARCHPATH_SEPARATOR_S and g_module_build_path.
* gtk/gtkmain.h: Mark variables for export/import on Win32.
* gtk/gtkrange.c (gtk_range_motion_notify): Set mods also in case
the event is not a hint, or its window is not the slider. Needed
on Win32, at least.
* gtk/gtkrc.c: Include config.h and gdk/gdkx.h. Use <locale.h>
unless on X11. Skip \r chars, too. Use G_DIR_SEPARATOR and
G_SEARCHPATH_SEPARATOR(_S). Use g_path_is_absolute. On Win32, use
a subdirectory of the Windows directory as gtk system
configuration directory.
* gtk/gtkselection.c: No chunks on Win32.
* gtk/gtksocket.c: Not implemented on Win32.
* gtk/gtkthemes.c (gtk_theme_engine_get): Use g_module_build_path.
* gtk/makeenums.h: Include gdkprivate.h after gdk.h.
* gtk/testrgb.c: Use dynamically allocated buffer. Use GTimers.
1999-03-15 00:03:37 +00:00
|
|
|
printf ("GTKTYPEBUILTINS_VAR GtkType %s;\n", type_macro);
|
1998-06-09 07:11:55 +00:00
|
|
|
}
|
|
|
|
if (gen_entries)
|
|
|
|
{
|
|
|
|
printf (" { \"%s\", &%s,\n", type_name, type_macro);
|
|
|
|
if (generate_1 == "BOXED")
|
|
|
|
printf (" GTK_TYPE_%s, NULL },\n", generate_1);
|
|
|
|
else
|
|
|
|
printf (" GTK_TYPE_%s, %s_values },\n", generate_1, type_ident);
|
|
|
|
}
|
|
|
|
if (gen_vars)
|
|
|
|
{
|
|
|
|
printf ("GtkType %s = 0;\n", type_macro);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# skip scheme comments
|
|
|
|
";" {
|
|
|
|
sub (";.*", "");
|
|
|
|
}
|
|
|
|
|
|
|
|
# parse keywords
|
|
|
|
|
|
|
|
/\(define-enum/ {
|
|
|
|
if ($2 == "")
|
|
|
|
printf ("huh? define-enum keyword without arg?\n") > "/dev/stderr";
|
|
|
|
else
|
|
|
|
{
|
|
|
|
set_type($2);
|
|
|
|
generate("ENUM");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/\(define-flags/ {
|
|
|
|
if ($2 == "")
|
|
|
|
printf ("huh? define-flags keyword without arg?\n") > "/dev/stderr";
|
|
|
|
else
|
|
|
|
{
|
|
|
|
set_type($2);
|
|
|
|
generate("FLAGS");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/\(define-boxed/ {
|
|
|
|
if ($2 == "")
|
|
|
|
printf ("huh? define-boxed keyword without arg?\n") > "/dev/stderr";
|
|
|
|
else
|
|
|
|
{
|
|
|
|
set_type($2);
|
|
|
|
generate("BOXED");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
END {
|
|
|
|
if (gen_macros)
|
|
|
|
printf("\n#define\tGTK_TYPE_NUM_BUILTINS\t(%u)\n", type_counter);
|
|
|
|
}
|