Next: Libraries
Up: The Compiler
Previous: Compiler Modes
The compiler normally reads a file up to its end.
The file end can also be simulated with a clause
end_of_file.
The file is normally read consecutively, however
the compiler uses the normal ECLiPSe
I/O streams,
and so if during the compilation the stream pointer is modified
(e.g. by seek/2 or read/2), the compiler continues
at the specified place.
There are several built-in predicates which invoke the compiler:
-
- compile(File)
This is the standard compiler predicate.
The contents of the file is compiled according to the current
state of the global flags.
-
- compile(File, Module)
This predicate is used to compile the contents of a file into
a specified module, without having to use the module declaration
in the file itself.
-
- compile_stream(Stream)
This predicate compiles a given stream up to its end
or to the end_of_file clause.
It can be used when the input file is already open,
e.g. when the beginning of the file does not contain
compiler input, or when the input has to be processed
in a non-consecutive way.
-
- compile_term(Clauses)
This predicate is used to compile a given term,
usually a list of clauses and directives.
Unlike assert/1 it compiles a static procedure,
and so it can be used to compile a procedure which is dynamically
created and then used as a static one.
For more information please refer to [17].
-
- dump(File)
This predicate stores the precompiled form of the given file
into a file with the suffix sd (Sepia Dump).
It can be used to speed up the compilation or to deliver
program modules whose source should not be readable.
-
- ensure_loaded(File)
This predicate compiles the specified file if it has not been compiled
yet or if it has been modified since the last compilation.
-
- make
This predicate recompiles all files that have been modified since their
last compilation.
-
- lib(File)
This predicate is used to ensure that a specified library
file is loaded.
If this library is not yet compiled, the system will look
in all directories in the library_path flag for
a file with this name.
When the file is found, it is compiled and the system remembers it.
-
- current_compiled_file(File, Time, Module)
This predicate returns on backtracking all files that have been compiled
in this session, together with the module from where the compilation was
done and the modification time stamp of the file at the time it was compiled.
-
- compiled_file(File, Line)
This predicate allows to access the compiled file during the compilation.
If it is called during the compilation, it returns the name
of the file being compiled and the current line in it.
If some I/O operations are performed on the compiler stream,
it influences the compiler, e.g. some procedures can be omitted
and some compiled several times.
An example of its use is the library ifdef
which implements a C-like conditional compilation.
-
- assert(Clause)
This predicate compiles the given clause of a dynamic predicate.
Next: Libraries
Up: The Compiler
Previous: Compiler Modes
Micha Meier
Mon Mar 4 12:11:45 MET 1996