[perl-Cairo] Slightly tweak the automatic marshaller code generation



commit 9254f11b99158be622edf518d79f92f2620b0eeb
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date:   Sat Apr 30 19:06:39 2011 +0200

    Slightly tweak the automatic marshaller code generation
    
    Specifically, rework the backend guard stuff as it wasn't being used at all.

 Makefile.PL       |   16 +++++++---------
 inc/MakeHelper.pm |   18 +++++++++---------
 2 files changed, 16 insertions(+), 18 deletions(-)
---
diff --git a/Makefile.PL b/Makefile.PL
index 7c520c6..4c31262 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -61,12 +61,6 @@ if ($@ ne '') {
 	exit 0;
 }
 
-my %backend_guards = (
-	'cairo_pdf_surface_t' => 'CAIRO_HAS_PDF_SURFACE',
-	'cairo_ps_surface_t'  => 'CAIRO_HAS_PS_SURFACE',
-	'cairo_svg_surface_t' => 'CAIRO_HAS_SVG_SURFACE',
-);
-
 my %objects = (
 	'cairo_t *'             => 'Cairo::Context',
 	'cairo_font_face_t *'   => 'Cairo::FontFace',
@@ -331,12 +325,16 @@ if ($have_cairo_1_8) {
 
 # --------------------------------------------------------------------------- #
 
+my %object_guards = ();
+
 my %enum_guards = (
-	cairo_svg_version_t => $backend_guards{cairo_svg_surface_t},
+	cairo_svg_version_t => '#ifdef CAIRO_HAS_SVG_SURFACE',
 );
-MakeHelper::do_enums (\%enums, \%enum_guards);
 
 my %flag_guards = ();
+
+MakeHelper::do_enums (\%enums, \%enum_guards);
+
 MakeHelper::do_flags (\%flags, \%flag_guards);
 
 my @xs_files = qw(
@@ -363,7 +361,7 @@ MakeHelper::write_boot (
 );
 
 my @typemaps = MakeHelper::do_typemaps (\%objects, \%structs, \%enums, \%flags,
-                                        \%backend_guards,
+                                        \%object_guards,
                                         \%enum_guards,
                                         \%flag_guards);
 push @typemaps, 'cairo-perl.typemap';
diff --git a/inc/MakeHelper.pm b/inc/MakeHelper.pm
index 3daa129..15fea0f 100644
--- a/inc/MakeHelper.pm
+++ b/inc/MakeHelper.pm
@@ -78,7 +78,7 @@ sub do_typemaps
 	my %structs = %{shift ()};
 	my %enums = %{shift ()};
 	my %flags = %{shift ()};
-	my %backend_guards = %{shift ()};
+	my %object_guards = %{shift ()};
 	my %enum_guards = %{shift ()};
 	my %flag_guards = %{shift ()};
 
@@ -201,8 +201,8 @@ EOS
 		my $mangled = mangle ($type);
 		my $ref = reference ($type);
 
-		if (exists $backend_guards{$type}) {
-			print HEADER "#ifdef $backend_guards{$type}\n";
+		if (exists $object_guards{$type}) {
+			print HEADER "$object_guards{$type}\n";
 		}
 
 		print HEADER <<"EOS";
@@ -215,8 +215,8 @@ typedef $type ${type}_ornull;
 #define newSV${mangled}_ornull(object)	(((object) == NULL) ? &PL_sv_undef : newSV$mangled(object))
 EOS
 
-		if (exists $backend_guards{$type}) {
-			print HEADER "#endif /* $backend_guards{$type} */\n";
+		if (exists $object_guards{$type}) {
+			print HEADER "#endif /* $object_guards{$type} */\n";
 		}
 	}
 
@@ -251,7 +251,7 @@ EOS
 		next unless @{$enums{$type}};
 
 		if (exists $enum_guards{$type}) {
-			print HEADER "#ifdef $enum_guards{$type}\n";
+			print HEADER "$enum_guards{$type}\n";
 		}
 
 		print HEADER <<"EOS";
@@ -278,7 +278,7 @@ EOS
 		next unless @{$flags{$type}};
 
 		if (exists $flag_guards{$type}) {
-			print HEADER "#ifdef $flag_guards{$type}\n";
+			print HEADER "$flag_guards{$type}\n";
 		}
 
 		print HEADER <<"EOS";
@@ -385,7 +385,7 @@ EOS
 		my $tree_to = enum_if_tree_to (@enum_values);
 
 		if (exists $guards{$type}) {
-			print ENUMS "#ifdef $guards{$type}\n\n";
+			print ENUMS "$guards{$type}\n\n";
 		}
 
 		print ENUMS <<"EOS";
@@ -497,7 +497,7 @@ EOS
 		my $tree_to = flag_if_tree_to (@flag_values);
 
 		if (exists $guards{$type}) {
-			print FLAGS "#ifdef $guards{$type}\n\n";
+			print FLAGS "$guards{$type}\n\n";
 		}
 
 		print FLAGS <<"EOS";



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