PROMPT-READ : UTILITY

PROMPT-READ is an utility.
PROMPT-READ is the canonical way of doing input in TPS.
It provides argument type checking, a default mechanism and options
which allow ? and ?? help and arbitrarily many other special responses.
Its form is
(PROMPT-READ internal-var external-var
initial-message-form argument-type default-value
((response form ...) (response form ...)))
internal-var will hold the internal representation of the user's response
after the input.

external-var will hold the external representation of what the user typed.
If external-var = NIL, the external form of the input is thrown away.

initial-message-form is evaluated and should somehow output the initial
part of the prompt.

argument-type is the type of the object that the user is supposed to input.
Common here is 'YESNO

default-value is the internal representation of the default for the input.
A default-value of $ means that there is no default.

((response form ...) (response form ...)) are forms to handle special responses
like ?, ?? or perhaps <Esc>. response is either a single symbol or a list
of symbols and form ... are evaluated in case one of the corresponding
responses has been typed. A common use is

((? (msgf "Please decide whether you want to see any more news."))
(?? (mhelp 'yesno)))
Here is a complete example of a use of PROMPT-READ within an initialization
dialogue:

(let (ldefp)
(prompt-read
ldefp nil
(msgf "Load private definitions? ")
'yesno 'nil
((? (msgf "Load PPS:DEFS and PPS:MODES.INI ?"))
(?? (mhelp 'yesno)))))

(when ldefp (lload "pps:defs") (lload "pps:modes.ini")))

TPS documentation homepage


© 1988-99, Carnegie Mellon University.

TPS homepage