Before proceeding with the next program let’s skip forward to the index of the book to page 338. Here K&P list the code for their "wrapper." The wrapper is a program which defines constants, types, functions and procedures that are used by their other programs. Here is the explanation of why K&P’s programs are not programs at all but procedures. One implements a program such as
charcount by including it in the wrapper and calling it from the wrapper. The wrapper for UCSD Pascal, probably the closest pre Turbo implementation to Turbo Pascal, is given on pages 338 .. 341. Turbo Pascal’s units, i.e., its provision for separate compilation, makes the rigmarole of the wrapper superfluous, although it was probably a good strategy in 1981 a couple of years before Turbo Pascal made the scene.
Instead of a wrapper we’ll create a Turbo Pascal unit called
Tools. We’ll start with only what we need and expand it as we go. In anticipation of what we’ll need to write out next program here is our first cut of
Tools.
Unit Tools ;
{
a unit of procedures, functions, constants used in software tools
}
interface
CONST
TAB = Chr(9) ;
LF = Chr(10) ;
CR = Chr(13) ;
BLANK = Chr(32) ;
implementation
end. { Tools }