[ Obsolete | Reference Manual | Alphabetic Index ]

get_prompt(+InStream, -Prompt, -OutStream)

Succeeds if the prompt for the stream InStream is Prompt and is written to the stream OutStream.
Integer (stream number) or Atom (reserved or user-defined symbolic stream name).
String, atom or variable.
Variable,Integer or Atom.

This built-in predicate is obsolete!


Used to get the prompt Prompt of the input stream InStream which is output to the stream OutStream.

When new data is to be read from an input stream, the system prints on the specified output stream a prompt, to notify the user.

InStream (and OutStream, when instantiated) can be a symbolic stream name (atom) or a physical stream number (integer). InStream must be an existing stream open in read or update mode. OutStream must be open in write or update mode.

Note that the prompt for toplevel-input printed by the system at the end of each query is made using the predicate toplevel-prompt/1 and not by using the string set by set_prompt/3.

Modes and Determinism


(4) instantiation fault
InStream is not instantiated.
(5) type error
Either InStream or OutStream (or both) is instantiated, but is neither an atom nor an integer.
(5) type error
Prompt is instantiated, but to neither an atom nor a string.
(192) illegal stream mode
InStream is not an input stream.
(192) illegal stream mode
OutStream is not an output stream.
(193) illegal stream specification
Either InStream or OutStream is an illegal stream specification (e.g. does not exist).


    [eclipse]: get_prompt(debug_input,_,input),% find where the
                                             % prompt is output;
    > set_prompt(debug_input,"> ",input).    % change it
    yes.                                     % destructively.

    [eclipse]: read(X).
    > a.
    X = a
    [eclipse]: get_prompt(input, Old, Out),
    > set_prompt(input, "Enter a term: ", Out), read(X).
    Enter a term: a.
    Old = "> "
    Out = 1
    X = a

    [eclipse]: get_stream(debug_input,S), % debug input prompt
    > set_prompt(S, " DEBUG: ", 1).
    S = 3
    [eclipse]: trace.
    [eclipse]: atom_string(atom, String).
    B (1) 0  CALL   atom_string(atom, _g52) DEBUG: creep
    B (1) 0  EXIT   atom_string(atom, "atom") DEBUG: creep
    String = "atom"


    get_prompt(I, "p", Stream).  (Error 4).
    get_prompt(0, Prompt, "5").  (Error 5).
    get_prompt(1, Prompt, 2).    (Error 192). % 1 in write mode
    get_prompt(0, Prompt, 30).   (Error 193). % no such stream

See Also

set_prompt / 3, get_stream_info / 3