Adding phincter into h2ph 
Author Message
 Adding phincter into h2ph

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 ----


+     $known{$file} = 1;
+ }
+

      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

!                   $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"

Phone: (919) 469-8300 fax: (919) 460-8355  |



Sun, 05 Mar 1995 01:49:48 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Trying to add exception handling, getting errors after adding Error.pm to path

2. h2ph

3. h2ph in perl 5?

4. h2ph in perl 5: suggestion

5. need to beef up h2ph

6. Problems with H2ph

7. h2ph and feature switches

8. Problems with h2ph

9. h2ph script

10. h2ph ?

11. h2ph on HP/UX 9.01 workstation

12. perl-h2ph/mirror

 

 
Powered by phpBB® Forum Software