ocaml/camlp4/tools/camlp4_comm.mpw

54 lines
1.9 KiB
Plaintext
Raw Normal View History

#######################################################################
# #
# Camlp4 #
# #
# Damien Doligez, projet Para, INRIA Rocquencourt #
# #
# Copyright 1999 Institut National de Recherche en Informatique et #
# en Automatique. Distributed only by permission. #
# #
#######################################################################
# $Id$
set echo 0
exit if {#} < 1
set args1 ""
set file ""
loop
break if {#} == 0
if "{1}" =~ /<2F>.ml<6D>/
set file "{1}"
else
set args1 "{args1} `quote "{1}"`"
end
shift
end
set firstline "`streamedit -e '1 exit' "{file}"`" <20> dev:null || set status 0
if "{firstline}" =~ /[<5B> ]+ camlp4r (<28>)<29>0/
set args0 "`echo "{<7B>0}" | streamedit -e '1,$ replace -c <20> /[()*]/ ""' <20>
-e '1,$ replace -c <20> /.<2E>// ":"'`"
set comm "{OTOP}boot:ocamlrun ::boot:camlp4r -nolib -I ::boot:"
echo "{comm} {args0} {args1} {file}"
{comm} {args0} {args1} "{file}"
else if "{firstline}" =~ /[<5B> ]+ camlp4 (<28>)<29>0/
set args0 "`echo "{<7B>0}" | streamedit -e '1,$ replace -c <20> /[()*]/ ""' <20>
-e '1,$ replace -c <20> /.<2E>// ":"'`"
set comm "{OTOP}boot:ocamlrun ::boot:camlp4 -nolib -I ::boot:"
echo "{comm} {args0} {args1} {file}"
{comm} {args0} {args1} "{file}"
else if "{file}" =~ /(<28>)<29>0.mli/
echo duplicate -y {file} {<7B>0}.ppi
duplicate -y "{file}" "{<7B>0}.ppi"
else if "{file}" =~ /(<28>)<29>0.ml/
echo duplicate -y {file} {<7B>0}.ppo
duplicate -y "{file}" "{<7B>0}.ppo"
else
echo duplicate -y {file} {file}.ppo
duplicate -y "{file}" "{file}.ppo"
end