glibmm r797 - branches/glibmm-2-12 branches/glibmm-2-12/tools/m4 branches/glibmm-2-14 branches/glibmm-2-14/tools/m4 branches/glibmm-2-16 branches/glibmm-2-16/tools/m4 branches/glibmm-2-18 branches/glibmm-2-18/tools/m4 trunk trunk/tools/m4



Author: jaalburqu
Date: Thu Mar 19 00:17:42 2009
New Revision: 797
URL: http://svn.gnome.org/viewvc/glibmm?rev=797&view=rev

Log:
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().

Modified:
   branches/glibmm-2-12/ChangeLog
   branches/glibmm-2-12/tools/m4/base.m4
   branches/glibmm-2-14/ChangeLog
   branches/glibmm-2-14/tools/m4/base.m4
   branches/glibmm-2-16/ChangeLog
   branches/glibmm-2-16/tools/m4/base.m4
   branches/glibmm-2-18/ChangeLog
   branches/glibmm-2-18/tools/m4/base.m4
   trunk/ChangeLog
   trunk/tools/m4/base.m4

Modified: branches/glibmm-2-12/tools/m4/base.m4
==============================================================================
--- branches/glibmm-2-12/tools/m4/base.m4	(original)
+++ branches/glibmm-2-12/tools/m4/base.m4	Thu Mar 19 00:17:42 2009
@@ -121,9 +121,15 @@
 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

Modified: branches/glibmm-2-14/tools/m4/base.m4
==============================================================================
--- branches/glibmm-2-14/tools/m4/base.m4	(original)
+++ branches/glibmm-2-14/tools/m4/base.m4	Thu Mar 19 00:17:42 2009
@@ -121,9 +121,15 @@
 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

Modified: branches/glibmm-2-16/tools/m4/base.m4
==============================================================================
--- branches/glibmm-2-16/tools/m4/base.m4	(original)
+++ branches/glibmm-2-16/tools/m4/base.m4	Thu Mar 19 00:17:42 2009
@@ -121,9 +121,15 @@
 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

Modified: branches/glibmm-2-18/tools/m4/base.m4
==============================================================================
--- branches/glibmm-2-18/tools/m4/base.m4	(original)
+++ branches/glibmm-2-18/tools/m4/base.m4	Thu Mar 19 00:17:42 2009
@@ -121,9 +121,15 @@
 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

Modified: trunk/tools/m4/base.m4
==============================================================================
--- trunk/tools/m4/base.m4	(original)
+++ trunk/tools/m4/base.m4	Thu Mar 19 00:17:42 2009
@@ -121,9 +121,15 @@
 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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]