head 1.3; access; symbols SFIO_1999:1.1.1.3 SFIO_1998:1.1.1.2 SFIO_1997:1.1.1.1 ATT:1.1.1; locks; strict; comment @# @; 1.3 date 99.09.11.13.20.43; author rse; state Exp; branches; next 1.2; 1.2 date 99.09.11.12.42.12; author rse; state Exp; branches; next 1.1; 1.1 date 97.01.04.02.38.00; author rse; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 97.01.04.02.38.00; author rse; state Exp; branches; next 1.1.1.2; 1.1.1.2 date 97.04.08.19.16.19; author rse; state Exp; branches; next 1.1.1.3; 1.1.1.3 date 98.11.03.14.45.41; author rse; state Exp; branches; next ; desc @@ 1.3 log @Merge in Sfio 1999 changes @ text @# This shell script attempts to find the actual lexical spelling # of the following objects: # _iob : the traditional name of the stdio FILE structure # _filbuf: the traditional name of the function to fill a FILE buffer # _flsbuf: the traditional name of the function to flush a FILE buffer # # _uflow: _filbuf on Linux # _overflow: _flsbuf on Linux # # _sF, _srget, _swbuf: BSD stuffs # # Written by Kiem-Phong Vo, 12/11/93 # Clean up on error or exit trap "eval 'rm kpv.xxx.* >/dev/null 2>&1'" 0 1 2 # Take cross-compiler name as an argument if test "$1" = "" then CC=cc else CC="$*" fi # initialize generated header file { echo '#include "cfg_common.h"' echo '#include "cfg_sfio.h"' echo '#include "cfg_stdio.h"' } >sfstdhdr.h # Get full path name for stdio.h # make sure that the right stdio.h file will be included echo "#include " > kpv.xxx.c $CC -E kpv.xxx.c > kpv.xxx.cpp 2>/dev/null ed kpv.xxx.cpp >/dev/null 2>&1 <>sfstdhdr.h # determine the right names for the given objects for name in _iob _filbuf _flsbuf _uflow _overflow _sf _srget _swbuf _sgetc _sputc do { echo "#include " case $name in _iob) echo "kpvxxx: stdin;" ;; _filbuf) echo "kpvxxx: getc(stdin);" ;; _flsbuf) echo "kpvxxx: putc(0,stdout);" ;; _uflow) echo "kpvxxx: getc(stdin);" ;; _overflow) echo "kpvxxx: putc(0,stdout);" ;; _sf) echo "kpvxxx: stdin;" ;; _srget) echo "kpvxxx: getc(stdin);" ;; _swbuf) echo "kpvxxx: putc(0,stdout);" ;; esac } >kpv.xxx.c case $name in _iob) pat='__*iob[a-zA-Z0-9_]*' ;; _filbuf) pat='__*fi[a-zA-Z0-9_]*buf[a-zA-Z0-9_]*' ;; _flsbuf) pat='__*fl[a-zA-Z0-9_]*buf[a-zA-Z0-9_]*' ;; _uflow) pat='__*u[a-z]*flow[a-zA-Z0-9_]*' ;; _overflow) pat='__*o[a-z]*flow[a-zA-Z0-9_]*' ;; _sf) pat='__*s[fF][a-zA-Z0-9_]*' ;; _srget) pat='__*sr[a-zA-Z0-9_]*' ;; _swbuf) pat='__*sw[a-zA-Z0-9_]*' ;; esac rm kpv.xxx.name >/dev/null 2>&1 $CC -E kpv.xxx.c > kpv.xxx.cpp 2>/dev/null grep kpvxxx kpv.xxx.cpp | grep "$pat" > kpv.xxx.name if test "`cat kpv.xxx.name`" = "" then echo "${name}_kpv" > kpv.xxx.name else ed kpv.xxx.name >/dev/null 2>&1 <>sfstdhdr.h done { echo '#if _lib___srget && !defined(NAME_srget)' echo '#define NAME_srget "__srget"' echo '#undef _filbuf' echo '#define _filbuf __srget' echo '#endif' echo "" echo '#if _lib___swbuf && !defined(NAME_swbuf)' echo '#define NAME_swbuf "__swbuf"' echo '#undef _flsbuf' echo '#define _flsbuf __swbuf' echo '#endif' echo '#if _u_flow && !defined(NAME_uflow)' echo '#define NAME_uflow "__uflow"' echo '#undef _filbuf' echo '#define _filbuf __uflow' echo '#endif' echo '#if _under_flow && !_u_flow && !defined(NAME_uflow)' echo '#define NAME_uflow "__underflow"' echo '#undef _filbuf' echo '#define _filbuf __underflow' echo '#endif' echo "" echo '#if _lib___overflow && !defined(NAME_overflow)' echo '#define NAME_overflow "__overflow"' echo '#undef _flsbuf' echo '#define _flsbuf __overflow' echo '#endif' } >>sfstdhdr.h exit 0 @ 1.2 log @Incorporate stuff from RSE's Sfio98 variant @ text @d112 17 @ 1.1 log @Initial revision @ text @d10 1 a10 1 # _sF, _srget, _swbuf, _sgetc, _sputc: BSD stuffs d23 5 a27 2 # clear the generated header file >sfstdhdr.h d36 2 a37 2 .w sfstdhdr.h E sfstdhdr.h d44 1 a59 2 _sgetc) echo "kpvxxx: getc(stdin);" ;; _sputc) echo "kpvxxx: putc(0,stdout);" ;; a71 2 _sgetc) pat='__*sg[a-zA-Z0-9_]*' ;; _sputc) pat='__*sp[a-zA-Z0-9_]*' ;; d101 11 a111 9 # hack for BSDI { echo "#ifdef NAME_sgetc" echo "#undef NAME_sgetc" echo "#define NAME_srget \"__srget\"" echo "#endif" echo "#ifdef NAME_sputc" echo "#undef NAME_sputc" echo "#define NAME_swbuf \"__swbuf\"" echo "#endif" @ 1.1.1.1 log @Import of Sfio1997 @ text @@ 1.1.1.2 log @Import of Sfio1998 @ text @d10 1 a10 1 # _sF, _srget, _swbuf: BSD stuffs d23 2 a24 5 # initialize generated header file { echo '#include "ast_common.h"' echo '#include "FEATURE/sfio"' echo '#include "FEATURE/stdio"' } >sfstdhdr.h d33 2 a34 2 .w kpv.xxx.h E kpv.xxx.h a40 1 echo "`cat kpv.xxx.h`" >>sfstdhdr.h d56 2 d70 2 d101 9 a109 11 { echo '#if _lib___srget && !defined(NAME_srget)' echo '#define NAME_srget "__srget"' echo '#undef _filbuf' echo '#define _filbuf __srget' echo '#endif' echo "" echo '#if _lib___swbuf && !defined(NAME_swbuf)' echo '#define NAME_swbuf "__swbuf"' echo '#undef _flsbuf' echo '#define _flsbuf __swbuf' echo '#endif' @ 1.1.1.3 log @Import of Sfio1999 @ text @a111 17 echo '#if _u_flow && !defined(NAME_uflow)' echo '#define NAME_uflow "__uflow"' echo '#undef _filbuf' echo '#define _filbuf __uflow' echo '#endif' echo '#if _under_flow && !_u_flow && !defined(NAME_uflow)' echo '#define NAME_uflow "__underflow"' echo '#undef _filbuf' echo '#define _filbuf __underflow' echo '#endif' echo "" echo '#if _lib___overflow && !defined(NAME_overflow)' echo '#define NAME_overflow "__overflow"' echo '#undef _flsbuf' echo '#define _flsbuf __overflow' echo '#endif' @