[glibmm] gmmproc: _WRAP_SIGNAL(): Allow signals to be deprecated.



commit 7a6c0ac34de755cd77f321afde69f60971d372c6
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Mar 23 10:05:57 2012 +0100

    gmmproc: _WRAP_SIGNAL(): Allow signals to be deprecated.
    
    	* tools/pm/WrapParser.pm: on_wrap_signal(): Parse an optional
        	deprecated "the explanation" parameter.
    	* tools/pm/Output.pm: output_wrap_signal_decl(): Take a deprecated bool
        	and deprecated_docs, passing them to the m4 macro.
    	* tools/m4/signal.m4: _SIGNAL_PROXY(): Take a deprecated bool parameter
    	and use it to ifdef-out the signal declaration.
    	However, we cannot put the ifdef around the default signal handler,
    	because that would break ABI.

 ChangeLog              |   13 +++++++++++++
 tools/m4/signal.m4     |   23 ++++++++++++++---------
 tools/pm/DocsParser.pm |    2 +-
 tools/pm/Output.pm     |   10 ++++++----
 tools/pm/WrapParser.pm |   30 +++++++++++++++++++++---------
 5 files changed, 55 insertions(+), 23 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0883bd1..f854e2c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2012-03-23  Murray Cumming  <murrayc murrayc com>
+
+	gmmproc: _WRAP_SIGNAL(): Allow signals to be deprecated.
+
+	* tools/pm/WrapParser.pm: on_wrap_signal(): Parse an optional
+    	deprecated "the explanation" parameter.
+	* tools/pm/Output.pm: output_wrap_signal_decl(): Take a deprecated bool
+    	and deprecated_docs, passing them to the m4 macro.
+	* tools/m4/signal.m4: _SIGNAL_PROXY(): Take a deprecated bool parameter
+	and use it to ifdef-out the signal declaration.
+	However, we cannot put the ifdef around the default signal handler, 
+	because that would break ABI.
+
 2012-03-22  Murray Cumming  <murrayc murrayc com>
 
 	Gio: MenuItem: set_action_and_target(): Add one without the cariant.
diff --git a/tools/m4/signal.m4 b/tools/m4/signal.m4
index 9cf4305..cab9382 100644
--- a/tools/m4/signal.m4
+++ b/tools/m4/signal.m4
@@ -11,21 +11,26 @@ dnl               $5 = cpp_return_type,
 dnl               $6 = `<cpp_arg_types>',
 dnl               $7 = `<c_args_to_cpp>',
 dnl               $8 = `custom_c_callback (boolean)',
-dnl               $9 = `refdoc_comment',
-dnl				  $10 = ifdef)
+dnl               $9 = `deprecated' (boolean),
+dnl               $10 = `refdoc_comment',
+dnl               $11 = ifdef)
 
 define(`_SIGNAL_PROXY',`
-$9
+$10
 
-ifelse(`$10',,,`#ifdef $10'
+ifelse(`$11',,,`#ifdef $11'
 )dnl
+ifelse(`$9',,,`_DEPRECATE_IFDEF_START
+')dnl
   Glib::SignalProxy`'_NUM($6)< $5`'_COMMA_PREFIX($6) > signal_$4`'();
-ifelse(`$10',,,`#endif // $10
+ifelse(`$9',,,`_DEPRECATE_IFDEF_END
+')dnl
+ifelse(`$11',,,`#endif // $11
 ')dnl
 dnl
 _PUSH(SECTION_ANONYMOUS_NAMESPACE)
 
-ifelse(`$10',,,`#ifdef $10'
+ifelse(`$11',,,`#ifdef $11'
 )dnl
 dnl
 ifelse($2`'_NUM($3)`'$5`'_NUM($6),`void0void0',`dnl
@@ -112,18 +117,18 @@ static const Glib::SignalProxyInfo __CPPNAME__`'_signal_$4_info =
 };
 ')dnl endif
 
-ifelse(`$10',,,`#endif // $10
+ifelse(`$11',,,`#endif // $11
 ')dnl
 
 _SECTION(SECTION_CC_SIGNALPROXIES)
 
-ifelse(`$10',,,`#ifdef $10'
+ifelse(`$11',,,`#ifdef $11'
 )dnl
 Glib::SignalProxy`'_NUM($6)< $5`'_COMMA_PREFIX($6) > __CPPNAME__::signal_$4`'()
 {
   return Glib::SignalProxy`'_NUM($6)< $5`'_COMMA_PREFIX($6) >(this, &__CPPNAME__`'_signal_$4_info);
 }
-ifelse(`$10',,,`#endif // $10
+ifelse(`$11',,,`#endif // $11
 ')dnl
 
 _POP()')
diff --git a/tools/pm/DocsParser.pm b/tools/pm/DocsParser.pm
index 0a71137..646e367 100644
--- a/tools/pm/DocsParser.pm
+++ b/tools/pm/DocsParser.pm
@@ -233,7 +233,7 @@ sub parse_on_cdata($$)
 }
 
 
-# $strCommentBlock lookup_documentation($strFunctionName)
+# $strCommentBlock lookup_documentation($strFunctionName, $deprecation_docs)
 sub lookup_documentation($$)
 {
   my ($functionName, $deprecation_docs) = @_;
diff --git a/tools/pm/Output.pm b/tools/pm/Output.pm
index 2c1de2c..8fa21d7 100644
--- a/tools/pm/Output.pm
+++ b/tools/pm/Output.pm
@@ -473,11 +473,11 @@ sub output_wrap_create($$$)
   }
 }
 
-# void output_wrap_sig_decl($filename, $line_num, $objCSignal, $objCppfunc, $signal_name, $bCustomCCallback)
+# void output_wrap_sig_decl($filename, $line_num, $objCSignal, $objCppfunc, $signal_name, $bCustomCCallback, $ifdef, $merge_doxycomment_with_previous, $deprecated, $deprecation_docs)
 # custom_signalproxy_name is "" when no type conversion is required - a normal templates SignalProxy will be used instead.
-sub output_wrap_sig_decl($$$$$$$$)
+sub output_wrap_sig_decl($$$$$$$$$$)
 {
-  my ($self, $filename, $line_num, $objCSignal, $objCppfunc, $signal_name, $bCustomCCallback, $ifdef, $merge_doxycomment_with_previous) = @_;
+  my ($self, $filename, $line_num, $objCSignal, $objCppfunc, $signal_name, $bCustomCCallback, $ifdef, $merge_doxycomment_with_previous, $deprecated, $deprecation_docs) = @_;
 
 # _SIGNAL_PROXY(c_signal_name, c_return_type, `<c_arg_types_and_names>',
 #               cpp_signal_name, cpp_return_type, `<cpp_arg_types>',`<c_args_to_cpp>',
@@ -490,7 +490,7 @@ sub output_wrap_sig_decl($$$$$$$$)
 
   # Get the existing signal documentation from the parsed docs.
   my $documentation =
-    DocsParser::lookup_documentation("$$objCSignal{class}::$underscored_signal_name", "");
+    DocsParser::lookup_documentation("$$objCSignal{class}::$underscored_signal_name", $deprecation_docs);
 
   # Create a merged Doxygen comment block for the signal from the looked up
   # docs (the block will also contain a prototype of the slot as an example).
@@ -505,6 +505,7 @@ sub output_wrap_sig_decl($$$$$$$$)
   {
     # Strip leading whitespace
     $doxycomment =~ s/^\s+//;
+
     # We don't have something to add, so just close the comment.
     if($doxycomment eq "")
     {
@@ -529,6 +530,7 @@ sub output_wrap_sig_decl($$$$$$$$)
     $objCppfunc->args_types_only(),
     convert_args_c_to_cpp($objCSignal, $objCppfunc, $line_num),
     $bCustomCCallback, #When this is true, it will not write the *_callback implementation for you.
+    $deprecated,
     $doxycomment,
     $ifdef
   );
diff --git a/tools/pm/WrapParser.pm b/tools/pm/WrapParser.pm
index aafaf95..c18c1b0 100644
--- a/tools/pm/WrapParser.pm
+++ b/tools/pm/WrapParser.pm
@@ -1130,6 +1130,8 @@ sub on_wrap_signal($$)
   my $bCustomCCallback = 0;
   my $bRefreturn = 0;
   my $ifdef;
+  my $argDeprecated = "";
+  my $deprecation_docs = "";
 
   while($#args >= 2) # If optional arguments are there.
   {
@@ -1154,7 +1156,17 @@ sub on_wrap_signal($$)
       $bRefreturn = 1;
     }
 
-  	elsif($argRef =~ /^ifdef(.*)/) #If ifdef is at the start.
+    if($argRef =~ /^deprecated(.*)/) #If deprecated is at the start.
+    {
+      $argDeprecated = "deprecated";
+
+      if($1 ne "")
+      {
+        $deprecation_docs = string_unquote(string_trim($1));
+      }
+    }
+
+    elsif($argRef =~ /^ifdef(.*)/) #If ifdef is at the start.
     {
     	$ifdef = $1;
     }
@@ -1162,7 +1174,7 @@ sub on_wrap_signal($$)
 
   $self->output_wrap_signal($argCppDecl, $argCName, $$self{filename}, $$self{line_num},
                             $bCustomDefaultHandler, $bNoDefaultHandler, $bCustomCCallback,
-                            $bRefreturn, $ifdef, $merge_doxycomment_with_previous);
+                            $bRefreturn, $ifdef, $merge_doxycomment_with_previous, $argDeprecated, $deprecation_docs);
 }
 
 # void on_wrap_vfunc()
@@ -1331,10 +1343,10 @@ sub output_wrap_check($$$$$$)
   return '';
 }
 
-# void output_wrap($CppDecl, $signal_name, $filename, $line_num, $bCustomDefaultHandler, $bNoDefaultHandler, $bCustomCCallback, $bRefreturn)
-sub output_wrap_signal($$$$$$$$$)
+# void output_wrap($CppDecl, $signal_name, $filename, $line_num, $bCustomDefaultHandler, $bNoDefaultHandler, $bCustomCCallback, $bRefreturn, $ifdef, $merge_doxycomment_with_previous, $deprecated, $deprecation_docs)
+sub output_wrap_signal($$$$$$$$$$$)
 {
-  my ($self, $CppDecl, $signal_name, $filename, $line_num, $bCustomDefaultHandler, $bNoDefaultHandler, $bCustomCCallback, $bRefreturn, $ifdef, $merge_doxycomment_with_previous) = @_;
+  my ($self, $CppDecl, $signal_name, $filename, $line_num, $bCustomDefaultHandler, $bNoDefaultHandler, $bCustomCCallback, $bRefreturn, $ifdef, $merge_doxycomment_with_previous, $deprecated, $deprecation_docs) = @_;
 
   #Some checks:
   return if ($self->output_wrap_check($CppDecl, $signal_name,
@@ -1359,14 +1371,14 @@ sub output_wrap_signal($$$$$$$$$)
     # Check for failed lookup.
     if($objCSignal eq 0) 
     {
-    print STDERR "$signal_name\n";
-      $objOutputter->output_wrap_failed($signal_name, 
-        " signal defs lookup failed");
+      print STDERR "$signal_name\n";
+        $objOutputter->output_wrap_failed($signal_name, 
+          " signal defs lookup failed");
       return;
     }
   }
 
-  $objOutputter->output_wrap_sig_decl($filename, $line_num, $objCSignal, $objCppSignal, $signal_name, $bCustomCCallback, $ifdef, $merge_doxycomment_with_previous);
+  $objOutputter->output_wrap_sig_decl($filename, $line_num, $objCSignal, $objCppSignal, $signal_name, $bCustomCCallback, $ifdef, $merge_doxycomment_with_previous, $deprecated, $deprecation_docs);
 
   if($bNoDefaultHandler eq 0)
   {



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