$t = '';
$tab = 0;
- # $eval_index goes into ``#line'' directives, to help locate syntax errors:
+ # $eval_index goes into '#line' directives, to help locate syntax errors:
$eval_index = 1;
if ($file eq '-') {
} else {
s/^\s+//;
expr();
+
$new = 1 if $new eq '';
+
+ # Shunt around such directives as '#define FOO FOO':
+ next if $new =~ /^\s*&\Q$name\E\s*\z/;
+
$new = reindent($new);
$args = reindent($args);
- if ($t ne '') {
- $new =~ s/(['\\])/\\$1/g; #']);
-
- if ($opt_h) {
- print OUT $t,"eval \"\\n#line $eval_index $outfile\\n\" . 'sub $name () {",$new,";}' unless defined(\&$name);\n";
- $eval_index++;
- } else {
- print OUT $t,"eval 'sub $name () {",$new,";}' unless defined(\&$name);\n";
- }
- } else {
- # Shunt around such directives as `#define FOO FOO':
- next if " \&$name" eq $new;
+ $new =~ s/(['\\])/\\$1/g; #']);
- print OUT $t,"unless(defined(\&$name)) {\n sub $name () {\t",$new,";}\n}\n";
+ print OUT $t, 'eval ';
+ if ($opt_h) {
+ print OUT "\"\\n#line $eval_index $outfile\\n\" . ";
+ $eval_index++;
}
+ print OUT "'sub $name () {$new;}' unless defined(&$name);\n";
}
} elsif (/^(include|import|include_next)\s*([<\"])(.*)[>\"]/) {
$incl_type = $1;
if ($opt_r) {
expand_glob($file);
} else {
- print STDERR "Skipping directory `$file'\n";
+ print STDERR "Skipping directory '$file'\n";
}
} elsif ($opt_a) {
return $file;
} else {
- print STDERR "Skipping `$file': not a file or directory\n";
+ print STDERR "Skipping '$file': not a file or directory\n";
}
}
# non-GCC?) C compilers, but gcc uses additional include directories.
sub inc_dirs
{
- my $from_gcc = `LC_ALL=C $Config{cc} -v 2>&1`;
- if( !( $from_gcc =~ s:^Reading specs from (.*?)/specs\b.*:$1/include:s ) )
- { # gcc-4+ :
- $from_gcc = `LC_ALL=C $Config{cc} -print-search-dirs 2>&1`;
- if ( !($from_gcc =~ s/^install:\s*([^\s]+[^\s\/])([\s\/]*).*$/$1\/include/s) )
- {
- $from_gcc = '';
- };
- };
- length($from_gcc) ? ($from_gcc, $from_gcc . "-fixed", $Config{usrinc}) : ($Config{usrinc});
+ my $from_gcc = `LC_ALL=C $Config{cc} -v -E - < /dev/null 2>&1 | awk '/^#include/, /^End of search list/' | grep '^ '`;
+ length($from_gcc) ? (split(' ', $from_gcc), $Config{usrinc}) : ($Config{usrinc});
}
my $allsymbols = join " ",
@Config{'ccsymbols', 'cppsymbols', 'cppccsymbols'};
- # Split compiler pre-definitions into `key=value' pairs:
+ # Split compiler pre-definitions into 'key=value' pairs:
while ($allsymbols =~ /([^\s]+)=((\\\s|[^\s])+)/g) {
$define{$1} = $2;
if ($opt_D) {
=item -h
-Put ``hints'' in the .ph files which will help in locating problems with
+Put 'hints' in the .ph files which will help in locating problems with
I<h2ph>. In those cases when you B<require> a B<.ph> file containing syntax
errors, instead of the cryptic
=item -Q
-``Quiet'' mode; don't print out the names of the files being converted.
+'Quiet' mode; don't print out the names of the files being converted.
=back