pp.probe revision 3f54fd611f536639ec30dd53c48e5ec1897cc7d9
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett:
12b2ae689353ecbaad720a9af9f9be01c1a3fe2dChristian Maeder# Glenn Fowler
e071fb22ea9923a2a4ff41184d80ca46b55ee932Till Mossakowski# AT&T Research
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett#
98890889ffb2e8f6f722b00e265a211f13b5a861Corneliu-Claudiu Prodescu# @(#)pp.probe (AT&T Research) 2012-02-29
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett#
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett# C probe for libpp
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett#
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett# NOTE: C.probe must be included or .'d here
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett#
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblettppdef=$dir/pp.def
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblettppkey=$dir/pp.key
9ebbce450fb242e1a346f9f89367d8c46fcb2ec8Andy Gimblettppsym=$dir/ppsym
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblettfor f in $ppdef $ppkey $ppsym
576a4ca6de740c90afd448607c2323477139de24Liam O'Reillydo test -f $f || { echo "$0: $f: not found" >&4; exit 1 ;}
9f93b2a8b552789cd939d599504d39732672dc84Christian Maederdone
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblettsed -e "/^#/d" -e "s/[ ].*//" < $ppdef > all.pp
05b3e12808da901dccd665715cb934462290d550Andy Gimblett
9ebbce450fb242e1a346f9f89367d8c46fcb2ec8Andy Gimblettsystem=
aa0d5f8be9950e788884f7431cf4cb7bee74788cAndy Gimblettrelease=
aa0d5f8be9950e788884f7431cf4cb7bee74788cAndy Gimblettversion=
9aeda2b3ae8ce0b018955521e4ca835a8ba8a27bLiam O'Reillyarchitecture=
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblettcpu=
12b2ae689353ecbaad720a9af9f9be01c1a3fe2dChristian Maedermodel=
12b2ae689353ecbaad720a9af9f9be01c1a3fe2dChristian Maedermachine=
567db7182e691cce5816365d8c912d09ffe92f86Andy Gimblettundef_predef=
12b2ae689353ecbaad720a9af9f9be01c1a3fe2dChristian Maeder
12b2ae689353ecbaad720a9af9f9be01c1a3fe2dChristian Maeder#
12b2ae689353ecbaad720a9af9f9be01c1a3fe2dChristian Maeder# path cleanup
12b2ae689353ecbaad720a9af9f9be01c1a3fe2dChristian Maeder#
12b2ae689353ecbaad720a9af9f9be01c1a3fe2dChristian Maeder
8db2221917c1bc569614f3481bcdb3b988facaedChristian Maederfor i in stdinclude usrinclude
12b2ae689353ecbaad720a9af9f9be01c1a3fe2dChristian Maederdo eval o='$'$i
8db2221917c1bc569614f3481bcdb3b988facaedChristian Maeder v=$o
12b2ae689353ecbaad720a9af9f9be01c1a3fe2dChristian Maeder case $v in
1c7c4d95775a8ad5f7373e5cf0bad86f8301c56cAndy Gimblett *//*) v=`echo $v | sed 's,///*,/,g'` ;;
9aeda2b3ae8ce0b018955521e4ca835a8ba8a27bLiam O'Reilly esac
9aeda2b3ae8ce0b018955521e4ca835a8ba8a27bLiam O'Reilly if (test . -ef "`pwd`")
9aeda2b3ae8ce0b018955521e4ca835a8ba8a27bLiam O'Reilly then k=
9f93b2a8b552789cd939d599504d39732672dc84Christian Maeder for x in $v
9f93b2a8b552789cd939d599504d39732672dc84Christian Maeder do case $x in
9f93b2a8b552789cd939d599504d39732672dc84Christian Maeder */../*|*/..)
9f93b2a8b552789cd939d599504d39732672dc84Christian Maeder case $x in
9f93b2a8b552789cd939d599504d39732672dc84Christian Maeder /*) a=/ ;;
9f93b2a8b552789cd939d599504d39732672dc84Christian Maeder *) a= ;;
23a073e0a3433ca80a286d46202841b569ec36fdChristian Maeder esac
a5f3a8cdc3ceb045c3c166ee840d3e59ec7efac6Christian Maeder IFS=/
9f93b2a8b552789cd939d599504d39732672dc84Christian Maeder set '' $x
9aeda2b3ae8ce0b018955521e4ca835a8ba8a27bLiam O'Reilly IFS=$ifs
0b8146e4f675518993a34eb2255ad7ddd7bf82a4Christian Maeder r=
23a073e0a3433ca80a286d46202841b569ec36fdChristian Maeder for d
0b8146e4f675518993a34eb2255ad7ddd7bf82a4Christian Maeder do r="$d $r"
0b8146e4f675518993a34eb2255ad7ddd7bf82a4Christian Maeder done
0b8146e4f675518993a34eb2255ad7ddd7bf82a4Christian Maeder p=
1c7c4d95775a8ad5f7373e5cf0bad86f8301c56cAndy Gimblett g=
53f89daf88665d3ea96d871110a5c0d9d8326bd2Andy Gimblett for d in $r
1c7c4d95775a8ad5f7373e5cf0bad86f8301c56cAndy Gimblett do case $d in
1c7c4d95775a8ad5f7373e5cf0bad86f8301c56cAndy Gimblett ..) g="$g $d" ;;
53f89daf88665d3ea96d871110a5c0d9d8326bd2Andy Gimblett *) case $g in
53f89daf88665d3ea96d871110a5c0d9d8326bd2Andy Gimblett '') case $p in
12b2ae689353ecbaad720a9af9f9be01c1a3fe2dChristian Maeder '') p=$d ;;
1c7c4d95775a8ad5f7373e5cf0bad86f8301c56cAndy Gimblett *) p=$d/$p ;;
c052e3ee4a53ee3a2da829aa142fd596ef6c9e3dAndy Gimblett esac
c052e3ee4a53ee3a2da829aa142fd596ef6c9e3dAndy Gimblett ;;
1c7c4d95775a8ad5f7373e5cf0bad86f8301c56cAndy Gimblett *) set $g
b25c72845890740c2f8a21214752574990b943cfChristian Maeder shift
b25c72845890740c2f8a21214752574990b943cfChristian Maeder g=$*
b25c72845890740c2f8a21214752574990b943cfChristian Maeder ;;
c052e3ee4a53ee3a2da829aa142fd596ef6c9e3dAndy Gimblett esac
a09bfcbcb0fba5663fca1968aa82daebf2e092c4Andy Gimblett ;;
a5f3a8cdc3ceb045c3c166ee840d3e59ec7efac6Christian Maeder esac
dfc58f5ec6492d1a9b9babd9cdcdbb15baa6e657Christian Maeder done
a5f3a8cdc3ceb045c3c166ee840d3e59ec7efac6Christian Maeder case $a in
a5f3a8cdc3ceb045c3c166ee840d3e59ec7efac6Christian Maeder '') for d in $g
dfc58f5ec6492d1a9b9babd9cdcdbb15baa6e657Christian Maeder do p=$d/$p
b25c72845890740c2f8a21214752574990b943cfChristian Maeder done
1c7c4d95775a8ad5f7373e5cf0bad86f8301c56cAndy Gimblett ;;
61051521e4d82769a47f23aecb5fb477de47d534Andy Gimblett *) p=$a$p
61051521e4d82769a47f23aecb5fb477de47d534Andy Gimblett ;;
61051521e4d82769a47f23aecb5fb477de47d534Andy Gimblett esac
61051521e4d82769a47f23aecb5fb477de47d534Andy Gimblett case $p in
61051521e4d82769a47f23aecb5fb477de47d534Andy Gimblett /) continue ;;
b25c72845890740c2f8a21214752574990b943cfChristian Maeder esac
1c7c4d95775a8ad5f7373e5cf0bad86f8301c56cAndy Gimblett test $x -ef $p && x=$p
b22c258cca179a5ffe777b64b32e10687c5f6b2cAndy Gimblett ;;
a5f3a8cdc3ceb045c3c166ee840d3e59ec7efac6Christian Maeder esac
23a073e0a3433ca80a286d46202841b569ec36fdChristian Maeder k="$k $x"
23a073e0a3433ca80a286d46202841b569ec36fdChristian Maeder done
876bd2c70a93981cc80f8376284616bce4a0fefcChristian Maeder set '' $k
aa0d5f8be9950e788884f7431cf4cb7bee74788cAndy Gimblett shift
aa0d5f8be9950e788884f7431cf4cb7bee74788cAndy Gimblett v=$1
aa0d5f8be9950e788884f7431cf4cb7bee74788cAndy Gimblett case $# in
aa0d5f8be9950e788884f7431cf4cb7bee74788cAndy Gimblett 0) ;;
afc52bfaabee38c4d55cee9f35b1a0028ba3854aAndy Gimblett *) shift
afc52bfaabee38c4d55cee9f35b1a0028ba3854aAndy Gimblett while :
197888c54795ec1e79e77289b7e20436a6db74c0Andy Gimblett do case $# in
197888c54795ec1e79e77289b7e20436a6db74c0Andy Gimblett 0) break ;;
197888c54795ec1e79e77289b7e20436a6db74c0Andy Gimblett esac
b25c72845890740c2f8a21214752574990b943cfChristian Maeder k=
b25c72845890740c2f8a21214752574990b943cfChristian Maeder for d
a1f6118e7ce7f8892fc4299e316630ec74083f0aAndy Gimblett do for j in $v
b25c72845890740c2f8a21214752574990b943cfChristian Maeder do test $d -ef $j && continue 2
afc52bfaabee38c4d55cee9f35b1a0028ba3854aAndy Gimblett done
b25c72845890740c2f8a21214752574990b943cfChristian Maeder k="$k $d"
b25c72845890740c2f8a21214752574990b943cfChristian Maeder done
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maeder set '' $k
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maeder case $# in
afc52bfaabee38c4d55cee9f35b1a0028ba3854aAndy Gimblett 1) break ;;
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maeder esac
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maeder shift
b25c72845890740c2f8a21214752574990b943cfChristian Maeder v="$v $1"
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maeder shift
afc52bfaabee38c4d55cee9f35b1a0028ba3854aAndy Gimblett done
b25c72845890740c2f8a21214752574990b943cfChristian Maeder ;;
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maeder esac
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maeder fi
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maeder case $v in
afc52bfaabee38c4d55cee9f35b1a0028ba3854aAndy Gimblett $o) ;;
b25c72845890740c2f8a21214752574990b943cfChristian Maeder *) eval $i='$'v ;;
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maeder esac
b25c72845890740c2f8a21214752574990b943cfChristian Maederdone
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maeder
afc52bfaabee38c4d55cee9f35b1a0028ba3854aAndy Gimblettid="::IDENT::`date`::IDENT::"
b25c72845890740c2f8a21214752574990b943cfChristian Maederecho '#assert test(ok)
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maeder#if #test(ok)
b25c72845890740c2f8a21214752574990b943cfChristian Maeder#else
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maeder(
b25c72845890740c2f8a21214752574990b943cfChristian Maeder#endif' > assert.$src
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maederecho '#ifdef __BASE_FILE__
b25c72845890740c2f8a21214752574990b943cfChristian Maederint ok;
b25c72845890740c2f8a21214752574990b943cfChristian Maeder#else
b25c72845890740c2f8a21214752574990b943cfChristian Maeder(
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maeder#endif' > basefile.$src
b25c72845890740c2f8a21214752574990b943cfChristian Maedercat > catlit1.i <<'!'
b25c72845890740c2f8a21214752574990b943cfChristian Maederchar test[] = "te"
b25c72845890740c2f8a21214752574990b943cfChristian Maeder"st";
0a83f8dcd5598436966584b858313eb5efd95d5bLiam O'Reilly!
9aeda2b3ae8ce0b018955521e4ca835a8ba8a27bLiam O'Reillycat > catlit2.i <<'!'
2f35e5f6757968746dbab385be21fcae52378a3fLiam O'Reillychar test[] = "te\
2f35e5f6757968746dbab385be21fcae52378a3fLiam O'Reillyst";
23a073e0a3433ca80a286d46202841b569ec36fdChristian Maeder!
23a073e0a3433ca80a286d46202841b569ec36fdChristian Maederecho '#define g(a,b) a ## b
7371f8fe3a9a286a74ea30a3cd18e7740f67d537Andy Gimblettvolatile int a;
fd4ad12563262ebe380d810df8f7755cfab5fb42Liam O'Reillyconst int g(x,y)=1;
fd4ad12563262ebe380d810df8f7755cfab5fb42Liam O'Reillyextern int c(int);' > compat.$src
fd4ad12563262ebe380d810df8f7755cfab5fb42Liam O'Reillyecho > cpp.$src
fd4ad12563262ebe380d810df8f7755cfab5fb42Liam O'Reillyecho "#defincl <x.h>" > defincl.$src
afc52bfaabee38c4d55cee9f35b1a0028ba3854aAndy Gimblettecho 'int a$b;' > dollar.$src
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maederecho "#eject" > eject.$src
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maederecho "#if 0
da955132262baab309a50fdffe228c9efe68251dCui Jian(
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maeder#else if 1
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maederint x;
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maeder#else
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maeder(
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maeder#endif" > elseif.$src
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maederecho "#define _CAT(a,b,c) a##b##c
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maeder#define hdra hdrx
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maeder#define hdr _CAT(<,hdra,.h>)
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maeder#include hdr" > hdra.$src
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maederecho "#define _XAT(a,b,c) a##b##c
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maeder#define _CAT(a,b,c) _XAT(a,b,c)
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maeder#define hdra hdrx
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maeder#define hdr _CAT(<,hdra,.h>)
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maeder#include hdr" > hdrx.$src
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maederecho "int f(){return 0;}" > hdrx.h
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maederecho "#ident \"$id\"" > ident.$src
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maederecho "#import \"import.h\"" > import.$src
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maederecho "int aaa;" > import.h
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maederecho "#include <inc_next.h>" > inc_next.$src
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maedermkdir inc0 inc1
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maederecho "#include_next <inc_next.h>" > inc0/inc_next.h
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maederecho 'char s[] = "INCLUDE_NEXT";' > inc1/inc_next.h
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maederecho '# 1 "linefile.i"
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maeder
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maeder# 1 "linefile.i"
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maeder
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maederint i;' > linefile1.i
4f4e94264f48e255d4125f47649f585d9d062fabChristian Maederecho '# 1 "linefile.i"
afc52bfaabee38c4d55cee9f35b1a0028ba3854aAndy Gimblett
7371f8fe3a9a286a74ea30a3cd18e7740f67d537Andy Gimblett# 1
7371f8fe3a9a286a74ea30a3cd18e7740f67d537Andy Gimblett
7371f8fe3a9a286a74ea30a3cd18e7740f67d537Andy Gimblettint i;' > linefile2.i
576a4ca6de740c90afd448607c2323477139de24Liam O'Reillyecho "int i = 0;" > lineid1.i
7371f8fe3a9a286a74ea30a3cd18e7740f67d537Andy Gimblettecho '# 1 "t.c"
fd4ad12563262ebe380d810df8f7755cfab5fb42Liam O'Reillyint i = 0;' > lineid2.i
fd4ad12563262ebe380d810df8f7755cfab5fb42Liam O'Reillyecho '# 1 "t.c"
2bb060537a37352251aa04d8dc09aa53aad5d4bfLiam O'Reillyint i = 0;' > lineid3.$src
576a4ca6de740c90afd448607c2323477139de24Liam O'Reillyecho "#include <stdio.h>" > linetype.$src
b25c72845890740c2f8a21214752574990b943cfChristian Maederecho '#include <sys/types.h>
576a4ca6de740c90afd448607c2323477139de24Liam O'Reillymain()
b25c72845890740c2f8a21214752574990b943cfChristian Maeder{
b25c72845890740c2f8a21214752574990b943cfChristian Maeder return sizeof(LONGLONG) != 8;
576a4ca6de740c90afd448607c2323477139de24Liam O'Reilly}' > longlong.$src
b25c72845890740c2f8a21214752574990b943cfChristian Maederecho '#include "once.h"
b25c72845890740c2f8a21214752574990b943cfChristian Maeder#include "once.h"' > once.$src
576a4ca6de740c90afd448607c2323477139de24Liam O'Reillyecho '#ifdef once
b25c72845890740c2f8a21214752574990b943cfChristian Maederallmultiple
b25c72845890740c2f8a21214752574990b943cfChristian Maeder#else
576a4ca6de740c90afd448607c2323477139de24Liam O'Reilly#define once
576a4ca6de740c90afd448607c2323477139de24Liam O'Reilly#endif' > once.h
b25c72845890740c2f8a21214752574990b943cfChristian Maederecho "extern int a,b;int f(){return a + = b;}" > opspace.$src
b25c72845890740c2f8a21214752574990b943cfChristian Maederecho "int f(){return(0);} // ((" > pluscom.$src
434c11a96bc623ebd5b60781efabef319bb15b0eChristian Maederecho "class x {int n;} m;" > plusplus.$src
434c11a96bc623ebd5b60781efabef319bb15b0eChristian Maederecho > preinc.$src
b25c72845890740c2f8a21214752574990b943cfChristian Maederecho '// splice \
576a4ca6de740c90afd448607c2323477139de24Liam O'Reilly(
576a4ca6de740c90afd448607c2323477139de24Liam O'Reillyint x = 1;' > plusspl.$src
b25c72845890740c2f8a21214752574990b943cfChristian Maederecho "int stdc_default_value = __STDC__ ;" > stdc.$src
b25c72845890740c2f8a21214752574990b943cfChristian Maederecho 'char xxx[] = "abc
b25c72845890740c2f8a21214752574990b943cfChristian Maeder(";' > span.$src
b25c72845890740c2f8a21214752574990b943cfChristian Maederecho '#define g(a,b) a\
b25c72845890740c2f8a21214752574990b943cfChristian Maederb
b25c72845890740c2f8a21214752574990b943cfChristian Maederint ab,xy;
b25c72845890740c2f8a21214752574990b943cfChristian Maeder#define xy XY
576a4ca6de740c90afd448607c2323477139de24Liam O'Reillychar* g(x,y);' > splice.$src
b25c72845890740c2f8a21214752574990b943cfChristian Maeder{
b25c72845890740c2f8a21214752574990b943cfChristian Maederecho 'int a\ '
576a4ca6de740c90afd448607c2323477139de24Liam O'Reillyecho 'b = 1;'
b25c72845890740c2f8a21214752574990b943cfChristian Maeder} > splicesp.$src
b25c72845890740c2f8a21214752574990b943cfChristian Maederecho '#define g(a,b) a/**/b
576a4ca6de740c90afd448607c2323477139de24Liam O'Reillyint g(x,y)=1;' > trans.$src
b25c72845890740c2f8a21214752574990b943cfChristian Maederecho '#define m 65
b25c72845890740c2f8a21214752574990b943cfChristian Maeder#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 65
576a4ca6de740c90afd448607c2323477139de24Liam O'Reilly#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 64
576a4ca6de740c90afd448607c2323477139de24Liam O'Reilly#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 63
b25c72845890740c2f8a21214752574990b943cfChristian Maeder#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 62
b25c72845890740c2f8a21214752574990b943cfChristian Maeder#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 61
b25c72845890740c2f8a21214752574990b943cfChristian Maeder#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 60
b25c72845890740c2f8a21214752574990b943cfChristian Maeder#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 59
b25c72845890740c2f8a21214752574990b943cfChristian Maeder#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 58
576a4ca6de740c90afd448607c2323477139de24Liam O'Reilly#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 57
576a4ca6de740c90afd448607c2323477139de24Liam O'Reilly#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 56
b25c72845890740c2f8a21214752574990b943cfChristian Maeder#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 55
b25c72845890740c2f8a21214752574990b943cfChristian Maeder#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 54
b25c72845890740c2f8a21214752574990b943cfChristian Maeder#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 53
576a4ca6de740c90afd448607c2323477139de24Liam O'Reilly#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 52
576a4ca6de740c90afd448607c2323477139de24Liam O'Reilly#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 51
b25c72845890740c2f8a21214752574990b943cfChristian Maeder#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 50
b25c72845890740c2f8a21214752574990b943cfChristian Maeder#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 49
b25c72845890740c2f8a21214752574990b943cfChristian Maeder#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 48
576a4ca6de740c90afd448607c2323477139de24Liam O'Reilly#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 47
b25c72845890740c2f8a21214752574990b943cfChristian Maeder#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 46
7371f8fe3a9a286a74ea30a3cd18e7740f67d537Andy Gimblett#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 45
7371f8fe3a9a286a74ea30a3cd18e7740f67d537Andy Gimblett#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 44
7371f8fe3a9a286a74ea30a3cd18e7740f67d537Andy Gimblett#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 43
7371f8fe3a9a286a74ea30a3cd18e7740f67d537Andy Gimblett#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 42
7371f8fe3a9a286a74ea30a3cd18e7740f67d537Andy Gimblett#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 41
fd4ad12563262ebe380d810df8f7755cfab5fb42Liam O'Reilly#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 40
fd4ad12563262ebe380d810df8f7755cfab5fb42Liam O'Reilly#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 39
fd4ad12563262ebe380d810df8f7755cfab5fb42Liam O'Reilly#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 38
fd4ad12563262ebe380d810df8f7755cfab5fb42Liam O'Reilly#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 37
#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 36
#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 35
#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 34
#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 33
#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 32
#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 31
#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 30
#define xxxxxxxxxxxxxxxxxxxxxxxxxxxxx 29
#define xxxxxxxxxxxxxxxxxxxxxxxxxxxx 28
#define xxxxxxxxxxxxxxxxxxxxxxxxxxx 27
#define xxxxxxxxxxxxxxxxxxxxxxxxxx 26
#define xxxxxxxxxxxxxxxxxxxxxxxxx 25
#define xxxxxxxxxxxxxxxxxxxxxxxx 24
#define xxxxxxxxxxxxxxxxxxxxxxx 23
#define xxxxxxxxxxxxxxxxxxxxxx 22
#define xxxxxxxxxxxxxxxxxxxxx 21
#define xxxxxxxxxxxxxxxxxxxx 20
#define xxxxxxxxxxxxxxxxxxx 19
#define xxxxxxxxxxxxxxxxxx 18
#define xxxxxxxxxxxxxxxxx 17
#define xxxxxxxxxxxxxxxx 16
#define xxxxxxxxxxxxxxx 15
#define xxxxxxxxxxxxxx 14
#define xxxxxxxxxxxxx 13
#define xxxxxxxxxxxx 12
#define xxxxxxxxxxx 11
#define xxxxxxxxxx 10
#define xxxxxxxxx 9
#define xxxxxxxx 8
#define xxxxxxx 7
#define xxxxxx 6
#define xxxxx 5
#define xxxx 4
#define xxx 3
#define xx 2
#define x 1
#if xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx != m
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
#endif' > truncate.$src
cat > zeof.c <<'!'
char* foo = "az";
!
allmultiple=
assert=
basefile=
compatibility=1
defincl=
dollar=
eject=
elseif=
headerexpand=
headerexpandall=
hostedtransition=
ident=
import=
include_next=
linefile=
lineid=
linetype=
nocatliteral=
opspace=
pluscom=
plusplus=
plussplice=
redef=
reguard=
reserved=
spaceout=
splicecat=
splicespace=
strict=
stringspan=
transition=
truncate=
zeof=
$cc -c assert.$src && assert=1
$cc -c basefile.$src && basefile=__BASE_FILE__
if $cc -E defincl.$src
then case "`$cc -E defincl.$src | grep -c 'defincl'`" in
0) defincl=1 ;;
esac
fi
if $cc -c catlit1.i 2>e
then if $cc -c catlit2.i 2>f
then if test `wc -c < f` -gt `wc -c < e`
then nocatliteral=1
fi
else nocatliteral=1
fi
fi
$cc -c dollar.$src && dollar=1
$cc -c elseif.$src && elseif=1
if $cc -I. -c hdra.$src
then headerexpandall=1
elif $cc -I. -c hdrx.$src
then headerexpand=1
fi
if $cc -E eject.$src
then case "`$cc -E eject.$src | grep -c 'eject'`" in
0) eject=1 ;;
esac
fi
$cc -S ident.$src && grep "$id" ident.s && ident=1
{ $cc -E import.$src | grep aaa ;} && import=1
{ $cc -E -Iinc0 -Iinc1 inc_next.$src | grep INCLUDE_NEXT ;} && include_next=1
if $cc -c linefile1.i
then $cc -c linefile2.i
case $? in
0) ;;
*) linefile=1 ;;
esac
fi
if $cc -c lineid1.i 2>b
then $cc -c lineid2.i 2>e
c=$?
else $cc -c lineid3.c 2>e
c=$?
fi
case $c in
0) case `wc -l < b` in
`wc -l < e`) ;;
*) lineid=line ;;
esac
;;
*) lineid=line
;;
esac
if $cc -E linetype.$src | grep '^[ ]*#[ ]*[0123456789]*[ ]*".*"[ ]*[12]' > linetype
then if grep '^[ ]*#[ ]*[0123456789]*[ ]*".*"[ ]*[12][ ][ ]*3' linetype
then linetype=2
else linetype=1
fi
fi
{ $cc -E once.$src | grep allmultiple ;} && allmultiple=1
$cc -c plusplus.$src && plusplus=1
$cc -c span.$src && stringspan=1
$cc -c splice.$src && splicecat=1
$cc -c splicesp.$src && splicespace=1
exec < $ppkey
while read keyword type alternate comment
do case $keyword in
.) break ;;
""|"#") continue ;;
esac
case $type in
""|".") type= ;;
*) type="=$type" ;;
esac
for pre in '' _ __
do for suf in '' _ __
do case $suf in
'') sep= ;;
*) sep=. ;;
esac
case ,,$alternate, in
*,$pre$sep$suf,*)
key=$pre$keyword$suf
undef="$undef $key"
echo "int f(){
int $key = 0;
return $key;
}
#undef $key
int g(){
int $key = 0;
return $key;
}" > key.$src
$cc -c key.$src >/dev/null 2>&1 || reserved="$reserved $key$type"
;;
esac
done
done
done
$cc -c opspace.$src && opspace=1
case $plusplus in
"") $cc -c compat.$src && compatibility=
$cc -c pluscom.$src && pluscom=1
;;
esac
case $plusplus$pluscom in
?*) $cc -c plusspl.$src || plussplice=1 ;;
esac
case $plusplus in
?*) mkdir reguard
cd reguard
echo '#include "ptrone.h"
#include "ptrdef.h"
int main () { return gt(2,1) + gt(2.0,1.0); }' > ptr.$src
echo '#include "ptrone.h"
template<class T> int gt(T a, T b) { return a > b; }' > ptrdef.$src
echo 'template<class T> int gt(T a, T b);' > ptrdef.h
echo '/* empty */' > ptrone.h
if $cc -E ptr.$src > x.i && $cc x.i
then echo '#ifndef _PTRONE_H
#define _PTRONE_H
static int xxx;
#endif' > ptrone.h
if $cc -E ptr.$src > x.i && echo "#define _PTRONE_H" >> x.i && $cc x.i
then reguard=1
fi
fi
cd ..
rm -rf reguard
;;
esac
stdc=`$cc -E stdc.$src | sed -e '/stdc_default_value/!d' -e 's/.*=[ ]*//' -e 's/[ ]*;.*//'`
case $stdc in
0) $cc -c trans.$src && transition=1 ;;
[0123456789]*) ;;
*) stdc= ;;
esac
truncate=`$cc -E truncate.$src | grep '^[ ]*[0123456789]'`
$cc -c zeof.c || zeof=1
echo "$predef" >> all.pp
{
case $ppopt$ppenv in
?*) ppcmd=cpp
ppdir=.
eval $ppenv '$'cc -Dmycpp -E '$'ppopt cpp.$src
;;
esac
eval set x $probe_verbose
shift
x=
for o in "$@"
do set x `$cc $o -c cpp.$src 2>&1`
while :
do shift
case $# in
0) break ;;
esac
case $1 in
*[\\/]rm)
;;
[\\/]*) case " $x " in
*" $1 "*) ;;
*) test -x $1 && x="$x $1" ;;
esac
;;
esac
done
case $x in
?*) for f in $x
do cp $f x && chmod u+w x && strip x && f=x
$ppsym < $f
done
break
;;
esac
done
} 3>&- 3>&1 >/dev/null |
sed -e '/^ppsymbol$/d' -e '/^.$/d' -e '/^..$/d' -e '/[ABCDEFGHIJKLMNOPQRSTUVWXYZ].*[abcdefghijklmnopqrstuvwxyz]/d' -e '/[abcdefghijklmnopqrstuvwxyz].*[ABCDEFGHIJKLMNOPQRSTUVWXYZ]/d' |
cat - all.pp |
sort -u |
{
for i in 0 1 2 3 4 5
do echo "struct { char* name; long value; } predef[] = {" > cpp$i.$src
done
while read sym junk
do case $sym in
_*) set 0 ${sym}
;;
*_) continue
;;
[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]*)
set 1 ${sym} 2 _${sym} 3 _${sym}_ 4 __${sym} 5 __${sym}__
;;
*) continue
;;
esac
while :
do case $# in
0|1) break ;;
esac
{
echo "#ifdef $2"
echo "\"$2\" , (long) $2 -1,"
echo "#endif"
} >> cpp$1.$src
shift
shift
done
done
for i in 0 1 2 3 4 5
do echo "\"\", 0 };" >> cpp$i.$src
done
}
preval="`for i in 0 1 2 3 4 5;do $cc -E cpp$i.$src;done | sed -e '/\".*\".*,.*,/!d' -e 's/[^\"]*\"\\([^\"]*\\)\"[ ]*,[ ]*([ ]*long[ ]*)[ ]*\\(.*\\)[ ]*-[ ]*1[ ]*,[ ]*\$/\\1 \\2 =/g' -e '/\\(^[^ ]*\\) \1 *=$/d'` `$cc -dM -E stdc.$src | sed -e '/[ ]*#[ ]*define/!d' -e '/\"/d' -e 's/[ ]*#[ ]*define[ ]*\\([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]*([^)]*)\\)[ ]*\\(.*\\)/\\1 \\2 =/' -e 's/[ ]*#[ ]*define[ ]*\\([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]*\\)[ ]*\\(.*\\)/\\1 \\2 =/'`"
print -r "$preval" > /tmp/probe/preval
for i in bufld namei quota reboot utsname vfs
do echo "#include <sys/$i.h>" > t.$src
if $cc -E t.$src
then x=1
else x=0
fi
eval sys_$i=$x
done
echo "char* fun() { return (char*)__FUNCTION__; }
int main() { return !fun(); }" > fun.$src
rm -f fun.exe
if $cc -o fun.exe fun.$src && test -x fun.exe
then undef_predef="$undef_predef __FUNCTION__"
fi
case "`grep -c '__STDC__[-0 ]*[=!]=[ ]*0' $usrinclude/stdio.h 2>/dev/null`" in
0) ;;
*) hostedtransition=1 ;;
esac
mapinclude=
for i in builtins
do echo "#include <$i.h>" > t.$src
if $cc -E t.$src
then mapinclude="$mapinclude <$i.h>=\".\""
fi
done
#
# the payoff
#
exec >&3
case "$compatibility:$transition:$dollar" in
::) strict=1 ;;
esac
case $version_stamp in
?*) echo "/* $version_stamp" ;;
*) echo "/* $cc" ;;
esac
echo "*/"
case $plusplus:$stdc in
1:?*) preval="$preval = __STDC__ $stdc ="
redef="$redef __STDC__"
;;
esac
ppbuiltin=0
set x $preval
shift
case $# in
0) ;;
*) echo
echo "#pragma pp:predefined"
predef=
while :
do case $# in
0) break ;;
esac
m=$1
shift
case $m in
*'('*) i=`echo "$m" | sed 's,(.*,,'` ;;
*) i=$m ;;
esac
predef="$predef
$i"
eval predef_$i=0
while :
do case $1 in
'=') break ;;
*) shift ;;
esac
done
while :
do case $1 in
'=') shift ;;
*) break ;;
esac
done
done
for i in $undef
do case " $redef " in
*" $i "*) ;;
*) eval predef_$i=3 ;;
esac
done
set $preval
while :
do case $# in
0) break ;;
esac
m=$1
shift
case $m in
*'('*) i=`echo "$m" | sed 's,(.*,,'` ;;
*) i=$m ;;
esac
case $i in
'=') continue ;;
esac
v=
while :
do case $1 in
'=') break ;;
esac
v="$v $1"
shift
done
while :
do case $1 in
'=') shift ;;
*) break ;;
esac
done
case $i in
__LCC__)strict=2 ;;
_*) ;;
*) eval j=\$predef_$i
case $j in
0) eval predef_$i=1
echo "#define $m$v"
case $strict in
1) strict= ;;
esac
;;
esac
;;
esac
done
nopredef=0
while :
do set $preval
while :
do case $# in
0) break ;;
esac
m=$1
shift
case $m in
*'('*) i=`echo "$m" | sed 's,(.*,,'` ;;
*) i=$m ;;
esac
v=
while :
do case $1 in
'=') break ;;
esac
v="$v $1"
shift
done
while :
do case $1 in
'=') shift ;;
*) break ;;
esac
done
case $m in
__*_BIT__|__*_DIG__|__*_MIN__|__*_MAX__|__*_TYPE__|*_FLT_*|*_DBL_*|*_LDBL_*)
case $nopredef in
0) nopredef=1
continue
;;
1) continue
;;
esac
;;
esac
case $nopredef in
2) ;;
*) case $v in
' '*' '*)
nopredef=1
continue
;;
' '[0123456789]*|' '"'"*"'"*)
;;
*) case $1 in
_*) ;;
*) nopredef=1
continue
;;
esac
;;
esac
;;
esac
eval j=\$predef_$i
case $j in
0) case $ppbuiltin in
2) echo "#pragma pp:builtin"
ppbuiltin=1
;;
esac
eval predef_$i=2
echo "#define $m$v"
;;
1) case $m in
$i) eval predef_$i=2
eval j=\$predef___${i}__
case $j in
[12]) ;;
*) case $ppbuiltin in
2) echo "#pragma pp:builtin"
ppbuiltin=1
;;
esac
eval predef___${i}__=2
echo "#define __${i}__$v"
;;
esac
;;
esac
;;
esac
done
case $nopredef in
2) break ;;
esac
echo "#pragma pp:nopredefined"
case $nopredef in
0) break ;;
esac
ppbuiltin=2
nopredef=2
done
;;
esac
case $basefile in
?*) case $ppbuiltin in
0|2) ppbuiltin=1
echo "#pragma pp:builtin"
;;
esac
echo "#define $basefile #(BASE)"
;;
esac
case $ppbuiltin in
1) echo "#pragma pp:nobuiltin" ;;
esac
eval set x $probe_longlong
shift
x=
for o in "$@"
do rm -f longlong.$exe
if $cc -DLONGLONG="$o" -o longlong.$exe longlong.$src &&
./longlong.$exe
then x=1
break
fi
done
case $x in
'') eval set x $probe_longlong_t
shift
for o in "$@"
do rm -f longlong.$exe
if $cc -DLONGLONG="$o" -o longlong.$exe longlong.$src &&
./longlong.$exe
then echo "#define <long long> $o"
break
fi
done
;;
esac
echo
for i in `echo "$predef" | sed -e 's/^__*\(.*\)_*\$/\1/' -e '/^[abcdefghijklmnopqrstuvwxyz][abcdefghijklmnopqrstuvwxyz]*[0123456789][abcdefghijklmnopqrstuvwxyz0123456789]*\$/!d'` `echo "$predef" | sed -e 's/^__*\(.*\)_*\$/\1/' -e '/^[abcdefghijklmnopqrstuvwxyz][abcdefghijklmnopqrstuvwxyz]*\$/!d'`
do case $i in
*ix) ;;
*) architecture=$i
break
;;
esac
done
for i in `sed -e '/^#/d' -e '/:architecture:/!d' -e 's/[ ].*//' < $ppdef`
do eval j="\" \$predef_$i \$predef__${i} \$predef__${i}_ \$predef___${i} \$predef___${i}__ \""
case $j in
*" 2 "*)architecture=$i
break
;;
esac
done
for i in `sed -e '/^#/d' -e '/:machine:/!d' -e 's/[ ].*//' < $ppdef`
do eval j="\" \$predef_$i \$predef__${i} \$predef__${i}_ \$predef___${i} \$predef___${i}__ \""
case $j in
*" 2 "*)machine="$machine $i" ;;
esac
done
case $sys_bufld$sys_reboot$sys_utsname in
1??) release=research
version=9
;;
01?) release=bsd
case $sys_quota in
0) case $sys_vfs in
0) version=4.1
;;
esac
;;
1) case $sys_namei in
0) version=4.2
;;
1) version=4.3
;;
esac
;;
esac
;;
001) release=V
;;
esac
for i in `sed -e '/^#/d' -e '/:release:/!d' -e 's/[ ].*//' < $ppdef`
do eval j=\$predef_$i
case $j in
2) release="$release $i" ;;
esac
done
for i in `sed -e '/^#/d' -e '/:system:/!d' -e 's/[ ].*//' < $ppdef`
do eval j=\$predef_$i
case $j in
2) system="$system $i" ;;
esac
done
case $release in
topix) release="$release V"
;;
esac
case $assert in
?*) for i in $predef
do case $i in
_*|*_) ;;
*) for p in architecture cpu machine system
do echo "#if #$p($i)
eval \"case \\\" \$$p \\\" in *\\\" $i \\\"*) ;; *) $p=\\\"$i \$$p\\\" ;; esac\"
: avoid string literal concatenation
#endif"
done
;;
esac
done > t.$src
eval "`$cc -E t.$src`"
set x x $prepred
while :
do shift
shift
case $# in
[01]) break ;;
esac
eval "
case \" \$$1 \" in
*\" $2 \"*) ;;
*) $1=\"$2 \$$1\" ;;
esac
"
done
;;
esac
case $system in
"") system=unix ;;
esac
case $architecture in
ibm|uts|u370) model=370
architecture=ibm
;;
m*68*) architecture=m68000
for i in $predef
do case $i in
m*68*[123456789][0123456789])
model=`echo $i | sed 's/.*\(..\)/\1/'`
break
;;
esac
done
;;
u3b?*) model=`echo $architecture | sed 's/u3b//'`
architecture=3b
;;
u3b) case $model in
"") model=20 ;;
esac
architecture=3b
;;
vax[0123456789]*)
model=`echo $architecture | sed 's/vax//'`
architecture=vax
;;
hp[0123456789]*s[0123456789])
case $release in
[abcdefghijklmnopqrstuvwxyz]*.[abcdefghijklmnopqrstuvwxyz]*.*)
version=$release
release=V
;;
esac
architecture="$architecture `echo $architecture | sed 's/s.*//'`"
;;
esac
case $hosttype in
*.*) i=`echo $hosttype | sed -e 's,.*\.,,'` ;;
*) i=$hosttype ;;
esac
case $i in
unknown);;
?*) case " $architecture " in
*" $i "*) ;;
*) architecture="$architecture $i" ;;
esac
;;
esac
case $architecture in
"") echo "$cc: warning: architecture not determined" >&4
set x $machine
architecture=$2
;;
esac
echo "#define #hosttype($hosttype)"
for i in $system
do echo "#define #system($i)"
done
case $release in
"") echo "#define #release()" ;;
*) for i in $release
do echo "#define #release($i)"
case $i in
V) echo "#define #release(system5)" ;; # compatibility
esac
done
;;
esac
echo "#define #version($version)"
case $architecture in
"") echo "#define #architecture()" ;;
*) for i in `echo $architecture | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
do echo "#define #architecture($i)"
done
;;
esac
echo "#define #model($model)"
case $machine in
"") case $architecture:$model in
?*:?*) set x $architecture; machine="$2/$model $architecture" ;;
*) machine=$architecture ;;
esac
;;
*) machine="$machine $architecture"
;;
esac
case $machine in
"") echo "#define #machine()" ;;
*) j=
for i in `echo $machine | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
do case " $i " in
*" $j "*)
;;
*) j="$j $i"
echo "#define #machine($i)"
;;
esac
done
;;
esac
for i in $cpu
do echo "#define #cpu($i)"
done
echo "#define #addressing()"
for i in $ATTRIBUTES
do eval d=\$$i
n=`echo $i | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
echo "#define #$n($d)"
done
case $stdc in
?*) echo "#define #dialect(ansi)" ;;
esac
case $plusplus in
?*) echo "#define #dialect(C++)" ;;
esac
case $hosted in
"") echo "#define #dialect(cross)" ;;
esac
case $so:$dynamic:$static in
::) ;;
*) echo "#define #dialect(dynamic)" ;;
esac
echo
case $undef_predef in
?*) for m in $undef_predef
do echo "#undef $m"
done
echo
;;
esac
case $plusplus in
?*) echo "#pragma pp:plusplus" ;;
esac
case $reserved in
?*) echo "#pragma pp:reserved" $reserved ;;
esac
case $nocatliteral in
?*) echo "#pragma pp:nocatliteral" ;;
esac
case $opspace in
?*) echo "#pragma pp:opspace" ;;
esac
case $pluscom in
?*) echo "#pragma pp:pluscomment" ;;
esac
case $plussplice in
?*) echo "#pragma pp:plussplice" ;;
esac
case $reguard in
?*) echo "#pragma pp:reguard" ;;
esac
case $splicecat in
?*) echo "#pragma pp:splicecat" ;;
esac
case $splicespace in
?*) echo "#pragma pp:splicespace" ;;
esac
case $stringspan in
?*) echo "#pragma pp:stringspan" ;;
esac
case $stdc in
"") echo "#pragma pp:compatibility"
;;
0) echo "#pragma pp:transition"
;;
1) case $strict in
?*) echo "#pragma pp:strict" ;;
esac
;;
esac
case $hostedtransition in
1) echo "#pragma pp:hostedtransition" ;;
esac
case $stdc in
?*) case $ppopt$ppenv in
"") spaceout=1
echo "#pragma pp:spaceout"
;;
esac
;;
esac
case $truncate in
?*) echo "#pragma pp:truncate $truncate" ;;
esac
case $zeof in
?*) echo "#pragma pp:zeof" ;;
esac
case $dollar in
1) echo '#pragma pp:id "$"' ;;
esac
cdir=-I+C
hdir=-I+H
set x $stdinclude
while :
do shift
case $# in
0) break ;;
esac
case $1 in
$cdir|$hdir)
;;
-I+C) cdir=$1
echo "#pragma pp:nocdir"
;;
-I-C) cdir=$1
echo "#pragma pp:cdir"
;;
-I+H) hdir=$1
echo "#pragma pp:nohostdir"
;;
-I-H) hdir=$1
echo "#pragma pp:hostdir"
;;
-I*) ;;
*) echo "#pragma pp:include \"$1\""
;;
esac
done
case $usrinclude in
/usr/include)
;;
?*) echo "#pragma pp:standard \"$usrinclude\""
;;
esac
case $plusplus in
?*) case $usrinclude in
?*) if grep plusplus $usrinclude/ctype.h >/dev/null 2>&1
then echo '#pragma pp:nocdir "-"'
fi
;;
esac
;;
esac
case $mapinclude in
?*) echo "#pragma pp:mapinclude hosted$mapinclude" ;;
esac
case $linefile in
?*) echo "#pragma pp:linefile" ;;
esac
case $lineid in
?*) echo "#pragma pp:lineid line" ;;
esac
case $linetype in
1) echo "#pragma pp:linetype" ;;
?*) echo "#pragma pp:linetype $linetype" ;;
esac
case $allmultiple in
"") echo "#pragma pp:noallmultiple" ;;
esac
case $defincl in
1) echo '#pragma pp:map "/#(pragma )?defincl>/"' ;;
esac
case $eject in
1) echo '#pragma pp:map "/#(pragma )?eject>/"' ;;
esac
case $elseif in
1) echo "#pragma pp:elseif" ;;
esac
case $headerexpand in
1) echo "#pragma pp:headerexpand" ;;
esac
case $headerexpandall in
1) echo "#pragma pp:headerexpandall" ;;
esac
case $ident in
1) echo '#pragma pp:map "/#(pragma )?ident>/" "/#(pragma )?/###/"' ;;
*) echo '#pragma pp:map "/#(pragma )?ident>/"' ;;
esac
case $import in
1) echo '#pragma pp:map "/#(pragma )?import>/" "/#(pragma )?import(.*)/__STDPP__IMPORT__(\2)/"
#macdef __STDPP__IMPORT__(x)
#pragma pp:noallmultiple
#include x
#pragma pp:allmultiple
#endmac' ;;
esac
case $include_next in
1) echo '#pragma pp:map "/#include_next>/" ",[^\<]*\<,#include <.../,"' ;;
esac
echo '#pragma pp:map "/#pragma lint:/" ",#pragma lint:(.*),##/*\1*/,u"'
echo '#pragma pp:map "/#(pragma )?sccs>/"'
case $stdc:$spaceout in
1:) case ' '$reserved' ' in
*' 'asm' '*|*' 'asm=*)
echo "#macdef asm"
echo "#pragma pp:spaceout"
echo "#undef asm"
echo "asm"
echo "#endmac"
;;
esac
;;
esac
if $cc -E preinc.$src > preinc.out
then for f in `sed -e 's,\\\\,/,g' -e 's,"[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz]:/,"/,g' -e '/^#[line ]*[0123456789][0123456789]*[ ][ ]*"[\\/]/!d' -e 's/^#[line ]*[0123456789][0123456789]*[ ][ ]*".*[\\/]\(.*\)".*/\1/' preinc.out | sort -u`
do case $f in
*preinc.$src*)
;;
*) echo "#include <$f>"
;;
esac
done
fi