Wahoo Fitness API  3.6.1
Documentation for the iPhone version of the Wahoo Fitness API.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages
types.h
Go to the documentation of this file.
1 /*
2  * Dynastream Innovations Inc.
3  * Cochrane, AB, CANADA
4  *
5  * Copyright � 1998-2008 Dynastream Innovations Inc.
6  * All rights reserved. This software may not be reproduced by
7  * any means without express written approval of Dynastream
8  * Innovations Inc.
9  */
10 
11 #ifndef DSI_TYPES_H
12 #define DSI_TYPES_H
13 
14 #if defined(__WIN32__) || defined(WIN32) || defined(_WIN32) || defined(_WIN64) || defined(__TOS_WIN__) || defined(__WINDOWS__) //Windows Platform
15  #define DSI_TYPES_WINDOWS
16 
17  #if defined(_WIN32_WINNT)
18  #if (_WIN32_WINNT < 0x501)
19  #undef _WIN32_WINNT
20  #define _WIN32_WINNT 0x0501
21  #endif
22  #else
23  #define _WIN32_WINNT 0X0501
24  #endif
25 
26  #include <windows.h>
27 
28 #elif defined(macintosh) || defined (Macintosh) || defined(__APPLE__) || defined(__MACH__)
29  // Apple platform (first two defines are for Mac OS 9; last two are for Mac OS X)
30  #define DSI_TYPES_MACINTOSH
31 #elif defined(linux) || defined (__linux) // Linux platform
32  #define DSI_TYPES_LINUX
33 #else
34  #define DSI_TYPES_OTHER_OS
35 #endif
36 
37 
39 // Public Definitions
41 
42 #if !defined(TRUE)
43  #define TRUE ((BOOL) 1)
44 #endif
45 #if !defined(FALSE)
46  #define FALSE ((BOOL) 0)
47 #endif
48 
49 #if !defined(NULL) // <windef.h> compatibility.
50  #define NULL ((void *) 0)
51 #endif
52 
53 #define NUL '\0'
54 
55 #define MAX_SCHAR ((SCHAR) 0x7F)
56 #define MIN_SCHAR ((SCHAR) 0x80)
57 #define MAX_UCHAR ((UCHAR) 0xFF)
58 #define MIN_UCHAR ((UCHAR) 0)
59 
60 #define MAX_SSHORT ((SSHORT) 0x7FFF)
61 #define MIN_SSHORT ((SSHORT) 0x8000)
62 #define MAX_USHORT ((USHORT) 0xFFFF)
63 #define MIN_USHORT ((USHORT) 0)
64 
65 #define MAX_SLONG ((SLONG) 0x7FFFFFFF)
66 #define MIN_SLONG ((SLONG) 0x80000000)
67 #define MAX_ULONG ((ULONG) 0xFFFFFFFF)
68 #define MIN_ULONG ((ULONG) 0)
69 
70 #if defined (__ICC8051__)
71  #define C_TYPE __code
72  #define MEM_TYPE __xdata
73  #define MEM_TYPE_S static __xdata
74  #define MEM_TYPE_P __xdata *
75  #define BIT_TYPE __bdata
76  #define DIR_TYPE __data
77 #else
78  #define C_TYPE
79  #define MEM_TYPE
80  #define MEM_TYPE_S
81  #define MEM_TYPE_P
82  #define BIT_TYPE
83  #define DIR_TYPE
84 #endif
85 
86 #if defined(__IAR_SYSTEMS_ICC__)
87  #define BITFIELD_START struct {
88  #define BITFIELD_END }
89  #define BITS_1 : 1
90  #define BITS_2 : 2
91  #define BITS_3 : 3
92  #define BITS_4 : 4
93  #define BITS_5 : 5
94  #define BITS_6 : 6
95  #define BITS_7 : 7
96 #else
97  #define BITFIELD_START
98  #define BITFIELD_END
99  #define BITS_1
100  #define BITS_2
101  #define BITS_3
102  #define BITS_4
103  #define BITS_5
104  #define BITS_6
105  #define BITS_7
106 #endif
107 
108 #if !defined(DSI_TYPES_WINDOWS)
109  #if !defined(BASETYPES) && !defined(_WinToMac_h_) && !defined(_OBJC_OBJC_H_) // MMOORE: 2/22/2013 - added exception for Obj-C, which already defines BOOL.
110  typedef signed char BOOL; // MMOORE: changed unsigned to signed to maintain compatibility between apple obj-c and c++.
111  typedef char BYTE; // 1-byte int. Sign is processor/compiler-dependent.
112  #endif
113 #endif
114 
115 typedef unsigned char BOOL_SAFE; // BOOL that doesn't get redefined to signed int in windows to result in TRUE=-1 when used in bit fields.
116 
117 typedef signed char SCHAR; // Signed 1-byte int.
118 typedef unsigned char UCHAR; // Unsigned 1-byte int.
119 
120 typedef signed short SSHORT; // Signed 2-byte int.
121 typedef unsigned short USHORT; // Unsigned 2-byte int.
122 
123 typedef signed long SLONG; // Signed 4-byte int.
124 #ifdef DSI_TYPES_MACINTOSH // MMOORE - 2/22/2013 added for 64-bit OSX compatibility
125 #if !defined(__COREFOUNDATION_CFPLUGINCOM__)
126 #if defined(__x86_64__)
127 typedef unsigned int ULONG; // Unsigned 4-byte int.
128 #else
129 typedef unsigned long ULONG; // Unsigned 4-byte int.
130 #endif
131 #endif
132 #else
133 typedef unsigned long ULONG; // Unsigned 4-byte int.
134 #endif // DSI_TYPES_MACINTOSH
135 
136 #if !defined(_WinToMac_h_)
137  typedef long LONG;
138  // 4-byte int. Sign is processor/compiler-dependent. Commonly assumed
139  // to be signed, however this is not guaranteed. Suggested use for
140  // this type is for efficient data passing and bit manipulation.
141  // Assuming any sign for math may be problematic, especially on code
142  // intended to be cross-platform.
143 #endif
144 
145 #if !defined(__BORLANDC__)
146 typedef signed long long SLLONG; // Signed 8-byte int.
147 typedef unsigned long long ULLONG; // Unsigned 8-byte int.
148 #endif
149 
150 typedef float FLOAT; // 2-byte floating point.
151 typedef double DOUBLE; // 4-byte floating point.
152 
153 typedef signed long long SINT64;
155 // !!NOTE: The structures below assume little endian architecture!!
157 typedef union
158 {
160  struct
161  {
164  } stBytes;
165 } USHORT_UNION;
166 
167 #define USHORT_HIGH(X) (((USHORT_UNION *)(X))->stBytes.ucHigh)
168 #define USHORT_LOW(X) (((USHORT_UNION *)(X))->stBytes.ucLow)
169 
170 typedef union
171 {
172  signed short ssData;
173  struct
174  {
177  } stBytes;
178 } SSHORT_UNION;
179 
180 #define SSHORT_HIGH(X) (((SSHORT_UNION *)(X))->stBytes.ucHigh)
181 #define SSHORT_LOW(X) (((SSHORT_UNION *)(X))->stBytes.ucLow)
182 
183 typedef union
184 {
185  UCHAR aucData[4];
187  struct
188  {
189  // The least significant byte of the ULONG in this structure is
190  // referenced by ucByte0.
195  } stBytes;
196 } ULONG_UNION;
197 
198 #define ULONG_LOW_0(X) (((ULONG_UNION *)(X))->stBytes.ucByte0)
199 #define ULONG_MID_1(X) (((ULONG_UNION *)(X))->stBytes.ucByte1)
200 #define ULONG_MID_2(X) (((ULONG_UNION *)(X))->stBytes.ucByte2)
201 #define ULONG_HIGH_3(X) (((ULONG_UNION *)(X))->stBytes.ucByte3)
202 
203 
204 #endif // defined(DSI_TYPES_H)
UCHAR ucHigh
Definition: types.h:163
UCHAR ucByte0
Definition: types.h:191
signed long long SINT64
Definition: types.h:153
signed long long SLLONG
Definition: types.h:146
unsigned long long ULLONG
Definition: types.h:147
unsigned char BOOL_SAFE
Definition: types.h:115
UCHAR ucByte1
Definition: types.h:192
UCHAR ucByte3
Definition: types.h:194
unsigned short USHORT
Definition: types.h:121
long LONG
Definition: types.h:137
Definition: types.h:183
signed short SSHORT
Definition: types.h:120
signed char BOOL
Definition: types.h:110
UCHAR ucByte2
Definition: types.h:193
UCHAR ucHigh
Definition: types.h:176
signed short ssData
Definition: types.h:172
float FLOAT
Definition: types.h:150
unsigned char UCHAR
Definition: types.h:118
double DOUBLE
Definition: types.h:151
Definition: types.h:170
UCHAR ucLow
Definition: types.h:175
USHORT usData
Definition: types.h:159
Definition: types.h:157
UCHAR ucLow
Definition: types.h:162
unsigned long ULONG
Definition: types.h:133
ULONG ulData
Definition: types.h:186
char BYTE
Definition: types.h:111
signed long SLONG
Definition: types.h:123
signed char SCHAR
Definition: types.h:117