diff --git a/gobject/ChangeLog b/gobject/ChangeLog index 357b9e2fc..3b9e59298 100644 --- a/gobject/ChangeLog +++ b/gobject/ChangeLog @@ -1,3 +1,14 @@ +2004-09-16 Matthias Clasen + + Implement the same PLT reduction technique used in GTK+: + + * Makefile.am: Generate gobjectalias.h from gobject.symbols. + (BUILT_SOURCES): Add gobjectalias.h. + + * makegobjectalias.pl: Script to generate gobjectalias.h. + + * *.c: Include gobjectalias.h + 2004-09-16 Matthias Clasen Add ABI control using the same technique that is used in GTK+. @@ -6,7 +17,7 @@ * gobject.def: Removed. It is now generated from gobject.symbols. - * Makefile.am (gobject.def): Generate from gobject.symbols. + * Makefile.am: Generate gobject.def from gobject.symbols. (TESTS): Add abicheck.sh (EXTRA_DIST): Add abicheck.sh (export_symbols): Don't export _-prefixed symbols. diff --git a/gobject/Makefile.am b/gobject/Makefile.am index da2abf359..822aa6892 100644 --- a/gobject/Makefile.am +++ b/gobject/Makefile.am @@ -16,6 +16,9 @@ INCLUDES = \ gobject.def: gobject.symbols (echo -e EXPORTS; cpp -P -DINCLUDE_VARIABLES -DINCLUDE_INTERNAL_SYMBOLS -DG_OS_WIN32 $(srcdir)/gobject.symbols | sed -e '/^$$/d' -e 's/^/\t/' | sort) > gobject.def +gobjectalias.h: gobject.symbols + ./makegobjectalias.pl < $(srcdir)/gobject.symbols > gobjectalias.h + if OS_UNIX TESTS = abicheck.sh endif @@ -112,7 +115,7 @@ gobject_c_sources = \ gvaluetypes.c # these sources (also mentioned above) are generated. -BUILT_SOURCES = gmarshal.h gmarshal.c +BUILT_SOURCES = gmarshal.h gmarshal.c gobjectalias.h # non-header sources (headers should be specified in the above variables) # that don't serve as direct make target sources, i.e. they don't have diff --git a/gobject/gboxed.c b/gobject/gboxed.c index 54a1b4901..dc3339ab0 100644 --- a/gobject/gboxed.c +++ b/gobject/gboxed.c @@ -16,6 +16,7 @@ * Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. */ +#include "gobjectalias.h" #include "gboxed.h" #include "gbsearcharray.h" @@ -108,7 +109,7 @@ gstring_free (gpointer boxed) } void -g_boxed_type_init (void) /* sync with gtype.c */ +g_boxed_type_init (void) { static const GTypeInfo info = { 0, /* class_size */ diff --git a/gobject/gclosure.c b/gobject/gclosure.c index 73f2b16e5..23299bf80 100644 --- a/gobject/gclosure.c +++ b/gobject/gclosure.c @@ -16,7 +16,7 @@ * Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. */ - +#include "gobjectalias.h" #include "gclosure.h" #include "gvalue.h" diff --git a/gobject/genums.c b/gobject/genums.c index e0ecf5c5a..5bbc772c1 100644 --- a/gobject/genums.c +++ b/gobject/genums.c @@ -23,6 +23,7 @@ #include +#include "gobjectalias.h" #include "genums.h" #include "gvalue.h" @@ -46,10 +47,9 @@ static gchar* value_flags_enum_lcopy_value (const GValue *value, GTypeCValue *collect_values, guint collect_flags); - /* --- functions --- */ void -g_enum_types_init (void) /* sync with gtype.c */ +g_enum_types_init (void) { static gboolean initialized = FALSE; static const GTypeValueTable flags_enum_value_table = { diff --git a/gobject/gobject.c b/gobject/gobject.c index e15ffdc2b..6429cdc21 100644 --- a/gobject/gobject.c +++ b/gobject/gobject.c @@ -16,6 +16,7 @@ * Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. */ +#include "gobjectalias.h" #include "gobject.h" /* @@ -144,7 +145,7 @@ debug_objects_atexit (void) #endif /* G_ENABLE_DEBUG */ void -g_object_type_init (void) /* sync with gtype.c */ +g_object_type_init (void) { static gboolean initialized = FALSE; static const GTypeFundamentalInfo finfo = { diff --git a/gobject/gparam.c b/gobject/gparam.c index f2edcbbe3..282b8a4be 100644 --- a/gobject/gparam.c +++ b/gobject/gparam.c @@ -21,6 +21,7 @@ * MT safe */ +#include "gobjectalias.h" #include "gparam.h" #include "gparamspecs.h" @@ -68,7 +69,7 @@ G_LOCK_DEFINE_STATIC (pspec_ref_count); /* --- functions --- */ void -g_param_type_init (void) /* sync with gtype.c */ +g_param_type_init (void) { static const GTypeFundamentalInfo finfo = { (G_TYPE_FLAG_CLASSED | diff --git a/gobject/gparamspecs.c b/gobject/gparamspecs.c index b4a71a37c..7e40f7e99 100644 --- a/gobject/gparamspecs.c +++ b/gobject/gparamspecs.c @@ -23,6 +23,7 @@ #include "../config.h" +#include "gobjectalias.h" #include "gparamspecs.h" #include "gvaluecollector.h" @@ -1019,7 +1020,7 @@ param_override_values_cmp (GParamSpec *pspec, GType *g_param_spec_types = NULL; void -g_param_spec_types_init (void) /* sync with gtype.c */ +g_param_spec_types_init (void) { const guint n_types = 21; GType type, *spec_types, *spec_types_bound; diff --git a/gobject/gsignal.c b/gobject/gsignal.c index 01b248db1..9aa2dc358 100644 --- a/gobject/gsignal.c +++ b/gobject/gsignal.c @@ -26,6 +26,7 @@ #include +#include "gobjectalias.h" #include "gsignal.h" #include "gbsearcharray.h" #include "gvaluecollector.h" @@ -709,7 +710,7 @@ signal_key_cmp (gconstpointer node1, } void -g_signal_init (void) /* sync with gtype.c */ +g_signal_init (void) { SIGNAL_LOCK (); if (!g_n_signal_nodes) diff --git a/gobject/gsourceclosure.c b/gobject/gsourceclosure.c index 3db1317d3..7ff1680a3 100644 --- a/gobject/gsourceclosure.c +++ b/gobject/gsourceclosure.c @@ -17,6 +17,7 @@ * Boston, MA 02111-1307, USA. */ +#include "gobjectalias.h" #include "gsourceclosure.h" #include "gboxed.h" #include "genums.h" diff --git a/gobject/gtype.c b/gobject/gtype.c index 9c50a51e3..6aaf87cc9 100644 --- a/gobject/gtype.c +++ b/gobject/gtype.c @@ -17,6 +17,7 @@ * Boston, MA 02111-1307, USA. */ #include +#include "gobjectalias.h" #include "gtype.h" /* diff --git a/gobject/gtypemodule.c b/gobject/gtypemodule.c index 0c917c0d3..4ecb6ca03 100644 --- a/gobject/gtypemodule.c +++ b/gobject/gtypemodule.c @@ -19,6 +19,7 @@ #include +#include "gobjectalias.h" #include "gtypeplugin.h" #include "gtypemodule.h" diff --git a/gobject/gtypeplugin.c b/gobject/gtypeplugin.c index 5c4fcc0cf..99665cc3e 100644 --- a/gobject/gtypeplugin.c +++ b/gobject/gtypeplugin.c @@ -16,6 +16,7 @@ * Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. */ +#include "gobjectalias.h" #include "gtypeplugin.h" diff --git a/gobject/gvalue.c b/gobject/gvalue.c index 069f9961b..680122f91 100644 --- a/gobject/gvalue.c +++ b/gobject/gvalue.c @@ -23,6 +23,7 @@ #include +#include "gobjectalias.h" #include "gvalue.h" #include "gvaluecollector.h" #include "gbsearcharray.h" @@ -52,7 +53,7 @@ static GBSearchConfig transform_bconfig = { /* --- functions --- */ void -g_value_c_init (void) /* sync with gtype.c */ +g_value_c_init (void) { transform_array = g_bsearch_array_create (&transform_bconfig); } diff --git a/gobject/gvaluearray.c b/gobject/gvaluearray.c index 908724270..54e0e11e3 100644 --- a/gobject/gvaluearray.c +++ b/gobject/gvaluearray.c @@ -23,6 +23,7 @@ #include +#include "gobjectalias.h" #include "gvaluearray.h" #include #include /* qsort() */ diff --git a/gobject/gvaluetransform.c b/gobject/gvaluetransform.c index 20e473eae..d4769fd50 100644 --- a/gobject/gvaluetransform.c +++ b/gobject/gvaluetransform.c @@ -18,6 +18,7 @@ */ #include +#include "gobjectalias.h" #include "gvalue.h" #include "genums.h" @@ -242,7 +243,7 @@ value_transform_flags_string (const GValue *src_value, /* registration */ void -g_value_transforms_init (void) /* sync with gtype.c */ +g_value_transforms_init (void) { /* some transformations are a bit questionable, * we currently skip those diff --git a/gobject/gvaluetypes.c b/gobject/gvaluetypes.c index 48227869f..3b73876d5 100644 --- a/gobject/gvaluetypes.c +++ b/gobject/gvaluetypes.c @@ -21,6 +21,7 @@ * MT safe */ +#include "gobjectalias.h" #include "gvaluetypes.h" #include "gvaluecollector.h" @@ -357,7 +358,7 @@ value_lcopy_pointer (const GValue *value, /* --- type initialization --- */ void -g_value_types_init (void) /* sync with gtype.c */ +g_value_types_init (void) { GTypeInfo info = { 0, /* class_size */ diff --git a/gobject/makegobjectalias.pl b/gobject/makegobjectalias.pl new file mode 100755 index 000000000..d115de2b9 --- /dev/null +++ b/gobject/makegobjectalias.pl @@ -0,0 +1,100 @@ +#!/usr/bin/perl -w + +print <) { + + # ignore empty lines + next if /^\s*$/; + + # skip comments + if ($_ =~ /^\s*\/\*/) + { + $in_comment = 1; + } + + if ($in_comment) + { + if ($_ =~ /\*\/\s$/) + { + $in_comment = 0; + } + + next; + } + + # handle ifdefs + if ($_ =~ /^\#endif/) + { + if (!$in_skipped_section) + { + print $_; + } + + $in_skipped_section = 0; + + next; + } + + if ($_ =~ /^\#ifdef\s+(INCLUDE_VARIABLES|INCLUDE_INTERNAL_SYMBOLS)/) + { + $in_skipped_section = 1; + } + + if ($in_skipped_section) + { + next; + } + + if ($_ =~ /^\#ifdef\s+G/) + { + print $_; + + next; + } + + + my $str = $_; + chomp($str); + my $alias = "IA__".$str; + + print <