Lines 63-68
Link Here
|
63 |
#ifndef _SOLAR_H |
63 |
#ifndef _SOLAR_H |
64 |
#define _SOLAR_H |
64 |
#define _SOLAR_H |
65 |
|
65 |
|
|
|
66 |
#ifndef _SAL_TYPES_H_ |
67 |
#include <sal/types.h> |
68 |
#endif |
69 |
|
66 |
/*** common solar defines ***********************************/ |
70 |
/*** common solar defines ***********************************/ |
67 |
|
71 |
|
68 |
#ifndef TRUE |
72 |
#ifndef TRUE |
Lines 81-145
Link Here
|
81 |
#define _SOLAR__PRIVATE 1 |
85 |
#define _SOLAR__PRIVATE 1 |
82 |
#define __REFERENCED 0 |
86 |
#define __REFERENCED 0 |
83 |
|
87 |
|
84 |
/*** common solar types ******************************************/ |
88 |
/*** common solar types ********************************************/ |
85 |
|
89 |
/* NOTE: these types are deprecated, or soon will be. They should */ |
86 |
typedef unsigned char BOOL; |
90 |
/* not be used in new code, and should be replaced with their */ |
87 |
typedef unsigned char BYTE; |
91 |
/* corresponding types from sal/types.h in old code when possible. */ |
88 |
typedef unsigned short USHORT; |
92 |
/* Previous typedefs from before sal convergence are in comments */ |
89 |
typedef unsigned long ULONG; |
93 |
/* to the right of the new types. */ |
90 |
typedef int FASTBOOL; |
94 |
|
|
|
95 |
typedef sal_Bool BOOL; /* typedef unsigned char BOOL; */ |
96 |
typedef sal_uInt8 BYTE; /* typedef unsigned char BYTE; */ |
97 |
typedef sal_uInt16 USHORT; /* typedef unsigned short USHORT; */ |
98 |
typedef sal_uInt32 ULONG; /* typedef unsigned long ULONG; */ |
99 |
typedef int FASTBOOL; |
91 |
|
100 |
|
92 |
#ifndef _SOLAR_NOUINT |
101 |
#ifndef _SOLAR_NOUINT |
|
|
102 |
typedef sal_Int16 INT16; /* typedef short INT16; */ |
103 |
typedef sal_uInt16 UINT16; /* typedef unsigned short UINT16; */ |
104 |
typedef sal_Char INT8; /* typedef char INT8; */ |
105 |
typedef sal_uInt8 UINT8; /* typedef unsigned char UINT8; */ |
106 |
|
93 |
/* types with exact defined size (not just the minimum size) */ |
107 |
/* types with exact defined size (not just the minimum size) */ |
94 |
#if defined ALPHA && !defined WNT |
108 |
typedef sal_Int64 INT64; /* typedef long INT64; previously "void" on Windows */ |
95 |
typedef long INT64; |
109 |
typedef sal_uInt64 UINT64; /* typedef unsigned long UINT64; previously "void" on Windows */ |
96 |
typedef unsigned long UINT64; |
110 |
typedef sal_Int32 INT32; /* typedef int INT32; previously "long" on Windows */ |
97 |
typedef int INT32; |
111 |
typedef sal_uInt32 UINT32; /* typedef unsigned int UINT32; previously "unsigned long" on Windows */ |
98 |
typedef unsigned int UINT32; |
|
|
99 |
typedef short INT16; |
100 |
typedef unsigned short UINT16; |
101 |
typedef char INT8; |
102 |
typedef unsigned char UINT8; |
103 |
#else |
104 |
#if !defined(_MSC_VER) || defined(_MSC_VER) && (_MSC_VER < 1200) || (_MSC_VER >= 1200 ) && !defined(VCL_NEED_BASETSD ) |
105 |
typedef void INT64; |
106 |
typedef void UINT64; |
107 |
typedef long INT32; |
108 |
typedef unsigned long UINT32; |
109 |
#endif |
110 |
typedef short INT16; |
111 |
typedef unsigned short UINT16; |
112 |
typedef signed char INT8; |
113 |
typedef unsigned char UINT8; |
114 |
#endif |
115 |
#endif /* _SOLAR_NOUINT */ |
112 |
#endif /* _SOLAR_NOUINT */ |
116 |
|
113 |
|
117 |
|
114 |
|
118 |
/*** description of platform and compiler properties *******************/ |
|
|
119 |
|
120 |
#ifndef _SOLAR_NODESCRIPTION |
121 |
#if defined UNX |
122 |
#include <svconf.h> |
123 |
#else |
124 |
#if defined WNT /* auf PC's */ |
125 |
#define __LITTLEENDIAN |
126 |
#define __ALIGNMENT2 1 |
127 |
#define __ALIGNMENT4 1 |
128 |
#define __ALIGNMENT8 1 |
129 |
#define __STACKALIGNMENT 4 |
130 |
#define __STACKDIRECTION -1 |
131 |
#define __SIZEOFCHAR 1 |
132 |
#define __SIZEOFSHORT 2 |
133 |
#define __SIZEOFINT 4 |
134 |
#define __SIZEOFLONG 4 |
135 |
#define __SIZEOFPOINTER 4 |
136 |
#define __SIZEOFDOUBLE 8 |
137 |
#define __IEEEDOUBLE |
138 |
#endif |
139 |
#endif |
140 |
#endif /* _SOLAR_NODESCRIPTION */ |
141 |
|
142 |
|
143 |
/*** misc. macros to leverage platform and compiler differences ********/ |
115 |
/*** misc. macros to leverage platform and compiler differences ********/ |
144 |
|
116 |
|
145 |
#define DELETEZ( p ) ( delete p,p = 0 ) |
117 |
#define DELETEZ( p ) ( delete p,p = 0 ) |
Lines 160-167
Link Here
|
160 |
|
132 |
|
161 |
#if defined UNX |
133 |
#if defined UNX |
162 |
#define ILLEGAL_POINTER ((void*)1) |
134 |
#define ILLEGAL_POINTER ((void*)1) |
163 |
#elif defined ( MAC ) |
|
|
164 |
#define ILLEGAL_POINTER ((void*)0xEFEFEFEF) |
165 |
#else |
135 |
#else |
166 |
#define ILLEGAL_POINTER NULL |
136 |
#define ILLEGAL_POINTER NULL |
167 |
#endif |
137 |
#endif |
Lines 179-193
Link Here
|
179 |
typedef BYTE SVBT64[8]; |
149 |
typedef BYTE SVBT64[8]; |
180 |
|
150 |
|
181 |
#ifdef __cplusplus |
151 |
#ifdef __cplusplus |
182 |
#ifndef _SOLAR_NODESCRIPTION |
152 |
|
183 |
inline BYTE SVBT8ToByte ( const SVBT8 p ) { return p[0]; } |
153 |
inline BYTE SVBT8ToByte ( const SVBT8 p ) { return p[0]; } |
184 |
#if defined __LITTLEENDIAN && __ALIGNMENT2 == 1 |
154 |
#if defined SAL_TYPES_LITTLEENDIAN && SAL_TYPES_ALIGNMENT2 == 1 |
185 |
inline USHORT SVBT16ToShort( const SVBT16 p ) { return *(USHORT*)p; } |
155 |
inline USHORT SVBT16ToShort( const SVBT16 p ) { return *(USHORT*)p; } |
186 |
#else |
156 |
#else |
187 |
inline USHORT SVBT16ToShort( const SVBT16 p ) { return (USHORT)p[0] |
157 |
inline USHORT SVBT16ToShort( const SVBT16 p ) { return (USHORT)p[0] |
188 |
+ ((USHORT)p[1] << 8); } |
158 |
+ ((USHORT)p[1] << 8); } |
189 |
#endif |
159 |
#endif |
190 |
#if defined __LITTLEENDIAN && __ALIGNMENT4 == 1 |
160 |
#if defined SAL_TYPES_LITTLEENDIAN && SAL_TYPES_ALIGNMENT4 == 1 |
191 |
inline ULONG SVBT32ToLong ( const SVBT32 p ) { return *(ULONG*)p; } |
161 |
inline ULONG SVBT32ToLong ( const SVBT32 p ) { return *(ULONG*)p; } |
192 |
#else |
162 |
#else |
193 |
inline ULONG SVBT32ToLong ( const SVBT32 p ) { return (ULONG)p[0] |
163 |
inline ULONG SVBT32ToLong ( const SVBT32 p ) { return (ULONG)p[0] |
Lines 195-205
Link Here
|
195 |
+ ((ULONG)p[2] << 16) |
165 |
+ ((ULONG)p[2] << 16) |
196 |
+ ((ULONG)p[3] << 24); } |
166 |
+ ((ULONG)p[3] << 24); } |
197 |
#endif |
167 |
#endif |
198 |
#if !defined __IEEEDOUBLE || __SIZEOFDOUBLE != 8 |
168 |
#if !defined SAL_TYPES_IEEEDOUBLE || SAL_TYPES_SIZEOFDOUBLE != 8 |
199 |
#error sorry, not implemented |
169 |
#error "Sorry, !defined SAL_TYPES_IEEEDOUBLE || SAL_TYPES_SIZEOFDOUBLE != 8 is not implemented" |
200 |
#elif defined __LITTLEENDIAN && __ALIGNMENT8 == 1 |
170 |
#elif defined SAL_TYPES_LITTLEENDIAN && SAL_TYPES_ALIGNMENT8 == 1 |
201 |
inline double SVBT64ToDouble( const SVBT64 p ) { return *(double*)p; } |
171 |
inline double SVBT64ToDouble( const SVBT64 p ) { return *(double*)p; } |
202 |
#elif defined __LITTLEENDIAN |
172 |
#elif defined SAL_TYPES_LITTLEENDIAN |
203 |
inline double SVBT64ToDouble( const SVBT64 p ) { double n; |
173 |
inline double SVBT64ToDouble( const SVBT64 p ) { double n; |
204 |
((BYTE*)&n)[0] = p[0]; |
174 |
((BYTE*)&n)[0] = p[0]; |
205 |
((BYTE*)&n)[1] = p[1]; |
175 |
((BYTE*)&n)[1] = p[1]; |
Lines 224-236
Link Here
|
224 |
#endif |
194 |
#endif |
225 |
|
195 |
|
226 |
inline void ByteToSVBT8 ( BYTE n, SVBT8 p ) { p[0] = n; } |
196 |
inline void ByteToSVBT8 ( BYTE n, SVBT8 p ) { p[0] = n; } |
227 |
#if defined __LITTLEENDIAN && __ALIGNMENT2 == 1 |
197 |
#if defined SAL_TYPES_LITTLEENDIAN && SAL_TYPES_ALIGNMENT2 == 1 |
228 |
inline void ShortToSVBT16( USHORT n, SVBT16 p ) { *(USHORT*)p = n; } |
198 |
inline void ShortToSVBT16( USHORT n, SVBT16 p ) { *(USHORT*)p = n; } |
229 |
#else |
199 |
#else |
230 |
inline void ShortToSVBT16( USHORT n, SVBT16 p ) { p[0] = (BYTE) n; |
200 |
inline void ShortToSVBT16( USHORT n, SVBT16 p ) { p[0] = (BYTE) n; |
231 |
p[1] = (BYTE)(n >> 8); } |
201 |
p[1] = (BYTE)(n >> 8); } |
232 |
#endif |
202 |
#endif |
233 |
#if defined __LITTLEENDIAN && __ALIGNMENT4 == 1 |
203 |
#if defined SAL_TYPES_LITTLEENDIAN && SAL_TYPES_ALIGNMENT4 == 1 |
234 |
inline void LongToSVBT32 ( ULONG n, SVBT32 p ) { *(ULONG*)p = n; } |
204 |
inline void LongToSVBT32 ( ULONG n, SVBT32 p ) { *(ULONG*)p = n; } |
235 |
#else |
205 |
#else |
236 |
inline void LongToSVBT32 ( ULONG n, SVBT32 p ) { p[0] = (BYTE) n; |
206 |
inline void LongToSVBT32 ( ULONG n, SVBT32 p ) { p[0] = (BYTE) n; |
Lines 238-248
Link Here
|
238 |
p[2] = (BYTE)(n >> 16); |
208 |
p[2] = (BYTE)(n >> 16); |
239 |
p[3] = (BYTE)(n >> 24); } |
209 |
p[3] = (BYTE)(n >> 24); } |
240 |
#endif |
210 |
#endif |
241 |
#if !defined __IEEEDOUBLE || __SIZEOFDOUBLE != 8 |
211 |
#if !defined SAL_TYPES_IEEEDOUBLE || SAL_TYPES_SIZEOFDOUBLE != 8 |
242 |
#error sorry, not implemented |
212 |
#error "Sorry, !defined SAL_TYPES_IEEEDOUBLE || SAL_TYPES_SIZEOFDOUBLE != 8 is not implemented." |
243 |
#elif defined __LITTLEENDIAN && __ALIGNMENT8 == 1 |
213 |
#elif defined SAL_TYPES_LITTLEENDIAN && SAL_TYPES_ALIGNMENT8 == 1 |
244 |
inline void DoubleToSVBT64( double n, SVBT64 p ) { *(double*)p = n; } |
214 |
inline void DoubleToSVBT64( double n, SVBT64 p ) { *(double*)p = n; } |
245 |
#elif defined __LITTLEENDIAN |
215 |
#elif defined SAL_TYPES_LITTLEENDIAN |
246 |
inline void DoubleToSVBT64( double n, SVBT64 p ) { p[0] = ((BYTE*)&n)[0]; |
216 |
inline void DoubleToSVBT64( double n, SVBT64 p ) { p[0] = ((BYTE*)&n)[0]; |
247 |
p[1] = ((BYTE*)&n)[1]; |
217 |
p[1] = ((BYTE*)&n)[1]; |
248 |
p[2] = ((BYTE*)&n)[2]; |
218 |
p[2] = ((BYTE*)&n)[2]; |
Lines 260-266
Link Here
|
260 |
p[5] = ((BYTE*)&n)[2]; |
230 |
p[5] = ((BYTE*)&n)[2]; |
261 |
p[6] = ((BYTE*)&n)[1]; |
231 |
p[6] = ((BYTE*)&n)[1]; |
262 |
p[7] = ((BYTE*)&n)[0]; } |
232 |
p[7] = ((BYTE*)&n)[0]; } |
263 |
#endif |
|
|
264 |
#endif |
233 |
#endif |
265 |
#endif |
234 |
#endif |
266 |
#endif |
235 |
#endif |