Prev Next Up Home Keys Figs Search New

Prolog Scripts

Appeared in Volume 10/1, February 1997

Keywords: web programming.


vannoord@let.rug.nl
Gertjan van Noord
23rd August 1996

A while ago someone presented a tool called 'prolog_shell' which could be used to turn a Prolog source file into a script. Such a script could be called from the command line, or become a script in a Web application for example.

There is an easier solution, which:

Here is an example:

#!/bin/sh
echo "<H2> Title </H2>
eval '/sysadm/web/htbin/cgiparse -form'
echo "Arguments: $FORM_a1<P>"
cat << EOF | /usr/local/bin/sicstus -f -a $FORM_a1

reconsult(user).

% Start of Prolog source file; this includes a definition for % the predicate main/1. Its single argument is a list of input % arguments. ... ... ... % Change this for SICStus 3 (prolog_flag(argv,...) :- unix(argv(Args)), main(Args). EOF # The EOF marks the end of the input to the SICStus command. # You can continue your shell script here...

Prev Next Up Home Keys Figs Search New