diff options
-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-10-12 Armin Burgmeier <armin@openismus.com> * tools/m4/base.m4: Added a new section called SECTION_HEADER_FIRST 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 |