[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

kcl shell script



This is a new kcl shell script that replaces the existing kcl and lc.

To customize for your system, change the variable "dir" on the second
line to the directory containing your saved_kcl.  If you call the
lisp image by some other name, then change the third line from "saved_kcl"
to that name.

"kcl" without any argument gives you the interactive lisp.
"kcl -c file" compiles "file".
There are other options.  Giving an illegal flag (like -x)
prints the usage message.

---------------------
#!/bin/csh -f
set dir = /usr/public/kcl.lib
set kcl = saved_kcl
set a = "" a0 = U a1 = 1 a2 = 0 a3 = 0 a4 = 0
set ifile = "" ofile = ""
while ($#argv > 0)
	switch ($1)
	case -c:
		set a1 = 0 a2 = 1 a3 = 1 a4 = 1
		breaksw
	case -C:
		set a2 = 1 a3 = 1 a4 = 1
		breaksw
	case -o:
		shift
		set ofile = $1
		breaksw
	case -d:
		shift
		set dir = $1
		breaksw
	case -k:
		shift
		set kcl = $1
		breaksw
	case -s:
		set a0 = S
		breaksw
	case -*:
		echo ${1}: Unknown flag.
		echo 'Usage: kcl [-d dir] [-k kcl] [ [-c] [-C] [-s]' \
				'[-o ofile] ifile ]'
		echo '	-d dir		System directory, defaults to'
		echo '				'\"$dir\"
		echo '	-k kcl		Kcl binary, defaults to' \"$kcl\"
		echo '	-c		Produce C files only'
		echo '	-C		Produce C files as well'
		echo '	-s		Compile for system'
		echo '	-o ofile	Output file name, defaults to ifile'
		echo '	ifile		File to compile'
		exit 1
	case *:
		set ifile = $1
		breaksw
	endsw
	shift
end
if ($ifile != "" && $ofile == "") set ofile = $ifile
if ($ifile != "") set a = $a0$a1$a2$a3$a4
if ($kcl !~ */*) set kcl = $dir/$kcl
exec $kcl $dir/ $ifile $ofile $a
exit $status