summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Janik <timj@gtk.org>2001-11-21 17:49:34 +0000
committerTim Janik <timj@src.gnome.org>2001-11-21 17:49:34 +0000
commit860905c445db25e6b1b6ccb3df555f0c1ada48b5 (patch)
tree94eaab9e0b192b222993e6876d14c208a0f12c7a
parent2bbd00a2633bb5a6a7441803061f1a57ed9f20c9 (diff)
put newly created param spec types into a global array.GOBJECT_GType_guint
Wed Nov 21 17:23:33 2001 Tim Janik <timj@gtk.org> * gparamspecs.[hc]: put newly created param spec types into a global array. * gboxed.[hc]: moved boxed types with _get_type() function here, for: G_TYPE_CLOSURE, G_TYPE_VALUE, G_TYPE_VALUE_ARRAY, G_TYPE_GSTRING. * gtype.h: removed fundamental branch APIs and derived enum values.
-rw-r--r--docs/reference/glib/tmpl/glib-unused.sgml6
-rw-r--r--docs/reference/glib/tmpl/iochannels.sgml4
-rw-r--r--docs/reference/glib/tmpl/messages.sgml6
-rw-r--r--docs/reference/glib/tmpl/patterns.sgml6
-rw-r--r--docs/reference/gobject/tmpl/gtype.sgml24
-rw-r--r--gobject/ChangeLog12
-rw-r--r--gobject/gboxed.c69
-rw-r--r--gobject/gboxed.h17
-rw-r--r--gobject/gparamspecs.c36
-rw-r--r--gobject/gparamspecs.h32
-rw-r--r--gobject/gtype.c5
-rw-r--r--gobject/gtype.h37
12 files changed, 151 insertions, 103 deletions
diff --git a/docs/reference/glib/tmpl/glib-unused.sgml b/docs/reference/glib/tmpl/glib-unused.sgml
index 321291813..efacb586f 100644
--- a/docs/reference/glib/tmpl/glib-unused.sgml
+++ b/docs/reference/glib/tmpl/glib-unused.sgml
@@ -200,6 +200,12 @@ i.e. just the <filename>foo</filename> in <filename>/usr/bin/foo</filename>.
@Returns:
+<!-- ##### VARIABLE g_log_domain_glib ##### -->
+<para>
+The log domain used for messages logged by GLib itself.
+</para>
+
+
<!-- ##### FUNCTION g_main_add_poll ##### -->
<para>
Adds a file descriptor to be polled.
diff --git a/docs/reference/glib/tmpl/iochannels.sgml b/docs/reference/glib/tmpl/iochannels.sgml
index 88b676067..31667b85c 100644
--- a/docs/reference/glib/tmpl/iochannels.sgml
+++ b/docs/reference/glib/tmpl/iochannels.sgml
@@ -449,10 +449,10 @@ g_io_channel_set_flags().
</para>
@G_IO_FLAG_APPEND: turns on append mode, corresponds to %O_APPEND (see the
- documentation of the Unix <function>open()</function> syscall).
+ documentation of the Unix <function>open()</function> syscall).
@G_IO_FLAG_NONBLOCK: turns on nonblocking mode, corresponds to
%O_NONBLOCK/%O_NDELAY (see the documentation of the Unix
- <function>open()</function> syscall).
+ <function>open()</function> syscall).
@G_IO_FLAG_IS_READABLE: indicates that the io channel is readable. This flag
can not be changed.
@G_IO_FLAG_IS_WRITEABLE: indicates that the io channel is writable. This flag
diff --git a/docs/reference/glib/tmpl/messages.sgml b/docs/reference/glib/tmpl/messages.sgml
index 9e38cc42f..7a05c74a6 100644
--- a/docs/reference/glib/tmpl/messages.sgml
+++ b/docs/reference/glib/tmpl/messages.sgml
@@ -38,12 +38,6 @@ INCLUDES = \
-<!-- ##### VARIABLE g_log_domain_glib ##### -->
-<para>
-The log domain used for messages logged by GLib itself.
-</para>
-
-
<!-- ##### MACRO G_LOG_FATAL_MASK ##### -->
<para>
GLib log levels that are considered fatal by default.
diff --git a/docs/reference/glib/tmpl/patterns.sgml b/docs/reference/glib/tmpl/patterns.sgml
index 87b8f8f55..7a35b8ec9 100644
--- a/docs/reference/glib/tmpl/patterns.sgml
+++ b/docs/reference/glib/tmpl/patterns.sgml
@@ -25,6 +25,12 @@ g_pattern_spec_new() and use g_pattern_match_string() instead of
g_pattern_match_simple(). This avoids the overhead of repeated
pattern compilation.
+<!-- ##### SECTION See_Also ##### -->
+<para>
+
+</para>
+
+
<!-- ##### STRUCT GPatternSpec ##### -->
<para>
A <structname>GPatternSpec</structname> is the 'compiled' form of a pattern.
diff --git a/docs/reference/gobject/tmpl/gtype.sgml b/docs/reference/gobject/tmpl/gtype.sgml
index 33abba9ce..c725a54c9 100644
--- a/docs/reference/gobject/tmpl/gtype.sgml
+++ b/docs/reference/gobject/tmpl/gtype.sgml
@@ -202,30 +202,6 @@ The predefined identifiers of the reserved fundamental types.
@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_LAST_FUNDAMENTAL: Last reserved fundamental type ID.
-@G_TYPE_CLOSURE:
-@G_TYPE_VALUE:
-@G_TYPE_VALUE_ARRAY:
-@G_TYPE_GSTRING:
-@G_TYPE_PARAM_CHAR: Identifier for the "#GParamSpecChar" type.
-@G_TYPE_PARAM_UCHAR: Identifier for the "#GParamSpecUChar" type.
-@G_TYPE_PARAM_BOOLEAN: Identifier for the "#GParamSpecBoolean" type.
-@G_TYPE_PARAM_INT: Identifier for the "#GParamSpecInt" type.
-@G_TYPE_PARAM_UINT: Identifier for the "#GParamSpecUInt" type.
-@G_TYPE_PARAM_LONG: Identifier for the "#GParamSpecLong" type.
-@G_TYPE_PARAM_ULONG: Identifier for the "#GParamSpecULong" type.
-@G_TYPE_PARAM_INT64:
-@G_TYPE_PARAM_UINT64:
-@G_TYPE_PARAM_UNICHAR:
-@G_TYPE_PARAM_ENUM: Identifier for the "#GParamSpecEnum" type.
-@G_TYPE_PARAM_FLAGS: Identifier for the "#GParamSpecFlags" type.
-@G_TYPE_PARAM_FLOAT: Identifier for the "#GParamSpecFloat" type.
-@G_TYPE_PARAM_DOUBLE: Identifier for the "#GParamSpecDouble" type.
-@G_TYPE_PARAM_STRING: Identifier for the "#GParamSpecString" type.
-@G_TYPE_PARAM_PARAM: Identifier for the "#GParamSpecParam" type.
-@G_TYPE_PARAM_BOXED: Identifier for the "#GParamSpecBoxed" type.
-@G_TYPE_PARAM_POINTER: Identifier for the "#GParamSpecPointer" type.
-@G_TYPE_PARAM_VALUE_ARRAY: Identifier for the "#GParamSpecValueArray" type.
-@G_TYPE_PARAM_OBJECT: Identifier for the "#GParamSpecObject" type.
<!-- ##### STRUCT GTypeInterface ##### -->
<para>
diff --git a/gobject/ChangeLog b/gobject/ChangeLog
index 038c554ad..91a7ec332 100644
--- a/gobject/ChangeLog
+++ b/gobject/ChangeLog
@@ -1,3 +1,15 @@
+Wed Nov 21 17:23:33 2001 Tim Janik <timj@gtk.org>
+
+ * gparamspecs.[hc]: put newly created param spec types into a
+ global array.
+
+ * gboxed.[hc]: moved boxed types with _get_type() function here,
+ for: G_TYPE_CLOSURE, G_TYPE_VALUE, G_TYPE_VALUE_ARRAY,
+ G_TYPE_GSTRING.
+
+ * gtype.h: removed fundamental branch APIs and derived enum
+ values.
+
2001-11-19 jacob berkman <jacob@ximian.com>
* gobjectnotifyqueue.c: include glib-object.h rather than
diff --git a/gobject/gboxed.c b/gobject/gboxed.c
index c40011583..02adca97c 100644
--- a/gobject/gboxed.c
+++ b/gobject/gboxed.c
@@ -125,35 +125,54 @@ g_boxed_type_init (void) /* sync with gtype.c */
type = g_type_register_fundamental (G_TYPE_BOXED, "GBoxed", &info, &finfo,
G_TYPE_FLAG_ABSTRACT | G_TYPE_FLAG_VALUE_ABSTRACT);
g_assert (type == G_TYPE_BOXED);
+}
- /* boxed: G_TYPE_CLOSURE
- */
- type = g_boxed_type_register_static ("GClosure",
- (GBoxedCopyFunc) g_closure_ref,
- (GBoxedFreeFunc) g_closure_unref);
- g_assert (type == G_TYPE_CLOSURE);
+GType
+g_closure_get_type (void)
+{
+ static GType type_id = 0;
- /* boxed: G_TYPE_VALUE
- */
- type = g_boxed_type_register_static ("GValue",
- value_copy,
- value_free);
- g_assert (type == G_TYPE_VALUE);
+ if (!type_id)
+ type_id = g_boxed_type_register_static ("GClosure",
+ (GBoxedCopyFunc) g_closure_ref,
+ (GBoxedFreeFunc) g_closure_unref);
+ return type_id;
+}
- /* boxed: G_TYPE_VALUE_ARRAY
- */
- type = g_boxed_type_register_static ("GValueArray",
- (GBoxedCopyFunc) g_value_array_copy,
- (GBoxedFreeFunc) g_value_array_free);
- g_assert (type == G_TYPE_VALUE_ARRAY);
+GType
+g_value_get_type (void)
+{
+ static GType type_id = 0;
- /* boxed: G_TYPE_GSTRING
- * yes, the naming is a bit odd, but GString is obviously not G_TYPE_STRING
- */
- type = g_boxed_type_register_static ("GString",
- gstring_copy,
- gstring_free);
- g_assert (type == G_TYPE_GSTRING);
+ if (!type_id)
+ type_id = g_boxed_type_register_static ("GValue",
+ value_copy,
+ value_free);
+ return type_id;
+}
+
+GType
+g_value_array_get_type (void)
+{
+ static GType type_id = 0;
+
+ if (!type_id)
+ type_id = g_boxed_type_register_static ("GValueArray",
+ (GBoxedCopyFunc) g_value_array_copy,
+ (GBoxedFreeFunc) g_value_array_free);
+ return type_id;
+}
+
+GType
+g_gstring_get_type (void)
+{
+ static GType type_id = 0;
+
+ if (!type_id)
+ type_id = g_boxed_type_register_static ("GString", /* the naming is a bit odd, but GString is obviously not G_TYPE_STRING */
+ gstring_copy,
+ gstring_free);
+ return type_id;
}
static void
diff --git a/gobject/gboxed.h b/gobject/gboxed.h
index df92251c5..af26562b7 100644
--- a/gobject/gboxed.h
+++ b/gobject/gboxed.h
@@ -56,12 +56,21 @@ GType g_boxed_type_register_static (const gchar *name,
GBoxedFreeFunc boxed_free);
-/* --- marshaller specific --- */
-void g_value_set_boxed_take_ownership (GValue *value,
- gconstpointer v_boxed);
-
+/* --- GLib boxed types --- */
+#define G_TYPE_CLOSURE (g_closure_get_type ())
+#define G_TYPE_VALUE (g_value_get_type ())
+#define G_TYPE_VALUE_ARRAY (g_value_array_get_type ())
+#define G_TYPE_GSTRING (g_gstring_get_type ())
+/* --- internal (marshaller specific) --- */
+void g_value_set_boxed_take_ownership (GValue *value,
+ gconstpointer v_boxed);
+GType g_closure_get_type (void) G_GNUC_CONST;
+GType g_value_get_type (void) G_GNUC_CONST;
+GType g_value_array_get_type (void) G_GNUC_CONST;
+GType g_gstring_get_type (void) G_GNUC_CONST;
+
G_END_DECLS
#endif /* __G_BOXED_H__ */
diff --git a/gobject/gparamspecs.c b/gobject/gparamspecs.c
index eda227338..75bbc68a3 100644
--- a/gobject/gparamspecs.c
+++ b/gobject/gparamspecs.c
@@ -959,10 +959,17 @@ param_object_values_cmp (GParamSpec *pspec,
/* --- type initialization --- */
+GType *g_param_spec_types = NULL;
+
void
g_param_spec_types_init (void) /* sync with gtype.c */
{
- GType type;
+ const guint n_types = 20;
+ GType type, *spec_types, *spec_types_bound;
+
+ g_param_spec_types = g_new0 (GType, n_types);
+ spec_types = g_param_spec_types;
+ spec_types_bound = g_param_spec_types + n_types;
/* G_TYPE_PARAM_CHAR
*/
@@ -978,6 +985,7 @@ g_param_spec_types_init (void) /* sync with gtype.c */
param_int_values_cmp, /* values_cmp */
};
type = g_param_type_register_static ("GParamChar", &pspec_info);
+ *spec_types++ = type;
g_assert (type == G_TYPE_PARAM_CHAR);
}
@@ -995,6 +1003,7 @@ g_param_spec_types_init (void) /* sync with gtype.c */
param_uint_values_cmp, /* values_cmp */
};
type = g_param_type_register_static ("GParamUChar", &pspec_info);
+ *spec_types++ = type;
g_assert (type == G_TYPE_PARAM_UCHAR);
}
@@ -1012,6 +1021,7 @@ g_param_spec_types_init (void) /* sync with gtype.c */
param_int_values_cmp, /* values_cmp */
};
type = g_param_type_register_static ("GParamBoolean", &pspec_info);
+ *spec_types++ = type;
g_assert (type == G_TYPE_PARAM_BOOLEAN);
}
@@ -1029,6 +1039,7 @@ g_param_spec_types_init (void) /* sync with gtype.c */
param_int_values_cmp, /* values_cmp */
};
type = g_param_type_register_static ("GParamInt", &pspec_info);
+ *spec_types++ = type;
g_assert (type == G_TYPE_PARAM_INT);
}
@@ -1046,6 +1057,7 @@ g_param_spec_types_init (void) /* sync with gtype.c */
param_uint_values_cmp, /* values_cmp */
};
type = g_param_type_register_static ("GParamUInt", &pspec_info);
+ *spec_types++ = type;
g_assert (type == G_TYPE_PARAM_UINT);
}
@@ -1063,6 +1075,7 @@ g_param_spec_types_init (void) /* sync with gtype.c */
param_long_values_cmp, /* values_cmp */
};
type = g_param_type_register_static ("GParamLong", &pspec_info);
+ *spec_types++ = type;
g_assert (type == G_TYPE_PARAM_LONG);
}
@@ -1080,6 +1093,7 @@ g_param_spec_types_init (void) /* sync with gtype.c */
param_ulong_values_cmp, /* values_cmp */
};
type = g_param_type_register_static ("GParamULong", &pspec_info);
+ *spec_types++ = type;
g_assert (type == G_TYPE_PARAM_ULONG);
}
@@ -1097,6 +1111,7 @@ g_param_spec_types_init (void) /* sync with gtype.c */
param_int64_values_cmp, /* values_cmp */
};
type = g_param_type_register_static ("GParamInt64", &pspec_info);
+ *spec_types++ = type;
g_assert (type == G_TYPE_PARAM_INT64);
}
@@ -1114,6 +1129,7 @@ g_param_spec_types_init (void) /* sync with gtype.c */
param_uint64_values_cmp, /* values_cmp */
};
type = g_param_type_register_static ("GParamUInt64", &pspec_info);
+ *spec_types++ = type;
g_assert (type == G_TYPE_PARAM_UINT64);
}
@@ -1131,6 +1147,7 @@ g_param_spec_types_init (void) /* sync with gtype.c */
param_unichar_values_cmp, /* values_cmp */
};
type = g_param_type_register_static ("GParamUnichar", &pspec_info);
+ *spec_types++ = type;
g_assert (type == G_TYPE_PARAM_UNICHAR);
}
@@ -1148,6 +1165,7 @@ g_param_spec_types_init (void) /* sync with gtype.c */
param_long_values_cmp, /* values_cmp */
};
type = g_param_type_register_static ("GParamEnum", &pspec_info);
+ *spec_types++ = type;
g_assert (type == G_TYPE_PARAM_ENUM);
}
@@ -1165,6 +1183,7 @@ g_param_spec_types_init (void) /* sync with gtype.c */
param_ulong_values_cmp, /* values_cmp */
};
type = g_param_type_register_static ("GParamFlags", &pspec_info);
+ *spec_types++ = type;
g_assert (type == G_TYPE_PARAM_FLAGS);
}
@@ -1182,6 +1201,7 @@ g_param_spec_types_init (void) /* sync with gtype.c */
param_float_values_cmp, /* values_cmp */
};
type = g_param_type_register_static ("GParamFloat", &pspec_info);
+ *spec_types++ = type;
g_assert (type == G_TYPE_PARAM_FLOAT);
}
@@ -1199,6 +1219,7 @@ g_param_spec_types_init (void) /* sync with gtype.c */
param_double_values_cmp, /* values_cmp */
};
type = g_param_type_register_static ("GParamDouble", &pspec_info);
+ *spec_types++ = type;
g_assert (type == G_TYPE_PARAM_DOUBLE);
}
@@ -1216,6 +1237,7 @@ g_param_spec_types_init (void) /* sync with gtype.c */
param_string_values_cmp, /* values_cmp */
};
type = g_param_type_register_static ("GParamString", &pspec_info);
+ *spec_types++ = type;
g_assert (type == G_TYPE_PARAM_STRING);
}
@@ -1233,6 +1255,7 @@ g_param_spec_types_init (void) /* sync with gtype.c */
param_pointer_values_cmp, /* values_cmp */
};
type = g_param_type_register_static ("GParamParam", &pspec_info);
+ *spec_types++ = type;
g_assert (type == G_TYPE_PARAM_PARAM);
}
@@ -1250,6 +1273,7 @@ g_param_spec_types_init (void) /* sync with gtype.c */
param_boxed_values_cmp, /* values_cmp */
};
type = g_param_type_register_static ("GParamBoxed", &pspec_info);
+ *spec_types++ = type;
g_assert (type == G_TYPE_PARAM_BOXED);
}
@@ -1267,23 +1291,26 @@ g_param_spec_types_init (void) /* sync with gtype.c */
param_pointer_values_cmp, /* values_cmp */
};
type = g_param_type_register_static ("GParamPointer", &pspec_info);
+ *spec_types++ = type;
g_assert (type == G_TYPE_PARAM_POINTER);
}
/* G_TYPE_PARAM_VALUE_ARRAY
*/
{
- static const GParamSpecTypeInfo pspec_info = {
+ static /* const */ GParamSpecTypeInfo pspec_info = {
sizeof (GParamSpecValueArray), /* instance_size */
0, /* n_preallocs */
param_value_array_init, /* instance_init */
- G_TYPE_VALUE_ARRAY, /* value_type */
+ 0xdeadbeef, /* value_type, assigned further down */
param_value_array_finalize, /* finalize */
param_value_array_set_default, /* value_set_default */
param_value_array_validate, /* value_validate */
param_value_array_values_cmp, /* values_cmp */
};
+ pspec_info.value_type = G_TYPE_VALUE_ARRAY;
type = g_param_type_register_static ("GParamValueArray", &pspec_info);
+ *spec_types++ = type;
g_assert (type == G_TYPE_PARAM_VALUE_ARRAY);
}
@@ -1301,8 +1328,11 @@ g_param_spec_types_init (void) /* sync with gtype.c */
param_object_values_cmp, /* values_cmp */
};
type = g_param_type_register_static ("GParamObject", &pspec_info);
+ *spec_types++ = type;
g_assert (type == G_TYPE_PARAM_OBJECT);
}
+
+ g_assert (spec_types == spec_types_bound);
}
diff --git a/gobject/gparamspecs.h b/gobject/gparamspecs.h
index 075291ed4..0b7584ffe 100644
--- a/gobject/gparamspecs.h
+++ b/gobject/gparamspecs.h
@@ -33,44 +33,64 @@
G_BEGIN_DECLS
/* --- type macros --- */
+#define G_TYPE_PARAM_CHAR (g_param_spec_types[0])
#define G_IS_PARAM_SPEC_CHAR(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_CHAR))
#define G_PARAM_SPEC_CHAR(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_CHAR, GParamSpecChar))
+#define G_TYPE_PARAM_UCHAR (g_param_spec_types[1])
#define G_IS_PARAM_SPEC_UCHAR(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UCHAR))
#define G_PARAM_SPEC_UCHAR(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UCHAR, GParamSpecUChar))
+#define G_TYPE_PARAM_BOOLEAN (g_param_spec_types[2])
#define G_IS_PARAM_SPEC_BOOLEAN(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_BOOLEAN))
#define G_PARAM_SPEC_BOOLEAN(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_BOOLEAN, GParamSpecBoolean))
+#define G_TYPE_PARAM_INT (g_param_spec_types[3])
#define G_IS_PARAM_SPEC_INT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_INT))
#define G_PARAM_SPEC_INT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_INT, GParamSpecInt))
+#define G_TYPE_PARAM_UINT (g_param_spec_types[4])
#define G_IS_PARAM_SPEC_UINT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UINT))
#define G_PARAM_SPEC_UINT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UINT, GParamSpecUInt))
+#define G_TYPE_PARAM_LONG (g_param_spec_types[5])
#define G_IS_PARAM_SPEC_LONG(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_LONG))
#define G_PARAM_SPEC_LONG(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_LONG, GParamSpecLong))
+#define G_TYPE_PARAM_ULONG (g_param_spec_types[6])
#define G_IS_PARAM_SPEC_ULONG(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_ULONG))
#define G_PARAM_SPEC_ULONG(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_ULONG, GParamSpecULong))
-#define G_IS_PARAM_SPEC_INT64(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_INT64))
-#define G_PARAM_SPEC_INT64(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_INT64, GParamSpecInt64))
-#define G_IS_PARAM_SPEC_UINT64(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UINT64))
-#define G_PARAM_SPEC_UINT64(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UINT64, GParamSpecUInt64))
+#define G_TYPE_PARAM_INT64 (g_param_spec_types[7])
+#define G_IS_PARAM_SPEC_INT64(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_INT64))
+#define G_PARAM_SPEC_INT64(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_INT64, GParamSpecInt64))
+#define G_TYPE_PARAM_UINT64 (g_param_spec_types[8])
+#define G_IS_PARAM_SPEC_UINT64(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UINT64))
+#define G_PARAM_SPEC_UINT64(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UINT64, GParamSpecUInt64))
+#define G_TYPE_PARAM_UNICHAR (g_param_spec_types[9])
#define G_PARAM_SPEC_UNICHAR(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_UNICHAR, GParamSpecUnichar))
#define G_IS_PARAM_SPEC_UNICHAR(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_UNICHAR))
+#define G_TYPE_PARAM_ENUM (g_param_spec_types[10])
#define G_IS_PARAM_SPEC_ENUM(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_ENUM))
#define G_PARAM_SPEC_ENUM(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_ENUM, GParamSpecEnum))
+#define G_TYPE_PARAM_FLAGS (g_param_spec_types[11])
#define G_IS_PARAM_SPEC_FLAGS(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_FLAGS))
#define G_PARAM_SPEC_FLAGS(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_FLAGS, GParamSpecFlags))
+#define G_TYPE_PARAM_FLOAT (g_param_spec_types[12])
#define G_IS_PARAM_SPEC_FLOAT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_FLOAT))
#define G_PARAM_SPEC_FLOAT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_FLOAT, GParamSpecFloat))
+#define G_TYPE_PARAM_DOUBLE (g_param_spec_types[13])
#define G_IS_PARAM_SPEC_DOUBLE(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_DOUBLE))
#define G_PARAM_SPEC_DOUBLE(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_DOUBLE, GParamSpecDouble))
+#define G_TYPE_PARAM_STRING (g_param_spec_types[14])
#define G_IS_PARAM_SPEC_STRING(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_STRING))
#define G_PARAM_SPEC_STRING(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_STRING, GParamSpecString))
+#define G_TYPE_PARAM_PARAM (g_param_spec_types[15])
#define G_IS_PARAM_SPEC_PARAM(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_PARAM))
#define G_PARAM_SPEC_PARAM(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_PARAM, GParamSpecParam))
+#define G_TYPE_PARAM_BOXED (g_param_spec_types[16])
#define G_IS_PARAM_SPEC_BOXED(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_BOXED))
#define G_PARAM_SPEC_BOXED(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_BOXED, GParamSpecBoxed))
+#define G_TYPE_PARAM_POINTER (g_param_spec_types[17])
#define G_IS_PARAM_SPEC_POINTER(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_POINTER))
#define G_PARAM_SPEC_POINTER(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_POINTER, GParamSpecPointer))
+#define G_TYPE_PARAM_VALUE_ARRAY (g_param_spec_types[18])
#define G_IS_PARAM_SPEC_VALUE_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_VALUE_ARRAY))
#define G_PARAM_SPEC_VALUE_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_VALUE_ARRAY, GParamSpecValueArray))
+#define G_TYPE_PARAM_OBJECT (g_param_spec_types[19])
#define G_IS_PARAM_SPEC_OBJECT(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_OBJECT))
#define G_PARAM_SPEC_OBJECT(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_OBJECT, GParamSpecObject))
@@ -362,6 +382,10 @@ GParamSpec* g_param_spec_object (const gchar *name,
GType object_type,
GParamFlags flags);
+
+/* --- internal --- */
+GLIB_VAR GType *g_param_spec_types;
+
G_END_DECLS
#endif /* __G_PARAMSPECS_H__ */
diff --git a/gobject/gtype.c b/gobject/gtype.c
index 427ff2f0b..ed567b9b9 100644
--- a/gobject/gtype.c
+++ b/gobject/gtype.c
@@ -255,6 +255,7 @@ static TypeNode ***static_type_nodes = NULL;
static inline TypeNode*
lookup_type_node_L (register GType utype)
{
+#define G_TYPE_BRANCH_SEQNO(type) ((type) >> 8)
register GType ftype = G_TYPE_FUNDAMENTAL (utype);
register GType b_seqno = G_TYPE_BRANCH_SEQNO (utype);
@@ -278,7 +279,7 @@ type_node_any_new_W (TypeNode *pnode,
n_supers = pnode ? pnode->n_supers + 1 : 0;
branch_last = static_branch_seqnos[ftype]++;
- type = G_TYPE_DERIVE_ID (ftype, branch_last);
+ type = ftype | (branch_last << 8); // FIXME: G_TYPE_DERIVE_ID (ftype, branch_last);
g_assert ((type & G_TYPE_FLAG_RESERVED_ID_BIT) == 0);
if (!branch_last || g_bit_storage (branch_last - 1) < g_bit_storage (static_branch_seqnos[ftype] - 1))
static_type_nodes[ftype] = g_renew (TypeNode*, static_type_nodes[ftype], 1 << g_bit_storage (static_branch_seqnos[ftype] - 1));
@@ -2254,7 +2255,7 @@ g_type_is_a (GType type,
}
guint
-g_type_fundamental_branch_last (GType type)
+_g_type_fundamental_branch_last (GType type)
{
GType ftype = G_TYPE_FUNDAMENTAL (type);
guint last_type;
diff --git a/gobject/gtype.h b/gobject/gtype.h
index aeb770d2f..17da8b277 100644
--- a/gobject/gtype.h
+++ b/gobject/gtype.h
@@ -31,8 +31,6 @@ G_BEGIN_DECLS
*/
#define G_TYPE_FUNDAMENTAL(type) ((type) & 0xff)
#define G_TYPE_FUNDAMENTAL_MAX (0xff)
-#define G_TYPE_DERIVE_ID(ptype, branch_seqno) (G_TYPE_FUNDAMENTAL (ptype) | ((branch_seqno) << 8))
-#define G_TYPE_BRANCH_SEQNO(type) ((type) >> 8)
#define G_TYPE_FUNDAMENTAL_LAST ((GType) g_type_fundamental_last ())
@@ -71,40 +69,13 @@ typedef enum /*< skip >*/
G_TYPE_RESERVED_BSE_FIRST,
G_TYPE_RESERVED_BSE_LAST = G_TYPE_RESERVED_BSE_FIRST + 15,
G_TYPE_RESERVED_LAST_FUNDAMENTAL,
-
- /* derived type ids */
- G_TYPE_CLOSURE = G_TYPE_DERIVE_ID (G_TYPE_BOXED, 1),
- G_TYPE_VALUE = G_TYPE_DERIVE_ID (G_TYPE_BOXED, 2),
- G_TYPE_VALUE_ARRAY = G_TYPE_DERIVE_ID (G_TYPE_BOXED, 3),
- G_TYPE_GSTRING = G_TYPE_DERIVE_ID (G_TYPE_BOXED, 4),
- G_TYPE_PARAM_CHAR = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 1),
- G_TYPE_PARAM_UCHAR = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 2),
- G_TYPE_PARAM_BOOLEAN = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 3),
- G_TYPE_PARAM_INT = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 4),
- G_TYPE_PARAM_UINT = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 5),
- G_TYPE_PARAM_LONG = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 6),
- G_TYPE_PARAM_ULONG = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 7),
- G_TYPE_PARAM_INT64 = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 8),
- G_TYPE_PARAM_UINT64 = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 9),
- G_TYPE_PARAM_UNICHAR = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 10),
- G_TYPE_PARAM_ENUM = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 11),
- G_TYPE_PARAM_FLAGS = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 12),
- G_TYPE_PARAM_FLOAT = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 13),
- G_TYPE_PARAM_DOUBLE = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 14),
- G_TYPE_PARAM_STRING = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 15),
- G_TYPE_PARAM_PARAM = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 16),
- G_TYPE_PARAM_BOXED = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 17),
- G_TYPE_PARAM_POINTER = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 18),
- G_TYPE_PARAM_VALUE_ARRAY = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 19),
- G_TYPE_PARAM_OBJECT = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 20)
-
} GTypeFundamentals;
/* Type Checking Macros
*/
-#define G_TYPE_IS_FUNDAMENTAL(type) (G_TYPE_BRANCH_SEQNO (type) == 0)
-#define G_TYPE_IS_DERIVED(type) (G_TYPE_BRANCH_SEQNO (type) > 0)
+#define G_TYPE_IS_FUNDAMENTAL(type) ((type) <= G_TYPE_FUNDAMENTAL_MAX)
+#define G_TYPE_IS_DERIVED(type) ((type) > G_TYPE_FUNDAMENTAL_MAX)
#define G_TYPE_IS_INTERFACE(type) (G_TYPE_FUNDAMENTAL (type) == G_TYPE_INTERFACE)
#define G_TYPE_IS_CLASSED(type) (g_type_test_flags ((type), G_TYPE_FLAG_CLASSED))
#define G_TYPE_IS_INSTANTIATABLE(type) (g_type_test_flags ((type), G_TYPE_FLAG_INSTANTIATABLE))
@@ -119,7 +90,7 @@ typedef enum /*< skip >*/
/* Typedefs
*/
-typedef guint32 GType;
+typedef gsize GType;
typedef struct _GValue GValue;
typedef union _GTypeCValue GTypeCValue;
typedef struct _GTypePlugin GTypePlugin;
@@ -200,7 +171,7 @@ GType g_type_next_base (GType leaf_type
GType root_type);
gboolean g_type_is_a (GType type,
GType is_a_type);
-guint g_type_fundamental_branch_last (GType type);
+//FIXME: guint g_type_fundamental_branch_last (GType type);
gpointer g_type_class_ref (GType type);
gpointer g_type_class_peek (GType type);
void g_type_class_unref (gpointer g_class);