home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!news!netlabs!lwall
- From: lwall@netlabs.com (Larry Wall)
- Newsgroups: comp.lang.perl
- Subject: Re: inctree, p. 274 in Programming Perl
- Keywords: inctree #include tree
- Message-ID: <1992Sep11.174538.22982@netlabs.com>
- Date: 11 Sep 92 17:45:38 GMT
- References: <BuDq2p.GM9@unx.sas.com>
- Organization: NetLabs, Inc.
- Lines: 40
-
- In article <BuDq2p.GM9@unx.sas.com> bultman@sonny.unx.sas.com (David Bultman) writes:
- :
- : I typed in the inctree program in Programming Perl and something is awry.
- : (p. 274 in the First edition, I checked the latest edition and the program
- : is identical)
- :
- : If anyone has any ideas or previous experience with this, your feedback
- : would be greatly appreciated.
- :
- : When I try inctree main.c and main.c looks like,
- : -- here --
- : #include <stdio.h>
- : main()
- : {
- : }
- : -- to here --
- :
- : the output is,
- :
- : Start program
- : main.c
- : /usr/include/stdio.h
- : /usr/include/sys/stdsyms.h
- :
- : /usr/include/stdio.h DUPLICATE
- : main.c DUPLICATE
-
- This line must be failing somehow:
-
- : if ($stack[$#stack-1] eq $filename) { # Leaving file.
-
- The clue is the blank line, and the double indentation to the line after.
- The inctree script is looking for lines that match /^# \d/. It
- would appear that something in the cpp output is spoofing it into
- thinking it has a valid line directive when it doesn't. Since the
- invalid line directive is processed as a "push", and there's no
- corresponding "pop", inctree doesn't return to stdio.h when it should
- because stdio.h is buried down at $#stack - 2.
-
- Larry
-