home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!sun-barr!west.West.Sun.COM!cronkite.Central.Sun.COM!sixgun.East.Sun.COM!matthew
- From: matthew@sunpix.East.Sun.COM (Matthew Stier - Sun NC Development Center)
- Newsgroups: comp.lang.perl
- Subject: Adding phincter into h2ph
- Date: 15 Sep 1992 17:49:48 GMT
- Organization: Sun Microsystems, Research Triangle Park, NC
- Lines: 86
- Distribution: world
- Message-ID: <1957nsINN8gt@sixgun.East.Sun.COM>
- NNTP-Posting-Host: superdave.east.sun.com
-
-
- Why scan thru the include files twice when once will do.
-
- Most of the code in phincter appears to be grabbed directly from h2ph, so
- I just merged the 'phincter' uniq code back into h2ph, and now h2ph will
- try to grab all the include files it needs.
-
- The first two segments of this patch implement phincter in h2ph. The third
- fixes a logic flaw in the handling of '#if' statements, where the subroutine
- being called, is never declared.
-
- c:
- #if defined(ALWAYS); /* Testing if ALWAYS declared */
- #if (NEVER == 12); /* NEVER is not declared */
-
- perl:
- if defined(&ALWAYS); # Testing if ALWAYS declared
- if (&NEVER == 12) # Perl tries to make a call to a subroutine
- # that does not exist.
-
- fixed perl:
- if defined(&ALWAYS); # Testing if ALWAYS declared
- if (eval '&NEVER' == 12); # Run thru eval, to catch if NEVER is not declared
-
-
- *** /depot/gnu/src/perl-4.035/h2ph Fri Sep 11 23:28:27 1992
- --- ./h2ph Tue Sep 15 12:56:25 1992
- ***************
- *** 19,24 ****
- --- 19,28 ----
- @ARGV = ('-') unless @ARGV;
-
- foreach $file (@ARGV) {
- + $known{$file} = 1;
- + }
- +
- + while ($file = shift(@ARGV)) {
- if ($file eq '-') {
- open(IN, "-");
- open(OUT, ">-");
- ***************
- *** 93,99 ****
- }
- }
- elsif (/^include\s+<(.*)>/) {
- ! ($incl = $1) =~ s/\.h$/.ph/;
- print OUT $t,"require '$incl';\n";
- }
- elsif (/^ifdef\s+(\w+)/) {
- --- 97,109 ----
- }
- }
- elsif (/^include\s+<(.*)>/) {
- ! $incl = $1;
- ! if (!defined($known{$incl}) && $file ne '-') {
- ! # first encounter! add to the list of arguments
- ! push(@ARGV, $incl);
- ! $known{$incl} = 1;
- ! }
- ! $incl =~ s/\.h$/.ph/;
- print OUT $t,"require '$incl';\n";
- }
- elsif (/^ifdef\s+(\w+)/) {
- ***************
- *** 193,199 ****
- }
- }
- else {
- ! $new .= ' &' . $id;
- }
- next;
- };
- --- 203,209 ----
- }
- }
- else {
- ! $new .= ($new =~ /defined\s*\($/ ? '&$id' : "eval '&$id'");
- }
- next;
- };
-
- --
- Matthew Lee Stier |
- Sun Microsystems --- RTP, NC 27709-3447 | "Wisconsin Escapee"
- Email: matthew.stier@East.Sun.COM |
- Phone: (919) 469-8300 fax: (919) 460-8355 |
-