13.07.2015 Views

apple-pascal-1.3-manual

apple-pascal-1.3-manual

apple-pascal-1.3-manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Each unit follows this overall structure:unitheadinginterface---- implementationcompoundstatementAll of these parts are described in more detail below. Here is a summary:o The unit heading is like a program heading. It is different for Regularand Intrinsic Units.o The interface section declares "public" constants, types, variables,procedures, and functions-those that may be used by the host program.With procedures and functions, only their headings are written here.Label declarations are not allowed in the interface.o The implementation section provides the actual program body for eachprocedure or function declared in the interface section. It also declares"private" labels, constants, variables, procedures, and functions-thosethat may be used only by the unit. Type declarations are not allowed inthe implementation section. If the interface section declares noprocedures or functions, the implementation section is omitted.o The optional initialization section is like a "main program." It is aBEGIN ... END statement that is automatically executed at the beginningof the host program. If you omit it, write END instead.These general rules apply to Program Units:o When you are compiling a program that uses a Program Unit, you will geta Compiler error if any identifier declared in the Program Unit'sinterj ace section is also declared in the program.o However, conflicting identifiers may be used in the implementationsection. This part of the Program Unit is "invisible" to the program thatuses it.o A Program Unit cannot access labels, constants, types, variables,procedures, or functions declared in the program that uses it.o A Program Unit may not contain SEGMENT procedures or functions.o Nested Program Units may not be compiled at the same time; each innerunit must be compiled first and then accessed by its calling unit.III-214Chapter 12: Program Units

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!