[ Predicate Database and Compiler | The ECLiPSe Built-In Predicates | Reference Manual | Alphabetic Index ]

# compile_stream(+Stream)

Compile the given stream Stream.

Stream
  Integer or atom.

## Description

Used to compile from an arbitrary input stream Stream.

Stream may be a physical stream number or a reserved or user-defined symbolic stream name. The stream can be of any type, e.g. file, tty, socket, queue, string, etc.

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.

### Modes and Determinism

- compile_stream(+) is det

### Modules

This predicate is sensitive to its module context (tool predicate, see @/2).

### Exceptions

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

## Examples

    compile_string(String) :-
    	open(string(String), read, S),
    	compile_stream(S),
    	close(S).

    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, pragma / 1