[glibmm] gmmproc: _WRAP_METHOD: Allow return types to have commas.



commit d6305e213cca1dbc97cf09fb3afb4b04ddc814f5
Author: Josà Alburquerque <jaalburqu svn gnome org>
Date:   Tue Oct 11 11:56:14 2011 -0400

    gmmproc: _WRAP_METHOD: Allow return types to have commas.
    
    	* tools/pm/WrapParser.pm (string_split_commas): Modify so that when
    	splitting by commas, '<' and '>' are taken into account by levels as
    	is done with '(' and ')'.  This so that if a return type in a
    	_WRAP_METHOD has a comma (which is possible, e.g. with std::map<>) the
    	return type is not split incorrectly.
    	(read_file): Modified so that '<' and '>' are tokens by which to
    	split.
    	* tools/pm/Output.pm (output_wrap_meth): Add `' around the return type
    	when calling the _METHOD() and _STATIC_METHOD() M4 macros so that
    	commas don't split the return type into more than one argument.
    	* tools/m4/method.m4: Do the same (for the return type) in _METHOD()
    	and _STATIC_METHOD() when calling the _CONVERT() macro for the same
    	reason as above.
    
    	Bug #661401

 ChangeLog              |   20 ++++++++++++++++++++
 tools/m4/method.m4     |    8 ++++----
 tools/pm/Output.pm     |    4 ++--
 tools/pm/WrapParser.pm |   10 +++++-----
 4 files changed, 31 insertions(+), 11 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b1ee3c2..4b86508 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,25 @@
 2011-10-10  Josà Alburquerque  <jaalburqu svn gnome org>
 
+	gmmproc: _WRAP_METHOD: Allow return types to have commas.
+
+	* tools/pm/WrapParser.pm (string_split_commas): Modify so that when
+	splitting by commas, '<' and '>' are taken into account by levels as
+	is done with '(' and ')'.  This so that if a return type in a
+	_WRAP_METHOD has a comma (which is possible, e.g. with std::map<>) the
+	return type is not split incorrectly.
+	(read_file): Modified so that '<' and '>' are tokens by which to
+	split.
+	* tools/pm/Output.pm (output_wrap_meth): Add `' around the return type
+	when calling the _METHOD() and _STATIC_METHOD() M4 macros so that
+	commas don't split the return type into more than one argument.
+	* tools/m4/method.m4: Do the same (for the return type) in _METHOD()
+	and _STATIC_METHOD() when calling the _CONVERT() macro for the same
+	reason as above.
+	
+	Bug #661401
+
+2011-10-10  Josà Alburquerque  <jaalburqu svn gnome org>
+
 	SimpleAction: Wrap the signals and properties.
 
 	* gio/src/simpleaction.hg: Wrap the signals using the
diff --git a/tools/m4/method.m4 b/tools/m4/method.m4
index 943eb31..e194e72 100644
--- a/tools/m4/method.m4
+++ b/tools/m4/method.m4
@@ -24,7 +24,7 @@ ifelse(`$11',,dnl
 `ifelse(`$14',,dnl If no output parameter is specified
 `ifelse(`$3',void,dnl If it returns voids:
 `$2(ifelse(`$7',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$6',,,`, ')$6);' dnl It it returns non-void:
-,`  return _CONVERT($4,$3,`$2`'(ifelse(`$7',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$6',,,`, ')$6)');'dnl
+,`  return _CONVERT($4,`$3',`$2`'(ifelse(`$7',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$6',,,`, ')$6)');'dnl
 )'dnl End if it returns voids.
 dnl An output parameter is specified:
 ,`  _INITIALIZE($15,$4,`$14',`$2`'(ifelse(`$7',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$6',,,`, ')$6)',$16);'dnl
@@ -32,7 +32,7 @@ dnl An output parameter is specified:
 dnl If is errthrow or refreturn
 `ifelse(`$9',,,`  GError* gerror = 0;')
 ifelse(`$14',,dnl If no output parameter is specified:
-`  ifelse(`$3',void,,``$3' retvalue = ')_CONVERT($4,$3,`$2`'(ifelse(`$7',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$6',,,`, ')$6)');'dnl
+`  ifelse(`$3',void,,``$3' retvalue = ')_CONVERT($4,`$3',`$2`'(ifelse(`$7',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$6',,,`, ')$6)');'dnl
 dnl An output parameter is specified:
 ,`  _INITIALIZE($15,$4,`$14',`$2`'(ifelse(`$7',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$6',,,`, ')$6)',$16);'dnl
 )dnl
@@ -70,14 +70,14 @@ $3 __CPPNAME__::$1($5)
 {
 ifelse(`$7'`$8',,dnl
 `ifelse(`$11',,dnl If no output parameter is specified
-`ifelse(`$3',void,,`  return ')_CONVERT($4,$3,`$2`'($6)');
+`ifelse(`$3',void,,`  return ')_CONVERT($4,`$3',`$2`'($6)');
 'dnl
 dnl An output parameter is specified:
 ,`  _INITIALIZE($12,$4,`$11',`$2`'($6)',$13);'
 )',dnl End if an output parameter is specified.
 `ifelse(`$8',,,`  GError* gerror = 0;')
 ifelse(`$11',,dnl If no output parameter is specified:
-  ifelse(`$3',void,,``$3' retvalue = ')_CONVERT($4,$3,`$2`'($6)');
+  ifelse(`$3',void,,``$3' retvalue = ')_CONVERT($4,`$3',`$2`'($6)');
 dnl An output parameter is specified:
 ,`  _INITIALIZE($12,$4,`$11',`$2`'($6)',$13);'dnl
 )dnl
diff --git a/tools/pm/Output.pm b/tools/pm/Output.pm
index 10acc10..c3d4a58 100644
--- a/tools/pm/Output.pm
+++ b/tools/pm/Output.pm
@@ -356,7 +356,7 @@ sub output_wrap_meth($$$$$$$)
     #Implementation:
     my $str;
     if ($$objCppfunc{static}) {
-      $str = sprintf("_STATIC_METHOD(%s,%s,%s,%s,\`%s\',\`%s\',%s,%s,%s,%s,%s,%s,%s)dnl\n",
+      $str = sprintf("_STATIC_METHOD(%s,%s,`%s\',%s,\`%s\',\`%s\',%s,%s,%s,%s,%s,%s,%s)dnl\n",
         $$objCppfunc{name},
         $$objCDefsFunc{c_name},
         $$objCppfunc{rettype},
@@ -373,7 +373,7 @@ sub output_wrap_meth($$$$$$$)
         $line_num
         );
     } else {
-      $str = sprintf("_METHOD(%s,%s,%s,%s,\`%s\',\`%s\',%s,%s,%s,%s,%s,\`%s\',%s,%s,%s,%s)dnl\n",
+      $str = sprintf("_METHOD(%s,%s,`%s\',%s,\`%s\',\`%s\',%s,%s,%s,%s,%s,\`%s\',%s,%s,%s,%s)dnl\n",
         $$objCppfunc{name},
         $$objCDefsFunc{c_name},
         $$objCppfunc{rettype},
diff --git a/tools/pm/WrapParser.pm b/tools/pm/WrapParser.pm
index 1b34f3c..04abd0f 100644
--- a/tools/pm/WrapParser.pm
+++ b/tools/pm/WrapParser.pm
@@ -682,15 +682,15 @@ sub string_split_commas($)
   my @out;
   my $level = 0;
   my $str = "";
-  my @in = split(/([,()])/, $in);
+  my @in = split(/([,()<>])/, $in);
 
   while ($#in > -1)
     {
       my $t = shift @in;
 
       next if ($t eq "");
-      $level++ if ($t eq "(");
-      $level-- if ($t eq ")");
+      $level++ if ($t eq "(" or $t eq "<");
+      $level-- if ($t eq ")" or $t eq ">");
 
       # skip , inside functions  Ie.  void (*)(int,int)
       if ( ($t eq ",") && !$level) 
@@ -761,9 +761,9 @@ sub read_file($$$)
   #      *.
   #      //
   #      any char proceeded by \
-  #      symbols ;{}"`'()
+  #      symbols ;{}"`'()<>
   #      newline
-  @tokens = split(/(\#[lf] \S+\n)|([#A-Za-z0-9_]+)|(\/\*\*)|(\/\*)|(\*\/)|(\/\/)|(\\.)|([;{}"'`()])|(\n)/,
+  @tokens = split(/(\#[lf] \S+\n)|([#A-Za-z0-9_]+)|(\/\*\*)|(\/\*)|(\*\/)|(\/\/)|(\\.)|([;{}"'`()<>])|(\n)/,
                          $strIn);
 }
 



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