next up previous contents
Next: Include files Up: Compiler usage Previous: Compiler usage

File searching

Before you start compiling a program or a series of units, it is important to know where the compiler looks for its source files and other files. In this section we discuss this, and we indicate how to influence this.

Remark: The use of slashes (/) and backslahses ( tex2html_wrap_inline2743 ) as directory separators is irrelevant, the compiler will convert to whatever character is used on the current operating system. Examples will be given using slashes, since this avoids problems on LINUX.

Command line files

The file that you specify on the command line, such as in

ppc386 foo.pp
will be looked for ONLY in the current directory. If you specify a directory in the filename, then the compiler will look in that directory:
ppc386 subdir/foo.pp
will look for foo.pp in the subdirectory subdir of the current directory.

Under LINUX, the name of this file is case sensitive, under other operating systems (DOS, WINDOWSNT, OS/2) this is not the case.

Unit files

When you compile a unit or program that needs other units, the compiler will look for compiled versions of these units in the following way:

  1. It will look in the current directory.
  2. It will look in the directory where the compiler binary is. (not under LINUX)
  3. It will look in all the directories specified in the unit search path.
You can add a directory to the unit search path with the -Up or -Fu options (See 5.1, See 5.1). Every occurrence of one of those options will append a directory to the unit search path.

On LINUX, the compiler will first convert the filename of a unit to all-lowercase. This is necessary, since Pascal is case-independent, and the statements Uses Unit1; or uses unit1; should have the same effect. Also, unit names that are longer than 8 characters will first be looked for with their full length. If the unit is not found with this name, the name will be truncated to 8 characters, and the compiler will look again in the same directories, but with the truncated name.

For instance, suppose that the file foo.pp needs the unit bar. Then the command

ppc386 -Up.. -Upunits foo.pp
will tell the compiler to look for the unit bar in the following places:
  1. In the current directory.
  2. In the directory where the compile binary is (not under LINUX).
  3. In the parent directory of the current directory.
  4. In the subdirectory units of the current directory

If the compiler finds the unit it needs, it will look for the source file of this unit in the same directory where it found the unit. If it finds the source of the unit, then it will compare the file times. If the source file was modified more recent than the unit file, the compiler will attempt to recompile the unit with this source file.

If the compiler doesn't find a compiled version of the unit, or when the -B option is specified, then the compiler will look in the same manner for the unit source file, and attempt to recompile it.

It is recommended to set the unit search path in the configuration file ppc386.cfg. If you do this, you don't need to specify the unit search path on the command-line every time you want to compile something.


next up previous contents
Next: Include files Up: Compiler usage Previous: Compiler usage

Michael Van Canneyt
Thu Sep 10 13:56:17 CEST 1998