I/O Utilities

Turbo Pascal contains many functions that read or write files, handle error messages and take care for compiler operation.

This procedure loads Turbo Pascal library (a collection of units). It adjust each unit so that it starts on a segment boundary. Actually, each compiled unit is a group of symbol tables.

urbo Pascal needs to access files that may be located in different directories – located where the compiler is run or specified either in the configuration file or at the command line.

Turbo Pascal needs to create, read from and write to files. Few simple routins take care for this.

For each source file Turbo Pascal keeps a record with essential data like file handle, file name, current line number, current position, conditional compilation If level, etc.

Source files are read into buffer from where source lines are extracted. NextLine procedure moves to the next source line. If a line was read it increments counters and returns True, otherwise if there are no more source lines NextLine returns False.

CompileUnit calls this procedure to create unit file which is in fact a collection of symbol tables. All segment addresses are cleared and symbol table data is written to the file.

This short procedure reads unit from file to symbol tables. If header is not valid it reports error.