libove@ius3.ius.cs.cmu.edu (Jay Libove) (02/25/90)
I'm trying to build mush 7.0 (as told by ucbvax.berkeley.edu) on an 80286 box running SCO Xenix v2.2.1. Compiling the 'curs_io.c' module, I get: curs_io.c(519) : error 65: `FMETA' undefined curs_io.c(656) : error 65: `FMETA' undefined (if CURSES is not defined; if I leave CURSES defined in the CFLAGS, then FMETA is undefined at 656 and a different first line) despite the fact that curs_io.c includes glob.h and the last line in glob.h unconditionally defines FMETA. Has anyone gotten mush 7.0 to build and run properly on SCO Xenix 286 v2.2.1? Please send me whatever hints you can! Thanks... -- Jay Libove Internet: libove@cs.cmu.edu 403 Village Green Blvd, Apt 203 BITNET: libove@drycas Ann Arbor, MI 48105 (313) 747-7454
bob@rel.mi.org (Bob Leffler) (02/25/90)
In article <8162@pt.cs.cmu.edu>, libove@ius3.ius.cs.cmu.edu (Jay Libove) writes: > I'm trying to build mush 7.0 (as told by ucbvax.berkeley.edu) on > an 80286 box running SCO Xenix v2.2.1. Compiling the 'curs_io.c' > module, I get: > curs_io.c(519) : error 65: `FMETA' undefined > curs_io.c(656) : error 65: `FMETA' undefined > despite the fact that curs_io.c includes glob.h and the last line > in glob.h unconditionally defines FMETA. I started working on Mush 7.0 yesterday and ran into the same problem. My quick hack was to put a #define FMETA line above each reference of FMETA in curs_io.c I haven't had the time to figure our why the define doesn't work from glob.h yet. I even copied the last three or four lines from glob.h to curs_io.c and didn't help. > Has anyone gotten mush 7.0 to build and run properly on SCO > Xenix 286 v2.2.1? Please send me whatever hints you can! After you resolve the curs_io.c problem, you'll run into something similar in glob.c. I've resolved one define problem, but I have a couple more problems that I haven't had time to resolve. bob -- Bob Leffler - Electronic Data Systems, GM Corporate Staffs Account 3011 West Grand Blvd., Room 9074, Detroit, MI 48202 (313) 556-4474 bob@rel.mi.org or {uunet!edsews, rutgers, sharkey}!rel!bob Opinions expressed may not be those of my employer.
schaefer@ogicse.ogi.edu (Barton E. Schaefer) (02/26/90)
In article <10304@rel.mi.org> bob@rel.mi.org (Bob Leffler) writes: } In article <8162@pt.cs.cmu.edu>, libove@ius3.ius.cs.cmu.edu (Jay Libove) writes: } > I'm trying to build mush 7.0 (as told by ucbvax.berkeley.edu) on } > an 80286 box running SCO Xenix v2.2.1. Compiling the 'curs_io.c' } > module, I get: } > curs_io.c(519) : error 65: `FMETA' undefined } > curs_io.c(656) : error 65: `FMETA' undefined } > despite the fact that curs_io.c includes glob.h and the last line } > in glob.h unconditionally defines FMETA. } } I started working on Mush 7.0 yesterday and ran into the same problem. My } quick hack was to put a #define FMETA line above each reference of FMETA } in curs_io.c I haven't had the time to figure our why the define doesn't } work from glob.h yet. I even copied the last three or four lines from } glob.h to curs_io.c and didn't help. I wonder if there aren't such a large number of #definitions that the Xenix compiler simply gives up and drops one of them. However, if you have managed to get Perl-3.0 up and running, here's a program that will perform a rudimentary check for what is being defined and how many definitions there are altogether. Crossposted to comp.lang.perl in case (just?) another perl hacker out there wants to improve it; it currently understands #define symbol #undef symbol #ifdef symbol #ifndef symbol #if [!] defined(sym1) {&&,||} [!] defined(sym2) [...] #if <digits> #else #endif #include but only uses its understanding to process #includes and count #defines. Seems like it could be a good skeleton for a perl-based cpp ... #! /usr/bin/perl # # Usage: ckcpp [-dvx] [-Ddefinition ...] [files ...] # -d Print debugging output # -v Toggle Verbose output (on by default) # -x Echo every line scanned # -Ddef As the C preprocessor # # Reads STDIN if no files named. $HANDLE = 'FILE00000'; sub incl { local($file) = @_; local($FILE) = $HANDLE++; if ($file =~ m:\<(.*)\>:) { $file = "/usr/include/$1"; } elsif ($file =~ m:"([^"]*)":) { $file = $1; } print "Reading $file\n" if $verbose; unless (open($FILE, "<$file")) { warn "Can't read $file\n"; return; } do scan($FILE); close($FILE); print "Finished $file\n" if $verbose; } sub endif { local($FILE) = @_; local($_); while (<$FILE>) { print if $echo; if ( /^#[ \t]*if/ ) { do endif($FILE); } elsif ( /^#[ \t]*endif/ ) { return; } } warn "#if with no #endif !!!\n"; } sub hashelse { local($FILE) = @_; local($_); while (<$FILE>) { print if $echo; if ( /^#[ \t]*if/ ) { do endif($FILE); } elsif ( /^#[ \t]*else/ || /^#[ \t]*endif/ ) { return; } } warn "#if with no #endif !!!\n"; } sub hashif { local($_) = $_[0]; local($not,$token,$symbol,$conj); if ( /^(n{0,1})def[ \t]*([_A-Za-z][_A-Za-z0-9]*)/ ) { if ($1 ne "n" && ! $defined{$2} || $1 eq "n" && $defined{$2}) { print "Skipping to #else or #endif /* $2 */\n" if $debug; do hashelse($FILE); } } elsif ( /^[ \t]*(!{0,1})[ \t]*defined\(([_A-Za-z][_A-Za-z0-9]*)\)/ ) { $not = $1; $token = $symbol = $2; $_ = $'; if ( /(\&\&){1}/ || /(\|\|){1}/ ) { $conj = $1; $_ = $'; } if ($not eq "!") { if ($defined{$symbol}) { undef $symbol; } } else { if (! $defined{$symbol}) { undef $symbol; } } if ($symbol && $conj eq "&&" || ! $symbol && $conj eq "||") { print "Testing $conj$_\n" if $debug; do hashif($_); } elsif (! $symbol) { print "Skipping to #endif /* $token */\n" if $debug; do hashelse($FILE); } } elsif ( /([0-9][0-9]*)/ ) { if ($1 == 0) { print "Skipping to #endif\n" if $debug; do hashelse($FILE); } } else { if ($debug || $echo || $verbose) { print "\tUnrecognized #if expression: $_\n"; } else { warn "Unrecognized #if expression $_\n"; } } } sub scan { local($FILE) = @_; local($_,$if); while (<$FILE>) { print if $echo; if ( /^#[ \t]*if(.*)/ ) { print "Testing $_" if $debug; do hashif($1); } elsif ( /^#[ \t]*else/ ) { do endif($FILE); } elsif ( /^#[ \t]*undef[ \t]*([_A-Za-z][_A-Za-z0-9]*)/ ) { if ($defined{$1}) { print "\tUndefining $1\n" if $debug; $defined{$1} = 0; if ($max < $define) { $max = $define; } $define--; } } elsif ( /^#[ \t]*define[ \t]([_A-Za-z][_A-Za-z0-9]*)/ ) { if (! $defined{$1}) { $define++; print "\tDefining $1\n" if $debug; $defined{$1} = $file; } else { if ($debug || $echo || $verbose) { print "\t$1 redefined (seen in $defined{$1})\n"; } else { warn "$1 redefined (seen in $defined{$1})\n"; } } } elsif ( /^#[ \t]*include[ \t]+([^ \t]*)/ ) { do incl($1); } } } $verbose = 1; while ($_ = shift(@ARGV)) { if ( /^-D(.*)={0,1}/ ) { $predef++; $predefined{$1} = "command line"; } elsif ( /^-d/ ) { $debug = 1; } elsif ( /^-x/ ) { $echo = 1; } elsif ( /^-v/ ) { $verbose = ! $verbose; } else { push(@Files,$_); } } if ($#Files < $[) { unshift(@Files,"&STDIN"); } print "Predefined $predef symbols:\n\t", join("\n\t",keys(%predefined)), "\n"; $FILE = $HANDLE; while ($_ = shift(@Files)) { open($FILE,"<$_") || warn "Can't read $_\n" && next; %defined = %predefined; $max = $define = $predef; do scan($FILE); if ($define > $max) { $max = $define; } print "Total of $define symbols defined, max was $max.\n"; } -- Bart Schaefer "February. The hangnail on the big toe of the year." -- Duffy schaefer@cse.ogi.edu (used to be cse.ogc.edu)
libove@ius3.ius.cs.cmu.edu (Jay Libove) (02/27/90)
In article <8162@pt.cs.cmu.edu>, libove@ius3.cs.cmu.edu (Jay Libove) writes: > I'm trying to build mush 7.0 (as told by ucbvax.berkeley.edu) on > an 80286 box running SCO Xenix v2.2.1. Compiling the 'curs_io.c' > module, I get: > > curs_io.c(519) : error 65: `FMETA' undefined > curs_io.c(656) : error 65: `FMETA' undefined > > despite the fact that curs_io.c includes glob.h and the last line > in glob.h unconditionally defines FMETA. Sigh. It seems that the SCO Xenix/286 v2.2.1 preprocessor grabs the line right before the glob.h definition of FMETA which is: #define META "/*?[{" and fails to parse out the /* as being in a string ... so it becomes an unclosed comment! And the FMETA definition on the next line never happens... and it doesn't even complain about the unclosed comment :( I moved the /*? around to get /?* and now the preprocessor is happy and it all works. SIGH Thanks anyway folks... -- Jay Libove Internet: libove@cs.cmu.edu 403 Village Green Blvd, Apt 203 BITNET: libove@drycas Ann Arbor, MI 48105 (313) 747-7454
daveh@marob.masa.com (Dave Hammond) (03/01/90)
In article <8185@pt.cs.cmu.edu> libove@ius3.ius.cs.cmu.edu (Jay Libove) writes:
-[...] It seems that the SCO Xenix/286 v2.2.1 preprocessor grabs the
-line right before the glob.h definition of FMETA which is:
-
-#define META "/*?[{"
-
-and fails to parse out the /* as being in a string ... so it becomes
-an unclosed comment! And the FMETA definition on the next line never
-happens... and it doesn't even complain about the unclosed comment :(
-
-I moved the /*? around to get /?* and now the preprocessor is
-happy and it all works. SIGH
This perfectly documents a problem currently being discussed over in
comp.lang.c under the subject of `nested comments'. The general
consensus has been that including the character pairs `/*' and `*/'
literally within a string is all but inviting disaster.
--
Dave Hammond
daveh@marob.masa.com
uunet!masa.com!marob!daveh