Commit d1097bec authored by Michael Hanus's avatar Michael Hanus
Browse files

tools and libs updated, runcurry script added

parent b6749a06
......@@ -53,6 +53,7 @@ bin/currypp
bin/data2xml
bin/erd2curry
bin/fcypp
bin/runcurry
bin/spiceup
cpns/CPNSD
curry2prolog/prologbasics.pl
......
......@@ -262,13 +262,13 @@ readCharParseError(unchecked,S) :- % show always error in .fcy file reading
take(20,S,Line),
putChars(user_error,Line), writeErr('...'), nlErr,
writeErr('Hint: do not use UTF encoding but 8bit chars (check your locale settings)'), nlErr,
!, fail.
raise_exception('parse error').
readCharParseError(_,S) :-
pakcsrc(readtermerrors,yes),
writeErr('ERROR in ReadShowTerm.readTerm: illegal character in remaining string:'),
nlErr,
putChars(user_error,S), nlErr,
!, fail.
raise_exception('parse error in ReadShowTerm.readTerm').
readParseError(S) :-
pakcsrc(readtermerrors,yes),
......@@ -358,6 +358,8 @@ readChar([92,N|S],T,C) :- N>=48, N<58, !, % read decimal numeric char
readChar([92,N,39|T],T,C) :- !,
readStringChar(N,NS),
char_int(C,NS).
readChar([92,69,83,67,39|T],T,C) :- !, char_int(C,27). % '\ESC' character
readChar([92,68,69,76,39|T],T,C) :- !, char_int(C,127). % '\DEL' character
readChar([N,39|T],T,C) :- char_int(C,N).
readDecimalChar(N,[39|T],T,C) :- !, char_int(C,N).
......
currytools @ 101cb513
Subproject commit 013287555fa4fe3b1ec1051c2807150a321330e4
Subproject commit 101cb51368673b5a00bcd6f0e28c0802401d42ab
lib-trunk @ 8d901f4d
Subproject commit 126fb901c01907aed6c82019eca3b7fb8fd11cf6
Subproject commit 8d901f4d5300d945a0bab205e01f907f368db77b
......@@ -5,7 +5,7 @@
# the scripts to be installed
BINS = $(BINDIR)/pakcs $(BINDIR)/makecurrycgi \
$(BINDIR)/.makesavedstate $(BINDIR)/parsecurry $(BINDIR)/cleancurry \
$(BINDIR)/fcypp
$(BINDIR)/fcypp $(BINDIR)/runcurry
.PHONY: all
......
#!/bin/sh
# run a Curry program without explicitly invoking the interactive environment
# Define the main directory where PAKCS is installed:
PAKCSHOME=`echo PAKCSHOME must be defined here!`
export PAKCSHOME
# usage function:
show_usage () {
echo "Usage:"
echo
echo "As a shell command:"
echo "> runcurry [Curry system options] <Curry program> <run-time arguments>"
echo
echo "As a shell script: start script with"
echo "#!/usr/bin/env runcurry"
echo "...your Curry program defining operation 'main'..."
echo
echo "In interactive mode:"
echo "> runcurry"
echo "...type your Curry program until end-of-file..."
}
# define a new Curry file name:
NEWMOD=RUNCURRY$$
while [ -f $NEWMOD.curry ] ; do
NEWMOD=$NEWMOD_0
done
NEWPROG=$NEWMOD.curry
DELPROG=no
if [ $# = 0 ] ; then
# no arguments provided, use remaining input as program:
PROG=$NEWPROG
cat > $PROG
DELPROG=yes
elif [ $# = 1 ] ; then
if [ "$1" = "-h" -o "$1" = "--help" -o "$1" = "-?" ] ; then
show_usage ; exit
fi
PROG=$1
shift
# check whether runcurry is called in script mode, i.e., the argument
# is not a Curry program but an existing file:
PROGwolcurry=`expr $PROG : '\(.*\)\.lcurry'`
PROGwocurry=`expr $PROG : '\(.*\)\.curry'`
if [ -z "$PROGwolcurry" -a -z "$PROGwocurry" -a -f $PROG ] ; then
# store PROG in a Curry program, but remove lines starting with '#':
sed 's|^#.*$||' < $PROG > $NEWPROG
DELPROG=yes
PROG=$NEWPROG
fi
else
# split arguments into system arguments and Curry program:
CURRYSYSARGS=
PROG=
while [ -z "$PROG" ] ; do
# check whether argument is the name of a Curry program:
PROGwolcurry=`expr $1 : '\(.*\)\.lcurry'`
PROGwocurry=`expr $1 : '\(.*\)\.curry'`
if [ -z "$PROGwolcurry" -a -z "$PROGwocurry" ] ; then
CURRYSYSARGS="$CURRYSYSARGS $1"
else
PROG=$1
fi
shift
if [ $# = 0 ] ; then
echo "ERROR: No Curry program name provided as argument!" >&2
exit 1
fi
done
fi
$PAKCSHOME/bin/curry :set v0 :set parser -Wnone $CURRYSYSARGS :load "$PROG" :set args ${1+"$@"} :eval main :quit
if [ $DELPROG = yes ] ; then
cleancurry "$PROG"
rm "$PROG"
fi
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment