next up previous contents index
Next: Functions and Procedures Up: TypesConstants and Variables Previous: Constants

Variables

The following variables are defined and initialized in the system unit:

var
  output,input,stderr : text;
  exitproc : pointer;
  exitcode : word;
  stackbottom : longint;
  loweststack : longint;
The variables ExitProc, exitcode are used in the Free Pascal exit scheme. It works similarly to the on in Turbo Pascal:

When a program halts (be it through the call of the Halt function or Exit or through a run-time error), the exit mechanism checks the value of ExitProc. If this one is non-Nil, it is set to Nil, and the procedure is called. If the exit procedure exits, the value of ExitProc is checked again. If it is non-Nil then the above steps are repeated.

So if you want to install your exit procedure, you should save the old value of ExitProc (may be non-Nil, since other units could have set it before you did). In your exit procedure you then restore the value of ExitProc, such that if it was non-Nil the exit-procedure can be called.

The ErrorAddr and ExitCode can be used to check for error-conditions. If ErrorAddr is non-Nil, a run-time error has occurred. If so, ExitCode contains the error code. If ErrorAddr is Nil, then ExitCode contains the argument to Halt or 0 if the program terminated normally.

ExitCode is always passed to the operating system as the exit-code of your process.

Under GO32, the following constants are also defined :

const
   seg0040 = $0040;
   segA000 = $A000;
   segB000 = $B000;
   segB800 = $B800;
These constants allow easy access to the bios/screen segment via mem/absolute.



Michael Van Canneyt
Thu Sep 10 14:02:43 CEST 1998