[ ECLiPSe Predicate Database built-in.|Group Index| Full Index]

compile_stream(+Stream)

Compile the given stream Stream.

+Stream
Integer or atom.

Description

Used to compile an input stream Stream.

Stream may be a physical stream number or a reserved or user-defined symbolic stream name.

If Stream is an opened input stream, its content is read and compiled as in compile/1. The compilation stops at the stream end, but the stream remains open.

Fail Conditions

None.

Resatisfiable

No.

Exceptions

(4) Instantiation fault
Stream is not instantiated.
(5) Type error
Stream is instantiated, but not to an atom or integer.
(192)
Stream is in an illegal stream mode.
(193)
Stream is an illegal stream specification.

Examples


Success:
     [eclipse]: open(X, string(25), s).
     X = ""
     yes.
     [eclipse]: writeln(s, "q(X) :- write(X)."), at(s,P).
     P = 18
     yes.
     [eclipse]: compile_stream(s),     % pointer must be at
     > q(hi).                        % the start of the file.
     string compiled 0 bytes in 0.00 seconds
     calling an undefined procedure q(hi) in module eclipse
     [eclipse]: seek(s,0), compile_stream(s).
     string compiled 96 bytes in 0.05 seconds
     yes.
     [eclipse]: q(hi).
     hi
     yes.
     [eclipse]: seek(s,18), write(s, " b.").
     yes.
     [eclipse]: seek(s,0), compile_stream(s).
     string compiled 124 bytes in 0.05 seconds
     yes.
     [eclipse]: q(hi).
     hi
     yes.
     [eclipse]: b.
     yes.

     [eclipse]: [user].
      compile_term(Term) :-
                open(_, string, s),
                write(s,Term),
                write(s, " .\n"),
                seek(s,0),
                compile_stream(s),
                close(s).
      user compiled 380 bytes in 0.02 seconds
     yes.
     [eclipse]: compile_term(g(X) :- writeln(X)).
     string compiled 56 bytes in 0.00 seconds
     X = _g60
     yes.
     [eclipse]: g(hi).
     hi
     yes.

Error:
     compile_stream(X).      (Error 4).
     compile_stream(1.0).    (Error 5).
     compile_stream(1).      (Error 192).
     compile_stream(2).      (Error 192).
     compile_stream(20).     (Error 192).
     compile_stream(a).      (Error 193).


See Also

compile / 1, compile / 2, compiled_stream / 1, compile_term / 1, current_compiled_file / 3, set_flag / 2, dbgcomp / 0, nodbgcomp / 0