[glibmm] gmmproc: _WRAP_[CREATE|CTOR|METHOD]: Allow any order of {} options.



commit c552d83e234227217638c38af15547501b3d2ea2
Author: Josà Alburquerque <jaalburqu svn gnome org>
Date:   Wed Jan 16 01:30:54 2013 -0500

    gmmproc: _WRAP_[CREATE|CTOR|METHOD]: Allow any order of {} options.
    
    	* tools/pm/Function.pm: Make it possible to use any order desired of
    	the options to specify whether parameters should be optional or should
    	be re-ordered in the _WRAP_* directives.

 ChangeLog            |    8 ++++++++
 tools/pm/Function.pm |   50 +++++++++++++++++++++++++++++++++++++-------------
 2 files changed, 45 insertions(+), 13 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index fef7f46..6db2cb0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2013-01-16  Josà Alburquerque  <jaalburquerque gmail com>
+
+	gmmproc: _WRAP_[CREATE|CTOR|METHOD]: Allow any order of {} options.
+
+	* tools/pm/Function.pm: Make it possible to use any order desired of
+	the options to specify whether parameters should be optional or should
+	be re-ordered in the _WRAP_* directives.
+
 2013-01-14  Kjell Ahlstedt  <kjell ahlstedt bredband net>
 
 	Gio::File: Remove refreturn to avoid memory leaks.
diff --git a/tools/pm/Function.pm b/tools/pm/Function.pm
index 4da2bf3..8934b2c 100644
--- a/tools/pm/Function.pm
+++ b/tools/pm/Function.pm
@@ -260,15 +260,26 @@ sub parse_param($$)
       # Determine if the param is optional, an output param or if a C param
       # name should be mapped to the current C++ index (if name ends with
       # {c_name>>?}). (A '.' for the name means use the C++ as the C name).
-      # '@' - Means that it is an output parameter.
+      # '>>' - Means that it is an output parameter.
       # '?' - Means that it is an optional parameter.
-      if ($name =~ /\{\s*(\w+|\.)?\s*(>>)?\s*(\??)\s*\}$/)
+      if ($name =~ /\{(.*)\}$/)
       {
-        $flags = FLAG_PARAM_OPTIONAL if($3);
-        $flags |= FLAG_PARAM_OUTPUT if($2);
-        $mapping = $1 if($1);
-        $name =~ s/\{\s*(\w+|\.)?\s*(>>)?\s*\??\s*\}$//;
-        $mapping = $name if($mapping eq ".");
+        # Get the options.
+        my $options = $1;
+ 
+        # Remove the options from the name.
+        $name =~ s/\{.*\}$//;
+ 
+        # Check if param should be optional or an output param.
+        $flags = FLAG_PARAM_OPTIONAL if($options =~ /\?/);
+        $flags |= FLAG_PARAM_OUTPUT if($options =~ />>/);
+ 
+        # Check if it should be mapped to a C param.
+        if ($options =~ /(\w+|\.)/)
+        {
+          $mapping = $1;
+          $mapping = $name if($mapping eq ".");
+        }
       }
 
       push(@$param_types, $type);
@@ -335,13 +346,26 @@ sub parse_param($$)
   # Determine if the param is optional, an output param or if a C param
   # name should be mapped to the current C++ index (if name ends with
   # {c_name>>?}). (A '.' for the name means use the C++ as the C name).
-  if ($name =~ /\{\s*(\w+|\.)?\s*(>>)?\s*(\??)\s*\}$/)
+  # '>>' - Means that it is an output parameter.
+  # '?' - Means that it is an optional parameter.
+  if ($name =~ /\{(.*)\}$/)
   {
-    $flags = FLAG_PARAM_OPTIONAL if($3);
-    $flags |= FLAG_PARAM_OUTPUT if($2);
-    $mapping = $1 if($1);
-    $name =~ s/\{\s*(\w+|\.)?\s*(>>)?\??\s*\}$//;
-    $mapping = $name if($mapping eq ".");
+    # Get the options.
+    my $options = $1;
+ 
+    # Remove the options from the name.
+    $name =~ s/\{.*\}$//;
+        
+    # Check if param should be optional or an output param.
+    $flags = FLAG_PARAM_OPTIONAL if($options =~ /\?/);
+    $flags |= FLAG_PARAM_OUTPUT if($options =~ />>/);
+      
+    # Check if it should be mapped to a C param.
+    if ($options =~ /(\w+|\.)/)
+    {
+      $mapping = $1;
+      $mapping = $name if($mapping eq ".");
+    }
   }
 
   push(@$param_types, $type);



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