/[pkgs]/devel/perl/10_fix_h2ph_include_quote
ViewVC logotype

Contents of /devel/perl/10_fix_h2ph_include_quote

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Wed Mar 11 22:01:05 2009 UTC (8 months, 1 week ago) by spot
Branch: MAIN
CVS Tags: F-12-split, perl-5_10_0-63_fc11, perl-5_10_0-61_fc11, perl-5_10_0-80_fc12, perl-5_10_0-81_fc12, perl-5_10_0-84_fc13, perl-5_10_0-82_fc13, perl-5_10_0-77_fc12, perl-5_10_0-83_fc13, perl-5_10_0-71_fc12, perl-5_10_0-75_fc12, perl-5_10_0-73_fc12, perl-5_10_0-68_fc11, perl-5_10_0-67_fc11, perl-5_10_0-64_fc11, perl-5_10_0-72_fc12, F-11-split, perl-5_10_0-62_fc11, perl-5_10_0-69_fc12, perl-5_10_0-79_fc12, perl-5_10_0-78_fc12, perl-5_10_0-70_fc12, perl-5_10_0-74_fc12, perl-5_10_0-66_fc11, perl-5_10_0-65_fc11, perl-5_10_0-76_fc12, HEAD
reorder @INC, fix bz 489204, merge useful debian patches
1 Allow the quote mark delimiter also for those #include directives chased with
2 "h2ph -a". Debian bug #479762.
3
4 Also add the directory prefix of the current file when the quote syntax is
5 used; 'require' will only look in @INC, not the current directory.
6
7 Upstream change 33835.
8 diff --git a/utils/h2ph.PL b/utils/h2ph.PL
9 index 0bfea18..a3ff285 100644
10 --- a/utils/h2ph.PL
11 +++ b/utils/h2ph.PL
12 @@ -85,7 +85,7 @@ sub reindent($) {
13 }
14
15 my ($t, $tab, %curargs, $new, $eval_index, $dir, $name, $args, $outfile);
16 -my ($incl, $incl_type, $next);
17 +my ($incl, $incl_type, $incl_quote, $next);
18 while (defined (my $file = next_file())) {
19 if (-l $file and -d $file) {
20 link_if_possible($file) if ($opt_l);
21 @@ -186,9 +186,10 @@ while (defined (my $file = next_file())) {
22 print OUT $t,"unless(defined(\&$name)) {\n sub $name () {\t",$new,";}\n}\n";
23 }
24 }
25 - } elsif (/^(include|import|include_next)\s*[<\"](.*)[>\"]/) {
26 + } elsif (/^(include|import|include_next)\s*([<\"])(.*)[>\"]/) {
27 $incl_type = $1;
28 - $incl = $2;
29 + $incl_quote = $2;
30 + $incl = $3;
31 if (($incl_type eq 'include_next') ||
32 ($opt_e && exists($bad_file{$incl}))) {
33 $incl =~ s/\.h$/.ph/;
34 @@ -221,6 +222,10 @@ while (defined (my $file = next_file())) {
35 "warn(\$\@) if \$\@;\n");
36 } else {
37 $incl =~ s/\.h$/.ph/;
38 + # copy the prefix in the quote syntax (#include "x.h") case
39 + if ($incl !~ m|/| && $incl_quote eq q{"} && $file =~ m|^(.*)/|) {
40 + $incl = "$1/$incl";
41 + }
42 print OUT $t,"require '$incl';\n";
43 }
44 } elsif (/^ifdef\s+(\w+)/) {
45 @@ -724,8 +729,13 @@ sub queue_includes_from
46 $line .= <HEADER>;
47 }
48
49 - if ($line =~ /^#\s*include\s+<(.*?)>/) {
50 - push(@ARGV, $1) unless $Is_converted{$1};
51 + if ($line =~ /^#\s*include\s+([<"])(.*?)[>"]/) {
52 + my ($delimiter, $new_file) = ($1, $2);
53 + # copy the prefix in the quote syntax (#include "x.h") case
54 + if ($delimiter eq q{"} && $file =~ m|^(.*)/|) {
55 + $new_file = "$1/$new_file";
56 + }
57 + push(@ARGV, $new_file) unless $Is_converted{$new_file};
58 }
59 }
60 close HEADER;

admin@fedoraproject.org
ViewVC Help
Powered by ViewVC 1.1.2