[win32] add AS patch#24, remove one other instance of error_no
[p5sagit/p5-mst-13.2.git] / utils / h2ph.PL
CommitLineData
4633a7c4 1#!/usr/local/bin/perl
2
3use Config;
ee580363 4use File::Basename qw(basename dirname);
4633a7c4 5
6# List explicitly here the variables you want Configure to
7# generate. Metaconfig only looks for shell variables, so you
8# have to mention them as if they were shell variables, not
9# %Config entries. Thus you write
10# $startperl
11# to ensure Configure will look for $Config{startperl}.
12# Wanted: $archlibexp
13
14# This forces PL files to create target in same directory as PL file.
15# This is so that make depend always knows where to find PL derivatives.
44a8e56a 16chdir dirname($0);
17$file = basename($0, '.PL');
774d564b 18$file .= '.com' if $^O eq 'VMS';
4633a7c4 19
20open OUT,">$file" or die "Can't create $file: $!";
21
22print "Extracting $file (with variable substitutions)\n";
23
24# In this section, perl variables will be expanded during extraction.
25# You can use $Config{...} to use Configure variables.
26
27print OUT <<"!GROK!THIS!";
5f05dabc 28$Config{startperl}
29 eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}'
30 if \$running_under_some_shell;
154e51a4 31!GROK!THIS!
32
4633a7c4 33# In the following, perl variables are not expanded during extraction.
34
35print OUT <<'!NO!SUBS!';
154e51a4 36
2c2acf7e 37use Config;
b306bf39 38use File::Path qw(mkpath);
50f6e060 39use Getopt::Std;
40
1d3434b8 41getopts('Dd:rlha');
42die "-r and -a options are mutually exclusive\n" if ($opt_r and $opt_a);
43@inc_dirs = inc_dirs() if $opt_a;
2c2acf7e 44
b306bf39 45my $Exit = 0;
46
50f6e060 47my $Dest_dir = $opt_d || $Config{installsitearch};
b306bf39 48die "Destination directory $Dest_dir doesn't exist or isn't a directory\n"
49 unless -d $Dest_dir;
154e51a4 50
fe14fcc3 51@isatype = split(' ',<<END);
52 char uchar u_char
53 short ushort u_short
54 int uint u_int
55 long ulong u_long
fb73857a 56 FILE key_t caddr_t
fe14fcc3 57END
58
55204971 59@isatype{@isatype} = (1) x @isatype;
748a9306 60$inif = 0;
fe14fcc3 61
62@ARGV = ('-') unless @ARGV;
154e51a4 63
50f6e060 64while (defined ($file = next_file())) {
65 if (-l $file and -d $file) {
66 link_if_possible($file) if ($opt_l);
67 next;
68 }
69
5f05dabc 70 # Recover from header files with unbalanced cpp directives
71 $t = '';
72 $tab = 0;
73
50f6e060 74 # $eval_index goes into ``#line'' directives, to help locate syntax errors:
75 $eval_index = 1;
76
fe14fcc3 77 if ($file eq '-') {
78 open(IN, "-");
79 open(OUT, ">-");
ee580363 80 } else {
fe14fcc3 81 ($outfile = $file) =~ s/\.h$/.ph/ || next;
82 print "$file -> $outfile\n";
83 if ($file =~ m|^(.*)/|) {
84 $dir = $1;
b306bf39 85 mkpath "$Dest_dir/$dir";
154e51a4 86 }
1d3434b8 87
88 if ($opt_a) { # automagic mode: locate header file in @inc_dirs
89 foreach (@inc_dirs) {
90 chdir $_;
91 last if -f $file;
92 }
93 }
94
b306bf39 95 open(IN,"$file") || (($Exit = 1),(warn "Can't open $file: $!\n"),next);
96 open(OUT,">$Dest_dir/$outfile") || die "Can't create $outfile: $!\n";
154e51a4 97 }
154e51a4 98 while (<IN>) {
99 chop;
100 while (/\\$/) {
101 chop;
102 $_ .= <IN>;
103 chop;
104 }
ee580363 105 print OUT "# $_\n" if $opt_D;
154e51a4 106 if (s:/\*:\200:g) {
107 s:\*/:\201:g;
108 s/\200[^\201]*\201//g; # delete single line comments
109 if (s/\200.*//) { # begin multi-line comment?
110 $_ .= '/*';
111 $_ .= <IN>;
112 redo;
113 }
114 }
1d2dff63 115 if (s/^\s*\#\s*//) {
154e51a4 116 if (s/^define\s+(\w+)//) {
117 $name = $1;
118 $new = '';
119 s/\s+$//;
120 if (s/^\(([\w,\s]*)\)//) {
121 $args = $1;
b306bf39 122 my $proto = '() ';
154e51a4 123 if ($args ne '') {
b306bf39 124 $proto = '';
154e51a4 125 foreach $arg (split(/,\s*/,$args)) {
55204971 126 $arg =~ s/^\s*([^\s].*[^\s])\s*$/$1/;
154e51a4 127 $curargs{$arg} = 1;
128 }
129 $args =~ s/\b(\w)/\$$1/g;
130 $args = "local($args) = \@_;\n$t ";
131 }
132 s/^\s+//;
5f05dabc 133 expr();
ee580363 134 $new =~ s/(["\\])/\\$1/g; #"]);
135 $new = reindent($new);
136 $args = reindent($args);
154e51a4 137 if ($t ne '') {
ee580363 138 $new =~ s/(['\\])/\\$1/g; #']);
50f6e060 139 if ($opt_h) {
140 print OUT $t,
ee580363 141 "eval \"\\n#line $eval_index $outfile\\n\" . 'sub $name $proto\{\n$t ${args}eval q($new);\n$t}' unless defined(\&$name);\n";
50f6e060 142 $eval_index++;
143 } else {
144 print OUT $t,
ee580363 145 "eval 'sub $name $proto\{\n$t ${args}eval q($new);\n$t}' unless defined(\&$name);\n";
50f6e060 146 }
ee580363 147 } else {
148 print OUT "unless(defined(\&$name)) {\n sub $name $proto\{\n\t${args}eval q($new);\n }\n}\n";
154e51a4 149 }
150 %curargs = ();
ee580363 151 } else {
154e51a4 152 s/^\s+//;
5f05dabc 153 expr();
154e51a4 154 $new = 1 if $new eq '';
ee580363 155 $new = reindent($new);
156 $args = reindent($args);
154e51a4 157 if ($t ne '') {
ee580363 158 $new =~ s/(['\\])/\\$1/g; #']);
50f6e060 159 if ($opt_h) {
160 print OUT $t,"eval \"\\n#line $eval_index $outfile\\n\" . 'sub $name () {",$new,";}' unless defined(\&$name);\n";
161 $eval_index++;
162 } else {
163 print OUT $t,"eval 'sub $name () {",$new,";}' unless defined(\&$name);\n";
164 }
ee580363 165 } else {
166 print OUT $t,"unless(defined(\&$name)) {\n sub $name () {\t",$new,";}\n}\n";
154e51a4 167 }
168 }
ee580363 169 } elsif (/^(include|import)\s*[<"](.*)[>"]/) {
170 ($incl = $2) =~ s/\.h$/.ph/;
d9d8d8de 171 print OUT $t,"require '$incl';\n";
ee580363 172 } elsif(/^include_next\s*[<"](.*)[>"]/) {
173 ($incl = $1) =~ s/\.h$/.ph/;
ee580363 174 print OUT ($t,
1d2dff63 175 "eval {\n");
176 $tab += 4;
177 $t = "\t" x ($tab / 8) . ' ' x ($tab % 8);
178 print OUT ($t,
179 "my(\%INCD) = map { \$INC{\$_} => 1 } ",
180 "(grep { \$_ eq \"$incl\" } keys(\%INC));\n");
181 print OUT ($t,
182 "my(\@REM) = map { \"\$_/$incl\" } ",
183 "(grep { not exists(\$INCD{\"\$_/$incl\"})",
184 "and -f \"\$_/$incl\" } \@INC);\n");
185 print OUT ($t,
186 "require \"\$REM[0]\" if \@REM;\n");
187 $tab -= 4;
188 $t = "\t" x ($tab / 8) . ' ' x ($tab % 8);
189 print OUT ($t,
190 "};\n");
191 print OUT ($t,
192 "warn(\$\@) if \$\@;\n");
ee580363 193 } elsif (/^ifdef\s+(\w+)/) {
194 print OUT $t,"if(defined(&$1)) {\n";
154e51a4 195 $tab += 4;
196 $t = "\t" x ($tab / 8) . ' ' x ($tab % 8);
ee580363 197 } elsif (/^ifndef\s+(\w+)/) {
198 print OUT $t,"unless(defined(&$1)) {\n";
199 $tab += 4;
200 $t = "\t" x ($tab / 8) . ' ' x ($tab % 8);
201 } elsif (s/^if\s+//) {
154e51a4 202 $new = '';
748a9306 203 $inif = 1;
5f05dabc 204 expr();
748a9306 205 $inif = 0;
ee580363 206 print OUT $t,"if($new) {\n";
154e51a4 207 $tab += 4;
208 $t = "\t" x ($tab / 8) . ' ' x ($tab % 8);
ee580363 209 } elsif (s/^elif\s+//) {
154e51a4 210 $new = '';
748a9306 211 $inif = 1;
5f05dabc 212 expr();
748a9306 213 $inif = 0;
154e51a4 214 $tab -= 4;
215 $t = "\t" x ($tab / 8) . ' ' x ($tab % 8);
ee580363 216 print OUT $t,"}\n elsif($new) {\n";
154e51a4 217 $tab += 4;
218 $t = "\t" x ($tab / 8) . ' ' x ($tab % 8);
ee580363 219 } elsif (/^else/) {
154e51a4 220 $tab -= 4;
221 $t = "\t" x ($tab / 8) . ' ' x ($tab % 8);
ee580363 222 print OUT $t,"} else {\n";
154e51a4 223 $tab += 4;
224 $t = "\t" x ($tab / 8) . ' ' x ($tab % 8);
ee580363 225 } elsif (/^endif/) {
154e51a4 226 $tab -= 4;
227 $t = "\t" x ($tab / 8) . ' ' x ($tab % 8);
228 print OUT $t,"}\n";
ee580363 229 } elsif(/^undef\s+(\w+)/) {
230 print OUT $t, "undef(&$1) if defined(&$1);\n";
231 } elsif(/^error\s+(.*)/) {
232 print OUT $t, "die(\"$1\");\n";
233 } elsif(/^warning\s+(.*)/) {
234 print OUT $t, "warn(\"$1\");\n";
235 } elsif(/^ident\s+(.*)/) {
236 print OUT $t, "# $1\n";
154e51a4 237 }
1d2dff63 238 } elsif(/^\s*(typedef\s*)?enum\b/) {
239 until(/\}.*?;/) {
240 chomp($next = <IN>);
241 $_ .= $next;
242 print OUT "# $next\n" if $opt_D;
243 }
244 s@/\*.*?\*/@@g;
245 s/\s+/ /g;
246 /^\s?(typedef\s?)?enum\s?([a-zA-Z_]\w*)?\s?\{(.*)\}\s?([a-zA-Z_]\w*)?\s?;/;
247 ($enum_subs = $3) =~ s/\s//g;
248 @enum_subs = split(/,/, $enum_subs);
249 $enum_val = -1;
250 for $enum (@enum_subs) {
251 ($enum_name, $enum_value) = $enum =~ /^([a-zA-Z_]\w*)(=.+)?$/;
252 $enum_value =~ s/^=//;
253 $enum_val = (length($enum_value) ? $enum_value : $enum_val + 1);
254 if ($opt_h) {
255 print OUT ($t,
256 "eval(\"\\n#line $eval_index $outfile\\n",
257 "sub $enum_name () \{ $enum_val; \}\") ",
258 "unless defined(\&$enum_name);\n");
259 ++ $eval_index;
260 } else {
261 print OUT ($t,
262 "eval(\"sub $enum_name () \{ $enum_val; \}\") ",
263 "unless defined(\&$enum_name);\n");
264 }
265 }
154e51a4 266 }
267 }
268 print OUT "1;\n";
1d3434b8 269
270 $is_converted{$file} = 1;
271 queue_includes_from($file) if ($opt_a);
154e51a4 272}
273
b306bf39 274exit $Exit;
275
ee580363 276sub reindent($) {
277 my($text) = shift;
278 $text =~ s/\n/\n /g;
279 $text =~ s/ /\t/g;
280 $text;
281}
282
154e51a4 283sub expr {
ee580363 284 if(keys(%curargs)) {
285 my($joined_args) = join('|', keys(%curargs));
286 }
154e51a4 287 while ($_ ne '') {
ee580363 288 s/^\&\&// && do { $new .= " &&"; next;}; # handle && operator
289 s/^\&([\(a-z\)]+)/$1/i; # hack for things that take the address of
154e51a4 290 s/^(\s+)// && do {$new .= ' '; next;};
50f6e060 291 s/^(0X[0-9A-F]+)[UL]*//i && do {$new .= lc($1); next;};
292 s/^(-?\d+\.\d+E[-+]\d+)F?//i && do {$new .= $1; next;};
293 s/^(\d+)\s*[LU]*//i && do {$new .= $1; next;};
154e51a4 294 s/^("(\\"|[^"])*")// && do {$new .= $1; next;};
295 s/^'((\\"|[^"])*)'// && do {
296 if ($curargs{$1}) {
297 $new .= "ord('\$$1')";
ee580363 298 } else {
154e51a4 299 $new .= "ord('$1')";
300 }
301 next;
302 };
5f05dabc 303 # replace "sizeof(foo)" with "{foo}"
304 # also, remove * (C dereference operator) to avoid perl syntax
305 # problems. Where the %sizeof array comes from is anyone's
306 # guess (c2ph?), but this at least avoids fatal syntax errors.
307 # Behavior is undefined if sizeof() delimiters are unbalanced.
308 # This code was modified to able to handle constructs like this:
309 # sizeof(*(p)), which appear in the HP-UX 10.01 header files.
310 s/^sizeof\s*\(// && do {
311 $new .= '$sizeof';
312 my $lvl = 1; # already saw one open paren
313 # tack { on the front, and skip it in the loop
314 $_ = "{" . "$_";
315 my $index = 1;
316 # find balanced closing paren
317 while ($index <= length($_) && $lvl > 0) {
318 $lvl++ if substr($_, $index, 1) eq "(";
319 $lvl-- if substr($_, $index, 1) eq ")";
320 $index++;
321 }
322 # tack } on the end, replacing )
323 substr($_, $index - 1, 1) = "}";
324 # remove pesky * operators within the sizeof argument
325 substr($_, 0, $index - 1) =~ s/\*//g;
326 next;
327 };
50f6e060 328 # Eliminate typedefs
329 /\(([\w\s]+)[\*\s]*\)\s*[\w\(]/ && do {
330 foreach (split /\s+/, $1) { # Make sure all the words are types,
331 last unless ($isatype{$_} or $_ eq 'struct');
332 }
333 s/\([\w\s]+[\*\s]*\)// && next; # then eliminate them.
334 };
ee580363 335 # struct/union member, including arrays:
336 s/^([_A-Z]\w*(\[[^\]]+\])?((\.|->)[_A-Z]\w*(\[[^\]]+\])?)+)//i && do {
50f6e060 337 $id = $1;
ee580363 338 $id =~ s/(\.|(->))([^\.\-]*)/->\{$3\}/g;
339 $id =~ s/\b([^\$])($joined_args)/$1\$$2/g if length($joined_args);
340 while($id =~ /\[\s*([^\$\&\d\]]+)\]/) {
341 my($index) = $1;
342 $index =~ s/\s//g;
343 if(exists($curargs{$index})) {
344 $index = "\$$index";
345 } else {
346 $index = "&$index";
347 }
348 $id =~ s/\[\s*([^\$\&\d\]]+)\]/[$index]/;
349 }
350 $new .= " (\$$id)";
50f6e060 351 };
154e51a4 352 s/^([_a-zA-Z]\w*)// && do {
353 $id = $1;
fe14fcc3 354 if ($id eq 'struct') {
355 s/^\s+(\w+)//;
356 $id .= ' ' . $1;
357 $isatype{$id} = 1;
ee580363 358 } elsif ($id =~ /^((un)?signed)|(long)|(short)$/) {
50f6e060 359 while (s/^\s+(\w+)//) { $id .= ' ' . $1; }
fe14fcc3 360 $isatype{$id} = 1;
361 }
154e51a4 362 if ($curargs{$id}) {
ee580363 363 $new .= "\$$id";
364 $new .= '->' if /^[\[\{]/;
365 } elsif ($id eq 'defined') {
154e51a4 366 $new .= 'defined';
ee580363 367 } elsif (/^\(/) {
e5d73d77 368 s/^\((\w),/("$1",/ if $id =~ /^_IO[WR]*$/i; # cheat
154e51a4 369 $new .= " &$id";
ee580363 370 } elsif ($isatype{$id}) {
fe14fcc3 371 if ($new =~ /{\s*$/) {
372 $new .= "'$id'";
ee580363 373 } elsif ($new =~ /\(\s*$/ && /^[\s*]*\)/) {
fe14fcc3 374 $new =~ s/\(\s*$//;
375 s/^[\s*]*\)//;
ee580363 376 } else {
b276c83d 377 $new .= q(').$id.q(');
fe14fcc3 378 }
ee580363 379 } else {
c07a80fd 380 if ($inif && $new !~ /defined\s*\($/) {
748a9306 381 $new .= '(defined(&' . $id . ') ? &' . $id . ' : 0)';
ee580363 382 } elsif (/^\[/) {
383 $new .= " \$$id";
384 } else {
748a9306 385 $new .= ' &' . $id;
386 }
154e51a4 387 }
388 next;
389 };
fb21d8eb 390 s/^(.)// && do { if ($1 ne '#') { $new .= $1; } next;};
154e51a4 391 }
392}
50f6e060 393
394
395# Handle recursive subdirectories without getting a grotesquely big stack.
396# Could this be implemented using File::Find?
397sub next_file
398{
399 my $file;
400
401 while (@ARGV) {
402 $file = shift @ARGV;
403
404 if ($file eq '-' or -f $file or -l $file) {
405 return $file;
406 } elsif (-d $file) {
407 if ($opt_r) {
408 expand_glob($file);
409 } else {
410 print STDERR "Skipping directory `$file'\n";
411 }
1d3434b8 412 } elsif ($opt_a) {
413 return $file;
414 } else {
50f6e060 415 print STDERR "Skipping `$file': not a file or directory\n";
416 }
417 }
418
419 return undef;
420}
421
422
423# Put all the files in $directory into @ARGV for processing.
424sub expand_glob
425{
426 my ($directory) = @_;
427
428 $directory =~ s:/$::;
429
430 opendir DIR, $directory;
431 foreach (readdir DIR) {
432 next if ($_ eq '.' or $_ eq '..');
433
434 # expand_glob() is going to be called until $ARGV[0] isn't a
435 # directory; so push directories, and unshift everything else.
1d3434b8 436 if (-d "$directory/$_") { push @ARGV, "$directory/$_" }
437 else { unshift @ARGV, "$directory/$_" }
50f6e060 438 }
439 closedir DIR;
440}
441
442
443# Given $file, a symbolic link to a directory in the C include directory,
444# make an equivalent symbolic link in $Dest_dir, if we can figure out how.
445# Otherwise, just duplicate the file or directory.
446sub link_if_possible
447{
448 my ($dirlink) = @_;
449 my $target = eval 'readlink($dirlink)';
450
451 if ($target =~ m:^\.\./: or $target =~ m:^/:) {
452 # The target of a parent or absolute link could leave the $Dest_dir
453 # hierarchy, so let's put all of the contents of $dirlink (actually,
454 # the contents of $target) into @ARGV; as a side effect down the
455 # line, $dirlink will get created as an _actual_ directory.
456 expand_glob($dirlink);
457 } else {
458 if (-l "$Dest_dir/$dirlink") {
459 unlink "$Dest_dir/$dirlink" or
460 print STDERR "Could not remove link $Dest_dir/$dirlink: $!\n";
461 }
1d3434b8 462
50f6e060 463 if (eval 'symlink($target, "$Dest_dir/$dirlink")') {
464 print "Linking $target -> $Dest_dir/$dirlink\n";
465
466 # Make sure that the link _links_ to something:
467 if (! -e "$Dest_dir/$target") {
1d3434b8 468 mkpath("$Dest_dir/$target", 0755) or
50f6e060 469 print STDERR "Could not create $Dest_dir/$target/\n";
470 }
471 } else {
472 print STDERR "Could not symlink $target -> $Dest_dir/$dirlink: $!\n";
473 }
474 }
475}
476
477
1d3434b8 478# Push all #included files in $file onto our stack, except for STDIN
479# and files we've already processed.
480sub queue_includes_from
481{
482 my ($file) = @_;
483 my $line;
484
485 return if ($file eq "-");
486
487 open HEADER, $file or return;
488 while (defined($line = <HEADER>)) {
489 while (/\\$/) { # Handle continuation lines
490 chop $line;
491 $line .= <HEADER>;
492 }
493
494 if ($line =~ /^#\s*include\s+<(.*?)>/) {
495 push(@ARGV, $1) unless $is_converted{$1};
496 }
497 }
498 close HEADER;
499}
500
501
502# Determine include directories; $Config{usrinc} should be enough for (all
503# non-GCC?) C compilers, but gcc uses an additional include directory.
504sub inc_dirs
505{
506 my $from_gcc = `$Config{cc} -v 2>&1`;
507 $from_gcc =~ s:^Reading specs from (.*?)/specs\b.*:$1/include:s;
508
509 length($from_gcc) ? ($from_gcc, $Config{usrinc}) : ($Config{usrinc});
510}
511
512
50f6e060 5131;
514
154e51a4 515##############################################################################
1fef88e7 516__END__
517
518=head1 NAME
519
520h2ph - convert .h C header files to .ph Perl header files
521
522=head1 SYNOPSIS
523
1d3434b8 524B<h2ph [-d destination directory] [-r | -a] [-l] [headerfiles]>
1fef88e7 525
526=head1 DESCRIPTION
154e51a4 527
1fef88e7 528I<h2ph>
154e51a4 529converts any C header files specified to the corresponding Perl header file
530format.
531It is most easily run while in /usr/include:
154e51a4 532
533 cd /usr/include; h2ph * sys/*
534
50f6e060 535or
536
537 cd /usr/include; h2ph -r -l .
538
b306bf39 539The output files are placed in the hierarchy rooted at Perl's
540architecture dependent library directory. You can specify a different
541hierarchy with a B<-d> switch.
542
fe14fcc3 543If run with no arguments, filters standard input to standard output.
1fef88e7 544
50f6e060 545=head1 OPTIONS
546
547=over 4
548
549=item -d destination_dir
550
551Put the resulting B<.ph> files beneath B<destination_dir>, instead of
552beneath the default Perl library location (C<$Config{'installsitsearch'}>).
553
554=item -r
555
556Run recursively; if any of B<headerfiles> are directories, then run I<h2ph>
1d3434b8 557on all files in those directories (and their subdirectories, etc.). B<-r>
558and B<-a> are mutually exclusive.
559
560=item -a
561
562Run automagically; convert B<headerfiles>, as well as any B<.h> files
563which they include. This option will search for B<.h> files in all
564directories which your C compiler ordinarily uses. B<-a> and B<-r> are
565mutually exclusive.
50f6e060 566
567=item -l
568
569Symbolic links will be replicated in the destination directory. If B<-l>
570is not specified, then links are skipped over.
571
572=item -h
573
574Put ``hints'' in the .ph files which will help in locating problems with
575I<h2ph>. In those cases when you B<require> a B<.ph> file containing syntax
576errors, instead of the cryptic
577
578 [ some error condition ] at (eval mmm) line nnn
579
580you will see the slightly more helpful
581
582 [ some error condition ] at filename.ph line nnn
583
584However, the B<.ph> files almost double in size when built using B<-h>.
585
1d3434b8 586=item -D
587
588Include the code from the B<.h> file as a comment in the B<.ph> file.
589This is primarily used for debugging I<h2ph>.
590
50f6e060 591=back
592
1fef88e7 593=head1 ENVIRONMENT
594
154e51a4 595No environment variables are used.
1fef88e7 596
597=head1 FILES
598
599 /usr/include/*.h
600 /usr/include/sys/*.h
601
154e51a4 602etc.
1fef88e7 603
604=head1 AUTHOR
605
154e51a4 606Larry Wall
1fef88e7 607
608=head1 SEE ALSO
609
154e51a4 610perl(1)
1fef88e7 611
612=head1 DIAGNOSTICS
613
154e51a4 614The usual warnings if it can't read or write the files involved.
1fef88e7 615
616=head1 BUGS
617
154e51a4 618Doesn't construct the %sizeof array for you.
1fef88e7 619
154e51a4 620It doesn't handle all C constructs, but it does attempt to isolate
621definitions inside evals so that you can get at the definitions
622that it can translate.
1fef88e7 623
154e51a4 624It's only intended as a rough tool.
625You may need to dicker with the files produced.
1fef88e7 626
627=cut
628
154e51a4 629!NO!SUBS!
4633a7c4 630
631close OUT or die "Can't close $file: $!";
632chmod 0755, $file or die "Can't reset permissions for $file: $!\n";
633exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';