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