Generating Preprocessor Error Messages

Not base level

If the preprocessor encounters an error when processing the source code it can return the text of a message to be output.

This message is displayed in the same way as other Compiler messages according to the WARNING and ERRQ directives, and it is also highlighted in the source code.

To generate an error, a preprocessor must pass through the source line in error. The error message is passed with the following settings:

resp-main 17
resp-more Value indicating the severity:
1 Informational
2 Warning
3 Error
4 Severe error
Value Severity
buffer The text of the message. If the message text starts with the string OFFSETnnn (case is important) and a space, the error at the position specified by nnn is flagged. nnn is a three byte numeric number. The string is not displayed as part of the message.
1 Unrecoverable error
2 Severe error
3 Error
4 Warning
5 Informational
6 Flag count

The function resp-main=17 should only be used once one or more user source lines have been returned to the Checker by the preprocessor.

Note: in some circumstances using this feature highlights errors later than normal. This happens when the Compiler is reading ahead in the source to look for continuation and so on. If the Compiler receives and processes an error request from a preprocessor, and then determines that the error was on a line before the read-ahead, the line flagged by the prerocessor is highlighted.

All levels

An older technique for handling error conditions is still available. This requires the preprocessor to handle the actual display of the error message and so is less well integrated. We do not recommend this technique.

If the preprocessor encounters an error when processing the source code, it can communicate this to the Compiler so that the error is treated as a syntax error. There are two ways to do this:

  • Set resp-main to the value 5 and place a comment line in buffer; the comment is inserted in the list file.
  • Set resp-main to the value 6; the Compiler terminates.

The value in resp-more specifies the column number in which the error was found. It is used when positioning the cursor on return to the Editor.

It is also possible to force the Compiler to increment its internal error counts in conjunction with one of the two operations described above. This is done by setting resp-main to the value 7 and specifying which error count is to be increased in resp-more. Possible values for resp-more are:

Value Severity
1 Unrecoverable error
2 Severe error
3 Error
4 Warning
5 Informational
6 Flag count

Increasing the unrecoverable error count causes the Compiler to abort immediately. The contents of buffer are ignored.

It is the responsibility of the preprocessor to output error messages to the user before forcing the Compiler to either abort or increment the error counts. This should not be confused with the message that can be inserted in the list file which is for informational purposes only.