#! /bin/csh -f
set noglob
set lib = lib.index
set pi = ../syntax/parseimp
set a = "$<"
while ("$a" != "")
	echo "$a" | grep -s "import type"
	if ($status != 0) then
		set name = `echo "$a" | sed -e 's/import \([^:]*\).*/\1/'`
		if ("$1" == "-Z") then
#			set a = `echo "$a" | sed -e 's/\([^a-zA-Z0-9_]\)_\([a-zA-Z0-9_]\)/\1\2/g'`
		else
			set name = "_$name"
		endif
		echo "$a 1" | lmlp $1 | $pi >"parsed/${name}.p"
		grep -s "^$name"'$' $lib || echo "$name" >>$lib
	endif
	set a = "$<"
end
