|Did you know ...||Search Documentation:|
|library(main): Provide entry point for scripts|
library(pce_main), which starts the GUI and processes events until all windows have gone.
This library is intended for supporting PrologScript on Unix using
#! magic sequence for scripts using commandline options.
The entry point main/0 calls
the user-supplied predicate main/1 passing
a list of commandline options. Below is `echo' in Prolog (adjust
/usr/bin/swipl to where SWI-Prolog is installed)
#!/usr/bin/env swipl :- initialization(main, main). main(Argv) :- echo(Argv). echo() :- nl. echo([Last]) :- !, write(Last), nl. echo([H|T]) :- write(H), write(' '), echo(T).
SIGINT(Control-C) that terminates the process with status 1.
no-, in which case the option is mapped to Name(false). Numeric option values are mapped to Prolog numbers.
library(optparse)provides a more involved option library, providing both short and long options, help and error handling. This predicate is more for quick-and-dirty scripts.