📄 tmwtypes.h
字号:
/*
* @(#)tmwtypes.h generated by: makeheader 4.21 Tue Jul 26 23:02:50 2005
*
* built from: ../../src/include/copyright.h
* ../../src/include/tmwtypes.h
*/
#ifndef tmwtypes_h
#define tmwtypes_h
/*
* Copyright 1984-2003 The MathWorks, Inc.
* All Rights Reserved.
*/
/* Copyright 1995-2004 The MathWorks, Inc. */
#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.4.8 $ */
#include <limits.h>
#ifdef __APPLE_CC__
#include <stdbool.h>
#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 <float.h>
# 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 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 *
*=======================================================================*/
/* When used with Real Time Workshop generated code, this
* header file can be used with a variety of compilers.
*
* The compiler could be for an 8 bit embedded processor that
* only had 8 bits per integer and 16 bits per long.
* In that example, a 32 bit integer size is not even available.
* This header file should be robust to that.
*
* For the case of an 8 bit processor, the preprocessor
* may be limited to 16 bit math like its target. That limitation
* would mean that 32 bit comparisons can't be done accurately.
* To increase robustness to this, comparisons are done against
* smaller values first. An inaccurate 32 bit comparison isn't
* attempted if the 16 bit comparison has already succeeded.
*
* Limitations on preprocessor math can also be stricter than
* for the target. There are known cases where a compiler
* targeting processors with 64 bit longs can't do accurate
* preprocessor comparisons on more than 32 bits.
*/
/* Determine the number of bits for int, long, short, and char.
* If one fails to be determined, set the number of bits to -1
*/
#ifndef TMW_BITS_PER_INT
# if INT_MAX == 0x7FL
# define TMW_BITS_PER_INT 8
# elif INT_MAX == 0x7FFFL
# define TMW_BITS_PER_INT 16
# elif INT_MAX == 0x7FFFFFFFL
# define TMW_BITS_PER_INT 32
# else
# define TMW_BITS_PER_INT -1
# endif
#endif
#ifndef TMW_BITS_PER_LONG
# if LONG_MAX == 0x7FL
# define TMW_BITS_PER_LONG 8
# elif LONG_MAX == 0x7FFFL
# define TMW_BITS_PER_LONG 16
# elif LONG_MAX == 0x7FFFFFFFL
# define TMW_BITS_PER_LONG 32
# else
# define TMW_BITS_PER_LONG -1
# endif
#endif
#ifndef TMW_BITS_PER_SHRT
# if SHRT_MAX == 0x7FL
# define TMW_BITS_PER_SHRT 8
# elif SHRT_MAX == 0x7FFFL
# define TMW_BITS_PER_SHRT 16
# elif SHRT_MAX == 0x7FFFFFFFL
# define TMW_BITS_PER_SHRT 32
# else
# define TMW_BITS_PER_SHRT -1
# endif
#endif
#ifndef TMW_BITS_PER_SCHAR
# if SCHAR_MAX == 0x7FL
# define TMW_BITS_PER_SCHAR 8
# elif SCHAR_MAX == 0x7FFFL
# define TMW_BITS_PER_SCHAR 16
# elif SCHAR_MAX == 0x7FFFFFFFL
# define TMW_BITS_PER_SCHAR 32
# else
# define TMW_BITS_PER_SCHAR -1
# endif
#endif
#ifndef TMW_CHAR_SIGNED
# if SCHAR_MAX == CHAR_MAX
# define TMW_CHAR_SIGNED 1
# else
# define TMW_CHAR_SIGNED 0
# endif
#endif
/* It is common for one or more of the integer types
* to be the same size. For example, on many embedded
* processors, both shorts and ints are 16 bits. On
* processors used for workstations, it is quite common
* for both int and long to be 32 bits.
* When there is more than one choice for typdef'ing
* a portable type like int16_T or uint32_T, in
* concept, it should not matter which choice is made.
* However, some style guides and some code checking
* tools do identify and complain about seemingly
* irrelevant differences. For example, a code
* checking tool may complain about an implicit
* conversion from int to short even though both
* are 16 bits. To reduce these types of
* complaints, it is best to make int the
* preferred choice when more than one is available.
*/
#ifndef INT8_T
# if TMW_BITS_PER_INT == 8
# define INT8_T int
# elif TMW_BITS_PER_LONG == 8
# define INT8_T long
# elif TMW_BITS_PER_SCHAR == 8
# if TMW_CHAR_SIGNED
# define INT8_T char
# else
# define INT8_T signed char
# endif
# elif TMW_BITS_PER_SHRT == 8
# define INT8_T short
# endif
#endif
#ifdef INT8_T
typedef INT8_T int8_T;
#endif
#ifndef UINT8_T
# if TMW_BITS_PER_INT == 8
# define UINT8_T unsigned int
# elif TMW_BITS_PER_LONG == 8
# define UINT8_T unsigned long
# elif TMW_BITS_PER_SCHAR == 8
# if TMW_CHAR_SIGNED
# define UINT8_T unsigned char
# else
# define UINT8_T char
# endif
# elif TMW_BITS_PER_SHRT == 8
# define UINT8_T unsigned short
# endif
#endif
#ifdef UINT8_T
typedef UINT8_T uint8_T;
#endif
#ifndef INT16_T
# if TMW_BITS_PER_INT == 16
# define INT16_T int
# elif TMW_BITS_PER_LONG == 16
# define INT16_T long
# elif TMW_BITS_PER_SCHAR == 16
# if TMW_CHAR_SIGNED
# define INT16_T char
# else
# define INT16_T signed char
# endif
# elif TMW_BITS_PER_SHRT == 16
# define INT16_T short
# endif
#endif
#ifdef INT16_T
typedef INT16_T int16_T;
#endif
#ifndef UINT16_T
# if TMW_BITS_PER_INT == 16
# define UINT16_T unsigned int
# elif TMW_BITS_PER_LONG == 16
# define UINT16_T unsigned long
# elif TMW_BITS_PER_SCHAR == 16
# if TMW_CHAR_SIGNED
# define UINT16_T unsigned char
# else
# define UINT16_T char
# endif
# elif TMW_BITS_PER_SHRT == 16
# define UINT16_T unsigned short
# endif
#endif
#ifdef UINT16_T
typedef UINT16_T uint16_T;
#endif
#ifndef INT32_T
# if TMW_BITS_PER_INT == 32
# define INT32_T int
# elif TMW_BITS_PER_LONG == 32
# define INT32_T long
# elif TMW_BITS_PER_SCHAR == 32
# if TMW_CHAR_SIGNED
# define INT32_T char
# else
# define INT32_T signed char
# endif
# elif TMW_BITS_PER_SHRT == 32
# define INT32_T short
# endif
#endif
#ifdef INT32_T
typedef INT32_T int32_T;
#endif
#ifndef UINT32_T
# if TMW_BITS_PER_INT == 32
# define UINT32_T unsigned int
# elif TMW_BITS_PER_LONG == 32
# define UINT32_T unsigned long
# elif TMW_BITS_PER_SCHAR == 32
# if TMW_CHAR_SIGNED
# define UINT32_T unsigned char
# else
# define UINT32_T char
# endif
# elif TMW_BITS_PER_SHRT == 32
# define UINT32_T unsigned short
# endif
#endif
#ifdef UINT32_T
typedef UINT32_T uint32_T;
#endif
/* The following is used to emulate smaller integer types when only
* larger types are available. For example, compilers for TI C3x/C4x DSPs
* define char and short to be 32 bits, so 8 and 16 bits are not directly
* available. This target is commonly used with RTW rapid prototyping.
* Other DSPs define char to be 16 bits, so 8 bits is not directly
* available.
*/
#ifndef INT8_T
# ifdef INT16_T
typedef INT16_T int8_T;
# else
# ifdef INT32_T
typedef INT32_T int8_T;
# endif
# endif
#endif
#ifndef UINT8_T
# ifdef UINT16_T
typedef UINT16_T uint8_T;
# else
# ifdef UINT32_T
typedef UINT32_T uint8_T;
# endif
# endif
#endif
#ifndef INT16_T
# ifdef INT32_T
typedef INT32_T int16_T;
# endif
#endif
#ifndef UINT16_T
# ifdef UINT32_T
typedef UINT32_T uint16_T;
# endif
#endif
#ifndef NO_FLOATS
#ifndef REAL32_T
# ifndef __MWERKS__
# if FLT_MANT_DIG >= 23
# define REAL32_T float
# endif
# else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -