11.3.176 query_hook/6 [hook]

Synopsis

:- multifile 'SU_messages':query_hook/6.

'SU_messages':query_hook(+QueryClass, +Prompt, +PromptLines, +Help, +HelpLines, -Answer)

Provides a method of overriding Prolog's default keyboard based input requests.

Arguments

QueryClass
term

Determines the allowed values for the atom Answer.

Prompt
term

A message term.

PromptLines
list of pair

The message generated from the Prompt message term.

Help
term

A message term.

HelpLines
list of pair

The message generated from the Help message term.

Answer
term

See QueryClass

Description

This provides a way of overriding Prolog's default method of interaction. If this predicate fails, Prolog's default method of interaction is invoked.

The default method first prints out the prompt, then if the response from the user is not one of the allowed values, the help message is printed.

It is useful to compare this predicate to user:message_hook/3, since this explains how you might use the Prompt, PromptLines, Help, HelpLines.

Exceptions

An exception raised by this predicate causes an error message to be printed and then the default method of interation is invoked. In other words, exceptions are treated as failures.

See Also

Query Processing.


Send feedback on this subject.