[glibmm] Slightly clean up gross Perl code in gmmproc.in



commit ea3d93146ea1259652fcb3b443279d31b8e1b008
Author: Daniel Elstner <daniel kitta gmail com>
Date:   Fri Sep 11 02:51:35 2009 +0200

    Slightly clean up gross Perl code in gmmproc.in
    
    * tools/gmmproc.in: Try not to abuse Perl too much, and get rid of
    the 'no warnings' hammer.

 ChangeLog        |    7 +++++++
 tools/gmmproc.in |   51 ++++++++++++++++++++++-----------------------------
 2 files changed, 29 insertions(+), 29 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a131026..d1e0aa2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-09-11  Daniel Elstner  <danielk openismus com>
+
+	Slightly clean up gross Perl code in gmmproc.in
+
+	* tools/gmmproc.in: Try not to abuse Perl too much, and get rid of
+	the 'no warnings' hammer.
+
 2009-09-10  Daniel Elstner  <danielk openismus com>
 
 	Allow the C documentation to be overridden
diff --git a/tools/gmmproc.in b/tools/gmmproc.in
index d33e25b..9b735bd 100644
--- a/tools/gmmproc.in
+++ b/tools/gmmproc.in
@@ -93,61 +93,54 @@ $objOutputter->output_temp_g1($$objWrapParser{module}); # e.g. "gtk"
 # Execute m4 to get *.g2 file:
 {
   my $exitcode = $objOutputter->make_g2_from_g1();
-  if ($exitcode != 0)
+  if ($exitcode)
   {
-    if (!$main::debug)
-    {
-      $objOutputter->remove_temp_files();
-    }
+    $objOutputter->remove_temp_files() unless ($main::debug);
+
     print STDERR "m4 failed with exit code $exitcode.  Aborting...\n";
-    exit ($exitcode);
+    exit($exitcode);
   }
 }
 
 # Section out the resulting output
 $objOutputter->write_sections_to_files();
-
-# Remove temp files.
-if (!$main::debug)
-{
-  $objOutputter->remove_temp_files();
-}
+$objOutputter->remove_temp_files() unless ($main::debug);
 
 #Warn about any unwrapped function/signals:
 if ($main::unwrapped)
 { 
   my @unwrapped = GtkDefs::get_unwrapped();
+  @unwrapped = grep { exists $$_{entity_type} } @unwrapped;
+
   if (@unwrapped)
   {
-    no warnings;
+    my @methods = grep { $$_{entity_type} eq 'method' and $$_{c_name} !~ m/^_/s } @unwrapped;
+    my @signals = grep { $$_{entity_type} eq 'signal' } @unwrapped;
+    my @properties = grep { $$_{entity_type} eq 'property' } @unwrapped;
 
-    my @methods =
-      grep {$$_{entity_type} eq "method" & $$_{c_name}!~/^_/ } @unwrapped;
-    my @signals =
-      grep {$$_{entity_type} eq "signal"} @unwrapped;
-    my @properties =
-      grep {$$_{entity_type} eq "property"} @unwrapped;
+    local $, = "\ngmmproc:   ";
+    local $\ = "\n";
 
     if (@methods)
-    { 
-      print "Unwrapped functions:\n";
-      map { print "  $$_{c_name}\n"} @methods;
+    {
+      print STDERR ('gmmproc: Unwrapped functions:',
+                    map($$_{c_name}, @methods));
     }
     if (@properties)
-    { 
-      print "Unwrapped properties:\n";
-      map { print "  $$_{class}::$$_{name}\n"} @properties;
+    {
+      print STDERR ('gmmproc: Unwrapped properties:',
+                    map($$_{class} . '::' . $$_{name}, @properties));
     }
     if (@signals)
     { 
-      print "Unwrapped signals:\n";
-      map { print "  $$_{class}::$$_{name}\n"} @signals;
+      print STDERR ('gmmproc: Unwrapped signals:',
+                    map($$_{class} . '::' . $$_{name}, @signals));
     }
   }
 }
 
 # end of program
-exit();
+exit;
 
 
 ####################################################################
@@ -174,7 +167,7 @@ sub print_usage()
 
 Note: This will read srcdir/name.{hg,ccg} file and generates destdir/name.cc
 ';
-  exit (1);
+  exit(1);
 }
 
 # void parse_command_line_args()



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