#! /bin/sh # $Id: gen-scale.sh,v 1.6 2005/12/28 22:51:52 tom Exp $ # # This script generates source variations from scale.c for different datatypes. UPPER="$1" MIXED="$2" DTYPE="$3" CTYPE="$4" # The widget provides for setting the digits. Turn on/off the corresponding # ifdef. case $CTYPE in float|*double) float=1 print=f ;; long*long) float=0 print=ll ;; unsigned*long) float=0 print=lu ;; unsigned) float=0 print=u ;; long) float=0 print=l ;; *) float=0 print=d ;; esac if test "$print" = "d" ; then MODEL= elif test $CTYPE = double; then MODEL="d" else MODEL=$print fi if test $float = 0 ; then sed -e '/^#if /,/^#endif /d' \ -e '/^#if /d' \ -e '/^#endif /d' \ -e 's//'"$UPPER"'/g' \ -e 's//'"$MIXED"'/g' \ -e 's//'"$DTYPE"'/g' \ -e 's//'"$CTYPE"'/g' \ -e 's//'"$MODEL"'/g' \ -e 's//'"$print"'/g' \ $5 else sed -e '/^#if /,/^#endif /d' \ -e '/^#if /d' \ -e '/^#endif /d' \ -e 's//'"$UPPER"'/g' \ -e 's//'"$MIXED"'/g' \ -e 's//'"$DTYPE"'/g' \ -e 's//'"$CTYPE"'/g' \ -e 's//'"$MODEL"'/g' \ -e 's//'"$print"'/g' \ $5 fi