/* * @(#)tmwtypes.h generated by: makeheader 3.10 Fri Jun 14 22:33:05 2002 * * built from: ../../src/include/copyright.h * ../../src/include/tmwtypes.h */ #ifndef tmwtypes_h #define tmwtypes_h /* $Revision: 1.4 $ */ /* * Copyright (c) 1984-2001 The MathWorks, Inc. * All Rights Reserved. */ #ifndef __TMWTYPES__ #define __TMWTYPES__ /* * File : tmwtypes.h * Abstract: * Data types for use with MATLAB/SIMULINK and the Real-Time Workshop. * * When compiling stand-alone model code, data types can be overridden * via compiler switches. * * Define NO_FLOATS to eliminate reference to real_T, etc. */ /* $Revision: 1.45 $ */ #include #ifdef __APPLE_CC__ #include #endif #define LOGICAL_IS_A_TYPE #define SPARSE_GENERALIZATION #ifdef NO_FLOATS # define double double_not_allowed # define float float_not_allowed #endif /*NO_FLOATS*/ #ifndef NO_FLOATS #ifndef __MWERKS__ # ifdef __STDC__ # include # else # define FLT_MANT_DIG 24 # define DBL_MANT_DIG 53 # endif #endif #endif /*NO_FLOATS*/ /* * The following data types cannot be overridden when building MEX files. */ #ifdef MATLAB_MEX_FILE # undef CHARACTER_T # undef INTEGER_T # undef BOOLEAN_T # undef REAL_T # undef TIME_T #endif /* * The following define is used to emulate when all integer types are * 32-bits. This is the case for TI C30/C40 DSPs which are RTW targets. */ #ifdef DSP32 # define INT8_T int # define UINT8_T unsigned int # define INT16_T int # define UINT16_T unsigned int #endif /* * The uchar_T, ushort_T and ulong_T types are needed for compilers which do * not allow defines to be specified, at the command line, with spaces in them. */ typedef unsigned char uchar_T; typedef unsigned short ushort_T; typedef unsigned long ulong_T; /*=======================================================================* * Fixed width word size data types: * * int8_T, int16_T, int32_T - signed 8, 16, or 32 bit integers * * uint8_T, uint16_T, uint32_T - unsigned 8, 16, or 32 bit integers * * real32_T, real64_T - 32 and 64 bit floating point numbers * *=======================================================================*/ #ifndef INT8_T # if CHAR_MIN == -128 # define INT8_T char # elif SCHAR_MIN == -128 # define INT8_T signed char # endif #endif #ifdef INT8_T typedef INT8_T int8_T; # ifndef UINT8_T # define UINT8_T unsigned char # endif typedef UINT8_T uint8_T; #endif #ifndef INT16_T # if SHRT_MAX == 0x7FFF # define INT16_T short # elif INT_MAX == 0x7FFF # define INT16_T int # endif #endif #ifdef INT16_T typedef INT16_T int16_T; #endif #ifndef UINT16_T # if SHRT_MAX == 0x7FFF /* can't compare with USHRT_MAX on some platforms */ # define UINT16_T unsigned short # elif INT_MAX == 0x7FFF # define UINT16_T unsigned int # endif #endif #ifdef UINT16_T typedef UINT16_T uint16_T; #endif #ifndef INT32_T # if INT_MAX == 0x7FFFFFFF # define INT32_T int # elif LONG_MAX == 0x7FFFFFFF # define INT32_T long # endif #endif #ifdef INT32_T typedef INT32_T int32_T; #endif #ifndef UINT32_T # if INT_MAX == 0x7FFFFFFF # define UINT32_T unsigned int # elif LONG_MAX == 0x7FFFFFFF # define UINT32_T unsigned long # endif #endif #ifdef UINT32_T typedef UINT32_T uint32_T; #endif #ifndef NO_FLOATS #ifndef REAL32_T # ifndef __MWERKS__ # if FLT_MANT_DIG >= 23 # define REAL32_T float # endif # else # define REAL32_T float # endif #endif #ifdef REAL32_T typedef REAL32_T real32_T; #endif #ifndef REAL64_T # ifndef __MWERKS__ # if DBL_MANT_DIG >= 52 # define REAL64_T double # endif # else # define REAL64_T double # endif #endif #ifdef REAL64_T typedef REAL64_T real64_T; #endif #endif /* NO_FLOATS*/ /*=======================================================================* * Fixed width word size data types: * * int64_T - signed 64 bit integers * * uint64_T - unsigned 64 bit integers * *=======================================================================*/ #ifndef INT64_T # if defined(__alpha) || defined(__ia64__) # define INT64_T long # define FMT64 "l" # elif defined(_MSC_VER) || (defined(__BORLANDC__) && __BORLANDC__ >= 0x530) \ || (defined(__WATCOMC__) && __WATCOMC__ >= 1100) # define INT64_T __int64 # define FMT64 "I64" # elif defined(__GNUC__) || defined(TMW_ENABLE_INT64) # define INT64_T long long # define FMT64 "ll" # endif #endif #if defined(INT64_T) # if (__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >=9)) __extension__ # endif typedef INT64_T int64_T; #endif #ifndef UINT64_T # if defined(__alpha) || defined(__ia64__) # define UINT64_T unsigned long # define FMT64 "l" # elif defined(_MSC_VER) || (defined(__BORLANDC__) && __BORLANDC__ >= 0x530) \ || (defined(__WATCOMC__) && __WATCOMC__ >= 1100) # define UINT64_T unsigned __int64 # define FMT64 "I64" # elif defined(__GNUC__) || defined(TMW_ENABLE_INT64) # define UINT64_T unsigned long long # define FMT64 "ll" # endif #endif #if defined(UINT64_T) # if (__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >=9)) __extension__ # endif typedef UINT64_T uint64_T; #endif /*===========================================================================* * General or logical data types where the word size is not guaranteed. * * real_T - possible settings include real32_T or real64_T * * time_T - possible settings include real64_T or uint32_T * * boolean_T * * char_T * * int_T * * uint_T * * byte_T * *===========================================================================*/ #ifndef NO_FLOATS #ifndef REAL_T # ifdef REAL64_T # define REAL_T real64_T # else # ifdef REAL32_T # define REAL_T real32_T # endif # endif #endif #ifdef REAL_T typedef REAL_T real_T; #endif #ifndef TIME_T # ifdef REAL_T # define TIME_T real_T # endif #endif #ifdef TIME_T typedef TIME_T time_T; #endif #endif /* NO_FLOATS */ #ifndef BOOLEAN_T # if defined(UINT8_T) # define BOOLEAN_T UINT8_T # else # define BOOLEAN_T unsigned int # endif #endif typedef BOOLEAN_T boolean_T; #ifndef CHARACTER_T # define CHARACTER_T char #endif typedef CHARACTER_T char_T; #ifndef INTEGER_T # define INTEGER_T int #endif typedef INTEGER_T int_T; #ifndef UINTEGER_T # define UINTEGER_T unsigned #endif typedef UINTEGER_T uint_T; #ifndef BYTE_T # define BYTE_T unsigned char #endif typedef BYTE_T byte_T; /*===========================================================================* * Define Complex Structures * *===========================================================================*/ #ifndef NO_FLOATS #ifndef CREAL32_T # ifdef REAL32_T typedef struct { real32_T re, im; } creal32_T; # define CREAL32_T creal32_T # endif #endif #ifndef CREAL64_T # ifdef REAL64_T typedef struct { real64_T re, im; } creal64_T; # define CREAL64_T creal64_T # endif #endif #ifndef CREAL_T # ifdef REAL_T typedef struct { real_T re, im; } creal_T; # define CREAL_T creal_T # endif #endif #endif /* NO_FLOATS */ #ifndef CINT8_T # ifdef INT8_T typedef struct { int8_T re, im; } cint8_T; # define CINT8_T cint8_T # endif #endif #ifndef CUINT8_T # ifdef UINT8_T typedef struct { uint8_T re, im; } cuint8_T; # define CUINT8_T cuint8_T # endif #endif #ifndef CINT16_T # ifdef INT16_T typedef struct { int16_T re, im; } cint16_T; # define CINT16_T cint16_T # endif #endif #ifndef CUINT16_T # ifdef UINT16_T typedef struct { uint16_T re, im; } cuint16_T; # define CUINT16_T cuint16_T # endif #endif #ifndef CINT32_T # ifdef INT32_T typedef struct { int32_T re, im; } cint32_T; # define CINT32_T cint32_T # endif #endif #ifndef CUINT32_T # ifdef UINT32_T typedef struct { uint32_T re, im; } cuint32_T; # define CUINT32_T cuint32_T # endif #endif /*=======================================================================* * Min and Max: * * int8_T, int16_T, int32_T - signed 8, 16, or 32 bit integers * * uint8_T, uint16_T, uint32_T - unsigned 8, 16, or 32 bit integers * *=======================================================================*/ #define MAX_int8_T ((int8_T)(127)) /* 127 */ #define MIN_int8_T ((int8_T)(-128)) /* -128 */ #define MAX_uint8_T ((uint8_T)(255)) /* 255 */ #define MIN_uint8_T ((uint8_T)(0)) #define MAX_int16_T ((int16_T)(32767)) /* 32767 */ #define MIN_int16_T ((int16_T)(-32768)) /* -32768 */ #define MAX_uint16_T ((uint16_T)(65535)) /* 65535 */ #define MIN_uint16_T ((uint16_T)(0)) #define MAX_int32_T ((int32_T)(2147483647)) /* 2147483647 */ #define MIN_int32_T ((int32_T)(-2147483647-1)) /* -2147483648 */ #define MAX_uint32_T ((uint32_T)(0xFFFFFFFFU)) /* 4294967295 */ #define MIN_uint32_T ((uint32_T)(0)) #if defined(_MSC_VER) || (defined(__BORLANDC__) && __BORLANDC__ >= 0x530) \ || (defined(__WATCOMC__) && __WATCOMC__ >= 1100) # ifdef INT64_T # define MAX_int64_T ((int64_T)(9223372036854775807)) # define MIN_int64_T ((int64_T)(-9223372036854775807-1)) # endif # ifdef UINT64_T # define MAX_uint64_T ((uint64_T)(0xFFFFFFFFFFFFFFFFU)) # define MIN_uint64_T ((uint64_T)(0)) # endif #else # ifdef INT64_T # define MAX_int64_T ((int64_T)(9223372036854775807LL)) # define MIN_int64_T ((int64_T)(-9223372036854775807LL-1LL)) # endif # ifdef UINT64_T # define MAX_uint64_T ((uint64_T)(0xFFFFFFFFFFFFFFFFLLU)) # define MIN_uint64_T ((uint64_T)(0)) # endif #endif #ifdef _MSC_VER # define uint64_to_double(u) (((u) > _I64_MAX) ? \ (double)(__int64)((u) - _I64_MAX) + (double)_I64_MAX : \ (double)(__int64)(u)) #else # define uint64_to_double(u) ((double)(u)) #endif #if !defined(__cplusplus) && !defined(__bool_true_false_are_defined) #ifndef _bool_T #define _bool_T typedef boolean_T bool; #ifndef false #define false (0) #endif #ifndef true #define true (1) #endif #endif /* _bool_T */ #endif /* !__cplusplus */ /* * This software assumes that the code is being compiled on a target using a * 2's complement representation for signed integer values. */ #if ((SCHAR_MIN + 1) != -SCHAR_MAX) #error "This code must be compiled using a 2's complement representation for signed integer values" #endif /* * Maximum length of a MATLAB identifier (function/variable/model) * including the null-termination character. */ #define TMW_NAME_LENGTH_MAX 64 #endif /* __TMWTYPES__ */ #endif /* tmwtypes_h */