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 convebtion 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 # define xSTDCALL __attribute__ ((__stdcall__))
78 # else
79 # define xSTDCALL
80 # endif
81 # endif
82 # define xCCALL __attribute__ ((__cdecl__))
83 #elif defined(__GNUC__) && (__GNUC__ ==4)
84 # define xNOEXPORT __attribute__ ((visibility ("hidden")))
85 # define xEXPORT __attribute__ ((visibility ("default")))
86 # define xIMPORT __attribute__ ((visibility ("default")))
87 # if BITNESS == 32
88 # define xSTDCALL __attribute__ ((__stdcall__))
89 # define xCCALL __attribute__ ((__cdecl__))
90 # else
91 # define xSTDCALL
92 # define xCCALL
93 # endif
94 #elif defined(__SUNPRO_CC)
95 # define xNOEXPORT __hidden
96 # define xEXPORT __global
97 # define xIMPORT
98 # define xSTDCALL
99 # define xCCALL
100 #else
101 #error "Unsupported/Unknown platform - unable to define function call and visibility defines"
102 #endif
103 
104 #define P6NOEXPORT xNOEXPORT
105 #define P6EXPORT xEXPORT
106 #define P6IMPORT xIMPORT
107 #define P6STDCALL xSTDCALL
108 #define P6CCALL xCCALL
109 
114 #ifndef interface
115 # define interface struct
116 #endif
117 
123 #ifndef P6FROZEN
124 # define P6FROZEN
125 #endif
126 
130 #ifndef P6API
131 # define P6API
132 /*# ifndef P6_UEFI
133 # else
134 # define P6API EFIAPI
135 # endif*/
136 #endif
137 
138 
139 #ifdef __cplusplus
140 
141 # define P6IIDOF(iface) ((const P6R::P6IID) IF_##iface)
142 
150 # define P6DECLARE_IID(iface) static const P6R::P6IID IID_##iface = IF_##iface
151 
156 # define P6DECLARE_CID(component) static const P6R::P6CID CID_##component = COMP_##component
157 
162 # define P6DECLARE_CATID(category) static const P6R::P6CATID CATID_##category = CAT_##category
163 
164 # define P6COMMETHOD virtual P6NOEXPORT P6R::P6ERR P6STDCALL
165 # define P6COMMETHOD_(type) virtual P6NOEXPORT type P6STDCALL
166 # define P6COMMETHODIMPL P6NOEXPORT P6R::P6ERR
167 # define P6CLASSMETHOD P6NOEXPORT P6R::P6ERR P6STDCALL
168 # define P6CLASSMETHODIMPL P6NOEXPORT P6R::P6ERR
169 
170 
171 # define P6DECLAREIF(iface) interface iface
172 # define P6DECLAREIF_(iface,baseif) interface iface : public baseif
173 # define P6DECLCOMMETHOD(method) P6COMMETHOD method
174 # define P6DECLCOMMETHOD_(type,method) P6COMMETHOD_(type) method
175 # define P6DECLAREICOM
176 # define P6PURE =0
177 # define P6THIS_
178 # define P6THIS void
179 # define P6REFUUID P6R::P6UUID &
180 # define P6REFCID P6R::P6CID &
181 # define P6REFIID P6R::P6IID &
182 # define P6REFCATID P6R::P6CATID &
183 # define P6REFUINT32 P6R::P6UINT32 &
184 
186 #define P6COMVAMETHOD virtual P6NOEXPORT P6R::P6ERR P6CCALL
187 
188 #define P6COMVAMETHODIMPL P6NOEXPORT P6R::P6ERR P6CCALL
189 
190 #define P6TEXT(t) L ## t
191 #define P6CTEXT(t) (const P6R::P6WCHAR*) L ## t
192 #define P6CCHR(c) (const P6R::P6WCHAR) L ## c
193 #define P6CHR(c) L ## c
194 #define P6CHARCNT(x) (sizeof((x))/sizeof((x)[0]))
195 #define P6CNTOF P6CHARCNT
196 
221 #ifndef P6_UEFI
222 # define P6ASSERT(expr) ((expr)?P6R::eOk:P6R::p6Assert(P6TEXT(#expr),__FILE__,__LINE__))
223 #else
224 # define P6ASSERT(expr)
225 #endif
226 
227 #else // C
228 
229 
230 # define P6IIDOF(iface) ((const P6IID) IF_##iface)
231 # define P6DECLARE_IID(iface) static const P6IID IID_##iface = IF_##iface
232 # define P6DECLARE_CID(component) static const P6CID CID_##component = COMP_##component
233 # define P6DECLARE_CATID(category) static const P6CATID CATID_##category = CAT_##category
234 
235 # define P6COMMETHOD P6ERR P6STDCALL
236 # define P6COMMETHOD_(type) type P6STDCALL
237 # define P6COMMETHODIMPL P6ERR
238 
239 # define P6DECLCOMMETHOD(method) P6ERR (P6STDCALL *method)
240 # define P6DECLCOMMETHOD_(type,method) type (P6STDCALL *method)
241 # define P6PURE
242 # define P6THIS_ INTERFACE * This,
243 # define P6THIS INTERFACE * This
244 # define P6REFUUID P6UUID *
245 # define P6REFCID P6CID *
246 # define P6REFIID P6IID *
247 # define P6REFCATID P6CATID *
248 # define P6REFUINT32 P6UINT32 *
249 
250 # define P6DECLAREIF(iface) typedef interface iface { \
251  struct iface##Vtbl * lpVtbl; \
252  } iface; \
253  typedef struct iface##Vtbl iface##Vtbl; \
254  struct iface##Vtbl
255 
256 # define P6DECLAREIF_(iface,baseif) P6DECLAREIF(iface)
257 
258 # define P6DECLAREICOM P6DECLCOMMETHOD(queryInterface)(P6THIS_ const P6REFIID iid,P6VOID **ppIface) P6PURE; \
259  P6DECLCOMMETHOD_(P6INT32,addref)(P6THIS) P6PURE; \
260  P6DECLCOMMETHOD_(P6INT32,release)(P6THIS) P6PURE;
261 
262 #define P6TEXT(t) L ## t
263 #define P6CTEXT(t) (const P6WCHAR*) L ## t
264 #define P6CCHR(c) (const P6WCHAR) L ## c
265 #define P6CHR(c) L ## c
266 #define P6CHARCNT(x) (sizeof((x))/sizeof((x)[0]))
267 #define P6CNTOF P6CHARCNT
268 
269 #ifndef P6_UEFI
270 # define P6ASSERT(expr) ((expr)?eOk:p6Assert(P6TEXT(#expr),__FILE__,__LINE__))
271 #else
272 # define P6ASSERT(expr)
273 #endif
274 
275 #endif // __cplusplus
276 
277 #ifdef P6_UEFI
278 /* Define NULL pointer value */
279 #ifndef NULL
280 # ifdef __cplusplus
281 # define NULL 0
282 # else
283 # define NULL ((void *)0)
284 # endif
285 #endif
286 #endif
288 #endif
289