Hardware manual
normally is simply the contents of the command line which invoked the subsystem (see section 5). The
subroutine package GP contains a procedure to facilitate reading this string according to the conventions
by which it is normally formatted. This is not a standard routine but must be loaded with your program.
(For more information on GP, see the "Alto Software Packages Manual.")
3.12. Finish -- Terminating Execution
When a program terminates operation, it "finishes," returns to the operating system and ultimately to the
Executive. A program may finish in several ways:
Bcpl return If the main procedure in the user program (the one invoked by
CallSubsys) ever returns, the program finishes. Equivalent to
OsFinish(fcOK).
Bcpl finish If the "finish" construct is executed in a Bcpl program, it
terminates. Equivalent to OsFinish(fcOK).
Bcpl abort If the "abort" construct is executed in a Bcpl program, it
terminates. Equivalent to OsFinish(fcAbort).
Swat abort If, during program execution, the "left shift" key and the "Swat
key" (lower-rightmost key on Alto I keyboards, upper-rightmost
key on "ADL" Alto II keyboards) are depressed concurrently,
the program is aborted. Similarly, if the <control>K ("kill")
command is typed to Swat, the program is aborted. Both are
equivalent to OsFinish(fcAbort).
OsFinish(fCode) An explicit call to this function will also terminate execution.
The value of fCode is saved in the static OsFinishCode, which
may be examined by the Executive and the next program that it
invokes. Values of fCode presently defined are: fcOK=0;
fcAbort=1.
When a program finishes, the value of the finish code is first recorded. Then, if the value of the static
UserFinishProc is non-zero, the call UserFinishProc(OsFinishCode) is performed before restoring the
operating system state. This facility is useful for performing various clean-ups. (Note: To set
UserFinishProc, it is necessary to execute @lvUserFinishProc = value.) In order to permit independent
software packages to provide for cleanups, the convention is that each initialization procedure saves the
present value of UserFinishProc and then replaces it with his procedure. This procedure will do the
cleanups, restore UserFinishProc, and return:
// Initialization procedure
...
static savedUFP
savedUFP = @lvUserFinishProc
@lvUserFinishProc = MyCleanUp
...
// The cleanup procedure
let MyCleanUp(code) be
[
... cleanups here
@lvUserFinishProc = savedUFP
]
Finally, control is returned to the operating system, which resets the interrupt system, updates the disk
allocation table, and invokes the executive anew.
Alto Operating System May 5, 1980 17
For Xerox Internal Use Only -- December 15, 1980










