Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
p6defs.h
Go to the documentation of this file.
1 
10 #ifndef P6DEFS_H__
11 #define P6DEFS_H__ 1
12 
19 #define P6MACROSTRING2(x) #x
20 #define P6MACROVALUE(x) P6MACROSTRING2(x)
21 
22 #define IN
23 #define OUT
24 #define INOUT
25 #define P6DEPRICATED
26 
27 #ifdef P6_UEFI
28 #define P6UNUSED(x) x;
29 #else
30 #define P6UNUSED(x)
31 #endif
32 
33 #define P6INVALIDTHREADID ((P6R::P6THREADID)0)
34 
35 #define P6MIN(a,b) (((a) < (b)) ? (a) : (b))
36 #define P6MAX(a,b) (((a) > (b)) ? (a) : (b))
37 
38 #define P6WAITINFINITE (P6R::P6INTERVAL)-1
39 #define P6WAITNONE (P6R::P6INTERVAL)0
40 
41 #define P6MAXPATH 4096
42 #define P6MAXHOSTNAME 1025
43 #define P6MAXOSNAMESTR 128
44 #define P6MAXVERSIONSTR 1024
45 #define P6MAXARCHSTR 64
46 #define P6MAXIPADDR 46
47 #define P6MAX_PASS 1024
49 #define P6FILE __FILE__
50 #define P6LINE __LINE__
51 #define P6FILEANDLINE __FILE__,__LINE__
52 
53 #ifdef _WIN32
54 # ifdef _M_AMD64
55 # define xNOEXPORT
56 # define xEXPORT __declspec(dllexport)
57 # define xIMPORT __declspec(dllimport)
58 # define xSTDCALL
59 # define xCCALL
60 # elif defined(_M_IX86)
61 # define xNOEXPORT
62 # define xEXPORT __declspec(dllexport)
63 # define xIMPORT __declspec(dllimport)
64 # define xSTDCALL __stdcall
65 # define xCCALL __cdecl
66 # else
67 # error "Unsupported/Unknown Windows platform - unable to define calling convention and visibility macros."
68 # endif
69 #elif defined(__GNUC__) && ((__GNUC__ ==3) && (__GNUC_MINOR__ >= 4) && (__GNUC_PATCHLEVEL__ >= 4))
70 # define xNOEXPORT __attribute__ ((visibility ("hidden")))
71 # define xEXPORT __attribute__ ((visibility ("default")))
72 # define xIMPORT __attribute__ ((visibility ("default")))
73 # ifdef P6_SOLARIS
74 # define xSTDCALL
75 # else
76 # if BITNESS == 32
77 # ifdef __arm__
78 # define xSTDCALL
79 # else
80 # define xSTDCALL __attribute__ ((__stdcall__))
81 # endif
82 # else
83 # define xSTDCALL
84 # endif
85 # endif
86 # ifdef __arm__
87 # define xCCALL
88 # else
89 # define xCCALL __attribute__ ((__cdecl__))
90 # endif
91 #elif defined(__GNUC__) && (__GNUC__ >=4)
92 # define xNOEXPORT __attribute__ ((visibility ("hidden")))
93 # define xEXPORT __attribute__ ((visibility ("default")))
94 # define xIMPORT __attribute__ ((visibility ("default")))
95 # if BITNESS == 32
96 # ifdef __arm__
97 # define xSTDCALL
98 # else
99 # define xSTDCALL __attribute__ ((__stdcall__))
100 # endif
101 # ifdef __arm__
102 # define xCCALL
103 # else
104 # define xCCALL __attribute__ ((__cdecl__))
105 # endif
106 # else
107 # define xSTDCALL
108 # define xCCALL
109 # endif
110 #elif defined(__SUNPRO_CC)
111 # define xNOEXPORT __hidden
112 # define xEXPORT __global
113 # define xIMPORT
114 # define xSTDCALL
115 # define xCCALL
116 #else
117 #error "Unsupported/Unknown platform - unable to define function call and visibility defines"
118 #endif
119 
120 #define P6NOEXPORT xNOEXPORT
121 #define P6EXPORT xEXPORT
122 #define P6IMPORT xIMPORT
123 #define P6STDCALL xSTDCALL
124 #define P6CCALL xCCALL
125 
130 #ifndef interface
131 # define interface struct
132 #endif
133 
139 #ifndef P6FROZEN
140 # define P6FROZEN
141 #endif
142 
146 #ifndef P6API
147 # define P6API
148 /*# ifndef P6_UEFI
149 # else
150 # define P6API EFIAPI
151 # endif*/
152 #endif
153 
154 
155 #ifdef __cplusplus
156 
157 # define P6IIDOF(iface) ((const P6R::P6IID) IF_##iface)
158 
166 # define P6DECLARE_IID(iface) static const P6R::P6IID IID_##iface = IF_##iface
167 
172 # define P6DECLARE_CID(component) static const P6R::P6CID CID_##component = COMP_##component
173 
178 # define P6DECLARE_CATID(category) static const P6R::P6CATID CATID_##category = CAT_##category
179 
180 # define P6COMMETHOD virtual P6NOEXPORT P6R::P6ERR P6STDCALL
181 # define P6COMMETHOD_(type) virtual P6NOEXPORT type P6STDCALL
182 # define P6COMMETHODIMPL P6NOEXPORT P6R::P6ERR
183 # define P6CLASSMETHOD P6NOEXPORT P6R::P6ERR P6STDCALL
184 # define P6CLASSMETHODIMPL P6NOEXPORT P6R::P6ERR
185 
186 
187 # define P6DECLAREIF(iface) interface iface
188 # define P6DECLAREIF_(iface,baseif) interface iface : public baseif
189 # define P6DECLCOMMETHOD(method) P6COMMETHOD method
190 # define P6DECLCOMMETHOD_(type,method) P6COMMETHOD_(type) method
191 # define P6DECLAREICOM
192 # define P6PURE = 0
193 # define P6THIS_
194 # define P6THIS void
195 # define P6REFUUID P6R::P6UUID &
196 # define P6REFCID P6R::P6CID &
197 # define P6REFIID P6R::P6IID &
198 # define P6REFCATID P6R::P6CATID &
199 # define P6REFUINT32 P6R::P6UINT32 &
200 
202 #define P6COMVAMETHOD virtual P6NOEXPORT P6R::P6ERR P6CCALL
203 
204 #define P6COMVAMETHODIMPL P6NOEXPORT P6R::P6ERR P6CCALL
205 
206 #define P6TEXT(t) L ## t
207 #define P6CTEXT(t) (const P6R::P6WCHAR*) L ## t
208 #define P6CCHR(c) (const P6R::P6WCHAR) L ## c
209 #define P6CHR(c) L ## c
210 #define P6CHARCNT(x) (sizeof((x))/sizeof((x)[0]))
211 #define P6CNTOF P6CHARCNT
212 
237 #ifndef P6_UEFI
238 # define P6ASSERT(expr) ((expr)?P6R::eOk:P6R::p6Assert(P6TEXT(#expr),__FILE__,__LINE__))
239 #else
240 # define P6ASSERT(expr)
241 #endif
242 
243 #else // C
244 
245 
246 # define P6IIDOF(iface) ((const P6IID) IF_##iface)
247 # define P6DECLARE_IID(iface) static const P6IID IID_##iface = IF_##iface
248 # define P6DECLARE_CID(component) static const P6CID CID_##component = COMP_##component
249 # define P6DECLARE_CATID(category) static const P6CATID CATID_##category = CAT_##category
250 
251 # define P6COMMETHOD P6ERR P6STDCALL
252 # define P6COMMETHOD_(type) type P6STDCALL
253 # define P6COMMETHODIMPL P6ERR
254 
255 # define P6DECLCOMMETHOD(method) P6ERR (P6STDCALL *method)
256 # define P6DECLCOMMETHOD_(type,method) type (P6STDCALL *method)
257 # define P6PURE
258 # define P6THIS_ INTERFACE * This,
259 # define P6THIS INTERFACE * This
260 # define P6REFUUID P6UUID *
261 # define P6REFCID P6CID *
262 # define P6REFIID P6IID *
263 # define P6REFCATID P6CATID *
264 # define P6REFUINT32 P6UINT32 *
265 
266 # define P6DECLAREIF(iface) typedef interface iface { \
267  struct iface##Vtbl * lpVtbl; \
268  } iface; \
269  typedef struct iface##Vtbl iface##Vtbl; \
270  struct iface##Vtbl
271 
272 # define P6DECLAREIF_(iface,baseif) P6DECLAREIF(iface)
273 
274 # define P6DECLAREICOM P6DECLCOMMETHOD(queryInterface)(P6THIS_ const P6REFIID iid,P6VOID **ppIface) P6PURE; \
275  P6DECLCOMMETHOD_(P6INT32,addref)(P6THIS) P6PURE; \
276  P6DECLCOMMETHOD_(P6INT32,release)(P6THIS) P6PURE;
277 
278 #define P6TEXT(t) L ## t
279 #define P6CTEXT(t) (const P6WCHAR*) L ## t
280 #define P6CCHR(c) (const P6WCHAR) L ## c
281 #define P6CHR(c) L ## c
282 #define P6CHARCNT(x) (sizeof((x))/sizeof((x)[0]))
283 #define P6CNTOF P6CHARCNT
284 
285 #ifndef P6_UEFI
286 # define P6ASSERT(expr) ((expr)?eOk:p6Assert(P6TEXT(#expr),__FILE__,__LINE__))
287 #else
288 # define P6ASSERT(expr)
289 #endif
290 
291 #endif // __cplusplus
292 
293 #ifdef P6_UEFI
294 /* Define NULL pointer value */
295 #ifndef NULL
296 # ifdef __cplusplus
297 # define NULL 0
298 # else
299 # define NULL ((void *)0)
300 # endif
301 #endif
302 #endif
304 #ifndef P6CURFUNCTION
305  #ifdef WIN32
306  #define P6CURFUNCTION __FUNCTION__
307  #else
308  #define P6CURFUNCTION __func__
309  #endif
310 #endif
311 
312 #endif
313