user_help/0
hook:- multifile user_help/0.
user_help
A hook for users to add more information when help/0
is called.
Useful when you want a standard way to tell users something, like how to run a demo.
help/0
always calls user_help/0
in module user
.
Therefore, to be visible to help/0
, user_help/0
must either
be defined in or imported into module user
.
The common test harness for many Quintus test suites includes the clause:
user_help :- suite_type(_,Type), suite_host(Host), write('You have loaded the Quintus test suite for '), write(Type), write(' on '), write(Host), nl, nl, write('You can invoke the suite as follows:'), nl, nl, write(' ?- quiet. % run suite, concise output'), nl, write(' ?- verbose. % run suite, verbose output'), nl, write(' ?- quiet(+Pred). % run suite, concise output for'), nl, write(' % tests of predicate Pred'), nl, write(' ?- quiet(+Pred, +N). % similar to above, but runs the'),nl, write(' % test specified by N'), nl, write(' ?- verbose(+Pred). % run suite, verbose output for'), nl, write(' % tests of predicate Pred'), nl, write(' % (Pred a name, NOT name/arity!'),nl, write(' ?- verbose(+Pred, +N). % similar to above, but runs the'),nl, write(' % test specified by N'), nl, write(' ?- help. % to get this message'), nl.
So if you compile the Prolog, C, Pascal or FORTRAN suites, you have a consistent help message telling you how to run the suites:
<run prolog> <compile /ptg/suite/plsuite.pl> | ?- help.
If you have loaded the Quintus test suite for Prolog on Sun ??? you can invoke the suite as follows:
?- quiet. % run suite, concise output ?- verbose. % run suite, verbose output ?- quiet(+Pred). % run suite, concise output for % tests of predicate Pred ?- quiet(+Pred, +N). % similar to above, but runs the % test specified by N ?- verbose(+Pred). % run suite, verbose output for % tests of predicate Pred % (Pred a name, NOT name/arity! ?- verbose(+Pred, +N). % similar to above, but runs the % test specified by N ?- help. % to get this message
help/1
ref-olh