home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- # Convert WEB programs not needing special treatment to C.
- #
- # $1 is the Pascal file to be converted.
- # $2 is the C file to be created.
- # $3 is the source directory, which might not be '.'
- # $4, if present, is extended with .h, and #included in the C file, and
- # extended with .defines, and prepended along with the common
- # definitions.
-
- pascalfile=$1
- basefile=`basename $1 .p`
- cfile=$2
- srcdir=$3
-
- # We use cpascal.h instead of config.h because getopt.c and perhaps
- # other straight C routines don't need or want the Pascal definitions of
- # `chr' and the like.
- hfile=cpascal.h
- defnfile=
-
- if test $# -eq 4; then
- hfile=$4.h
- defnfile=$4.defines
- fi
-
- cat $srcdir/../lib/common.defines $defnfile $pascalfile \
- | ../web2c/web2c -h$hfile -c$basefile \
- | ../web2c/fixwrites $basefile > $cfile
-
- if test $? -ne 0; then
- echo "web2c conversion failed, goodbye." 1>&2
- exit 1
- fi
- exit 0
-