From 5f04f01ff1bd03b236ce657c60e2ed1bd10adbc8 Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Sun, 25 Nov 2001 21:59:53 +0000 Subject: [PATCH] removed enum GTypeFundamentals. use macros to provide the constant Sun Nov 25 22:33:32 2001 Tim Janik * gtype.h: removed enum GTypeFundamentals. use macros to provide the constant fundamental type IDs, so they all return numbers of type GType, and not int. sizeof(GTypeFundamentals) < sizeof(GType) problem reported and fix sugegsted by Havoc. --- docs/reference/glib/tmpl/windows.sgml | 4 +- docs/reference/gobject/tmpl/gtype.sgml | 30 +++++++++-- gobject/ChangeLog | 9 +++- gobject/gtype.h | 75 +++++++++++++------------- 4 files changed, 73 insertions(+), 45 deletions(-) diff --git a/docs/reference/glib/tmpl/windows.sgml b/docs/reference/glib/tmpl/windows.sgml index 58517f31a..774e4425e 100644 --- a/docs/reference/glib/tmpl/windows.sgml +++ b/docs/reference/glib/tmpl/windows.sgml @@ -96,12 +96,12 @@ included in. On non-Windows platforms, expands to nothing. -@static: empty or "static". +@static: empty or "static". @dll_name: the name of the (pointer to the) char array where the DLL name will be stored. If this is used, you must also include windows.h. If you need a more complex DLL entry point function, you cannot use this. - + @static: @dll_name: diff --git a/docs/reference/gobject/tmpl/gtype.sgml b/docs/reference/gobject/tmpl/gtype.sgml index 558118d4e..fe6ce1ca3 100644 --- a/docs/reference/gobject/tmpl/gtype.sgml +++ b/docs/reference/gobject/tmpl/gtype.sgml @@ -187,11 +187,35 @@ The predefined identifiers of the reserved fundamental types. @G_TYPE_BOXED: Identifier for the "#GBoxed" type. @G_TYPE_PARAM: Identifier for the "#GParam" type. @G_TYPE_OBJECT: Identifier for the "#GObject" type. -@G_TYPE_RESERVED_GLIB_FIRST: -@G_TYPE_RESERVED_GLIB_LAST: @G_TYPE_RESERVED_BSE_FIRST: First fundamental type ID reserved for BSE. @G_TYPE_RESERVED_BSE_LAST: Last fundamental type ID reserved for BSE. -@G_TYPE_RESERVED_USER_FIRST: +@G_TYPE_RESERVED_LAST_FUNDAMENTAL: +@G_TYPE_CONSTANT_TYPES: +@G_TYPE_CLOSURE: +@G_TYPE_VALUE: +@G_TYPE_VALUE_ARRAY: +@G_TYPE_GSTRING: +@G_TYPE_PARAM_CHAR: +@G_TYPE_PARAM_UCHAR: +@G_TYPE_PARAM_BOOLEAN: +@G_TYPE_PARAM_INT: +@G_TYPE_PARAM_UINT: +@G_TYPE_PARAM_LONG: +@G_TYPE_PARAM_ULONG: +@G_TYPE_PARAM_INT64: +@G_TYPE_PARAM_UINT64: +@G_TYPE_PARAM_UNICHAR: +@G_TYPE_PARAM_ENUM: +@G_TYPE_PARAM_FLAGS: +@G_TYPE_PARAM_FLOAT: +@G_TYPE_PARAM_DOUBLE: +@G_TYPE_PARAM_STRING: +@G_TYPE_PARAM_PARAM: +@G_TYPE_PARAM_BOXED: +@G_TYPE_PARAM_POINTER: +@G_TYPE_PARAM_VALUE_ARRAY: +@G_TYPE_PARAM_CLOSURE: +@G_TYPE_PARAM_OBJECT: diff --git a/gobject/ChangeLog b/gobject/ChangeLog index 7e8edb229..55fa4cf2c 100644 --- a/gobject/ChangeLog +++ b/gobject/ChangeLog @@ -1,8 +1,15 @@ +Sun Nov 25 22:33:32 2001 Tim Janik + + * gtype.h: removed enum GTypeFundamentals. use macros + to provide the constant fundamental type IDs, so they + all return numbers of type GType, and not int. + sizeof(GTypeFundamentals) < sizeof(GType) problem reported + and fix sugegsted by Havoc. + 2001-11-23 Hans Breuer * gobject.def : updated externals - Mon Nov 19 14:35:56 2001 Owen Taylor * *.h: Improve the detection of invalid includes by moving diff --git a/gobject/gtype.h b/gobject/gtype.h index 3f6599c53..b8701ca87 100644 --- a/gobject/gtype.h +++ b/gobject/gtype.h @@ -31,47 +31,44 @@ G_BEGIN_DECLS */ #define G_TYPE_FUNDAMENTAL(type) (g_type_fundamental (type)) #define G_TYPE_FUNDAMENTAL_MAX (255 << G_TYPE_FUNDAMENTAL_SHIFT) -#define G_TYPE_FUNDAMENTAL_SHIFT (2) - -/* Constant fundamental types +/* Constant fundamental types, + * introduced by g_type_init(). */ -typedef enum /*< skip >*/ -{ - /* standard types, introduced by g_type_init() */ - G_TYPE_INVALID = 0 << G_TYPE_FUNDAMENTAL_SHIFT, - G_TYPE_NONE = 1 << G_TYPE_FUNDAMENTAL_SHIFT, - G_TYPE_INTERFACE = 2 << G_TYPE_FUNDAMENTAL_SHIFT, - - /* GLib type IDs */ - G_TYPE_CHAR = 3 << G_TYPE_FUNDAMENTAL_SHIFT, - G_TYPE_UCHAR = 4 << G_TYPE_FUNDAMENTAL_SHIFT, - G_TYPE_BOOLEAN = 5 << G_TYPE_FUNDAMENTAL_SHIFT, - G_TYPE_INT = 6 << G_TYPE_FUNDAMENTAL_SHIFT, - G_TYPE_UINT = 7 << G_TYPE_FUNDAMENTAL_SHIFT, - G_TYPE_LONG = 8 << G_TYPE_FUNDAMENTAL_SHIFT, - G_TYPE_ULONG = 9 << G_TYPE_FUNDAMENTAL_SHIFT, - G_TYPE_INT64 = 10 << G_TYPE_FUNDAMENTAL_SHIFT, - G_TYPE_UINT64 = 11 << G_TYPE_FUNDAMENTAL_SHIFT, - G_TYPE_ENUM = 12 << G_TYPE_FUNDAMENTAL_SHIFT, - G_TYPE_FLAGS = 13 << G_TYPE_FUNDAMENTAL_SHIFT, - G_TYPE_FLOAT = 14 << G_TYPE_FUNDAMENTAL_SHIFT, - G_TYPE_DOUBLE = 15 << G_TYPE_FUNDAMENTAL_SHIFT, - G_TYPE_STRING = 16 << G_TYPE_FUNDAMENTAL_SHIFT, - G_TYPE_POINTER = 17 << G_TYPE_FUNDAMENTAL_SHIFT, - G_TYPE_BOXED = 18 << G_TYPE_FUNDAMENTAL_SHIFT, - G_TYPE_PARAM = 19 << G_TYPE_FUNDAMENTAL_SHIFT, - G_TYPE_OBJECT = 20 << G_TYPE_FUNDAMENTAL_SHIFT, - - /* reserved fundamental type ids, - * mail gtk-devel-list@redhat.com for reservations - */ - G_TYPE_RESERVED_GLIB_FIRST = 21 << G_TYPE_FUNDAMENTAL_SHIFT, - G_TYPE_RESERVED_GLIB_LAST = 31 << G_TYPE_FUNDAMENTAL_SHIFT, - G_TYPE_RESERVED_BSE_FIRST = 32 << G_TYPE_FUNDAMENTAL_SHIFT, - G_TYPE_RESERVED_BSE_LAST = 48 << G_TYPE_FUNDAMENTAL_SHIFT, - G_TYPE_RESERVED_USER_FIRST = 49 << G_TYPE_FUNDAMENTAL_SHIFT -} GTypeFundamentals; +#define G_TYPE_INVALID G_TYPE_MAKE_FUNDAMENTAL (0) +#define G_TYPE_NONE G_TYPE_MAKE_FUNDAMENTAL (1) +#define G_TYPE_INTERFACE G_TYPE_MAKE_FUNDAMENTAL (2) +#define G_TYPE_CHAR G_TYPE_MAKE_FUNDAMENTAL (3) +#define G_TYPE_UCHAR G_TYPE_MAKE_FUNDAMENTAL (4) +#define G_TYPE_BOOLEAN G_TYPE_MAKE_FUNDAMENTAL (5) +#define G_TYPE_INT G_TYPE_MAKE_FUNDAMENTAL (6) +#define G_TYPE_UINT G_TYPE_MAKE_FUNDAMENTAL (7) +#define G_TYPE_LONG G_TYPE_MAKE_FUNDAMENTAL (8) +#define G_TYPE_ULONG G_TYPE_MAKE_FUNDAMENTAL (9) +#define G_TYPE_INT64 G_TYPE_MAKE_FUNDAMENTAL (10) +#define G_TYPE_UINT64 G_TYPE_MAKE_FUNDAMENTAL (11) +#define G_TYPE_ENUM G_TYPE_MAKE_FUNDAMENTAL (12) +#define G_TYPE_FLAGS G_TYPE_MAKE_FUNDAMENTAL (13) +#define G_TYPE_FLOAT G_TYPE_MAKE_FUNDAMENTAL (14) +#define G_TYPE_DOUBLE G_TYPE_MAKE_FUNDAMENTAL (15) +#define G_TYPE_STRING G_TYPE_MAKE_FUNDAMENTAL (16) +#define G_TYPE_POINTER G_TYPE_MAKE_FUNDAMENTAL (17) +#define G_TYPE_BOXED G_TYPE_MAKE_FUNDAMENTAL (18) +#define G_TYPE_PARAM G_TYPE_MAKE_FUNDAMENTAL (19) +#define G_TYPE_OBJECT G_TYPE_MAKE_FUNDAMENTAL (20) + + +/* Reserved fundamental type numbers to create new fundamental + * type IDs with G_TYPE_MAKE_FUNDAMENTAL(). + * Send email to gtk-devel-list@redhat.com for reservations. + */ +#define G_TYPE_FUNDAMENTAL_SHIFT (2) +#define G_TYPE_MAKE_FUNDAMENTAL(x) ((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT)) +#define G_TYPE_RESERVED_GLIB_FIRST (21) +#define G_TYPE_RESERVED_GLIB_LAST (31) +#define G_TYPE_RESERVED_BSE_FIRST (32) +#define G_TYPE_RESERVED_BSE_LAST (48) +#define G_TYPE_RESERVED_USER_FIRST (49) /* Type Checking Macros