Commit | Line | Data |
8d063cd8 |
1 | #!./perl -P |
2 | |
3 | # $Header: comp.cpp,v 1.0 87/12/18 13:12:22 root Exp $ |
4 | |
5 | print "1..3\n"; |
6 | |
7 | #this is a comment |
8 | #define MESS "ok 1\n" |
9 | print MESS; |
10 | |
11 | #If you capitalize, it's a comment. |
12 | #ifdef MESS |
13 | print "ok 2\n"; |
14 | #else |
15 | print "not ok 2\n"; |
16 | #endif |
17 | |
18 | open(try,">Comp.cpp.tmp") || die "Can't open temp perl file."; |
19 | print try '$ok = "not ok 3\n";'; print try "\n"; |
20 | print try "#include <Comp.cpp.inc>\n"; |
21 | print try "#ifdef OK\n"; |
22 | print try '$ok = OK;'; print try "\n"; |
23 | print try "#endif\n"; |
24 | print try 'print $ok;'; print try "\n"; |
25 | close try; |
26 | |
27 | open(try,">Comp.cpp.inc") || (die "Can't open temp include file."); |
28 | print try '#define OK "ok 3\n"'; print try "\n"; |
29 | close try; |
30 | |
31 | $pwd=`pwd`; |
32 | $pwd =~ s/\n//; |
33 | $x = `./perl -P -I$pwd Comp.cpp.tmp`; |
34 | print $x; |
35 | `/bin/rm -f Comp.cpp.tmp Comp.cpp.inc`; |