1.2.41 $I or $INCLUDE : Include compiler info

In this form:


the {$INCLUDE} directive inserts a string constant in the source code.

Here XXX can be one of the following:

Inserts the current date. It will be formatted as YYYY/MM/DD.
Inserts the target CPU name. (deprecated, use FPCTARGETCPU)
Inserts the target CPU name.
Inserts the target OS name.
Current compiler version number.
Filename in which the directive is found.
Line number on which the directive is found.
Line number on which the directive is found. In this case, the result is an integer, not a string.
Current time, formatted as HH:MM:SS

If XXX is none of the above, then it is assumed to be the name of an environment variable. Its value will be fetched from the environment, if it exists, otherwise an empty string is inserted. As a result, this will generate a macro with the value of the XXX specifier, as if it were a string (or, in the case of LINENUM, an integer).

For example, the following program

Program InfoDemo;  
Const User = {$I %USER%};  
  Write (’This program was compiled at ’,{$I %TIME%});  
  Writeln (’ on ’,{$I %DATE%});  
  Writeln (’By ’,User);  
  Writeln (’Compiler version: ’,{$I %FPCVERSION%});  
  Writeln (’Target CPU: ’,{$I %FPCTARGET%});  

Creates the following output:

This program was compiled at 17:40:18 on 1998/09/09  
By michael  
Compiler version: 0.99.7  
Target CPU: i386

Remark: Note that the inclusion of DATE and TIME will not cause the compiler to recompile the unit every time it is used: the date and time will be the date and time when the unit was last compiled.