changed prototype of g_boxed_type_register_static() to contain an optional
authorTim Janik <timj@gtk.org>
Wed, 7 Mar 2001 14:46:45 +0000 (14:46 +0000)
committerTim Janik <timj@src.gnome.org>
Wed, 7 Mar 2001 14:46:45 +0000 (14:46 +0000)
Wed Mar  7 09:36:33 2001  Tim Janik  <timj@gtk.org>

* gboxed.[hc]: changed prototype of g_boxed_type_register_static()
to contain an optional init function and a hint at whether the
boxed structure uses ref counting internally.
added g_value_set_boxed_take_ownership().
made G_TYPE_BOXED an abstract value type.

* genums.[hc]: made G_TYPE_ENUM and G_TYPE_FLAGS abstract value
types.

* glib-genmarshal.c: argument type changes, preparation for third-party
arg specification.

* gobject.[hc]: cleaned up get/set property code.
added g_strdup_value_contents() to improve warnings.

* gparam.[hc]: added g_param_value_convert(), taking over responsibility
of the old g_value_convert(). added G_PARAM_LAX_VALIDATION flag so
validation alterations may be valid a part of the property setting
process.

* gparamspecs.[hc]: made value comparisons stable (for sort applications).
added GParamSpecValueArray, a param spec for value arrays and
GParamSpecClosure. nuked the value exchange functions and
GParamSpecCCallback.

* gtype.[hc]: catch unintialized usages of the type system with
g_return_val_if_uninitialized(). introduced G_TYPE_FLAG_VALUE_ABSTRACT
to flag types that introduce a value table, but can't be used for
g_value_init(). cleaned up reserved type ids.

* gvalue.[hc]: code cleanups and saner checking.
nuked the value exchange API. implemented value transformations, we
can't really "convert" values, rather transforms are an anylogy to
C casts, real conversions need a param spec for validation, which is
why g_param_value_convert() does real conversions now.

* gvaluearray.[hc]: new files that implement a GValueArray, a struct
that can hold inhomogeneous arrays of value (to that extend that it
also allowes undefined values, i.e. G_VALUE_TYPE(value)==0).
this is exposed to the type system as a boxed type.

* gvaluetransform.c: new file implementing most of the former value
exchange functions as single-sided transformations.

* gvaluetypes.[hc]: nuked G_TYPE_CCALLBACK, added
g_value_set_string_take_ownership().

* *.h: s/G_IS_VALUE_/G_VALUE_HOLDS_/.

* *.[hc]: many fixes and cleanups.

* many warning improvements.

Tue Feb 27 18:35:15 2001  Tim Janik  <timj@gtk.org>

* gobject.c (g_object_get_valist): urg, pass G_VALUE_NOCOPY_CONTENTS
into G_VALUE_LCOPY(), this needs proper documenting.

* gparam.c: fixed G_PARAM_USER_MASK.

* gtype.c (type_data_make_W):
(type_data_last_unref_Wm): fixed invalid memory freeing.

* gobject.c (g_object_last_unref): destroy signal handlers associated
with object, right before finalization.

* gsignal.c (g_signal_parse_name): catch destroyed nodes or signals
that don't actually support details.

* gobject.[hc]: got rid of property trailers. nuked GObject
properties "data" and the "signal" variants.
(g_object_connect): new convenience function to do multiple
signal connections at once.
(g_object_disconnect): likewise, for disconnections.

* gparam.[hc] (g_param_spec_pool_lookup): took out trailer support.

* gvalue.[hc]: marked g_value_fits_pointer() and g_value_peek_pointer()
as private (the latter got renamed from g_value_get_as_pointer()).

Wed Mar  7 09:32:06 2001  Tim Janik  <timj@gtk.org>

        * glib-object.h: add gvaluearray.h.

        * gstring.[hc]: fixup naming of g_string_sprint*.

        * gtypes.h: fixed GCompareDataFunc naming.

Wed Mar  7 09:33:27 2001  Tim Janik  <timj@gtk.org>

        * gobject/Makefile.am: shuffled rules to avoid excessive
        rebuilds.

        * gobject/gobject-sections.txt: updates.

        * gobject/tmpl/*: bunch of updates, added another patch
        from Eric Lemings <eric.b.lemings@lmco.com>.

86 files changed:
ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
docs/reference/ChangeLog
docs/reference/glib/tmpl/glib-unused.sgml
docs/reference/glib/tmpl/misc_utils.sgml
docs/reference/glib/tmpl/strings.sgml
docs/reference/gobject/Makefile.am
docs/reference/gobject/gobject-sections.txt
docs/reference/gobject/tmpl/enumerations_flags.sgml
docs/reference/gobject/tmpl/gboxed.sgml
docs/reference/gobject/tmpl/generic_values.sgml
docs/reference/gobject/tmpl/gobject-unused.sgml
docs/reference/gobject/tmpl/objects.sgml
docs/reference/gobject/tmpl/param_specs.sgml
docs/reference/gobject/tmpl/signals.sgml
docs/reference/gobject/tmpl/standard_params.sgml
docs/reference/gobject/tmpl/types.sgml
docs/reference/gobject/tmpl/value_types.sgml
garray.c
garray.h
glib-object.h
glib/garray.c
glib/garray.h
glib/gbsearcharray.c
glib/gbsearcharray.h
glib/glib-object.h
glib/glist.c
glib/glist.h
glib/gqsort.c
glib/gqsort.h
glib/gslist.c
glib/gslist.h
glib/gstring.c
glib/gstring.h
glib/gtree.c
glib/gtree.h
glib/gtypes.h
glist.c
glist.h
gobject/ChangeLog
gobject/Makefile.am
gobject/gboxed.c
gobject/gboxed.h
gobject/gbsearcharray.c
gobject/gbsearcharray.h
gobject/gclosure.c
gobject/gclosure.h
gobject/genums.c
gobject/genums.h
gobject/glib-genmarshal.1
gobject/glib-genmarshal.c
gobject/gmarshal.list
gobject/gobject-query.c
gobject/gobject.c
gobject/gobject.h
gobject/gparam.c
gobject/gparam.h
gobject/gparamspecs.c
gobject/gparamspecs.h
gobject/gsignal.c
gobject/gsignal.h
gobject/gtype.c
gobject/gtype.h
gobject/gvalue.c
gobject/gvalue.h
gobject/gvaluearray.c [new file with mode: 0644]
gobject/gvaluearray.h [new file with mode: 0644]
gobject/gvaluecollector.h
gobject/gvaluetransform.c [new file with mode: 0644]
gobject/gvaluetypes.c
gobject/gvaluetypes.h
gqsort.c
gqsort.h
gslist.c
gslist.h
gstring.c
gstring.h
gtree.c
gtree.h
gtypes.h

index fbec0a36e760cde2524098a273bcd5f16d21059d..4dc9d318169665a2ea8db0c266a36bea4a77333b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Wed Mar  7 09:32:06 2001  Tim Janik  <timj@gtk.org>
+
+       * glib-object.h: add gvaluearray.h.
+
+       * gstring.[hc]: fixup naming of g_string_sprint*.
+       
+       * gtypes.h: fixed GCompareDataFunc naming.
+
 2001-03-07  Christian Meyer  <chrisime@gnome.org>
 
        * configure.in: Added de (German) to ALL_LINGUAS.
index fbec0a36e760cde2524098a273bcd5f16d21059d..4dc9d318169665a2ea8db0c266a36bea4a77333b 100644 (file)
@@ -1,3 +1,11 @@
+Wed Mar  7 09:32:06 2001  Tim Janik  <timj@gtk.org>
+
+       * glib-object.h: add gvaluearray.h.
+
+       * gstring.[hc]: fixup naming of g_string_sprint*.
+       
+       * gtypes.h: fixed GCompareDataFunc naming.
+
 2001-03-07  Christian Meyer  <chrisime@gnome.org>
 
        * configure.in: Added de (German) to ALL_LINGUAS.
index fbec0a36e760cde2524098a273bcd5f16d21059d..4dc9d318169665a2ea8db0c266a36bea4a77333b 100644 (file)
@@ -1,3 +1,11 @@
+Wed Mar  7 09:32:06 2001  Tim Janik  <timj@gtk.org>
+
+       * glib-object.h: add gvaluearray.h.
+
+       * gstring.[hc]: fixup naming of g_string_sprint*.
+       
+       * gtypes.h: fixed GCompareDataFunc naming.
+
 2001-03-07  Christian Meyer  <chrisime@gnome.org>
 
        * configure.in: Added de (German) to ALL_LINGUAS.
index fbec0a36e760cde2524098a273bcd5f16d21059d..4dc9d318169665a2ea8db0c266a36bea4a77333b 100644 (file)
@@ -1,3 +1,11 @@
+Wed Mar  7 09:32:06 2001  Tim Janik  <timj@gtk.org>
+
+       * glib-object.h: add gvaluearray.h.
+
+       * gstring.[hc]: fixup naming of g_string_sprint*.
+       
+       * gtypes.h: fixed GCompareDataFunc naming.
+
 2001-03-07  Christian Meyer  <chrisime@gnome.org>
 
        * configure.in: Added de (German) to ALL_LINGUAS.
index fbec0a36e760cde2524098a273bcd5f16d21059d..4dc9d318169665a2ea8db0c266a36bea4a77333b 100644 (file)
@@ -1,3 +1,11 @@
+Wed Mar  7 09:32:06 2001  Tim Janik  <timj@gtk.org>
+
+       * glib-object.h: add gvaluearray.h.
+
+       * gstring.[hc]: fixup naming of g_string_sprint*.
+       
+       * gtypes.h: fixed GCompareDataFunc naming.
+
 2001-03-07  Christian Meyer  <chrisime@gnome.org>
 
        * configure.in: Added de (German) to ALL_LINGUAS.
index fbec0a36e760cde2524098a273bcd5f16d21059d..4dc9d318169665a2ea8db0c266a36bea4a77333b 100644 (file)
@@ -1,3 +1,11 @@
+Wed Mar  7 09:32:06 2001  Tim Janik  <timj@gtk.org>
+
+       * glib-object.h: add gvaluearray.h.
+
+       * gstring.[hc]: fixup naming of g_string_sprint*.
+       
+       * gtypes.h: fixed GCompareDataFunc naming.
+
 2001-03-07  Christian Meyer  <chrisime@gnome.org>
 
        * configure.in: Added de (German) to ALL_LINGUAS.
index fbec0a36e760cde2524098a273bcd5f16d21059d..4dc9d318169665a2ea8db0c266a36bea4a77333b 100644 (file)
@@ -1,3 +1,11 @@
+Wed Mar  7 09:32:06 2001  Tim Janik  <timj@gtk.org>
+
+       * glib-object.h: add gvaluearray.h.
+
+       * gstring.[hc]: fixup naming of g_string_sprint*.
+       
+       * gtypes.h: fixed GCompareDataFunc naming.
+
 2001-03-07  Christian Meyer  <chrisime@gnome.org>
 
        * configure.in: Added de (German) to ALL_LINGUAS.
index fbec0a36e760cde2524098a273bcd5f16d21059d..4dc9d318169665a2ea8db0c266a36bea4a77333b 100644 (file)
@@ -1,3 +1,11 @@
+Wed Mar  7 09:32:06 2001  Tim Janik  <timj@gtk.org>
+
+       * glib-object.h: add gvaluearray.h.
+
+       * gstring.[hc]: fixup naming of g_string_sprint*.
+       
+       * gtypes.h: fixed GCompareDataFunc naming.
+
 2001-03-07  Christian Meyer  <chrisime@gnome.org>
 
        * configure.in: Added de (German) to ALL_LINGUAS.
index 98dad9239f2897467f7df84b162e1640afce55c8..5fcacd12bea6a75ec4480ac5f33130f25f7a646c 100644 (file)
@@ -1,3 +1,13 @@
+Wed Mar  7 09:33:27 2001  Tim Janik  <timj@gtk.org>
+
+       * gobject/Makefile.am: shuffled rules to avoid excessive
+       rebuilds.
+
+       * gobject/gobject-sections.txt: updates.
+
+       * gobject/tmpl/*: bunch of updates, added another patch
+       from Eric Lemings <eric.b.lemings@lmco.com>.
+
 2001-03-07  Sebastian Wilhelmi  <wilhelmi@ira.uka.de>
 
        * glib/glib-sections.txt, glib/tmpl/messages.sgml: Removed
index 1a46e2fa27a74aad3a01bf9af0780315bb76fe43..63b8f6d7099fb6c543413aa09c991a253e0cc1b9 100644 (file)
@@ -1,3 +1,13 @@
+<!-- ##### USER_FUNCTION GCompareFuncData ##### -->
+<para>
+
+</para>
+
+@a: 
+@b: 
+@user_data: 
+@Returns: 
+
 <!-- ##### USER_FUNCTION GCompletionStrcmpFunc ##### -->
 <para>
 
index 522d9bbf5a7352f768e3d5de634f8468d7aa7356..e95f0b0e97159860f40e48f81819c38af83eb6e5 100644 (file)
@@ -278,17 +278,6 @@ and has no return value. It is not currently used in GLib or GTK+.
 @data: 
 
 
-<!-- ##### USER_FUNCTION GCompareFuncData ##### -->
-<para>
-
-</para>
-
-@a: 
-@b: 
-@user_data: 
-@Returns: 
-
-
 <!-- ##### FUNCTION g_qsort_with_data ##### -->
 <para>
 
index 23bfc3bc65913873ea6042d12a94adc894ffe26f..c096bb7171a97e031dd823254ab064dbc69fefce 100644 (file)
@@ -78,7 +78,7 @@ you do not have to worry about having enough space to copy the string.
 @Returns: the destination #GString.
 
 
-<!-- ##### FUNCTION g_string_sprintf ##### -->
+<!-- ##### MACRO g_string_sprintf ##### -->
 <para>
 Writes a formatted string into a #GString.
 This is similar to the standard <function>sprintf()</function> function,
@@ -86,19 +86,21 @@ except that the GString buffer automatically expands to contain the results.
 The previous contents of the GString are destroyed.
 </para>
 
+<!-- # Unused Parameters # -->
 @string: a #GString.
 @format: the string format. See the <function>sprintf()</function>
 documentation.
 @Varargs: the parameters to insert into the format string.
 
 
-<!-- ##### FUNCTION g_string_sprintfa ##### -->
+<!-- ##### MACRO g_string_sprintfa ##### -->
 <para>
 Appends a formatted string onto the end of a #GString.
 This function is is similar to g_string_sprintf() except that
 the text is appended to the GString.
 </para>
 
+<!-- # Unused Parameters # -->
 @string: a #GString.
 @format: the string format. See the <function>sprintf()</function>
 documentation.
index 82772f7a034adc88b6d1a0a5c89c61f801aee5c3..e515bf7fccd7bf76d5a8f43bf4c66e7ae9652cdd 100644 (file)
@@ -2,47 +2,36 @@
 
 # The name of the module.
 DOC_MODULE=gobject
-
 # The top-level SGML file.
 DOC_MAIN_SGML_FILE=gobject-docs.sgml
-
+# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE)
+EXTRA_DIST +=
 # The directory containing the source code. Relative to $(srcdir)
 DOC_SOURCE_DIR=../../../gobject
-
 # Extra options to supply to gtkdoc-scan
 SCAN_OPTIONS=
-
 # Extra options to supply to gtkdoc-mkdb
 MKDB_OPTIONS=
-
 # Extra options to supply to gtkdoc-fixref
 FIXXREF_OPTIONS=--extra-dir=$(srcdir)/../glib/html
+# Images to copy into HTML directory
+HTML_IMAGES =
 
 # Used for dependencies
 HFILE_GLOB=$(top_srcdir)/gobject/*.h
 CFILE_GLOB=$(top_srcdir)/gobject/*.c
-
 # Headers to ignore
 IGNORE_HFILES=                         \
+       .saved                          \
+       glib-genmarshal.c               \
        gbsearcharray.h
-
 # Extra files to add when scanning
 EXTRA_HFILES=
 
-# Images to copy into HTML directory
-HTML_IMAGES =
-
-# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE)
-content_files =
-
-# Other files to distribute
-extra_files =
-
 # CFLAGS and LDFLAGS for compiling scan program. Only needed
 # if $(DOC_MODULE).types is non-empty.
 GTKDOC_CFLAGS =
 GTKDOC_LIBS =
-
 # Commands for compiling and linking 
 GTKDOC_CC=$(LIBTOOL) --mode=compile $(CC)
 GTKDOC_LD=$(LIBTOOL) --mode=link $(CC)
@@ -54,29 +43,29 @@ GTKDOC_LD=$(LIBTOOL) --mode=link $(CC)
 
 TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
 
-EXTRA_DIST =                           \
-       $(content_files)                \
-       $(extra_files)                  \
-       $(HTML_IMAGES)                  \
-       $(DOC_MAIN_SGML_FILE)           \
-       $(DOC_MODULE).types             \
-       $(DOC_MODULE)-sections.txt      \
-       $(DOC_MODULE)-overrides.txt
+DOC_STAMPS = $(srcdir)/tmpl.stamp $(srcdir)/sgml.stamp $(srcdir)/html.stamp \
+            build-scan.stamp build-tmpl.stamp build-sgml.stamp build-html.stamp
+# gtkdoc-mktmpl:       creates, and on changes touches:        tmpl.stamp
+# gtkdoc-mkdb:         creates, and on changes touches:        sgml.stamp
+# gtkdoc-mkhtml:       creates, and on changes touches:        html.stamp
 
-DOC_STAMPS=scan-build.stamp tmpl-build.stamp sgml-build.stamp html-build.stamp
 
-if ENABLE_GTK_DOC
-all-local: html-build.stamp
+.PHONY: gtkdoc-build-all
 
+if ENABLE_GTK_DOC
 SCANOBJ_FILES =                \
        $(DOC_MODULE).args      \
        $(DOC_MODULE).hierarchy \
        $(DOC_MODULE).signal
 
-scan-build.stamp: $(HFILE_GLOB)
+all-local: gtkdoc-build-all
+
+gtkdoc-build-all: build-sgml.stamp build-html.stamp
+       @true
+build-scan.stamp: $(HFILE_GLOB)
        @echo '*** Scanning header files ***'
        cd $(srcdir) && ( \
-       if grep -l '^.+$$' $(DOC_MODULE).types > /dev/null ; then \
+       if grep -l '^.+$$' $(DOC_MODULE).types > /dev/null 2>/dev/null ; then \
            CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" CFLAGS="$(GTKDOC_CFLAGS)" LDFLAGS="$(GTKDOC_LIBS)" gtkdoc-scangobj --module=$(DOC_MODULE) ; \
        else \
            for i in $(SCANOBJ_FILES) ; do \
@@ -85,46 +74,32 @@ scan-build.stamp: $(HFILE_GLOB)
        fi )
        cd $(srcdir) && \
          gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="$(IGNORE_HFILES)" $(SCAN_OPTIONS) $(EXTRA_HFILES)
-       touch scan-build.stamp
-
-check_scan:
-       $(MAKE) scan-build.stamp
-
-$(DOC_MODULE)-decl.txt $(SCANOBJ_FILES): check_scan
-
-tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt
+       touch build-scan.stamp
+build-tmpl.stamp: build-scan.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt $(srcdir)/tmpl/*.sgml
        @echo '*** Rebuilding template files ***'
        cd $(srcdir) && gtkdoc-mktmpl --module=$(DOC_MODULE)
-       touch tmpl-build.stamp
-
-check_templates: 
-       $(MAKE) tmpl-build.stamp
-
-tmpl.stamp: check_templates
-
-sgml-build.stamp: tmpl.stamp $(CFILE_GLOB)
+       touch build-tmpl.stamp
+tmpl.stamp: build-tmpl.stamp
+       @true
+build-sgml.stamp: tmpl.stamp $(CFILE_GLOB)
        @echo '*** Building SGML ***'
        cd $(srcdir) && \
        gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) $(MKDB_OPTIONS)
-       touch sgml-build.stamp
-
-check_sgml:
-       $(MAKE) sgml-build.stamp
-
-sgml.stamp: check_sgml
-
-html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE)
+       touch build-sgml.stamp
+sgml.stamp: build-sgml.stamp
+       @true
+build-html.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE)
        @echo '*** Building HTML ***'
        test -d $(srcdir)/html || mkdir $(srcdir)/html
        cd $(srcdir)/html && gtkdoc-mkhtml $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
        test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) html )
        @echo '-- Fixing Crossreferences' 
        cd $(srcdir) && gtkdoc-fixxref --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
-       touch html-build.stamp
+       touch build-html.stamp
 endif
 
 clean-local:
-       rm -f *~ *.bak $(SCANOBJ_FILES) *-unused.txt $(DOC_STAMPS) $(srcdir)/sgml.stamp 
+       rm -f *~ *.bak $(SCANOBJ_FILES) *-unused.txt $(DOC_STAMPS)
 
 maintainer-clean-local: clean
        cd $(srcdir) && rm -rf sgml html $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
@@ -167,4 +142,12 @@ dist-hook: dist-check-gtkdoc dist-hook-local
          cp $(srcdir)/$$i $(distdir)/html ;  \
         done
 
-.PHONY : check_sgml check_templates check_scan dist-hook-local
+.PHONY: dist-hook-local
+
+
+EXTRA_DIST =                           \
+       $(HTML_IMAGES)                  \
+       $(DOC_MAIN_SGML_FILE)           \
+       $(DOC_MODULE).types             \
+       $(DOC_MODULE)-sections.txt      \
+       $(DOC_MODULE)-overrides.txt
index 5c3106882111f1ddad3ea32702640c5dae8c38f1..550c4c240ead878968b9ab7f9ecd067679f8e580 100644 (file)
@@ -24,7 +24,6 @@ GTypeInstance
 GTypeInfo
 GTypeFundamentalInfo
 GInterfaceInfo
-GTypeValueTable
 
 <TITLE>GType</TITLE>
 G_TYPE_FROM_INSTANCE
@@ -141,45 +140,47 @@ GObjectClass
 GObjectConstructParam
 GObjectGetPropertyFunc
 GObjectSetPropertyFunc
+GObjectFinalizeFunc
+G_TYPE_IS_OBJECT
 G_OBJECT
+G_IS_OBJECT
+G_OBJECT_CLASS
+G_IS_OBJECT_CLASS
 G_OBJECT_GET_CLASS
 G_OBJECT_TYPE
 G_OBJECT_TYPE_NAME
 G_OBJECT_CLASS_TYPE
 G_OBJECT_CLASS_NAME
-G_IS_VALUE_OBJECT
-G_TYPE_IS_OBJECT
-G_IS_OBJECT
-G_OBJECT_CLASS
-G_IS_OBJECT_CLASS
-GObjectFinalizeFunc
+G_VALUE_HOLDS_OBJECT
 g_object_class_install_property
 g_object_class_find_property
 g_object_new
-g_object_new_valist
+g_object_ref
+g_object_unref
+g_object_connect
+g_object_disconnect
 g_object_set
 g_object_get
-g_object_set_valist
-g_object_get_valist
-g_object_set_property
-g_object_get_property
-g_object_freeze_notify
 g_object_notify
+g_object_freeze_notify
 g_object_thaw_notify
-g_object_ref
-g_object_unref
-g_object_get_qdata
-g_object_set_qdata
-g_object_set_qdata_full
-g_object_steal_qdata
 g_object_get_data
 g_object_set_data
 g_object_set_data_full
 g_object_steal_data
+g_object_get_qdata
+g_object_set_qdata
+g_object_set_qdata_full
+g_object_steal_qdata
+g_object_set_property
+g_object_get_property
+g_object_new_valist
+g_object_set_valist
+g_object_get_valist
+g_object_watch_closure
 g_value_set_object
 g_value_get_object
 g_value_dup_object
-g_object_watch_closure
 G_OBJECT_WARN_INVALID_PROPERTY_ID
 </SECTION>
 
@@ -198,8 +199,8 @@ G_FLAGS_CLASS
 G_IS_FLAGS_CLASS
 G_FLAGS_CLASS_TYPE
 G_FLAGS_CLASS_TYPE_NAME
-G_IS_VALUE_ENUM
-G_IS_VALUE_FLAGS
+G_VALUE_HOLDS_ENUM
+G_VALUE_HOLDS_FLAGS
 GEnumValue
 GFlagsValue
 g_enum_get_value
@@ -228,11 +229,12 @@ g_boxed_copy
 g_boxed_free
 g_value_set_boxed
 g_value_set_static_boxed
+g_value_set_boxed_take_ownership
 g_value_get_boxed
 g_value_dup_boxed
 g_boxed_type_register_static
 <SUBSECTION Standard>
-G_IS_VALUE_BOXED
+G_VALUE_HOLDS_BOXED
 G_TYPE_IS_BOXED
 </SECTION>
 
@@ -248,31 +250,48 @@ GValueExchange
 GValue
 g_value_init
 g_value_copy
-g_value_convert
 g_value_reset
 g_value_unset
 g_value_fits_pointer
+g_value_peek_pointer
+g_value_convert
 g_values_exchange
 g_value_types_exchangable
 g_value_register_exchange_func
+GTypeValueTable
+</SECTION>
+
+<SECTION>
+<TITLE>Value arrays</TITLE>
+<FILE>value_types</FILE>
+GValueArray
+g_value_array_new
+g_value_array_copy
+g_value_array_free
+g_value_array_index
+g_value_array_append
+g_value_array_prepend
+g_value_array_insert
+g_value_array_remove
+g_value_array_sort
+g_value_array_sort_with_data
 </SECTION>
 
 <SECTION>
 <TITLE>Standard value types</TITLE>
 <FILE>value_types</FILE>
-G_IS_VALUE_CHAR
-G_IS_VALUE_UCHAR
-G_IS_VALUE_BOOLEAN
-G_IS_VALUE_INT
-G_IS_VALUE_UINT
-G_IS_VALUE_LONG
-G_IS_VALUE_ULONG
-G_IS_VALUE_FLOAT
-G_IS_VALUE_DOUBLE
-G_IS_VALUE_STRING
-G_IS_VALUE_POINTER
-G_IS_VALUE_CCALLBACK
-G_IS_VALUE_PARAM
+G_VALUE_HOLDS_CHAR
+G_VALUE_HOLDS_UCHAR
+G_VALUE_HOLDS_BOOLEAN
+G_VALUE_HOLDS_INT
+G_VALUE_HOLDS_UINT
+G_VALUE_HOLDS_LONG
+G_VALUE_HOLDS_ULONG
+G_VALUE_HOLDS_FLOAT
+G_VALUE_HOLDS_DOUBLE
+G_VALUE_HOLDS_STRING
+G_VALUE_HOLDS_POINTER
+G_VALUE_HOLDS_PARAM
 g_value_set_char
 g_value_get_char
 g_value_set_uchar
@@ -293,16 +312,14 @@ g_value_set_double
 g_value_get_double
 g_value_set_string
 g_value_set_static_string
+g_value_set_string_take_ownership
 g_value_get_string
 g_value_dup_string
 g_value_set_param
 g_value_get_param
 g_value_dup_param
-g_value_get_ccallback
 g_value_get_pointer
 g_value_set_pointer
-g_value_get_as_pointer
-g_value_set_ccallback
 g_value_set_instance
 </SECTION>
 
@@ -374,8 +391,6 @@ G_IS_PARAM_SPEC_POINTER
 G_PARAM_SPEC_POINTER
 G_IS_PARAM_SPEC_BOXED
 G_PARAM_SPEC_BOXED
-G_IS_PARAM_SPEC_CCALLBACK
-G_PARAM_SPEC_CCALLBACK
 G_IS_PARAM_SPEC_PARAM
 G_PARAM_SPEC_PARAM
 G_IS_PARAM_SPEC_OBJECT
@@ -393,7 +408,6 @@ GParamSpecFloat
 GParamSpecDouble
 GParamSpecString
 GParamSpecBoxed
-GParamSpecCCallback
 GParamSpecParam
 GParamSpecPointer
 GParamSpecObject
@@ -411,7 +425,6 @@ g_param_spec_double
 g_param_spec_string
 g_param_spec_string_c
 g_param_spec_boxed
-g_param_spec_ccallback
 g_param_spec_param
 g_param_spec_pointer
 g_param_spec_object
@@ -435,6 +448,9 @@ GSignalEmissionHook
 GSignalFlags
 GSignalMatchType
 GSignalQuery
+G_SIGNAL_TYPE_STATIC_SCOPE
+G_SIGNAL_MATCH_MASK
+G_SIGNAL_FLAGS_MASK
 g_signal_newc
 g_signal_newv
 g_signal_new_valist
index 971195e5dd8d452a3ffc7f2ade68c864df0b090c..c72b7d3fb27293dc78f7c80f9226f5fc12b8dc3c 100644 (file)
@@ -106,7 +106,7 @@ Enumeration and Flag Types
 @class: 
 
 
-<!-- ##### MACRO G_IS_VALUE_ENUM ##### -->
+<!-- ##### MACRO G_VALUE_HOLDS_ENUM ##### -->
 <para>
 
 </para>
@@ -114,7 +114,7 @@ Enumeration and Flag Types
 @value: 
 
 
-<!-- ##### MACRO G_IS_VALUE_FLAGS ##### -->
+<!-- ##### MACRO G_VALUE_HOLDS_FLAGS ##### -->
 <para>
 
 </para>
index 1ffd58fb1df2e9b084d28e13732c63661320a83f..0e6835741e069ea544c225cb58ec7201c4a904a0 100644 (file)
@@ -74,6 +74,15 @@ gboxed
 @boxed: 
 
 
+<!-- ##### FUNCTION g_value_set_boxed_take_ownership ##### -->
+<para>
+This is an internal function introduced mainly for C marshallers.
+</para>
+
+@value: 
+@boxed: 
+
+
 <!-- ##### FUNCTION g_value_get_boxed ##### -->
 <para>
 
@@ -98,8 +107,10 @@ gboxed
 </para>
 
 @name: 
+@boxed_init: 
 @boxed_copy: 
 @boxed_free: 
+@is_refcounted: 
 @Returns: 
 
 
index 099dd3f907d6e818850b20eb30332165c7ac288d..ab588ec9712de2766c6ce13f841601a75e5d0001 100644 (file)
@@ -1,58 +1,75 @@
 <!-- ##### SECTION Title ##### -->
-Generic values
+Generic Values
 
 <!-- ##### SECTION Short_Description ##### -->
-
+A polymorphic type that can hold values of any other type.
 
 <!-- ##### SECTION Long_Description ##### -->
 <para>
-
+The #GValue structure is basically a variable container that consists
+of a type identifier and a specific value of that type.
+The type identifier within a #GValue structure always determines the
+type of the associated value.
+To create a undefined #GValue structure, simply create a zero-filled
+#GValue structure. To intialize the #GValue, use the g_value_init()
+function. A #GValue cannot be used until it is initialized.
+The basic type operations (such as freeing and copying) are determined
+by the #GTypeValueTable associated with the type ID stored in the #GValue.
+Other #GValue operations (such as converting values between types) are
+provided by this interface.
 </para>
 
 <!-- ##### SECTION See_Also ##### -->
 <para>
-
+The fundamental types which all support #GValue operations and thus
+can be used as a type initializer for g_value_init() are defined by
+a separate interface.  See the Standard Values API for details.
 </para>
 
 <!-- ##### MACRO G_VALUE_HOLDS ##### -->
 <para>
-
+Returns #TRUE if @value holds (or contains) a value of @type.
+This macro will also check for @value != #NULL and issue a
+warning if the check fails.
 </para>
 
 @value: 
-@g_type: 
+@type: 
 
 
 <!-- ##### MACRO G_VALUE_TYPE ##### -->
 <para>
-
+Returns the type identifier of @value.
 </para>
 
-@value: 
+@value: A #GValue structure.
 
 
 <!-- ##### MACRO G_VALUE_TYPE_NAME ##### -->
 <para>
-
+Returns the type name of @value.
 </para>
 
-@value: 
+@value: A #GValue structure.
 
 
 <!-- ##### MACRO G_TYPE_IS_VALUE ##### -->
 <para>
-
+Return whether the passed in type ID can be used for g_value_init().
+That is, this macro checks whether this type provides an implementation
+of the #GTypeValueTable functions required for a type to create a #GValue of.
 </para>
 
-@type: 
+@type:           A #GType value.
+@Returns: Whether @type is suitable as a #GValue type.
 
 
 <!-- ##### MACRO G_IS_VALUE ##### -->
 <para>
-
+Returns #TRUE if @value is a valid and initialized #GValue structure.
 </para>
 
-@value: 
+@value: A #GValue structure.
 
 
 <!-- ##### USER_FUNCTION GValueExchange ##### -->
@@ -66,90 +83,269 @@ Generic values
 
 <!-- ##### STRUCT GValue ##### -->
 <para>
-
+A mostly opaque structure used to hold a #GValue object.  Mostly because
+the data within the structure has protected scope: it is accessible only
+to functions within a #GTypeValueTable structure, or implementations of
+the g_value_*() API.
 </para>
 
 
 <!-- ##### FUNCTION g_value_init ##### -->
 <para>
-
+Initializes @value with the default value of @type.
 </para>
 
-@value: 
-@g_type: 
+@value:                A zero-filled (uninitialized) #GValue structure.
+@g_type:       Type the #GValue should hold values of.
+@Returns: 
 
 
 <!-- ##### FUNCTION g_value_copy ##### -->
 <para>
-
+Copies the value of @src_value into @dest_value.
 </para>
 
-@src_value: 
-@dest_value: 
-
-
-<!-- ##### FUNCTION g_value_convert ##### -->
-<para>
-
-</para>
-
-@src_value: 
-@dest_value: 
-@Returns: 
+@src_value:    An initialized #GValue structure.
+@dest_value:   An initialized #GValue structure of the same type as @src_value.
 
 
 <!-- ##### FUNCTION g_value_reset ##### -->
 <para>
-
+Clears the current value in @value and resets it to the default value
+(as if the value had just been initialized).
 </para>
 
-@value: 
+@value:        An initialized #GValue structure.
+@Returns: 
 
 
 <!-- ##### FUNCTION g_value_unset ##### -->
 <para>
-
+Clears the current value in @value and "unsets" the type,
+this releases all resources associated with this GValue.
+An unset value is the same as an uninitialized (zero-filled)
+#GValue structure.
 </para>
 
-@value: 
+@value:        An initialized #GValue structure.
 
 
 <!-- ##### FUNCTION g_value_fits_pointer ##### -->
 <para>
-
+Determines if @value will fit inside the size of a pointer value.
+This is an internal function introduced mainly for C marshallers.
 </para>
 
-@value: 
-@Returns: 
+@value:                An initialized #GValue structure.
+@Returns:      #TRUE if @value will fit inside a pointer value.
 
 
-<!-- ##### FUNCTION g_values_exchange ##### -->
+<!-- ##### FUNCTION g_value_peek_pointer ##### -->
 <para>
-
+Return the value contents as pointer. This function asserts that
+g_value_fits_pointer() returned #TRUE for the passed in value.
+This is an internal function introduced mainly for C marshallers.
 </para>
 
-@value1: 
-@value2: 
-@Returns: 
+@value:                An initialized #GValue structure.
+@Returns:      #TRUE if @value will fit inside a pointer value.
 
 
-<!-- ##### FUNCTION g_value_types_exchangable ##### -->
+<!-- ##### FUNCTION g_value_convert ##### -->
 <para>
 
 </para>
 
-@value_type1
-@value_type2
+@src_value
+@dest_value
 @Returns: 
 
 
-<!-- ##### FUNCTION g_value_register_exchange_func ##### -->
+<!-- ##### STRUCT GTypeValueTable ##### -->
 <para>
-
+The #GTypeValueTable provides the functions required by the #GValue implementation,
+to serve as a container for values of a type.
 </para>
 
-@value_type1: 
-@value_type2: 
-@func: 
-
+@value_init:           Default initialize @values contents by poking values
+                       directly into the value-&gt;data array. The data array of
+                       the #GValue passed into this function was zero-filled
+                       with memset, so no care has to be taken to free any
+                       old contents. E.g. for the implementation of a string
+                       value that may never be NULL, the implementation might
+                       look like:
+<msgtext><programlisting>
+{
+  value-&gt;data[0].v_pointer = g_strdup ("");
+}
+</programlisting></msgtext>
+@value_free:           Free any old contents that might be left in the
+                       data array of the passed in @value. No resources may
+                       remain allocated through the #GValue contents after
+                       this function returns. E.g. for our above string type:
+<msgtext><programlisting>
+{
+  /* only free strings without a specific flag for static storage */
+  if (!(value-&gt;data[1].v_uint & G_VALUE_NOCOPY_CONTENTS))
+    g_free (value-&gt;data[0].v_pointer);
+}
+</programlisting></msgtext>
+@value_copy:           @dest_value is a #GValue with zero-filled data section
+                       and @src_value is a properly setup #GValue of same or
+                       derived type.
+                       The purpose of this function is to copy the contents of
+                       @src_value into @dest_value in a way, that even after
+                       @src_value has been freed, the contents of @dest_value
+                       remain valid. String type example:
+<msgtext><programlisting>
+{
+  dest_value-&gt;data[0].v_pointer = g_strdup (src_value-&gt;data[0].v_pointer);
+}
+</programlisting></msgtext>
+@value_peek_pointer:   If the value contents fit into a pointer, such as objects
+                       or strings, return this pointer, so the caller can peek at
+                       the current contents. To extend on our above string example:
+<msgtext><programlisting>
+{
+  return value-&gt;data[0].v_pointer;
+}
+</programlisting></msgtext>
+@collect_format:       A string format describing how to collect the contents of
+                       this value, bit-by-bit. Each character in the format represents
+                       an argument to be collected, the characters themselves indicate
+                       the type of the argument. Currently supported arguments are:
+<msgtext><variablelist>
+  <varlistentry><term></term><listitem><para>
+        'i' - Integers. passed as collect_values[].v_int.
+  </para></listitem></varlistentry>
+  <varlistentry><term></term><listitem><para>
+        'l' - Longs. passed as collect_values[].v_long.
+  </para></listitem></varlistentry>
+  <varlistentry><term></term><listitem><para>
+        'd' - Doubles. passed as collect_values[].v_double.
+  </para></listitem></varlistentry>
+  <varlistentry><term></term><listitem><para>
+        'p' - Pointers. passed as collect_values[].v_pointer.
+  </para></listitem></varlistentry>
+</variablelist></msgtext>
+                       It should be noted, that for variable argument list construction,
+                       ANSI C promotes every type smaller than an integer to an int, and
+                       floats to doubles. So for collection of short int or char, 'i'
+                       needs to be used, and for collection of floats 'd'.
+@collect_value:        The collect_value() function is responsible for converting the
+                       values collected from a variable argument list into contents
+                       suitable for storage in a GValue. This function should setup
+                       @value similar to value_init(), e.g. for a string value that
+                       does not allow NULL pointers, it needs to either spew an error,
+                       or do an implicit conversion by storing an empty string.
+                       The @value passed in to this function has a zero-filled data
+                       array, so just like for @value_init it is guarranteed to not
+                       contain any old contents that might need freeing.
+                       @n_collect_values is exactly the string length of @collect_format,
+                       and @collect_values is an array of unions #GTypeCValue with
+                       length @n_collect_values, containing the collected values
+                       according to @collect_format.
+                       @collect_flags is an argument provided as a hint by the caller,
+                       which may contain the flag #G_VALUE_NOCOPY_CONTENTS indicating,
+                       that the collected value contents may be considered "static"
+                       for the duration of the #@value lifetime.
+                       Thus an extra copy of the contents stored in @collect_values is
+                       not required for assignment to @value.
+                       For our above string example, we continue with:
+<msgtext><programlisting>
+{
+  if (!collect_values[0].v_pointer)
+    value->data[0].v_pointer = g_strdup ("");
+  else if (collect_flags & G_VALUE_NOCOPY_CONTENTS)
+    {
+      value-&gt;data[0].v_pointer = collect_values[0].v_pointer;
+      /* keep a flag for the value_free() implementation to not free this string */
+      value-&gt;data[1].v_uint = G_VALUE_NOCOPY_CONTENTS;
+    }
+  else
+    value-&gt;data[0].v_pointer = g_strdup (collect_values[0].v_pointer);
+
+  return NULL;
+}
+</programlisting></msgtext>
+                       It should be noted, that it is generally a bad idea to follow the
+                       #G_VALUE_NOCOPY_CONTENTS hint for reference counted types. Due to
+                       reentrancy requirements and reference count assertions performed
+                       by the GSignal code, reference counts should always be incremented
+                       for reference counted contents stored in the value-&gt;data array.
+                       To deviate from our string example for a moment, and taking a look
+                       at an exemplary implementation for collect_value() of #GObject:
+<msgtext><programlisting>
+{
+  if (collect_values[0].v_pointer)
+    {
+      GObject *object = G_OBJECT (collect_values[0].v_pointer);
+
+      /* never honour G_VALUE_NOCOPY_CONTENTS for ref-counted types */
+      value-&gt;data[0].v_pointer = g_object_ref (object);
+      return NULL;
+    }
+  else
+    return g_strdup_printf ("Object passed as invalid NULL pointer");
+}
+</programlisting></msgtext>
+                       The reference count for valid objects is always incremented,
+                       regardless of @collect_flags. For invalid objects, the example
+                       returns a newly allocated string without altering @value.
+                       Upon success, collect_value() needs to return NULL, if however
+                       a malicious condition occoured, collect_value() may spew an
+                       error by returning a newly allocated non-NULL string, giving
+                       a suitable description of the error condition.
+                       The calling code makes no assumptions about the @value
+                       contents being valid upon error returns, @value
+                       is simply thrown away without further freeing. As such, it is
+                       a good idea to not allocate #GValue contents, prior to returning
+                       an error, however, collect_values() is not obliged to return
+                       a correctly setup @value for error returns, simply because
+                       any non-NULL return is considered a fatal condition so further
+                       program behaviour is undefined.
+@lcopy_format:                 Format description of the arguments to collect for @lcopy_value,
+                       analogous to @collect_format. Usually, @lcopy_format string consist
+                       only of 'p's to provide lcopy_value() with pointers to storage locations.
+@lcopy_value:          This function is responsible for storing the @value contents into
+                       arguments passed through a variable argument list which got
+                       collected into @collect_values according to @lcopy_format.
+                       @n_collect_values equals the string length of @lcopy_format,
+                       and @collect_flags may contain #G_VALUE_NOCOPY_CONTENTS.
+                       In contrast to collect_value(), lcopy_value() is obliged to
+                       always properly support #G_VALUE_NOCOPY_CONTENTS.
+                       Similar to collect_value() the function may prematurely abort
+                       by returning a newly allocated string describing an error condition.
+                       To complete the string example:
+<msgtext><programlisting>
+{
+  gchar **string_p = collect_values[0].v_pointer;
+
+  if (!string_p)
+    return g_strdup_printf ("string location passed as NULL");
+
+  if (collect_flags & G_VALUE_NOCOPY_CONTENTS)
+    *string_p = value-&gt;data[0].v_pointer;
+  else
+    *string_p = g_strdup (value-&gt;data[0].v_pointer);
+
+}
+</programlisting></msgtext>
+                       And an exemplary version of lcopy_value() for
+                       reference-counted types:
+<msgtext><programlisting>
+{
+  GObject **object_p = collect_values[0].v_pointer;
+
+  if (!object_p)
+    return g_strdup_printf ("object location passed as NULL");
+  if (!value-&gt;data[0].v_pointer)
+    *object_p = NULL;
+  else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) /* always honour */
+    *object_p = value-&gt;data[0].v_pointer;
+  else
+    *object_p = g_object_ref (value-&gt;data[0].v_pointer);
+  return NULL;
+}
+</programlisting></msgtext>
 
index 8098c0650887e4127fd784e1a4781536fa1f97dc..1fe73b57548089bb5941511fd6eecb34c05b22b8 100644 (file)
-<!-- ##### SECTION ./tmpl/closures.sgml:Long_Description ##### -->
+<!-- ##### FUNCTION g_type_value_is_a ##### -->
 <para>
-
-</para>
-
-
-<!-- ##### SECTION ./tmpl/closures.sgml:See_Also ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### SECTION ./tmpl/closures.sgml:Short_Description ##### -->
-
-
-
-<!-- ##### SECTION ./tmpl/closures.sgml:Title ##### -->
-Closures
-
-
-<!-- ##### SECTION ./tmpl/gtypemodule.sgml.sgml:Long_Description ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### SECTION ./tmpl/gtypemodule.sgml.sgml:See_Also ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### SECTION ./tmpl/gtypemodule.sgml.sgml:Short_Description ##### -->
-
-
-
-<!-- ##### SECTION ./tmpl/gtypemodule.sgml.sgml:Title ##### -->
-gtypemodule.sgml
-
-
-<!-- ##### SECTION ./tmpl/signals.sgml:Long_Description ##### -->
-<para>
-The basic concept of the signal system is that of the <emphasis>emission</emphasis>
-of a signal.
-Signals are introduced per-type and are identified through strings.
-Signals introduced for a parent type are availale in derived types as well,
-so basically they are a per-type facility that is inherited.
-A signal emission mainly involves invocation of a certain set of callbacks in
-precisely defined manner. There are two main categories of such callbacks,
-per-object
-       <footnote><para> Although signals can deal with any kind of type, i'm
-       referring to those types as "object types" in the following, simply
-       because that is the context most users will encounter signals in.
-       </para></footnote>
-ones and user provided ones.
-The per-object callbacks are most often referred to as "object method
-handler" or "default (signal) handler", while user provided callbacks are
-usually just called "signal handler".
-The object method handler is provided at signal creation time (this most
-frequently happens at the end of an object class' creation), while user
-provided handlers are frequently connected and disconnected to/from a certain
-signal on certain object instances.
-</para>
-<para>
-A signal emission consists of five stages, unless prematurely stopped:
-<variablelist>
-  <varlistentry><term></term><listitem><para>
-       1 - Invocation of the object method handler for %G_SIGNAL_RUN_FIRST signals
-  </para></listitem></varlistentry>
-  <varlistentry><term></term><listitem><para>
-       2 - Invocation of normal user-provided signal handlers (<emphasis>after</emphasis> flag %FALSE)
-  </para></listitem></varlistentry>
-  <varlistentry><term></term><listitem><para>
-       3 - Invocation of the object method handler for %G_SIGNAL_RUN_LAST signals
-  </para></listitem></varlistentry>
-  <varlistentry><term></term><listitem><para>
-       4 - Invocation of user provided signal handlers, connected with an <emphasis>after</emphasis> flag of %TRUE
-  </para></listitem></varlistentry>
-  <varlistentry><term></term><listitem><para>
-       5 - Invocation of the object method handler for %G_SIGNAL_RUN_CLEANUP signals
-  </para></listitem></varlistentry>
-</variablelist>
-The user provided signal handlers are called in the order they were
-connected in.
-All handlers may prematurely stop a signal emission, and any number of
-handlers may be connected, disconnected, blocked or unblocked during
-a signal emission.
-There are certain criteria for skipping user handlers in stages 2 and 4
-of a signal emission.
-First, user handlers may be <emphasis>blocked</emphasis>, blocked handlers are omitted
-during callback invocation, to return from the "blocked" state, a
-handler has to get unblocked exactly the same amount of times
-it has been blocked before.
-Second, upon emission of a %G_SIGNAL_DETAILED signal, an additional
-"detail" argument passed in to g_signal_emit() has to match the detail
-argument of the signal handler currently subject to invocation.
-Specification of no detail argument for signal handlers (omission of the
-detail part of the signal specification upon connection) serves as a
-wildcard and matches any detail argument passed in to emission.
-</para>
-
-
-<!-- ##### SECTION ./tmpl/signals.sgml:See_Also ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### SECTION ./tmpl/signals.sgml:Short_Description ##### -->
-Signals provide a means for customization of object behaviour and are used
-as general purpose notification mechanism.
-
-
-<!-- ##### SECTION ./tmpl/signals.sgml:Title ##### -->
-Signals
-
-
-<!-- ##### USER_FUNCTION GObjectGetParamFunc ##### -->
-<para>
-
-</para>
-
-@object: 
-@param_id: 
-@value: 
-@pspec: 
-@trailer: 
-
-<!-- ##### USER_FUNCTION GObjectSetParamFunc ##### -->
-<para>
-
-</para>
-
-@object: 
-@param_id: 
-@value: 
-@pspec: 
-@trailer: 
-
-<!-- ##### ENUM GSignalType ##### -->
-<para>
-
-</para>
-
-@G_SIGNAL_RUN_FIRST: 
-@G_SIGNAL_RUN_LAST: 
-@G_SIGNAL_RUN_CLEANUP: 
-@G_SIGNAL_NO_RECURSE: 
-@G_SIGNAL_ACTION: 
-@G_SIGNAL_NO_HOOKS: 
-
-<!-- ##### USER_FUNCTION GTypePluginFillInterfaceInfo ##### -->
-<para>
-
-</para>
-
-@plugin: 
-@interface_type: 
-@instance_type: 
-@info: 
-
-<!-- ##### USER_FUNCTION GTypePluginFillTypeInfo ##### -->
-<para>
-
-</para>
-
-@plugin: 
-@g_type: 
-@info: 
-@value_table: 
-
-<!-- ##### USER_FUNCTION GTypePluginRef ##### -->
-<para>
-
-</para>
-
-@plugin: 
-
-<!-- ##### USER_FUNCTION GTypePluginUnRef ##### -->
-<para>
-
-</para>
-
-@plugin: 
-
-<!-- ##### STRUCT GTypePluginVTable ##### -->
-<para>
-
+Determines if @value is a #GValue whose type conforms to @type.
 </para>
 
-@plugin_ref: 
-@plugin_unref: 
-@complete_type_info: 
-@complete_interface_info: 
+@value:          A valid #GValue structure.
+@type:    A #GType value.
+@Returns: #TRUE if @value is a #GValue of @type or #FALSE if not.
 
-<!-- ##### MACRO G_IS_PARAM_VALUE ##### -->
+<!-- ##### FUNCTION g_value_register_exchange_func ##### -->
 <para>
 
 </para>
 
-@pspec: 
-@value: 
-
-<!-- ##### MACRO G_NOTIFY_PRIORITY ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### MACRO G_WARN_INVALID_PARAM_ID ##### -->
-<para>
-
-</para>
-
-@object: 
-@param_id: 
-@pspec: 
-
-<!-- ##### FUNCTION g_object_class_find_param_spec ##### -->
-<para>
-
-</para>
-
-@oclass: 
-@param_name: 
-@Returns: 
-
-<!-- ##### FUNCTION g_object_class_install_param ##### -->
-<para>
-
-</para>
-
-@oclass: 
-@param_id: 
-@pspec: 
-
-<!-- ##### FUNCTION g_object_get_param ##### -->
-<para>
-
-</para>
-
-@object: 
-@param_name: 
-@value: 
-
-<!-- ##### FUNCTION g_object_queue_param_changed ##### -->
-<para>
-
-</para>
-
-@object: 
-@param_name: 
-
-<!-- ##### FUNCTION g_object_set_param ##### -->
-<para>
-
-</para>
-
-@object: 
-@param_name: 
-@value: 
-
-<!-- ##### FUNCTION g_param_spec_hash_table_insert ##### -->
-<para>
-
-</para>
-
-@hash_table: 
-@pspec: 
-@owner_type: 
-
-<!-- ##### FUNCTION g_param_spec_hash_table_lookup ##### -->
-<para>
-
-</para>
-
-@hash_table: 
-@param_name: 
-@owner_type: 
-@try_ancestors: 
-@trailer: 
-@Returns: 
-
-<!-- ##### FUNCTION g_param_spec_hash_table_new ##### -->
-<para>
-
-</para>
-
-@Returns: 
-
-<!-- ##### FUNCTION g_param_spec_hash_table_remove ##### -->
-<para>
-
-</para>
-
-@hash_table: 
-@pspec: 
-
-<!-- ##### FUNCTION g_signal_type_closure_new ##### -->
-<para>
-
-</para>
-
-@itype: 
-@struct_offset: 
-@Returns: 
-
-<!-- ##### FUNCTION g_signals_destroy ##### -->
-<para>
-
-</para>
-
-@itype: 
-
-<!-- ##### FUNCTION g_type_conforms_to ##### -->
-<para>
-
-</para>
-
-@type: 
-@iface_type: 
-@Returns: 
-
-<!-- ##### FUNCTION g_type_instance_conforms_to ##### -->
-<para>
-
-</para>
-
-@instance: 
-@iface_type: 
-@Returns: 
+@value_type1: 
+@value_type2: 
+@func: 
 
-<!-- ##### FUNCTION g_type_is_dynamic ##### -->
+<!-- ##### FUNCTION g_value_types_exchangable ##### -->
 <para>
 
 </para>
 
-@type
-@flags
+@value_type1
+@value_type2
 @Returns: 
 
-<!-- ##### FUNCTION g_type_value_conforms_to ##### -->
+<!-- ##### FUNCTION g_values_exchange ##### -->
 <para>
 
 </para>
 
-@value: 
-@type
+@value1
+@value2
 @Returns: 
 
index 9cb7851c08addae9b0105f86ea942b0cdccf369b..2e69507e1d9e2d77ffad4753d80d2180b3e67824 100644 (file)
@@ -34,7 +34,6 @@ The Base Object Type
 
 @pspec: 
 @value: 
-@trailer: 
 
 <!-- ##### USER_FUNCTION GObjectGetPropertyFunc ##### -->
 <para>
@@ -45,6 +44,7 @@ The Base Object Type
 @property_id: 
 @value: 
 @pspec: 
+<!-- # Unused Parameters # -->
 @trailer: 
 
 
@@ -57,10 +57,11 @@ The Base Object Type
 @property_id: 
 @value: 
 @pspec: 
+<!-- # Unused Parameters # -->
 @trailer: 
 
 
-<!-- ##### MACRO G_OBJECT ##### -->
+<!-- ##### USER_FUNCTION GObjectFinalizeFunc ##### -->
 <para>
 
 </para>
@@ -68,15 +69,15 @@ The Base Object Type
 @object: 
 
 
-<!-- ##### MACRO G_OBJECT_GET_CLASS ##### -->
+<!-- ##### MACRO G_TYPE_IS_OBJECT ##### -->
 <para>
 
 </para>
 
-@object
+@type
 
 
-<!-- ##### MACRO G_OBJECT_TYPE ##### -->
+<!-- ##### MACRO G_OBJECT ##### -->
 <para>
 
 </para>
@@ -84,7 +85,7 @@ The Base Object Type
 @object: 
 
 
-<!-- ##### MACRO G_OBJECT_TYPE_NAME ##### -->
+<!-- ##### MACRO G_IS_OBJECT ##### -->
 <para>
 
 </para>
@@ -92,7 +93,7 @@ The Base Object Type
 @object: 
 
 
-<!-- ##### MACRO G_OBJECT_CLASS_TYPE ##### -->
+<!-- ##### MACRO G_OBJECT_CLASS ##### -->
 <para>
 
 </para>
@@ -100,7 +101,7 @@ The Base Object Type
 @class: 
 
 
-<!-- ##### MACRO G_OBJECT_CLASS_NAME ##### -->
+<!-- ##### MACRO G_IS_OBJECT_CLASS ##### -->
 <para>
 
 </para>
@@ -108,23 +109,23 @@ The Base Object Type
 @class: 
 
 
-<!-- ##### MACRO G_IS_VALUE_OBJECT ##### -->
+<!-- ##### MACRO G_OBJECT_GET_CLASS ##### -->
 <para>
 
 </para>
 
-@value
+@object
 
 
-<!-- ##### MACRO G_TYPE_IS_OBJECT ##### -->
+<!-- ##### MACRO G_OBJECT_TYPE ##### -->
 <para>
 
 </para>
 
-@type
+@object
 
 
-<!-- ##### MACRO G_IS_OBJECT ##### -->
+<!-- ##### MACRO G_OBJECT_TYPE_NAME ##### -->
 <para>
 
 </para>
@@ -132,7 +133,7 @@ The Base Object Type
 @object: 
 
 
-<!-- ##### MACRO G_OBJECT_CLASS ##### -->
+<!-- ##### MACRO G_OBJECT_CLASS_TYPE ##### -->
 <para>
 
 </para>
@@ -140,7 +141,7 @@ The Base Object Type
 @class: 
 
 
-<!-- ##### MACRO G_IS_OBJECT_CLASS ##### -->
+<!-- ##### MACRO G_OBJECT_CLASS_NAME ##### -->
 <para>
 
 </para>
@@ -148,12 +149,12 @@ The Base Object Type
 @class: 
 
 
-<!-- ##### USER_FUNCTION GObjectFinalizeFunc ##### -->
+<!-- ##### MACRO G_VALUE_HOLDS_OBJECT ##### -->
 <para>
 
 </para>
 
-@object
+@value
 
 
 <!-- ##### FUNCTION g_object_class_install_property ##### -->
@@ -189,88 +190,88 @@ The Base Object Type
 @first_param_name: 
 
 
-<!-- ##### FUNCTION g_object_new_valist ##### -->
+<!-- ##### FUNCTION g_object_ref ##### -->
 <para>
 
 </para>
 
-@object_type: 
-@first_property_name: 
-@var_args: 
+@object: 
 @Returns: 
-<!-- # Unused Parameters # -->
-@first_param_name: 
 
 
-<!-- ##### FUNCTION g_object_set ##### -->
+<!-- ##### FUNCTION g_object_unref ##### -->
 <para>
 
 </para>
 
 @object: 
-@first_property_name: 
+
+
+<!-- ##### FUNCTION g_object_connect ##### -->
+<para>
+
+</para>
+
+@object: 
+@signal_spec: 
 @Varargs: 
-<!-- # Unused Parameters # -->
-@first_param_name: 
+@Returns: 
 
 
-<!-- ##### FUNCTION g_object_get ##### -->
+<!-- ##### FUNCTION g_object_disconnect ##### -->
 <para>
 
 </para>
 
 @object: 
-@first_property_name
+@signal_spec
 @Varargs: 
-<!-- # Unused Parameters # -->
-@first_param_name: 
+@Returns: 
 
 
-<!-- ##### FUNCTION g_object_set_valist ##### -->
+<!-- ##### FUNCTION g_object_set ##### -->
 <para>
 
 </para>
 
 @object: 
 @first_property_name: 
-@var_args: 
+@Varargs: 
+@Returns: 
 <!-- # Unused Parameters # -->
 @first_param_name: 
 
 
-<!-- ##### FUNCTION g_object_get_valist ##### -->
+<!-- ##### FUNCTION g_object_get ##### -->
 <para>
 
 </para>
 
 @object: 
 @first_property_name: 
-@var_args: 
+@Varargs: 
 <!-- # Unused Parameters # -->
 @first_param_name: 
 
 
-<!-- ##### FUNCTION g_object_set_property ##### -->
+<!-- ##### FUNCTION g_object_notify ##### -->
 <para>
 
 </para>
 
 @object: 
 @property_name: 
-@value: 
 
 
-<!-- ##### FUNCTION g_object_get_property ##### -->
+<!-- ##### FUNCTION g_object_freeze_notify ##### -->
 <para>
 
 </para>
 
 @object: 
-@property_name: 
-@value: 
 
 
-<!-- ##### FUNCTION g_object_freeze_notify ##### -->
+<!-- ##### FUNCTION g_object_thaw_notify ##### -->
 <para>
 
 </para>
@@ -278,38 +279,45 @@ The Base Object Type
 @object: 
 
 
-<!-- ##### FUNCTION g_object_notify ##### -->
+<!-- ##### FUNCTION g_object_get_data ##### -->
 <para>
 
 </para>
 
 @object: 
-@property_name: 
+@key: 
+@Returns: 
 
 
-<!-- ##### FUNCTION g_object_thaw_notify ##### -->
+<!-- ##### FUNCTION g_object_set_data ##### -->
 <para>
 
 </para>
 
 @object: 
+@key: 
+@data: 
 
 
-<!-- ##### FUNCTION g_object_ref ##### -->
+<!-- ##### FUNCTION g_object_set_data_full ##### -->
 <para>
 
 </para>
 
 @object: 
-@Returns: 
+@key: 
+@data: 
+@destroy: 
 
 
-<!-- ##### FUNCTION g_object_unref ##### -->
+<!-- ##### FUNCTION g_object_steal_data ##### -->
 <para>
 
 </para>
 
 @object: 
+@key: 
+@Returns: 
 
 
 <!-- ##### FUNCTION g_object_get_qdata ##### -->
@@ -353,45 +361,70 @@ The Base Object Type
 @Returns: 
 
 
-<!-- ##### FUNCTION g_object_get_data ##### -->
+<!-- ##### FUNCTION g_object_set_property ##### -->
 <para>
 
 </para>
 
 @object: 
-@key: 
+@property_name: 
+@value: 
+
+
+<!-- ##### FUNCTION g_object_get_property ##### -->
+<para>
+
+</para>
+
+@object: 
+@property_name: 
+@value: 
+
+
+<!-- ##### FUNCTION g_object_new_valist ##### -->
+<para>
+
+</para>
+
+@object_type: 
+@first_property_name: 
+@var_args: 
 @Returns: 
+<!-- # Unused Parameters # -->
+@first_param_name: 
 
 
-<!-- ##### FUNCTION g_object_set_data ##### -->
+<!-- ##### FUNCTION g_object_set_valist ##### -->
 <para>
 
 </para>
 
 @object: 
-@key: 
-@data: 
+@first_property_name: 
+@var_args: 
+<!-- # Unused Parameters # -->
+@first_param_name: 
 
 
-<!-- ##### FUNCTION g_object_set_data_full ##### -->
+<!-- ##### FUNCTION g_object_get_valist ##### -->
 <para>
 
 </para>
 
 @object: 
-@key: 
-@data: 
-@destroy: 
+@first_property_name: 
+@var_args: 
+<!-- # Unused Parameters # -->
+@first_param_name: 
 
 
-<!-- ##### FUNCTION g_object_steal_data ##### -->
+<!-- ##### FUNCTION g_object_watch_closure ##### -->
 <para>
 
 </para>
 
 @object: 
-@key: 
-@Returns: 
+@closure: 
 
 
 <!-- ##### FUNCTION g_value_set_object ##### -->
@@ -421,15 +454,6 @@ The Base Object Type
 @Returns: 
 
 
-<!-- ##### FUNCTION g_object_watch_closure ##### -->
-<para>
-
-</para>
-
-@object: 
-@closure: 
-
-
 <!-- ##### MACRO G_OBJECT_WARN_INVALID_PROPERTY_ID ##### -->
 <para>
 
index 53319627a94013681c43b5d580685271244ef07f..d57c0a40cec470ab5cce5bc0bb837804047058f2 100644 (file)
@@ -118,6 +118,7 @@ Parameter Specifications
 @G_PARAM_WRITABLE: 
 @G_PARAM_CONSTRUCT: 
 @G_PARAM_CONSTRUCT_ONLY: 
+@G_PARAM_LAX_VALIDATION: 
 @G_PARAM_PRIVATE: 
 
 <!-- ##### FUNCTION g_param_spec_ref ##### -->
@@ -293,8 +294,9 @@ Parameter Specifications
 @param_name: 
 @owner_type: 
 @walk_ancestors: 
-@trailer_p: 
 @Returns: 
+<!-- # Unused Parameters # -->
+@trailer_p: 
 
 
 <!-- ##### FUNCTION g_param_spec_internal ##### -->
index 558b9738814433cf1d1db41c21b000dfe619c969..4445fa03da59f12973d34a3df4b0b47d37116b5e 100644 (file)
@@ -15,8 +15,8 @@ so basically they are a per-type facility that is inherited.
 A signal emission mainly involves invocation of a certain set of callbacks in
 precisely defined manner. There are two main categories of such callbacks,
 per-object
-       <footnote><para> Although signals can deal with any kind of type, i'm
-       referring to those types as "object types" in the following, simply
+       <footnote><para> Although signals can deal with any kind of instantiatable type,
+       i'm referring to those types as "object types" in the following, simply
        because that is the context most users will encounter signals in.
        </para></footnote>
 ones and user provided ones.
@@ -182,6 +182,27 @@ filled in by the g_signal_query() function.
                        #gpointer     data2);
 </programlisting></msgtext>
 
+<!-- ##### MACRO G_SIGNAL_TYPE_STATIC_SCOPE ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO G_SIGNAL_MATCH_MASK ##### -->
+<para>
+
+</para>
+
+
+
+<!-- ##### MACRO G_SIGNAL_FLAGS_MASK ##### -->
+<para>
+
+</para>
+
+
+
 <!-- ##### FUNCTION g_signal_newc ##### -->
 <para>
 
index ec7df7c2e070a29594ab617b56fa00d92dee6184..08b218caf7541b315ff6a5f9658247eaa0e0d5b4 100644 (file)
@@ -238,22 +238,6 @@ Standard Parameter Types
 @pspec: 
 
 
-<!-- ##### MACRO G_IS_PARAM_SPEC_CCALLBACK ##### -->
-<para>
-
-</para>
-
-@pspec: 
-
-
-<!-- ##### MACRO G_PARAM_SPEC_CCALLBACK ##### -->
-<para>
-
-</para>
-
-@pspec: 
-
-
 <!-- ##### MACRO G_IS_PARAM_SPEC_PARAM ##### -->
 <para>
 
@@ -414,13 +398,6 @@ Standard Parameter Types
 
 @parent_instance: 
 
-<!-- ##### STRUCT GParamSpecCCallback ##### -->
-<para>
-
-</para>
-
-@parent_instance: 
-
 <!-- ##### STRUCT GParamSpecParam ##### -->
 <para>
 
@@ -642,18 +619,6 @@ Standard Parameter Types
 @Returns: 
 
 
-<!-- ##### FUNCTION g_param_spec_ccallback ##### -->
-<para>
-
-</para>
-
-@name: 
-@nick: 
-@blurb: 
-@flags: 
-@Returns: 
-
-
 <!-- ##### FUNCTION g_param_spec_param ##### -->
 <para>
 
index 4289ca474884e69e6b48ab1bc548c242a426e9bb..87f848d1fa5ccefc9e1d439b16042fcf2b7cc893 100644 (file)
@@ -178,50 +178,48 @@ interfaces and C++ classes containing only pure virtual functions.
 The predefined identifiers of the reserved fundamental types.
 </para>
 
-@G_TYPE_INVALID:       Usually a return value indicating an error.
-@G_TYPE_NONE:          A synonym for the "void" type in C.
-@G_TYPE_INTERFACE:     Root type of all interface types.
-@G_TYPE_CHAR:          Identifier for the built-in type "gchar".
-@G_TYPE_UCHAR:                 Identifier for the built-in type "guchar".
-@G_TYPE_BOOLEAN:       Identifier for the built-in type "gboolean".
-@G_TYPE_INT:           Identifier for the built-in type "gint".
-@G_TYPE_UINT:          Identifier for the built-in type "guint".
-@G_TYPE_LONG:          Identifier for the built-in type "glong".
-@G_TYPE_ULONG:                 Identifier for the built-in type "gulong".
-@G_TYPE_ENUM:          Identifier for the "#GEnum" type.
-@G_TYPE_FLAGS:                 Identifier for the "#GFlags" type.
-@G_TYPE_FLOAT:                 Identifier for the built-in type "gfloat".
+@G_TYPE_INVALID:               Usually a return value indicating an error.
+@G_TYPE_NONE:                  A synonym for the "void" type in C.
+@G_TYPE_INTERFACE:             Root type of all interface types.
+@G_TYPE_CHAR:                  Identifier for the built-in type "gchar".
+@G_TYPE_UCHAR:                         Identifier for the built-in type "guchar".
+@G_TYPE_BOOLEAN:               Identifier for the built-in type "gboolean".
+@G_TYPE_INT:                   Identifier for the built-in type "gint".
+@G_TYPE_UINT:                  Identifier for the built-in type "guint".
+@G_TYPE_LONG:                  Identifier for the built-in type "glong".
+@G_TYPE_ULONG:                         Identifier for the built-in type "gulong".
+@G_TYPE_ENUM:                  Identifier for the "#GEnum" type.
+@G_TYPE_FLAGS:                         Identifier for the "#GFlags" type.
+@G_TYPE_FLOAT:                         Identifier for the built-in type "gfloat".
 @G_TYPE_DOUBLE:                Identifier for the built-in type "gdouble".
 @G_TYPE_STRING:                Identifier for a pointer to a null-terminated string "gchar*".
-@G_TYPE_PARAM:                 Identifier for the "#GParam" type.
-@G_TYPE_BOXED:                 Identifier for the "#GBoxed" type.
-@G_TYPE_POINTER:       Identifier for anonymous pointers "void*".
-@G_TYPE_CCALLBACK:     Identifier for a pointer to a C function.
+@G_TYPE_POINTER:               Identifier for anonymous pointers "void*".
+@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_GTK_SIGNAL:    Reserved for use by the Gtk+ software package.
-@G_TYPE_BSE_PROCEDURE:         Reserved for use by the BSE software package.
-@G_TYPE_BSE_TIME:      Reserved for use by the BSE software package.
-@G_TYPE_BSE_NOTE:      Reserved for use by the BSE software package.
-@G_TYPE_BSE_DOTS:      Reserved for use by the BSE software package.
-@G_TYPE_GLE_GOBJECT:   Reserved for use by the GLE software package.
-@G_TYPE_LAST_RESERVED_FUNDAMENTAL: New third-party fundamental types have to use IDs higher than this.
-@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_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_POINTER:         Identifier for the "#GParamSpecPointer" type.
-@G_TYPE_PARAM_CCALLBACK: Identifier for the "#GParamSpecCCallback" type.
-@G_TYPE_PARAM_BOXED:   Identifier for the "#GParamSpecBoxed" type.
-@G_TYPE_PARAM_OBJECT:  Identifier for the "#GParamSpecObject" type.
+@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_ARRAY: 
+@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_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_CLOSURE:                 Identifier for the "#GParamClosure" type.
+@G_TYPE_PARAM_OBJECT:          Identifier for the "#GParamSpecObject" type.
 
 <!-- ##### STRUCT GTypeInterface ##### -->
 <para>
@@ -256,8 +254,8 @@ across invocation of g_type_register_static().
 @instance_size:  Size of the instance (object) structure (required for instantiatable types only).
 @n_preallocs:   Number of pre-allocated (cached) instances to reserve memory for (0 indicates no caching).
 @instance_init:  Location of the instance initialization function (optional, for instantiatable types only).
-@value_table:   Function table for generic handling of GValues of this type (usualy only usefull for
-                fundamental types).
+@value_table:   A #GTypeValueTable function table for generic handling of GValues of this type (usualy only
+                usefull for fundamental types).
 
 <!-- ##### STRUCT GTypeFundamentalInfo ##### -->
 <para>
@@ -278,20 +276,6 @@ used specifically for managing interface types.
 @interface_data:       Location of user data passed to the @interface_init and
                        @interface_finalize functions (optional).
 
-<!-- ##### STRUCT GTypeValueTable ##### -->
-<para>
-
-</para>
-
-@value_init: 
-@value_free: 
-@value_copy: 
-@value_peek_pointer: 
-@collect_format: 
-@collect_value: 
-@lcopy_format: 
-@lcopy_value: 
-
 <!-- ##### MACRO G_TYPE_FROM_INSTANCE ##### -->
 <para>
 Returns the type identifier from a given @instance structure.
@@ -423,8 +407,8 @@ Return the unique name that is assigned to a type ID (this is the preferred meth
 to find out whether a specific type has been registered for the passed in ID yet).
 </para>
 
-@type:    Type to return name for.
-@Returns: Static type name or NULL.
+@type:                 Type to return name for.
+@Returns:      Static type name or NULL.
 
 
 <!-- ##### FUNCTION g_type_qname ##### -->
@@ -458,17 +442,17 @@ If the passed in type has no parent, i.e. is a fundamental type, 0 is returned.
 
 <!-- ##### FUNCTION g_type_next_base ##### -->
 <para>
-Given a @type and a @base_type which is contained in its anchestry, return
-the type that @base_type is the direct parent type for.
-In other words, for a given type branch, e.g. Root-Derived1-Derived2-Leaf, specified
-through @type=Leaf, return the nextmost child of @base_type. In this example, for
-@base_type=Derived1, the returned value would be Derived2, for @base_type=Root, the
-returned value would be Derived1.
+Given a @leaf_type and a @root_type which is contained in its anchestry, return
+the type that @root_type is the immediate parent of.
+In other words, this function determines the type that is derived directly from
+@root_type which is also a base class of @leaf_type.  Given a root type and a
+leaf type, this function can be used to determine the types and order in which
+the leaf type is descended from the root type.
 </para>
 
-@type:      Descendant of @base_type and the type to be returned.
-@base_type: Direct parent of the returned type.
-@Returns:   Immediate child of @base_type and anchestor of @type.
+@leaf_type:    Descendant of @root_type and the type to be returned.
+@root_type:    Immediate parent of the returned type.
+@Returns:      Immediate child of @root_type and anchestor of @leaf_type.
 
 
 <!-- ##### FUNCTION g_type_is_a ##### -->
@@ -799,6 +783,7 @@ Bit masks used to check or determine characteristics of a type.
 
 @G_TYPE_FLAG_ABSTRACT:         Indicates an abstract type. No instances can be
                        created for an abstract type.
+@G_TYPE_FLAG_VALUE_ABSTRACT: 
 
 <!-- ##### ENUM GTypeFundamentalFlags ##### -->
 <para>
@@ -1034,16 +1019,6 @@ the anchestry of @instance.
 @Returns: 
 
 
-<!-- ##### FUNCTION g_type_value_is_a ##### -->
-<para>
-Determines if @value is a #GValue whose type conforms to @type.
-</para>
-
-@value:          A valid #GValue structure.
-@type:    A #GType value.
-@Returns: #TRUE if @value is a #GValue of @type or #FALSE if not.
-
-
 <!-- ##### FUNCTION g_type_value_table_peek ##### -->
 <para>
 Returns the location of the #GTypeValueTable associated with @type.
index 9e568b26ee2f12f3ef36354878a60339d4f4d761..fe77eb6aedf365441ff866f269d33bcc91dcece0 100644 (file)
@@ -9,20 +9,14 @@ Standard value types
 
 </para>
 
+
 <!-- ##### SECTION See_Also ##### -->
 <para>
 
 </para>
 
-<!-- ##### MACRO G_IS_VALUE_CHAR ##### -->
-<para>
 
-</para>
-
-@value: 
-
-
-<!-- ##### MACRO G_IS_VALUE_UCHAR ##### -->
+<!-- ##### MACRO G_VALUE_HOLDS_CHAR ##### -->
 <para>
 
 </para>
@@ -30,7 +24,7 @@ Standard value types
 @value: 
 
 
-<!-- ##### MACRO G_IS_VALUE_BOOLEAN ##### -->
+<!-- ##### MACRO G_VALUE_HOLDS_UCHAR ##### -->
 <para>
 
 </para>
@@ -38,7 +32,7 @@ Standard value types
 @value: 
 
 
-<!-- ##### MACRO G_IS_VALUE_INT ##### -->
+<!-- ##### MACRO G_VALUE_HOLDS_BOOLEAN ##### -->
 <para>
 
 </para>
@@ -46,7 +40,7 @@ Standard value types
 @value: 
 
 
-<!-- ##### MACRO G_IS_VALUE_UINT ##### -->
+<!-- ##### MACRO G_VALUE_HOLDS_INT ##### -->
 <para>
 
 </para>
@@ -54,7 +48,7 @@ Standard value types
 @value: 
 
 
-<!-- ##### MACRO G_IS_VALUE_LONG ##### -->
+<!-- ##### MACRO G_VALUE_HOLDS_UINT ##### -->
 <para>
 
 </para>
@@ -62,7 +56,7 @@ Standard value types
 @value: 
 
 
-<!-- ##### MACRO G_IS_VALUE_ULONG ##### -->
+<!-- ##### MACRO G_VALUE_HOLDS_LONG ##### -->
 <para>
 
 </para>
@@ -70,7 +64,7 @@ Standard value types
 @value: 
 
 
-<!-- ##### MACRO G_IS_VALUE_FLOAT ##### -->
+<!-- ##### MACRO G_VALUE_HOLDS_ULONG ##### -->
 <para>
 
 </para>
@@ -78,7 +72,7 @@ Standard value types
 @value: 
 
 
-<!-- ##### MACRO G_IS_VALUE_DOUBLE ##### -->
+<!-- ##### MACRO G_VALUE_HOLDS_FLOAT ##### -->
 <para>
 
 </para>
@@ -86,7 +80,7 @@ Standard value types
 @value: 
 
 
-<!-- ##### MACRO G_IS_VALUE_STRING ##### -->
+<!-- ##### MACRO G_VALUE_HOLDS_DOUBLE ##### -->
 <para>
 
 </para>
@@ -94,7 +88,7 @@ Standard value types
 @value: 
 
 
-<!-- ##### MACRO G_IS_VALUE_POINTER ##### -->
+<!-- ##### MACRO G_VALUE_HOLDS_STRING ##### -->
 <para>
 
 </para>
@@ -102,7 +96,7 @@ Standard value types
 @value: 
 
 
-<!-- ##### MACRO G_IS_VALUE_CCALLBACK ##### -->
+<!-- ##### MACRO G_VALUE_HOLDS_POINTER ##### -->
 <para>
 
 </para>
@@ -110,7 +104,7 @@ Standard value types
 @value: 
 
 
-<!-- ##### MACRO G_IS_VALUE_PARAM ##### -->
+<!-- ##### MACRO G_VALUE_HOLDS_PARAM ##### -->
 <para>
 
 </para>
@@ -298,6 +292,15 @@ Standard value types
 @v_string: 
 
 
+<!-- ##### FUNCTION g_value_set_string_take_ownership ##### -->
+<para>
+This is an internal function introduced mainly for C marshallers.
+</para>
+
+@value: 
+@v_string: 
+
+
 <!-- ##### FUNCTION g_value_get_string ##### -->
 <para>
 
@@ -343,16 +346,6 @@ Standard value types
 @Returns: 
 
 
-<!-- ##### FUNCTION g_value_get_ccallback ##### -->
-<para>
-
-</para>
-
-@value: 
-@callback_func: 
-@callback_data: 
-
-
 <!-- ##### FUNCTION g_value_get_pointer ##### -->
 <para>
 
@@ -371,25 +364,6 @@ Standard value types
 @v_pointer: 
 
 
-<!-- ##### FUNCTION g_value_get_as_pointer ##### -->
-<para>
-
-</para>
-
-@value: 
-@Returns: 
-
-
-<!-- ##### FUNCTION g_value_set_ccallback ##### -->
-<para>
-
-</para>
-
-@value: 
-@callback_func: 
-@callback_data: 
-
-
 <!-- ##### FUNCTION g_value_set_instance ##### -->
 <para>
 
index c50d643f2af3c95884259d209afdf4a9a5d40cbc..9f32b76006baf35110e737a1502d15e38ed4ba49 100644 (file)
--- a/garray.c
+++ b/garray.c
@@ -286,7 +286,7 @@ g_array_sort (GArray       *farray,
 
 void
 g_array_sort_with_data (GArray           *farray,
-                       GCompareFuncData  compare_func,
+                       GCompareDataFunc  compare_func,
                        gpointer          user_data)
 {
   GRealArray *array = (GRealArray*) farray;
@@ -580,7 +580,7 @@ g_ptr_array_sort (GPtrArray    *array,
 
 void
 g_ptr_array_sort_with_data (GPtrArray        *array,
-                           GCompareFuncData  compare_func,
+                           GCompareDataFunc  compare_func,
                            gpointer          user_data)
 {
   g_return_if_fail (array != NULL);
@@ -663,7 +663,7 @@ g_byte_array_sort (GByteArray   *array,
 
 void
 g_byte_array_sort_with_data (GByteArray       *array,
-                            GCompareFuncData  compare_func,
+                            GCompareDataFunc  compare_func,
                             gpointer          user_data)
 {
   g_array_sort_with_data ((GArray *) array, compare_func, user_data);
index ddade3688021b9cf6805a0dc0a8575117168d678..766da77d6f09d235fc119a9f4bc9a07f716c53d0 100644 (file)
--- a/garray.h
+++ b/garray.h
@@ -91,7 +91,7 @@ GArray* g_array_remove_index_fast (GArray           *array,
 void    g_array_sort              (GArray           *array,
                                   GCompareFunc      compare_func);
 void    g_array_sort_with_data    (GArray           *array,
-                                  GCompareFuncData  compare_func,
+                                  GCompareDataFunc  compare_func,
                                   gpointer          user_data);
 
 /* Resizable pointer array.  This interface is much less complicated
@@ -119,7 +119,7 @@ void       g_ptr_array_add                (GPtrArray        *array,
 void       g_ptr_array_sort               (GPtrArray        *array,
                                           GCompareFunc      compare_func);
 void       g_ptr_array_sort_with_data     (GPtrArray        *array,
-                                          GCompareFuncData  compare_func,
+                                          GCompareDataFunc  compare_func,
                                           gpointer          user_data);
 
 
@@ -146,7 +146,7 @@ GByteArray* g_byte_array_remove_index_fast (GByteArray       *array,
 void        g_byte_array_sort              (GByteArray       *array,
                                            GCompareFunc      compare_func);
 void        g_byte_array_sort_with_data    (GByteArray       *array,
-                                           GCompareFuncData  compare_func,
+                                           GCompareDataFunc  compare_func,
                                            gpointer          user_data);
 
 
index b4392431b741a7fc20d9b81e4442f476f2e2efff..98e3dfebcaf9fdd50acb0a03b1af5006036bf822 100644 (file)
@@ -31,6 +31,7 @@
 #include       <gobject/gtypemodule.h>
 #include       <gobject/gtypeplugin.h>
 #include       <gobject/gvalue.h>
+#include       <gobject/gvaluearray.h>
 #include       <gobject/gvaluetypes.h>
 
 
index c50d643f2af3c95884259d209afdf4a9a5d40cbc..9f32b76006baf35110e737a1502d15e38ed4ba49 100644 (file)
@@ -286,7 +286,7 @@ g_array_sort (GArray       *farray,
 
 void
 g_array_sort_with_data (GArray           *farray,
-                       GCompareFuncData  compare_func,
+                       GCompareDataFunc  compare_func,
                        gpointer          user_data)
 {
   GRealArray *array = (GRealArray*) farray;
@@ -580,7 +580,7 @@ g_ptr_array_sort (GPtrArray    *array,
 
 void
 g_ptr_array_sort_with_data (GPtrArray        *array,
-                           GCompareFuncData  compare_func,
+                           GCompareDataFunc  compare_func,
                            gpointer          user_data)
 {
   g_return_if_fail (array != NULL);
@@ -663,7 +663,7 @@ g_byte_array_sort (GByteArray   *array,
 
 void
 g_byte_array_sort_with_data (GByteArray       *array,
-                            GCompareFuncData  compare_func,
+                            GCompareDataFunc  compare_func,
                             gpointer          user_data)
 {
   g_array_sort_with_data ((GArray *) array, compare_func, user_data);
index ddade3688021b9cf6805a0dc0a8575117168d678..766da77d6f09d235fc119a9f4bc9a07f716c53d0 100644 (file)
@@ -91,7 +91,7 @@ GArray* g_array_remove_index_fast (GArray           *array,
 void    g_array_sort              (GArray           *array,
                                   GCompareFunc      compare_func);
 void    g_array_sort_with_data    (GArray           *array,
-                                  GCompareFuncData  compare_func,
+                                  GCompareDataFunc  compare_func,
                                   gpointer          user_data);
 
 /* Resizable pointer array.  This interface is much less complicated
@@ -119,7 +119,7 @@ void       g_ptr_array_add                (GPtrArray        *array,
 void       g_ptr_array_sort               (GPtrArray        *array,
                                           GCompareFunc      compare_func);
 void       g_ptr_array_sort_with_data     (GPtrArray        *array,
-                                          GCompareFuncData  compare_func,
+                                          GCompareDataFunc  compare_func,
                                           gpointer          user_data);
 
 
@@ -146,7 +146,7 @@ GByteArray* g_byte_array_remove_index_fast (GByteArray       *array,
 void        g_byte_array_sort              (GByteArray       *array,
                                            GCompareFunc      compare_func);
 void        g_byte_array_sort_with_data    (GByteArray       *array,
-                                           GCompareFuncData  compare_func,
+                                           GCompareDataFunc  compare_func,
                                            gpointer          user_data);
 
 
index dbba47c9b3153df29d773db4cd888bd8feabbd35..9a8dbcf8e0aa80adbb070137e577fd32f92fe7ee 100644 (file)
@@ -1,5 +1,5 @@
 /* GObject - GLib Type, Object, Parameter and Signal Library
- * Copyright (C) 2000 Tim Janik
+ * Copyright (C) 2000-2001 Tim Janik
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -94,7 +94,7 @@ bsearch_array_insert (GBSearchArray *barray,
        }
       else
        barray->nodes = g_realloc (barray->nodes, barray->n_nodes * sizeof_node);
-      check = (char *) barray->nodes + i * sizeof_node;
+      check = ((guint8*) barray->nodes) + i * sizeof_node;
       g_memmove (check + sizeof_node, check, (n_nodes - i) * sizeof_node);
       replace = TRUE;
     SKIP_GROW:
index 3b0cf168299d28e29d11d5bcc725cf81b631f435..1bc0ab21ef956862a3dfbd772114698009010219 100644 (file)
@@ -1,5 +1,5 @@
 /* GObject - GLib Type, Object, Parameter and Signal Library
- * Copyright (C) 2000 Tim Janik
+ * Copyright (C) 2000-2001 Tim Janik
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -69,6 +69,9 @@ gpointer      g_bsearch_array_lookup          (GBSearchArray  *barray,
 G_INLINE_FUNC
 gpointer       g_bsearch_array_get_nth         (GBSearchArray  *barray,
                                                 guint           n);
+G_INLINE_FUNC
+guint          g_bsearch_array_get_index       (GBSearchArray  *barray,
+                                                gpointer        node_in_array);
 
 
 /* --- implementation details --- */
@@ -115,14 +118,25 @@ g_bsearch_array_get_nth (GBSearchArray *barray,
 {
   if (n < barray->n_nodes)
     {
-      guint8 *nodes = (guint8 *) barray->nodes;
+      guint8 *nodes = (guint8*) barray->nodes;
 
       return nodes + n * barray->sizeof_node;
     }
   else
     return NULL;
 }
-#endif  /* G_CAN_INLINE && __G_BSEARCHARRAY_C__ */
+G_INLINE_FUNC
+guint
+g_bsearch_array_get_index (GBSearchArray *barray,
+                          gpointer       node_in_array)
+{
+  guint distance = ((guint8*) node_in_array) - ((guint8*) barray->nodes);
+
+  distance /= barray->sizeof_node;
+
+  return MIN (distance, barray->n_nodes);
+}
+#endif  /* G_CAN_INLINE || __G_BSEARCHARRAY_C__ */
 
 
 
index b4392431b741a7fc20d9b81e4442f476f2e2efff..98e3dfebcaf9fdd50acb0a03b1af5006036bf822 100644 (file)
@@ -31,6 +31,7 @@
 #include       <gobject/gtypemodule.h>
 #include       <gobject/gtypeplugin.h>
 #include       <gobject/gvalue.h>
+#include       <gobject/gvaluearray.h>
 #include       <gobject/gvaluetypes.h>
 
 
index 8c2201069004f5b9332923316a72a268b2087b78..e629b1a204f4a50b9c074c2d9acc942d243857c9 100644 (file)
@@ -651,7 +651,7 @@ g_list_sort_merge (GList     *l1,
   while (l1 && l2)
     {
       if (use_data)
-       cmp = ((GCompareFuncData) compare_func) (l1->data, l2->data, user_data);
+       cmp = ((GCompareDataFunc) compare_func) (l1->data, l2->data, user_data);
       else
        cmp = ((GCompareFunc) compare_func) (l1->data, l2->data);
 
@@ -720,7 +720,7 @@ g_list_sort (GList        *list,
 
 GList *
 g_list_sort_with_data (GList            *list,
-                      GCompareFuncData  compare_func,
+                      GCompareDataFunc  compare_func,
                       gpointer          user_data)
 {
   return g_list_sort_real (list, (GFunc) compare_func, TRUE, user_data);
index 438b89bf6f2ba9a7b082a06a1ba6e47977ef991a..7b3e977a5e82f27e6e5c2ac353786cc97ab61711 100644 (file)
@@ -87,7 +87,7 @@ void     g_list_foreach        (GList            *list,
 GList*   g_list_sort           (GList            *list,
                                GCompareFunc      compare_func);
 GList*   g_list_sort_with_data (GList            *list,
-                               GCompareFuncData  compare_func,
+                               GCompareDataFunc  compare_func,
                                gpointer          user_data);
 gpointer g_list_nth_data       (GList            *list,
                                guint             n);
index 69b63637ef30f3749f73e06b7df2ffc214c59df6..c75cca31a45983d2505bd1f913309af9b37eb91f 100644 (file)
@@ -96,7 +96,7 @@ void
 g_qsort_with_data (gconstpointer    pbase,
                   gint             total_elems,
                   size_t           size,
-                  GCompareFuncData compare_func,
+                  GCompareDataFunc compare_func,
                   gpointer         user_data)
 {
   register char *base_ptr = (char *) pbase;
index f236e04fbe6ba35b5134c00f8480baad56d330e4..d946e80cadaffd23f47145f6387c0f51d7783ee0 100644 (file)
@@ -35,7 +35,7 @@ G_BEGIN_DECLS
 void g_qsort_with_data (gconstpointer    pbase,
                        gint             total_elems,
                        size_t           size,
-                       GCompareFuncData compare_func,
+                       GCompareDataFunc compare_func,
                        gpointer         user_data);
 
 G_END_DECLS
index 6c90199148e2e0d4d33e0aaef4ad7d1e60ef7e89..65c2c6cdb956fbb8aeb8fb00c7c97c1ed1a72a64 100644 (file)
@@ -634,7 +634,7 @@ g_slist_sort_merge (GSList   *l1,
   while (l1 && l2)
     {
       if (use_data)
-       cmp = ((GCompareFuncData) compare_func) (l1->data, l2->data, user_data);
+       cmp = ((GCompareDataFunc) compare_func) (l1->data, l2->data, user_data);
       else
        cmp = ((GCompareFunc) compare_func) (l1->data, l2->data);
 
@@ -695,7 +695,7 @@ g_slist_sort (GSList       *list,
 
 GSList *
 g_slist_sort_with_data (GSList           *list,
-                       GCompareFuncData  compare_func,
+                       GCompareDataFunc  compare_func,
                        gpointer          user_data)
 {
   return g_slist_sort_real (list, (GFunc) compare_func, TRUE, user_data);
index 446eab43eae54bebab981895f58a004f683c2e1c..8d94b2c075975725c22bc907089402f32eab9d29 100644 (file)
@@ -88,7 +88,7 @@ void     g_slist_foreach        (GSList           *list,
 GSList*  g_slist_sort           (GSList           *list,
                                 GCompareFunc      compare_func);
 GSList*  g_slist_sort_with_data (GSList           *list,
-                                GCompareFuncData  compare_func,
+                                GCompareDataFunc  compare_func,
                                 gpointer          user_data);
 gpointer g_slist_nth_data       (GSList           *list,
                                 guint             n);
index ff6fc7c6dabfb9e7b44ca8f10ee33f71c8059ecd..a720ac73d70debb216156822c41a3d6a58763d95 100644 (file)
@@ -565,9 +565,9 @@ g_string_up (GString *fstring)
 }
 
 static void
-g_string_sprintfa_int (GString     *string,
-                      const gchar *fmt,
-                      va_list      args)
+g_string_printfa_internal (GString     *string,
+                          const gchar *fmt,
+                          va_list      args)
 {
   gchar *buffer;
 
@@ -577,27 +577,27 @@ g_string_sprintfa_int (GString     *string,
 }
 
 void
-g_string_sprintf (GString *string,
-                 const gchar *fmt,
-                 ...)
+g_string_printf (GString *string,
+                const gchar *fmt,
+                ...)
 {
   va_list args;
 
   g_string_truncate (string, 0);
 
   va_start (args, fmt);
-  g_string_sprintfa_int (string, fmt, args);
+  g_string_printfa_internal (string, fmt, args);
   va_end (args);
 }
 
 void
-g_string_sprintfa (GString *string,
-                  const gchar *fmt,
-                  ...)
+g_string_printfa (GString *string,
+                 const gchar *fmt,
+                 ...)
 {
   va_list args;
 
   va_start (args, fmt);
-  g_string_sprintfa_int (string, fmt, args);
+  g_string_printfa_internal (string, fmt, args);
   va_end (args);
 }
index d2f88e066a00c3268b8c6540bf76481b17dceac4..84d0bbb3f10d91b654fb16f0465f66e3324cec2f 100644 (file)
@@ -94,12 +94,15 @@ GString*     g_string_erase         (GString         *string,
                                         gint             len);
 GString*     g_string_down              (GString        *string);
 GString*     g_string_up                (GString        *string);
-void         g_string_sprintf           (GString        *string,
+void         g_string_printf            (GString        *string,
                                         const gchar     *format,
                                         ...) G_GNUC_PRINTF (2, 3);
-void         g_string_sprintfa          (GString        *string,
+void         g_string_printfa           (GString        *string,
                                         const gchar     *format,
                                         ...) G_GNUC_PRINTF (2, 3);
+/* compatibility */
+#define        g_string_sprintf        g_string_printf
+#define        g_string_sprintfa       g_string_printfa
 
 G_END_DECLS
 
index c453eb64b82539978b8eb7e7e9fc2023ad6bd75a..5e0c0f57363f90084e31590c3461c1209c75997c 100644 (file)
@@ -41,7 +41,7 @@ typedef struct _GTreeNode  GTreeNode;
 struct _GRealTree
 {
   GTreeNode *root;
-  GCompareFuncData key_compare;
+  GCompareDataFunc key_compare;
   gpointer key_compare_data;
 };
 
@@ -59,13 +59,13 @@ static GTreeNode* g_tree_node_new                   (gpointer        key,
                                                     gpointer        value);
 static void       g_tree_node_destroy               (GTreeNode      *node);
 static GTreeNode* g_tree_node_insert                (GTreeNode      *node,
-                                                    GCompareFuncData compare,
+                                                    GCompareDataFunc compare,
                                                     gpointer        comp_data,
                                                     gpointer        key,
                                                     gpointer        value,
                                                     gint           *inserted);
 static GTreeNode* g_tree_node_remove                (GTreeNode      *node,
-                                                    GCompareFuncData compare,
+                                                    GCompareDataFunc compare,
                                                     gpointer        comp_data,
                                                     gconstpointer   key);
 static GTreeNode* g_tree_node_balance               (GTreeNode      *node);
@@ -76,7 +76,7 @@ static GTreeNode* g_tree_node_restore_left_balance  (GTreeNode      *node,
 static GTreeNode* g_tree_node_restore_right_balance (GTreeNode      *node,
                                                     gint            old_balance);
 static gpointer   g_tree_node_lookup                (GTreeNode      *node,
-                                                    GCompareFuncData compare,
+                                                    GCompareDataFunc compare,
                                                     gpointer        comp_data,
                                                     gconstpointer   key);
 static gint       g_tree_node_count                 (GTreeNode      *node);
@@ -157,7 +157,7 @@ g_tree_node_destroy (GTreeNode *node)
    }
 }
 
-GTree*  g_tree_new_udata(GCompareFuncData key_compare_func,
+GTree*  g_tree_new_udata(GCompareDataFunc key_compare_func,
                           gpointer        key_compare_data)
 {
   GRealTree *rtree;
@@ -175,7 +175,7 @@ GTree*       g_tree_new_udata(GCompareFuncData key_compare_func,
 GTree*
 g_tree_new (GCompareFunc key_compare_func)
 {
-  return g_tree_new_udata ((GCompareFuncData) key_compare_func, NULL);
+  return g_tree_new_udata ((GCompareDataFunc) key_compare_func, NULL);
 }
 
 
@@ -322,7 +322,7 @@ g_tree_nnodes (GTree *tree)
 
 static GTreeNode*
 g_tree_node_insert (GTreeNode      *node,
-                   GCompareFuncData compare,
+                   GCompareDataFunc compare,
                    gpointer        compare_data,
                    gpointer        key,
                    gpointer        value,
@@ -393,7 +393,7 @@ g_tree_node_insert (GTreeNode      *node,
 
 static GTreeNode*
 g_tree_node_remove (GTreeNode      *node,
-                   GCompareFuncData compare,
+                   GCompareDataFunc compare,
                    gpointer        compare_data,
                    gconstpointer   key)
 {
@@ -526,7 +526,7 @@ g_tree_node_restore_right_balance (GTreeNode *node,
 
 static gpointer
 g_tree_node_lookup (GTreeNode      *node,
-                   GCompareFuncData compare,
+                   GCompareDataFunc compare,
                    gpointer        compare_data,
                    gconstpointer   key)
 {
index 3530a6374bea9da7b7ac652f2523f6f0a2a31007..78a52fb0f4fcdd7d60937b1f3698d6f55a83dbd1 100644 (file)
@@ -40,7 +40,7 @@ typedef gint          (*GTraverseFunc)        (gpointer       key,
 /* Balanced binary trees
  */
 GTree*   g_tree_new           (GCompareFunc      key_compare_func);
-GTree*   g_tree_new_with_data (GCompareFuncData  key_compare_func,
+GTree*   g_tree_new_with_data (GCompareDataFunc  key_compare_func,
                               gpointer          user_data);
 void     g_tree_destroy       (GTree            *tree);
 void     g_tree_insert        (GTree            *tree,
index 21a29e91903cf6417d7ef89f4adaf2136b3bfbea..487ecdc776114f8372c724396a1c1156efc6d4b1 100644 (file)
@@ -69,7 +69,7 @@ typedef const void *gconstpointer;
 
 typedef gint            (*GCompareFunc)         (gconstpointer  a,
                                                  gconstpointer  b);
-typedef gint            (*GCompareFuncData)     (gconstpointer  a,
+typedef gint            (*GCompareDataFunc)     (gconstpointer  a,
                                                  gconstpointer  b,
                                                 gpointer       user_data);
 typedef gboolean        (*GEqualFunc)           (gconstpointer  a,
diff --git a/glist.c b/glist.c
index 8c2201069004f5b9332923316a72a268b2087b78..e629b1a204f4a50b9c074c2d9acc942d243857c9 100644 (file)
--- a/glist.c
+++ b/glist.c
@@ -651,7 +651,7 @@ g_list_sort_merge (GList     *l1,
   while (l1 && l2)
     {
       if (use_data)
-       cmp = ((GCompareFuncData) compare_func) (l1->data, l2->data, user_data);
+       cmp = ((GCompareDataFunc) compare_func) (l1->data, l2->data, user_data);
       else
        cmp = ((GCompareFunc) compare_func) (l1->data, l2->data);
 
@@ -720,7 +720,7 @@ g_list_sort (GList        *list,
 
 GList *
 g_list_sort_with_data (GList            *list,
-                      GCompareFuncData  compare_func,
+                      GCompareDataFunc  compare_func,
                       gpointer          user_data)
 {
   return g_list_sort_real (list, (GFunc) compare_func, TRUE, user_data);
diff --git a/glist.h b/glist.h
index 438b89bf6f2ba9a7b082a06a1ba6e47977ef991a..7b3e977a5e82f27e6e5c2ac353786cc97ab61711 100644 (file)
--- a/glist.h
+++ b/glist.h
@@ -87,7 +87,7 @@ void     g_list_foreach        (GList            *list,
 GList*   g_list_sort           (GList            *list,
                                GCompareFunc      compare_func);
 GList*   g_list_sort_with_data (GList            *list,
-                               GCompareFuncData  compare_func,
+                               GCompareDataFunc  compare_func,
                                gpointer          user_data);
 gpointer g_list_nth_data       (GList            *list,
                                guint             n);
index 2dc5102da36e60498825b10da9a25ec2317b52c3..9e70d513197e892346e2b7b9511e02c2473d773f 100644 (file)
@@ -2,10 +2,87 @@
 
        * Makefile.am: Avoid rebuilding everything everytime.
 
-Mon Mar  5 15:26:30 2001  Jonathan Blandford  <jrb@redhat.com>
+Wed Mar  7 09:36:33 2001  Tim Janik  <timj@gtk.org>
 
-       * gparamspecs.c (g_param_spec_interface): add a new param spec to
-       handle interfaces.
+       * gboxed.[hc]: changed prototype of g_boxed_type_register_static()
+       to contain an optional init function and a hint at whether the
+       boxed structure uses ref counting internally.
+       added g_value_set_boxed_take_ownership().
+       made G_TYPE_BOXED an abstract value type.
+
+       * genums.[hc]: made G_TYPE_ENUM and G_TYPE_FLAGS abstract value
+       types.
+
+       * glib-genmarshal.c: argument type changes, preparation for third-party
+       arg specification.
+
+       * gobject.[hc]: cleaned up get/set property code.
+       added g_strdup_value_contents() to improve warnings.
+
+       * gparam.[hc]: added g_param_value_convert(), taking over responsibility
+       of the old g_value_convert(). added G_PARAM_LAX_VALIDATION flag so
+       validation alterations may be valid a part of the property setting
+       process.
+
+       * gparamspecs.[hc]: made value comparisons stable (for sort applications).
+       added GParamSpecValueArray, a param spec for value arrays and
+       GParamSpecClosure. nuked the value exchange functions and
+       GParamSpecCCallback.
+
+       * gtype.[hc]: catch unintialized usages of the type system with
+       g_return_val_if_uninitialized(). introduced G_TYPE_FLAG_VALUE_ABSTRACT
+       to flag types that introduce a value table, but can't be used for
+       g_value_init(). cleaned up reserved type ids.
+
+       * gvalue.[hc]: code cleanups and saner checking.
+       nuked the value exchange API. implemented value transformations, we
+       can't really "convert" values, rather transforms are an anylogy to
+       C casts, real conversions need a param spec for validation, which is
+       why g_param_value_convert() does real conversions now.
+
+       * gvaluearray.[hc]: new files that implement a GValueArray, a struct
+       that can hold inhomogeneous arrays of value (to that extend that it
+       also allowes undefined values, i.e. G_VALUE_TYPE(value)==0).
+       this is exposed to the type system as a boxed type.
+
+       * gvaluetransform.c: new file implementing most of the former value
+       exchange functions as single-sided transformations.
+
+       * gvaluetypes.[hc]: nuked G_TYPE_CCALLBACK, added
+       g_value_set_string_take_ownership().
+
+       * *.h: s/G_IS_VALUE_/G_VALUE_HOLDS_/.
+
+       * *.[hc]: many fixes and cleanups.
+
+       * many warning improvements.
+
+Tue Feb 27 18:35:15 2001  Tim Janik  <timj@gtk.org>
+
+       * gobject.c (g_object_get_valist): urg, pass G_VALUE_NOCOPY_CONTENTS
+       into G_VALUE_LCOPY(), this needs proper documenting.
+
+       * gparam.c: fixed G_PARAM_USER_MASK.
+
+       * gtype.c (type_data_make_W): 
+       (type_data_last_unref_Wm): fixed invalid memory freeing.
+
+       * gobject.c (g_object_last_unref): destroy signal handlers associated
+       with object, right before finalization.
+
+       * gsignal.c (g_signal_parse_name): catch destroyed nodes or signals
+       that don't actually support details.
+
+       * gobject.[hc]: got rid of property trailers. nuked GObject
+       properties "data" and the "signal" variants.
+       (g_object_connect): new convenience function to do multiple
+       signal connections at once.
+       (g_object_disconnect): likewise, for disconnections.
+
+       * gparam.[hc] (g_param_spec_pool_lookup): took out trailer support.
+
+       * gvalue.[hc]: marked g_value_fits_pointer() and g_value_peek_pointer()
+       as private (the latter got renamed from g_value_get_as_pointer()).
 
 Wed Feb 21 18:31:46 2001  Jonathan Blandford  <jrb@redhat.com>
 
index aecfc3ae0e9c8b80fc3eff489970af0da2258687..1005bee33dcce987f5ac3af52587f34849270dc4 100644 (file)
@@ -8,6 +8,7 @@ INCLUDES = @STRIP_BEGIN@ \
        -I$(top_srcdir)                         \
        -I$(top_builddir)                       \
        @GLIB_DEBUG_FLAGS@                      \
+       -DG_DISABLE_CONST_RETURNS               \
 @STRIP_END@
 
 # libraries to compile and install
@@ -38,6 +39,7 @@ gruntime_public_h_sources = @STRIP_BEGIN@ \
        gtypemodule.h           \
        gtypeplugin.h           \
        gvalue.h                \
+       gvaluearray.h           \
        gvaluecollector.h       \
        gvaluetypes.h           \
 @STRIP_END@
@@ -57,6 +59,8 @@ gruntime_c_sources = @STRIP_BEGIN@ \
        gtypemodule.c           \
        gtypeplugin.c           \
        gvalue.c                \
+       gvaluearray.c           \
+       gvaluetransform.c       \
        gvaluetypes.c           \
 @STRIP_END@
 
index a2684b31b6869a5e2af168ff964ed6547d10325e..5356513e9594bdfec3e1db977b2331aac83e1254 100644 (file)
@@ -1,5 +1,5 @@
 /* GObject - GLib Type, Object, Parameter and Signal Library
- * Copyright (C) 2000 Red Hat, Inc.
+ * Copyright (C) 2000-2001 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -20,6 +20,8 @@
 
 #include       "gbsearcharray.h"
 #include       "gvalue.h"
+#include       "gvaluearray.h"
+#include       "gclosure.h"
 #include       "gvaluecollector.h"
 
 #include <string.h>
 typedef struct
 {
   GType                 type;
+  GBoxedInitFunc init;
   GBoxedCopyFunc copy;
   GBoxedFreeFunc free;
+  gboolean      is_refcounted;
 } BoxedNode;
 
 
@@ -52,6 +56,20 @@ boxed_nodes_cmp      (gconstpointer p1,
   return G_BSEARCH_ARRAY_CMP (node1->type, node2->type);
 }
 
+static inline void              /* keep this function in sync with gvalue.c */
+value_meminit (GValue *value,
+              GType   value_type)
+{
+  value->g_type = value_type;
+  memset (value->data, 0, sizeof (value->data));
+}
+
+static gpointer
+value_array_init (void)
+{
+  return g_value_array_new (0);
+}
+
 void
 g_boxed_type_init (void)  /* sync with gtype.c */
 {
@@ -72,14 +90,37 @@ g_boxed_type_init (void)  /* sync with gtype.c */
 
   /* G_TYPE_BOXED
    */
-  type = g_type_register_fundamental (G_TYPE_BOXED, "GBoxed", &info, &finfo, G_TYPE_FLAG_ABSTRACT);
+  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",
+                                      (GBoxedInitFunc) NULL,
+                                      (GBoxedCopyFunc) g_closure_ref,
+                                      (GBoxedFreeFunc) g_closure_unref,
+                                      TRUE);
+  g_assert (type == G_TYPE_CLOSURE);
+
+  /* boxed: G_TYPE_VALUE_ARRAY
+   */
+  type = g_boxed_type_register_static ("GValueArray",
+                                      value_array_init,        /* don't allow NULL values */
+                                      (GBoxedCopyFunc) g_value_array_copy,
+                                      (GBoxedFreeFunc) g_value_array_free,
+                                      FALSE);
+  g_assert (type == G_TYPE_VALUE_ARRAY);
 }
 
 static void
 boxed_proxy_value_init (GValue *value)
 {
-  value->data[0].v_pointer = 0;
+  BoxedNode key, *node;
+
+  key.type = G_VALUE_TYPE (value);
+  node = g_bsearch_array_lookup (&boxed_bsa, &key);
+  value->data[0].v_pointer = node->init ? node->init () : NULL;
 }
 
 static void
@@ -89,7 +130,7 @@ boxed_proxy_value_free (GValue *value)
     {
       BoxedNode key, *node;
 
-      key.type = value->g_type;
+      key.type = G_VALUE_TYPE (value);
       node = g_bsearch_array_lookup (&boxed_bsa, &key);
       node->free (value->data[0].v_pointer);
     }
@@ -103,7 +144,7 @@ boxed_proxy_value_copy (const GValue *src_value,
     {
       BoxedNode key, *node;
 
-      key.type = src_value->g_type;
+      key.type = G_VALUE_TYPE (src_value);
       node = g_bsearch_array_lookup (&boxed_bsa, &key);
       dest_value->data[0].v_pointer = node->copy (src_value->data[0].v_pointer);
     }
@@ -123,20 +164,24 @@ boxed_proxy_collect_value (GValue      *value,
                           GTypeCValue *collect_values,
                           guint        collect_flags)
 {
+  BoxedNode key, *node;
+
+  key.type = G_VALUE_TYPE (value);
+  node = g_bsearch_array_lookup (&boxed_bsa, &key);
+
+  /* for NULL values, we have to call GBoxedInitFunc */
   if (!collect_values[0].v_pointer)
-    value->data[0].v_pointer = NULL;
-  else if (collect_flags & G_VALUE_NOCOPY_CONTENTS)
-    {
-      value->data[0].v_pointer = collect_values[0].v_pointer;
-      value->data[1].v_uint = G_VALUE_NOCOPY_CONTENTS;
-    }
+    value->data[0].v_pointer = node->init ? node->init () : NULL;
   else
     {
-      BoxedNode key, *node;
-      
-      key.type = value->g_type;
-      node = g_bsearch_array_lookup (&boxed_bsa, &key);
-      value->data[0].v_pointer = node->copy (collect_values[0].v_pointer);
+      /* never honour G_VALUE_NOCOPY_CONTENTS for ref-counted types */
+      if (!node->is_refcounted && (collect_flags & G_VALUE_NOCOPY_CONTENTS))
+       {
+         value->data[0].v_pointer = collect_values[0].v_pointer;
+         value->data[1].v_uint = G_VALUE_NOCOPY_CONTENTS;
+       }
+      else
+       value->data[0].v_pointer = node->copy (collect_values[0].v_pointer);
     }
 
   return NULL;
@@ -161,7 +206,7 @@ boxed_proxy_lcopy_value (const GValue *value,
     {
       BoxedNode key, *node;
 
-      key.type = value->g_type;
+      key.type = G_VALUE_TYPE (value);
       node = g_bsearch_array_lookup (&boxed_bsa, &key);
       *boxed_p = node->copy (value->data[0].v_pointer);
     }
@@ -171,8 +216,10 @@ boxed_proxy_lcopy_value (const GValue *value,
 
 GType
 g_boxed_type_register_static (const gchar   *name,
+                             GBoxedInitFunc boxed_init,
                              GBoxedCopyFunc boxed_copy,
-                             GBoxedFreeFunc boxed_free)
+                             GBoxedFreeFunc boxed_free,
+                             gboolean       is_refcounted)
 {
   static const GTypeValueTable vtable = {
     boxed_proxy_value_init,
@@ -211,8 +258,10 @@ g_boxed_type_register_static (const gchar   *name,
       BoxedNode key;
 
       key.type = type;
+      key.init = boxed_init;
       key.copy = boxed_copy;
       key.free = boxed_free;
+      key.is_refcounted = is_refcounted != FALSE;
       g_bsearch_array_insert (&boxed_bsa, &key, TRUE);
     }
 
@@ -247,14 +296,26 @@ g_boxed_copy (GType         boxed_type,
     {
       GValue src_value, dest_value;
       
-      /* we heavil rely on the gvalue.c implementation here */
-
-      memset (&src_value.data, 0, sizeof (src_value.data));
-      memset (&dest_value.data, 0, sizeof (dest_value.data));
-      dest_value.g_type = boxed_type;
-      src_value.g_type = boxed_type;
+      /* we heavil rely on third-party boxed type value vtable
+       * implementations to follow normal boxed value storage
+       * (data[0].v_pointer is the boxed struct, and
+       * data[1].v_uint holds the G_VALUE_NOCOPY_CONTENTS flag,
+       * rest zero).
+       * but then, we can expect that since we layed out the
+       * g_boxed_*() API.
+       * data[1].v_uint&G_VALUE_NOCOPY_CONTENTS shouldn't be set
+       * after a copy.
+       */
+      /* equiv. to g_value_set_static_boxed() */
+      value_meminit (&src_value, boxed_type);
       src_value.data[0].v_pointer = (gpointer) src_boxed;
+      src_value.data[1].v_uint = G_VALUE_NOCOPY_CONTENTS;
+
+      /* call third-party code copy fucntion, fingers-crossed */
+      value_meminit (&dest_value, boxed_type);
       value_table->value_copy (&src_value, &dest_value);
+
+      /* double check and grouse if things went wrong */
       if (dest_value.data[1].v_ulong ||
          dest_value.data[2].v_ulong ||
          dest_value.data[3].v_ulong)
@@ -294,54 +355,100 @@ g_boxed_free (GType    boxed_type,
     {
       GValue value;
 
-      /* we heavil rely on the gvalue.c implementation here */
-      memset (&value.data, 0, sizeof (value.data));
-      value.g_type = boxed_type;
+      /* see g_boxed_copy() on why we think we can do this */
+      value_meminit (&value, boxed_type);
       value.data[0].v_pointer = boxed;
       value_table->value_free (&value);
     }
 }
 
+gpointer
+g_value_get_boxed (const GValue *value)
+{
+  g_return_val_if_fail (G_VALUE_HOLDS_BOXED (value), NULL);
+  g_return_val_if_fail (G_TYPE_IS_VALUE (G_VALUE_TYPE (value)), NULL);
+
+  return value->data[0].v_pointer;
+}
+
+gpointer
+g_value_dup_boxed (GValue *value)
+{
+  g_return_val_if_fail (G_VALUE_HOLDS_BOXED (value), NULL);
+  g_return_val_if_fail (G_TYPE_IS_VALUE (G_VALUE_TYPE (value)), NULL);
+
+  return value->data[0].v_pointer ? g_boxed_copy (G_VALUE_TYPE (value), value->data[0].v_pointer) : NULL;
+}
+
+static inline void
+value_set_boxed_internal (GValue       *value,
+                         gconstpointer const_boxed,
+                         gboolean      need_copy,
+                         gboolean      need_free)
+{
+  BoxedNode key, *node;
+  gpointer boxed = (gpointer) const_boxed;
+
+  if (!boxed)
+    {
+      /* just resetting to NULL might not be desired, need to
+       * have value reinitialized also (for values defaulting
+       * to other default value states than a NULL data pointer),
+       * g_value_reset() will handle this
+       */
+      g_value_reset (value);
+      return;
+    }
+
+  key.type = G_VALUE_TYPE (value);
+  node = g_bsearch_array_lookup (&boxed_bsa, &key);
+
+  if (node)
+    {
+      /* we proxy this type, free contents and copy right away */
+      if (value->data[0].v_pointer && !(value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS))
+       node->free (value->data[0].v_pointer);
+      value->data[1].v_uint = need_free ? 0 : G_VALUE_NOCOPY_CONTENTS;
+      value->data[0].v_pointer = need_copy ? node->copy (boxed) : boxed;
+    }
+  else
+    {
+      /* we don't handle this type, free contents and let g_boxed_copy()
+       * figure what's required
+       */
+      if (value->data[0].v_pointer && !(value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS))
+       g_boxed_free (G_VALUE_TYPE (value), value->data[0].v_pointer);
+      value->data[1].v_uint = need_free ? 0 : G_VALUE_NOCOPY_CONTENTS;
+      value->data[0].v_pointer = need_copy ? g_boxed_copy (G_VALUE_TYPE (value), boxed) : boxed;
+    }
+}
+
 void
 g_value_set_boxed (GValue       *value,
                   gconstpointer boxed)
 {
-  g_return_if_fail (G_IS_VALUE_BOXED (value));
+  g_return_if_fail (G_VALUE_HOLDS_BOXED (value));
   g_return_if_fail (G_TYPE_IS_VALUE (G_VALUE_TYPE (value)));
 
-  if (value->data[0].v_pointer && !(value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS))
-    g_boxed_free (G_VALUE_TYPE (value), value->data[0].v_pointer);
-  value->data[0].v_pointer = boxed ? g_boxed_copy (G_VALUE_TYPE (value), boxed) : NULL;
-  value->data[1].v_uint = 0;
+  value_set_boxed_internal (value, boxed, TRUE, TRUE);
 }
 
 void
 g_value_set_static_boxed (GValue       *value,
                          gconstpointer boxed)
 {
-  g_return_if_fail (G_IS_VALUE_BOXED (value));
+  g_return_if_fail (G_VALUE_HOLDS_BOXED (value));
   g_return_if_fail (G_TYPE_IS_VALUE (G_VALUE_TYPE (value)));
 
-  if (value->data[0].v_pointer && !(value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS))
-    g_boxed_free (G_VALUE_TYPE (value), value->data[0].v_pointer);
-  value->data[0].v_pointer = (gpointer) boxed;
-  value->data[1].v_uint = boxed ? G_VALUE_NOCOPY_CONTENTS : 0;
-}
-
-gpointer
-g_value_get_boxed (const GValue *value)
-{
-  g_return_val_if_fail (G_IS_VALUE_BOXED (value), NULL);
-  g_return_val_if_fail (G_TYPE_IS_VALUE (G_VALUE_TYPE (value)), NULL);
-
-  return value->data[0].v_pointer;
+  value_set_boxed_internal (value, boxed, FALSE, FALSE);
 }
 
-gpointer
-g_value_dup_boxed (GValue *value)
+void
+g_value_set_boxed_take_ownership (GValue       *value,
+                                 gconstpointer boxed)
 {
-  g_return_val_if_fail (G_IS_VALUE_BOXED (value), NULL);
-  g_return_val_if_fail (G_TYPE_IS_VALUE (G_VALUE_TYPE (value)), NULL);
+  g_return_if_fail (G_VALUE_HOLDS_BOXED (value));
+  g_return_if_fail (G_TYPE_IS_VALUE (G_VALUE_TYPE (value)));
 
-  return value->data[0].v_pointer ? g_boxed_copy (G_VALUE_TYPE (value), value->data[0].v_pointer) : NULL;
+  value_set_boxed_internal (value, boxed, FALSE, TRUE);
 }
index 7b7e9a51a3c9d8780b4400c9aabd3b90a3e600e3..c12bd4038c927278061835ad576fdf7ec3c621da 100644 (file)
@@ -1,5 +1,5 @@
 /* GObject - GLib Type, Object, Parameter and Signal Library
- * Copyright (C) 2000 Red Hat, Inc.
+ * Copyright (C) 2000-2001 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -28,12 +28,13 @@ extern "C" {
 
 
 /* --- type macros --- */
-#define G_TYPE_IS_BOXED(type)  (G_TYPE_FUNDAMENTAL (type) == G_TYPE_BOXED)
-#define G_IS_VALUE_BOXED(value)        (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_BOXED))
+#define G_TYPE_IS_BOXED(type)     (G_TYPE_FUNDAMENTAL (type) == G_TYPE_BOXED)
+#define G_VALUE_HOLDS_BOXED(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_BOXED))
 
 
 /* --- typedefs --- */
 typedef struct _GBoxed GBoxed;
+typedef gpointer (*GBoxedInitFunc)     (void);
 typedef gpointer (*GBoxedCopyFunc)     (gpointer        boxed);
 typedef void     (*GBoxedFreeFunc)     (gpointer        boxed);
 
@@ -43,20 +44,26 @@ GBoxed*             g_boxed_copy                    (GType           boxed_type,
                                                 gconstpointer   src_boxed);
 void           g_boxed_free                    (GType           boxed_type,
                                                 gpointer        boxed);
-void            g_value_set_boxed              (GValue         *value,
-                                                gconstpointer   boxed);
-void            g_value_set_static_boxed       (GValue         *value,
-                                                gconstpointer   boxed);
-gpointer       g_value_get_boxed               (const GValue   *value);
-gpointer       g_value_dup_boxed               (GValue         *value);
+void           g_value_set_boxed               (GValue         *value,
+                                                gconstpointer   boxed);
+void           g_value_set_static_boxed        (GValue         *value,
+                                                gconstpointer   boxed);
+gpointer       g_value_get_boxed               (const GValue   *value);
+gpointer       g_value_dup_boxed               (GValue         *value);
 
 
 /* --- convenience --- */
-GType  g_boxed_type_register_static    (const gchar   *name,
-                                        GBoxedCopyFunc boxed_copy,
-                                        GBoxedFreeFunc boxed_free);
+GType  g_boxed_type_register_static            (const gchar    *name,
+                                                GBoxedInitFunc  boxed_init,
+                                                GBoxedCopyFunc  boxed_copy,
+                                                GBoxedFreeFunc  boxed_free,
+                                                gboolean        is_refcounted);
 
 
+/* --- marshaller specific --- */
+void   g_value_set_boxed_take_ownership        (GValue         *value,
+                                                gconstpointer   boxed);
+
 
 
 #ifdef __cplusplus
index dbba47c9b3153df29d773db4cd888bd8feabbd35..9a8dbcf8e0aa80adbb070137e577fd32f92fe7ee 100644 (file)
@@ -1,5 +1,5 @@
 /* GObject - GLib Type, Object, Parameter and Signal Library
- * Copyright (C) 2000 Tim Janik
+ * Copyright (C) 2000-2001 Tim Janik
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -94,7 +94,7 @@ bsearch_array_insert (GBSearchArray *barray,
        }
       else
        barray->nodes = g_realloc (barray->nodes, barray->n_nodes * sizeof_node);
-      check = (char *) barray->nodes + i * sizeof_node;
+      check = ((guint8*) barray->nodes) + i * sizeof_node;
       g_memmove (check + sizeof_node, check, (n_nodes - i) * sizeof_node);
       replace = TRUE;
     SKIP_GROW:
index 3b0cf168299d28e29d11d5bcc725cf81b631f435..1bc0ab21ef956862a3dfbd772114698009010219 100644 (file)
@@ -1,5 +1,5 @@
 /* GObject - GLib Type, Object, Parameter and Signal Library
- * Copyright (C) 2000 Tim Janik
+ * Copyright (C) 2000-2001 Tim Janik
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -69,6 +69,9 @@ gpointer      g_bsearch_array_lookup          (GBSearchArray  *barray,
 G_INLINE_FUNC
 gpointer       g_bsearch_array_get_nth         (GBSearchArray  *barray,
                                                 guint           n);
+G_INLINE_FUNC
+guint          g_bsearch_array_get_index       (GBSearchArray  *barray,
+                                                gpointer        node_in_array);
 
 
 /* --- implementation details --- */
@@ -115,14 +118,25 @@ g_bsearch_array_get_nth (GBSearchArray *barray,
 {
   if (n < barray->n_nodes)
     {
-      guint8 *nodes = (guint8 *) barray->nodes;
+      guint8 *nodes = (guint8*) barray->nodes;
 
       return nodes + n * barray->sizeof_node;
     }
   else
     return NULL;
 }
-#endif  /* G_CAN_INLINE && __G_BSEARCHARRAY_C__ */
+G_INLINE_FUNC
+guint
+g_bsearch_array_get_index (GBSearchArray *barray,
+                          gpointer       node_in_array)
+{
+  guint distance = ((guint8*) node_in_array) - ((guint8*) barray->nodes);
+
+  distance /= barray->sizeof_node;
+
+  return MIN (distance, barray->n_nodes);
+}
+#endif  /* G_CAN_INLINE || __G_BSEARCHARRAY_C__ */
 
 
 
index 5b386d6b84bb8219184210cd024396cf1573391f..3fc3387c119f2a437047996db1046dbb0dd60c9a 100644 (file)
@@ -1,5 +1,5 @@
 /* GObject - GLib Type, Object, Parameter and Signal Library
- * Copyright (C) 2000 Red Hat, Inc.
+ * Copyright (C) 2000-2001 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -158,7 +158,7 @@ g_closure_set_meta_marshal (GClosure       *closure,
   g_return_if_fail (meta_marshal != NULL);
   g_return_if_fail (closure->is_invalid == FALSE);
   g_return_if_fail (closure->in_marshal == FALSE);
-  g_return_if_fail (closure->meta_marshal == FALSE);
+  g_return_if_fail (closure->meta_marshal == 0);
 
   n = CLOSURE_N_NOTIFIERS (closure);
   notifiers = closure->notifiers;
@@ -506,7 +506,7 @@ g_type_class_meta_marshal (GClosure       *closure,
   /* GType itype = GPOINTER_TO_UINT (closure->data); */
   guint offset = GPOINTER_TO_UINT (marshal_data);
   
-  class = G_TYPE_INSTANCE_GET_CLASS (g_value_get_as_pointer (param_values + 0), itype, GTypeClass);
+  class = G_TYPE_INSTANCE_GET_CLASS (g_value_peek_pointer (param_values + 0), itype, GTypeClass);
   callback = G_STRUCT_MEMBER (gpointer, class, offset);
   if (callback)
     closure->marshal (closure,
@@ -529,7 +529,7 @@ g_type_iface_meta_marshal (GClosure       *closure,
   GType itype = GPOINTER_TO_UINT (closure->data);
   guint offset = GPOINTER_TO_UINT (marshal_data);
   
-  class = G_TYPE_INSTANCE_GET_INTERFACE (g_value_get_as_pointer (param_values + 0), itype, GTypeClass);
+  class = G_TYPE_INSTANCE_GET_INTERFACE (g_value_peek_pointer (param_values + 0), itype, GTypeClass);
   callback = G_STRUCT_MEMBER (gpointer, class, offset);
   if (callback)
     closure->marshal (closure,
index df766413aba318faaf1779b8730d30b45724bf17..8ae329f6b9eea435802d2ab84074a7d0e14b6f21 100644 (file)
@@ -1,5 +1,5 @@
 /* GObject - GLib Type, Object, Parameter and Signal Library
- * Copyright (C) 2000 Red Hat, Inc.
+ * Copyright (C) 2000-2001 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -38,7 +38,7 @@ extern "C" {
 /* -- typedefs --- */
 typedef struct _GClosure                GClosure;
 typedef struct _GClosureNotifyData      GClosureNotifyData;
-typedef        gpointer GCallback;
+typedef        gpointer                         GCallback;
 typedef void  (*GClosureNotify)                (gpointer        data,
                                         GClosure       *closure);
 typedef void  (*GClosureMarshal)       (GClosure       *closure,
@@ -85,7 +85,7 @@ struct _GClosure
    * - order of inotifiers is random
    *   inotifiers may _not_ free/invalidate parameter values (e.g. ->data)
    * - order of fnotifiers is random
-   * - notifiers may only be removed before or during their invocation
+   * - each notifier may only be removed before or during its invocation
    * - reference counting may only happen prior to fnotify invocation
    *   (in that sense, fnotifiers are really finalization handlers)
    */
index 6a20024fd6e2b183415395e4ace7a837e378f56a..e0ecf5c5a032663ac873f94303f79d810c79c9bb 100644 (file)
@@ -1,5 +1,5 @@
 /* GObject - GLib Type, Object, Parameter and Signal Library
- * Copyright (C) 1998, 1999, 2000 Tim Janik and Red Hat, Inc.
+ * Copyright (C) 1998-1999, 2000-2001 Tim Janik and Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -85,13 +85,15 @@ g_enum_types_init (void)    /* sync with gtype.c */
   /* G_TYPE_ENUM
    */
   info.class_size = sizeof (GEnumClass);
-  type = g_type_register_fundamental (G_TYPE_ENUM, "GEnum", &info, &finfo, G_TYPE_FLAG_ABSTRACT);
+  type = g_type_register_fundamental (G_TYPE_ENUM, "GEnum", &info, &finfo,
+                                     G_TYPE_FLAG_ABSTRACT | G_TYPE_FLAG_VALUE_ABSTRACT);
   g_assert (type == G_TYPE_ENUM);
   
   /* G_TYPE_FLAGS
    */
   info.class_size = sizeof (GFlagsClass);
-  type = g_type_register_fundamental (G_TYPE_FLAGS, "GFlags", &info, &finfo, G_TYPE_FLAG_ABSTRACT);
+  type = g_type_register_fundamental (G_TYPE_FLAGS, "GFlags", &info, &finfo,
+                                     G_TYPE_FLAG_ABSTRACT | G_TYPE_FLAG_VALUE_ABSTRACT);
   g_assert (type == G_TYPE_FLAGS);
 }
 
@@ -378,7 +380,7 @@ g_flags_get_first_value (GFlagsClass *flags_class,
       GFlagsValue *flags_value;
       
       for (flags_value = flags_class->values; flags_value->value_name; flags_value++)
-       if ((flags_value->value & value) > 0)
+       if ((flags_value->value & value) == flags_value->value)
          return flags_value;
     }
   
@@ -389,7 +391,7 @@ void
 g_value_set_enum (GValue *value,
                  gint    v_enum)
 {
-  g_return_if_fail (G_IS_VALUE_ENUM (value));
+  g_return_if_fail (G_VALUE_HOLDS_ENUM (value));
   
   value->data[0].v_long = v_enum;
 }
@@ -397,7 +399,7 @@ g_value_set_enum (GValue *value,
 gint
 g_value_get_enum (const GValue *value)
 {
-  g_return_val_if_fail (G_IS_VALUE_ENUM (value), 0);
+  g_return_val_if_fail (G_VALUE_HOLDS_ENUM (value), 0);
   
   return value->data[0].v_long;
 }
@@ -406,7 +408,7 @@ void
 g_value_set_flags (GValue *value,
                   guint   v_flags)
 {
-  g_return_if_fail (G_IS_VALUE_FLAGS (value));
+  g_return_if_fail (G_VALUE_HOLDS_FLAGS (value));
   
   value->data[0].v_ulong = v_flags;
 }
@@ -414,7 +416,7 @@ g_value_set_flags (GValue *value,
 guint
 g_value_get_flags (const GValue *value)
 {
-  g_return_val_if_fail (G_IS_VALUE_FLAGS (value), 0);
+  g_return_val_if_fail (G_VALUE_HOLDS_FLAGS (value), 0);
   
   return value->data[0].v_ulong;
 }
index d2d4ff05298ebc73bcf89df0af9b0070f800ab03..bd1ea6ef6d932552b3abc53b00e43f39b7027f9f 100644 (file)
@@ -1,5 +1,5 @@
 /* GObject - GLib Type, Object, Parameter and Signal Library
- * Copyright (C) 1998, 1999, 2000 Tim Janik and Red Hat, Inc.
+ * Copyright (C) 1998-1999, 2000-2001 Tim Janik and Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -38,8 +38,8 @@ extern "C" {
 #define G_IS_FLAGS_CLASS(class)        (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_FLAGS))
 #define G_FLAGS_CLASS_TYPE(class)      (G_TYPE_FROM_CLASS (class))
 #define G_FLAGS_CLASS_TYPE_NAME(class) (g_type_name (G_FLAGS_TYPE (class)))
-#define G_IS_VALUE_ENUM(value)         (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_ENUM))
-#define G_IS_VALUE_FLAGS(value)        (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_FLAGS))
+#define G_VALUE_HOLDS_ENUM(value)      (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_ENUM))
+#define G_VALUE_HOLDS_FLAGS(value)     (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_FLAGS))
 
 
 /* --- enum/flag values & classes --- */
index 687b0201173442b419d7aad12e6ea7c845290f79..c35606a5a53c1e88f2c60f705a70158d7a2bb2aa 100644 (file)
@@ -124,6 +124,7 @@ for boxed (anonymous but reference counted) types (GBoxed*)
 .TP 12
 \fIPARAM
 for GParamSpec or derived types (GParamSpec*)
+.TP 12
 \fIPOINTER
 for anonymous pointer types (gpointer)
 .TP 12
index f1b4c3b08229f960c15a7b7de0b90420d1d0d17a..5b6b86ba8f78b29fcbdd638c2b899230b5f2ce31 100644 (file)
@@ -1,5 +1,5 @@
 /* GLIB-GenMarshal - Marshaller generator for GObject library
- * Copyright (C) 2000 Red Hat, Inc.
+ * Copyright (C) 2000-2001 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -48,21 +48,27 @@ char *g_log_domain_gruntime = "GLib-Genmarshal";
 
 
 /* --- typedefs & structures --- */
-typedef struct _Argument  Argument;
-typedef struct _Signature Signature;
-struct _Argument
+typedef struct
 {
-  gchar       *pname;          /* parsed name */
-  const gchar *sname;          /* signature name */
-  const gchar *func;           /* functional extension */
-  const gchar *cname;          /* C name */
-};
-struct _Signature
+  gchar              *keyword;         /* marhaller list keyword [MY_STRING] */
+  const gchar *sig_name;       /* signature name [STRING] */
+  const gchar *ctype;          /* C type name [gchar*] */
+  const gchar *getter;         /* value getter function [g_value_get_string] */
+} InArgument;
+typedef struct
 {
-  gchar    *ploc;
-  Argument *rarg;
-  GList    *args;      /* of type Argument* */
-};
+  gchar              *keyword;         /* marhaller list keyword [MY_STRING] */
+  const gchar *sig_name;       /* signature name [STRING] */
+  const gchar *ctype;          /* C type name [gchar*] */
+  const gchar *setter;         /* value setter function [g_value_set_string] */
+  const gchar *release;                /* value release function [g_free] */
+} OutArgument;
+typedef struct
+{
+  gchar       *ploc;
+  OutArgument *rarg;
+  GList       *args;   /* of type InArgument* */
+} Signature;
 
 
 /* --- prototypes --- */
@@ -125,72 +131,89 @@ static gboolean            std_includes = TRUE;
 
 /* --- functions --- */
 static gboolean
-complete_arg (Argument *arg,
-             gboolean  is_return)
+complete_in_arg (InArgument *iarg)
 {
-  static const Argument inout_arguments[] = {
-    /* pname,          sname,          func,                   cname           */
-    { "VOID",          "VOID",         NULL,                   "void",         },
-    { "BOOLEAN",       "BOOLEAN",      "boolean",              "gboolean",     },
-    { "CHAR",          "CHAR",         "char",                 "gchar",        },
-    { "UCHAR",         "UCHAR",        "uchar",                "guchar",       },
-    { "INT",           "INT",          "int",                  "gint",         },
-    { "UINT",          "UINT",         "uint",                 "guint",        },
-    { "LONG",          "LONG",         "long",                 "glong",        },
-    { "ULONG",         "ULONG",        "ulong",                "gulong",       },
-    { "ENUM",          "ENUM",         "enum",                 "gint",         },
-    { "FLAGS",         "FLAGS",        "flags",                "guint",        },
-    { "FLOAT",         "FLOAT",        "float",                "gfloat",       },
-    { "DOUBLE",                "DOUBLE",       "double",               "gdouble",      },
+  static const InArgument args[] = {
+    /* keyword         sig_name        ctype           getter                  */
+    { "VOID",          "VOID",         "void",         NULL,                   },
+    { "BOOLEAN",       "BOOLEAN",      "gboolean",     "g_value_get_boolean",  },
+    { "CHAR",          "CHAR",         "gchar",        "g_value_get_char",     },
+    { "UCHAR",         "UCHAR",        "guchar",       "g_value_get_uchar",    },
+    { "INT",           "INT",          "gint",         "g_value_get_int",      },
+    { "UINT",          "UINT",         "guint",        "g_value_get_uint",     },
+    { "LONG",          "LONG",         "glong",        "g_value_get_long",     },
+    { "ULONG",         "ULONG",        "gulong",       "g_value_get_ulong",    },
+    { "ENUM",          "ENUM",         "gint",         "g_value_get_enum",     },
+    { "FLAGS",         "FLAGS",        "guint",        "g_value_get_flags",    },
+    { "FLOAT",         "FLOAT",        "gfloat",       "g_value_get_float",    },
+    { "DOUBLE",                "DOUBLE",       "gdouble",      "g_value_get_double",   },
+    { "STRING",                "STRING",       "gpointer",     "(char*) g_value_get_string",   },
+    { "PARAM",         "PARAM",        "gpointer",     "g_value_get_param",    },
+    { "BOXED",         "BOXED",        "gpointer",     "g_value_get_boxed",    },
+    { "POINTER",       "POINTER",      "gpointer",     "g_value_get_pointer",  },
+    { "OBJECT",                "OBJECT",       "gpointer",     "g_value_get_object",   },
     /* deprecated: */
-    { "NONE",          "VOID",         NULL,                   "void",         },
-    { "BOOL",          "BOOLEAN",      "boolean",              "gboolean",     },
+    { "NONE",          "VOID",         "void",         NULL,                   },
+    { "BOOL",          "BOOLEAN",      "gboolean",     "g_value_get_boolean",  },
   };
-  static const Argument in_arguments[] = {
-    { "STRING",                "POINTER",      "as_pointer",           "gpointer",     },
-    { "BOXED",         "POINTER",      "as_pointer",           "gpointer",     },
-    { "POINTER",       "POINTER",      "as_pointer",           "gpointer",     },
-    { "PARAM",         "POINTER",      "as_pointer",           "gpointer",     },
-    { "OBJECT",                "POINTER",      "as_pointer",           "gpointer",     },
-  };
-  static const Argument out_arguments[] = {
-    { "STRING",                "STRING",       "string",               "gchar*",       },
-    { "BOXED",         "BOXED",        "boxed",                "gpointer",     },
-    { "POINTER",       "POINTER",      "pointer",              "gpointer",     },
-    { "PARAM",         "PARAM",        "param",                "GParamSpec*",  },
-    { "OBJECT",                "OBJECT",       "object",               "GObject*",     },
-  };
-  const guint n_inout_arguments = sizeof (inout_arguments) / sizeof (inout_arguments[0]);
-  const guint n_out_arguments = sizeof (out_arguments) / sizeof (out_arguments[0]);
-  const guint n_in_arguments = sizeof (in_arguments) / sizeof (in_arguments[0]);
-  const Argument *arguments;
-  guint i, n_arguments;
-
-  g_return_val_if_fail (arg != NULL, FALSE);
-
-  arguments = inout_arguments;
-  n_arguments = n_inout_arguments;
-  for (i = 0; i < n_arguments; i++)
-    if (strcmp (arguments[i].pname, arg->pname) == 0)
+  const guint n_args = sizeof (args) / sizeof (args[0]);
+  guint i;
+
+  g_return_val_if_fail (iarg != NULL, FALSE);
+
+  for (i = 0; i < n_args; i++)
+    if (strcmp (args[i].keyword, iarg->keyword) == 0)
       {
-       arg->sname = arguments[i].sname;
-       arg->func = arguments[i].func;
-       arg->cname = arguments[i].cname;
+       iarg->sig_name = args[i].sig_name;
+       iarg->ctype = args[i].ctype;
+       iarg->getter = args[i].getter;
 
        return TRUE;
       }
-  arguments = is_return ? out_arguments : in_arguments;
-  n_arguments = is_return ? n_out_arguments : n_in_arguments;
-  for (i = 0; i < n_arguments; i++)
-    if (strcmp (arguments[i].pname, arg->pname) == 0)
+  return FALSE;
+}
+
+static gboolean
+complete_out_arg (OutArgument *oarg)
+{
+  static const OutArgument args[] = {
+    /* keyword         sig_name        ctype           setter                  release */
+    { "VOID",          "VOID",         "void",         NULL,                   NULL,                   },
+    { "BOOLEAN",       "BOOLEAN",      "gboolean",     "g_value_set_boolean",  NULL,                   },
+    { "CHAR",          "CHAR",         "gchar",        "g_value_set_char",     NULL,                   },
+    { "UCHAR",         "UCHAR",        "guchar",       "g_value_set_uchar",    NULL,                   },
+    { "INT",           "INT",          "gint",         "g_value_set_int",      NULL,                   },
+    { "UINT",          "UINT",         "guint",        "g_value_set_uint",     NULL,                   },
+    { "LONG",          "LONG",         "glong",        "g_value_set_long",     NULL,                   },
+    { "ULONG",         "ULONG",        "gulong",       "g_value_set_ulong",    NULL,                   },
+    { "ENUM",          "ENUM",         "gint",         "g_value_set_enum",     NULL,                   },
+    { "FLAGS",         "FLAGS",        "guint",        "g_value_set_flags",    NULL,                   },
+    { "FLOAT",         "FLOAT",        "gfloat",       "g_value_set_float",    NULL,                   },
+    { "DOUBLE",                "DOUBLE",       "gdouble",      "g_value_set_double",   NULL,                   },
+    { "STRING",                "STRING",       "gchar*",       "g_value_set_string_take_ownership", NULL,      },
+    { "PARAM",         "PARAM",        "GParamSpec*",  "g_value_set_param",    "g_param_spec_unref",   },
+    { "BOXED",         "BOXED",        "gpointer",     "g_value_set_boxed_take_ownership", NULL,       },
+    { "POINTER",       "POINTER",      "gpointer",     "g_value_set_pointer",  NULL,                   },
+    { "OBJECT",                "OBJECT",       "GObject*",     "g_value_set_object",   "g_object_unref",       },
+    /* deprecated: */
+    { "NONE",          "VOID",         "void",         NULL,                   NULL,                   },
+    { "BOOL",          "BOOLEAN",      "gboolean",     "g_value_set_boolean",  NULL,                   },
+  };
+  const guint n_args = sizeof (args) / sizeof (args[0]);
+  guint i;
+
+  g_return_val_if_fail (oarg != NULL, FALSE);
+
+  for (i = 0; i < n_args; i++)
+    if (strcmp (args[i].keyword, oarg->keyword) == 0)
       {
-       arg->sname = arguments[i].sname;
-       arg->func = arguments[i].func;
-       arg->cname = arguments[i].cname;
+       oarg->sig_name = args[i].sig_name;
+       oarg->ctype = args[i].ctype;
+       oarg->setter = args[i].setter;
+       oarg->release = args[i].release;
 
        return TRUE;
       }
-
   return FALSE;
 }
 
@@ -230,7 +253,7 @@ pad (const gchar *string)
 static const gchar*
 indent (guint n_spaces)
 {
-  static gchar *buffer;
+  static gchar *buffer = NULL;
   static guint blength = 0;
 
   if (blength <= n_spaces)
@@ -307,38 +330,38 @@ generate_marshal (const gchar *signame,
       fprintf (fout, "%sgpointer      marshal_data)\n", indent (ind));
       fprintf (fout, "{\n");
 
-      /* cfile GSignalFunc typedef */
-      ind = fprintf (fout, "  typedef %s (*GSignalFunc_%s) (", sig->rarg->cname, signame);
+      /* cfile GMarshalFunc typedef */
+      ind = fprintf (fout, "  typedef %s (*GMarshalFunc_%s) (", sig->rarg->ctype, signame);
       fprintf (fout, "%s data1,\n", pad ("gpointer"));
       for (a = 1, node = sig->args; node; node = node->next)
        {
-         Argument *arg = node->data;
+         InArgument *iarg = node->data;
 
-         if (arg->func)
-           fprintf (fout, "%s%s arg_%d,\n", indent (ind), pad (arg->cname), a++);
+         if (iarg->getter)
+           fprintf (fout, "%s%s arg_%d,\n", indent (ind), pad (iarg->ctype), a++);
        }
       fprintf (fout, "%s%s data2);\n", indent (ind), pad ("gpointer"));
 
       /* cfile marshal variables */
-      fprintf (fout, "  register GSignalFunc_%s callback;\n", signame);
+      fprintf (fout, "  register GMarshalFunc_%s callback;\n", signame);
       fprintf (fout, "  register GCClosure *cc = (GCClosure*) closure;\n");
       fprintf (fout, "  register gpointer data1, data2;\n");
-      if (sig->rarg->func)
-       fprintf (fout, "  %s v_return;\n", sig->rarg->cname);
+      if (sig->rarg->setter)
+       fprintf (fout, "  %s v_return;\n", sig->rarg->ctype);
 
-      if (sig->args || sig->rarg->func)
+      if (sig->args || sig->rarg->setter)
        {
          fprintf (fout, "\n");
 
-         if (sig->rarg->func)
+         if (sig->rarg->setter)
            fprintf (fout, "  g_return_if_fail (return_value != NULL);\n");
          if (sig->args)
            {
              for (a = 0, node = sig->args; node; node = node->next)
                {
-                 Argument *arg = node->data;
+                 InArgument *iarg = node->data;
 
-                 if (arg->func)
+                 if (iarg->getter)
                    a++;
                }
              fprintf (fout, "  g_return_if_fail (n_param_values >= %u);\n", 1 + a);
@@ -349,31 +372,33 @@ generate_marshal (const gchar *signame,
       fprintf (fout, "\n");
       fprintf (fout, "  if (G_CCLOSURE_SWAP_DATA (closure))\n    {\n");
       fprintf (fout, "      data1 = closure->data;\n");
-      fprintf (fout, "      data2 = g_value_get_as_pointer (param_values + 0);\n");
+      fprintf (fout, "      data2 = g_value_peek_pointer (param_values + 0);\n");
       fprintf (fout, "    }\n  else\n    {\n");
-      fprintf (fout, "      data1 = g_value_get_as_pointer (param_values + 0);\n");
+      fprintf (fout, "      data1 = g_value_peek_pointer (param_values + 0);\n");
       fprintf (fout, "      data2 = closure->data;\n");
       fprintf (fout, "    }\n");
-      fprintf (fout, "  callback = (GSignalFunc_%s) (marshal_data ? marshal_data : cc->callback);\n", signame);
+      fprintf (fout, "  callback = (GMarshalFunc_%s) (marshal_data ? marshal_data : cc->callback);\n", signame);
 
       /* cfile marshal callback action */
       fprintf (fout, "\n");
-      ind = fprintf (fout, " %s callback (", sig->rarg->func ? " v_return =" : "");
+      ind = fprintf (fout, " %s callback (", sig->rarg->setter ? " v_return =" : "");
       fprintf (fout, "data1,\n");
       for (a = 1, node = sig->args; node; node = node->next)
        {
-         Argument *arg = node->data;
+         InArgument *iarg = node->data;
 
-         if (arg->func)
-           fprintf (fout, "%sg_value_get_%s (param_values + %d),\n", indent (ind), arg->func, a++);
+         if (iarg->getter)
+           fprintf (fout, "%s%s (param_values + %d),\n", indent (ind), iarg->getter, a++);
        }
       fprintf (fout, "%sdata2);\n", indent (ind));
 
       /* cfile marshal return value storage */
-      if (sig->rarg->func)
+      if (sig->rarg->setter)
        {
          fprintf (fout, "\n");
-         fprintf (fout, "  g_value_set_%s (return_value, v_return);\n", sig->rarg->func);
+         fprintf (fout, "  %s (return_value, v_return);\n", sig->rarg->setter);
+         if (sig->rarg->release)
+           fprintf (fout, "  %s (v_return);\n", sig->rarg->release);
        }
 
       /* cfile marshal footer */
@@ -388,45 +413,45 @@ process_signature (Signature *sig)
   GList *node;
 
   /* lookup and complete info on arguments */
-  if (!complete_arg (sig->rarg, TRUE))
+  if (!complete_out_arg (sig->rarg))
     {
-      g_warning ("unknown type: %s", sig->rarg->pname);
+      g_warning ("unknown type: %s", sig->rarg->keyword);
       return;
     }
   for (node = sig->args; node; node = node->next)
     {
-      Argument *arg = node->data;
+      InArgument *iarg = node->data;
 
-      if (!complete_arg (arg, FALSE))
+      if (!complete_in_arg (iarg))
        {
-         g_warning ("unknown type: %s", arg->pname);
+         g_warning ("unknown type: %s", iarg->keyword);
          return;
        }
     }
 
   /* construct requested marshaller name and technical marshaller name */
-  pname = g_strconcat (sig->rarg->pname, "_", NULL);
-  sname = g_strconcat (sig->rarg->sname, "_", NULL);
+  pname = g_strconcat (sig->rarg->keyword, "_", NULL);
+  sname = g_strconcat (sig->rarg->sig_name, "_", NULL);
   for (node = sig->args; node; node = node->next)
     {
-      Argument *arg = node->data;
+      InArgument *iarg = node->data;
       gchar *tmp;
 
       tmp = sname;
-      sname = g_strconcat (tmp, "_", arg->sname, NULL);
+      sname = g_strconcat (tmp, "_", iarg->sig_name, NULL);
       g_free (tmp);
       tmp = pname;
-      pname = g_strconcat (tmp, "_", arg->pname, NULL);
+      pname = g_strconcat (tmp, "_", iarg->keyword, NULL);
       g_free (tmp);
     }
 
   /* introductionary comment */
-  fprintf (fout, "\n/* %s", sig->rarg->pname);
+  fprintf (fout, "\n/* %s", sig->rarg->keyword);
   for (node = sig->args; node; node = node->next)
     {
-      Argument *arg = node->data;
+      InArgument *iarg = node->data;
 
-      fprintf (fout, "%c%s", node->prev ? ',' : ':', arg->pname);
+      fprintf (fout, "%c%s", node->prev ? ',' : ':', iarg->keyword);
     }
   if (!skip_ploc)
     fprintf (fout, " (%s)", sig->ploc);
@@ -450,14 +475,24 @@ process_signature (Signature *sig)
   g_free (sname);
 }
 
-static Argument*
-new_arg (const gchar *pname)
+static InArgument*
+new_in_arg (const gchar *pname)
+{
+  InArgument *iarg = g_new0 (InArgument, 1);
+
+  iarg->keyword = g_strdup (pname);
+
+  return iarg;
+}
+
+static OutArgument*
+new_out_arg (const gchar *pname)
 {
-  Argument *arg = g_new0 (Argument, 1);
+  OutArgument *oarg = g_new0 (OutArgument, 1);
 
-  arg->pname = g_strdup (pname);
+  oarg->keyword = g_strdup (pname);
 
-  return arg;
+  return oarg;
 }
 
 static guint
@@ -467,7 +502,7 @@ parse_line (GScanner  *scanner,
   /* parse identifier for return value */
   if (g_scanner_get_next_token (scanner) != G_TOKEN_IDENTIFIER)
     return G_TOKEN_IDENTIFIER;
-  sig->rarg = new_arg (scanner->value.v_identifier);
+  sig->rarg = new_out_arg (scanner->value.v_identifier);
 
   /* keep a note on the location */
   sig->ploc = g_strdup_printf ("%s:%u", scanner->input_name, scanner->line);
@@ -479,7 +514,7 @@ parse_line (GScanner  *scanner,
   /* parse first argument */
   if (g_scanner_get_next_token (scanner) != G_TOKEN_IDENTIFIER)
     return G_TOKEN_IDENTIFIER;
-  sig->args = g_list_append (sig->args, new_arg (scanner->value.v_identifier));
+  sig->args = g_list_append (sig->args, new_in_arg (scanner->value.v_identifier));
 
   /* parse rest of argument list */
   while (g_scanner_peek_next_token (scanner) == ',')
@@ -490,7 +525,7 @@ parse_line (GScanner  *scanner,
       /* parse arg identifier */
       if (g_scanner_get_next_token (scanner) != G_TOKEN_IDENTIFIER)
        return G_TOKEN_IDENTIFIER;
-      sig->args = g_list_append (sig->args, new_arg (scanner->value.v_identifier));
+      sig->args = g_list_append (sig->args, new_in_arg (scanner->value.v_identifier));
     }
   
   /* expect end of line, done */
@@ -605,14 +640,14 @@ main (int   argc,
                /* clean up signature contents */
                g_free (signature.ploc);
                if (signature.rarg)
-                 g_free (signature.rarg->pname);
+                 g_free (signature.rarg->keyword);
                g_free (signature.rarg);
                for (node = signature.args; node; node = node->next)
                  {
-                   Argument *arg = node->data;
+                   InArgument *iarg = node->data;
                    
-                   g_free (arg->pname);
-                   g_free (arg);
+                   g_free (iarg->keyword);
+                   g_free (iarg);
                  }
                g_list_free (signature.args);
              }
index cec63a82895133a7b7a739257f88922eb626d562..835fe8598fafc9e7211302c879b5c8845d569b9f 100644 (file)
 #   FLOAT       for single-precision float types (gfloat)
 #   DOUBLE      for double-precision float types (gdouble)
 #   STRING      for string types (gchar*)
+#   PARAM       for GParamSpec or derived types  (GParamSpec*)
 #   BOXED       for boxed (anonymous but reference counted) types (GBoxed*)
 #   POINTER     for anonymous pointer types (gpointer)
-#   PARAM       for GParamSpec or derived types  (GParamSpec*)
 #   OBJECT      for GObject or derived types (GObject*)
 #   NONE        deprecated alias for VOID
 #   BOOL        deprecated alias for BOOLEAN
 
+# standard VOID return marshallers
 VOID:VOID
-VOID:UINT,POINTER
-VOID:PARAM
+VOID:BOOLEAN
+VOID:CHAR
+VOID:UCHAR
 VOID:INT
-VOID:OBJECT
-VOID:POINTER
-VOID:STRING
 VOID:UINT
+VOID:LONG
+VOID:ULONG
+VOID:ENUM
+VOID:FLAGS
+VOID:FLOAT
+VOID:DOUBLE
+VOID:STRING
+VOID:PARAM
+VOID:BOXED
+VOID:POINTER
+VOID:OBJECT
+
+# GRuntime specific marshallers
+VOID:UINT,POINTER
index 37f87980c1331342ffa7d1b5859588018118ecdd..fd5746bb2c21eeb2b1d07bae3cdbdb2ec163d554 100644 (file)
@@ -1,5 +1,5 @@
 /* GObject - GLib Type, Object, Parameter and Signal Library
- * Copyright (C) 1998, 1999, 2000 Tim Janik and Red Hat, Inc.
+ * Copyright (C) 1998-1999, 2000-2001 Tim Janik and Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -119,16 +119,21 @@ int
 main (gint   argc,
       gchar *argv[])
 {
+  GLogLevelFlags fatal_mask;
   gboolean gen_froots = 0;
   gboolean gen_tree = 0;
   guint i;
   gchar *iindent = "";
-  
+
   f_out = stdout;
   
-  g_type_init (0);
+  fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
+  fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL;
+  g_log_set_always_fatal (fatal_mask);
   
   root = G_TYPE_OBJECT;
+
+  g_type_init (0);
   
   for (i = 1; i < argc; i++)
     {
@@ -194,6 +199,7 @@ main (gint   argc,
       else
        return help (argv[i]);
     }
+  
   if (!gen_froots && !gen_tree)
     return help (argv[i-1]);
   
index a4aed1f6532b93e2af0551b2a24de9d9f76a34b5..690fe6b7cfb85e5996399b17e1a05597ae842733 100644 (file)
@@ -1,5 +1,5 @@
 /* GObject - GLib Type, Object, Parameter and Signal Library
- * Copyright (C) 1998, 1999, 2000 Tim Janik and Red Hat, Inc.
+ * Copyright (C) 1998-1999, 2000-2001 Tim Janik and Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -48,12 +48,7 @@ enum {
 
 /* --- properties --- */
 enum {
-  PROP_NONE,
-  PROP_DATA,
-  PROP_SIGNAL,
-  PROP_SWAPPED_SIGNAL,
-  PROP_SIGNAL_AFTER,
-  PROP_SWAPPED_SIGNAL_AFTER
+  PROP_NONE
 };
 
 
@@ -75,17 +70,17 @@ static void g_object_finalize                       (GObject        *object);
 static void    g_object_do_set_property                (GObject        *object,
                                                         guint           property_id,
                                                         const GValue   *value,
-                                                        GParamSpec     *pspec,
-                                                        const gchar    *trailer);
+                                                        GParamSpec     *pspec);
 static void    g_object_do_get_property                (GObject        *object,
                                                         guint           property_id,
                                                         GValue         *value,
-                                                        GParamSpec     *pspec,
-                                                        const gchar    *trailer);
+                                                        GParamSpec     *pspec);
 static void    g_value_object_init                     (GValue         *value);
 static void    g_value_object_free_value               (GValue         *value);
 static void    g_value_object_copy_value               (const GValue   *src_value,
                                                         GValue         *dest_value);
+static void    g_value_object_transform_value          (const GValue   *src_value,
+                                                        GValue         *dest_value);
 static gpointer g_value_object_peek_pointer             (const GValue   *value);
 static gchar*  g_value_object_collect_value            (GValue         *value,
                                                         guint           n_collect_values,
@@ -110,13 +105,11 @@ static inline void           object_queue_property        (GObject        *object,
 static inline void        object_thaw_notifies         (GObject        *object,
                                                         NotifyQueue    *nqueue);
 static inline void         object_get_property         (GObject        *object,
-                                                        GValue         *value,
                                                         GParamSpec     *pspec,
-                                                        const gchar    *trailer);
+                                                        GValue         *value);
 static inline void        object_set_property          (GObject        *object,
-                                                        GValue         *value,
                                                         GParamSpec     *pspec,
-                                                        const gchar    *trailer,
+                                                        const GValue   *value,
                                                         NotifyQueue    *nqueue);
 
 
@@ -211,6 +204,7 @@ g_object_type_init (void)   /* sync with gtype.c */
   info.value_table = &value_table;
   type = g_type_register_fundamental (G_TYPE_OBJECT, "GObject", &info, &finfo, 0);
   g_assert (type == G_TYPE_OBJECT);
+  g_value_register_transform_func (G_TYPE_OBJECT, G_TYPE_OBJECT, g_value_object_transform_value);
   
 #ifdef G_ENABLE_DEBUG
   IF_DEBUG (OBJECTS)
@@ -272,35 +266,6 @@ g_object_do_class_init (GObjectClass *class)
   class->properties_changed = g_object_properties_changed;
   class->notify = g_object_notify_property_changed;
 
-  g_object_class_install_property (class,
-                                  PROP_DATA,
-                                  g_param_spec_pointer ("data", "Named Data",
-                                                        "Named anonymous pointers",
-                                                        G_PARAM_READABLE | G_PARAM_WRITABLE));
-  g_object_class_install_property (class,
-                                  PROP_SIGNAL,
-                                  g_param_spec_ccallback ("signal", "Signal Connection",
-                                                          "Signal connection consisting of a callback function "
-                                                          "and a data pointer",
-                                                          G_PARAM_WRITABLE));
-  g_object_class_install_property (class,
-                                  PROP_SWAPPED_SIGNAL,
-                                  g_param_spec_ccallback ("swapped_signal", "Swapped Signal Connection",
-                                                          "Signal connection consisting of a callback function "
-                                                          "and a data pointer",
-                                                          G_PARAM_WRITABLE));
-  g_object_class_install_property (class,
-                                  PROP_SIGNAL_AFTER,
-                                  g_param_spec_ccallback ("signal_after", "Signal After Connection",
-                                                          "Signal connection consisting of a callback function "
-                                                          "and a data pointer",
-                                                          G_PARAM_WRITABLE));
-  g_object_class_install_property (class,
-                                  PROP_SWAPPED_SIGNAL_AFTER,
-                                  g_param_spec_ccallback ("swapped_signal_after", "Swapped Signal After Connection",
-                                                          "Signal connection consisting of a callback function "
-                                                          "and a data pointer",
-                                                          G_PARAM_WRITABLE));
   gobject_signals[PROPERTIES_CHANGED] =
     g_signal_newc ("properties_changed",
                    G_TYPE_FROM_CLASS (class),
@@ -353,7 +318,7 @@ g_object_class_install_property (GObjectClass *class,
                   pspec->name);
        return;
       }
-  if (g_param_spec_pool_lookup (pspec_pool, pspec->name, G_OBJECT_CLASS_TYPE (class), FALSE, NULL))
+  if (g_param_spec_pool_lookup (pspec_pool, pspec->name, G_OBJECT_CLASS_TYPE (class), FALSE))
     {
       g_warning (G_STRLOC ": class `%s' already contains a property named `%s'",
                 G_OBJECT_CLASS_NAME (class),
@@ -374,7 +339,7 @@ g_object_class_install_property (GObjectClass *class,
   /* for property overrides of construct poperties, we have to get rid
    * of the overidden inherited construct property
    */
-  pspec = g_param_spec_pool_lookup (pspec_pool, pspec->name, g_type_parent (G_OBJECT_CLASS_TYPE (class)), TRUE, NULL);
+  pspec = g_param_spec_pool_lookup (pspec_pool, pspec->name, g_type_parent (G_OBJECT_CLASS_TYPE (class)), TRUE);
   if (pspec && pspec->flags & (G_PARAM_CONSTRUCT | G_PARAM_CONSTRUCT_ONLY))
     class->construct_properties = g_slist_remove (class->construct_properties, pspec);
 }
@@ -389,7 +354,7 @@ g_object_class_find_property (GObjectClass *class,
   return g_param_spec_pool_lookup (pspec_pool,
                                   property_name,
                                   G_OBJECT_CLASS_TYPE (class),
-                                  TRUE, NULL);
+                                  TRUE);
 }
 
 static void
@@ -453,36 +418,10 @@ static void
 g_object_do_set_property (GObject      *object,
                          guint         property_id,
                          const GValue *value,
-                         GParamSpec   *pspec,
-                         const gchar  *trailer)
+                         GParamSpec   *pspec)
 {
-  guint i = 0;
-  
   switch (property_id)
     {
-      gboolean swapped, after;
-      gpointer callback, data;
-    case PROP_DATA:
-      g_return_if_fail (trailer != NULL);
-
-      g_object_set_data (object, trailer, g_value_get_pointer (value));
-      break;
-    case PROP_SWAPPED_SIGNAL_AFTER:
-      i++;
-    case PROP_SIGNAL_AFTER:
-      i++;
-    case PROP_SWAPPED_SIGNAL:
-      i++;
-    case PROP_SIGNAL:
-      after = i > 2;
-      swapped = i & 1;
-      g_return_if_fail (trailer != NULL);
-
-      g_value_get_ccallback (value, &callback, &data);
-      g_signal_connect_data (object, trailer,
-                            callback, data, NULL,
-                            swapped, after);
-      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;
@@ -493,16 +432,10 @@ static void
 g_object_do_get_property (GObject     *object,
                          guint        property_id,
                          GValue      *value,
-                         GParamSpec  *pspec,
-                         const gchar *trailer)
+                         GParamSpec  *pspec)
 {
   switch (property_id)
     {
-    case PROP_DATA:
-      g_return_if_fail (trailer != NULL);
-
-      g_value_set_pointer (value, g_object_get_data (object, trailer));
-      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;
@@ -526,6 +459,8 @@ g_object_last_unref (GObject *object)
   
   if (object->ref_count == 0)  /* may have been re-referenced meanwhile */
     {
+      g_signal_handlers_destroy (object);
+      g_object_set_qdata (object, quark_closure_array, NULL);
       G_OBJECT_GET_CLASS (object)->finalize (object);
 #ifdef G_ENABLE_DEBUG
       IF_DEBUG (OBJECTS)
@@ -659,7 +594,7 @@ g_object_notify (GObject     *object,
   pspec = g_param_spec_pool_lookup (pspec_pool,
                                    property_name,
                                    G_OBJECT_TYPE (object),
-                                   TRUE, NULL);
+                                   TRUE);
   if (!pspec)
     g_warning ("%s: object class `%s' has no property named `%s'",
               G_STRLOC,
@@ -696,34 +631,110 @@ g_object_thaw_notify (GObject *object)
 
 static inline void
 object_get_property (GObject     *object,
-                    GValue      *value,
                     GParamSpec  *pspec,
-                    const gchar *trailer)
+                    GValue      *value)
 {
   GObjectClass *class;
   
-  g_return_if_fail (g_type_is_a (G_OBJECT_TYPE (object), pspec->owner_type));  /* paranoid */
-  
   class = g_type_class_peek (pspec->owner_type);
   
-  class->get_property (object, PARAM_SPEC_PARAM_ID (pspec), value, pspec, trailer);
+  class->get_property (object, PARAM_SPEC_PARAM_ID (pspec), value, pspec);
 }
 
-static inline void
-object_set_property (GObject     *object,
-                    GValue      *value,
-                    GParamSpec  *pspec,
-                    const gchar *trailer,
-                    NotifyQueue *nqueue)
+static gchar*
+g_strdup_value_contents (const GValue *value)
 {
-  GObjectClass *class;
-  
-  g_return_if_fail (g_type_is_a (G_OBJECT_TYPE (object), pspec->owner_type));  /* paranoid */
-  
-  class = g_type_class_peek (pspec->owner_type);
+  const gchar *src;
+  gchar *contents;
+
+  g_return_val_if_fail (G_IS_VALUE (value), NULL);
   
-  class->set_property (object, PARAM_SPEC_PARAM_ID (pspec), value, pspec, trailer);
-  object_queue_property (object, pspec, nqueue);
+  if (G_VALUE_HOLDS_STRING (value))
+    {
+      src = g_value_get_string (value);
+      
+      if (!src)
+       contents = g_strdup ("NULL");
+      else
+       {
+         gchar *s = g_strescape (src, NULL);
+
+         contents = g_strdup_printf ("\"%s\"", s);
+         g_free (s);
+       }
+    }
+  else if (g_value_type_transformable (G_VALUE_TYPE (value), G_TYPE_STRING))
+    {
+      GValue tmp_value = { 0, };
+      
+      g_value_init (&tmp_value, G_TYPE_STRING);
+      g_value_transform (value, &tmp_value);
+      if (G_VALUE_HOLDS_ENUM (value) || G_VALUE_HOLDS_FLAGS (value))
+       contents = g_strdup_printf ("((%s) %s)",
+                                   g_type_name (G_VALUE_TYPE (value)),
+                                   g_value_get_string (&tmp_value));
+      else
+       {
+         src = g_value_get_string (&tmp_value);
+         contents = g_strdup (src ? src : "NULL");
+       }
+      g_value_unset (&tmp_value);
+    }
+  else if (g_value_fits_pointer (value))
+    {
+      gpointer p = g_value_peek_pointer (value);
+
+      if (!p)
+       contents = g_strdup ("NULL");
+      else if (G_VALUE_HOLDS_OBJECT (value))
+       contents = g_strdup_printf ("((%s*) %p)", G_OBJECT_TYPE_NAME (p), p);
+      else if (G_VALUE_HOLDS_PARAM (value))
+       contents = g_strdup_printf ("((%s*) %p)", G_PARAM_SPEC_TYPE_NAME (p), p);
+      else if (G_VALUE_HOLDS_BOXED (value))
+       contents = g_strdup_printf ("((%s*) %p)", g_type_name (G_VALUE_TYPE (value)), p);
+      else if (G_VALUE_HOLDS_POINTER (value))
+       contents = g_strdup_printf ("((gpointer) %p)", p);
+      else
+       contents = g_strdup ("???");
+    }
+  else
+    contents = g_strdup ("???");
+  return contents;
+}
+
+static inline void
+object_set_property (GObject      *object,
+                    GParamSpec   *pspec,
+                    const GValue *value,
+                    NotifyQueue  *nqueue)
+{
+  GValue tmp_value = { 0, };
+  GObjectClass *class = g_type_class_peek (pspec->owner_type);
+
+  /* provide a copy to work from, convert (if necessary) and validate */
+  g_value_init (&tmp_value, G_PARAM_SPEC_VALUE_TYPE (pspec));
+  if (!g_value_transform (value, &tmp_value))
+    g_warning ("unable to set property `%s' of type `%s' from value of type `%s'",
+              pspec->name,
+              g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)),
+              G_VALUE_TYPE_NAME (value));
+  else if (g_param_value_validate (pspec, &tmp_value) && !(pspec->flags & G_PARAM_LAX_VALIDATION))
+    {
+      gchar *contents = g_strdup_value_contents (value);
+
+      g_warning ("value <%s> of type `%s' is invalid for property `%s' of type `%s'",
+                contents,
+                G_VALUE_TYPE_NAME (value),
+                pspec->name,
+                g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)));
+      g_free (contents);
+    }
+  else
+    {
+      class->set_property (object, PARAM_SPEC_PARAM_ID (pspec), &tmp_value, pspec);
+      object_queue_property (object, pspec, nqueue);
+    }
+  g_value_unset (&tmp_value);
 }
 
 gpointer
@@ -765,7 +776,6 @@ g_object_new_valist (GType    object_type,
   name = first_property_name;
   while (name)
     {
-      const gchar *trailer = NULL;
       GValue *value;
       GParamSpec *pspec;
       gchar *error = NULL;
@@ -773,8 +783,7 @@ g_object_new_valist (GType    object_type,
       pspec = g_param_spec_pool_lookup (pspec_pool,
                                        name,
                                        object_type,
-                                       TRUE,
-                                       &trailer);
+                                       TRUE);
       if (!pspec)
        {
          g_warning ("%s: object class `%s' has no property named `%s'",
@@ -814,7 +823,6 @@ g_object_new_valist (GType    object_type,
            cparams = g_renew (GObjectConstructParam, cparams, MAX (n_cparams + 1, PREALLOC_CPARAMS));
          cparams[n_cparams].pspec = pspec;
          cparams[n_cparams].value = value;
-         cparams[n_cparams].trailer = trailer;
          for (i = 0; i < n_cparams; i++)       /* picky, aren't we? ;) */
            if (cparams[i].pspec == pspec)
              g_warning (G_STRLOC ": construct property \"%s\" for object `%s' is being set twice",
@@ -828,7 +836,6 @@ g_object_new_valist (GType    object_type,
            nparams = g_renew (GObjectConstructParam, nparams, MAX (n_nparams + 1, PREALLOC_CPARAMS));
          nparams[n_nparams].pspec = pspec;
          nparams[n_nparams].value = value;
-         nparams[n_nparams].trailer = trailer;
          n_nparams++;
        }
 
@@ -850,7 +857,6 @@ g_object_new_valist (GType    object_type,
        cparams = g_renew (GObjectConstructParam, cparams, MAX (n_cparams + 1, PREALLOC_CPARAMS));
       cparams[n_cparams].pspec = pspec;
       cparams[n_cparams].value = value;
-      cparams[n_cparams].trailer = NULL;
       n_cparams++;
 
       g_slist_free_1 (clist);
@@ -876,28 +882,9 @@ g_object_new_valist (GType   object_type,
     {
       GValue *value = nparams->value;
       GParamSpec *pspec = nparams->pspec;
-      const gchar *trailer = nparams++->trailer;
-
-      /* convert if necessary */
-      if (!g_type_is_a (G_VALUE_TYPE (value), G_PARAM_SPEC_VALUE_TYPE (pspec)))
-       {
-         GValue tmp_value = { 0, };
 
-         g_value_init (&tmp_value, G_PARAM_SPEC_VALUE_TYPE (pspec));
-         if (!g_value_convert (value, &tmp_value) ||
-             g_param_value_validate (pspec, &tmp_value))
-           g_warning ("%s: cannot convert `%s' value to property `%s' value of type `%s'",
-                      G_STRLOC,
-                      G_VALUE_TYPE_NAME (value),
-                      pspec->name,
-                      g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)));
-         else
-           object_set_property (object, &tmp_value, pspec, trailer, nqueue);
-         g_value_unset (&tmp_value);
-       }
-      else
-       object_set_property (object, value, pspec, trailer, nqueue);
-      
+      nparams++;
+      object_set_property (object, pspec, value, nqueue);
       g_value_unset (value);
       g_free (value);
     }
@@ -931,27 +918,9 @@ g_object_constructor (GType                  type,
        {
          GValue *value = construct_params->value;
          GParamSpec *pspec = construct_params->pspec;
-         const gchar *trailer = construct_params++->trailer;
-         
-         /* convert if necessary */
-         if (!g_type_is_a (G_VALUE_TYPE (value), G_PARAM_SPEC_VALUE_TYPE (pspec)))
-           {
-             GValue tmp_value = { 0, };
-             
-             g_value_init (&tmp_value, G_PARAM_SPEC_VALUE_TYPE (pspec));
-             if (!g_value_convert (value, &tmp_value) ||
-                 g_param_value_validate (pspec, &tmp_value))
-               g_warning ("%s: cannot convert `%s' value to property `%s' value of type `%s'",
-                          G_STRLOC,
-                          G_VALUE_TYPE_NAME (value),
-                          pspec->name,
-                          g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)));
-             else
-               object_set_property (object, &tmp_value, pspec, trailer, nqueue);
-             g_value_unset (&tmp_value);
-           }
-         else
-           object_set_property (object, value, pspec, trailer, nqueue);
+
+         construct_params++;
+         object_set_property (object, pspec, value, nqueue);
        }
       nqueue->freeze_count--;
       /* the notification queue is still frozen from g_object_init(), so
@@ -979,7 +948,6 @@ g_object_set_valist (GObject         *object,
   name = first_property_name;
   while (name)
     {
-      const gchar *trailer = NULL;
       GValue value = { 0, };
       GParamSpec *pspec;
       gchar *error = NULL;
@@ -987,8 +955,7 @@ g_object_set_valist (GObject         *object,
       pspec = g_param_spec_pool_lookup (pspec_pool,
                                        name,
                                        G_OBJECT_TYPE (object),
-                                       TRUE,
-                                       &trailer);
+                                       TRUE);
       if (!pspec)
        {
          g_warning ("%s: object class `%s' has no property named `%s'",
@@ -1020,8 +987,7 @@ g_object_set_valist (GObject        *object,
          break;
        }
       
-      object_set_property (object, &value, pspec, trailer, nqueue);
-      
+      object_set_property (object, pspec, &value, nqueue);
       g_value_unset (&value);
       
       name = va_arg (var_args, gchar*);
@@ -1046,7 +1012,6 @@ g_object_get_valist (GObject       *object,
   
   while (name)
     {
-      const gchar *trailer = NULL;
       GValue value = { 0, };
       GParamSpec *pspec;
       gchar *error;
@@ -1054,8 +1019,7 @@ g_object_get_valist (GObject       *object,
       pspec = g_param_spec_pool_lookup (pspec_pool,
                                        name,
                                        G_OBJECT_TYPE (object),
-                                       TRUE,
-                                       &trailer);
+                                       TRUE);
       if (!pspec)
        {
          g_warning ("%s: object class `%s' has no property named `%s'",
@@ -1075,9 +1039,9 @@ g_object_get_valist (GObject       *object,
       
       g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
       
-      object_get_property (object, &value, pspec, trailer);
+      object_get_property (object, pspec, &value);
       
-      G_VALUE_LCOPY (&value, var_args, 0, &error);
+      G_VALUE_LCOPY (&value, var_args, G_VALUE_NOCOPY_CONTENTS, &error);
       if (error)
        {
          g_warning ("%s: %s", G_STRLOC, error);
@@ -1097,7 +1061,7 @@ g_object_get_valist (GObject       *object,
   g_object_unref (object);
 }
 
-void
+gpointer
 g_object_set (gpointer     _object,
              const gchar *first_property_name,
              ...)
@@ -1105,11 +1069,13 @@ g_object_set (gpointer     _object,
   GObject *object = _object;
   va_list var_args;
   
-  g_return_if_fail (G_IS_OBJECT (object));
+  g_return_val_if_fail (G_IS_OBJECT (object), NULL);
   
   va_start (var_args, first_property_name);
   g_object_set_valist (object, first_property_name, var_args);
   va_end (var_args);
+
+  return object;
 }
 
 void
@@ -1134,7 +1100,6 @@ g_object_set_property (GObject        *object,
 {
   NotifyQueue *nqueue;
   GParamSpec *pspec;
-  const gchar *trailer;
   
   g_return_if_fail (G_IS_OBJECT (object));
   g_return_if_fail (property_name != NULL);
@@ -1146,32 +1111,13 @@ g_object_set_property (GObject      *object,
   pspec = g_param_spec_pool_lookup (pspec_pool,
                                    property_name,
                                    G_OBJECT_TYPE (object),
-                                   TRUE,
-                                   &trailer);
+                                   TRUE);
   if (!pspec)
-    g_warning ("%s: object class `%s' has no property named `%s'",
-              G_STRLOC,
+    g_warning ("object class `%s' has no property named `%s'",
               G_OBJECT_TYPE_NAME (object),
               property_name);
   else
-    {
-      GValue tmp_value = { 0, };
-      
-      /* provide a copy to work from and convert if necessary */
-      g_value_init (&tmp_value, G_PARAM_SPEC_VALUE_TYPE (pspec));
-      
-      if (!g_value_convert (value, &tmp_value) ||
-         g_param_value_validate (pspec, &tmp_value))
-       g_warning ("%s: cannot convert `%s' value to property `%s' value of type `%s'",
-                  G_STRLOC,
-                  G_VALUE_TYPE_NAME (value),
-                  pspec->name,
-                  g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)));
-      else
-       object_set_property (object, &tmp_value, pspec, trailer, nqueue);
-      
-      g_value_unset (&tmp_value);
-    }
+    object_set_property (object, pspec, value, nqueue);
   
   object_thaw_notifies (object, nqueue);
   g_object_unref (object);
@@ -1183,7 +1129,6 @@ g_object_get_property (GObject       *object,
                       GValue      *value)
 {
   GParamSpec *pspec;
-  const gchar *trailer;
   
   g_return_if_fail (G_IS_OBJECT (object));
   g_return_if_fail (property_name != NULL);
@@ -1194,44 +1139,140 @@ g_object_get_property (GObject    *object,
   pspec = g_param_spec_pool_lookup (pspec_pool,
                                    property_name,
                                    G_OBJECT_TYPE (object),
-                                   TRUE,
-                                   &trailer);
+                                   TRUE);
   if (!pspec)
-    g_warning ("%s: object class `%s' has no property named `%s'",
-              G_STRLOC,
+    g_warning ("object class `%s' has no property named `%s'",
               G_OBJECT_TYPE_NAME (object),
               property_name);
   else
     {
-      GValue tmp_value = { 0, };
+      GValue *prop_value, tmp_value = { 0, };
       
-      /* provide a copy to work from and later convert if necessary, so
-       * _get_property() implementations need *not* care about freeing values
-       * that might be already set in the property to get.
-       * (though, at this point, GValue should exclusively be modified
-       * through the accessor functions anyways)
+      /* auto-conversion of the callers value type
        */
-      g_value_init (&tmp_value, G_PARAM_SPEC_VALUE_TYPE (pspec));
-      
-      if (!g_value_types_exchangable (G_VALUE_TYPE (value), G_PARAM_SPEC_VALUE_TYPE (pspec)))
-       g_warning ("%s: can't retrive property `%s' value of type `%s' as value of type `%s'",
-                  G_STRLOC,
-                  pspec->name,
-                  g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)),
-                  G_VALUE_TYPE_NAME (value));
+      if (G_VALUE_TYPE (value) == G_PARAM_SPEC_VALUE_TYPE (pspec))
+       {
+         g_value_reset (value);
+         prop_value = value;
+       }
+      else if (!g_value_type_transformable (G_PARAM_SPEC_VALUE_TYPE (pspec), G_VALUE_TYPE (value)))
+       {
+         g_warning ("can't retrive property `%s' of type `%s' as value of type `%s'",
+                    pspec->name,
+                    g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)),
+                    G_VALUE_TYPE_NAME (value));
+         return;
+       }
       else
        {
-         object_get_property (object, &tmp_value, pspec, trailer);
-         g_value_convert (&tmp_value, value);
-         /* g_value_validate (value, pspec); */
+         g_value_init (&tmp_value, G_PARAM_SPEC_VALUE_TYPE (pspec));
+         prop_value = &tmp_value;
+       }
+      object_get_property (object, pspec, prop_value);
+      if (prop_value != value)
+       {
+         g_value_transform (prop_value, value);
+         g_value_unset (&tmp_value);
        }
-      
-      g_value_unset (&tmp_value);
     }
   
   g_object_unref (object);
 }
 
+gpointer
+g_object_connect (gpointer     _object,
+                 const gchar *signal_spec,
+                 ...)
+{
+  GObject *object = _object;
+  va_list var_args;
+
+  g_return_val_if_fail (G_IS_OBJECT (object), NULL);
+  g_return_val_if_fail (object->ref_count > 0, object);
+
+  va_start (var_args, signal_spec);
+  while (signal_spec)
+    {
+      gpointer callback = va_arg (var_args, gpointer);
+      gpointer data = va_arg (var_args, gpointer);
+      guint sid;
+
+      if (strncmp (signal_spec, "signal::", 8) == 0)
+       sid = g_signal_connect_data (object, signal_spec + 8,
+                                    callback, data, NULL,
+                                    FALSE, FALSE);
+      else if (strncmp (signal_spec, "swapped_signal::", 16) == 0)
+       sid = g_signal_connect_data (object, signal_spec + 16,
+                                    callback, data, NULL,
+                                    TRUE, FALSE);
+      else if (strncmp (signal_spec, "signal_after::", 14) == 0)
+       sid = g_signal_connect_data (object, signal_spec + 14,
+                                    callback, data, NULL,
+                                    FALSE, TRUE);
+      else if (strncmp (signal_spec, "swapped_signal_after::", 22) == 0)
+       sid = g_signal_connect_data (object, signal_spec + 22,
+                                    callback, data, NULL,
+                                    TRUE, TRUE);
+      else
+       {
+         g_warning ("%s: invalid signal spec \"%s\"", G_STRLOC, signal_spec);
+         break;
+       }
+      signal_spec = va_arg (var_args, gchar*);
+    }
+  va_end (var_args);
+
+  return object;
+}
+
+gpointer
+g_object_disconnect (gpointer     _object,
+                    const gchar *signal_spec,
+                    ...)
+{
+  GObject *object = _object;
+  va_list var_args;
+
+  g_return_val_if_fail (G_IS_OBJECT (object), NULL);
+  g_return_val_if_fail (object->ref_count > 0, object);
+
+  va_start (var_args, signal_spec);
+  while (signal_spec)
+    {
+      gpointer callback = va_arg (var_args, gpointer);
+      gpointer data = va_arg (var_args, gpointer);
+      guint sid = 0, detail = 0, mask = 0;
+
+      if (strncmp (signal_spec, "any_signal::", 12) == 0)
+       {
+         signal_spec += 12;
+         mask = G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA;
+       }
+      else if (strcmp (signal_spec, "any_signal") == 0)
+       {
+         signal_spec += 10;
+         mask = G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA;
+       }
+      else
+       {
+         g_warning ("%s: invalid signal spec \"%s\"", G_STRLOC, signal_spec);
+         break;
+       }
+
+      if ((mask & G_SIGNAL_MATCH_ID) &&
+         !g_signal_parse_name (signal_spec, G_OBJECT_TYPE (object), &sid, &detail, FALSE))
+       g_warning ("%s: invalid signal name \"%s\"", G_STRLOC, signal_spec);
+      else if (!g_signal_handlers_disconnect_matched (object, mask | (detail ? G_SIGNAL_MATCH_DETAIL : 0),
+                                                     sid, detail,
+                                                     NULL, callback, data))
+       g_warning (G_STRLOC ": signal handler %p(%p) is not connected", callback, data);
+      signal_spec = va_arg (var_args, gchar*);
+    }
+  va_end (var_args);
+
+  return object;
+}
+
 gpointer
 g_object_ref (gpointer _object)
 {
@@ -1385,6 +1426,16 @@ g_value_object_copy_value (const GValue *src_value,
     dest_value->data[0].v_pointer = NULL;
 }
 
+static void
+g_value_object_transform_value (const GValue *src_value,
+                               GValue       *dest_value)
+{
+  if (src_value->data[0].v_pointer && g_type_is_a (G_OBJECT_TYPE (src_value->data[0].v_pointer), G_VALUE_TYPE (dest_value)))
+    dest_value->data[0].v_pointer = g_object_ref (src_value->data[0].v_pointer);
+  else
+    dest_value->data[0].v_pointer = NULL;
+}
+
 static gpointer
 g_value_object_peek_pointer (const GValue *value)
 {
@@ -1406,13 +1457,14 @@ g_value_object_collect_value (GValue      *value,
                            G_VALUE_TYPE_NAME (value),
                            "'",
                            NULL);
-      else if (!g_type_is_a (G_OBJECT_TYPE (object), G_VALUE_TYPE (value)))
+      else if (!g_value_type_compatible (G_OBJECT_TYPE (object), G_VALUE_TYPE (value)))
        return g_strconcat ("invalid object type `",
                            G_OBJECT_TYPE_NAME (object),
                            "' for value type `",
                            G_VALUE_TYPE_NAME (value),
                            "'",
                            NULL);
+      /* never honour G_VALUE_NOCOPY_CONTENTS for ref-counted types */
       value->data[0].v_pointer = g_object_ref (object);
     }
   else
@@ -1446,7 +1498,7 @@ void
 g_value_set_object (GValue  *value,
                    GObject *v_object)
 {
-  g_return_if_fail (G_IS_VALUE_OBJECT (value));
+  g_return_if_fail (G_VALUE_HOLDS_OBJECT (value));
   
   if (value->data[0].v_pointer)
     {
@@ -1457,17 +1509,17 @@ g_value_set_object (GValue  *value,
   if (v_object)
     {
       g_return_if_fail (G_IS_OBJECT (v_object));
-      g_return_if_fail (g_type_is_a (G_OBJECT_TYPE (v_object), G_VALUE_TYPE (value)));
+      g_return_if_fail (g_value_type_compatible (G_OBJECT_TYPE (v_object), G_VALUE_TYPE (value)));
 
       value->data[0].v_pointer = v_object;
       g_object_ref (value->data[0].v_pointer);
     }
 }
 
-GObject*
+gpointer
 g_value_get_object (const GValue *value)
 {
-  g_return_val_if_fail (G_IS_VALUE_OBJECT (value), NULL);
+  g_return_val_if_fail (G_VALUE_HOLDS_OBJECT (value), NULL);
   
   return value->data[0].v_pointer;
 }
@@ -1475,7 +1527,7 @@ g_value_get_object (const GValue *value)
 GObject*
 g_value_dup_object (const GValue *value)
 {
-  g_return_val_if_fail (G_IS_VALUE_OBJECT (value), NULL);
+  g_return_val_if_fail (G_VALUE_HOLDS_OBJECT (value), NULL);
   
   return value->data[0].v_pointer ? g_object_ref (value->data[0].v_pointer) : NULL;
 }
index 603906124c10240f8046f9759ab8dda9b1ef733e..31eb5643851a676de59d305bd168ec204689b471 100644 (file)
@@ -1,5 +1,5 @@
 /* GObject - GLib Type, Object, Parameter and Signal Library
- * Copyright (C) 1998, 1999, 2000 Tim Janik and Red Hat, Inc.
+ * Copyright (C) 1998-1999, 2000-2001 Tim Janik and Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -31,17 +31,17 @@ extern "C" {
 
 
 /* --- type macros --- */
-#define G_TYPE_IS_OBJECT(type)     (G_TYPE_FUNDAMENTAL (type) == G_TYPE_OBJECT)
-#define G_OBJECT(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), G_TYPE_OBJECT, GObject))
-#define G_OBJECT_CLASS(class)      (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_OBJECT, GObjectClass))
-#define G_IS_OBJECT(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), G_TYPE_OBJECT))
-#define G_IS_OBJECT_CLASS(class)   (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_OBJECT))
-#define G_OBJECT_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), G_TYPE_OBJECT, GObjectClass))
-#define G_OBJECT_TYPE(object)      (G_TYPE_FROM_INSTANCE (object))
-#define G_OBJECT_TYPE_NAME(object) (g_type_name (G_OBJECT_TYPE (object)))
-#define G_OBJECT_CLASS_TYPE(class) (G_TYPE_FROM_CLASS (class))
-#define G_OBJECT_CLASS_NAME(class) (g_type_name (G_OBJECT_CLASS_TYPE (class)))
-#define G_IS_VALUE_OBJECT(value)   (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_OBJECT))
+#define G_TYPE_IS_OBJECT(type)      (G_TYPE_FUNDAMENTAL (type) == G_TYPE_OBJECT)
+#define G_OBJECT(object)            (G_TYPE_CHECK_INSTANCE_CAST ((object), G_TYPE_OBJECT, GObject))
+#define G_OBJECT_CLASS(class)       (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_OBJECT, GObjectClass))
+#define G_IS_OBJECT(object)         (G_TYPE_CHECK_INSTANCE_TYPE ((object), G_TYPE_OBJECT))
+#define G_IS_OBJECT_CLASS(class)    (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_OBJECT))
+#define G_OBJECT_GET_CLASS(object)  (G_TYPE_INSTANCE_GET_CLASS ((object), G_TYPE_OBJECT, GObjectClass))
+#define G_OBJECT_TYPE(object)       (G_TYPE_FROM_INSTANCE (object))
+#define G_OBJECT_TYPE_NAME(object)  (g_type_name (G_OBJECT_TYPE (object)))
+#define G_OBJECT_CLASS_TYPE(class)  (G_TYPE_FROM_CLASS (class))
+#define G_OBJECT_CLASS_NAME(class)  (g_type_name (G_OBJECT_CLASS_TYPE (class)))
+#define G_VALUE_HOLDS_OBJECT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_OBJECT))
 
 
 /* --- typedefs & structures --- */
@@ -51,13 +51,11 @@ typedef struct _GObjectConstructParam    GObjectConstructParam;
 typedef void (*GObjectGetPropertyFunc)  (GObject      *object,
                                          guint         property_id,
                                          GValue       *value,
-                                         GParamSpec   *pspec,
-                                         const gchar  *trailer);
+                                         GParamSpec   *pspec);
 typedef void (*GObjectSetPropertyFunc)  (GObject      *object,
                                          guint         property_id,
                                          const GValue *value,
-                                         GParamSpec   *pspec,
-                                         const gchar  *trailer);
+                                         GParamSpec   *pspec);
 typedef void (*GObjectFinalizeFunc)     (GObject      *object);
 struct  _GObject
 {
@@ -83,13 +81,11 @@ struct  _GObjectClass
   void       (*set_property)            (GObject        *object,
                                          guint           property_id,
                                          const GValue   *value,
-                                         GParamSpec     *pspec,
-                                         const gchar    *trailer);
+                                         GParamSpec     *pspec);
   void       (*get_property)            (GObject        *object,
                                          guint           property_id,
                                          GValue         *value,
-                                         GParamSpec     *pspec,
-                                         const gchar    *trailer);
+                                         GParamSpec     *pspec);
   void       (*shutdown)                (GObject        *object);
   void       (*finalize)                (GObject        *object);
 
@@ -109,7 +105,6 @@ struct _GObjectConstructParam
 {
   GParamSpec  *pspec;
   GValue      *value;
-  const gchar *trailer;
 };
 
 
@@ -125,12 +120,18 @@ gpointer    g_object_new                      (GType           object_type,
 gpointer    g_object_new_valist               (GType           object_type,
                                               const gchar    *first_property_name,
                                               va_list         var_args);
-void        g_object_set                      (gpointer               object,
+gpointer    g_object_set                      (gpointer               object,
                                               const gchar    *first_property_name,
                                               ...);
 void        g_object_get                      (gpointer        object,
                                               const gchar    *first_property_name,
                                               ...);
+gpointer    g_object_connect                  (gpointer               object,
+                                              const gchar    *signal_spec,
+                                              ...);
+gpointer    g_object_disconnect               (gpointer               object,
+                                              const gchar    *signal_spec,
+                                              ...);
 void        g_object_set_valist               (GObject        *object,
                                               const gchar    *first_property_name,
                                               va_list         var_args);
@@ -181,7 +182,7 @@ GClosure*   g_closure_new_object              (guint           sizeof_closure,
                                               GObject        *object);
 void        g_value_set_object                (GValue         *value,
                                               GObject        *v_object);
-GObject*    g_value_get_object                (const GValue   *value);
+gpointer    g_value_get_object                (const GValue   *value);
 GObject*    g_value_dup_object                (const GValue   *value);
 guint      g_signal_connect_object           (gpointer        instance,
                                               const gchar    *detailed_signal,
index 7ead600ee5fef1ec7692a1620501e0bd8b6584b1..5a1dff4a4b1aed5be3a8bf6966cdcc4e9afd2302 100644 (file)
@@ -1,5 +1,5 @@
 /* GObject - GLib Type, Object, Parameter and Signal Library
- * Copyright (C) 1997, 1998, 1999, 2000 Tim Janik and Red Hat, Inc.
+ * Copyright (C) 1997-1999, 2000-2001 Tim Janik and Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -31,7 +31,7 @@
 
 /* --- defines --- */
 #define G_PARAM_SPEC_CLASS(class)              (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_PARAM, GParamSpecClass))
-#define        G_PARAM_USER_MASK                       ((1 << G_PARAM_USER_SHIFT) - 1)
+#define        G_PARAM_USER_MASK                       (~0 << G_PARAM_USER_SHIFT)
 #define PSPEC_APPLIES_TO_VALUE(pspec, value)   (G_TYPE_CHECK_VALUE_TYPE ((value), G_PARAM_SPEC_VALUE_TYPE (pspec)))
 #define        G_SLOCK(mutex)                          g_static_mutex_lock (mutex)
 #define        G_SUNLOCK(mutex)                        g_static_mutex_unlock (mutex)
@@ -49,6 +49,8 @@ static void   value_param_init                (GValue         *value);
 static void    value_param_free_value          (GValue         *value);
 static void    value_param_copy_value          (const GValue   *src_value,
                                                 GValue         *dest_value);
+static void    value_param_transform_value     (const GValue   *src_value,
+                                                GValue         *dest_value);
 static gpointer        value_param_peek_pointer        (const GValue   *value);
 static gchar*  value_param_collect_value       (GValue         *value,
                                                 guint           n_collect_values,
@@ -104,6 +106,7 @@ g_param_type_init (void)    /* sync with gtype.c */
 
   type = g_type_register_fundamental (G_TYPE_PARAM, "GParam", &param_spec_info, &finfo, G_TYPE_FLAG_ABSTRACT);
   g_assert (type == G_TYPE_PARAM);
+  g_value_register_transform_func (G_TYPE_PARAM, G_TYPE_PARAM, value_param_transform_value);
 }
 
 static void
@@ -345,6 +348,40 @@ g_param_value_validate (GParamSpec *pspec,
   return FALSE;
 }
 
+gboolean
+g_param_value_convert (GParamSpec   *pspec,
+                      const GValue *src_value,
+                      GValue       *dest_value,
+                      gboolean      strict_validation)
+{
+  GValue tmp_value = { 0, };
+
+  g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), FALSE);
+  g_return_val_if_fail (G_IS_VALUE (src_value), FALSE);
+  g_return_val_if_fail (G_IS_VALUE (dest_value), FALSE);
+  g_return_val_if_fail (PSPEC_APPLIES_TO_VALUE (pspec, dest_value), FALSE);
+
+  /* better leave dest_value untouched when returning FALSE */
+
+  g_value_init (&tmp_value, G_VALUE_TYPE (dest_value));
+  if (g_value_transform (src_value, &tmp_value) &&
+      (!g_param_value_validate (pspec, &tmp_value) || !strict_validation))
+    {
+      g_value_unset (dest_value);
+      
+      /* values are relocatable */
+      memcpy (dest_value, &tmp_value, sizeof (tmp_value));
+      
+      return TRUE;
+    }
+  else
+    {
+      g_value_unset (&tmp_value);
+      
+      return FALSE;
+    }
+}
+
 gint
 g_param_values_cmp (GParamSpec   *pspec,
                    const GValue *value1,
@@ -386,9 +423,21 @@ static void
 value_param_copy_value (const GValue *src_value,
                        GValue       *dest_value)
 {
-  dest_value->data[0].v_pointer = (src_value->data[0].v_pointer
-                                  ? g_param_spec_ref (src_value->data[0].v_pointer)
-                                  : NULL);
+  if (src_value->data[0].v_pointer)
+    dest_value->data[0].v_pointer = g_param_spec_ref (src_value->data[0].v_pointer);
+  else
+    dest_value->data[0].v_pointer = NULL;
+}
+
+static void
+value_param_transform_value (const GValue *src_value,
+                            GValue       *dest_value)
+{
+  if (src_value->data[0].v_pointer &&
+      g_type_is_a (G_PARAM_SPEC_TYPE (dest_value->data[0].v_pointer), G_VALUE_TYPE (dest_value)))
+    dest_value->data[0].v_pointer = g_param_spec_ref (src_value->data[0].v_pointer);
+  else
+    dest_value->data[0].v_pointer = NULL;
 }
 
 static gpointer
@@ -412,7 +461,7 @@ value_param_collect_value (GValue      *value,
                            G_VALUE_TYPE_NAME (value),
                            "'",
                            NULL);
-      else if (!g_type_is_a (G_PARAM_SPEC_TYPE (param), G_VALUE_TYPE (value)))
+      else if (!g_value_type_compatible (G_PARAM_SPEC_TYPE (param), G_VALUE_TYPE (value)))
        return g_strconcat ("invalid param spec type `",
                            G_PARAM_SPEC_TYPE_NAME (param),
                            "' for value type `",
@@ -601,8 +650,7 @@ GParamSpec*
 g_param_spec_pool_lookup (GParamSpecPool *pool,
                          const gchar    *param_name,
                          GType           owner_type,
-                         gboolean        walk_ancestors,
-                         const gchar   **trailer_p)
+                         gboolean        walk_ancestors)
 {
   GParamSpec *pspec;
   gchar *delim;
@@ -615,13 +663,11 @@ g_param_spec_pool_lookup (GParamSpecPool *pool,
 
   G_SLOCK (&pool->smutex);
 
-  delim = strchr (param_name, ':');
+  delim = pool->type_prefixing ? strchr (param_name, ':') : NULL;
 
-  /* try quick and away, i.e. no prefix, no trailer */
+  /* try quick and away, i.e. without prefix */
   if (!delim)
     {
-      if (trailer_p)
-       *trailer_p = NULL;
       pspec = param_spec_ht_lookup (pool->hash_table, param_name, owner_type, walk_ancestors);
       G_SUNLOCK (&pool->smutex);
 
@@ -645,48 +691,20 @@ g_param_spec_pool_lookup (GParamSpecPool *pool,
          /* sanity check, these cases don't make a whole lot of sense */
          if ((!walk_ancestors && type != owner_type) || !g_type_is_a (owner_type, type))
            {
-             if (trailer_p)
-               *trailer_p = NULL;
              G_SUNLOCK (&pool->smutex);
 
              return NULL;
            }
          owner_type = type;
          param_name += l + 2;
-         delim = strchr (param_name, ':');
-         if (!delim)           /* good, can still forget about trailer */
-           {
-             if (trailer_p)
-               *trailer_p = NULL;
-             pspec = param_spec_ht_lookup (pool->hash_table, param_name, owner_type, walk_ancestors);
-              G_SUNLOCK (&pool->smutex);
+         pspec = param_spec_ht_lookup (pool->hash_table, param_name, owner_type, walk_ancestors);
+         G_SUNLOCK (&pool->smutex);
 
-             return pspec;
-           }
+         return pspec;
        }
     }
-
-  /* ok, no prefix, handle trailer */
-  if (delim[1] == ':')
-    {
-      guint l = delim - param_name;
-      gchar stack_buffer[32], *buffer = l < 32 ? stack_buffer : g_new (gchar, l + 1);
-      
-      strncpy (buffer, param_name, delim - param_name);
-      buffer[l] = 0;
-      pspec = param_spec_ht_lookup (pool->hash_table, buffer, owner_type, walk_ancestors);
-      if (l >= 32)
-       g_free (buffer);
-      if (trailer_p)
-       *trailer_p = pspec ? delim + 2 : NULL;
-      G_SUNLOCK (&pool->smutex);
-
-      return pspec;
-    }
-
   /* malformed param_name */
-  if (trailer_p)
-    *trailer_p = NULL;
+
   G_SUNLOCK (&pool->smutex);
 
   return NULL;
@@ -784,7 +802,7 @@ void
 g_value_set_param (GValue     *value,
                   GParamSpec *param)
 {
-  g_return_if_fail (G_IS_VALUE_PARAM (value));
+  g_return_if_fail (G_VALUE_HOLDS_PARAM (value));
   if (param)
     g_return_if_fail (G_IS_PARAM_SPEC (param));
 
@@ -798,7 +816,7 @@ g_value_set_param (GValue     *value,
 GParamSpec*
 g_value_get_param (const GValue *value)
 {
-  g_return_val_if_fail (G_IS_VALUE_PARAM (value), NULL);
+  g_return_val_if_fail (G_VALUE_HOLDS_PARAM (value), NULL);
 
   return value->data[0].v_pointer;
 }
@@ -806,7 +824,7 @@ g_value_get_param (const GValue *value)
 GParamSpec*
 g_value_dup_param (const GValue *value)
 {
-  g_return_val_if_fail (G_IS_VALUE_PARAM (value), NULL);
+  g_return_val_if_fail (G_VALUE_HOLDS_PARAM (value), NULL);
 
   return value->data[0].v_pointer ? g_param_spec_ref (value->data[0].v_pointer) : NULL;
 }
index 3a27b1ff855804110dfb1aeefdecbd3d64362640..d186ffdf9891b3555a5251d219e6561928108f81 100644 (file)
@@ -1,5 +1,5 @@
 /* GObject - GLib Type, Object, Parameter and Signal Library
- * Copyright (C) 1997, 1998, 1999, 2000 Tim Janik and Red Hat, Inc.
+ * Copyright (C) 1997-1999, 2000-2001 Tim Janik and Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -38,7 +38,7 @@ extern "C" {
 #define G_IS_PARAM_SPEC(pspec)         (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM))
 #define G_PARAM_SPEC_GET_CLASS(pspec)  (G_TYPE_INSTANCE_GET_CLASS ((pspec), G_TYPE_PARAM, GParamSpecClass))
 #define        G_PARAM_SPEC_VALUE_TYPE(pspec)  (G_PARAM_SPEC (pspec)->value_type)
-#define G_IS_VALUE_PARAM(value)                (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_PARAM))
+#define G_VALUE_HOLDS_PARAM(value)     (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_PARAM))
        
 
 /* --- flags --- */
@@ -48,7 +48,8 @@ typedef enum
   G_PARAM_WRITABLE            = 1 << 1,
   G_PARAM_CONSTRUCT          = 1 << 2,
   G_PARAM_CONSTRUCT_ONLY      = 1 << 3,
-  G_PARAM_PRIVATE            = 1 << 4
+  G_PARAM_LAX_VALIDATION      = 1 << 4,
+  G_PARAM_PRIVATE            = 1 << 5
 } GParamFlags;
 #define        G_PARAM_READWRITE       (G_PARAM_READABLE | G_PARAM_WRITABLE)
 #define        G_PARAM_MASK            (0x000000ff)
@@ -115,6 +116,10 @@ gboolean   g_param_value_defaults          (GParamSpec    *pspec,
                                                 GValue        *value);
 gboolean       g_param_value_validate          (GParamSpec    *pspec,
                                                 GValue        *value);
+gboolean       g_param_value_convert           (GParamSpec    *dest_value_spec,
+                                                const GValue  *src_value,
+                                                GValue        *dest_value,
+                                                gboolean       strict_validation);
 gint           g_param_values_cmp              (GParamSpec    *pspec,
                                                 const GValue  *value1,
                                                 const GValue  *value2);
@@ -163,8 +168,7 @@ void                g_param_spec_pool_remove        (GParamSpecPool *pool,
 GParamSpec*    g_param_spec_pool_lookup        (GParamSpecPool *pool,
                                                 const gchar    *param_name,
                                                 GType           owner_type,
-                                                gboolean        walk_ancestors,
-                                                const gchar   **trailer_p);
+                                                gboolean        walk_ancestors);
 
 
 /* contracts:
index 358041c35d5b9a311198f8c1d9abbd9d45f6eb32..44dca645df82ec4fe945fa1c1b73323765b1f950 100644 (file)
@@ -1,5 +1,5 @@
 /* GObject - GLib Type, Object, Parameter and Signal Library
- * Copyright (C) 1997, 1998, 1999, 2000 Tim Janik and Red Hat, Inc.
+ * Copyright (C) 1997-1999, 2000-2001 Tim Janik and Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -24,6 +24,7 @@
 #include       "gparamspecs.h"
 
 #include       "gvaluecollector.h"
+#include       "gvaluearray.h"
 #include       <string.h>
 #include       "../config.h"   /* for SIZEOF_LONG */
 
@@ -33,7 +34,7 @@
 
 /* --- param spec functions --- */
 static void
-param_spec_char_init (GParamSpec *pspec)
+param_char_init (GParamSpec *pspec)
 {
   GParamSpecChar *cspec = G_PARAM_SPEC_CHAR (pspec);
   
@@ -62,7 +63,7 @@ param_char_validate (GParamSpec *pspec,
 }
 
 static void
-param_spec_uchar_init (GParamSpec *pspec)
+param_uchar_init (GParamSpec *pspec)
 {
   GParamSpecUChar *uspec = G_PARAM_SPEC_UCHAR (pspec);
   
@@ -109,7 +110,7 @@ param_boolean_validate (GParamSpec *pspec,
 }
 
 static void
-param_spec_int_init (GParamSpec *pspec)
+param_int_init (GParamSpec *pspec)
 {
   GParamSpecInt *ispec = G_PARAM_SPEC_INT (pspec);
   
@@ -149,7 +150,7 @@ param_int_values_cmp (GParamSpec   *pspec,
 }
 
 static void
-param_spec_uint_init (GParamSpec *pspec)
+param_uint_init (GParamSpec *pspec)
 {
   GParamSpecUInt *uspec = G_PARAM_SPEC_UINT (pspec);
   
@@ -189,7 +190,7 @@ param_uint_values_cmp (GParamSpec   *pspec,
 }
 
 static void
-param_spec_long_init (GParamSpec *pspec)
+param_long_init (GParamSpec *pspec)
 {
   GParamSpecLong *lspec = G_PARAM_SPEC_LONG (pspec);
   
@@ -234,7 +235,7 @@ param_long_values_cmp (GParamSpec   *pspec,
 }
 
 static void
-param_spec_ulong_init (GParamSpec *pspec)
+param_ulong_init (GParamSpec *pspec)
 {
   GParamSpecULong *uspec = G_PARAM_SPEC_ULONG (pspec);
   
@@ -278,7 +279,7 @@ param_ulong_values_cmp (GParamSpec   *pspec,
 }
 
 static void
-param_spec_enum_init (GParamSpec *pspec)
+param_enum_init (GParamSpec *pspec)
 {
   GParamSpecEnum *espec = G_PARAM_SPEC_ENUM (pspec);
   
@@ -287,7 +288,7 @@ param_spec_enum_init (GParamSpec *pspec)
 }
 
 static void
-param_spec_enum_finalize (GParamSpec *pspec)
+param_enum_finalize (GParamSpec *pspec)
 {
   GParamSpecEnum *espec = G_PARAM_SPEC_ENUM (pspec);
   GParamSpecClass *parent_class = g_type_class_peek (g_type_parent (G_TYPE_PARAM_ENUM));
@@ -323,7 +324,7 @@ param_enum_validate (GParamSpec *pspec,
 }
 
 static void
-param_spec_flags_init (GParamSpec *pspec)
+param_flags_init (GParamSpec *pspec)
 {
   GParamSpecFlags *fspec = G_PARAM_SPEC_FLAGS (pspec);
   
@@ -332,7 +333,7 @@ param_spec_flags_init (GParamSpec *pspec)
 }
 
 static void
-param_spec_flags_finalize (GParamSpec *pspec)
+param_flags_finalize (GParamSpec *pspec)
 {
   GParamSpecFlags *fspec = G_PARAM_SPEC_FLAGS (pspec);
   GParamSpecClass *parent_class = g_type_class_peek (g_type_parent (G_TYPE_PARAM_FLAGS));
@@ -369,7 +370,7 @@ param_flags_validate (GParamSpec *pspec,
 }
 
 static void
-param_spec_float_init (GParamSpec *pspec)
+param_float_init (GParamSpec *pspec)
 {
   GParamSpecFloat *fspec = G_PARAM_SPEC_FLOAT (pspec);
   
@@ -412,7 +413,7 @@ param_float_values_cmp (GParamSpec   *pspec,
 }
 
 static void
-param_spec_double_init (GParamSpec *pspec)
+param_double_init (GParamSpec *pspec)
 {
   GParamSpecDouble *dspec = G_PARAM_SPEC_DOUBLE (pspec);
   
@@ -455,7 +456,7 @@ param_double_values_cmp (GParamSpec   *pspec,
 }
 
 static void
-param_spec_string_init (GParamSpec *pspec)
+param_string_init (GParamSpec *pspec)
 {
   GParamSpecString *sspec = G_PARAM_SPEC_STRING (pspec);
   
@@ -468,7 +469,7 @@ param_spec_string_init (GParamSpec *pspec)
 }
 
 static void
-param_spec_string_finalize (GParamSpec *pspec)
+param_string_finalize (GParamSpec *pspec)
 {
   GParamSpecString *sspec = G_PARAM_SPEC_STRING (pspec);
   GParamSpecClass *parent_class = g_type_class_peek (g_type_parent (G_TYPE_PARAM_STRING));
@@ -546,7 +547,7 @@ param_string_values_cmp (GParamSpec   *pspec,
 }
 
 static void
-param_spec_param_init (GParamSpec *pspec)
+param_param_init (GParamSpec *pspec)
 {
   /* GParamSpecParam *spec = G_PARAM_SPEC_PARAM (pspec); */
 }
@@ -566,7 +567,7 @@ param_param_validate (GParamSpec *pspec,
   GParamSpec *param = value->data[0].v_pointer;
   guint changed = 0;
   
-  if (param && !g_type_is_a (G_PARAM_SPEC_TYPE (param), G_PARAM_SPEC_VALUE_TYPE (pspec)))
+  if (param && !g_value_type_compatible (G_PARAM_SPEC_TYPE (param), G_PARAM_SPEC_VALUE_TYPE (pspec)))
     {
       g_param_spec_unref (param);
       value->data[0].v_pointer = NULL;
@@ -577,299 +578,300 @@ param_param_validate (GParamSpec *pspec,
 }
 
 static void
-param_spec_pointer_init (GParamSpec *pspec)
+param_boxed_init (GParamSpec *pspec)
 {
-  /* GParamSpecPointer *spec = G_PARAM_SPEC_POINTER (pspec); */
+  /* GParamSpecBoxed *bspec = G_PARAM_SPEC_BOXED (pspec); */
 }
 
 static void
-param_pointer_set_default (GParamSpec *pspec,
-                          GValue     *value)
+param_boxed_set_default (GParamSpec *pspec,
+                        GValue     *value)
 {
   value->data[0].v_pointer = NULL;
 }
 
 static gboolean
-param_pointer_validate (GParamSpec *pspec,
-                       GValue     *value)
+param_boxed_validate (GParamSpec *pspec,
+                     GValue     *value)
 {
-  /* GParamSpecPointer *spec = G_PARAM_SPEC_POINTER (pspec); */
+  /* GParamSpecBoxed *bspec = G_PARAM_SPEC_BOXED (pspec); */
   guint changed = 0;
+
+  /* can't do a whole lot here since we haven't even G_BOXED_TYPE() */
   
   return changed;
 }
 
 static gint
-param_pointer_values_cmp (GParamSpec   *pspec,
-                         const GValue *value1,
-                         const GValue *value2)
+param_boxed_values_cmp (GParamSpec    *pspec,
+                        const GValue *value1,
+                        const GValue *value2)
 {
-  return value1->data[0].v_pointer != value2->data[0].v_pointer;
+  guint8 *p1 = value1->data[0].v_pointer;
+  guint8 *p2 = value2->data[0].v_pointer;
+
+  /* not much to compare here, try to at least provide stable lesser/greater result */
+
+  return p1 < p2 ? -1 : p1 > p2;
 }
 
 static void
-param_spec_ccallback_init (GParamSpec *pspec)
+param_pointer_init (GParamSpec *pspec)
 {
-  /* GParamSpecCCallback *spec = G_PARAM_SPEC_CCALLBACK (pspec); */
+  /* GParamSpecPointer *spec = G_PARAM_SPEC_POINTER (pspec); */
 }
 
 static void
-param_ccallback_set_default (GParamSpec *pspec,
-                            GValue     *value)
+param_pointer_set_default (GParamSpec *pspec,
+                          GValue     *value)
 {
   value->data[0].v_pointer = NULL;
-  value->data[1].v_pointer = NULL;
 }
 
 static gboolean
-param_ccallback_validate (GParamSpec *pspec,
-                         GValue     *value)
+param_pointer_validate (GParamSpec *pspec,
+                       GValue     *value)
 {
-  /* GParamSpecCCallback *spec = G_PARAM_SPEC_CCALLBACK (pspec); */
+  /* GParamSpecPointer *spec = G_PARAM_SPEC_POINTER (pspec); */
   guint changed = 0;
   
   return changed;
 }
 
 static gint
-param_ccallback_values_cmp (GParamSpec   *pspec,
-                           const GValue *value1,
-                           const GValue *value2)
+param_pointer_values_cmp (GParamSpec   *pspec,
+                         const GValue *value1,
+                         const GValue *value2)
 {
-  return (value1->data[0].v_pointer != value2->data[0].v_pointer ||
-         value1->data[1].v_pointer != value2->data[1].v_pointer);
+  guint8 *p1 = value1->data[0].v_pointer;
+  guint8 *p2 = value2->data[0].v_pointer;
+
+  /* not much to compare here, try to at least provide stable lesser/greater result */
+
+  return p1 < p2 ? -1 : p1 > p2;
 }
 
 static void
-param_spec_boxed_init (GParamSpec *pspec)
+param_closure_init (GParamSpec *pspec)
 {
-  /* GParamSpecBoxed *bspec = G_PARAM_SPEC_BOXED (pspec); */
+  /* GParamSpecClosure *cspec = G_PARAM_SPEC_CLOSURE (pspec); */
 }
 
 static void
-param_boxed_set_default (GParamSpec *pspec,
-                        GValue     *value)
+param_closure_set_default (GParamSpec *pspec,
+                          GValue     *value)
 {
   value->data[0].v_pointer = NULL;
 }
 
 static gboolean
-param_boxed_validate (GParamSpec *pspec,
-                     GValue     *value)
+param_closure_validate (GParamSpec *pspec,
+                       GValue     *value)
 {
-  /* GParamSpecBoxed *bspec = G_PARAM_SPEC_BOXED (pspec); */
+  /* GParamSpecClosure *cspec = G_PARAM_SPEC_CLOSURE (pspec); */
+  /* GClosure *closure = value->data[0].v_pointer; */
   guint changed = 0;
 
-  /* can't do a whole lot here since we haven't even G_BOXED_TYPE() */
-  
+  /* we don't actually have necessary means to ensure closure validity */
+
   return changed;
 }
 
 static gint
-param_boxed_values_cmp (GParamSpec    *pspec,
-                        const GValue *value1,
-                        const GValue *value2)
+param_closure_values_cmp (GParamSpec   *pspec,
+                         const GValue *value1,
+                         const GValue *value2)
 {
-  return value1->data[0].v_pointer != value2->data[0].v_pointer;
-}
+  guint8 *p1 = value1->data[0].v_pointer;
+  guint8 *p2 = value2->data[0].v_pointer;
 
-static void
-param_spec_object_init (GParamSpec *pspec)
-{
-  /* GParamSpecObject *ospec = G_PARAM_SPEC_OBJECT (pspec); */
-}
+  /* not much to compare here, try to at least provide stable lesser/greater result */
 
-static void
-param_spec_interface_init (GParamSpec *pspec)
-{
-  /* GParamSpecObject *ospec = G_PARAM_SPEC_OBJECT (pspec); */
+  return p1 < p2 ? -1 : p1 > p2;
 }
 
 static void
-param_object_set_default (GParamSpec *pspec,
-                         GValue     *value)
+param_value_array_init (GParamSpec *pspec)
 {
-  value->data[0].v_pointer = NULL;
+  GParamSpecValueArray *aspec = G_PARAM_SPEC_VALUE_ARRAY (pspec);
+
+  aspec->element_spec = NULL;
+  aspec->fixed_n_elements = 0; /* disable */
 }
 
-static gboolean
-param_object_validate (GParamSpec *pspec,
-                      GValue     *value)
+static inline guint
+value_array_ensure_size (GValueArray *value_array,
+                        guint        fixed_n_elements)
 {
-  GParamSpecObject *ospec = G_PARAM_SPEC_OBJECT (pspec);
-  GObject *object = value->data[0].v_pointer;
   guint changed = 0;
-  
-  if (object && !g_type_is_a (G_OBJECT_TYPE (object), G_PARAM_SPEC_VALUE_TYPE (ospec)))
+
+  if (fixed_n_elements)
     {
-      g_object_unref (object);
-      value->data[0].v_pointer = NULL;
-      changed++;
+      while (value_array->n_values < fixed_n_elements)
+       {
+         g_value_array_append (value_array, NULL);
+         changed++;
+       }
+      while (value_array->n_values > fixed_n_elements)
+       {
+         g_value_array_remove (value_array, value_array->n_values - 1);
+         changed++;
+       }
     }
-  
   return changed;
 }
 
-static gint
-param_object_values_cmp (GParamSpec   *pspec,
-                        const GValue *value1,
-                        const GValue *value2)
+static void
+param_value_array_finalize (GParamSpec *pspec)
 {
-  return value1->data[0].v_pointer != value2->data[0].v_pointer;
+  GParamSpecValueArray *aspec = G_PARAM_SPEC_VALUE_ARRAY (pspec);
+  GParamSpecClass *parent_class = g_type_class_peek (g_type_parent (G_TYPE_PARAM_VALUE_ARRAY));
+
+  if (aspec->element_spec)
+    {
+      g_param_spec_unref (aspec->element_spec);
+      aspec->element_spec = NULL;
+    }
+
+  parent_class->finalize (pspec);
 }
 
 static void
-param_interface_set_default (GParamSpec *pspec,
-                            GValue     *value)
+param_value_array_set_default (GParamSpec *pspec,
+                              GValue     *value)
 {
-  value->data[0].v_pointer = NULL;
+  GParamSpecValueArray *aspec = G_PARAM_SPEC_VALUE_ARRAY (pspec);
+
+  g_return_if_fail (value->data[0].v_pointer != NULL); /* paranoid */
+  
+  /* g_value_reset (value);  already done */
+  value_array_ensure_size (value->data[0].v_pointer, aspec->fixed_n_elements);
 }
 
 static gboolean
-param_interface_validate (GParamSpec *pspec,
-                         GValue     *value)
+param_value_array_validate (GParamSpec *pspec,
+                           GValue     *value)
 {
+  GParamSpecValueArray *aspec = G_PARAM_SPEC_VALUE_ARRAY (pspec);
+  GValueArray *value_array = value->data[0].v_pointer;
   guint changed = 0;
-  
-  if (value->data[0].v_pointer == NULL)
-    changed++;
 
-  return changed;
-}
+  g_return_val_if_fail (value->data[0].v_pointer != NULL, FALSE);      /* paranoid */
 
-static gint
-param_interface_values_cmp (GParamSpec   *pspec,
-                           const GValue *value1,
-                           const GValue *value2)
-{
-  return value1->data[0].v_pointer != value2->data[0].v_pointer;
-}
+  /* ensure array size validity */
+  changed += value_array_ensure_size (value_array, aspec->fixed_n_elements);
 
-static void
-value_exch_memcpy (GValue *value1,
-                  GValue *value2)
-{
-  GValue tmp_value;
-  memcpy (&tmp_value.data, &value1->data, sizeof (value1->data));
-  memcpy (&value1->data, &value2->data, sizeof (value1->data));
-  memcpy (&value2->data, &tmp_value.data, sizeof (value2->data));
-}
+  /* ensure array values validity against a present element spec */
+  if (aspec->element_spec)
+    {
+      GParamSpec *element_spec = aspec->element_spec;
+      guint i;
 
-static void
-value_exch_long_int (GValue *value1,
-                    GValue *value2)
-{
-  glong tmp = value1->data[0].v_long;
-  value1->data[0].v_long = value2->data[0].v_int;
-  value2->data[0].v_int = tmp;
-}
+      for (i = 0; i < value_array->n_values; i++)
+       {
+         GValue *element = value_array->values + i;
 
-static void
-value_exch_long_uint (GValue *value1,
-                     GValue *value2)
-{
-  glong tmp = value1->data[0].v_long;
-  value1->data[0].v_long = value2->data[0].v_uint;
-  value2->data[0].v_uint = tmp;
-}
+         /* need to fixup value type, or ensure that the array value is initialized at all */
+         if (!g_value_type_compatible (G_VALUE_TYPE (element), G_PARAM_SPEC_VALUE_TYPE (element_spec)))
+           {
+             if (G_VALUE_TYPE (element) != 0)
+               g_value_unset (element);
+             g_value_init (element, G_PARAM_SPEC_VALUE_TYPE (element_spec));
+             g_param_value_set_default (element_spec, element);
+             changed++;
+           }
+         /* validate array value against element_spec */
+         changed += g_param_value_validate (element_spec, element);
+       }
+    }
 
-static void
-value_exch_ulong_int (GValue *value1,
-                     GValue *value2)
-{
-  gulong tmp = value1->data[0].v_ulong;
-  value1->data[0].v_ulong = value2->data[0].v_int;
-  value2->data[0].v_int = tmp;
+  return changed;
 }
 
-static void
-value_exch_ulong_uint (GValue *value1,
-                      GValue *value2)
+static gint
+param_value_array_values_cmp (GParamSpec   *pspec,
+                             const GValue *value1,
+                             const GValue *value2)
 {
-  gulong tmp = value1->data[0].v_ulong;
-  value1->data[0].v_ulong = value2->data[0].v_uint;
-  value2->data[0].v_uint = tmp;
-}
+  GParamSpecValueArray *aspec = G_PARAM_SPEC_VALUE_ARRAY (pspec);
+  GValueArray *value_array1 = value1->data[0].v_pointer;
+  GValueArray *value_array2 = value2->data[0].v_pointer;
 
-static void
-value_exch_float_int (GValue *value1,
-                     GValue *value2)
-{
-  gfloat tmp = value1->data[0].v_float;
-  value1->data[0].v_float = value2->data[0].v_int;
-  value2->data[0].v_int = 0.5 + tmp;
-}
+  g_return_val_if_fail (value1->data[0].v_pointer != NULL, -1);        /* paranoid */
+  g_return_val_if_fail (value2->data[0].v_pointer != NULL, 1); /* paranoid */
 
-static void
-value_exch_float_uint (GValue *value1,
-                      GValue *value2)
-{
-  gfloat tmp = value1->data[0].v_float;
-  value1->data[0].v_float = value2->data[0].v_uint;
-  value2->data[0].v_uint = 0.5 + tmp;
-}
+  if (value_array1->n_values != value_array2->n_values)
+    return value_array1->n_values < value_array2->n_values ? -1 : 1;
+  else if (!aspec->element_spec)
+    {
+      /* we need an element specification for comparisons, so there's not much
+       * to compare here, try to at least provide stable lesser/greater result
+       */
+      return value_array1->n_values < value_array2->n_values ? -1 : value_array1->n_values > value_array2->n_values;
+    }
+  else /* value_array1->n_values == value_array2->n_values */
+    {
+      guint i;
 
-static void
-value_exch_float_long (GValue *value1,
-                      GValue *value2)
-{
-  gfloat tmp = value1->data[0].v_float;
-  value1->data[0].v_float = value2->data[0].v_long;
-  value2->data[0].v_long = 0.5 + tmp;
+      for (i = 0; i < value_array1->n_values; i++)
+       {
+         GValue *element1 = value_array1->values + i;
+         GValue *element2 = value_array2->values + i;
+         gint cmp;
+
+         /* need corresponding element types, provide stable result otherwise */
+         if (G_VALUE_TYPE (element1) != G_VALUE_TYPE (element2))
+           return G_VALUE_TYPE (element1) < G_VALUE_TYPE (element2) ? -1 : 1;
+         cmp = g_param_values_cmp (aspec->element_spec, element1, element2);
+         if (cmp)
+           return cmp;
+       }
+      return 0;
+    }
 }
 
 static void
-value_exch_float_ulong (GValue *value1,
-                       GValue *value2)
+param_object_init (GParamSpec *pspec)
 {
-  gfloat tmp = value1->data[0].v_float;
-  value1->data[0].v_float = value2->data[0].v_ulong;
-  value2->data[0].v_ulong = 0.5 + tmp;
+  /* GParamSpecObject *ospec = G_PARAM_SPEC_OBJECT (pspec); */
 }
 
 static void
-value_exch_double_int (GValue *value1,
-                      GValue *value2)
+param_object_set_default (GParamSpec *pspec,
+                         GValue     *value)
 {
-  gdouble tmp = value1->data[0].v_double;
-  value1->data[0].v_double = value2->data[0].v_int;
-  value2->data[0].v_int = 0.5 + tmp;
+  value->data[0].v_pointer = NULL;
 }
 
-static void
-value_exch_double_uint (GValue *value1,
-                       GValue *value2)
+static gboolean
+param_object_validate (GParamSpec *pspec,
+                      GValue     *value)
 {
-  gdouble tmp = value1->data[0].v_double;
-  value1->data[0].v_double = value2->data[0].v_uint;
-  value2->data[0].v_uint = 0.5 + tmp;
+  GParamSpecObject *ospec = G_PARAM_SPEC_OBJECT (pspec);
+  GObject *object = value->data[0].v_pointer;
+  guint changed = 0;
+  
+  if (object && !g_value_type_compatible (G_OBJECT_TYPE (object), G_PARAM_SPEC_VALUE_TYPE (ospec)))
+    {
+      g_object_unref (object);
+      value->data[0].v_pointer = NULL;
+      changed++;
+    }
+  
+  return changed;
 }
 
-static void
-value_exch_double_long (GValue *value1,
-                       GValue *value2)
+static gint
+param_object_values_cmp (GParamSpec   *pspec,
+                        const GValue *value1,
+                        const GValue *value2)
 {
-  gdouble tmp = value1->data[0].v_double;
-  value1->data[0].v_double = value2->data[0].v_long;
-  value2->data[0].v_long = 0.5 + tmp;
-}
+  guint8 *p1 = value1->data[0].v_pointer;
+  guint8 *p2 = value2->data[0].v_pointer;
 
-static void
-value_exch_double_ulong (GValue *value1,
-                        GValue *value2)
-{
-  gdouble tmp = value1->data[0].v_double;
-  value1->data[0].v_double = value2->data[0].v_ulong;
-  value2->data[0].v_ulong = 0.5 + tmp;
-}
+  /* not much to compare here, try to at least provide stable lesser/greater result */
 
-static void
-value_exch_double_float (GValue *value1,
-                        GValue *value2)
-{
-  gdouble tmp = value1->data[0].v_double;
-  value1->data[0].v_double = value2->data[0].v_float;
-  value2->data[0].v_float = tmp;
+  return p1 < p2 ? -1 : p1 > p2;
 }
 
 
@@ -885,7 +887,7 @@ g_param_spec_types_init (void)      /* sync with gtype.c */
     static const GParamSpecTypeInfo pspec_info = {
       sizeof (GParamSpecChar), /* instance_size */
       16,                      /* n_preallocs */
-      param_spec_char_init,    /* instance_init */
+      param_char_init,         /* instance_init */
       G_TYPE_CHAR,             /* value_type */
       NULL,                    /* finalize */
       param_char_set_default,  /* value_set_default */
@@ -902,7 +904,7 @@ g_param_spec_types_init (void)      /* sync with gtype.c */
     static const GParamSpecTypeInfo pspec_info = {
       sizeof (GParamSpecUChar), /* instance_size */
       16,                       /* n_preallocs */
-      param_spec_uchar_init,    /* instance_init */
+      param_uchar_init,         /* instance_init */
       G_TYPE_UCHAR,            /* value_type */
       NULL,                    /* finalize */
       param_uchar_set_default, /* value_set_default */
@@ -936,7 +938,7 @@ g_param_spec_types_init (void)      /* sync with gtype.c */
     static const GParamSpecTypeInfo pspec_info = {
       sizeof (GParamSpecInt),   /* instance_size */
       16,                       /* n_preallocs */
-      param_spec_int_init,      /* instance_init */
+      param_int_init,           /* instance_init */
       G_TYPE_INT,              /* value_type */
       NULL,                    /* finalize */
       param_int_set_default,   /* value_set_default */
@@ -953,7 +955,7 @@ g_param_spec_types_init (void)      /* sync with gtype.c */
     static const GParamSpecTypeInfo pspec_info = {
       sizeof (GParamSpecUInt),  /* instance_size */
       16,                       /* n_preallocs */
-      param_spec_uint_init,     /* instance_init */
+      param_uint_init,          /* instance_init */
       G_TYPE_UINT,             /* value_type */
       NULL,                    /* finalize */
       param_uint_set_default,  /* value_set_default */
@@ -970,7 +972,7 @@ g_param_spec_types_init (void)      /* sync with gtype.c */
     static const GParamSpecTypeInfo pspec_info = {
       sizeof (GParamSpecLong),  /* instance_size */
       16,                       /* n_preallocs */
-      param_spec_long_init,     /* instance_init */
+      param_long_init,          /* instance_init */
       G_TYPE_LONG,             /* value_type */
       NULL,                    /* finalize */
       param_long_set_default,  /* value_set_default */
@@ -987,7 +989,7 @@ g_param_spec_types_init (void)      /* sync with gtype.c */
     static const GParamSpecTypeInfo pspec_info = {
       sizeof (GParamSpecULong), /* instance_size */
       16,                       /* n_preallocs */
-      param_spec_ulong_init,    /* instance_init */
+      param_ulong_init,         /* instance_init */
       G_TYPE_ULONG,            /* value_type */
       NULL,                    /* finalize */
       param_ulong_set_default, /* value_set_default */
@@ -1004,9 +1006,9 @@ g_param_spec_types_init (void)    /* sync with gtype.c */
     static const GParamSpecTypeInfo pspec_info = {
       sizeof (GParamSpecEnum),  /* instance_size */
       16,                       /* n_preallocs */
-      param_spec_enum_init,     /* instance_init */
+      param_enum_init,          /* instance_init */
       G_TYPE_ENUM,             /* value_type */
-      param_spec_enum_finalize,        /* finalize */
+      param_enum_finalize,     /* finalize */
       param_enum_set_default,  /* value_set_default */
       param_enum_validate,     /* value_validate */
       param_long_values_cmp,   /* values_cmp */
@@ -1019,11 +1021,11 @@ g_param_spec_types_init (void)  /* sync with gtype.c */
    */
   {
     static const GParamSpecTypeInfo pspec_info = {
-      sizeof (GParamSpecFlags), /* instance_size */
-      16,                       /* n_preallocs */
-      param_spec_flags_init,    /* instance_init */
+      sizeof (GParamSpecFlags),        /* instance_size */
+      16,                      /* n_preallocs */
+      param_flags_init,                /* instance_init */
       G_TYPE_FLAGS,            /* value_type */
-      param_spec_flags_finalize,/* finalize */
+      param_flags_finalize,    /* finalize */
       param_flags_set_default, /* value_set_default */
       param_flags_validate,    /* value_validate */
       param_ulong_values_cmp,  /* values_cmp */
@@ -1038,7 +1040,7 @@ g_param_spec_types_init (void)    /* sync with gtype.c */
     static const GParamSpecTypeInfo pspec_info = {
       sizeof (GParamSpecFloat), /* instance_size */
       16,                       /* n_preallocs */
-      param_spec_float_init,    /* instance_init */
+      param_float_init,         /* instance_init */
       G_TYPE_FLOAT,            /* value_type */
       NULL,                    /* finalize */
       param_float_set_default, /* value_set_default */
@@ -1053,14 +1055,14 @@ g_param_spec_types_init (void)  /* sync with gtype.c */
    */
   {
     static const GParamSpecTypeInfo pspec_info = {
-      sizeof (GParamSpecDouble), /* instance_size */
-      16,                        /* n_preallocs */
-      param_spec_double_init,    /* instance_init */
-      G_TYPE_DOUBLE,            /* value_type */
-      NULL,                     /* finalize */
-      param_double_set_default,         /* value_set_default */
-      param_double_validate,    /* value_validate */
-      param_double_values_cmp,  /* values_cmp */
+      sizeof (GParamSpecDouble),       /* instance_size */
+      16,                              /* n_preallocs */
+      param_double_init,               /* instance_init */
+      G_TYPE_DOUBLE,                   /* value_type */
+      NULL,                            /* finalize */
+      param_double_set_default,                /* value_set_default */
+      param_double_validate,           /* value_validate */
+      param_double_values_cmp,         /* values_cmp */
     };
     type = g_param_type_register_static ("GParamDouble", &pspec_info);
     g_assert (type == G_TYPE_PARAM_DOUBLE);
@@ -1070,14 +1072,14 @@ g_param_spec_types_init (void)  /* sync with gtype.c */
    */
   {
     static const GParamSpecTypeInfo pspec_info = {
-      sizeof (GParamSpecString),  /* instance_size */
-      16,                        /* n_preallocs */
-      param_spec_string_init,    /* instance_init */
-      G_TYPE_STRING,             /* value_type */
-      param_spec_string_finalize, /* finalize */
-      param_string_set_default,          /* value_set_default */
-      param_string_validate,     /* value_validate */
-      param_string_values_cmp,   /* values_cmp */
+      sizeof (GParamSpecString),       /* instance_size */
+      16,                              /* n_preallocs */
+      param_string_init,               /* instance_init */
+      G_TYPE_STRING,                   /* value_type */
+      param_string_finalize,           /* finalize */
+      param_string_set_default,                /* value_set_default */
+      param_string_validate,           /* value_validate */
+      param_string_values_cmp,         /* values_cmp */
     };
     type = g_param_type_register_static ("GParamString", &pspec_info);
     g_assert (type == G_TYPE_PARAM_STRING);
@@ -1087,26 +1089,43 @@ g_param_spec_types_init (void)  /* sync with gtype.c */
    */
   {
     static const GParamSpecTypeInfo pspec_info = {
-      sizeof (GParamSpecParam),  /* instance_size */
-      16,                        /* n_preallocs */
-      param_spec_param_init,     /* instance_init */
-      G_TYPE_PARAM,             /* value_type */
-      NULL,                     /* finalize */
-      param_param_set_default,  /* value_set_default */
-      param_param_validate,     /* value_validate */
-      param_pointer_values_cmp,         /* values_cmp */
+      sizeof (GParamSpecParam),        /* instance_size */
+      16,                      /* n_preallocs */
+      param_param_init,                /* instance_init */
+      G_TYPE_PARAM,            /* value_type */
+      NULL,                    /* finalize */
+      param_param_set_default, /* value_set_default */
+      param_param_validate,    /* value_validate */
+      param_pointer_values_cmp,        /* values_cmp */
     };
     type = g_param_type_register_static ("GParamParam", &pspec_info);
     g_assert (type == G_TYPE_PARAM_PARAM);
   }
   
+  /* G_TYPE_PARAM_BOXED
+   */
+  {
+    static const GParamSpecTypeInfo pspec_info = {
+      sizeof (GParamSpecBoxed),        /* instance_size */
+      4,                       /* n_preallocs */
+      param_boxed_init,                /* instance_init */
+      G_TYPE_BOXED,            /* value_type */
+      NULL,                    /* finalize */
+      param_boxed_set_default, /* value_set_default */
+      param_boxed_validate,    /* value_validate */
+      param_boxed_values_cmp,  /* values_cmp */
+    };
+    type = g_param_type_register_static ("GParamBoxed", &pspec_info);
+    g_assert (type == G_TYPE_PARAM_BOXED);
+  }
+
   /* G_TYPE_PARAM_POINTER
    */
   {
     static const GParamSpecTypeInfo pspec_info = {
       sizeof (GParamSpecPointer),  /* instance_size */
       0,                           /* n_preallocs */
-      param_spec_pointer_init,     /* instance_init */
+      param_pointer_init,         /* instance_init */
       G_TYPE_POINTER,                     /* value_type */
       NULL,                       /* finalize */
       param_pointer_set_default,   /* value_set_default */
@@ -1117,47 +1136,47 @@ g_param_spec_types_init (void)  /* sync with gtype.c */
     g_assert (type == G_TYPE_PARAM_POINTER);
   }
   
-  /* G_TYPE_PARAM_CCALLBACK
+  /* G_TYPE_PARAM_VALUE_ARRAY
    */
   {
     static const GParamSpecTypeInfo pspec_info = {
-      sizeof (GParamSpecCCallback), /* instance_size */
-      0,                            /* n_preallocs */
-      param_spec_ccallback_init,    /* instance_init */
-      G_TYPE_CCALLBACK,                    /* value_type */
-      NULL,                        /* finalize */
-      param_ccallback_set_default,  /* value_set_default */
-      param_ccallback_validate,            /* value_validate */
-      param_ccallback_values_cmp,   /* values_cmp */
+      sizeof (GParamSpecValueArray),   /* instance_size */
+      0,                               /* n_preallocs */
+      param_value_array_init,          /* instance_init */
+      G_TYPE_VALUE_ARRAY,              /* value_type */
+      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 */
     };
-    type = g_param_type_register_static ("GParamCCallback", &pspec_info);
-    g_assert (type == G_TYPE_PARAM_CCALLBACK);
+    type = g_param_type_register_static ("GParamValueArray", &pspec_info);
+    g_assert (type == G_TYPE_PARAM_VALUE_ARRAY);
   }
-  
-  /* G_TYPE_PARAM_BOXED
+
+  /* G_TYPE_PARAM_CLOSURE
    */
   {
     static const GParamSpecTypeInfo pspec_info = {
-      sizeof (GParamSpecBoxed),  /* instance_size */
-      4,                         /* n_preallocs */
-      param_spec_boxed_init,     /* instance_init */
-      G_TYPE_BOXED,             /* value_type */
-      NULL,                     /* finalize */
-      param_boxed_set_default,  /* value_set_default */
-      param_boxed_validate,     /* value_validate */
-      param_boxed_values_cmp,   /* values_cmp */
+      sizeof (GParamSpecClosure),   /* instance_size */
+      0,                            /* n_preallocs */
+      param_closure_init,          /* instance_init */
+      G_TYPE_CLOSURE,              /* value_type */
+      NULL,                        /* finalize */
+      param_closure_set_default,    /* value_set_default */
+      param_closure_validate,      /* value_validate */
+      param_closure_values_cmp,     /* values_cmp */
     };
-    type = g_param_type_register_static ("GParamBoxed", &pspec_info);
-    g_assert (type == G_TYPE_PARAM_BOXED);
+    type = g_param_type_register_static ("GParamClosure", &pspec_info);
+    g_assert (type == G_TYPE_PARAM_CLOSURE);
   }
-
+  
   /* G_TYPE_PARAM_OBJECT
    */
   {
     static const GParamSpecTypeInfo pspec_info = {
       sizeof (GParamSpecObject), /* instance_size */
       16,                        /* n_preallocs */
-      param_spec_object_init,    /* instance_init */
+      param_object_init,        /* instance_init */
       G_TYPE_OBJECT,            /* value_type */
       NULL,                     /* finalize */
       param_object_set_default,         /* value_set_default */
@@ -1167,79 +1186,6 @@ g_param_spec_types_init (void)   /* sync with gtype.c */
     type = g_param_type_register_static ("GParamObject", &pspec_info);
     g_assert (type == G_TYPE_PARAM_OBJECT);
   }
-
-  /* G_TYPE_PARAM_INTERFACE
-   */
-  {
-    static const GParamSpecTypeInfo pspec_info = {
-      sizeof (GParamSpecInterface),    /* instance_size */
-      4,                               /* n_preallocs */
-      param_spec_interface_init,       /* instance_init */
-      G_TYPE_INTERFACE,                        /* value_type */
-      NULL,                            /* finalize */
-      param_interface_set_default,     /* value_set_default */
-      param_interface_validate,                /* value_validate */
-      param_interface_values_cmp,      /* values_cmp */
-    };
-    type = g_param_type_register_static ("GParamInterface", &pspec_info);
-    g_assert (type == G_TYPE_PARAM_INTERFACE);
-  }
-  
-  g_value_register_exchange_func (G_TYPE_CHAR,    G_TYPE_UCHAR,   value_exch_memcpy);
-  g_value_register_exchange_func (G_TYPE_CHAR,    G_TYPE_BOOLEAN, value_exch_memcpy);
-  g_value_register_exchange_func (G_TYPE_CHAR,    G_TYPE_INT,     value_exch_memcpy);
-  g_value_register_exchange_func (G_TYPE_CHAR,    G_TYPE_UINT,    value_exch_memcpy);
-  g_value_register_exchange_func (G_TYPE_CHAR,    G_TYPE_ENUM,    value_exch_memcpy);
-  g_value_register_exchange_func (G_TYPE_CHAR,    G_TYPE_FLAGS,   value_exch_memcpy); 
-  g_value_register_exchange_func (G_TYPE_UCHAR,   G_TYPE_BOOLEAN, value_exch_memcpy);
-  g_value_register_exchange_func (G_TYPE_UCHAR,   G_TYPE_INT,     value_exch_memcpy);
-  g_value_register_exchange_func (G_TYPE_UCHAR,   G_TYPE_UINT,    value_exch_memcpy);
-  g_value_register_exchange_func (G_TYPE_UCHAR,   G_TYPE_ENUM,    value_exch_memcpy);
-  g_value_register_exchange_func (G_TYPE_UCHAR,   G_TYPE_FLAGS,   value_exch_memcpy); 
-  g_value_register_exchange_func (G_TYPE_BOOLEAN, G_TYPE_INT,     value_exch_memcpy);
-  g_value_register_exchange_func (G_TYPE_BOOLEAN, G_TYPE_UINT,    value_exch_memcpy);
-  g_value_register_exchange_func (G_TYPE_BOOLEAN, G_TYPE_ENUM,    value_exch_memcpy);
-  g_value_register_exchange_func (G_TYPE_BOOLEAN, G_TYPE_FLAGS,   value_exch_memcpy); 
-  g_value_register_exchange_func (G_TYPE_INT,     G_TYPE_UINT,    value_exch_memcpy); 
-  g_value_register_exchange_func (G_TYPE_INT,     G_TYPE_ENUM,    value_exch_memcpy); 
-  g_value_register_exchange_func (G_TYPE_INT,     G_TYPE_FLAGS,   value_exch_memcpy); 
-  g_value_register_exchange_func (G_TYPE_UINT,    G_TYPE_ENUM,    value_exch_memcpy); 
-  g_value_register_exchange_func (G_TYPE_UINT,    G_TYPE_FLAGS,   value_exch_memcpy); 
-  g_value_register_exchange_func (G_TYPE_LONG,    G_TYPE_CHAR,    value_exch_long_int); 
-  g_value_register_exchange_func (G_TYPE_LONG,    G_TYPE_UCHAR,   value_exch_long_uint); 
-  g_value_register_exchange_func (G_TYPE_LONG,    G_TYPE_BOOLEAN, value_exch_long_int); 
-  g_value_register_exchange_func (G_TYPE_LONG,    G_TYPE_INT,     value_exch_long_int); 
-  g_value_register_exchange_func (G_TYPE_LONG,    G_TYPE_UINT,    value_exch_long_uint); 
-  g_value_register_exchange_func (G_TYPE_LONG,    G_TYPE_ULONG,   value_exch_memcpy); 
-  g_value_register_exchange_func (G_TYPE_LONG,    G_TYPE_ENUM,    value_exch_long_int); 
-  g_value_register_exchange_func (G_TYPE_LONG,    G_TYPE_FLAGS,   value_exch_long_uint); 
-  g_value_register_exchange_func (G_TYPE_ULONG,   G_TYPE_CHAR,    value_exch_ulong_int); 
-  g_value_register_exchange_func (G_TYPE_ULONG,   G_TYPE_UCHAR,   value_exch_ulong_uint); 
-  g_value_register_exchange_func (G_TYPE_ULONG,   G_TYPE_BOOLEAN, value_exch_ulong_int); 
-  g_value_register_exchange_func (G_TYPE_ULONG,   G_TYPE_INT,     value_exch_ulong_int); 
-  g_value_register_exchange_func (G_TYPE_ULONG,   G_TYPE_UINT,    value_exch_ulong_uint); 
-  g_value_register_exchange_func (G_TYPE_ULONG,   G_TYPE_ENUM,    value_exch_ulong_int); 
-  g_value_register_exchange_func (G_TYPE_ULONG,   G_TYPE_FLAGS,   value_exch_ulong_uint); 
-  g_value_register_exchange_func (G_TYPE_ENUM,    G_TYPE_FLAGS,   value_exch_memcpy); 
-  g_value_register_exchange_func (G_TYPE_FLOAT,   G_TYPE_CHAR,    value_exch_float_int); 
-  g_value_register_exchange_func (G_TYPE_FLOAT,   G_TYPE_UCHAR,   value_exch_float_uint); 
-  g_value_register_exchange_func (G_TYPE_FLOAT,   G_TYPE_BOOLEAN, value_exch_float_int); 
-  g_value_register_exchange_func (G_TYPE_FLOAT,   G_TYPE_INT,     value_exch_float_int); 
-  g_value_register_exchange_func (G_TYPE_FLOAT,   G_TYPE_UINT,    value_exch_float_uint); 
-  g_value_register_exchange_func (G_TYPE_FLOAT,   G_TYPE_LONG,    value_exch_float_long); 
-  g_value_register_exchange_func (G_TYPE_FLOAT,   G_TYPE_ULONG,   value_exch_float_ulong);
-  g_value_register_exchange_func (G_TYPE_FLOAT,   G_TYPE_ENUM,    value_exch_float_int); 
-  g_value_register_exchange_func (G_TYPE_FLOAT,   G_TYPE_FLAGS,   value_exch_float_uint); 
-  g_value_register_exchange_func (G_TYPE_DOUBLE,  G_TYPE_CHAR,    value_exch_double_int); 
-  g_value_register_exchange_func (G_TYPE_DOUBLE,  G_TYPE_UCHAR,   value_exch_double_uint); 
-  g_value_register_exchange_func (G_TYPE_DOUBLE,  G_TYPE_BOOLEAN, value_exch_double_int); 
-  g_value_register_exchange_func (G_TYPE_DOUBLE,  G_TYPE_INT,     value_exch_double_int); 
-  g_value_register_exchange_func (G_TYPE_DOUBLE,  G_TYPE_UINT,    value_exch_double_uint); 
-  g_value_register_exchange_func (G_TYPE_DOUBLE,  G_TYPE_LONG,    value_exch_double_long);
-  g_value_register_exchange_func (G_TYPE_DOUBLE,  G_TYPE_ULONG,   value_exch_double_ulong);
-  g_value_register_exchange_func (G_TYPE_DOUBLE,  G_TYPE_ENUM,    value_exch_double_int); 
-  g_value_register_exchange_func (G_TYPE_DOUBLE,  G_TYPE_FLAGS,   value_exch_double_uint);
-  g_value_register_exchange_func (G_TYPE_DOUBLE,  G_TYPE_FLOAT,   value_exch_double_float); 
 }
 
 
@@ -1552,6 +1498,28 @@ g_param_spec_param (const gchar *name,
   return G_PARAM_SPEC (pspec);
 }
 
+GParamSpec*
+g_param_spec_boxed (const gchar *name,
+                   const gchar *nick,
+                   const gchar *blurb,
+                   GType        boxed_type,
+                   GParamFlags  flags)
+{
+  GParamSpecBoxed *bspec;
+  
+  g_return_val_if_fail (G_TYPE_IS_BOXED (boxed_type), NULL);
+  g_return_val_if_fail (G_TYPE_IS_DERIVED (boxed_type), NULL);
+  
+  bspec = g_param_spec_internal (G_TYPE_PARAM_BOXED,
+                                name,
+                                nick,
+                                blurb,
+                                flags);
+  G_PARAM_SPEC (bspec)->value_type = boxed_type;
+  
+  return G_PARAM_SPEC (bspec);
+}
+
 GParamSpec*
 g_param_spec_pointer (const gchar *name,
                      const gchar *nick,
@@ -1569,41 +1537,45 @@ g_param_spec_pointer (const gchar *name,
 }
 
 GParamSpec*
-g_param_spec_ccallback (const gchar *name,
-                       const gchar *nick,
-                       const gchar *blurb,
-                       GParamFlags  flags)
+g_param_spec_value_array (const gchar *name,
+                         const gchar *nick,
+                         const gchar *blurb,
+                         GParamSpec  *element_spec,
+                         GParamFlags  flags)
 {
-  GParamSpecCCallback *cspec;
+  GParamSpecValueArray *aspec;
+  
+  if (element_spec)
+    g_return_val_if_fail (G_IS_PARAM_SPEC (element_spec), NULL);
   
-  cspec = g_param_spec_internal (G_TYPE_PARAM_CCALLBACK,
+  aspec = g_param_spec_internal (G_TYPE_PARAM_VALUE_ARRAY,
                                 name,
                                 nick,
                                 blurb,
                                 flags);
-  return G_PARAM_SPEC (cspec);
+  if (element_spec)
+    {
+      aspec->element_spec = g_param_spec_ref (element_spec);
+      g_param_spec_sink (element_spec);
+    }
+
+  return G_PARAM_SPEC (aspec);
 }
 
 GParamSpec*
-g_param_spec_boxed (const gchar *name,
-                   const gchar *nick,
-                   const gchar *blurb,
-                   GType        boxed_type,
-                   GParamFlags  flags)
+g_param_spec_closure (const gchar *name,
+                     const gchar *nick,
+                     const gchar *blurb,
+                     GParamFlags  flags)
 {
-  GParamSpecBoxed *bspec;
-  
-  g_return_val_if_fail (G_TYPE_IS_BOXED (boxed_type), NULL);
-  g_return_val_if_fail (G_TYPE_IS_DERIVED (boxed_type), NULL);
+  GParamSpecClosure *cspec;
   
-  bspec = g_param_spec_internal (G_TYPE_PARAM_BOXED,
+  cspec = g_param_spec_internal (G_TYPE_PARAM_CLOSURE,
                                 name,
                                 nick,
                                 blurb,
                                 flags);
-  G_PARAM_SPEC (bspec)->value_type = boxed_type;
-  
-  return G_PARAM_SPEC (bspec);
+  return G_PARAM_SPEC (cspec);
 }
 
 GParamSpec*
@@ -1626,25 +1598,3 @@ g_param_spec_object (const gchar *name,
   
   return G_PARAM_SPEC (ospec);
 }
-
-GParamSpec*
-g_param_spec_interface (const gchar *name,
-                       const gchar *nick,
-                       const gchar *blurb,
-                       GType        interface_type,
-                       GParamFlags  flags)
-{
-  GParamSpecInterface *ispec;
-  
-  g_return_val_if_fail (G_TYPE_IS_INTERFACE (interface_type), NULL);
-  
-  ispec = g_param_spec_internal (G_TYPE_PARAM_INTERFACE,
-                                name,
-                                nick,
-                                blurb,
-                                flags);
-  G_PARAM_SPEC (ispec)->value_type = interface_type;
-  
-  return G_PARAM_SPEC (ispec);
-}
-
index a3dc72394c2fe97e141976efff63ee1fcc8354c2..1072a4b95248f543a811f95e44a3cd7ced0fda5b 100644 (file)
@@ -1,5 +1,5 @@
 /* GObject - GLib Type, Object, Parameter and Signal Library
- * Copyright (C) 1997, 1998, 1999, 2000 Tim Janik and Red Hat, Inc.
+ * Copyright (C) 1997-1999, 2000-2001 Tim Janik and Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -34,63 +34,63 @@ extern "C" {
 
 
 /* --- type macros --- */
-#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_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_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_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_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_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_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_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_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_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_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_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_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_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_IS_PARAM_SPEC_CCALLBACK(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_CCALLBACK))
-#define G_PARAM_SPEC_CCALLBACK(pspec)    (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_CCALLBACK, GParamSpecCCallback))
-#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_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))
-#define G_IS_PARAM_SPEC_INTERFACE(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_INTERFACE))
-#define G_PARAM_SPEC_INTERFACE(pspec)    (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_INTERFACE, GParamSpecInterface))
+#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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_IS_PARAM_SPEC_CLOSURE(pspec)     (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_CLOSURE))
+#define G_PARAM_SPEC_CLOSURE(pspec)        (G_TYPE_CHECK_INSTANCE_CAST ((pspec), G_TYPE_PARAM_CLOSURE, GParamSpecClosure))
+#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))
 
 
 /* --- typedefs & structures --- */
-typedef struct _GParamSpecChar      GParamSpecChar;
-typedef struct _GParamSpecUChar     GParamSpecUChar;
-typedef struct _GParamSpecBoolean   GParamSpecBoolean;
-typedef struct _GParamSpecInt       GParamSpecInt;
-typedef struct _GParamSpecUInt      GParamSpecUInt;
-typedef struct _GParamSpecLong      GParamSpecLong;
-typedef struct _GParamSpecULong     GParamSpecULong;
-typedef struct _GParamSpecEnum      GParamSpecEnum;
-typedef struct _GParamSpecFlags     GParamSpecFlags;
-typedef struct _GParamSpecFloat     GParamSpecFloat;
-typedef struct _GParamSpecDouble    GParamSpecDouble;
-typedef struct _GParamSpecString    GParamSpecString;
-typedef struct _GParamSpecParam     GParamSpecParam;
-typedef struct _GParamSpecPointer   GParamSpecPointer;
-typedef struct _GParamSpecCCallback GParamSpecCCallback;
-typedef struct _GParamSpecBoxed     GParamSpecBoxed;
-typedef struct _GParamSpecObject    GParamSpecObject;
-typedef struct _GParamSpecInterface GParamSpecInterface;
+typedef struct _GParamSpecChar       GParamSpecChar;
+typedef struct _GParamSpecUChar      GParamSpecUChar;
+typedef struct _GParamSpecBoolean    GParamSpecBoolean;
+typedef struct _GParamSpecInt        GParamSpecInt;
+typedef struct _GParamSpecUInt       GParamSpecUInt;
+typedef struct _GParamSpecLong       GParamSpecLong;
+typedef struct _GParamSpecULong      GParamSpecULong;
+typedef struct _GParamSpecEnum       GParamSpecEnum;
+typedef struct _GParamSpecFlags      GParamSpecFlags;
+typedef struct _GParamSpecFloat      GParamSpecFloat;
+typedef struct _GParamSpecDouble     GParamSpecDouble;
+typedef struct _GParamSpecString     GParamSpecString;
+typedef struct _GParamSpecParam      GParamSpecParam;
+typedef struct _GParamSpecBoxed      GParamSpecBoxed;
+typedef struct _GParamSpecPointer    GParamSpecPointer;
+typedef struct _GParamSpecValueArray GParamSpecValueArray;
+typedef struct _GParamSpecClosure    GParamSpecClosure;
+typedef struct _GParamSpecObject     GParamSpecObject;
 struct _GParamSpecChar
 {
   GParamSpec    parent_instance;
@@ -192,140 +192,142 @@ struct _GParamSpecParam
 {
   GParamSpec    parent_instance;
 };
-struct _GParamSpecPointer
+struct _GParamSpecBoxed
 {
   GParamSpec    parent_instance;
 };
-struct _GParamSpecCCallback
+struct _GParamSpecPointer
 {
   GParamSpec    parent_instance;
 };
-struct _GParamSpecBoxed
+struct _GParamSpecValueArray
 {
   GParamSpec    parent_instance;
+  GParamSpec   *element_spec;
+  guint                fixed_n_elements;
 };
-struct _GParamSpecObject
+struct _GParamSpecClosure
 {
   GParamSpec    parent_instance;
 };
-struct _GParamSpecInterface
+struct _GParamSpecObject
 {
   GParamSpec    parent_instance;
 };
 
 
 /* --- GParamSpec prototypes --- */
-GParamSpec*     g_param_spec_char       (const gchar    *name,
-                                         const gchar    *nick,
-                                         const gchar    *blurb,
-                                         gint8           minimum,
-                                         gint8           maximum,
-                                         gint8           default_value,
-                                         GParamFlags     flags);
-GParamSpec*     g_param_spec_uchar      (const gchar    *name,
-                                         const gchar    *nick,
-                                         const gchar    *blurb,
-                                         guint8          minimum,
-                                         guint8          maximum,
-                                         guint8          default_value,
-                                         GParamFlags     flags);
-GParamSpec*     g_param_spec_boolean    (const gchar    *name,
-                                         const gchar    *nick,
-                                         const gchar    *blurb,
-                                         gboolean        default_value,
-                                         GParamFlags     flags);
-GParamSpec*     g_param_spec_int        (const gchar    *name,
-                                         const gchar    *nick,
-                                         const gchar    *blurb,
-                                         gint            minimum,
-                                         gint            maximum,
-                                         gint            default_value,
-                                         GParamFlags     flags);
-GParamSpec*     g_param_spec_uint       (const gchar    *name,
-                                         const gchar    *nick,
-                                         const gchar    *blurb,
-                                         guint           minimum,
-                                         guint           maximum,
-                                         guint           default_value,
-                                         GParamFlags     flags);
-GParamSpec*     g_param_spec_long       (const gchar    *name,
-                                         const gchar    *nick,
-                                         const gchar    *blurb,
-                                         glong           minimum,
-                                         glong           maximum,
-                                         glong           default_value,
-                                         GParamFlags     flags);
-GParamSpec*     g_param_spec_ulong      (const gchar    *name,
-                                         const gchar    *nick,
-                                         const gchar    *blurb,
-                                         gulong          minimum,
-                                         gulong          maximum,
-                                         gulong          default_value,
-                                         GParamFlags     flags);
-GParamSpec*     g_param_spec_enum       (const gchar    *name,
-                                         const gchar    *nick,
-                                         const gchar    *blurb,
-                                         GType           enum_type,
-                                         gint            default_value,
-                                         GParamFlags     flags);
-GParamSpec*     g_param_spec_flags      (const gchar    *name,
-                                         const gchar    *nick,
-                                         const gchar    *blurb,
-                                         GType           flags_type,
-                                         guint           default_value,
-                                         GParamFlags     flags);
-GParamSpec*     g_param_spec_float      (const gchar    *name,
-                                         const gchar    *nick,
-                                         const gchar    *blurb,
-                                         gfloat          minimum,
-                                         gfloat          maximum,
-                                         gfloat          default_value,
-                                         GParamFlags     flags);
-GParamSpec*     g_param_spec_double     (const gchar    *name,
-                                         const gchar    *nick,
-                                         const gchar    *blurb,
-                                         gdouble         minimum,
-                                         gdouble         maximum,
-                                         gdouble         default_value,
-                                         GParamFlags     flags);
-GParamSpec*     g_param_spec_string     (const gchar    *name,
-                                         const gchar    *nick,
-                                         const gchar    *blurb,
-                                         const gchar    *default_value,
-                                         GParamFlags     flags);
-GParamSpec*     g_param_spec_string_c   (const gchar    *name,
-                                         const gchar    *nick,
-                                         const gchar    *blurb,
-                                         const gchar    *default_value,
-                                         GParamFlags     flags);
-GParamSpec*     g_param_spec_param      (const gchar    *name,
-                                         const gchar    *nick,
-                                         const gchar    *blurb,
-                                         GType           param_type,
-                                         GParamFlags     flags);
-GParamSpec*     g_param_spec_pointer    (const gchar    *name,
-                                         const gchar    *nick,
-                                         const gchar    *blurb,
-                                         GParamFlags     flags);
-GParamSpec*     g_param_spec_ccallback  (const gchar    *name,
-                                         const gchar    *nick,
-                                         const gchar    *blurb,
-                                         GParamFlags     flags);
-GParamSpec*     g_param_spec_boxed      (const gchar    *name,
-                                         const gchar    *nick,
-                                         const gchar    *blurb,
-                                         GType           boxed_type,
-                                         GParamFlags     flags);
-GParamSpec*     g_param_spec_object     (const gchar    *name,
-                                         const gchar    *nick,
-                                         const gchar    *blurb,
-                                         GType           object_type,
-                                         GParamFlags     flags);
-GParamSpec*     g_param_spec_interface  (const gchar    *name,
-                                         const gchar    *nick,
-                                         const gchar    *blurb,
-                                         GType           object_type,
-                                         GParamFlags     flags);
+GParamSpec*    g_param_spec_char        (const gchar    *name,
+                                         const gchar    *nick,
+                                         const gchar    *blurb,
+                                         gint8           minimum,
+                                         gint8           maximum,
+                                         gint8           default_value,
+                                         GParamFlags     flags);
+GParamSpec*    g_param_spec_uchar       (const gchar    *name,
+                                         const gchar    *nick,
+                                         const gchar    *blurb,
+                                         guint8          minimum,
+                                         guint8          maximum,
+                                         guint8          default_value,
+                                         GParamFlags     flags);
+GParamSpec*    g_param_spec_boolean     (const gchar    *name,
+                                         const gchar    *nick,
+                                         const gchar    *blurb,
+                                         gboolean        default_value,
+                                         GParamFlags     flags);
+GParamSpec*    g_param_spec_int         (const gchar    *name,
+                                         const gchar    *nick,
+                                         const gchar    *blurb,
+                                         gint            minimum,
+                                         gint            maximum,
+                                         gint            default_value,
+                                         GParamFlags     flags);
+GParamSpec*    g_param_spec_uint        (const gchar    *name,
+                                         const gchar    *nick,
+                                         const gchar    *blurb,
+                                         guint           minimum,
+                                         guint           maximum,
+                                         guint           default_value,
+                                         GParamFlags     flags);
+GParamSpec*    g_param_spec_long        (const gchar    *name,
+                                         const gchar    *nick,
+                                         const gchar    *blurb,
+                                         glong           minimum,
+                                         glong           maximum,
+                                         glong           default_value,
+                                         GParamFlags     flags);
+GParamSpec*    g_param_spec_ulong       (const gchar    *name,
+                                         const gchar    *nick,
+                                         const gchar    *blurb,
+                                         gulong          minimum,
+                                         gulong          maximum,
+                                         gulong          default_value,
+                                         GParamFlags     flags);
+GParamSpec*    g_param_spec_enum        (const gchar    *name,
+                                         const gchar    *nick,
+                                         const gchar    *blurb,
+                                         GType           enum_type,
+                                         gint            default_value,
+                                         GParamFlags     flags);
+GParamSpec*    g_param_spec_flags       (const gchar    *name,
+                                         const gchar    *nick,
+                                         const gchar    *blurb,
+                                         GType           flags_type,
+                                         guint           default_value,
+                                         GParamFlags     flags);
+GParamSpec*    g_param_spec_float       (const gchar    *name,
+                                         const gchar    *nick,
+                                         const gchar    *blurb,
+                                         gfloat          minimum,
+                                         gfloat          maximum,
+                                         gfloat          default_value,
+                                         GParamFlags     flags);
+GParamSpec*    g_param_spec_double      (const gchar    *name,
+                                         const gchar    *nick,
+                                         const gchar    *blurb,
+                                         gdouble         minimum,
+                                         gdouble         maximum,
+                                         gdouble         default_value,
+                                         GParamFlags     flags);
+GParamSpec*    g_param_spec_string      (const gchar    *name,
+                                         const gchar    *nick,
+                                         const gchar    *blurb,
+                                         const gchar    *default_value,
+                                         GParamFlags     flags);
+GParamSpec*    g_param_spec_string_c    (const gchar    *name,
+                                         const gchar    *nick,
+                                         const gchar    *blurb,
+                                         const gchar    *default_value,
+                                         GParamFlags     flags);
+GParamSpec*    g_param_spec_param       (const gchar    *name,
+                                         const gchar    *nick,
+                                         const gchar    *blurb,
+                                         GType           param_type,
+                                         GParamFlags     flags);
+GParamSpec*    g_param_spec_boxed       (const gchar    *name,
+                                         const gchar    *nick,
+                                         const gchar    *blurb,
+                                         GType           boxed_type,
+                                         GParamFlags     flags);
+GParamSpec*    g_param_spec_pointer     (const gchar    *name,
+                                         const gchar    *nick,
+                                         const gchar    *blurb,
+                                         GParamFlags     flags);
+GParamSpec*    g_param_spec_value_array (const gchar    *name,
+                                         const gchar    *nick,
+                                         const gchar    *blurb,
+                                         GParamSpec     *element_spec,
+                                         GParamFlags     flags);
+GParamSpec*    g_param_spec_closure     (const gchar    *name,
+                                         const gchar    *nick,
+                                         const gchar    *blurb,
+                                         GParamFlags     flags);
+GParamSpec*    g_param_spec_object      (const gchar    *name,
+                                         const gchar    *nick,
+                                         const gchar    *blurb,
+                                         GType           object_type,
+                                         GParamFlags     flags);
 
 
 #ifdef __cplusplus
index c86533dd6310637c29e9a135a63d826c00619ecd..5cad4bb7ae70275e9760fdad842b53c79798c43b 100644 (file)
@@ -1,5 +1,5 @@
 /* GObject - GLib Type, Object, Parameter and Signal Library
- * Copyright (C) 2000 Red Hat, Inc.
+ * Copyright (C) 2000-2001 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -774,6 +774,7 @@ g_signal_parse_name (const gchar *detailed_signal,
                     GQuark      *detail_p,
                     gboolean     force_detail_quark)
 {
+  SignalNode *node;
   GQuark detail = 0;
   guint signal_id;
   
@@ -783,18 +784,18 @@ g_signal_parse_name (const gchar *detailed_signal,
   G_LOCK (g_signal_mutex);
   signal_id = signal_parse_name (detailed_signal, itype, &detail, force_detail_quark);
   G_UNLOCK (g_signal_mutex);
-  
-  if (signal_id)
-    {
-      if (signal_id_p)
-       *signal_id_p = signal_id;
-      if (detail_p)
-       *detail_p = detail;
-      
-      return TRUE;
-    }
-  else
+
+  node = signal_id ? LOOKUP_SIGNAL_NODE (signal_id) : NULL;
+  if (!node || node->destroyed ||
+      (detail && !(node->flags & G_SIGNAL_DETAILED)))
     return FALSE;
+
+  if (signal_id_p)
+    *signal_id_p = signal_id;
+  if (detail_p)
+    *detail_p = detail;
+  
+  return TRUE;
 }
 
 guint
@@ -1000,9 +1001,7 @@ g_signal_newv (const gchar       *signal_name,
       return 0;
     }
   for (i = 0; i < n_params; i++)
-    if (!G_TYPE_IS_VALUE (param_types[i] & ~G_SIGNAL_TYPE_STATIC_SCOPE) ||
-       (param_types[i] & ~G_SIGNAL_TYPE_STATIC_SCOPE) == G_TYPE_ENUM ||
-       (param_types[i] & ~G_SIGNAL_TYPE_STATIC_SCOPE) == G_TYPE_FLAGS) /* FIXME: kludge */
+    if (!G_TYPE_IS_VALUE (param_types[i] & ~G_SIGNAL_TYPE_STATIC_SCOPE))
       {
        g_warning (G_STRLOC ": parameter %d of type `%s' for signal \"%s::%s\" is not a value type",
                   i + 1, g_type_name (param_types[i] & ~G_SIGNAL_TYPE_STATIC_SCOPE), g_type_name (itype), name);
@@ -1537,7 +1536,7 @@ g_signal_emitv (const GValue *instance_and_params,
   guint i;
   
   g_return_if_fail (instance_and_params != NULL);
-  instance = g_value_get_as_pointer (instance_and_params);
+  instance = g_value_peek_pointer (instance_and_params);
   g_return_if_fail (G_TYPE_CHECK_INSTANCE (instance));
   g_return_if_fail (signal_id > 0);
 
@@ -1559,7 +1558,7 @@ g_signal_emitv (const GValue *instance_and_params,
       return;
     }
   for (i = 0; i < node->n_params; i++)
-    if (!G_VALUE_HOLDS (param_values + i, node->param_types[i] & ~G_SIGNAL_TYPE_STATIC_SCOPE))
+    if (!G_TYPE_CHECK_VALUE_TYPE (param_values + i, node->param_types[i] & ~G_SIGNAL_TYPE_STATIC_SCOPE))
       {
        g_critical ("%s: value for `%s' parameter %u for signal \"%s\" is of type `%s'",
                    G_STRLOC,
@@ -1581,7 +1580,7 @@ g_signal_emitv (const GValue *instance_and_params,
          G_UNLOCK (g_signal_mutex);
          return;
        }
-      else if (!node->accumulator && !G_VALUE_HOLDS (return_value, node->return_type & ~G_SIGNAL_TYPE_STATIC_SCOPE))
+      else if (!node->accumulator && !G_TYPE_CHECK_VALUE_TYPE (return_value, node->return_type & ~G_SIGNAL_TYPE_STATIC_SCOPE))
        {
          g_critical ("%s: return value `%s' for signal \"%s\" is of type `%s'",
                      G_STRLOC,
@@ -2045,4 +2044,7 @@ signal_emit_R (SignalNode   *node,
 
 /* --- compile standard marshallers --- */
 #include       "gvaluetypes.h"
+#include       "gobject.h"
+#include       "genums.h"
+#include       "gboxed.h"
 #include        "gmarshal.c"
index a967d2eae6e5eba20233c8671ef7ef654e20b6a0..a1434da7ad91d253d38ae2e4a13ea87db3d2c0ae 100644 (file)
@@ -1,5 +1,5 @@
 /* GObject - GLib Type, Object, Parameter and Signal Library
- * Copyright (C) 2000 Red Hat, Inc.
+ * Copyright (C) 2000-2001 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
index bcbed34f834c1d6a9341611fceb52a045dbe5669..65bdb9cd70ab5ce2e73a641878f23727a9a9d5b3 100644 (file)
@@ -1,5 +1,5 @@
 /* GObject - GLib Type, Object, Parameter and Signal Library
- * Copyright (C) 1998, 1999, 2000 Tim Janik and Red Hat, Inc.
+ * Copyright (C) 1998-1999, 2000-2001 Tim Janik and Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -74,6 +74,16 @@ static GStaticRWLock            type_rw_lock = G_STATIC_RW_LOCK_INIT;
     else \
       g_error ("%s()%s`%s'", _fname, _action, _tname); \
 }G_STMT_END
+#define        g_return_val_if_uninitialized(condition, init_function, return_value) G_STMT_START{     \
+  if (!(condition))                                                                            \
+    {                                                                                          \
+      g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL,                                               \
+            "%s: initialization assertion failed, use %s() prior to this function",            \
+            G_STRLOC, G_STRINGIFY (init_function));                                            \
+      return (return_value);                                                                   \
+    }                                                                                          \
+}G_STMT_END
+
 #ifdef  G_ENABLE_DEBUG
 #define DEBUG_CODE(debug_type, code_block)  G_STMT_START {    \
     if (_g_type_debug_flags & G_TYPE_DEBUG_ ## debug_type) \
@@ -87,7 +97,7 @@ static GStaticRWLock            type_rw_lock = G_STATIC_RW_LOCK_INIT;
                                    G_TYPE_FLAG_INSTANTIATABLE | \
                                    G_TYPE_FLAG_DERIVABLE | \
                                    G_TYPE_FLAG_DEEP_DERIVABLE)
-#define        TYPE_FLAG_MASK             (G_TYPE_FLAG_ABSTRACT)
+#define        TYPE_FLAG_MASK             (G_TYPE_FLAG_ABSTRACT | G_TYPE_FLAG_VALUE_ABSTRACT)
 
 
 /* --- typedefs --- */
@@ -811,7 +821,15 @@ type_data_make_W (TypeNode              *node,
        }
     }
   if (value_table)
-    vtable_size = sizeof (GTypeValueTable);
+    {
+      /* need to setup vtable_size since we have to allocate it with data in one chunk */
+      vtable_size = sizeof (GTypeValueTable);
+      if (value_table->collect_format)
+       vtable_size += strlen (value_table->collect_format);
+      if (value_table->lcopy_format)
+       vtable_size += strlen (value_table->lcopy_format);
+      vtable_size += 2;
+    }
   
   if (node->is_instantiatable) /* carefull, is_instantiatable is also is_classed */
     {
@@ -868,9 +886,26 @@ type_data_make_W (TypeNode              *node,
   
   if (vtable_size)
     {
+      gchar *p;
+
+      /* we allocate the vtable and its strings together with the type data, so
+       * children can take over their parent's vtable pointer, and we don't
+       * need to worry freeing it or not when the child data is destroyed
+       */
       *vtable = *value_table;
-      vtable->collect_format = g_strdup (value_table->collect_format ? value_table->collect_format : "");
-      vtable->lcopy_format = g_strdup (value_table->lcopy_format ? value_table->lcopy_format : "");
+      p = G_STRUCT_MEMBER_P (vtable, sizeof (*vtable));
+      p[0] = 0;
+      vtable->collect_format = p;
+      if (value_table->collect_format)
+       {
+         strcat (p, value_table->collect_format);
+         p += strlen (value_table->collect_format);
+       }
+      p++;
+      p[0] = 0;
+      vtable->lcopy_format = p;
+      if (value_table->lcopy_format)
+       strcat  (p, value_table->lcopy_format);
     }
   node->data->common.value_table = vtable;
   
@@ -1323,10 +1358,6 @@ type_data_finalize_class_U (TypeNode  *node,
   
   g_assert (cdata->class && cdata->common.ref_count == 0);
   
-  g_message ("finalizing %sClass `%s'",
-            type_descriptive_name_U (G_TYPE_FUNDAMENTAL (NODE_TYPE (node))),
-            type_descriptive_name_U (NODE_TYPE (node)));
-  
   if (cdata->class_finalize)
     cdata->class_finalize (class, (gpointer) cdata->class_data);
   
@@ -1415,11 +1446,9 @@ type_data_last_unref_Wm (GType    type,
       else
        node->data = NULL;
 
-      if (tdata->common.value_table)
-       {
-         g_free (tdata->common.value_table->collect_format);
-         g_free (tdata->common.value_table->lcopy_format);
-       }
+      /* freeing tdata->common.value_table and its contents is taking care of
+       * by allocating it in one chunk with tdata
+       */
       g_free (tdata);
       
       if (ptype)
@@ -1487,6 +1516,7 @@ g_type_register_fundamental (GType                       type_id,
   GTypeFundamentalInfo *node_finfo;
   TypeNode *node;
   
+  g_return_val_if_uninitialized (static_last_fundamental_id, g_type_init, 0);
   g_return_val_if_fail (type_id > 0, 0);
   g_return_val_if_fail (type_name != NULL, 0);
   g_return_val_if_fail (info != NULL, 0);
@@ -1539,6 +1569,7 @@ g_type_register_static (GType            parent_type,
   TypeNode *pnode, *node;
   GType type = 0;
   
+  g_return_val_if_uninitialized (static_last_fundamental_id, g_type_init, 0);
   g_return_val_if_fail (parent_type > 0, 0);
   g_return_val_if_fail (type_name != NULL, 0);
   g_return_val_if_fail (info != NULL, 0);
@@ -1578,6 +1609,7 @@ g_type_register_dynamic (GType        parent_type,
   TypeNode *pnode, *node;
   GType type;
   
+  g_return_val_if_uninitialized (static_last_fundamental_id, g_type_init, 0);
   g_return_val_if_fail (parent_type > 0, 0);
   g_return_val_if_fail (type_name != NULL, 0);
   g_return_val_if_fail (plugin != NULL, 0);
@@ -1800,27 +1832,13 @@ g_type_interface_peek (gpointer instance_class,
   return vtable;
 }
 
-GTypeValueTable*
-g_type_value_table_peek (GType type)
-{
-  TypeNode *node;
-  GTypeValueTable *vtable = NULL;
-  
-  G_READ_LOCK (&type_rw_lock);
-  node = lookup_type_node_L (type);
-  if (node && node->data && node->data->common.ref_count > 0 &&
-      node->data->common.value_table->value_init)
-    vtable = node->data->common.value_table;
-  G_READ_UNLOCK (&type_rw_lock);
-  
-  return vtable;
-}
-
 G_CONST_RETURN gchar*
 g_type_name (GType type)
 {
   TypeNode *node;
   
+  g_return_val_if_uninitialized (static_last_fundamental_id, g_type_init, NULL);
+
   G_READ_LOCK (&type_rw_lock);
   node = lookup_type_node_L (type);
   G_READ_UNLOCK (&type_rw_lock);
@@ -2140,7 +2158,7 @@ type_add_flags_W (TypeNode  *node,
   g_return_if_fail ((flags & ~TYPE_FLAG_MASK) == 0);
   g_return_if_fail (node != NULL);
   
-  if ((flags & G_TYPE_FLAG_ABSTRACT) && node->is_classed && node->data && node->data->class.class)
+  if ((flags & TYPE_FLAG_MASK) && node->is_classed && node->data && node->data->class.class)
     g_warning ("tagging type `%s' as abstract after class initialization", NODE_NAME (node));
   dflags = GPOINTER_TO_UINT (type_get_qdata_L (node, static_quark_type_flags));
   dflags |= flags;
@@ -2261,39 +2279,6 @@ g_type_class_is_a (GTypeClass *type_class,
          g_type_is_a (type_class->g_type, is_a_type));
 }
 
-gboolean
-g_type_value_is_a (GValue *value,
-                  GType   type)
-{
-  TypeNode *node;
-  
-  if (!value)
-    return FALSE;
-  
-  G_READ_LOCK (&type_rw_lock);
-  node = lookup_type_node_L (value->g_type);
-#if 0
-  if (!G_TYPE_IS_FUNDAMENTAL (value->g_type) && !node || !node->data)
-    node = lookup_type_node_L (G_TYPE_FUNDAMENTAL (value->g_type));
-#endif
-  if (!node || !node->data || node->data->common.ref_count < 1 ||
-      !node->data->common.value_table->value_init)
-    {
-      G_READ_UNLOCK (&type_rw_lock);
-      
-      return FALSE;
-    }
-  G_READ_UNLOCK (&type_rw_lock);
-  
-  return g_type_is_a (value->g_type, type);
-}
-
-gboolean
-g_type_check_value (GValue *value)
-{
-  return value && g_type_value_is_a (value, value->g_type);
-}
-
 GTypeInstance*
 g_type_check_instance_cast (GTypeInstance *type_instance,
                            GType          iface_type)
@@ -2392,6 +2377,57 @@ g_type_check_instance (GTypeInstance *type_instance)
   return TRUE;
 }
 
+static inline gboolean
+type_check_is_value_type_U (GType type)
+{
+  GTypeFlags tflags = G_TYPE_FLAG_VALUE_ABSTRACT;
+  TypeNode *node;
+
+  G_READ_LOCK (&type_rw_lock);
+  node = lookup_type_node_L (type);
+  if (node && node->data && node->data->common.ref_count > 0 &&
+      node->data->common.value_table->value_init)
+    tflags = GPOINTER_TO_UINT (type_get_qdata_L (node, static_quark_type_flags));
+  G_READ_UNLOCK (&type_rw_lock);
+
+  return !(tflags & G_TYPE_FLAG_VALUE_ABSTRACT);
+}
+
+gboolean
+g_type_check_is_value_type (GType type)
+{
+  return type_check_is_value_type_U (type);
+}
+
+gboolean
+g_type_check_value (GValue *value)
+{
+  return value && type_check_is_value_type_U (value->g_type);
+}
+
+gboolean
+g_type_check_value_holds (GValue *value,
+                         GType   type)
+{
+  return value && type_check_is_value_type_U (value->g_type) && g_type_is_a (value->g_type, type);
+}
+
+GTypeValueTable*
+g_type_value_table_peek (GType type)
+{
+  TypeNode *node;
+  GTypeValueTable *vtable = NULL;
+  
+  G_READ_LOCK (&type_rw_lock);
+  node = lookup_type_node_L (type);
+  if (node && node->data && node->data->common.ref_count > 0 &&
+      node->data->common.value_table->value_init)
+    vtable = node->data->common.value_table;
+  G_READ_UNLOCK (&type_rw_lock);
+  
+  return vtable;
+}
+
 
 /* --- foreign prototypes --- */
 extern void    g_value_types_init      (void); /* sync with gvaluetypes.c */
@@ -2400,6 +2436,7 @@ extern void     g_param_type_init       (void);   /* sync with gparam.c */
 extern void     g_boxed_type_init       (void);        /* sync with gboxed.c */
 extern void     g_object_type_init      (void);        /* sync with gobject.c */
 extern void    g_param_spec_types_init (void); /* sync with gparamspecs.c */
+extern void    g_value_transforms_init (void); /* sync with gvaluetransform.c */
 extern void    g_signal_init           (void); /* sync with gsignal.c */
 
 
@@ -2483,13 +2520,13 @@ g_type_init (GTypeDebugFlags debug_flags)
    */
   g_enum_types_init ();
   
-  /* G_TYPE_PARAM
+  /* G_TYPE_BOXED
    */
-  g_param_type_init ();
+  g_boxed_type_init ();
   
   /* G_TYPE_PARAM
    */
-  g_boxed_type_init ();
+  g_param_type_init ();
   
   /* G_TYPE_OBJECT
    */
@@ -2499,6 +2536,10 @@ g_type_init (GTypeDebugFlags debug_flags)
    */
   g_param_spec_types_init ();
   
+  /* Value Transformations
+   */
+  g_value_transforms_init ();
+
   /* Signal system
    */
   g_signal_init ();
index b251c391971d270616ea0a78cc261e0b32d749ed..81e9e3c90c372e1acbf6bc418f4acc41dad19331 100644 (file)
@@ -1,5 +1,5 @@
 /* GObject - GLib Type, Object, Parameter and Signal Library
- * Copyright (C) 1998, 1999, 2000 Tim Janik and Red Hat, Inc.
+ * Copyright (C) 1998-1999, 2000-2001 Tim Janik and Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -59,45 +59,39 @@ typedef enum    /*< skip >*/
   G_TYPE_FLOAT,
   G_TYPE_DOUBLE,
   G_TYPE_STRING,
-  G_TYPE_PARAM,
-  G_TYPE_BOXED,
   G_TYPE_POINTER,
-  G_TYPE_CCALLBACK,
+  G_TYPE_BOXED,
+  G_TYPE_PARAM,
   G_TYPE_OBJECT,
 
-  /* the following reserved ids should vanish soon */
-  G_TYPE_GTK_SIGNAL,
-
   /* reserved fundamental type ids,
    * mail gtk-devel-list@redhat.com for reservations
    */
-  G_TYPE_BSE_PROCEDURE,
-  G_TYPE_BSE_TIME,
-  G_TYPE_BSE_NOTE,
-  G_TYPE_BSE_DOTS,
-  G_TYPE_GLE_GOBJECT,
-
-  G_TYPE_LAST_RESERVED_FUNDAMENTAL,
+  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_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_ENUM             = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 8),
-  G_TYPE_PARAM_FLAGS            = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 9),
-  G_TYPE_PARAM_FLOAT            = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 10),
-  G_TYPE_PARAM_DOUBLE           = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 11),
-  G_TYPE_PARAM_STRING           = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 12),
-  G_TYPE_PARAM_PARAM            = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 13),
-  G_TYPE_PARAM_POINTER          = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 14),
-  G_TYPE_PARAM_CCALLBACK        = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 15),
-  G_TYPE_PARAM_BOXED            = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 16),
-  G_TYPE_PARAM_OBJECT           = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 17),
-  G_TYPE_PARAM_INTERFACE        = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 18)
+  G_TYPE_CLOSURE               = G_TYPE_DERIVE_ID (G_TYPE_BOXED, 1),
+  G_TYPE_VALUE_ARRAY           = G_TYPE_DERIVE_ID (G_TYPE_BOXED, 2),
+  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_ENUM            = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 8),
+  G_TYPE_PARAM_FLAGS           = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 9),
+  G_TYPE_PARAM_FLOAT           = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 10),
+  G_TYPE_PARAM_DOUBLE          = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 11),
+  G_TYPE_PARAM_STRING          = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 12),
+  G_TYPE_PARAM_PARAM           = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 13),
+  G_TYPE_PARAM_BOXED           = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 14),
+  G_TYPE_PARAM_POINTER         = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 15),
+  G_TYPE_PARAM_VALUE_ARRAY     = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 16),
+  G_TYPE_PARAM_CLOSURE         = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 17),
+  G_TYPE_PARAM_OBJECT          = G_TYPE_DERIVE_ID (G_TYPE_PARAM, 18)
 } GTypeFundamentals;
 
 
@@ -111,8 +105,10 @@ typedef enum    /*< skip >*/
 #define G_TYPE_IS_DERIVABLE(type)               (g_type_check_flags ((type), G_TYPE_FLAG_DERIVABLE))
 #define G_TYPE_IS_DEEP_DERIVABLE(type)          (g_type_check_flags ((type), G_TYPE_FLAG_DEEP_DERIVABLE))
 #define G_TYPE_IS_ABSTRACT(type)                (g_type_check_flags ((type), G_TYPE_FLAG_ABSTRACT))
+#define G_TYPE_IS_VALUE_ABSTRACT(type)          (g_type_check_flags ((type), G_TYPE_FLAG_VALUE_ABSTRACT))
 #define G_TYPE_IS_PARAM(type)                   (G_TYPE_FUNDAMENTAL (type) == G_TYPE_PARAM)
-#define G_TYPE_IS_VALUE_TYPE(type)              (g_type_value_table_peek (type) != NULL)
+#define G_TYPE_IS_VALUE_TYPE(type)              (g_type_check_is_value_type (type))
+#define G_TYPE_HAS_VALUE_TABLE(type)            (g_type_value_table_peek (type) != NULL)
 
 
 /* Typedefs
@@ -152,7 +148,6 @@ struct _GTypeInterface
 
 /* Casts, checks and accessors for structured types
  * usage of these macros is reserved to type implementations only
- * 
  */
 /*< protected >*/
 #define G_TYPE_CHECK_INSTANCE(instance)                                (_G_TYPE_CHI ((GTypeInstance*) (instance)))
@@ -163,7 +158,7 @@ struct _GTypeInterface
 #define G_TYPE_CHECK_CLASS_CAST(g_class, g_type, c_type)        (_G_TYPE_CCC ((g_class), (g_type), c_type))
 #define G_TYPE_CHECK_CLASS_TYPE(g_class, g_type)                (_G_TYPE_CCT ((g_class), (g_type)))
 #define G_TYPE_CHECK_VALUE(value)                              (_G_TYPE_CHV ((value)))
-#define G_TYPE_CHECK_VALUE_TYPE(value, g_type)                 (_G_TYPE_CVT ((value), (g_type)))
+#define G_TYPE_CHECK_VALUE_TYPE(value, g_type)                 (_G_TYPE_CVH ((value), (g_type)))
 #define G_TYPE_FROM_INSTANCE(instance)                          (G_TYPE_FROM_CLASS (((GTypeInstance*) (instance))->g_class))
 #define G_TYPE_FROM_CLASS(g_class)                              (((GTypeClass*) (g_class))->g_type)
 #define G_TYPE_FROM_INTERFACE(g_iface)                          (((GTypeInterface*) (g_iface))->g_type)
@@ -185,8 +180,8 @@ G_CONST_RETURN gchar* g_type_name                    (GType            type);
 GQuark                g_type_qname                   (GType            type);
 GType                 g_type_from_name               (const gchar     *name);
 GType                 g_type_parent                  (GType            type);
-GType                 g_type_next_base               (GType            type,
-                                                     GType            base_type);
+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);
@@ -235,7 +230,8 @@ typedef enum    /*< skip >*/
 } GTypeFundamentalFlags;
 typedef enum    /*< skip >*/
 {
-  G_TYPE_FLAG_ABSTRACT          = (1 << 4)
+  G_TYPE_FLAG_ABSTRACT         = (1 << 4),
+  G_TYPE_FLAG_VALUE_ABSTRACT   = (1 << 5)
 } GTypeFlags;
 struct _GTypeInfo
 {
@@ -335,8 +331,9 @@ GTypeClass*      g_type_check_class_cast        (GTypeClass         *g_class,
                                                 GType               is_a_type);
 gboolean         g_type_class_is_a              (GTypeClass         *g_class,
                                                 GType               is_a_type);
+gboolean        g_type_check_is_value_type     (GType               type);
 gboolean        g_type_check_value             (GValue             *value);
-gboolean        g_type_value_is_a              (GValue             *value,
+gboolean        g_type_check_value_holds       (GValue             *value,
                                                 GType               type);
 GTypeValueTable* g_type_value_table_peek        (GType              type);
 
@@ -354,7 +351,7 @@ GTypeValueTable* g_type_value_table_peek        (GType                   type);
 #define _G_TYPE_CHI(ip)                        (g_type_check_instance ((GTypeInstance*) ip))
 #define _G_TYPE_CIT(ip, gt)             (g_type_instance_is_a ((GTypeInstance*) ip, gt))
 #define _G_TYPE_CCT(cp, gt)             (g_type_class_is_a ((GTypeClass*) cp, gt))
-#define _G_TYPE_CVT(vl, gt)             (g_type_value_is_a ((GValue*) vl, gt))
+#define _G_TYPE_CVH(vl, gt)             (g_type_check_value_holds ((GValue*) vl, gt))
 #define _G_TYPE_CHV(vl)                        (g_type_check_value ((GValue*) vl))
 #define _G_TYPE_IGC(ip, gt, ct)         ((ct*) (((GTypeInstance*) ip)->g_class))
 #define _G_TYPE_IGI(ip, gt, ct)         ((ct*) g_type_interface_peek (((GTypeInstance*) ip)->g_class, gt))
index b7f6856c325feae41d17a231ff5817bb87432e00..70a04d312bf8badb7fe80a416cf9721067f13377 100644 (file)
@@ -1,5 +1,5 @@
 /* GObject - GLib Type, Object, Parameter and Signal Library
- * Copyright (C) 1997, 1998, 1999, 2000 Tim Janik and Red Hat, Inc.
+ * Copyright (C) 1997-1999, 2000-2001 Tim Janik and Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
 
 #include "gvalue.h"
 #include "gvaluecollector.h"
+#include "gbsearcharray.h"
 
 
 /* --- typedefs & structures --- */
-typedef struct
-{
-  GType          value_type1;
-  GType          value_type2;
-  GValueExchange func;
-  GType          first_type;
-} ExchangeEntry;
+typedef struct {
+  GType src_type;
+  GType dest_type;
+  GValueTransform func;
+} TransformEntry;
+
+
+/* --- prototypes --- */
+static gint    transform_entries_cmp   (gconstpointer bsearch_node1,
+                                        gconstpointer bsearch_node2);
 
 
 /* --- variables --- */
-static GHashTable *param_exchange_ht = NULL;
+static GBSearchArray transform_array = {
+  transform_entries_cmp,
+  sizeof (TransformEntry),
+  0, /* no flags */
+  0, NULL,
+};
 
 
 /* --- functions --- */
-void
+static inline void             /* keep this function in sync with gvaluecollector.h and gboxed.c */
+value_meminit (GValue *value,
+              GType   value_type)
+{
+  value->g_type = value_type;
+  memset (value->data, 0, sizeof (value->data));
+}
+
+GValue*
 g_value_init (GValue *value,
              GType   g_type)
 {
-  GTypeValueTable *value_table = g_type_value_table_peek (g_type);
-  
-  g_return_if_fail (value != NULL);
-  g_return_if_fail (G_VALUE_TYPE (value) == 0);
-  
-  if (value_table)
+  /* g_return_val_if_fail (G_TYPE_IS_VALUE (g_type), NULL);    be more elaborate below */
+  g_return_val_if_fail (value != NULL, NULL);
+  /* g_return_val_if_fail (G_VALUE_TYPE (value) == 0, NULL);   be more elaborate below */
+
+  if (G_TYPE_IS_VALUE (g_type) && G_VALUE_TYPE (value) == 0)
     {
-      memset (value, 0, sizeof (*value));
-      value->g_type = g_type;
+      GTypeValueTable *value_table = g_type_value_table_peek (g_type);
+
+      /* setup and init */
+      value_meminit (value, g_type);
       value_table->value_init (value);
     }
-  else
-    g_warning (G_STRLOC ": cannot initialize value of type `%s' which has no GTypeValueTable",
-              g_type_name (g_type));
+  else if (G_VALUE_TYPE (value))
+    g_warning ("%s: cannot initialize GValue with type `%s', the value has already been initialized as `%s'",
+              G_STRLOC,
+              g_type_name (g_type),
+              g_type_name (G_VALUE_TYPE (value)));
+  else /* !G_TYPE_IS_VALUE (g_type) */
+    g_warning ("%s: cannot initialize GValue with type `%s', %s",
+              G_STRLOC,
+              g_type_name (g_type),
+              g_type_value_table_peek (g_type) ?
+              "this type is abstract with regards to GValue use, use a more specific (derived) type" :
+              "this type has no GTypeValueTable implementation");
+  return value;
 }
 
 void
 g_value_copy (const GValue *src_value,
              GValue       *dest_value)
 {
-  GTypeValueTable *value_table;
-  
   g_return_if_fail (G_IS_VALUE (src_value));
   g_return_if_fail (G_IS_VALUE (dest_value));
-  g_return_if_fail (g_type_is_a (G_VALUE_TYPE (src_value), G_VALUE_TYPE (dest_value)));
-  
-  value_table = g_type_value_table_peek (G_VALUE_TYPE (dest_value));
-  if (!value_table)
-    g_return_if_fail (g_type_value_table_peek (G_VALUE_TYPE (dest_value)) != NULL);
+  g_return_if_fail (g_value_type_compatible (G_VALUE_TYPE (src_value), G_VALUE_TYPE (dest_value)));
   
   if (src_value != dest_value)
     {
-      /* make sure dest_value's value is free()d and zero initialized */
-      g_value_reset (dest_value);
-      
+      GType dest_type = G_VALUE_TYPE (dest_value);
+      GTypeValueTable *value_table = g_type_value_table_peek (dest_type);
+
+      /* make sure dest_value's value is free()d */
+      if (value_table->value_free)
+       value_table->value_free (dest_value);
+
+      /* setup and copy */
+      value_meminit (dest_value, dest_type);
       value_table->value_copy (src_value, dest_value);
     }
 }
 
+GValue*
+g_value_reset (GValue *value)
+{
+  GTypeValueTable *value_table;
+  GType g_type;
+  
+  g_return_val_if_fail (G_IS_VALUE (value), NULL);
+  
+  g_type = G_VALUE_TYPE (value);
+  value_table = g_type_value_table_peek (g_type);
+
+  /* make sure value's value is free()d */
+  if (value_table->value_free)
+    value_table->value_free (value);
+
+  /* setup and init */
+  value_meminit (value, g_type);
+  value_table->value_init (value);
+
+  return value;
+}
+
+void
+g_value_unset (GValue *value)
+{
+  GTypeValueTable *value_table;
+  
+  g_return_if_fail (G_IS_VALUE (value));
+
+  value_table = g_type_value_table_peek (G_VALUE_TYPE (value));
+
+  if (value_table->value_free)
+    value_table->value_free (value);
+  memset (value, 0, sizeof (*value));
+}
+
 gboolean
 g_value_fits_pointer (const GValue *value)
 {
@@ -93,22 +157,18 @@ g_value_fits_pointer (const GValue *value)
   g_return_val_if_fail (G_IS_VALUE (value), FALSE);
 
   value_table = g_type_value_table_peek (G_VALUE_TYPE (value));
-  if (!value_table)
-    g_return_val_if_fail (g_type_value_table_peek (G_VALUE_TYPE (value)) != NULL, FALSE);
 
   return value_table->value_peek_pointer != NULL;
 }
 
 gpointer
-g_value_get_as_pointer (const GValue *value)
+g_value_peek_pointer (const GValue *value)
 {
   GTypeValueTable *value_table;
 
   g_return_val_if_fail (G_IS_VALUE (value), NULL);
 
   value_table = g_type_value_table_peek (G_VALUE_TYPE (value));
-  if (!value_table)
-    g_return_val_if_fail (g_type_value_table_peek (G_VALUE_TYPE (value)) != NULL, NULL);
   if (!value_table->value_peek_pointer)
     g_return_val_if_fail (g_value_fits_pointer (value) == TRUE, NULL);
 
@@ -119,231 +179,167 @@ void
 g_value_set_instance (GValue  *value,
                      gpointer instance)
 {
-  g_return_if_fail (G_IS_VALUE (value));
+  GType g_type;
+  GTypeValueTable *value_table;
+  GTypeCValue cvalue;
+  gchar *error_msg;
   
-  g_value_reset (value);
+  g_return_if_fail (G_IS_VALUE (value));
   if (instance)
     {
-      GType g_type = G_VALUE_TYPE (value);
-      GTypeValueTable *value_table = g_type_value_table_peek (g_type);
-      GTypeCValue cvalue = { 0, };
-      gchar *error_msg;
-      
       g_return_if_fail (G_TYPE_CHECK_INSTANCE (instance));
-      g_return_if_fail (g_type_is_a (G_TYPE_FROM_INSTANCE (instance), G_VALUE_TYPE (value)));
-      g_return_if_fail (strcmp (value_table->collect_format, "p") == 0);
-      
-      cvalue.v_pointer = instance;
-      error_msg = value_table->collect_value (value, 1, &cvalue, 0);
-      
-      if (error_msg)
-       {
-         g_warning ("%s: %s", G_STRLOC, error_msg);
-         g_free (error_msg);
-         
-         /* we purposely leak the value here, it might not be
-          * in a sane state if an error condition occoured
-          */
-         memset (value, 0, sizeof (*value));
-         value->g_type = g_type;
-         value_table->value_init (value);
-       }
+      g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (instance), G_VALUE_TYPE (value)));
     }
-}
-
-void
-g_value_unset (GValue *value)
-{
-  GTypeValueTable *value_table = g_type_value_table_peek (G_VALUE_TYPE (value));
-  
-  g_return_if_fail (G_IS_VALUE (value));
-  if (!value_table)
-    g_return_if_fail (g_type_value_table_peek (G_VALUE_TYPE (value)) != NULL);
   
-  if (value_table->value_free)
-    value_table->value_free (value);
-  memset (value, 0, sizeof (*value));
-}
-
-void
-g_value_reset (GValue *value)
-{
-  GTypeValueTable *value_table;
-  GType g_type;
+  g_type = G_VALUE_TYPE (value);
+  value_table = g_type_value_table_peek (g_type);
   
-  g_return_if_fail (G_IS_VALUE (value));
+  g_return_if_fail (strcmp (value_table->collect_format, "p") == 0);
   
-  value_table = g_type_value_table_peek (G_VALUE_TYPE (value));
-  g_type = G_VALUE_TYPE (value);
+  memset (&cvalue, 0, sizeof (cvalue));
+  cvalue.v_pointer = instance;
   
+  /* make sure value's value is free()d */
   if (value_table->value_free)
     value_table->value_free (value);
-  memset (value, 0, sizeof (*value));
-  
-  value->g_type = g_type;
-  value_table->value_init (value);
-}
-
-static gboolean
-exchange_entries_equal (gconstpointer v1,
-                       gconstpointer v2)
-{
-  const ExchangeEntry *entry1 = v1;
-  const ExchangeEntry *entry2 = v2;
-  
-  return (entry1->value_type1 == entry2->value_type1 &&
-         entry1->value_type2 == entry2->value_type2);
-}
 
-static guint
-exchange_entry_hash (gconstpointer key)
-{
-  const ExchangeEntry *entry = key;
-  
-  return entry->value_type1 ^ entry->value_type2;
+  /* setup and collect */
+  value_meminit (value, g_type);
+  error_msg = value_table->collect_value (value, 1, &cvalue, 0);
+  if (error_msg)
+    {
+      g_warning ("%s: %s", G_STRLOC, error_msg);
+      g_free (error_msg);
+      
+      /* we purposely leak the value here, it might not be
+       * in a sane state if an error condition occoured
+       */
+      value_meminit (value, g_type);
+      value_table->value_init (value);
+    }
 }
 
-static void
-value_exchange_memcpy (GValue *value1,
-                      GValue *value2)
+static GValueTransform
+transform_func_lookup (GType src_type,
+                      GType dest_type)
 {
-  GValue tmp_value;
-  
-  memcpy (&tmp_value.data, &value1->data, sizeof (value1->data));
-  memcpy (&value1->data, &value2->data, sizeof (value1->data));
-  memcpy (&value2->data, &tmp_value.data, sizeof (value2->data));
-}
+  TransformEntry entry;
 
-static inline GValueExchange
-exchange_func_lookup (GType     value_type1,
-                     GType     value_type2,
-                     gboolean *need_swap)
-{
-  if (value_type1 == value_type2)
-    return value_exchange_memcpy;
-  else
+  entry.src_type = src_type;
+  do
     {
-      GType type1 = value_type1;
-      
+      entry.dest_type = dest_type;
       do
        {
-         GType type2 = value_type2;
+         TransformEntry *e;
          
-         do
+         e = g_bsearch_array_lookup (&transform_array, &entry);
+         if (e)
            {
-             ExchangeEntry entry, *ret;
-             
-             entry.value_type1 = MIN (type1, type2);
-             entry.value_type2 = MAX (type1, type2);
-             ret = g_hash_table_lookup (param_exchange_ht, &entry);
-             if (ret)
-               {
-                 if (need_swap)
-                   *need_swap = ret->first_type == type2;
-                 
-                 return ret->func;
-               }
-             
-             type2 = g_type_parent (type2);
+             /* need to check that there hasn't been a change in value handling */
+             if (g_type_value_table_peek (entry.dest_type) == g_type_value_table_peek (dest_type) &&
+                 g_type_value_table_peek (entry.src_type) == g_type_value_table_peek (src_type))
+               return e->func;
            }
-         while (type2);
-         
-         type1 = g_type_parent (type1);
+         entry.dest_type = g_type_parent (entry.dest_type);
        }
-      while (type1);
+      while (entry.dest_type);
+      
+      entry.src_type = g_type_parent (entry.src_type);
     }
-  
+  while (entry.src_type);
+
   return NULL;
 }
 
-void
-g_value_register_exchange_func (GType          value_type1,
-                               GType          value_type2,
-                               GValueExchange func)
+static gint
+transform_entries_cmp (gconstpointer bsearch_node1,
+                      gconstpointer bsearch_node2)
 {
-  ExchangeEntry entry;
-  
-  g_return_if_fail (g_type_name (value_type1) != NULL);
-  g_return_if_fail (g_type_name (value_type2) != NULL);
-  g_return_if_fail (func != NULL);
-  
-  entry.value_type1 = MIN (value_type1, value_type2);
-  entry.value_type2 = MAX (value_type1, value_type2);
-  if (param_exchange_ht && g_hash_table_lookup (param_exchange_ht, &entry))
-    g_warning (G_STRLOC ": cannot re-register param value exchange function "
-              "for `%s' and `%s'",
-              g_type_name (value_type1),
-              g_type_name (value_type2));
+  const TransformEntry *e1 = bsearch_node1;
+  const TransformEntry *e2 = bsearch_node2;
+  gint cmp = G_BSEARCH_ARRAY_CMP (e1->src_type, e2->src_type);
+
+  if (cmp)
+    return cmp;
   else
-    {
-      ExchangeEntry *entry = g_new (ExchangeEntry, 1);
-      
-      if (!param_exchange_ht)
-       param_exchange_ht = g_hash_table_new (exchange_entry_hash, exchange_entries_equal);
-      entry->value_type1 = MIN (value_type1, value_type2);
-      entry->value_type2 = MAX (value_type1, value_type2);
-      entry->func = func;
-      entry->first_type = value_type1;
-      g_hash_table_insert (param_exchange_ht, entry, entry);
-    }
+    return G_BSEARCH_ARRAY_CMP (e1->dest_type, e2->dest_type);
+}
+
+void
+g_value_register_transform_func (GType           src_type,
+                                GType           dest_type,
+                                GValueTransform transform_func)
+{
+  TransformEntry entry;
+
+  g_return_if_fail (G_TYPE_HAS_VALUE_TABLE (src_type));
+  g_return_if_fail (G_TYPE_HAS_VALUE_TABLE (dest_type));
+  g_return_if_fail (transform_func != NULL);
+
+  if (transform_func_lookup (src_type, dest_type))
+    g_warning ("reregistering value transformation function (%p) for `%s' to `%s'",
+              transform_func,
+              g_type_name (src_type),
+              g_type_name (dest_type));
+  entry.src_type = src_type;
+  entry.dest_type = dest_type;
+  entry.func = transform_func;
+  g_bsearch_array_insert (&transform_array, &entry, TRUE);
 }
 
 gboolean
-g_value_types_exchangable (GType value_type1,
-                          GType value_type2)
+g_value_type_transformable (GType src_type,
+                           GType dest_type)
 {
-  g_return_val_if_fail (G_TYPE_IS_VALUE (value_type1), FALSE); /* these might bite us, think G_TYPE_ENUM */
-  g_return_val_if_fail (G_TYPE_IS_VALUE (value_type2), FALSE);
-  
-  return exchange_func_lookup (value_type1, value_type2, NULL) != NULL;
+  g_return_val_if_fail (G_TYPE_IS_VALUE (src_type), FALSE);
+  g_return_val_if_fail (G_TYPE_IS_VALUE (dest_type), FALSE);
+
+  return (g_value_type_compatible (src_type, dest_type) ||
+         transform_func_lookup (src_type, dest_type) != NULL);
 }
 
 gboolean
-g_values_exchange (GValue *value1,
-                  GValue *value2)
+g_value_type_compatible (GType src_type,
+                        GType dest_type)
 {
-  g_return_val_if_fail (G_IS_VALUE (value1), FALSE);
-  g_return_val_if_fail (G_IS_VALUE (value2), FALSE);
-  
-  if (value1 != value2)
-    {
-      gboolean need_swap;
-      GValueExchange value_exchange = exchange_func_lookup (G_VALUE_TYPE (value1),
-                                                           G_VALUE_TYPE (value2),
-                                                           &need_swap);
-      if (value_exchange)
-       {
-         if (need_swap)
-           value_exchange (value2, value1);
-         else
-           value_exchange (value1, value2);
-       }
-      
-      return value_exchange != NULL;
-    }
-  
-  return TRUE;
+  g_return_val_if_fail (G_TYPE_IS_VALUE (src_type), FALSE);
+  g_return_val_if_fail (G_TYPE_IS_VALUE (dest_type), FALSE);
+
+  return (g_type_is_a (src_type, dest_type) &&
+         g_type_value_table_peek (dest_type) == g_type_value_table_peek (src_type));
 }
 
 gboolean
-g_value_convert (const GValue *src_value,
-                GValue       *dest_value)
+g_value_transform (const GValue *src_value,
+                  GValue       *dest_value)
 {
-  gboolean success = TRUE;
-  
+  GType dest_type;
+
   g_return_val_if_fail (G_IS_VALUE (src_value), FALSE);
   g_return_val_if_fail (G_IS_VALUE (dest_value), FALSE);
-  
-  if (src_value != dest_value)
+
+  dest_type = G_VALUE_TYPE (dest_value);
+  if (g_value_type_compatible (G_VALUE_TYPE (src_value), dest_type))
     {
-      GValue tmp_value = { 0, };
+      g_value_copy (src_value, dest_value);
       
-      g_value_init (&tmp_value, G_VALUE_TYPE (src_value));
-      g_value_copy (src_value, &tmp_value);
-      
-      success = g_values_exchange (&tmp_value, dest_value);
-      g_value_unset (&tmp_value);
+      return TRUE;
     }
-  
-  return success;
+  else
+    {
+      GValueTransform transform = transform_func_lookup (G_VALUE_TYPE (src_value), dest_type);
+
+      if (transform)
+       {
+         g_value_unset (dest_value);
+         
+         /* setup and transform */
+         value_meminit (dest_value, dest_type);
+         transform (src_value, dest_value);
+         
+         return TRUE;
+       }
+    }
+  return FALSE;
 }
index 54d6498b4de9f91e0f9f720c8eecc36369609ca1..bef28a7779b4c3ad54d314c7341e2f570028c04f 100644 (file)
@@ -1,5 +1,5 @@
 /* GObject - GLib Type, Object, Parameter and Signal Library
- * Copyright (C) 1997, 1998, 1999, 2000 Tim Janik and Red Hat, Inc.
+ * Copyright (C) 1997-1999, 2000-2001 Tim Janik and Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -32,14 +32,16 @@ extern "C" {
 /* --- type macros --- */
 #define        G_TYPE_IS_VALUE(type)           (g_type_value_table_peek (type) != NULL)
 #define        G_IS_VALUE(value)               (G_TYPE_CHECK_VALUE (value))
-#define        G_VALUE_HOLDS(value, g_type)    (G_TYPE_CHECK_VALUE_TYPE ((value), (g_type)))
 #define        G_VALUE_TYPE(value)             (((GValue*) (value))->g_type)
 #define        G_VALUE_TYPE_NAME(value)        (g_type_name (G_VALUE_TYPE (value)))
+#define G_VALUE_HOLDS(value,type)      (G_TYPE_CHECK_VALUE_TYPE ((value), (type)))
 
 
 /* --- typedefs & structures --- */
-typedef void (*GValueExchange) (GValue *value1,
-                               GValue  *value2);
+typedef void (*GValueExchange)  (GValue              *value1,
+                                GValue       *value2);
+typedef void (*GValueTransform) (const GValue *src_value,
+                                GValue       *dest_value);
 struct _GValue
 {
   /*< private >*/
@@ -59,28 +61,33 @@ struct _GValue
 
 
 /* --- prototypes --- */
-void            g_value_init           (GValue       *value,
+GValue*         g_value_init           (GValue       *value,
                                         GType         g_type);
 void            g_value_copy           (const GValue *src_value,
                                         GValue       *dest_value);
 gboolean       g_value_convert         (const GValue *src_value,
                                         GValue       *dest_value);
-void            g_value_reset          (GValue       *value);
+GValue*         g_value_reset          (GValue       *value);
 void            g_value_unset          (GValue       *value);
-gboolean       g_value_fits_pointer    (const GValue *value);
-gpointer       g_value_get_as_pointer  (const GValue *value);
 void           g_value_set_instance    (GValue       *value,
                                         gpointer      instance);
 
 
+/* --- private --- */
+gboolean       g_value_fits_pointer    (const GValue *value);
+gpointer       g_value_peek_pointer    (const GValue *value);
+
+
 /* --- implementation details --- */
-gboolean g_values_exchange             (GValue       *value1,
-                                        GValue       *value2);
-gboolean g_value_types_exchangable     (GType         value_type1,
-                                        GType         value_type2);
-void     g_value_register_exchange_func        (GType         value_type1,
-                                        GType         value_type2,
-                                        GValueExchange func);
+gboolean g_value_type_compatible       (GType           src_type,
+                                        GType           dest_type);
+gboolean g_value_type_transformable    (GType           src_type,
+                                        GType           dest_type);
+gboolean g_value_transform             (const GValue   *src_value,
+                                        GValue         *dest_value);
+void   g_value_register_transform_func (GType           src_type,
+                                        GType           dest_type,
+                                        GValueTransform transform_func);
 #define G_VALUE_NOCOPY_CONTENTS                (1 << 27)
 
 
diff --git a/gobject/gvaluearray.c b/gobject/gvaluearray.c
new file mode 100644 (file)
index 0000000..30bc6b9
--- /dev/null
@@ -0,0 +1,184 @@
+/* GObject - GLib Type, Object, Parameter and Signal Library
+ * Copyright (C) 2001 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * MT safe
+ */
+
+#include       "gvaluearray.h"
+#include       <string.h>
+#include       <stdlib.h>      /* qsort() */
+
+
+
+/* --- functions --- */
+GValue*
+g_value_array_get_nth (GValueArray *value_array,
+                      guint        index)
+{
+  g_return_val_if_fail (value_array != NULL, NULL);
+  g_return_val_if_fail (index < value_array->n_values, NULL);
+
+  return value_array->values + index;
+}
+
+GValueArray*
+g_value_array_new (guint n_prealloced)
+{
+  GValueArray *value_array = g_new0 (GValueArray, 1);
+
+  value_array->n_values = n_prealloced;
+  value_array->values = g_renew (GValue, value_array->values, value_array->n_values);
+  memset (value_array->values, 0, value_array->n_values * sizeof (value_array->values[0]));
+
+  return value_array;
+}
+
+void
+g_value_array_free (GValueArray *value_array)
+{
+  guint i;
+
+  g_return_if_fail (value_array != NULL);
+
+  for (i = 0; i < value_array->n_values; i++)
+    {
+      GValue *value = value_array->values + i;
+
+      if (G_VALUE_TYPE (value) != 0) /* we allow unset values in the array */
+       g_value_unset (value);
+    }
+  g_free (value_array->values);
+  g_free (value_array);
+}
+
+GValueArray*
+g_value_array_copy (const GValueArray *value_array)
+{
+  GValueArray *new_array;
+  guint i;
+
+  g_return_val_if_fail (value_array != NULL, NULL);
+
+  new_array = g_new0 (GValueArray, 1);
+  new_array->n_values = value_array->n_values;
+  new_array->values = g_renew (GValue, new_array->values, new_array->n_values);
+  memset (new_array->values, 0, new_array->n_values * sizeof (new_array->values[0]));
+  for (i = 0; i < new_array->n_values; i++)
+    if (G_VALUE_TYPE (value_array->values + i) != 0)
+      {
+       GValue *value = new_array->values + i;
+       
+       g_value_init (value, G_VALUE_TYPE (value_array->values + i));
+       g_value_copy (value_array->values + i, value);
+      }
+  return new_array;
+}
+
+GValueArray*
+g_value_array_prepend (GValueArray  *value_array,
+                      const GValue *value)
+{
+  g_return_val_if_fail (value_array != NULL, NULL);
+
+  return g_value_array_insert (value_array, 0, value);
+}
+
+GValueArray*
+g_value_array_append (GValueArray  *value_array,
+                     const GValue *value)
+{
+  g_return_val_if_fail (value_array != NULL, NULL);
+
+  return g_value_array_insert (value_array, value_array->n_values, value);
+}
+
+GValueArray*
+g_value_array_insert (GValueArray  *value_array,
+                     guint         index,
+                     const GValue *value)
+{
+  guint i;
+
+  g_return_val_if_fail (value_array != NULL, NULL);
+  g_return_val_if_fail (index <= value_array->n_values, value_array);
+
+  /* we support NULL for "value" as a shortcut for an unset value */
+
+  i = value_array->n_values++;
+  value_array->values = g_renew (GValue, value_array->values, value_array->n_values);
+  if (index + 1 < value_array->n_values)
+    g_memmove (value_array->values + index + 1, value_array->values + index,
+              (i - index) * sizeof (value_array->values[0]));
+  memset (value_array->values + index, 0, sizeof (value_array->values[0]));
+  if (value)
+    {
+      g_value_init (value_array->values + index, G_VALUE_TYPE (value));
+      g_value_copy (value, value_array->values + index);
+    }
+  return value_array;
+}
+
+GValueArray*
+g_value_array_remove (GValueArray *value_array,
+                     guint        index)
+{
+  g_return_val_if_fail (value_array != NULL, NULL);
+  g_return_val_if_fail (index < value_array->n_values, value_array);
+
+  if (G_VALUE_TYPE (value_array->values + index) != 0)
+    g_value_unset (value_array->values + index);
+  value_array->n_values--;
+  if (index < value_array->n_values)
+    g_memmove (value_array->values + index, value_array->values + index + 1,
+              (value_array->n_values - index) * sizeof (value_array->values[0]));
+  value_array->values = g_renew (GValue, value_array->values, value_array->n_values);
+
+  return value_array;
+}
+
+GValueArray*
+g_value_array_sort (GValueArray *value_array,
+                   GCompareFunc compare_func)
+{
+  g_return_val_if_fail (compare_func != NULL, NULL);
+
+  if (value_array->n_values)
+    qsort (value_array->values,
+          value_array->n_values,
+          sizeof (value_array->values[0]),
+          compare_func);
+  return value_array;
+}
+
+GValueArray*
+g_value_array_sort_with_data (GValueArray     *value_array,
+                             GCompareDataFunc compare_func,
+                             gpointer         user_data)
+{
+  g_return_val_if_fail (value_array != NULL, NULL);
+  g_return_val_if_fail (compare_func != NULL, NULL);
+
+  if (value_array->n_values)
+    g_qsort_with_data (value_array->values,
+                      value_array->n_values,
+                      sizeof (value_array->values[0]),
+                      compare_func, user_data);
+  return value_array;
+}
diff --git a/gobject/gvaluearray.h b/gobject/gvaluearray.h
new file mode 100644 (file)
index 0000000..21fcfbd
--- /dev/null
@@ -0,0 +1,69 @@
+/* GObject - GLib Type, Object, Parameter and Signal Library
+ * Copyright (C) 2001 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * gvaluearray.h: GLib array type holding GValues
+ */
+#ifndef __G_VALUE_ARRAY_H__
+#define __G_VALUE_ARRAY_H__
+
+
+#include       <gobject/gvalue.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/* --- typedefs & structs --- */
+typedef struct _GValueArray GValueArray;
+struct _GValueArray
+{
+  guint   n_values;
+  GValue *values;
+};
+
+
+/* --- prototypes --- */
+GValue*                g_value_array_get_nth        (GValueArray       *value_array,
+                                             guint              index);
+GValueArray*   g_value_array_new            (guint              n_prealloced);
+void           g_value_array_free           (GValueArray       *value_array);
+GValueArray*   g_value_array_copy           (const GValueArray *value_array);
+GValueArray*   g_value_array_prepend        (GValueArray       *value_array,
+                                             const GValue      *value);
+GValueArray*   g_value_array_append         (GValueArray       *value_array,
+                                             const GValue      *value);
+GValueArray*   g_value_array_insert         (GValueArray       *value_array,
+                                             guint              index,
+                                             const GValue      *value);
+GValueArray*   g_value_array_remove         (GValueArray       *value_array,
+                                             guint              index);
+GValueArray*   g_value_array_sort           (GValueArray       *value_array,
+                                             GCompareFunc       compare_func);
+GValueArray*   g_value_array_sort_with_data (GValueArray       *value_array,
+                                             GCompareDataFunc   compare_func,
+                                             gpointer           user_data);
+
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __G_VALUE_ARRAY_H__ */
index b34a21a7aec370767969ad20d109ff5c875d5295..55b613d817bd4d39119226d5ed3ad0d43fa11c05 100644 (file)
@@ -1,5 +1,5 @@
 /* GObject - GLib Type, Object, Parameter and Signal Library
- * Copyright (C) 1998, 1999, 2000 Tim Janik and Red Hat, Inc.
+ * Copyright (C) 1998-1999, 2000-2001 Tim Janik and Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -66,12 +66,16 @@ union _GTypeCValue
 G_STMT_START {                                                                         \
   GValue *_value = (value);                                                            \
   guint _flags = (flags);                                                              \
-  GTypeValueTable *_vtable = g_type_value_table_peek (G_VALUE_TYPE (_value));          \
+  GType _value_type = G_VALUE_TYPE (_value);                                           \
+  GTypeValueTable *_vtable = g_type_value_table_peek (_value_type);                    \
   gchar *_collect_format = _vtable->collect_format;                                    \
   GTypeCValue _cvalues[G_VALUE_COLLECT_FORMAT_MAX_LENGTH] = { { 0, }, };               \
   guint _n_values = 0;                                                                 \
                                                                                         \
-  g_value_reset (_value);                                                              \
+  if (_vtable->value_free)                                                             \
+    _vtable->value_free (_value);                                                      \
+  _value->g_type = _value_type;                /* value_meminit() from gvalue.c */             \
+  memset (_value->data, 0, sizeof (_value->data));                                     \
   while (*_collect_format)                                                             \
     {                                                                                  \
       GTypeCValue *_cvalue = _cvalues + _n_values++;                                   \
@@ -108,7 +112,8 @@ G_STMT_START {                                                                              \
 G_STMT_START {                                                                         \
   GValue *_value = (value);                                                            \
   guint _flags = (flags);                                                              \
-  GTypeValueTable *_vtable = g_type_value_table_peek (G_VALUE_TYPE (_value));          \
+  GType _value_type = G_VALUE_TYPE (_value);                                           \
+  GTypeValueTable *_vtable = g_type_value_table_peek (_value_type);                    \
   gchar *_lcopy_format = _vtable->lcopy_format;                                                \
   GTypeCValue _cvalues[G_VALUE_COLLECT_FORMAT_MAX_LENGTH] = { { 0, }, };               \
   guint _n_values = 0;                                                                 \
diff --git a/gobject/gvaluetransform.c b/gobject/gvaluetransform.c
new file mode 100644 (file)
index 0000000..065f31e
--- /dev/null
@@ -0,0 +1,339 @@
+/* GObject - GLib Type, Object, Parameter and Signal Library
+ * Copyright (C) 2001 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#include       "gvalue.h"
+#include       "genums.h"
+
+
+/* same type transforms
+ */
+static void
+value_transform_memcpy_data0 (const GValue *src_value,
+                             GValue       *dest_value)
+{
+  memcpy (&dest_value->data[0], &src_value->data[0], sizeof (src_value->data[0]));
+}
+#define        value_transform_int_int         value_transform_memcpy_data0
+#define        value_transform_uint_uint       value_transform_memcpy_data0
+#define        value_transform_long_long       value_transform_memcpy_data0
+#define        value_transform_ulong_ulong     value_transform_memcpy_data0
+#define        value_transform_float_float     value_transform_memcpy_data0
+#define        value_transform_double_double   value_transform_memcpy_data0
+
+
+/* numeric casts
+ */
+#define        DEFINE_CAST(func_name, from_member, ctype, to_member)                   \
+    static void                                                                        \
+    value_transform_##func_name (const GValue *src_value,                      \
+                                GValue       *dest_value)                      \
+    {                                                                          \
+      ctype c_value = src_value->data[0].##from_member;                                \
+      dest_value->data[0].##to_member = c_value;                               \
+    }
+DEFINE_CAST (int_s8,           v_int,    gint8,   v_int);
+DEFINE_CAST (int_u8,           v_int,    guint8,  v_uint);
+DEFINE_CAST (int_uint,         v_int,    guint,   v_uint);
+DEFINE_CAST (int_long,         v_int,    glong,   v_long);
+DEFINE_CAST (int_ulong,                v_int,    gulong,  v_ulong);
+DEFINE_CAST (int_float,                v_int,    gfloat,  v_float);
+DEFINE_CAST (int_double,       v_int,    gdouble, v_double);
+DEFINE_CAST (uint_s8,          v_uint,   gint8,   v_int);
+DEFINE_CAST (uint_u8,          v_uint,   guint8,  v_uint);
+DEFINE_CAST (uint_int,         v_uint,   gint,    v_int);
+DEFINE_CAST (uint_long,                v_uint,   glong,   v_long);
+DEFINE_CAST (uint_ulong,       v_uint,   gulong,  v_ulong);
+DEFINE_CAST (uint_float,       v_uint,   gfloat,  v_float);
+DEFINE_CAST (uint_double,      v_uint,   gdouble, v_double);
+DEFINE_CAST (long_s8,          v_long,   gint8,   v_int);
+DEFINE_CAST (long_u8,          v_long,   guint8,  v_uint);
+DEFINE_CAST (long_int,         v_long,   gint,    v_int);
+DEFINE_CAST (long_uint,                v_long,   guint,   v_uint);
+DEFINE_CAST (long_ulong,       v_long,   gulong,  v_ulong);
+DEFINE_CAST (long_float,       v_long,   gfloat,  v_float);
+DEFINE_CAST (long_double,      v_long,   gdouble, v_double);
+DEFINE_CAST (ulong_s8,         v_ulong,  gint8,   v_int);
+DEFINE_CAST (ulong_u8,         v_ulong,  guint8,  v_uint);
+DEFINE_CAST (ulong_int,                v_ulong,  gint,    v_int);
+DEFINE_CAST (ulong_uint,       v_ulong,  guint,   v_uint);
+DEFINE_CAST (ulong_long,       v_ulong,  glong,   v_long);
+DEFINE_CAST (ulong_float,      v_ulong,  gfloat,  v_float);
+DEFINE_CAST (ulong_double,     v_ulong,  gdouble, v_double);
+DEFINE_CAST (float_s8,         v_float,  gint8,   v_int);
+DEFINE_CAST (float_u8,         v_float,  guint8,  v_uint);
+DEFINE_CAST (float_int,                v_float,  gint,    v_int);
+DEFINE_CAST (float_uint,       v_float,  guint,   v_uint);
+DEFINE_CAST (float_long,       v_float,  glong,   v_long);
+DEFINE_CAST (float_ulong,      v_float,  gulong,  v_ulong);
+DEFINE_CAST (float_double,     v_float,  gdouble, v_double);
+DEFINE_CAST (double_s8,                v_double, gint8,   v_int);
+DEFINE_CAST (double_u8,                v_double, guint8,  v_uint);
+DEFINE_CAST (double_int,       v_double, gint,    v_int);
+DEFINE_CAST (double_uint,      v_double, guint,   v_uint);
+DEFINE_CAST (double_long,      v_double, glong,   v_long);
+DEFINE_CAST (double_ulong,     v_double, gulong,  v_ulong);
+DEFINE_CAST (double_float,     v_double, gfloat,  v_float);
+
+
+/* boolean assignments
+ */
+#define        DEFINE_BOOL_CHECK(func_name, from_member)                               \
+    static void                                                                        \
+    value_transform_##func_name (const GValue *src_value,                      \
+                                GValue       *dest_value)                      \
+    {                                                                          \
+      dest_value->data[0].v_int = src_value->data[0].##from_member != 0;       \
+    }
+DEFINE_BOOL_CHECK (int_bool,   v_int);
+DEFINE_BOOL_CHECK (uint_bool,  v_uint);
+DEFINE_BOOL_CHECK (long_bool,  v_long);
+DEFINE_BOOL_CHECK (ulong_bool, v_uint);
+
+
+/* string printouts
+ */
+#define        DEFINE_SPRINTF(func_name, from_member, format)                          \
+    static void                                                                        \
+    value_transform_##func_name (const GValue *src_value,                      \
+                                GValue       *dest_value)                      \
+    {                                                                          \
+      dest_value->data[0].v_pointer =                                          \
+        g_strdup_printf ((format), src_value->data[0].##from_member);          \
+    }
+DEFINE_SPRINTF (int_string,    v_int,    "%d");
+DEFINE_SPRINTF (uint_string,   v_uint,   "%u");
+DEFINE_SPRINTF (long_string,   v_long,   "%ld");
+DEFINE_SPRINTF (ulong_string,  v_ulong,  "%lu");
+DEFINE_SPRINTF (float_string,  v_float,  "%f");
+DEFINE_SPRINTF (double_string, v_double, "%f");
+
+
+/* special cases
+ */
+static void
+value_transform_bool_string (const GValue *src_value,
+                            GValue       *dest_value)
+{
+  dest_value->data[0].v_pointer = g_strdup_printf ("%s",
+                                                  src_value->data[0].v_int ?
+                                                  "TRUE" : "FALSE");
+}
+static void
+value_transform_string_string (const GValue *src_value,
+                              GValue       *dest_value)
+{
+  dest_value->data[0].v_pointer = g_strdup (src_value->data[0].v_pointer);
+}
+static void
+value_transform_enum_string (const GValue *src_value,
+                            GValue       *dest_value)
+{
+  GEnumClass *class = g_type_class_ref (G_VALUE_TYPE (src_value));
+  GEnumValue *enum_value = g_enum_get_value (class, src_value->data[0].v_int);
+
+  if (enum_value)
+    dest_value->data[0].v_pointer = g_strdup (enum_value->value_name);
+  else
+    dest_value->data[0].v_pointer = g_strdup_printf ("%d", src_value->data[0].v_int);
+
+  g_type_class_unref (class);
+}
+static void
+value_transform_flags_string (const GValue *src_value,
+                             GValue       *dest_value)
+{
+  GFlagsClass *class = g_type_class_ref (G_VALUE_TYPE (src_value));
+  GFlagsValue *flags_value = g_flags_get_first_value (class, src_value->data[0].v_uint);
+
+  if (flags_value)
+    {
+      GString *gstring = g_string_new ("");
+      guint v_flags = src_value->data[0].v_uint;
+      
+      do
+       {
+         v_flags &= ~flags_value->value;
+         
+         if (gstring->str[0])
+           g_string_append (gstring, " | ");
+         g_string_append (gstring, flags_value->value_name);
+         flags_value = g_flags_get_first_value (class, v_flags);
+       }
+      while (flags_value);
+
+      if (v_flags)
+       dest_value->data[0].v_pointer = g_strdup_printf ("%s | %u",
+                                                        gstring->str,
+                                                        v_flags);
+      else
+       dest_value->data[0].v_pointer = g_strdup (gstring->str);
+      g_string_free (gstring, TRUE);
+    }
+  else
+    dest_value->data[0].v_pointer = g_strdup_printf ("%u", src_value->data[0].v_uint);
+
+  g_type_class_unref (class);
+}
+
+
+/* registration
+ */
+void
+g_value_transforms_init (void)         /* sync with gtype.c */
+{
+  /* some transformations are a bit questionable,
+   * we currently skip those
+   */
+#define        SKIP____register_transform_func(type1,type2,transform_func)     /* skip questionable transforms */
+
+  /* numeric types (plus to string) */
+  g_value_register_transform_func (G_TYPE_CHAR,                G_TYPE_CHAR,            value_transform_int_int);
+  g_value_register_transform_func (G_TYPE_CHAR,                G_TYPE_UCHAR,           value_transform_int_u8);
+  g_value_register_transform_func (G_TYPE_CHAR,                G_TYPE_BOOLEAN,         value_transform_int_bool);
+  g_value_register_transform_func (G_TYPE_CHAR,                G_TYPE_INT,             value_transform_int_int);
+  g_value_register_transform_func (G_TYPE_CHAR,                G_TYPE_UINT,            value_transform_int_uint);
+  g_value_register_transform_func (G_TYPE_CHAR,                G_TYPE_LONG,            value_transform_int_long);
+  g_value_register_transform_func (G_TYPE_CHAR,                G_TYPE_ULONG,           value_transform_int_ulong);
+  g_value_register_transform_func (G_TYPE_CHAR,                G_TYPE_ENUM,            value_transform_int_int);
+  g_value_register_transform_func (G_TYPE_CHAR,                G_TYPE_FLAGS,           value_transform_int_uint);
+  g_value_register_transform_func (G_TYPE_CHAR,                G_TYPE_FLOAT,           value_transform_int_float);
+  g_value_register_transform_func (G_TYPE_CHAR,                G_TYPE_DOUBLE,          value_transform_int_double);
+  g_value_register_transform_func (G_TYPE_CHAR,                G_TYPE_STRING,          value_transform_int_string);
+  g_value_register_transform_func (G_TYPE_UCHAR,       G_TYPE_CHAR,            value_transform_uint_s8);
+  g_value_register_transform_func (G_TYPE_UCHAR,       G_TYPE_UCHAR,           value_transform_uint_uint);
+  g_value_register_transform_func (G_TYPE_UCHAR,       G_TYPE_BOOLEAN,         value_transform_uint_bool);
+  g_value_register_transform_func (G_TYPE_UCHAR,       G_TYPE_INT,             value_transform_uint_int);
+  g_value_register_transform_func (G_TYPE_UCHAR,       G_TYPE_UINT,            value_transform_uint_uint);
+  g_value_register_transform_func (G_TYPE_UCHAR,       G_TYPE_LONG,            value_transform_uint_long);
+  g_value_register_transform_func (G_TYPE_UCHAR,       G_TYPE_ULONG,           value_transform_uint_ulong);
+  g_value_register_transform_func (G_TYPE_UCHAR,       G_TYPE_ENUM,            value_transform_uint_int);
+  g_value_register_transform_func (G_TYPE_UCHAR,       G_TYPE_FLAGS,           value_transform_uint_uint);
+  g_value_register_transform_func (G_TYPE_UCHAR,       G_TYPE_FLOAT,           value_transform_uint_float);
+  g_value_register_transform_func (G_TYPE_UCHAR,       G_TYPE_DOUBLE,          value_transform_uint_double);
+  g_value_register_transform_func (G_TYPE_UCHAR,       G_TYPE_STRING,          value_transform_uint_string);
+  g_value_register_transform_func (G_TYPE_BOOLEAN,     G_TYPE_CHAR,            value_transform_int_s8);
+  g_value_register_transform_func (G_TYPE_BOOLEAN,     G_TYPE_UCHAR,           value_transform_int_u8);
+  g_value_register_transform_func (G_TYPE_BOOLEAN,     G_TYPE_BOOLEAN,         value_transform_int_int);
+  g_value_register_transform_func (G_TYPE_BOOLEAN,     G_TYPE_INT,             value_transform_int_int);
+  g_value_register_transform_func (G_TYPE_BOOLEAN,     G_TYPE_UINT,            value_transform_int_uint);
+  g_value_register_transform_func (G_TYPE_BOOLEAN,     G_TYPE_LONG,            value_transform_int_long);
+  g_value_register_transform_func (G_TYPE_BOOLEAN,     G_TYPE_ULONG,           value_transform_int_ulong);
+  g_value_register_transform_func (G_TYPE_BOOLEAN,     G_TYPE_ENUM,            value_transform_int_int);
+  g_value_register_transform_func (G_TYPE_BOOLEAN,     G_TYPE_FLAGS,           value_transform_int_uint);
+  SKIP____register_transform_func (G_TYPE_BOOLEAN,     G_TYPE_FLOAT,           value_transform_int_float);
+  SKIP____register_transform_func (G_TYPE_BOOLEAN,     G_TYPE_DOUBLE,          value_transform_int_double);
+  g_value_register_transform_func (G_TYPE_BOOLEAN,     G_TYPE_STRING,          value_transform_bool_string);
+  g_value_register_transform_func (G_TYPE_INT,         G_TYPE_CHAR,            value_transform_int_s8);
+  g_value_register_transform_func (G_TYPE_INT,         G_TYPE_UCHAR,           value_transform_int_u8);
+  g_value_register_transform_func (G_TYPE_INT,         G_TYPE_BOOLEAN,         value_transform_int_bool);
+  g_value_register_transform_func (G_TYPE_INT,         G_TYPE_INT,             value_transform_int_int);
+  g_value_register_transform_func (G_TYPE_INT,         G_TYPE_UINT,            value_transform_int_uint);
+  g_value_register_transform_func (G_TYPE_INT,         G_TYPE_LONG,            value_transform_int_long);
+  g_value_register_transform_func (G_TYPE_INT,         G_TYPE_ULONG,           value_transform_int_ulong);
+  g_value_register_transform_func (G_TYPE_INT,         G_TYPE_ENUM,            value_transform_int_int);
+  g_value_register_transform_func (G_TYPE_INT,         G_TYPE_FLAGS,           value_transform_int_uint);
+  g_value_register_transform_func (G_TYPE_INT,         G_TYPE_FLOAT,           value_transform_int_float);
+  g_value_register_transform_func (G_TYPE_INT,         G_TYPE_DOUBLE,          value_transform_int_double);
+  g_value_register_transform_func (G_TYPE_INT,         G_TYPE_STRING,          value_transform_int_string);
+  g_value_register_transform_func (G_TYPE_UINT,                G_TYPE_CHAR,            value_transform_uint_s8);
+  g_value_register_transform_func (G_TYPE_UINT,                G_TYPE_UCHAR,           value_transform_uint_u8);
+  g_value_register_transform_func (G_TYPE_UINT,                G_TYPE_BOOLEAN,         value_transform_uint_bool);
+  g_value_register_transform_func (G_TYPE_UINT,                G_TYPE_INT,             value_transform_uint_int);
+  g_value_register_transform_func (G_TYPE_UINT,                G_TYPE_UINT,            value_transform_uint_uint);
+  g_value_register_transform_func (G_TYPE_UINT,                G_TYPE_LONG,            value_transform_uint_long);
+  g_value_register_transform_func (G_TYPE_UINT,                G_TYPE_ULONG,           value_transform_uint_ulong);
+  g_value_register_transform_func (G_TYPE_UINT,                G_TYPE_ENUM,            value_transform_uint_int);
+  g_value_register_transform_func (G_TYPE_UINT,                G_TYPE_FLAGS,           value_transform_uint_uint);
+  g_value_register_transform_func (G_TYPE_UINT,                G_TYPE_FLOAT,           value_transform_uint_float);
+  g_value_register_transform_func (G_TYPE_UINT,                G_TYPE_DOUBLE,          value_transform_uint_double);
+  g_value_register_transform_func (G_TYPE_UINT,                G_TYPE_STRING,          value_transform_uint_string);
+  g_value_register_transform_func (G_TYPE_LONG,                G_TYPE_CHAR,            value_transform_long_s8);
+  g_value_register_transform_func (G_TYPE_LONG,                G_TYPE_UCHAR,           value_transform_long_u8);
+  g_value_register_transform_func (G_TYPE_LONG,                G_TYPE_BOOLEAN,         value_transform_long_bool);
+  g_value_register_transform_func (G_TYPE_LONG,                G_TYPE_INT,             value_transform_long_int);
+  g_value_register_transform_func (G_TYPE_LONG,                G_TYPE_UINT,            value_transform_long_uint);
+  g_value_register_transform_func (G_TYPE_LONG,                G_TYPE_LONG,            value_transform_long_long);
+  g_value_register_transform_func (G_TYPE_LONG,                G_TYPE_ULONG,           value_transform_long_ulong);
+  g_value_register_transform_func (G_TYPE_LONG,                G_TYPE_ENUM,            value_transform_long_int);
+  g_value_register_transform_func (G_TYPE_LONG,                G_TYPE_FLAGS,           value_transform_long_uint);
+  g_value_register_transform_func (G_TYPE_LONG,                G_TYPE_FLOAT,           value_transform_long_float);
+  g_value_register_transform_func (G_TYPE_LONG,                G_TYPE_DOUBLE,          value_transform_long_double);
+  g_value_register_transform_func (G_TYPE_LONG,                G_TYPE_STRING,          value_transform_long_string);
+  g_value_register_transform_func (G_TYPE_ULONG,       G_TYPE_CHAR,            value_transform_ulong_s8);
+  g_value_register_transform_func (G_TYPE_ULONG,       G_TYPE_UCHAR,           value_transform_ulong_u8);
+  g_value_register_transform_func (G_TYPE_ULONG,       G_TYPE_BOOLEAN,         value_transform_ulong_bool);
+  g_value_register_transform_func (G_TYPE_ULONG,       G_TYPE_INT,             value_transform_ulong_int);
+  g_value_register_transform_func (G_TYPE_ULONG,       G_TYPE_UINT,            value_transform_ulong_uint);
+  g_value_register_transform_func (G_TYPE_ULONG,       G_TYPE_LONG,            value_transform_ulong_long);
+  g_value_register_transform_func (G_TYPE_ULONG,       G_TYPE_ULONG,           value_transform_ulong_ulong);
+  g_value_register_transform_func (G_TYPE_ULONG,       G_TYPE_ENUM,            value_transform_ulong_int);
+  g_value_register_transform_func (G_TYPE_ULONG,       G_TYPE_FLAGS,           value_transform_ulong_uint);
+  g_value_register_transform_func (G_TYPE_ULONG,       G_TYPE_FLOAT,           value_transform_ulong_float);
+  g_value_register_transform_func (G_TYPE_ULONG,       G_TYPE_DOUBLE,          value_transform_ulong_double);
+  g_value_register_transform_func (G_TYPE_ULONG,       G_TYPE_STRING,          value_transform_ulong_string);
+  g_value_register_transform_func (G_TYPE_ENUM,                G_TYPE_CHAR,            value_transform_int_s8);
+  g_value_register_transform_func (G_TYPE_ENUM,                G_TYPE_UCHAR,           value_transform_int_u8);
+  SKIP____register_transform_func (G_TYPE_ENUM,                G_TYPE_BOOLEAN,         value_transform_int_bool);
+  g_value_register_transform_func (G_TYPE_ENUM,                G_TYPE_INT,             value_transform_int_int);
+  g_value_register_transform_func (G_TYPE_ENUM,                G_TYPE_UINT,            value_transform_int_uint);
+  g_value_register_transform_func (G_TYPE_ENUM,                G_TYPE_LONG,            value_transform_int_long);
+  g_value_register_transform_func (G_TYPE_ENUM,                G_TYPE_ULONG,           value_transform_int_ulong);
+  g_value_register_transform_func (G_TYPE_ENUM,                G_TYPE_ENUM,            value_transform_int_int);
+  g_value_register_transform_func (G_TYPE_ENUM,                G_TYPE_FLAGS,           value_transform_int_uint);
+  SKIP____register_transform_func (G_TYPE_ENUM,                G_TYPE_FLOAT,           value_transform_int_float);
+  SKIP____register_transform_func (G_TYPE_ENUM,                G_TYPE_DOUBLE,          value_transform_int_double);
+  g_value_register_transform_func (G_TYPE_ENUM,                G_TYPE_STRING,          value_transform_enum_string);
+  g_value_register_transform_func (G_TYPE_FLAGS,       G_TYPE_CHAR,            value_transform_uint_s8);
+  g_value_register_transform_func (G_TYPE_FLAGS,       G_TYPE_UCHAR,           value_transform_uint_u8);
+  SKIP____register_transform_func (G_TYPE_FLAGS,       G_TYPE_BOOLEAN,         value_transform_uint_bool);
+  g_value_register_transform_func (G_TYPE_FLAGS,       G_TYPE_INT,             value_transform_uint_int);
+  g_value_register_transform_func (G_TYPE_FLAGS,       G_TYPE_UINT,            value_transform_uint_uint);
+  g_value_register_transform_func (G_TYPE_FLAGS,       G_TYPE_LONG,            value_transform_uint_long);
+  g_value_register_transform_func (G_TYPE_FLAGS,       G_TYPE_ULONG,           value_transform_uint_ulong);
+  SKIP____register_transform_func (G_TYPE_FLAGS,       G_TYPE_ENUM,            value_transform_uint_int);
+  g_value_register_transform_func (G_TYPE_FLAGS,       G_TYPE_FLAGS,           value_transform_uint_uint);
+  SKIP____register_transform_func (G_TYPE_FLAGS,       G_TYPE_FLOAT,           value_transform_uint_float);
+  SKIP____register_transform_func (G_TYPE_FLAGS,       G_TYPE_DOUBLE,          value_transform_uint_double);
+  g_value_register_transform_func (G_TYPE_FLAGS,       G_TYPE_STRING,          value_transform_flags_string);
+  g_value_register_transform_func (G_TYPE_FLOAT,       G_TYPE_CHAR,            value_transform_float_s8);
+  g_value_register_transform_func (G_TYPE_FLOAT,       G_TYPE_UCHAR,           value_transform_float_u8);
+  SKIP____register_transform_func (G_TYPE_FLOAT,       G_TYPE_BOOLEAN,         value_transform_float_bool);
+  g_value_register_transform_func (G_TYPE_FLOAT,       G_TYPE_INT,             value_transform_float_int);
+  g_value_register_transform_func (G_TYPE_FLOAT,       G_TYPE_UINT,            value_transform_float_uint);
+  g_value_register_transform_func (G_TYPE_FLOAT,       G_TYPE_LONG,            value_transform_float_long);
+  g_value_register_transform_func (G_TYPE_FLOAT,       G_TYPE_ULONG,           value_transform_float_ulong);
+  SKIP____register_transform_func (G_TYPE_FLOAT,       G_TYPE_ENUM,            value_transform_float_int);
+  SKIP____register_transform_func (G_TYPE_FLOAT,       G_TYPE_FLAGS,           value_transform_float_uint);
+  g_value_register_transform_func (G_TYPE_FLOAT,       G_TYPE_FLOAT,           value_transform_float_float);
+  g_value_register_transform_func (G_TYPE_FLOAT,       G_TYPE_DOUBLE,          value_transform_float_double);
+  g_value_register_transform_func (G_TYPE_FLOAT,       G_TYPE_STRING,          value_transform_float_string);
+  g_value_register_transform_func (G_TYPE_DOUBLE,      G_TYPE_CHAR,            value_transform_double_s8);
+  g_value_register_transform_func (G_TYPE_DOUBLE,      G_TYPE_UCHAR,           value_transform_double_u8);
+  SKIP____register_transform_func (G_TYPE_DOUBLE,      G_TYPE_BOOLEAN,         value_transform_double_bool);
+  g_value_register_transform_func (G_TYPE_DOUBLE,      G_TYPE_INT,             value_transform_double_int);
+  g_value_register_transform_func (G_TYPE_DOUBLE,      G_TYPE_UINT,            value_transform_double_uint);
+  g_value_register_transform_func (G_TYPE_DOUBLE,      G_TYPE_LONG,            value_transform_double_long);
+  g_value_register_transform_func (G_TYPE_DOUBLE,      G_TYPE_ULONG,           value_transform_double_ulong);
+  SKIP____register_transform_func (G_TYPE_DOUBLE,      G_TYPE_ENUM,            value_transform_double_int);
+  SKIP____register_transform_func (G_TYPE_DOUBLE,      G_TYPE_FLAGS,           value_transform_double_uint);
+  g_value_register_transform_func (G_TYPE_DOUBLE,      G_TYPE_FLOAT,           value_transform_double_float);
+  g_value_register_transform_func (G_TYPE_DOUBLE,      G_TYPE_DOUBLE,          value_transform_double_double);
+  g_value_register_transform_func (G_TYPE_DOUBLE,      G_TYPE_STRING,          value_transform_double_string);
+  /* string types */
+  g_value_register_transform_func (G_TYPE_STRING,      G_TYPE_STRING,          value_transform_string_string);
+}
index 1e8ae92cde15e791fc0e6f0d397728f41e75371c..d148f03b981ce8ab283767993ccb1be56187b8c7 100644 (file)
@@ -1,5 +1,5 @@
 /* GObject - GLib Type, Object, Parameter and Signal Library
- * Copyright (C) 1997, 1998, 1999, 2000 Tim Janik and Red Hat, Inc.
+ * Copyright (C) 1997-1999, 2000-2001 Tim Janik and Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
 
 #include       "gvaluecollector.h"
 #include       <string.h>
+#include       <stdlib.h>      /* qsort() */
 
 
 /* --- value functions --- */
 static void
-value_long0_init (GValue *value)
+value_init_long0 (GValue *value)
 {
   value->data[0].v_long = 0;
 }
 
 static void
-value_long0_copy (const GValue *src_value,
+value_copy_long0 (const GValue *src_value,
                  GValue       *dest_value)
 {
   dest_value->data[0].v_long = src_value->data[0].v_long;
 }
 
 static gchar*
-value_char_lcopy_value (const GValue *value,
-                       guint         n_collect_values,
-                       GTypeCValue  *collect_values,
-                       guint         collect_flags)
+value_lcopy_char (const GValue *value,
+                 guint         n_collect_values,
+                 GTypeCValue  *collect_values,
+                 guint         collect_flags)
 {
   gint8 *int8_p = collect_values[0].v_pointer;
   
@@ -58,10 +59,10 @@ value_char_lcopy_value (const GValue *value,
 }
 
 static gchar*
-value_boolean_lcopy_value (const GValue *value,
-                          guint         n_collect_values,
-                          GTypeCValue  *collect_values,
-                          guint         collect_flags)
+value_lcopy_boolean (const GValue *value,
+                    guint         n_collect_values,
+                    GTypeCValue  *collect_values,
+                    guint         collect_flags)
 {
   gboolean *bool_p = collect_values[0].v_pointer;
   
@@ -74,10 +75,10 @@ value_boolean_lcopy_value (const GValue *value,
 }
 
 static gchar*
-value_int_collect_value (GValue             *value,
-                        guint        n_collect_values,
-                        GTypeCValue *collect_values,
-                        guint        collect_flags)
+value_collect_int (GValue      *value,
+                  guint        n_collect_values,
+                  GTypeCValue *collect_values,
+                  guint        collect_flags)
 {
   value->data[0].v_int = collect_values[0].v_int;
   
@@ -85,10 +86,10 @@ value_int_collect_value (GValue          *value,
 }
 
 static gchar*
-value_int_lcopy_value (const GValue *value,
-                      guint         n_collect_values,
-                      GTypeCValue  *collect_values,
-                      guint         collect_flags)
+value_lcopy_int (const GValue *value,
+                guint         n_collect_values,
+                GTypeCValue  *collect_values,
+                guint         collect_flags)
 {
   gint *int_p = collect_values[0].v_pointer;
   
@@ -101,10 +102,10 @@ value_int_lcopy_value (const GValue *value,
 }
 
 static gchar*
-value_long_collect_value (GValue      *value,
-                         guint        n_collect_values,
-                         GTypeCValue *collect_values,
-                         guint        collect_flags)
+value_collect_long (GValue      *value,
+                   guint        n_collect_values,
+                   GTypeCValue *collect_values,
+                   guint        collect_flags)
 {
   value->data[0].v_long = collect_values[0].v_long;
   
@@ -112,10 +113,10 @@ value_long_collect_value (GValue      *value,
 }
 
 static gchar*
-value_long_lcopy_value (const GValue *value,
-                        guint         n_collect_values,
-                       GTypeCValue  *collect_values,
-                       guint         collect_flags)
+value_lcopy_long (const GValue *value,
+                 guint         n_collect_values,
+                 GTypeCValue  *collect_values,
+                 guint         collect_flags)
 {
   glong *long_p = collect_values[0].v_pointer;
   
@@ -128,23 +129,23 @@ value_long_lcopy_value (const GValue *value,
 }
 
 static void
-value_float_init (GValue *value)
+value_init_float (GValue *value)
 {
   value->data[0].v_float = 0.0;
 }
 
 static void
-value_float_copy (const GValue *src_value,
+value_copy_float (const GValue *src_value,
                  GValue       *dest_value)
 {
   dest_value->data[0].v_float = src_value->data[0].v_float;
 }
 
 static gchar*
-value_float_collect_value (GValue      *value,
-                          guint        n_collect_values,
-                          GTypeCValue *collect_values,
-                          guint        collect_flags)
+value_collect_float (GValue      *value,
+                    guint        n_collect_values,
+                    GTypeCValue *collect_values,
+                    guint        collect_flags)
 {
   value->data[0].v_float = collect_values[0].v_double;
   
@@ -152,10 +153,10 @@ value_float_collect_value (GValue      *value,
 }
 
 static gchar*
-value_float_lcopy_value (const GValue *value,
-                        guint         n_collect_values,
-                        GTypeCValue  *collect_values,
-                        guint         collect_flags)
+value_lcopy_float (const GValue *value,
+                  guint         n_collect_values,
+                  GTypeCValue  *collect_values,
+                  guint         collect_flags)
 {
   gfloat *float_p = collect_values[0].v_pointer;
   
@@ -168,23 +169,23 @@ value_float_lcopy_value (const GValue *value,
 }
 
 static void
-value_double_init (GValue *value)
+value_init_double (GValue *value)
 {
   value->data[0].v_double = 0.0;
 }
 
 static void
-value_double_copy (const GValue *src_value,
+value_copy_double (const GValue *src_value,
                   GValue       *dest_value)
 {
   dest_value->data[0].v_double = src_value->data[0].v_double;
 }
 
 static gchar*
-value_double_collect_value (GValue     *value,
-                           guint        n_collect_values,
-                           GTypeCValue *collect_values,
-                           guint        collect_flags)
+value_collect_double (GValue     *value,
+                     guint        n_collect_values,
+                     GTypeCValue *collect_values,
+                     guint        collect_flags)
 {
   value->data[0].v_double = collect_values[0].v_double;
   
@@ -192,10 +193,10 @@ value_double_collect_value (GValue        *value,
 }
 
 static gchar*
-value_double_lcopy_value (const GValue *value,
-                         guint         n_collect_values,
-                         GTypeCValue  *collect_values,
-                         guint         collect_flags)
+value_lcopy_double (const GValue *value,
+                   guint         n_collect_values,
+                   GTypeCValue  *collect_values,
+                   guint         collect_flags)
 {
   gdouble *double_p = collect_values[0].v_pointer;
   
@@ -208,30 +209,30 @@ value_double_lcopy_value (const GValue *value,
 }
 
 static void
-value_string_init (GValue *value)
+value_init_string (GValue *value)
 {
   value->data[0].v_pointer = NULL;
 }
 
 static void
-value_string_free_value (GValue *value)
+value_free_string (GValue *value)
 {
   if (!(value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS))
     g_free (value->data[0].v_pointer);
 }
 
 static void
-value_string_copy_value (const GValue *src_value,
-                        GValue       *dest_value)
+value_copy_string (const GValue *src_value,
+                  GValue       *dest_value)
 {
   dest_value->data[0].v_pointer = g_strdup (src_value->data[0].v_pointer);
 }
 
 static gchar*
-value_string_collect_value (GValue     *value,
-                           guint        n_collect_values,
-                           GTypeCValue *collect_values,
-                           guint        collect_flags)
+value_collect_string (GValue     *value,
+                     guint        n_collect_values,
+                     GTypeCValue *collect_values,
+                     guint        collect_flags)
 {
   if (!collect_values[0].v_pointer)
     value->data[0].v_pointer = NULL;
@@ -247,10 +248,10 @@ value_string_collect_value (GValue        *value,
 }
 
 static gchar*
-value_string_lcopy_value (const GValue *value,
-                          guint         n_collect_values,
-                         GTypeCValue  *collect_values,
-                         guint         collect_flags)
+value_lcopy_string (const GValue *value,
+                   guint         n_collect_values,
+                   GTypeCValue  *collect_values,
+                   guint         collect_flags)
 {
   gchar **string_p = collect_values[0].v_pointer;
   
@@ -268,29 +269,29 @@ value_string_lcopy_value (const GValue *value,
 }
 
 static void
-value_pointer_init (GValue *value)
+value_init_pointer (GValue *value)
 {
   value->data[0].v_pointer = NULL;
 }
 
 static void
-value_pointer_copy (const GValue *src_value,
+value_copy_pointer (const GValue *src_value,
                    GValue       *dest_value)
 {
   dest_value->data[0].v_pointer = src_value->data[0].v_pointer;
 }
 
 static gpointer
-value_pointer_peek_pointer (const GValue *value)
+value_peek_pointer0 (const GValue *value)
 {
   return value->data[0].v_pointer;
 }
 
 static gchar*
-value_pointer_collect_value (GValue      *value,
-                            guint        n_collect_values,
-                            GTypeCValue *collect_values,
-                            guint        collect_flags)
+value_collect_pointer (GValue      *value,
+                      guint        n_collect_values,
+                      GTypeCValue *collect_values,
+                      guint        collect_flags)
 {
   value->data[0].v_pointer = collect_values[0].v_pointer;
 
@@ -298,10 +299,10 @@ value_pointer_collect_value (GValue      *value,
 }
 
 static gchar*
-value_pointer_lcopy_value (const GValue *value,
-                          guint         n_collect_values,
-                          GTypeCValue  *collect_values,
-                          guint         collect_flags)
+value_lcopy_pointer (const GValue *value,
+                    guint         n_collect_values,
+                    GTypeCValue  *collect_values,
+                    guint         collect_flags)
 {
   gpointer *pointer_p = collect_values[0].v_pointer;
 
@@ -313,59 +314,6 @@ value_pointer_lcopy_value (const GValue *value,
   return NULL;
 }
 
-static void
-value_ccallback_init (GValue *value)
-{
-  value->data[0].v_pointer = NULL;
-  value->data[1].v_pointer = NULL;
-}
-
-static void
-value_ccallback_copy (const GValue *src_value,
-                     GValue       *dest_value)
-{
-  dest_value->data[0].v_pointer = src_value->data[0].v_pointer;
-  dest_value->data[1].v_pointer = src_value->data[1].v_pointer;
-}
-
-static gchar*
-value_ccallback_collect_value (GValue      *value,
-                              guint        n_collect_values,
-                              GTypeCValue *collect_values,
-                              guint        collect_flags)
-{
-  gchar *error = NULL;
-
-  if (!collect_values[0].v_pointer)
-    error = g_strconcat ("invalid (NULL) pointer callback function for value type `",
-                        G_VALUE_TYPE_NAME (value),
-                        "'",
-                        NULL);
-  value->data[0].v_pointer = collect_values[0].v_pointer;
-  value->data[1].v_pointer = collect_values[1].v_pointer;
-
-  return error;
-}
-
-static gchar*
-value_ccallback_lcopy_value (const GValue *value,
-                            guint         n_collect_values,
-                            GTypeCValue  *collect_values,
-                            guint         collect_flags)
-{
-  gpointer *callback_p = collect_values[0].v_pointer;
-  gpointer *data_p = collect_values[1].v_pointer;
-
-  if (!callback_p || !data_p)
-    return g_strdup_printf ("%s location for `%s' passed as NULL",
-                           callback_p ? "data" : "callback",
-                           G_VALUE_TYPE_NAME (value));
-  *callback_p = value->data[0].v_pointer;
-  *data_p = value->data[1].v_pointer;
-
-  return NULL;
-}
-
 
 /* --- type initialization --- */
 void
@@ -390,14 +338,14 @@ g_value_types_init (void)  /* sync with gtype.c */
    */
   {
     static const GTypeValueTable value_table = {
-      value_long0_init,                /* value_init */
+      value_init_long0,                /* value_init */
       NULL,                    /* value_free */
-      value_long0_copy,                /* value_copy */
+      value_copy_long0,                /* value_copy */
       NULL,                    /* value_peek_pointer */
       "i",                     /* collect_format */
-      value_int_collect_value, /* collect_value */
+      value_collect_int,       /* collect_value */
       "p",                     /* lcopy_format */
-      value_char_lcopy_value,  /* lcopy_value */
+      value_lcopy_char,                /* lcopy_value */
     };
     info.value_table = &value_table;
     type = g_type_register_fundamental (G_TYPE_CHAR, "gchar", &info, &finfo, 0);
@@ -410,14 +358,14 @@ g_value_types_init (void)  /* sync with gtype.c */
    */
   {
     static const GTypeValueTable value_table = {
-      value_long0_init,                 /* value_init */
+      value_init_long0,                 /* value_init */
       NULL,                     /* value_free */
-      value_long0_copy,                 /* value_copy */
+      value_copy_long0,                 /* value_copy */
       NULL,                      /* value_peek_pointer */
       "i",                      /* collect_format */
-      value_int_collect_value,  /* collect_value */
+      value_collect_int,        /* collect_value */
       "p",                      /* lcopy_format */
-      value_boolean_lcopy_value, /* lcopy_value */
+      value_lcopy_boolean,      /* lcopy_value */
     };
     info.value_table = &value_table;
     type = g_type_register_fundamental (G_TYPE_BOOLEAN, "gboolean", &info, &finfo, 0);
@@ -428,14 +376,14 @@ g_value_types_init (void)  /* sync with gtype.c */
    */
   {
     static const GTypeValueTable value_table = {
-      value_long0_init,                /* value_init */
+      value_init_long0,                /* value_init */
       NULL,                    /* value_free */
-      value_long0_copy,                /* value_copy */
+      value_copy_long0,                /* value_copy */
       NULL,                     /* value_peek_pointer */
       "i",                     /* collect_format */
-      value_int_collect_value, /* collect_value */
+      value_collect_int,       /* collect_value */
       "p",                     /* lcopy_format */
-      value_int_lcopy_value,   /* lcopy_value */
+      value_lcopy_int,         /* lcopy_value */
     };
     info.value_table = &value_table;
     type = g_type_register_fundamental (G_TYPE_INT, "gint", &info, &finfo, 0);
@@ -448,14 +396,14 @@ g_value_types_init (void)  /* sync with gtype.c */
    */
   {
     static const GTypeValueTable value_table = {
-      value_long0_init,                /* value_init */
+      value_init_long0,                /* value_init */
       NULL,                    /* value_free */
-      value_long0_copy,                /* value_copy */
+      value_copy_long0,                /* value_copy */
       NULL,                     /* value_peek_pointer */
       "l",                     /* collect_format */
-      value_long_collect_value,        /* collect_value */
+      value_collect_long,      /* collect_value */
       "p",                     /* lcopy_format */
-      value_long_lcopy_value,  /* lcopy_value */
+      value_lcopy_long,                /* lcopy_value */
     };
     info.value_table = &value_table;
     type = g_type_register_fundamental (G_TYPE_LONG, "glong", &info, &finfo, 0);
@@ -468,14 +416,14 @@ g_value_types_init (void)  /* sync with gtype.c */
    */
   {
     static const GTypeValueTable value_table = {
-      value_float_init,                 /* value_init */
+      value_init_float,                 /* value_init */
       NULL,                     /* value_free */
-      value_float_copy,                 /* value_copy */
+      value_copy_float,                 /* value_copy */
       NULL,                      /* value_peek_pointer */
       "d",                      /* collect_format */
-      value_float_collect_value, /* collect_value */
+      value_collect_float,      /* collect_value */
       "p",                      /* lcopy_format */
-      value_float_lcopy_value,  /* lcopy_value */
+      value_lcopy_float,        /* lcopy_value */
     };
     info.value_table = &value_table;
     type = g_type_register_fundamental (G_TYPE_FLOAT, "gfloat", &info, &finfo, 0);
@@ -486,14 +434,14 @@ g_value_types_init (void)  /* sync with gtype.c */
    */
   {
     static const GTypeValueTable value_table = {
-      value_double_init,         /* value_init */
-      NULL,                      /* value_free */
-      value_double_copy,         /* value_copy */
-      NULL,                       /* value_peek_pointer */
-      "d",                       /* collect_format */
-      value_double_collect_value, /* collect_value */
-      "p",                       /* lcopy_format */
-      value_double_lcopy_value,          /* lcopy_value */
+      value_init_double,       /* value_init */
+      NULL,                    /* value_free */
+      value_copy_double,       /* value_copy */
+      NULL,                     /* value_peek_pointer */
+      "d",                     /* collect_format */
+      value_collect_double,    /* collect_value */
+      "p",                     /* lcopy_format */
+      value_lcopy_double,      /* lcopy_value */
     };
     info.value_table = &value_table;
     type = g_type_register_fundamental (G_TYPE_DOUBLE, "gdouble", &info, &finfo, 0);
@@ -504,14 +452,14 @@ g_value_types_init (void)  /* sync with gtype.c */
    */
   {
     static const GTypeValueTable value_table = {
-      value_string_init,         /* value_init */
-      value_string_free_value,   /* value_free */
-      value_string_copy_value,   /* value_copy */
-      value_pointer_peek_pointer, /* value_peek_pointer */
-      "p",                       /* collect_format */
-      value_string_collect_value, /* collect_value */
-      "p",                       /* lcopy_format */
-      value_string_lcopy_value,          /* lcopy_value */
+      value_init_string,       /* value_init */
+      value_free_string,       /* value_free */
+      value_copy_string,       /* value_copy */
+      value_peek_pointer0,     /* value_peek_pointer */
+      "p",                     /* collect_format */
+      value_collect_string,    /* collect_value */
+      "p",                     /* lcopy_format */
+      value_lcopy_string,      /* lcopy_value */
     };
     info.value_table = &value_table;
     type = g_type_register_fundamental (G_TYPE_STRING, "gstring", &info, &finfo, 0);
@@ -522,71 +470,53 @@ g_value_types_init (void)  /* sync with gtype.c */
    */
   {
     static const GTypeValueTable value_table = {
-      value_pointer_init,          /* value_init */
-      NULL,                        /* value_free */
-      value_pointer_copy,          /* value_copy */
-      value_pointer_peek_pointer,  /* value_peek_pointer */
-      "p",                        /* collect_format */
-      value_pointer_collect_value, /* collect_value */
-      "p",                        /* lcopy_format */
-      value_pointer_lcopy_value,   /* lcopy_value */
+      value_init_pointer,      /* value_init */
+      NULL,                    /* value_free */
+      value_copy_pointer,      /* value_copy */
+      value_peek_pointer0,     /* value_peek_pointer */
+      "p",                     /* collect_format */
+      value_collect_pointer,   /* collect_value */
+      "p",                     /* lcopy_format */
+      value_lcopy_pointer,     /* lcopy_value */
     };
     info.value_table = &value_table;
     type = g_type_register_fundamental (G_TYPE_POINTER, "gpointer", &info, &finfo, 0);
     g_assert (type == G_TYPE_POINTER);
   }
-
-  /* G_TYPE_CCALLBACK
-   */
-  {
-    static const GTypeValueTable value_table = {
-      value_ccallback_init,          /* value_init */
-      NULL,                          /* value_free */
-      value_ccallback_copy,          /* value_copy */
-      NULL,                          /* value_peek_pointer */
-      "pp",                         /* collect_format */
-      value_ccallback_collect_value, /* collect_value */
-      "pp",                         /* lcopy_format */
-      value_ccallback_lcopy_value,   /* lcopy_value */
-    };
-    info.value_table = &value_table;
-    type = g_type_register_fundamental (G_TYPE_CCALLBACK, "GCCallback", &info, &finfo, 0);
-    g_assert (type == G_TYPE_CCALLBACK);
-  }
 }
 
 
 /* --- GValue functions --- */
 void
 g_value_set_char (GValue *value,
-                 gint8   v_char)
+                 gchar   v_char)
 {
-  g_return_if_fail (G_IS_VALUE_CHAR (value));
+  g_return_if_fail (G_VALUE_HOLDS_CHAR (value));
   
   value->data[0].v_int = v_char;
 }
 
-gint8
+gchar
 g_value_get_char (const GValue *value)
 {
-  g_return_val_if_fail (G_IS_VALUE_CHAR (value), 0);
+  g_return_val_if_fail (G_VALUE_HOLDS_CHAR (value), 0);
   
   return value->data[0].v_int;
 }
 
 void
 g_value_set_uchar (GValue *value,
-                  guint8  v_uchar)
+                  guchar  v_uchar)
 {
-  g_return_if_fail (G_IS_VALUE_UCHAR (value));
+  g_return_if_fail (G_VALUE_HOLDS_UCHAR (value));
   
   value->data[0].v_uint = v_uchar;
 }
 
-guint8
+guchar
 g_value_get_uchar (const GValue *value)
 {
-  g_return_val_if_fail (G_IS_VALUE_UCHAR (value), 0);
+  g_return_val_if_fail (G_VALUE_HOLDS_UCHAR (value), 0);
   
   return value->data[0].v_uint;
 }
@@ -595,15 +525,15 @@ void
 g_value_set_boolean (GValue  *value,
                     gboolean v_boolean)
 {
-  g_return_if_fail (G_IS_VALUE_BOOLEAN (value));
+  g_return_if_fail (G_VALUE_HOLDS_BOOLEAN (value));
   
-  value->data[0].v_int = v_boolean;
+  value->data[0].v_int = v_boolean != FALSE;
 }
 
 gboolean
 g_value_get_boolean (const GValue *value)
 {
-  g_return_val_if_fail (G_IS_VALUE_BOOLEAN (value), 0);
+  g_return_val_if_fail (G_VALUE_HOLDS_BOOLEAN (value), 0);
   
   return value->data[0].v_int;
 }
@@ -612,7 +542,7 @@ void
 g_value_set_int (GValue *value,
                 gint    v_int)
 {
-  g_return_if_fail (G_IS_VALUE_INT (value));
+  g_return_if_fail (G_VALUE_HOLDS_INT (value));
   
   value->data[0].v_int = v_int;
 }
@@ -620,7 +550,7 @@ g_value_set_int (GValue *value,
 gint
 g_value_get_int (const GValue *value)
 {
-  g_return_val_if_fail (G_IS_VALUE_INT (value), 0);
+  g_return_val_if_fail (G_VALUE_HOLDS_INT (value), 0);
   
   return value->data[0].v_int;
 }
@@ -629,7 +559,7 @@ void
 g_value_set_uint (GValue *value,
                  guint   v_uint)
 {
-  g_return_if_fail (G_IS_VALUE_UINT (value));
+  g_return_if_fail (G_VALUE_HOLDS_UINT (value));
   
   value->data[0].v_uint = v_uint;
 }
@@ -637,7 +567,7 @@ g_value_set_uint (GValue *value,
 guint
 g_value_get_uint (const GValue *value)
 {
-  g_return_val_if_fail (G_IS_VALUE_UINT (value), 0);
+  g_return_val_if_fail (G_VALUE_HOLDS_UINT (value), 0);
   
   return value->data[0].v_uint;
 }
@@ -646,7 +576,7 @@ void
 g_value_set_long (GValue *value,
                  glong   v_long)
 {
-  g_return_if_fail (G_IS_VALUE_LONG (value));
+  g_return_if_fail (G_VALUE_HOLDS_LONG (value));
   
   value->data[0].v_long = v_long;
 }
@@ -654,7 +584,7 @@ g_value_set_long (GValue *value,
 glong
 g_value_get_long (const GValue *value)
 {
-  g_return_val_if_fail (G_IS_VALUE_LONG (value), 0);
+  g_return_val_if_fail (G_VALUE_HOLDS_LONG (value), 0);
   
   return value->data[0].v_long;
 }
@@ -663,7 +593,7 @@ void
 g_value_set_ulong (GValue *value,
                   gulong  v_ulong)
 {
-  g_return_if_fail (G_IS_VALUE_ULONG (value));
+  g_return_if_fail (G_VALUE_HOLDS_ULONG (value));
   
   value->data[0].v_ulong = v_ulong;
 }
@@ -671,7 +601,7 @@ g_value_set_ulong (GValue *value,
 gulong
 g_value_get_ulong (const GValue *value)
 {
-  g_return_val_if_fail (G_IS_VALUE_ULONG (value), 0);
+  g_return_val_if_fail (G_VALUE_HOLDS_ULONG (value), 0);
   
   return value->data[0].v_ulong;
 }
@@ -680,7 +610,7 @@ void
 g_value_set_float (GValue *value,
                   gfloat  v_float)
 {
-  g_return_if_fail (G_IS_VALUE_FLOAT (value));
+  g_return_if_fail (G_VALUE_HOLDS_FLOAT (value));
   
   value->data[0].v_float = v_float;
 }
@@ -688,7 +618,7 @@ g_value_set_float (GValue *value,
 gfloat
 g_value_get_float (const GValue *value)
 {
-  g_return_val_if_fail (G_IS_VALUE_FLOAT (value), 0);
+  g_return_val_if_fail (G_VALUE_HOLDS_FLOAT (value), 0);
   
   return value->data[0].v_float;
 }
@@ -697,7 +627,7 @@ void
 g_value_set_double (GValue *value,
                    gdouble v_double)
 {
-  g_return_if_fail (G_IS_VALUE_DOUBLE (value));
+  g_return_if_fail (G_VALUE_HOLDS_DOUBLE (value));
   
   value->data[0].v_double = v_double;
 }
@@ -705,7 +635,7 @@ g_value_set_double (GValue *value,
 gdouble
 g_value_get_double (const GValue *value)
 {
-  g_return_val_if_fail (G_IS_VALUE_DOUBLE (value), 0);
+  g_return_val_if_fail (G_VALUE_HOLDS_DOUBLE (value), 0);
   
   return value->data[0].v_double;
 }
@@ -714,7 +644,7 @@ void
 g_value_set_string (GValue     *value,
                    const gchar *v_string)
 {
-  g_return_if_fail (G_IS_VALUE_STRING (value));
+  g_return_if_fail (G_VALUE_HOLDS_STRING (value));
   
   if (value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS)
     value->data[1].v_uint = 0;
@@ -727,7 +657,7 @@ void
 g_value_set_static_string (GValue      *value,
                           const gchar *v_string)
 {
-  g_return_if_fail (G_IS_VALUE_STRING (value));
+  g_return_if_fail (G_VALUE_HOLDS_STRING (value));
   
   if (!(value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS))
     g_free (value->data[0].v_pointer);
@@ -735,10 +665,23 @@ g_value_set_static_string (GValue      *value,
   value->data[0].v_pointer = (gchar*) v_string;
 }
 
+void
+g_value_set_string_take_ownership (GValue *value,
+                                  gchar  *v_string)
+{
+  g_return_if_fail (G_VALUE_HOLDS_STRING (value));
+  
+  if (value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS)
+    value->data[1].v_uint = 0;
+  else
+    g_free (value->data[0].v_pointer);
+  value->data[0].v_pointer = v_string;
+}
+
 G_CONST_RETURN gchar*
 g_value_get_string (const GValue *value)
 {
-  g_return_val_if_fail (G_IS_VALUE_STRING (value), NULL);
+  g_return_val_if_fail (G_VALUE_HOLDS_STRING (value), NULL);
   
   return value->data[0].v_pointer;
 }
@@ -746,7 +689,7 @@ g_value_get_string (const GValue *value)
 gchar*
 g_value_dup_string (const GValue *value)
 {
-  g_return_val_if_fail (G_IS_VALUE_STRING (value), NULL);
+  g_return_val_if_fail (G_VALUE_HOLDS_STRING (value), NULL);
   
   return g_strdup (value->data[0].v_pointer);
 }
@@ -755,7 +698,7 @@ void
 g_value_set_pointer (GValue  *value,
                     gpointer v_pointer)
 {
-  g_return_if_fail (G_IS_VALUE_POINTER (value));
+  g_return_if_fail (G_VALUE_HOLDS_POINTER (value));
 
   value->data[0].v_pointer = v_pointer;
 }
@@ -763,31 +706,7 @@ g_value_set_pointer (GValue  *value,
 gpointer
 g_value_get_pointer (const GValue *value)
 {
-  g_return_val_if_fail (G_IS_VALUE_POINTER (value), NULL);
+  g_return_val_if_fail (G_VALUE_HOLDS_POINTER (value), NULL);
 
   return value->data[0].v_pointer;
 }
-
-void
-g_value_set_ccallback (GValue  *value,
-                      gpointer callback_func,
-                      gpointer callback_data)
-{
-  g_return_if_fail (G_IS_VALUE_CCALLBACK (value));
-  
-  value->data[0].v_pointer = callback_func;
-  value->data[1].v_pointer = callback_data;
-}
-
-void
-g_value_get_ccallback (const GValue *value,
-                      gpointer     *callback_func,
-                      gpointer     *callback_data)
-{
-  g_return_if_fail (G_IS_VALUE_CCALLBACK (value));
-
-  if (callback_func)
-    *callback_func = value->data[0].v_pointer;
-  if (callback_data)
-    *callback_data = value->data[1].v_pointer;
-}
index 5cf5b8865a1b7dc70457a57e1164c877de099082..557ca2343d2c0a6a2ebafb00e7711389fbe246e0 100644 (file)
@@ -1,5 +1,5 @@
 /* GObject - GLib Type, Object, Parameter and Signal Library
- * Copyright (C) 1997, 1998, 1999, 2000 Tim Janik and Red Hat, Inc.
+ * Copyright (C) 1997-1999, 2000-2001 Tim Janik and Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -31,63 +31,63 @@ extern "C" {
 
 
 /* --- type macros --- */
-#define G_IS_VALUE_CHAR(value)         (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_CHAR))
-#define G_IS_VALUE_UCHAR(value)                (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_UCHAR))
-#define G_IS_VALUE_BOOLEAN(value)      (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_BOOLEAN))
-#define G_IS_VALUE_INT(value)          (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_INT))
-#define G_IS_VALUE_UINT(value)         (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_UINT))
-#define G_IS_VALUE_LONG(value)         (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_LONG))
-#define G_IS_VALUE_ULONG(value)                (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_ULONG))
-#define G_IS_VALUE_FLOAT(value)                (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_FLOAT))
-#define G_IS_VALUE_DOUBLE(value)       (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_DOUBLE))
-#define G_IS_VALUE_STRING(value)       (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_STRING))
-#define G_IS_VALUE_POINTER(value)      (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_POINTER))
-#define G_IS_VALUE_CCALLBACK(value)    (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_CCALLBACK))
+#define G_VALUE_HOLDS_CHAR(value)       (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_CHAR))
+#define G_VALUE_HOLDS_UCHAR(value)      (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_UCHAR))
+#define G_VALUE_HOLDS_BOOLEAN(value)    (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_BOOLEAN))
+#define G_VALUE_HOLDS_INT(value)        (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_INT))
+#define G_VALUE_HOLDS_UINT(value)       (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_UINT))
+#define G_VALUE_HOLDS_LONG(value)       (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_LONG))
+#define G_VALUE_HOLDS_ULONG(value)      (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_ULONG))
+#define G_VALUE_HOLDS_FLOAT(value)      (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_FLOAT))
+#define G_VALUE_HOLDS_DOUBLE(value)     (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_DOUBLE))
+#define G_VALUE_HOLDS_STRING(value)     (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_STRING))
+#define G_VALUE_HOLDS_POINTER(value)    (G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_POINTER))
 
 
 /* --- prototypes --- */
-void                  g_value_set_char          (GValue       *value,
-                                                gint8         v_char);
-gint8                 g_value_get_char          (const GValue *value);
-void                  g_value_set_uchar         (GValue       *value,
-                                                guint8        v_uchar);
-guint8                g_value_get_uchar         (const GValue *value);
-void                  g_value_set_boolean       (GValue       *value,
+void                 g_value_set_char          (GValue       *value,
+                                                gchar         v_char);
+gchar                g_value_get_char          (const GValue *value);
+void                 g_value_set_uchar         (GValue       *value,
+                                                guchar        v_uchar);
+guchar               g_value_get_uchar         (const GValue *value);
+void                 g_value_set_boolean       (GValue       *value,
                                                 gboolean      v_boolean);
-gboolean              g_value_get_boolean       (const GValue *value);
-void                  g_value_set_int           (GValue       *value,
-                                                gint          v_int);
-gint                  g_value_get_int           (const GValue *value);
-void                  g_value_set_uint          (GValue       *value,
-                                                guint         v_uint);
-guint                 g_value_get_uint          (const GValue *value);
-void                  g_value_set_long          (GValue       *value,
-                                                glong         v_long);
-glong                 g_value_get_long          (const GValue *value);
-void                  g_value_set_ulong         (GValue       *value,
-                                                gulong        v_ulong);
-gulong                g_value_get_ulong         (const GValue *value);
-void                  g_value_set_float         (GValue       *value,
-                                                gfloat        v_float);
-gfloat                g_value_get_float         (const GValue *value);
-void                  g_value_set_double        (GValue       *value,
+gboolean             g_value_get_boolean       (const GValue *value);
+void                 g_value_set_int           (GValue       *value,
+                                                gint          v_int);
+gint                 g_value_get_int           (const GValue *value);
+void                 g_value_set_uint          (GValue       *value,
+                                                guint         v_uint);
+guint                g_value_get_uint          (const GValue *value);
+void                 g_value_set_long          (GValue       *value,
+                                                glong         v_long);
+glong                g_value_get_long          (const GValue *value);
+void                 g_value_set_ulong         (GValue       *value,
+                                                gulong        v_ulong);
+gulong               g_value_get_ulong         (const GValue *value);
+void                 g_value_set_float         (GValue       *value,
+                                                gfloat        v_float);
+gfloat               g_value_get_float         (const GValue *value);
+void                 g_value_set_double        (GValue       *value,
                                                 gdouble       v_double);
-gdouble               g_value_get_double        (const GValue *value);
-void                  g_value_set_string        (GValue       *value,
+gdouble                      g_value_get_double        (const GValue *value);
+void                 g_value_set_string        (GValue       *value,
                                                 const gchar  *v_string);
-void                  g_value_set_static_string (GValue       *value,
+void                 g_value_set_static_string (GValue       *value,
                                                 const gchar  *v_string);
-G_CONST_RETURN gchar* g_value_get_string        (const GValue *value);
-gchar*                g_value_dup_string        (const GValue *value);
-void                  g_value_set_pointer       (GValue       *value,
+G_CONST_RETURN gchar* g_value_get_string       (const GValue *value);
+gchar*               g_value_dup_string        (const GValue *value);
+void                 g_value_set_pointer       (GValue       *value,
                                                 gpointer      v_pointer);
-gpointer              g_value_get_pointer       (const GValue *value);
-void                  g_value_set_ccallback     (GValue       *value,
-                                                gpointer      callback_func,
-                                                gpointer      callback_data);
-void                  g_value_get_ccallback     (const GValue *value,
-                                                gpointer     *callback_func,
-                                                gpointer     *callback_data);
+gpointer             g_value_get_pointer       (const GValue *value);
+
+
+/* --- marshaller specific --- */
+void g_value_set_string_take_ownership         (GValue            *value,
+                                                gchar             *v_string);
+
+
 
 #ifdef __cplusplus
 }
index 69b63637ef30f3749f73e06b7df2ffc214c59df6..c75cca31a45983d2505bd1f913309af9b37eb91f 100644 (file)
--- a/gqsort.c
+++ b/gqsort.c
@@ -96,7 +96,7 @@ void
 g_qsort_with_data (gconstpointer    pbase,
                   gint             total_elems,
                   size_t           size,
-                  GCompareFuncData compare_func,
+                  GCompareDataFunc compare_func,
                   gpointer         user_data)
 {
   register char *base_ptr = (char *) pbase;
index f236e04fbe6ba35b5134c00f8480baad56d330e4..d946e80cadaffd23f47145f6387c0f51d7783ee0 100644 (file)
--- a/gqsort.h
+++ b/gqsort.h
@@ -35,7 +35,7 @@ G_BEGIN_DECLS
 void g_qsort_with_data (gconstpointer    pbase,
                        gint             total_elems,
                        size_t           size,
-                       GCompareFuncData compare_func,
+                       GCompareDataFunc compare_func,
                        gpointer         user_data);
 
 G_END_DECLS
index 6c90199148e2e0d4d33e0aaef4ad7d1e60ef7e89..65c2c6cdb956fbb8aeb8fb00c7c97c1ed1a72a64 100644 (file)
--- a/gslist.c
+++ b/gslist.c
@@ -634,7 +634,7 @@ g_slist_sort_merge (GSList   *l1,
   while (l1 && l2)
     {
       if (use_data)
-       cmp = ((GCompareFuncData) compare_func) (l1->data, l2->data, user_data);
+       cmp = ((GCompareDataFunc) compare_func) (l1->data, l2->data, user_data);
       else
        cmp = ((GCompareFunc) compare_func) (l1->data, l2->data);
 
@@ -695,7 +695,7 @@ g_slist_sort (GSList       *list,
 
 GSList *
 g_slist_sort_with_data (GSList           *list,
-                       GCompareFuncData  compare_func,
+                       GCompareDataFunc  compare_func,
                        gpointer          user_data)
 {
   return g_slist_sort_real (list, (GFunc) compare_func, TRUE, user_data);
index 446eab43eae54bebab981895f58a004f683c2e1c..8d94b2c075975725c22bc907089402f32eab9d29 100644 (file)
--- a/gslist.h
+++ b/gslist.h
@@ -88,7 +88,7 @@ void     g_slist_foreach        (GSList           *list,
 GSList*  g_slist_sort           (GSList           *list,
                                 GCompareFunc      compare_func);
 GSList*  g_slist_sort_with_data (GSList           *list,
-                                GCompareFuncData  compare_func,
+                                GCompareDataFunc  compare_func,
                                 gpointer          user_data);
 gpointer g_slist_nth_data       (GSList           *list,
                                 guint             n);
index ff6fc7c6dabfb9e7b44ca8f10ee33f71c8059ecd..a720ac73d70debb216156822c41a3d6a58763d95 100644 (file)
--- a/gstring.c
+++ b/gstring.c
@@ -565,9 +565,9 @@ g_string_up (GString *fstring)
 }
 
 static void
-g_string_sprintfa_int (GString     *string,
-                      const gchar *fmt,
-                      va_list      args)
+g_string_printfa_internal (GString     *string,
+                          const gchar *fmt,
+                          va_list      args)
 {
   gchar *buffer;
 
@@ -577,27 +577,27 @@ g_string_sprintfa_int (GString     *string,
 }
 
 void
-g_string_sprintf (GString *string,
-                 const gchar *fmt,
-                 ...)
+g_string_printf (GString *string,
+                const gchar *fmt,
+                ...)
 {
   va_list args;
 
   g_string_truncate (string, 0);
 
   va_start (args, fmt);
-  g_string_sprintfa_int (string, fmt, args);
+  g_string_printfa_internal (string, fmt, args);
   va_end (args);
 }
 
 void
-g_string_sprintfa (GString *string,
-                  const gchar *fmt,
-                  ...)
+g_string_printfa (GString *string,
+                 const gchar *fmt,
+                 ...)
 {
   va_list args;
 
   va_start (args, fmt);
-  g_string_sprintfa_int (string, fmt, args);
+  g_string_printfa_internal (string, fmt, args);
   va_end (args);
 }
index d2f88e066a00c3268b8c6540bf76481b17dceac4..84d0bbb3f10d91b654fb16f0465f66e3324cec2f 100644 (file)
--- a/gstring.h
+++ b/gstring.h
@@ -94,12 +94,15 @@ GString*     g_string_erase         (GString         *string,
                                         gint             len);
 GString*     g_string_down              (GString        *string);
 GString*     g_string_up                (GString        *string);
-void         g_string_sprintf           (GString        *string,
+void         g_string_printf            (GString        *string,
                                         const gchar     *format,
                                         ...) G_GNUC_PRINTF (2, 3);
-void         g_string_sprintfa          (GString        *string,
+void         g_string_printfa           (GString        *string,
                                         const gchar     *format,
                                         ...) G_GNUC_PRINTF (2, 3);
+/* compatibility */
+#define        g_string_sprintf        g_string_printf
+#define        g_string_sprintfa       g_string_printfa
 
 G_END_DECLS
 
diff --git a/gtree.c b/gtree.c
index c453eb64b82539978b8eb7e7e9fc2023ad6bd75a..5e0c0f57363f90084e31590c3461c1209c75997c 100644 (file)
--- a/gtree.c
+++ b/gtree.c
@@ -41,7 +41,7 @@ typedef struct _GTreeNode  GTreeNode;
 struct _GRealTree
 {
   GTreeNode *root;
-  GCompareFuncData key_compare;
+  GCompareDataFunc key_compare;
   gpointer key_compare_data;
 };
 
@@ -59,13 +59,13 @@ static GTreeNode* g_tree_node_new                   (gpointer        key,
                                                     gpointer        value);
 static void       g_tree_node_destroy               (GTreeNode      *node);
 static GTreeNode* g_tree_node_insert                (GTreeNode      *node,
-                                                    GCompareFuncData compare,
+                                                    GCompareDataFunc compare,
                                                     gpointer        comp_data,
                                                     gpointer        key,
                                                     gpointer        value,
                                                     gint           *inserted);
 static GTreeNode* g_tree_node_remove                (GTreeNode      *node,
-                                                    GCompareFuncData compare,
+                                                    GCompareDataFunc compare,
                                                     gpointer        comp_data,
                                                     gconstpointer   key);
 static GTreeNode* g_tree_node_balance               (GTreeNode      *node);
@@ -76,7 +76,7 @@ static GTreeNode* g_tree_node_restore_left_balance  (GTreeNode      *node,
 static GTreeNode* g_tree_node_restore_right_balance (GTreeNode      *node,
                                                     gint            old_balance);
 static gpointer   g_tree_node_lookup                (GTreeNode      *node,
-                                                    GCompareFuncData compare,
+                                                    GCompareDataFunc compare,
                                                     gpointer        comp_data,
                                                     gconstpointer   key);
 static gint       g_tree_node_count                 (GTreeNode      *node);
@@ -157,7 +157,7 @@ g_tree_node_destroy (GTreeNode *node)
    }
 }
 
-GTree*  g_tree_new_udata(GCompareFuncData key_compare_func,
+GTree*  g_tree_new_udata(GCompareDataFunc key_compare_func,
                           gpointer        key_compare_data)
 {
   GRealTree *rtree;
@@ -175,7 +175,7 @@ GTree*       g_tree_new_udata(GCompareFuncData key_compare_func,
 GTree*
 g_tree_new (GCompareFunc key_compare_func)
 {
-  return g_tree_new_udata ((GCompareFuncData) key_compare_func, NULL);
+  return g_tree_new_udata ((GCompareDataFunc) key_compare_func, NULL);
 }
 
 
@@ -322,7 +322,7 @@ g_tree_nnodes (GTree *tree)
 
 static GTreeNode*
 g_tree_node_insert (GTreeNode      *node,
-                   GCompareFuncData compare,
+                   GCompareDataFunc compare,
                    gpointer        compare_data,
                    gpointer        key,
                    gpointer        value,
@@ -393,7 +393,7 @@ g_tree_node_insert (GTreeNode      *node,
 
 static GTreeNode*
 g_tree_node_remove (GTreeNode      *node,
-                   GCompareFuncData compare,
+                   GCompareDataFunc compare,
                    gpointer        compare_data,
                    gconstpointer   key)
 {
@@ -526,7 +526,7 @@ g_tree_node_restore_right_balance (GTreeNode *node,
 
 static gpointer
 g_tree_node_lookup (GTreeNode      *node,
-                   GCompareFuncData compare,
+                   GCompareDataFunc compare,
                    gpointer        compare_data,
                    gconstpointer   key)
 {
diff --git a/gtree.h b/gtree.h
index 3530a6374bea9da7b7ac652f2523f6f0a2a31007..78a52fb0f4fcdd7d60937b1f3698d6f55a83dbd1 100644 (file)
--- a/gtree.h
+++ b/gtree.h
@@ -40,7 +40,7 @@ typedef gint          (*GTraverseFunc)        (gpointer       key,
 /* Balanced binary trees
  */
 GTree*   g_tree_new           (GCompareFunc      key_compare_func);
-GTree*   g_tree_new_with_data (GCompareFuncData  key_compare_func,
+GTree*   g_tree_new_with_data (GCompareDataFunc  key_compare_func,
                               gpointer          user_data);
 void     g_tree_destroy       (GTree            *tree);
 void     g_tree_insert        (GTree            *tree,
index 21a29e91903cf6417d7ef89f4adaf2136b3bfbea..487ecdc776114f8372c724396a1c1156efc6d4b1 100644 (file)
--- a/gtypes.h
+++ b/gtypes.h
@@ -69,7 +69,7 @@ typedef const void *gconstpointer;
 
 typedef gint            (*GCompareFunc)         (gconstpointer  a,
                                                  gconstpointer  b);
-typedef gint            (*GCompareFuncData)     (gconstpointer  a,
+typedef gint            (*GCompareDataFunc)     (gconstpointer  a,
                                                  gconstpointer  b,
                                                 gpointer       user_data);
 typedef gboolean        (*GEqualFunc)           (gconstpointer  a,