home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / unixtex-6.1b-src.tgz / tar.out / contrib / unixtex / web2c / lib / convert < prev    next >
Text File  |  1996-09-28  |  893b  |  36 lines

  1. #!/bin/sh
  2. # Convert WEB programs not needing special treatment to C.
  3. # $1 is the Pascal file to be converted.
  4. # $2 is the C file to be created.
  5. # $3 is the source directory, which might not be '.'
  6. # $4, if present, is extended with .h, and #included in the C file, and
  7. # extended with .defines, and prepended along with the common
  8. # definitions.
  9.  
  10. pascalfile=$1
  11. basefile=`basename $1 .p`
  12. cfile=$2
  13. srcdir=$3
  14.  
  15. # We use cpascal.h instead of config.h because getopt.c and perhaps
  16. # other straight C routines don't need or want the Pascal definitions of
  17. # `chr' and the like.
  18. hfile=cpascal.h
  19. defnfile=
  20.  
  21. if test $# -eq 4; then
  22.   hfile=$4.h
  23.   defnfile=$4.defines
  24. fi
  25.  
  26. cat $srcdir/../lib/common.defines $defnfile $pascalfile \
  27.     | ../web2c/web2c -h$hfile -c$basefile \
  28.     | ../web2c/fixwrites $basefile > $cfile
  29.  
  30. if test $? -ne 0; then
  31.   echo "web2c conversion failed, goodbye." 1>&2
  32.   exit 1
  33. fi
  34. exit 0
  35.