

In addition, in this case, the system monitors for possible changes to the source code of any module used. file with the source code of the module, and if the PAS file is found, it starts compiling it. If any of the files is not found, the system tries to find the file with the same name with the. In MAKE mode, the compiler checks for TPU files for each declared module.

TPU (from the English Turbo-Pascal Unit) is created as a result of module compilation. For example, if a program (in a module) contains the Uses Global clause, then the directory declared by the Unit directories option must already contain the GLOBAL.TPU file on the disk. When compiling a module or main program in Compile mode, all modules mentioned in the Uses clause must be pre-compiled and the results of their compilation must be placed in files with the same name with the. The modes differ only in the way in which the module being compiled or the main program being compiled is associated with other modules declared in the Uses clause. In particular, three compilation modes are defined: Compile, Make, and Build.
#FREE PASCAL GLOBAL PROCEDURE SOFTWARE#
The Turbo Pascal environment provides tools that control how modules are compiled and facilitate the development of large software projects. Local variables and constants, as well as all program codes generated during module compilation, are placed in a shared memory segment. with a list of formal parameters and a declaration of the result, it must match the header declared in the interface part. The description of the global block in the executable part must be preceded by a heading in which it is allowed to omit the list of formal variables (and the result type for the function), since they are already described in the interface part.īut if the block header is given in full, i.e. Global procedures and functions previously declared in the interface part must be declared in the same order as their headers appear in the interface part. This part can also declare objects local to the module: auxiliary types, constants, variables and blocks, as well as labels, if they are used in the initiating part. The executable part begins with a code word Implementation and contains the bodies of procedures and functions declared in the interface part. In the interface part of modules, forward description cannot be used. The order in which the various announcement sections appear and their number can be arbitrary. It should be noted that all constants and variables declared in the interface part of the module, as well as global objects of the main program, are placed by the Turbo-Pascal compiler in an abundance of data segments (the maximum segment length is 65521 bytes). This part contains declarations of all global objects of the module (types, constants, variables and subroutines) that should be made available to the main program and/or other modules. The interface part opens with a code word Interface. Thus, a module consists of a header and three components, any of which can be empty. Implementation- code word (English implementation) starts the executable part īegin- code word that starts the initiating part Interface- code word that starts the interface part of the module Unit- code word (English module) module header starter Other modules need to be included in the uses clause if the program uses the module's resources, such as procedures and functions. The System module is used in all programs, so an exception is made for it, you can not include it in the uses clause, it will be included automatically. They do not need to be described, but can be immediately included in the program with the uses clause. Turbo Pascal has standard modules: DOS, CRT (Cathode Ray Tube, Cathode Ray Tube), Printer, Graph, System and others. The finished compiled module can be used in the main program using the uses clause, which is written immediately after the program name. The module is compiled separately from the main program, the compiled module has the extension. Module is not an executable program, but only contains a set of facilities for use in an executable program: data types, variables, procedures, and functions. Rules for creating custom modules in pascal.
