| 1 | /* |
|---|
| 2 | * @(#)tmwtypes.h generated by: makeheader 4.21 Tue Jul 26 23:02:50 2005 |
|---|
| 3 | * |
|---|
| 4 | * built from: ../../src/include/copyright.h |
|---|
| 5 | * ../../src/include/tmwtypes.h |
|---|
| 6 | */ |
|---|
| 7 | |
|---|
| 8 | #ifndef tmwtypes_h |
|---|
| 9 | #define tmwtypes_h |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | /* |
|---|
| 13 | * Copyright 1984-2003 The MathWorks, Inc. |
|---|
| 14 | * All Rights Reserved. |
|---|
| 15 | */ |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | /* Copyright 1995-2004 The MathWorks, Inc. */ |
|---|
| 20 | |
|---|
| 21 | #ifndef __TMWTYPES__ |
|---|
| 22 | #define __TMWTYPES__ |
|---|
| 23 | /* |
|---|
| 24 | * File : tmwtypes.h |
|---|
| 25 | * Abstract: |
|---|
| 26 | * Data types for use with MATLAB/SIMULINK and the Real-Time Workshop. |
|---|
| 27 | * |
|---|
| 28 | * When compiling stand-alone model code, data types can be overridden |
|---|
| 29 | * via compiler switches. |
|---|
| 30 | * |
|---|
| 31 | * Define NO_FLOATS to eliminate reference to real_T, etc. |
|---|
| 32 | */ |
|---|
| 33 | |
|---|
| 34 | /* $Revision: 1.45.4.8 $ */ |
|---|
| 35 | |
|---|
| 36 | #include <limits.h> |
|---|
| 37 | |
|---|
| 38 | #ifdef __APPLE_CC__ |
|---|
| 39 | #include <stdbool.h> |
|---|
| 40 | #endif |
|---|
| 41 | |
|---|
| 42 | #define LOGICAL_IS_A_TYPE |
|---|
| 43 | #define SPARSE_GENERALIZATION |
|---|
| 44 | |
|---|
| 45 | #ifdef NO_FLOATS |
|---|
| 46 | # define double double_not_allowed |
|---|
| 47 | # define float float_not_allowed |
|---|
| 48 | #endif /*NO_FLOATS*/ |
|---|
| 49 | |
|---|
| 50 | #ifndef NO_FLOATS |
|---|
| 51 | |
|---|
| 52 | #ifndef __MWERKS__ |
|---|
| 53 | # ifdef __STDC__ |
|---|
| 54 | # include <float.h> |
|---|
| 55 | # else |
|---|
| 56 | # define FLT_MANT_DIG 24 |
|---|
| 57 | # define DBL_MANT_DIG 53 |
|---|
| 58 | # endif |
|---|
| 59 | #endif |
|---|
| 60 | |
|---|
| 61 | #endif /*NO_FLOATS*/ |
|---|
| 62 | |
|---|
| 63 | /* |
|---|
| 64 | * The following data types cannot be overridden when building MEX files. |
|---|
| 65 | */ |
|---|
| 66 | #ifdef MATLAB_MEX_FILE |
|---|
| 67 | # undef CHARACTER_T |
|---|
| 68 | # undef INTEGER_T |
|---|
| 69 | # undef BOOLEAN_T |
|---|
| 70 | # undef REAL_T |
|---|
| 71 | # undef TIME_T |
|---|
| 72 | #endif |
|---|
| 73 | |
|---|
| 74 | /* |
|---|
| 75 | * The uchar_T, ushort_T and ulong_T types are needed for compilers which do |
|---|
| 76 | * not allow defines to be specified, at the command line, with spaces in them. |
|---|
| 77 | */ |
|---|
| 78 | |
|---|
| 79 | typedef unsigned char uchar_T; |
|---|
| 80 | typedef unsigned short ushort_T; |
|---|
| 81 | typedef unsigned long ulong_T; |
|---|
| 82 | |
|---|
| 83 | |
|---|
| 84 | |
|---|
| 85 | /*=======================================================================* |
|---|
| 86 | * Fixed width word size data types: * |
|---|
| 87 | * int8_T, int16_T, int32_T - signed 8, 16, or 32 bit integers * |
|---|
| 88 | * uint8_T, uint16_T, uint32_T - unsigned 8, 16, or 32 bit integers * |
|---|
| 89 | * real32_T, real64_T - 32 and 64 bit floating point numbers * |
|---|
| 90 | *=======================================================================*/ |
|---|
| 91 | |
|---|
| 92 | /* When used with Real Time Workshop generated code, this |
|---|
| 93 | * header file can be used with a variety of compilers. |
|---|
| 94 | * |
|---|
| 95 | * The compiler could be for an 8 bit embedded processor that |
|---|
| 96 | * only had 8 bits per integer and 16 bits per long. |
|---|
| 97 | * In that example, a 32 bit integer size is not even available. |
|---|
| 98 | * This header file should be robust to that. |
|---|
| 99 | * |
|---|
| 100 | * For the case of an 8 bit processor, the preprocessor |
|---|
| 101 | * may be limited to 16 bit math like its target. That limitation |
|---|
| 102 | * would mean that 32 bit comparisons can't be done accurately. |
|---|
| 103 | * To increase robustness to this, comparisons are done against |
|---|
| 104 | * smaller values first. An inaccurate 32 bit comparison isn't |
|---|
| 105 | * attempted if the 16 bit comparison has already succeeded. |
|---|
| 106 | * |
|---|
| 107 | * Limitations on preprocessor math can also be stricter than |
|---|
| 108 | * for the target. There are known cases where a compiler |
|---|
| 109 | * targeting processors with 64 bit longs can't do accurate |
|---|
| 110 | * preprocessor comparisons on more than 32 bits. |
|---|
| 111 | */ |
|---|
| 112 | |
|---|
| 113 | /* Determine the number of bits for int, long, short, and char. |
|---|
| 114 | * If one fails to be determined, set the number of bits to -1 |
|---|
| 115 | */ |
|---|
| 116 | |
|---|
| 117 | #ifndef TMW_BITS_PER_INT |
|---|
| 118 | # if INT_MAX == 0x7FL |
|---|
| 119 | # define TMW_BITS_PER_INT 8 |
|---|
| 120 | # elif INT_MAX == 0x7FFFL |
|---|
| 121 | # define TMW_BITS_PER_INT 16 |
|---|
| 122 | # elif INT_MAX == 0x7FFFFFFFL |
|---|
| 123 | # define TMW_BITS_PER_INT 32 |
|---|
| 124 | # else |
|---|
| 125 | # define TMW_BITS_PER_INT -1 |
|---|
| 126 | # endif |
|---|
| 127 | #endif |
|---|
| 128 | |
|---|
| 129 | #ifndef TMW_BITS_PER_LONG |
|---|
| 130 | # if LONG_MAX == 0x7FL |
|---|
| 131 | # define TMW_BITS_PER_LONG 8 |
|---|
| 132 | # elif LONG_MAX == 0x7FFFL |
|---|
| 133 | # define TMW_BITS_PER_LONG 16 |
|---|
| 134 | # elif LONG_MAX == 0x7FFFFFFFL |
|---|
| 135 | # define TMW_BITS_PER_LONG 32 |
|---|
| 136 | # else |
|---|
| 137 | # define TMW_BITS_PER_LONG -1 |
|---|
| 138 | # endif |
|---|
| 139 | #endif |
|---|
| 140 | |
|---|
| 141 | #ifndef TMW_BITS_PER_SHRT |
|---|
| 142 | # if SHRT_MAX == 0x7FL |
|---|
| 143 | # define TMW_BITS_PER_SHRT 8 |
|---|
| 144 | # elif SHRT_MAX == 0x7FFFL |
|---|
| 145 | # define TMW_BITS_PER_SHRT 16 |
|---|
| 146 | # elif SHRT_MAX == 0x7FFFFFFFL |
|---|
| 147 | # define TMW_BITS_PER_SHRT 32 |
|---|
| 148 | # else |
|---|
| 149 | # define TMW_BITS_PER_SHRT -1 |
|---|
| 150 | # endif |
|---|
| 151 | #endif |
|---|
| 152 | |
|---|
| 153 | #ifndef TMW_BITS_PER_SCHAR |
|---|
| 154 | # if SCHAR_MAX == 0x7FL |
|---|
| 155 | # define TMW_BITS_PER_SCHAR 8 |
|---|
| 156 | # elif SCHAR_MAX == 0x7FFFL |
|---|
| 157 | # define TMW_BITS_PER_SCHAR 16 |
|---|
| 158 | # elif SCHAR_MAX == 0x7FFFFFFFL |
|---|
| 159 | # define TMW_BITS_PER_SCHAR 32 |
|---|
| 160 | # else |
|---|
| 161 | # define TMW_BITS_PER_SCHAR -1 |
|---|
| 162 | # endif |
|---|
| 163 | #endif |
|---|
| 164 | |
|---|
| 165 | #ifndef TMW_CHAR_SIGNED |
|---|
| 166 | # if SCHAR_MAX == CHAR_MAX |
|---|
| 167 | # define TMW_CHAR_SIGNED 1 |
|---|
| 168 | # else |
|---|
| 169 | # define TMW_CHAR_SIGNED 0 |
|---|
| 170 | # endif |
|---|
| 171 | #endif |
|---|
| 172 | |
|---|
| 173 | /* It is common for one or more of the integer types |
|---|
| 174 | * to be the same size. For example, on many embedded |
|---|
| 175 | * processors, both shorts and ints are 16 bits. On |
|---|
| 176 | * processors used for workstations, it is quite common |
|---|
| 177 | * for both int and long to be 32 bits. |
|---|
| 178 | * When there is more than one choice for typdef'ing |
|---|
| 179 | * a portable type like int16_T or uint32_T, in |
|---|
| 180 | * concept, it should not matter which choice is made. |
|---|
| 181 | * However, some style guides and some code checking |
|---|
| 182 | * tools do identify and complain about seemingly |
|---|
| 183 | * irrelevant differences. For example, a code |
|---|
| 184 | * checking tool may complain about an implicit |
|---|
| 185 | * conversion from int to short even though both |
|---|
| 186 | * are 16 bits. To reduce these types of |
|---|
| 187 | * complaints, it is best to make int the |
|---|
| 188 | * preferred choice when more than one is available. |
|---|
| 189 | */ |
|---|
| 190 | |
|---|
| 191 | #ifndef INT8_T |
|---|
| 192 | # if TMW_BITS_PER_INT == 8 |
|---|
| 193 | # define INT8_T int |
|---|
| 194 | # elif TMW_BITS_PER_LONG == 8 |
|---|
| 195 | # define INT8_T long |
|---|
| 196 | # elif TMW_BITS_PER_SCHAR == 8 |
|---|
| 197 | # if TMW_CHAR_SIGNED |
|---|
| 198 | # define INT8_T char |
|---|
| 199 | # else |
|---|
| 200 | # define INT8_T signed char |
|---|
| 201 | # endif |
|---|
| 202 | # elif TMW_BITS_PER_SHRT == 8 |
|---|
| 203 | # define INT8_T short |
|---|
| 204 | # endif |
|---|
| 205 | #endif |
|---|
| 206 | #ifdef INT8_T |
|---|
| 207 | typedef INT8_T int8_T; |
|---|
| 208 | #endif |
|---|
| 209 | |
|---|
| 210 | #ifndef UINT8_T |
|---|
| 211 | # if TMW_BITS_PER_INT == 8 |
|---|
| 212 | # define UINT8_T unsigned int |
|---|
| 213 | # elif TMW_BITS_PER_LONG == 8 |
|---|
| 214 | # define UINT8_T unsigned long |
|---|
| 215 | # elif TMW_BITS_PER_SCHAR == 8 |
|---|
| 216 | # if TMW_CHAR_SIGNED |
|---|
| 217 | # define UINT8_T unsigned char |
|---|
| 218 | # else |
|---|
| 219 | # define UINT8_T char |
|---|
| 220 | # endif |
|---|
| 221 | # elif TMW_BITS_PER_SHRT == 8 |
|---|
| 222 | # define UINT8_T unsigned short |
|---|
| 223 | # endif |
|---|
| 224 | #endif |
|---|
| 225 | #ifdef UINT8_T |
|---|
| 226 | typedef UINT8_T uint8_T; |
|---|
| 227 | #endif |
|---|
| 228 | |
|---|
| 229 | |
|---|
| 230 | #ifndef INT16_T |
|---|
| 231 | # if TMW_BITS_PER_INT == 16 |
|---|
| 232 | # define INT16_T int |
|---|
| 233 | # elif TMW_BITS_PER_LONG == 16 |
|---|
| 234 | # define INT16_T long |
|---|
| 235 | # elif TMW_BITS_PER_SCHAR == 16 |
|---|
| 236 | # if TMW_CHAR_SIGNED |
|---|
| 237 | # define INT16_T char |
|---|
| 238 | # else |
|---|
| 239 | # define INT16_T signed char |
|---|
| 240 | # endif |
|---|
| 241 | # elif TMW_BITS_PER_SHRT == 16 |
|---|
| 242 | # define INT16_T short |
|---|
| 243 | # endif |
|---|
| 244 | #endif |
|---|
| 245 | #ifdef INT16_T |
|---|
| 246 | typedef INT16_T int16_T; |
|---|
| 247 | #endif |
|---|
| 248 | |
|---|
| 249 | |
|---|
| 250 | #ifndef UINT16_T |
|---|
| 251 | # if TMW_BITS_PER_INT == 16 |
|---|
| 252 | # define UINT16_T unsigned int |
|---|
| 253 | # elif TMW_BITS_PER_LONG == 16 |
|---|
| 254 | # define UINT16_T unsigned long |
|---|
| 255 | # elif TMW_BITS_PER_SCHAR == 16 |
|---|
| 256 | # if TMW_CHAR_SIGNED |
|---|
| 257 | # define UINT16_T unsigned char |
|---|
| 258 | # else |
|---|
| 259 | # define UINT16_T char |
|---|
| 260 | # endif |
|---|
| 261 | # elif TMW_BITS_PER_SHRT == 16 |
|---|
| 262 | # define UINT16_T unsigned short |
|---|
| 263 | # endif |
|---|
| 264 | #endif |
|---|
| 265 | #ifdef UINT16_T |
|---|
| 266 | typedef UINT16_T uint16_T; |
|---|
| 267 | #endif |
|---|
| 268 | |
|---|
| 269 | |
|---|
| 270 | #ifndef INT32_T |
|---|
| 271 | # if TMW_BITS_PER_INT == 32 |
|---|
| 272 | # define INT32_T int |
|---|
| 273 | # elif TMW_BITS_PER_LONG == 32 |
|---|
| 274 | # define INT32_T long |
|---|
| 275 | # elif TMW_BITS_PER_SCHAR == 32 |
|---|
| 276 | # if TMW_CHAR_SIGNED |
|---|
| 277 | # define INT32_T char |
|---|
| 278 | # else |
|---|
| 279 | # define INT32_T signed char |
|---|
| 280 | # endif |
|---|
| 281 | # elif TMW_BITS_PER_SHRT == 32 |
|---|
| 282 | # define INT32_T short |
|---|
| 283 | # endif |
|---|
| 284 | #endif |
|---|
| 285 | #ifdef INT32_T |
|---|
| 286 | typedef INT32_T int32_T; |
|---|
| 287 | #endif |
|---|
| 288 | |
|---|
| 289 | |
|---|
| 290 | #ifndef UINT32_T |
|---|
| 291 | # if TMW_BITS_PER_INT == 32 |
|---|
| 292 | # define UINT32_T unsigned int |
|---|
| 293 | # elif TMW_BITS_PER_LONG == 32 |
|---|
| 294 | # define UINT32_T unsigned long |
|---|
| 295 | # elif TMW_BITS_PER_SCHAR == 32 |
|---|
| 296 | # if TMW_CHAR_SIGNED |
|---|
| 297 | # define UINT32_T unsigned char |
|---|
| 298 | # else |
|---|
| 299 | # define UINT32_T char |
|---|
| 300 | # endif |
|---|
| 301 | # elif TMW_BITS_PER_SHRT == 32 |
|---|
| 302 | # define UINT32_T unsigned short |
|---|
| 303 | # endif |
|---|
| 304 | #endif |
|---|
| 305 | #ifdef UINT32_T |
|---|
| 306 | typedef UINT32_T uint32_T; |
|---|
| 307 | #endif |
|---|
| 308 | |
|---|
| 309 | /* The following is used to emulate smaller integer types when only |
|---|
| 310 | * larger types are available. For example, compilers for TI C3x/C4x DSPs |
|---|
| 311 | * define char and short to be 32 bits, so 8 and 16 bits are not directly |
|---|
| 312 | * available. This target is commonly used with RTW rapid prototyping. |
|---|
| 313 | * Other DSPs define char to be 16 bits, so 8 bits is not directly |
|---|
| 314 | * available. |
|---|
| 315 | */ |
|---|
| 316 | #ifndef INT8_T |
|---|
| 317 | # ifdef INT16_T |
|---|
| 318 | typedef INT16_T int8_T; |
|---|
| 319 | # else |
|---|
| 320 | # ifdef INT32_T |
|---|
| 321 | typedef INT32_T int8_T; |
|---|
| 322 | # endif |
|---|
| 323 | # endif |
|---|
| 324 | #endif |
|---|
| 325 | |
|---|
| 326 | #ifndef UINT8_T |
|---|
| 327 | # ifdef UINT16_T |
|---|
| 328 | typedef UINT16_T uint8_T; |
|---|
| 329 | # else |
|---|
| 330 | # ifdef UINT32_T |
|---|
| 331 | typedef UINT32_T uint8_T; |
|---|
| 332 | # endif |
|---|
| 333 | # endif |
|---|
| 334 | #endif |
|---|
| 335 | |
|---|
| 336 | #ifndef INT16_T |
|---|
| 337 | # ifdef INT32_T |
|---|
| 338 | typedef INT32_T int16_T; |
|---|
| 339 | # endif |
|---|
| 340 | #endif |
|---|
| 341 | |
|---|
| 342 | #ifndef UINT16_T |
|---|
| 343 | # ifdef UINT32_T |
|---|
| 344 | typedef UINT32_T uint16_T; |
|---|
| 345 | # endif |
|---|
| 346 | #endif |
|---|
| 347 | |
|---|
| 348 | |
|---|
| 349 | #ifndef NO_FLOATS |
|---|
| 350 | |
|---|
| 351 | #ifndef REAL32_T |
|---|
| 352 | # ifndef __MWERKS__ |
|---|
| 353 | # if FLT_MANT_DIG >= 23 |
|---|
| 354 | # define REAL32_T float |
|---|
| 355 | # endif |
|---|
| 356 | # else |
|---|
| 357 | # define REAL32_T float |
|---|
| 358 | # endif |
|---|
| 359 | #endif |
|---|
| 360 | #ifdef REAL32_T |
|---|
| 361 | typedef REAL32_T real32_T; |
|---|
| 362 | #endif |
|---|
| 363 | |
|---|
| 364 | |
|---|
| 365 | #ifndef REAL64_T |
|---|
| 366 | # ifndef __MWERKS__ |
|---|
| 367 | # if DBL_MANT_DIG >= 52 |
|---|
| 368 | # define REAL64_T double |
|---|
| 369 | # endif |
|---|
| 370 | # else |
|---|
| 371 | # define REAL64_T double |
|---|
| 372 | # endif |
|---|
| 373 | #endif |
|---|
| 374 | #ifdef REAL64_T |
|---|
| 375 | typedef REAL64_T real64_T; |
|---|
| 376 | #endif |
|---|
| 377 | |
|---|
| 378 | #endif /* NO_FLOATS*/ |
|---|
| 379 | |
|---|
| 380 | /*=======================================================================* |
|---|
| 381 | * Fixed width word size data types: * |
|---|
| 382 | * int64_T - signed 64 bit integers * |
|---|
| 383 | * uint64_T - unsigned 64 bit integers * |
|---|
| 384 | *=======================================================================*/ |
|---|
| 385 | |
|---|
| 386 | |
|---|
| 387 | |
|---|
| 388 | #ifndef INT64_T |
|---|
| 389 | # if defined(__alpha) || defined(__sparcv9) || defined(__ia64) || \ |
|---|
| 390 | defined(__ia64__) || defined(__x86_64__) || defined(__LP64__) |
|---|
| 391 | # define INT64_T long |
|---|
| 392 | # define FMT64 "l" |
|---|
| 393 | # elif defined(_MSC_VER) || (defined(__BORLANDC__) && __BORLANDC__ >= 0x530) \ |
|---|
| 394 | || (defined(__WATCOMC__) && __WATCOMC__ >= 1100) |
|---|
| 395 | # define INT64_T __int64 |
|---|
| 396 | # define FMT64 "I64" |
|---|
| 397 | # elif defined(__GNUC__) || defined(__hpux) || defined(__sun) \ |
|---|
| 398 | || defined(TMW_ENABLE_INT64) |
|---|
| 399 | # define INT64_T long long |
|---|
| 400 | # define FMT64 "ll" |
|---|
| 401 | # endif |
|---|
| 402 | #endif |
|---|
| 403 | |
|---|
| 404 | |
|---|
| 405 | |
|---|
| 406 | #if defined(INT64_T) |
|---|
| 407 | # if (__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >=9)) |
|---|
| 408 | __extension__ |
|---|
| 409 | # endif |
|---|
| 410 | typedef INT64_T int64_T; |
|---|
| 411 | #endif |
|---|
| 412 | |
|---|
| 413 | |
|---|
| 414 | |
|---|
| 415 | #ifndef UINT64_T |
|---|
| 416 | # if defined(__alpha) || defined(__sparcv9) || defined(__ia64) || \ |
|---|
| 417 | defined(__ia64__) || defined(__x86_64__) || defined(__LP64__) |
|---|
| 418 | # define UINT64_T unsigned long |
|---|
| 419 | # define FMT64 "l" |
|---|
| 420 | # elif defined(_MSC_VER) || (defined(__BORLANDC__) && __BORLANDC__ >= 0x530) \ |
|---|
| 421 | || (defined(__WATCOMC__) && __WATCOMC__ >= 1100) |
|---|
| 422 | # define UINT64_T unsigned __int64 |
|---|
| 423 | # define FMT64 "I64" |
|---|
| 424 | # elif defined(__GNUC__) || defined(__hpux) || defined(__sun) \ |
|---|
| 425 | || defined(TMW_ENABLE_INT64) |
|---|
| 426 | # define UINT64_T unsigned long long |
|---|
| 427 | # define FMT64 "ll" |
|---|
| 428 | # endif |
|---|
| 429 | #endif |
|---|
| 430 | |
|---|
| 431 | |
|---|
| 432 | |
|---|
| 433 | #if defined(UINT64_T) |
|---|
| 434 | # if (__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >=9)) |
|---|
| 435 | __extension__ |
|---|
| 436 | # endif |
|---|
| 437 | typedef UINT64_T uint64_T; |
|---|
| 438 | #endif |
|---|
| 439 | |
|---|
| 440 | |
|---|
| 441 | |
|---|
| 442 | /*===========================================================================* |
|---|
| 443 | * General or logical data types where the word size is not guaranteed. * |
|---|
| 444 | * real_T - possible settings include real32_T or real64_T * |
|---|
| 445 | * time_T - possible settings include real64_T or uint32_T * |
|---|
| 446 | * boolean_T * |
|---|
| 447 | * char_T * |
|---|
| 448 | * int_T * |
|---|
| 449 | * uint_T * |
|---|
| 450 | * byte_T * |
|---|
| 451 | *===========================================================================*/ |
|---|
| 452 | |
|---|
| 453 | #ifndef NO_FLOATS |
|---|
| 454 | |
|---|
| 455 | #ifndef REAL_T |
|---|
| 456 | # ifdef REAL64_T |
|---|
| 457 | # define REAL_T real64_T |
|---|
| 458 | # else |
|---|
| 459 | # ifdef REAL32_T |
|---|
| 460 | # define REAL_T real32_T |
|---|
| 461 | # endif |
|---|
| 462 | # endif |
|---|
| 463 | #endif |
|---|
| 464 | #ifdef REAL_T |
|---|
| 465 | typedef REAL_T real_T; |
|---|
| 466 | #endif |
|---|
| 467 | |
|---|
| 468 | #ifndef TIME_T |
|---|
| 469 | # ifdef REAL_T |
|---|
| 470 | # define TIME_T real_T |
|---|
| 471 | # endif |
|---|
| 472 | #endif |
|---|
| 473 | #ifdef TIME_T |
|---|
| 474 | typedef TIME_T time_T; |
|---|
| 475 | #endif |
|---|
| 476 | |
|---|
| 477 | #endif /* NO_FLOATS */ |
|---|
| 478 | |
|---|
| 479 | #ifndef BOOLEAN_T |
|---|
| 480 | # if defined(UINT8_T) |
|---|
| 481 | # define BOOLEAN_T UINT8_T |
|---|
| 482 | # else |
|---|
| 483 | # define BOOLEAN_T unsigned int |
|---|
| 484 | # endif |
|---|
| 485 | #endif |
|---|
| 486 | typedef BOOLEAN_T boolean_T; |
|---|
| 487 | |
|---|
| 488 | |
|---|
| 489 | #ifndef CHARACTER_T |
|---|
| 490 | # define CHARACTER_T char |
|---|
| 491 | #endif |
|---|
| 492 | typedef CHARACTER_T char_T; |
|---|
| 493 | |
|---|
| 494 | |
|---|
| 495 | #ifndef INTEGER_T |
|---|
| 496 | # define INTEGER_T int |
|---|
| 497 | #endif |
|---|
| 498 | typedef INTEGER_T int_T; |
|---|
| 499 | |
|---|
| 500 | |
|---|
| 501 | #ifndef UINTEGER_T |
|---|
| 502 | # define UINTEGER_T unsigned |
|---|
| 503 | #endif |
|---|
| 504 | typedef UINTEGER_T uint_T; |
|---|
| 505 | |
|---|
| 506 | |
|---|
| 507 | #ifndef BYTE_T |
|---|
| 508 | # define BYTE_T unsigned char |
|---|
| 509 | #endif |
|---|
| 510 | typedef BYTE_T byte_T; |
|---|
| 511 | |
|---|
| 512 | |
|---|
| 513 | /*===========================================================================* |
|---|
| 514 | * Define Complex Structures * |
|---|
| 515 | *===========================================================================*/ |
|---|
| 516 | #ifndef NO_FLOATS |
|---|
| 517 | |
|---|
| 518 | #ifndef CREAL32_T |
|---|
| 519 | # ifdef REAL32_T |
|---|
| 520 | typedef struct { |
|---|
| 521 | real32_T re, im; |
|---|
| 522 | } creal32_T; |
|---|
| 523 | # define CREAL32_T creal32_T |
|---|
| 524 | # endif |
|---|
| 525 | #endif |
|---|
| 526 | |
|---|
| 527 | #ifndef CREAL64_T |
|---|
| 528 | # ifdef REAL64_T |
|---|
| 529 | typedef struct { |
|---|
| 530 | real64_T re, im; |
|---|
| 531 | } creal64_T; |
|---|
| 532 | # define CREAL64_T creal64_T |
|---|
| 533 | # endif |
|---|
| 534 | #endif |
|---|
| 535 | |
|---|
| 536 | #ifndef CREAL_T |
|---|
| 537 | # ifdef REAL_T |
|---|
| 538 | typedef struct { |
|---|
| 539 | real_T re, im; |
|---|
| 540 | } creal_T; |
|---|
| 541 | # define CREAL_T creal_T |
|---|
| 542 | # endif |
|---|
| 543 | #endif |
|---|
| 544 | |
|---|
| 545 | #endif /* NO_FLOATS */ |
|---|
| 546 | |
|---|
| 547 | #ifndef CINT8_T |
|---|
| 548 | # ifdef INT8_T |
|---|
| 549 | typedef struct { |
|---|
| 550 | int8_T re, im; |
|---|
| 551 | } cint8_T; |
|---|
| 552 | # define CINT8_T cint8_T |
|---|
| 553 | # endif |
|---|
| 554 | #endif |
|---|
| 555 | |
|---|
| 556 | #ifndef CUINT8_T |
|---|
| 557 | # ifdef UINT8_T |
|---|
| 558 | typedef struct { |
|---|
| 559 | uint8_T re, im; |
|---|
| 560 | } cuint8_T; |
|---|
| 561 | # define CUINT8_T cuint8_T |
|---|
| 562 | # endif |
|---|
| 563 | #endif |
|---|
| 564 | |
|---|
| 565 | #ifndef CINT16_T |
|---|
| 566 | # ifdef INT16_T |
|---|
| 567 | typedef struct { |
|---|
| 568 | int16_T re, im; |
|---|
| 569 | } cint16_T; |
|---|
| 570 | # define CINT16_T cint16_T |
|---|
| 571 | # endif |
|---|
| 572 | #endif |
|---|
| 573 | |
|---|
| 574 | #ifndef CUINT16_T |
|---|
| 575 | # ifdef UINT16_T |
|---|
| 576 | typedef struct { |
|---|
| 577 | uint16_T re, im; |
|---|
| 578 | } cuint16_T; |
|---|
| 579 | # define CUINT16_T cuint16_T |
|---|
| 580 | # endif |
|---|
| 581 | #endif |
|---|
| 582 | |
|---|
| 583 | #ifndef CINT32_T |
|---|
| 584 | # ifdef INT32_T |
|---|
| 585 | typedef struct { |
|---|
| 586 | int32_T re, im; |
|---|
| 587 | } cint32_T; |
|---|
| 588 | # define CINT32_T cint32_T |
|---|
| 589 | # endif |
|---|
| 590 | #endif |
|---|
| 591 | |
|---|
| 592 | #ifndef CUINT32_T |
|---|
| 593 | # ifdef UINT32_T |
|---|
| 594 | typedef struct { |
|---|
| 595 | uint32_T re, im; |
|---|
| 596 | } cuint32_T; |
|---|
| 597 | # define CUINT32_T cuint32_T |
|---|
| 598 | # endif |
|---|
| 599 | #endif |
|---|
| 600 | |
|---|
| 601 | /*=======================================================================* |
|---|
| 602 | * Min and Max: * |
|---|
| 603 | * int8_T, int16_T, int32_T - signed 8, 16, or 32 bit integers * |
|---|
| 604 | * uint8_T, uint16_T, uint32_T - unsigned 8, 16, or 32 bit integers * |
|---|
| 605 | *=======================================================================*/ |
|---|
| 606 | |
|---|
| 607 | #define MAX_int8_T ((int8_T)(127)) /* 127 */ |
|---|
| 608 | #define MIN_int8_T ((int8_T)(-128)) /* -128 */ |
|---|
| 609 | #define MAX_uint8_T ((uint8_T)(255)) /* 255 */ |
|---|
| 610 | #define MIN_uint8_T ((uint8_T)(0)) |
|---|
| 611 | |
|---|
| 612 | #define MAX_int16_T ((int16_T)(32767)) /* 32767 */ |
|---|
| 613 | #define MIN_int16_T ((int16_T)(-32768)) /* -32768 */ |
|---|
| 614 | #define MAX_uint16_T ((uint16_T)(65535)) /* 65535 */ |
|---|
| 615 | #define MIN_uint16_T ((uint16_T)(0)) |
|---|
| 616 | |
|---|
| 617 | #define MAX_int32_T ((int32_T)(2147483647)) /* 2147483647 */ |
|---|
| 618 | #define MIN_int32_T ((int32_T)(-2147483647-1)) /* -2147483648 */ |
|---|
| 619 | #define MAX_uint32_T ((uint32_T)(0xFFFFFFFFU)) /* 4294967295 */ |
|---|
| 620 | #define MIN_uint32_T ((uint32_T)(0)) |
|---|
| 621 | |
|---|
| 622 | #if defined(_MSC_VER) || (defined(__BORLANDC__) && __BORLANDC__ >= 0x530) \ |
|---|
| 623 | || (defined(__WATCOMC__) && __WATCOMC__ >= 1100) |
|---|
| 624 | # ifdef INT64_T |
|---|
| 625 | # define MAX_int64_T ((int64_T)(9223372036854775807)) |
|---|
| 626 | # define MIN_int64_T ((int64_T)(-9223372036854775807-1)) |
|---|
| 627 | # endif |
|---|
| 628 | # ifdef UINT64_T |
|---|
| 629 | # define MAX_uint64_T ((uint64_T)(0xFFFFFFFFFFFFFFFFU)) |
|---|
| 630 | # define MIN_uint64_T ((uint64_T)(0)) |
|---|
| 631 | # endif |
|---|
| 632 | #else |
|---|
| 633 | # ifdef INT64_T |
|---|
| 634 | # define MAX_int64_T ((int64_T)(9223372036854775807LL)) |
|---|
| 635 | # define MIN_int64_T ((int64_T)(-9223372036854775807LL-1LL)) |
|---|
| 636 | # endif |
|---|
| 637 | # ifdef UINT64_T |
|---|
| 638 | # define MAX_uint64_T ((uint64_T)(0xFFFFFFFFFFFFFFFFLLU)) |
|---|
| 639 | # define MIN_uint64_T ((uint64_T)(0)) |
|---|
| 640 | # endif |
|---|
| 641 | #endif |
|---|
| 642 | |
|---|
| 643 | #ifdef _MSC_VER |
|---|
| 644 | /* Conversion from unsigned __int64 to double is not implemented in windows |
|---|
| 645 | * and results in a compile error, thus the value must first be cast to |
|---|
| 646 | * signed __int64, and then to double. |
|---|
| 647 | * |
|---|
| 648 | * If the 64 bit int value is greater than 2^63-1, which is the signed int64 max, |
|---|
| 649 | * the macro below provides a workaround for casting a uint64 value to a double |
|---|
| 650 | * in windows. |
|---|
| 651 | */ |
|---|
| 652 | # define uint64_to_double(u) ( ((u) > _I64_MAX) ? \ |
|---|
| 653 | (double)(__int64)((u) - _I64_MAX - 1) + (double)_I64_MAX + 1: \ |
|---|
| 654 | (double)(__int64)(u) ) |
|---|
| 655 | |
|---|
| 656 | /* The largest double value that can be cast to uint64 in windows is the |
|---|
| 657 | * signed int64 max, which is 2^63-1. The macro below provides |
|---|
| 658 | * a workaround for casting large double values to uint64 in windows. |
|---|
| 659 | */ |
|---|
| 660 | # define double_to_uint64(d) ( ((d) > 0xffffffffffffffffu) ? \ |
|---|
| 661 | (unsigned __int64) 0xffffffffffffffffu : \ |
|---|
| 662 | ((d) < 0) ? (unsigned __int64) 0 : \ |
|---|
| 663 | ((d) > _I64_MAX) ? \ |
|---|
| 664 | (unsigned __int64) ((d) - _I64_MAX) - 1 + (unsigned __int64)_I64_MAX + 1: \ |
|---|
| 665 | (unsigned __int64)(d) ) |
|---|
| 666 | #else |
|---|
| 667 | # define uint64_to_double(u) ((double)(u)) |
|---|
| 668 | # if defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__TICCSC__) |
|---|
| 669 | /* double_to_uint64 defined only for MSVC and UNIX */ |
|---|
| 670 | # else |
|---|
| 671 | # define double_to_uint64(d) ( ((d) > 0xffffffffffffffffLLU) ? \ |
|---|
| 672 | (unsigned long long) 0xffffffffffffffffLLU : \ |
|---|
| 673 | ((d) < 0) ? (unsigned long long) 0 : (unsigned long long)(d) ) |
|---|
| 674 | # endif |
|---|
| 675 | #endif |
|---|
| 676 | |
|---|
| 677 | #if !defined(__cplusplus) && !defined(__bool_true_false_are_defined) |
|---|
| 678 | |
|---|
| 679 | #ifndef _bool_T |
|---|
| 680 | #define _bool_T |
|---|
| 681 | |
|---|
| 682 | typedef boolean_T bool; |
|---|
| 683 | |
|---|
| 684 | #ifndef false |
|---|
| 685 | #define false (0) |
|---|
| 686 | #endif |
|---|
| 687 | #ifndef true |
|---|
| 688 | #define true (1) |
|---|
| 689 | #endif |
|---|
| 690 | |
|---|
| 691 | #endif /* _bool_T */ |
|---|
| 692 | |
|---|
| 693 | #endif /* !__cplusplus */ |
|---|
| 694 | |
|---|
| 695 | /* |
|---|
| 696 | * This software assumes that the code is being compiled on a target using a |
|---|
| 697 | * 2's complement representation for signed integer values. |
|---|
| 698 | */ |
|---|
| 699 | #if ((SCHAR_MIN + 1) != -SCHAR_MAX) |
|---|
| 700 | #error "This code must be compiled using a 2's complement representation for signed integer values" |
|---|
| 701 | #endif |
|---|
| 702 | |
|---|
| 703 | /* |
|---|
| 704 | * Maximum length of a MATLAB identifier (function/variable/model) |
|---|
| 705 | * including the null-termination character. |
|---|
| 706 | */ |
|---|
| 707 | #define TMW_NAME_LENGTH_MAX 64 |
|---|
| 708 | |
|---|
| 709 | #endif /* __TMWTYPES__ */ |
|---|
| 710 | |
|---|
| 711 | #endif /* tmwtypes_h */ |
|---|