From jan@swi.psy.uva.nl  Thu Dec  2 17:12:42 1999
Received: from gollem.swi.psy.uva.nl (root@gollem [145.18.114.15])
	by swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id RAA25276;
	Thu, 2 Dec 1999 17:12:42 +0100 (MET)
Received: (from jan@localhost)
	by gollem.swi.psy.uva.nl (8.9.3/8.9.3) id RAA09188;
	Thu, 2 Dec 1999 17:11:56 +0100
Date: Thu, 2 Dec 1999 17:11:56 +0100
Message-Id: <199912021611.RAA09188@gollem.swi.psy.uva.nl>
From: Jan Wielemaker <jan@swi.psy.uva.nl>
Subject: Re: compiling/0
To: Hubert Ulrich <Ulrich.Hubert@icn.siemens.de>
In-Reply-To: Hubert Ulrich's message of Thu, 2 Dec 1999 17:02:50 +0100 
Phone: +31 - 20 - 525 6121
Cc: prolog@gollem.swi.psy.uva.nl

> Your manual says:
> 
> compiling
>      Succeeds if the system is compiling source files with the -c option
> into an intermediate code file. Can be used to perform code optimisations in
>      expand_term/2 under this condition. 
> 
> 
> 
> 
> Now my example (t1.pl):
> 
> 
> --------------------------
> t :-
>   compiling,
>   write('*********in compiler'),nl.
> 
> t :-
>   not compiling,
>   write('*********not in compiler'),nl.
> 
> 
> :- initialization(t).
> -----------------------------
> 
> And my result:
> 
> $pl -c t1.pl
> *********not in compiler
> t1.pro compiled, 0.00 sec, 988 bytes.
> 
> ------------------------------
> 
> 
> Another magic problem?

No, an error in the manual.  Compiling is defined if we are compiling
directly to `Quick Load Format' as now used only by qcompile/1.  If you
want to know whether or not a file is being loaded, you should be able
to use prolog_load_context(file, File), which yields the file being
loaded or fails if no file is being loaded.

If you want a directive executed only at program startup, you can use

:- at_initialization(t).

Try ?- listing(initialization) and you know why :-)

	Regards --- Jan

