[glibmm] generate_wrap_init.pl: Allow classes in files to not be registered.



commit 1758d24a4fb494ea1e403c817758023216c0a93a
Author: Josà Alburquerque <jaalburqu svn gnome org>
Date:   Mon Sep 17 14:28:14 2012 -0400

    generate_wrap_init.pl: Allow classes in files to not be registered.
    
    	* tools/m4/class_shared.m4: Add a new _NO_WRAP_INIT_REGISTRATION macro
    	used in the generate_wrap_init.pl script to recognize a file whose
    	classes should not be registered by wrap_init().
    	* tools/generate_wrap_init.pl.in (exclude_from_wrap_init): Include a
    	hash map to determine if the classes in a file should not be
    	registered with the wrapping system by the wrap_init() function.
    	(main): Modified to see if the new _NO_WRAP_INIT_REGISTRATION macro is
    	used in a file and store a true/false value in the hash map for the
    	specified file.  Also, modified to not include the includes, the
    	*_get_type() function declarations, the wrap_new() function
    	declarations and the *::get_type() invocations of the classes in the
    	file marked for no registration.
    
    	Bug #684006.

 ChangeLog                      |   19 +++++++++++++++++++
 tools/generate_wrap_init.pl.in |   20 +++++++++++++++++++-
 tools/m4/class_shared.m4       |    7 +++++++
 3 files changed, 45 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 9047de1..ae39a7c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2012-09-14  Josà Alburquerque  <jaalburquerque gmail com>
+
+	generate_wrap_init.pl: Allow classes in files to not be registered.
+
+	* tools/m4/class_shared.m4: Add a new _NO_WRAP_INIT_REGISTRATION macro
+	used in the generate_wrap_init.pl script to recognize a file whose
+	classes should not be registered by wrap_init().
+	* tools/generate_wrap_init.pl.in (exclude_from_wrap_init): Include a
+	hash map to determine if the classes in a file should not be
+	registered with the wrapping system by the wrap_init() function.
+	(main): Modified to see if the new _NO_WRAP_INIT_REGISTRATION macro is
+	used in a file and store a true/false value in the hash map for the
+	specified file.  Also, modified to not include the includes, the
+	*_get_type() function declarations, the wrap_new() function
+	declarations and the *::get_type() invocations of the classes in the
+	file marked for no registration.
+
+	Bug #684006.
+
 2012-09-16  Murray Cumming  <murrayc murrayc com>
 
 	File: Add remove_async() and remove_finish().
diff --git a/tools/generate_wrap_init.pl.in b/tools/generate_wrap_init.pl.in
index ccaf77d..59cd654 100644
--- a/tools/generate_wrap_init.pl.in
+++ b/tools/generate_wrap_init.pl.in
@@ -15,6 +15,12 @@ my %conditional_compilation = ();
 my %deprecated = ();
 my %extra_includes = ();
 
+# Hashmap telling if the registration of the classes in a file should not be
+# included in the wrap_init() function.  (This is useful for modules such as
+# gstreamermm that want to exclude plug-in types from being registered in their
+# wrap_init() function.)
+my %exclude_from_wrap_init = ();
+
 # The keys in all hashes except %extra_includes are names of header files (xyz.h),
 # corresponding to the read .hg files.
 #
@@ -183,6 +189,10 @@ while ($ARGV[0])
     {
       $deprecated{$filename_header} = 1; # This file is deprecated
     }
+    elsif (/\b_NO_WRAP_INIT_REGISTRATION\b/)
+    {
+      $exclude_from_wrap_init{$filename_header} = 1;
+    } 
   }
 
   shift @ARGV;
@@ -217,6 +227,7 @@ print "\n// #include the widget headers so that we can call the get_type() stati
 # keys %deprecated contains all filenames, not just the names of deprecated files.
 foreach my $filename_header (sort keys %deprecated)
 {
+  next if($exclude_from_wrap_init{$filename_header});
   print_with_guards($filename_header, "#include \"$filename_header\"\n");
 }
 
@@ -228,6 +239,8 @@ print "//Declarations of the *_get_type() functions:\n\n";
 
 foreach my $filename_header (sort keys %objects)
 {
+  next if($exclude_from_wrap_init{$filename_header});
+
   my @objects_in_file = @{$objects{$filename_header}};
   my $message = "";
   foreach my $i (@objects_in_file)
@@ -271,6 +284,8 @@ print "\n//Declarations of the *_Class::wrap_new() methods, instead of including
 
 foreach my $filename_header (sort keys %objects)
 {
+  next if($exclude_from_wrap_init{$filename_header});
+
   my @objects_in_file = @{$objects{$filename_header}};
   my $message = "";
   foreach my $i (@objects_in_file)
@@ -394,6 +409,8 @@ print "  // Map gtypes to gtkmm wrapper-creation functions:\n";
 
 foreach my $filename_header (sort keys %objects)
 {
+  next if($exclude_from_wrap_init{$filename_header});
+
   my @objects_in_file = @{$objects{$filename_header}};
   my $message = "";
   foreach my $i (@objects_in_file)
@@ -411,6 +428,8 @@ print "  // Register the gtkmm gtypes:\n";
 
 foreach my $filename_header (sort keys %objects)
 {
+  next if($exclude_from_wrap_init{$filename_header});
+
   my @objects_in_file = @{$objects{$filename_header}};
   my $message = "";
   foreach my $i (@objects_in_file)
@@ -430,4 +449,3 @@ $namespace_whole_close
 EOF
 
 exit 0;
-
diff --git a/tools/m4/class_shared.m4 b/tools/m4/class_shared.m4
index c3c1f57..4175b57 100644
--- a/tools/m4/class_shared.m4
+++ b/tools/m4/class_shared.m4
@@ -319,3 +319,10 @@ define(`__BOOL_DEPRECATED__',`$1')
 _POP()
 ')
 
+dnl _NO_WRAP_INIT_REGISTRATION
+dnl Used to tag the classes in a file as one not be registered by the
+dnl wrap_init() function (all the classes in the file will not be registered).
+dnl This macro does not generate any code in the .h and .cc files.
+dnl generate_wrap_init.pl will look for this in the original .hg file.
+dnl
+define(`_NO_WRAP_INIT_REGISTRATION',`')dnl



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