#! /bin/csh -fe
# msCcFront base
# (input: base.c2c.c) (output: `arch`/base.s)
#
set base = $argv[1]
set dir = `arch`
/lib/cpp ${base}.c2c.c > ${base}.E
/bin/awk 'BEGIN {mesaSource = 0} \
 /^#/ {if (mesaSource == 0) \
  {if ($2 >= 123000 && $3 == "\"'$base'.mesa\"") \
   mesaSource = 1} \
  else if ($3 == "\"'$base'.c2c.c\"") continue} \
 {print}' ${base}.E > ${base}.E.c
/lib/ccom -Xg ${base}.E.c > ${dir}/${base}.s
#/usr/local/bin/msScript -mob ${base}.mob -as ${dir}/${base}.s -out ${dir}/${base}.mob.s
/bin/rm -f ${base}.E.c ${base}.E