Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

721 lines
20 KiB

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