Main Content

Specify Boolean and Data Type Limit Identifiers

You can use configuration parameters to replace the default Boolean and data type limit identifiers. If you want to associate the data type limit identifiers with the data type names, consider replacing the default identifiers. You can also use configuration parameters to import a header file with the Boolean and data type limit identifier definitions.

Data Type Limit Identifiers

You can control the data type limit identifiers in the generated code by using the configuration parameters in this table.

Configuration ParameterDefault Identifier
DataTypeReplacement = 'CoderTypedefs' DataTypeReplacement = 'CDataTypesFixedWidth'
64-bit integer maximum identifier (MaxIdInt64)MAX_int64_TINT64_MAX
16-bit integer maximum identifier (MaxIdInt16)MAX_int16_TINT16_MAX
32-bit integer maximum identifier (MaxIdInt32)MAX_int32_TINT32_MAX
8-bit integer maximum identifier (MaxIdInt8)MAX_int8_TINT8_MAX
64-bit unsigned integer maximum identifier (MaxIdUint64)MAX_uint64_TUINT64_MAX
16-bit unsigned integer maximum identifier (MaxIdUint16)MAX_uint16_TUINT16_MAX
32-bit unsigned integer maximum identifier (MaxIdUint32)MAX_uint32_TUINT32_MAX
8-bit unsigned integer maximum identifier (MaxIdUint8)MAX_uint8_TUINT8_MAX
64-bit integer minimum identifier (MinIdInt64)MIN_int64_TINT64_MIN
16-bit integer minimum identifier (MinIdInt16)MIN_int16_TINT16_MIN
32-bit integer minimum identifier (MinIdInt32)MIN_int32_TINT32_MIN
8-bit integer minimum identifier (MinIdInt8)MIN_int8_TINT8_MIN

For example, to change the default identifiers for the 8-bit integer data limit minimum and maximum to s4g_S4MIN and s4g_S4MAX, respectively:

set_param(gcs,'MinIdInt8','s4g_S4MIN');
set_param(gcs,'MaxIdInt8','s4g_S4MAX')

If you do not import a header file, the generated file rtwtypes.h defines the 8-bit integer data minimum and maximum identifiers:

#define s4g_S4MAX                      ((int8_T)(127))
#define s4g_S4MIN                      ((int8_T)(-128))
If you do import a header file defining the data type limit identifiers, the header file is included in rtwtypes.h.

Boolean Identifiers

You can control the Boolean identifiers in the generated code by using the configuration parameters in this table. When changing Boolean identifiers, you must define false to be numerically equivalent to 0, and true to be numerically equivalent to 1.

BooleanConfiguration ParameterDefault Identifier
True Boolean true identifier (BooleanTrueId)true
False Boolean false identifier (BooleanFalseId)false

For example, to change the default Boolean true and false identifiers:

set_param(gcs,'BooleanTrueId','bTrue');
set_param(gcs,'BooleanFalseId','bFalse')

If you do not import a header file, the generated file rtwtypes.h defines the Boolean identifiers:

#define bFalse                         (0U)
#define bTrue                          (1U)
If you do import a header file defining the Boolean identifiers, the header file is included in rtwtypes.h.

Note

When changing Boolean identifiers, you must define false to be numerically equivalent to 0, and true to be numerically equivalent to 1.

Boolean and Data Type Limit Identifier Header Files

You can import a header file that defines Boolean and data type limit identifiers by using the configuration parameter Type limit identifier replacement header file or command-line parameter TypeLimitIdReplacementHeaderFile. The header file is included in rtwtypes.h. You must use the command-line parameters to specify the Boolean and data type limit identifiers that are included in the imported header file.

For example, if you have a header file myfile.h with data type limit definitions, use TypeLimitIdReplacementHeaderFile to include the definitions in the generated code:

set_param(gcs,'TypeLimitIdReplacementHeaderFile','myfile.h');

The generated file rtwtypes.h includes myfile.h.

/* Import type limit identifier replacement definitions. */
#include "myfile.h"

Related Topics