#include #include #define TRUE true #define FALSE false // A consistent approach to error reporting is adopted and it // involves specifying error severity and an appropriate message. // errorKind describes the four severiy levels. Message strings may be // constructed dynamically and follows the formatted printf() string // specification. enum errorKind {WARNING, ERROR, ABORT, INTERNAL}; void error(errorKind, char *, ...); // For example, a severe error without recovery options might be the // failure to open the input specification file. This can be specified // as: // error(ABORT, "Cannot open specification file '%s'", argv[1]); // Each error reported increments an error count and may be interrogated // via the funciton errorsFound(). As in most compilers, the presence // of errors disables further processing, eg code generation. int errorsFound(); // Heap memory is allocated via a consistent interface function // allocate() by specifying the heap size required. Processing // is aborted if there is insufficient free memory space. char* allocate(int);