9

Scalar Error Messages

Error messages stating that scalar (user-defined) types cannot be read from and written to files are often difficult to interpret. In fact, if you define:

type color = (red, green, blue)

standard Pascal does not associate these constants with the strings red, green, and blue in any way. Pascal adds an extension so that enumerated types can be read and written; however, if the program is to be portable, you must write your own routines to perform these functions.

Standard Pascal only allows the reading of characters, integers, and real numbers from text files, including input (not strings or booleans). You can make the following declaration:

file of color

However, the representation is binary rather than as strings, and it is impossible to define input as other than a text file.

Expression Diagnostics

The diagnostics for semantically ill-formed expressions are explicit, as the following program shows. This program, expr.p, is admittedly far-fetched, but illustrates that the error messages are clear enough so you can easily determine the problem in the expressions.

212

Pascal 4.0 User’s Guide

Page 236
Image 236
HP SunSoft Pascal 4.0 manual Scalar Error Messages, Expression Diagnostics, 212