diff options
author | José Alburquerque <jaalburqu@svn.gnome.org> | 2009-03-19 00:17:42 +0000 |
---|---|---|
committer | José Alburquerque <jaalburqu@src.gnome.org> | 2009-03-19 00:17:42 +0000 |
commit | 9c94a2ef4fecd653668521d9adce21cb469bf01a (patch) | |
tree | 2e4e50998d2b09fb65e74bcfe2fbbad34aff5817 | |
parent | 042a3ea826a8737166668ca900f1865252541e18 (diff) | |
download | glibmm-9c94a2ef4fecd653668521d9adce21cb469bf01a.tar.gz |
Modified _GET_TYPE_FUNC() to properly work with types like GtkFOOBar
2009-03-18 José Alburquerque <jaalburqu@svn.gnome.org>
* tools/m4/base.m4: Modified _GET_TYPE_FUNC() to properly work with
types like GtkFOOBar producing, for example, gtk_foo_bar_get_type()
instead of gtk_fo_obar_get_type().
svn path=/branches/glibmm-2-14/; revision=797
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | tools/m4/base.m4 | 10 |
2 files changed, 14 insertions, 2 deletions
@@ -1,3 +1,9 @@ +2009-03-18 José Alburquerque <jaalburqu@svn.gnome.org> + + * tools/m4/base.m4: Modified _GET_TYPE_FUNC() to properly work with + types like GtkFOOBar producing, for example, gtk_foo_bar_get_type() + instead of gtk_fo_obar_get_type(). + 2007-12-28 Murray Cumming <murrayc@murrayc.com> * glib/glibmm/refptr.h: Reverted this change, which should have only diff --git a/tools/m4/base.m4 b/tools/m4/base.m4 index 3ae2c2a7..8aa2d90e 100644 --- a/tools/m4/base.m4 +++ b/tools/m4/base.m4 @@ -121,9 +121,15 @@ dnl _IMPORT(section_name): define(`_IMPORT',`m4_undivert(__SEC_$1)dnl') dnl _GET_TYPE_FUNC(GtkWidget) -> gtk_widget_get_type() -dnl The funny `[A-Z]?' part of the regexp is to catch things like GdkGCFooBar. +dnl The way the macro works is that (in the inner patsubst) it first finds +dnl groups of caps, pre-pending an '_' to the groups . After (in the outer +dnl patsubst), it finds pairs of a caps and a lowercase (like 'Fo' or 'Ba'), +dnl also pre-pending an '_' to the pairs. Finally, it converts all characters +dnl to lowercase (with the translit), removing the first '_' (with substr) and +dnl appending _get_type(). This works with regular types like GtkWidget, but +dnl also multi-cap types like GdkGCFooBar or GdkFOOBar. define(`_GET_TYPE_FUNC',`dnl -m4_translit(m4_substr(m4_patsubst(`$1',`[A-Z]?[A-Z]',`_\&'),1),`[A-Z]',`[a-z]')_get_type()`'dnl +m4_translit(m4_substr(m4_patsubst(m4_patsubst(`$1',`[A-Z][A-Z]+',`_\&'),`[A-Z][a-z]',`_\&'),1),`[A-Z]',`[a-z]')_get_type()`'dnl ') dnl Define a new diversion |