IceTypes.h
Go to the documentation of this file.
1 
8 
11 // Include Guard
12 #ifndef __ICETYPES_H__
13 #define __ICETYPES_H__
14 
16 // Things to help us compile on non-windows platforms
17 #if 0
18 #if defined(__MACOSX__) || defined(__APPLE__)
19 #undef bool
20 #define bool char
21 #undef true
22 #define true ((bool)-1)
23 #undef false
24 #define false ((bool)0)
25 #endif // mac stuff
26 #endif
27 
29  #define USE_HANDLE_MANAGER
30 
31  // Constants
32  #define PI 3.1415926535897932384626433832795028841971693993751f
33  #define HALFPI 1.57079632679489661923f
34  #define TWOPI 6.28318530717958647692f
35  #define INVPI 0.31830988618379067154f
36 
37  #define RADTODEG 57.2957795130823208768f
38  #define DEGTORAD 0.01745329251994329577f
39 
40  #define EXP 2.71828182845904523536f
41  #define INVLOG2 3.32192809488736234787f
42  #define LN2 0.693147180559945f
43  #define INVLN2 1.44269504089f
44 
45  #define INV3 0.33333333333333333333f
46  #define INV6 0.16666666666666666666f
47  #define INV7 0.14285714285714285714f
48  #define INV9 0.11111111111111111111f
49  #define INV255 0.00392156862745098039f
50 
51  #define SQRT2 1.41421356237f
52  #define INVSQRT2 0.707106781188f
53 
54  #define SQRT3 1.73205080757f
55  #define INVSQRT3 0.577350269189f
56 
57  #define null 0
58 
59  // Custom types used in ICE
60  typedef signed char sbyte;
61  typedef unsigned char ubyte;
62  typedef signed short sword;
63  typedef unsigned short uword;
64  typedef signed int sdword;
65  typedef unsigned int udword;
66  typedef signed __int64 sqword;
67  typedef unsigned __int64 uqword;
68  typedef float float32;
69  typedef double float64;
70 
71  ICE_COMPILE_TIME_ASSERT(sizeof(bool)==1); // ...otherwise things might fail with VC++ 4.2 !
72  ICE_COMPILE_TIME_ASSERT(sizeof(ubyte)==1);
73  ICE_COMPILE_TIME_ASSERT(sizeof(sbyte)==1);
74  ICE_COMPILE_TIME_ASSERT(sizeof(sword)==2);
75  ICE_COMPILE_TIME_ASSERT(sizeof(uword)==2);
76  ICE_COMPILE_TIME_ASSERT(sizeof(udword)==4);
77  ICE_COMPILE_TIME_ASSERT(sizeof(sdword)==4);
78  ICE_COMPILE_TIME_ASSERT(sizeof(uqword)==8);
79  ICE_COMPILE_TIME_ASSERT(sizeof(sqword)==8);
80 
82  #define DECLARE_ICE_HANDLE(name) struct name##__ { int unused; }; typedef struct name##__ *name
83 
84  typedef udword DynID;
85 #ifdef USE_HANDLE_MANAGER
86  typedef udword KID;
87 // DECLARE_ICE_HANDLE(KID);
88 #else
89  typedef uword KID;
90 #endif
91  typedef udword RTYPE;
92  #define INVALID_ID 0xffffffff
93 #ifdef USE_HANDLE_MANAGER
94  #define INVALID_KID 0xffffffff
95 #else
96  #define INVALID_KID 0xffff
97 #endif
98  #define INVALID_NUMBER 0xDEADBEEF
99 
100  // Define BOOL if needed
101  #ifndef BOOL
102  typedef int BOOL;
103  #endif
104 
106  typedef union {
107  float f;
109  }scell;
110 
112  typedef union {
113  float f;
115  }ucell;
116 
117  // Type ranges
118  #define MAX_SBYTE 0x7f
119  #define MIN_SBYTE 0x80
120  #define MAX_UBYTE 0xff
121  #define MIN_UBYTE 0x00
122  #define MAX_SWORD 0x7fff
123  #define MIN_SWORD 0x8000
124  #define MAX_UWORD 0xffff
125  #define MIN_UWORD 0x0000
126  #define MAX_SDWORD 0x7fffffff
127  #define MIN_SDWORD 0x80000000
128  #define MAX_UDWORD 0xffffffff
129  #define MIN_UDWORD 0x00000000
130  #define MAX_FLOAT FLT_MAX
131  #define MIN_FLOAT (-FLT_MAX)
132  #define IEEE_1_0 0x3f800000
133  #define IEEE_255_0 0x437f0000
134  #define IEEE_MAX_FLOAT 0x7f7fffff
135  #define IEEE_MIN_FLOAT 0xff7fffff
136  #define IEEE_UNDERFLOW_LIMIT 0x1a000000
137 
138  #define ONE_OVER_RAND_MAX (1.0f / float(RAND_MAX))
139 
140  typedef int (__stdcall* PROC)();
141  typedef bool (*ENUMERATION)(udword value, udword param, udword context);
142  typedef void** VTABLE;
143 
144  #undef MIN
145  #undef MAX
146  #define MIN(a, b) ((a) < (b) ? (a) : (b))
147  #define MAX(a, b) ((a) > (b) ? (a) : (b))
148  #define MAXMAX(a,b,c) ((a) > (b) ? MAX (a,c) : MAX (b,c))
149 
150  template<class T> inline_ const T& TMin (const T& a, const T& b) { return b < a ? b : a; }
151  template<class T> inline_ const T& TMax (const T& a, const T& b) { return a < b ? b : a; }
152  template<class T> inline_ void TSetMin (T& a, const T& b) { if(a>b) a = b; }
153  template<class T> inline_ void TSetMax (T& a, const T& b) { if(a<b) a = b; }
154 
155  #define SQR(x) ((x)*(x))
156  #define CUBE(x) ((x)*(x)*(x))
157 
158  #define AND &
159  #define OR |
160  #define XOR ^
161 
162  #define QUADRAT(x) ((x)*(x))
163 
164 #ifdef _WIN32
165 # define srand48(x) srand((unsigned int) (x))
166 # define srandom(x) srand((unsigned int) (x))
167 # define random() ((double) rand())
168 # define drand48() ((double) (((double) rand()) / ((double) RAND_MAX)))
169 #endif
170 
171 #endif // __ICETYPES_H__
ENUMERATION
bool(* ENUMERATION)(udword value, udword param, udword context)
ICE standard enumeration call.
Definition: IceTypes.h:141
__int64
#define __int64
Definition: Opcode.h:38
DynID
udword DynID
Dynamic identifier.
Definition: IceTypes.h:84
udword
unsigned int udword
sizeof(udword) must be 4
Definition: IceTypes.h:65
float64
double float64
sizeof(float64) must be 4
Definition: IceTypes.h:69
BOOL
int BOOL
Another boolean type.
Definition: IceTypes.h:102
RTYPE
udword RTYPE
Relationship-type (!) between owners and references.
Definition: IceTypes.h:91
b
long b
Definition: jpegint.h:371
float32
float float32
sizeof(float32) must be 4
Definition: IceTypes.h:68
ubyte
unsigned char ubyte
sizeof(ubyte) must be 1
Definition: IceTypes.h:61
ucell::d
udword d
The integer.
Definition: IceTypes.h:114
sbyte
signed char sbyte
sizeof(sbyte) must be 1
Definition: IceTypes.h:60
scell
Union of a float and a sdword.
Definition: IceTypes.h:106
uqword
unsigned __int64 uqword
sizeof(uqword) must be 8
Definition: IceTypes.h:67
scell::f
float f
The float.
Definition: IceTypes.h:107
value
png_voidp int value
Definition: png.h:2110
int
typedef int
Definition: png.h:1111
KID
udword KID
Kernel ID.
Definition: IceTypes.h:86
sqword
signed __int64 sqword
sizeof(sqword) must be 8
Definition: IceTypes.h:66
TMax
const inline_ T & TMax(const T &a, const T &b)
Definition: IceTypes.h:151
ucell
Union of a float and a udword.
Definition: IceTypes.h:112
__stdcall
#define __stdcall
Definition: Opcode.h:39
TSetMin
inline_ void TSetMin(T &a, const T &b)
Definition: IceTypes.h:152
sword
signed short sword
sizeof(sword) must be 2
Definition: IceTypes.h:62
ICE_COMPILE_TIME_ASSERT
ICE_COMPILE_TIME_ASSERT(sizeof(bool)==1)
test.a
int a
Definition: test.py:1
PROC
int(__stdcall * PROC)()
A standard procedure call.
Definition: IceTypes.h:140
sdword
signed int sdword
sizeof(sdword) must be 4
Definition: IceTypes.h:64
TSetMax
inline_ void TSetMax(T &a, const T &b)
Definition: IceTypes.h:153
scell::d
sdword d
The integer.
Definition: IceTypes.h:108
inline_
#define inline_
Definition: IcePreprocessor.h:103
VTABLE
void ** VTABLE
A V-Table.
Definition: IceTypes.h:142
ucell::f
float f
The float.
Definition: IceTypes.h:113
TMin
const inline_ T & TMin(const T &a, const T &b)
Definition: IceTypes.h:150
uword
unsigned short uword
sizeof(uword) must be 2
Definition: IceTypes.h:63


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Wed Sep 7 2022 02:51:03