summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnu/usr.bin/perl/utils/h2ph.PL42
1 files changed, 24 insertions, 18 deletions
diff --git a/gnu/usr.bin/perl/utils/h2ph.PL b/gnu/usr.bin/perl/utils/h2ph.PL
index 4c5a6cd0569..6517d31e1a0 100644
--- a/gnu/usr.bin/perl/utils/h2ph.PL
+++ b/gnu/usr.bin/perl/utils/h2ph.PL
@@ -147,23 +147,7 @@ while (defined (my $file = next_file())) {
s/^\s+//;
expr();
$new =~ s/(["\\])/\\$1/g; #"]);
- EMIT:
- $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 $proto\{\n$t ${args}eval q($new);\n$t}' unless defined(\&$name);\n";
- $eval_index++;
- } else {
- print OUT $t,
- "eval 'sub $name $proto\{\n$t ${args}eval q($new);\n$t}' unless defined(\&$name);\n";
- }
- } else {
- print OUT "unless(defined(\&$name)) {\n sub $name $proto\{\n\t${args}eval q($new);\n }\n}\n";
- }
- %curargs = ();
+ EMIT($proto);
} else {
s/^\s+//;
expr();
@@ -380,7 +364,7 @@ while (defined (my $file = next_file())) {
$new =~ s/&$_\b/\$$_/g for @local_variables;
$new =~ s/(["\\])/\\$1/g; #"]);
# now that's almost like a macro (we hope)
- goto EMIT;
+ EMIT($proto);
}
}
$Is_converted{$file} = 1;
@@ -400,6 +384,28 @@ if ($opt_e && (scalar(keys %bad_file) > 0)) {
exit $Exit;
+sub EMIT {
+ my $proto = shift;
+
+ $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 $proto\{\n$t ${args}eval q($new);\n$t}' unless defined(\&$name);\n";
+ $eval_index++;
+ } else {
+ print OUT $t,
+ "eval 'sub $name $proto\{\n$t ${args}eval q($new);\n$t}' unless defined(\&$name);\n";
+ }
+ } else {
+ print OUT "unless(defined(\&$name)) {\n sub $name $proto\{\n\t${args}eval q($new);\n }\n}\n";
+ }
+ %curargs = ();
+ return;
+}
+
sub expr {
$new = '"(assembly code)"' and return if /\b__asm__\b/; # freak out.
my $joined_args;