home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / perl / 5871 < prev    next >
Encoding:
Text File  |  1992-09-11  |  1.5 KB  |  52 lines

  1. Path: sparky!uunet!usc!news!netlabs!lwall
  2. From: lwall@netlabs.com (Larry Wall)
  3. Newsgroups: comp.lang.perl
  4. Subject: Re: inctree, p. 274 in Programming Perl
  5. Keywords: inctree #include tree
  6. Message-ID: <1992Sep11.174538.22982@netlabs.com>
  7. Date: 11 Sep 92 17:45:38 GMT
  8. References: <BuDq2p.GM9@unx.sas.com>
  9. Organization: NetLabs, Inc.
  10. Lines: 40
  11.  
  12. In article <BuDq2p.GM9@unx.sas.com> bultman@sonny.unx.sas.com (David Bultman) writes:
  13. : I typed in the inctree program in Programming Perl and something is awry.
  14. : (p. 274 in the First edition, I checked the latest edition and the program
  15. :  is identical)
  16. : If anyone has any ideas or previous experience with this, your feedback 
  17. : would be greatly appreciated.
  18. : When I try inctree main.c and main.c looks like,
  19. : -- here --
  20. : #include <stdio.h>
  21. : main()
  22. : {
  23. : }
  24. : -- to here --
  25. : the output is,
  26. : Start program
  27. : main.c
  28. :     /usr/include/stdio.h
  29. :     /usr/include/sys/stdsyms.h
  30. :         
  31. :         /usr/include/stdio.h  DUPLICATE
  32. :         main.c  DUPLICATE
  33.  
  34. This line must be failing somehow:
  35.  
  36. :         if ($stack[$#stack-1] eq $filename) {  # Leaving file.
  37.  
  38. The clue is the blank line, and the double indentation to the line after.
  39. The inctree script is looking for lines that match /^# \d/.  It
  40. would appear that something in the cpp output is spoofing it into
  41. thinking it has a valid line directive when it doesn't.  Since the
  42. invalid line directive is processed as a "push", and there's no
  43. corresponding "pop", inctree doesn't return to stdio.h when it should
  44. because stdio.h is buried down at $#stack - 2.
  45.  
  46. Larry
  47.