[ Predicate Database and Compiler | Reference Manual | Alphabetic Index ]

compile(++File)

Compile specified file, or list of files, with default options
File
Atom, structure or string, or a list of them.

Description

Compiles the specified ECLiPSE source file or list of source files. The default options are used, and the resulting code is directly loaded into memory and ready for execution. See compile/2 for details.

Modes and Determinism

Modules

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

Exceptions

(4) instantiation fault
File is not instantiated.
(5) type error
File is instantiated, but not to an atom or string, or a list of atoms or strings.
(61) inconsistent tool redefinition
A predicate that was already defined is later declared to be a tool.
(62) inconsistent procedure redefinition
Illegal attempt to change a predicate's properties like: tool, dynamic, demon, parallel, calling convention.
(82) trying to access a locked module
The module in which the clauses should be compiled is locked.
(94) trying to redefine an existing imported procedure
There is already am imported predicate of the same name.
(130) illegal clause head
The head of a clause is not an atom or a compound term.
(131) illegal goal in clause body
A subgoal in the body of a clause is not an atom, a compound term or a variable.
(134) procedure clauses are not consecutive
The clauses of a procedure are not consecutive.
(137) trying to redefine a procedure with another type
A procedure which was previously referenced as built-in or external is now defined as a regular one, or vice versa.
(139) compiled or dumped file message
This event is invoked at the end of each compiled file, by default it prints the compilation time and size of compiled code.
(143) compiled query failed
A query in the compiled file has failed. This is by default ignored and the compilation continues.
(145) procedure being redefined in another file
A procedure is being redefined in another file than the original one.
(147) compilation aborted
This event is raised just before a compilation is aborted because of an error.
(148) bad pragma
An unrecognised pragma was used in the code.
(171) File does not exist :
File does not exist.

Examples

Success:
   [hanoi].         % compiles the file hanoi.pl

   [eclipse]: sh('cat file1').
   p:-q(hello).
   yes.
   [eclipse]: sh('cat file2').
   q(X) :- writeln(X).
   yes.
   [eclipse]: compile(user), p.
    p :- writeln(hi).
    user compiled 92 bytes in 0.00 seconds
   hi
   yes.
   [eclipse]: compile([file1, file2]), p.
   /home/lp/user/file1 compiled 32 bytes in 0.02 seconds
   /home/lp/user/file2 compiled 92 bytes in 0.00 seconds
   hello
   yes.


   % example showing use of relative pathnames.
   [eclipse]: sh('ls -FR /home/lp/user/pl').
   a.pl        util/

   /home/lp/user/pl/util:
   b.pl        c.pl

   yes.
   [eclipse]: sh('cat /home/lp/user/pl/a.pl').
   :- compile('util/b').
   p.

   yes.
   [eclipse]: compile('/home/lp/user/pl/a').
   /home/lp/user/pl/util/b.pl compiled 92 bytes in 0.00 seconds
   /home/lp/user/pl/a.pl compiled 28 bytes in 0.00 seconds
   yes.

Error:
   compile(F).            (Error 4).
   compile(file1/1).      (Error 5).
   compile(file).         (Error 171).

See Also

compile / 2, compile_stream / 1, compile_term / 1, compile_term / 2, ensure_loaded / 1, lib / 1, use_module / 1, pragma / 1, fcompile : fcompile / 1