Target Language Compiler    

TLC Error Handling


This chapter includes the following sections:
TLC Error Messages
Use the %exit directive to generate errors from TLC files
TLC Function Library Error Messages
Messages are sufficiently self-descriptive so that they do not need additional explanation

Generating Errors from TLC-Files

To generate errors from TLC files, use the %exit directive, but preferably one of the library functions described below that calls %exit for you. The two types of errors are

Usage errors
These can be caused by incorrect models.
Internal coding errors
These cannot be caused by incorrect models.

Usage Errors

Usage errors are errors resulting from incorrect models or attributes defined on a model. For example, suppose you have an S-Function block and an inline TLC file for a specific D/A device. If a model can contain only one copy of this S-function, then an error needs to be generated for a model that contains two copies of this S-Function block.

Using Library Functions

To generate usage errors related to a specific block, use the library function:

The block argument is the block record if it isn't scoped. If the block is currently scoped, then you can specify block as [].

To generate general usage errors that are not related to a specific block, use

These library functions prepend the string Real-Time Workshop Error to the message you provide when reporting the error.

For an example usage of these functions, refer to gensfun.tlc for block errors and commonsetup.tlc for common errors. There are other files that use these functions in the TLC source directories within matlabroot/rtw/c/tlc.


  Object Records Fatal (Internal) TLC Coding Errors