Node:Interfacing with UNIX, Next:Interfacing with C++, Up:Interfacing with Other Languages
Wrap the file into an executable Shell script that simply invokes
SICStus. Informational messages can be filtered out by redirecting
stderr
to /dev/null
. For example:
#!/bin/sh exec sicstus 2> /dev/null -f -a "$@" <<EOF % Tell SICStus to consult the sources. % The embedded command invokes main(Args) % where Args is the script's arguments passed as a list of atoms. [user]. main(Args) :- format('Hello world!\n\c Invoked with args = ~q\n', [Args]). :- prolog_flag(argv, Args), main(Args). EOF
The above script can be invoked as follows:
% ./hw.sh a 236U ka=ka Hello world! Invoked with args = [a,'236U','ka=ka']