put newly created param spec types into a global array. GOBJECT_GType_guint
authorTim Janik <timj@gtk.org>
Wed, 21 Nov 2001 17:49:34 +0000 (17:49 +0000)
committerTim Janik <timj@src.gnome.org>
Wed, 21 Nov 2001 17:49:34 +0000 (17:49 +0000)
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.

12 files changed:
docs/reference/glib/tmpl/glib-unused.sgml
docs/reference/glib/tmpl/iochannels.sgml
docs/reference/glib/tmpl/messages.sgml
docs/reference/glib/tmpl/patterns.sgml
docs/reference/gobject/tmpl/gtype.sgml
gobject/ChangeLog
gobject/gboxed.c
gobject/gboxed.h
gobject/gparamspecs.c
gobject/gparamspecs.h
gobject/gtype.c
gobject/gtype.h

index 3212918..efacb58 100644 (file)
@@ -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.
index 88b6760..31667b8 100644 (file)
@@ -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 
index 9e38cc4..7a05c74 100644 (file)
@@ -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.
index 87b8f8f..7a35b8e 100644 (file)
@@ -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.
index 33abba9..c725a54 100644 (file)
@@ -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>
index 038c554..91a7ec3 100644 (file)
@@ -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
index c400115..02adca9 100644 (file)
@@ -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
index df92251..af26562 100644 (file)
@@ -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__ */
index eda2273..75bbc68 100644 (file)
@@ -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);
 }
 
 
index 075291e..0b7584f 100644 (file)
 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__ */
index 427ff2f..ed567b9 100644 (file)
@@ -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;
index aeb770d..17da8b2 100644 (file)
@@ -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);