Move sub print_preprocessor_statements() into Utilities.pm.
authorJames E. Keenan <jkeenan@cpan.org>
Sat, 10 Apr 2010 01:42:30 +0000 (21:42 -0400)
committerSteffen Mueller <smueller@cpan.org>
Tue, 12 Jul 2011 18:53:56 +0000 (20:53 +0200)
dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm
dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Utilities.pm

index 3a7a8e5..80cde38 100644 (file)
@@ -21,6 +21,7 @@ use ExtUtils::ParseXS::Utilities qw(
   map_type
   standard_XS_defs
   assign_func_args
+  print_preprocessor_statements
 );
 
 our @ISA = qw(Exporter);
@@ -1878,38 +1879,4 @@ sub death {
   exit 1;
 }
 
-sub print_preprocessor_statements {
-  my ($self, $XSS_work_idx, $BootCode_ref) = @_;
-
-  my $statement = $+;
-  if ($statement eq 'if') {
-    $XSS_work_idx = @{ $self->{XSStack} };
-    push(@{ $self->{XSStack} }, {type => 'if'});
-  }
-  else {
-    death ("Error: `$statement' with no matching `if'")
-      if $self->{XSStack}->[-1]{type} ne 'if';
-    if ($self->{XSStack}->[-1]{varname}) {
-      push(@{ $self->{InitFileCode} }, "#endif\n");
-      push(@{ $BootCode_ref },     "#endif");
-    }
-
-    my(@fns) = keys %{$self->{XSStack}->[-1]{functions}};
-    if ($statement ne 'endif') {
-      # Hide the functions defined in other #if branches, and reset.
-      @{$self->{XSStack}->[-1]{other_functions}}{@fns} = (1) x @fns;
-      @{$self->{XSStack}->[-1]}{qw(varname functions)} = ('', {});
-    }
-    else {
-      my($tmp) = pop(@{ $self->{XSStack} });
-      0 while (--$XSS_work_idx
-           && $self->{XSStack}->[$XSS_work_idx]{type} ne 'if');
-      # Keep all new defined functions
-      push(@fns, keys %{$tmp->{other_functions}});
-      @{$self->{XSStack}->[$XSS_work_idx]{functions}}{@fns} = (1) x @fns;
-    }
-  }
-  return ($self, $XSS_work_idx, $BootCode_ref);
-}
-
 1;
index 6b09c4b..dfd8ca4 100644 (file)
@@ -19,6 +19,7 @@ our (@ISA, @EXPORT_OK);
   map_type
   standard_XS_defs
   assign_func_args
+  print_preprocessor_statements
 );
 
 =head1 NAME
@@ -502,4 +503,38 @@ sub assign_func_args {
   return join(", ", @func_args);
 }
 
+sub print_preprocessor_statements {
+  my ($self, $XSS_work_idx, $BootCode_ref) = @_;
+
+  my $statement = $+;
+  if ($statement eq 'if') {
+    $XSS_work_idx = @{ $self->{XSStack} };
+    push(@{ $self->{XSStack} }, {type => 'if'});
+  }
+  else {
+    death ("Error: `$statement' with no matching `if'")
+      if $self->{XSStack}->[-1]{type} ne 'if';
+    if ($self->{XSStack}->[-1]{varname}) {
+      push(@{ $self->{InitFileCode} }, "#endif\n");
+      push(@{ $BootCode_ref },     "#endif");
+    }
+
+    my(@fns) = keys %{$self->{XSStack}->[-1]{functions}};
+    if ($statement ne 'endif') {
+      # Hide the functions defined in other #if branches, and reset.
+      @{$self->{XSStack}->[-1]{other_functions}}{@fns} = (1) x @fns;
+      @{$self->{XSStack}->[-1]}{qw(varname functions)} = ('', {});
+    }
+    else {
+      my($tmp) = pop(@{ $self->{XSStack} });
+      0 while (--$XSS_work_idx
+           && $self->{XSStack}->[$XSS_work_idx]{type} ne 'if');
+      # Keep all new defined functions
+      push(@fns, keys %{$tmp->{other_functions}});
+      @{$self->{XSStack}->[$XSS_work_idx]{functions}}{@fns} = (1) x @fns;
+    }
+  }
+  return ($self, $XSS_work_idx, $BootCode_ref);
+}
+
 1;