Specify Boolean and Data Type Limit Identifiers
You can use command-line 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 command-line 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 command-line parameters in this table.
Data Type Limit | Default Identifier | Command-Line Parameter |
---|---|---|
64-bit integer maximum | MAX_int64_T | MaxIdInt64 |
16-bit integer maximum | MAX_int16_T | MaxIdInt16 |
32-bit integer maximum | MAX_int32_T | MaxIdInt32 |
8-bit integer maximum | MAX_int8_T | MaxIdInt8 |
64-bit unsigned integer maximum | MAX_uint64_T | MaxIdUint64 |
16-bit unsigned integer maximum | MAX_uint16_T | MaxIdUint16 |
32-bit unsigned integer maximum | MAX_uint32_T | MaxIdUint32 |
8-bit unsigned integer maximum | MAX_uint8_T | MaxIdUint8 |
64-bit integer minimum identifier | MIN_int64_T | MinIdInt64 |
16-bit integer minimum | MIN_int16_T | MinIdInt16 |
32-bit integer minimum | MIN_int32_T | MinIdInt32 |
8-bit integer minimum | MIN_int8_T | MinIdInt8 |
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))
rtwtypes.h
.Boolean Identifiers
You can control the Boolean identifiers in the generated code
by using the command-line 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
.
Boolean | Default Identifier | Command-Line Parameter |
---|---|---|
True | true | BooleanTrueId |
False | false | BooleanFalseId |
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)
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"