1 /*
2  * The Progressive Graphics File; http://www.libpgf.org
3  *
4  * $Date: 2007-06-12 19:27:47 +0200 (Di, 12 Jun 2007) $
5  * $Revision: 307 $
6  *
7  * This file Copyright (C) 2006 xeraina GmbH, Switzerland
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE
11  * as published by the Free Software Foundation; either version 2.1
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22  */
23 
24 //////////////////////////////////////////////////////////////////////
25 /// @file PGFplatform.h
26 /// @brief PGF platform specific definitions
27 /// @author C. Stamm
28 
29 #ifndef PGF_PGFPLATFORM_H
30 #define PGF_PGFPLATFORM_H
31 
32 #include <cassert>
33 #include <cmath>
34 #include <cstdlib>
35 
36 //-------------------------------------------------------------------------------
37 // Endianess detection taken from lcms2 header.
38 // This list can be endless, so only some checks are performed over here.
39 //-------------------------------------------------------------------------------
40 #if defined(_HOST_BIG_ENDIAN) || defined(__BIG_ENDIAN__) || defined(WORDS_BIGENDIAN)
41 #define PGF_USE_BIG_ENDIAN 1
42 #endif
43 
44 #if defined(__sgi__) || defined(__sgi) || defined(__powerpc__) || defined(__sparc) || defined(__sparc__)
45 #define PGF_USE_BIG_ENDIAN 1
46 #endif
47 
48 #if defined(__ppc__) || defined(__s390__) || defined(__s390x__)
49 #define PGF_USE_BIG_ENDIAN 1
50 #endif
51 
52 #ifdef TARGET_CPU_PPC
53 #define PGF_USE_BIG_ENDIAN 1
54 #endif
55 
56 //-------------------------------------------------------------------------------
57 // ROI support
58 //-------------------------------------------------------------------------------
59 #ifndef NPGFROI
60 #define __PGFROISUPPORT__ // without ROI support the program code gets simpler and smaller
61 #endif
62 
63 //-------------------------------------------------------------------------------
64 // 32 bit per channel support
65 //-------------------------------------------------------------------------------
66 #ifndef NPGF32
67 #define __PGF32SUPPORT__ // without 32 bit the memory consumption during encoding and decoding is much lesser
68 #endif
69 
70 //-------------------------------------------------------------------------------
71 //	32 Bit platform constants
72 //-------------------------------------------------------------------------------
73 #define WordWidth			32					///< WordBytes*8
74 #define WordWidthLog		5					///< ld of WordWidth
75 #define WordMask			0xFFFFFFE0			///< least WordWidthLog bits are zero
76 #define WordBytes			4					///< sizeof(UINT32)
77 #define WordBytesMask		0xFFFFFFFC			///< least WordBytesLog bits are zero
78 #define WordBytesLog		2					///< ld of WordBytes
79 
80 //-------------------------------------------------------------------------------
81 // Alignment macros (used in PGF based libraries)
82 //-------------------------------------------------------------------------------
83 #define DWWIDTHBITS(bits)	(((bits) + WordWidth - 1) & WordMask)		///< aligns scanline width in bits to DWORD value
84 #define DWWIDTH(bytes)		(((bytes) + WordBytes - 1) & WordBytesMask)	///< aligns scanline width in bytes to DWORD value
85 #define DWWIDTHREST(bytes)	((WordBytes - (bytes)%WordBytes)%WordBytes)	///< DWWIDTH(bytes) - bytes
86 
87 //-------------------------------------------------------------------------------
88 // Min-Max macros
89 //-------------------------------------------------------------------------------
90 #ifndef __min
91 	#define __min(x, y)		((x) <= (y) ? (x) : (y))
92 	#define __max(x, y)		((x) >= (y) ? (x) : (y))
93 #endif // __min
94 
95 //-------------------------------------------------------------------------------
96 //	Defines -- Adobe image modes.
97 //-------------------------------------------------------------------------------
98 #define ImageModeBitmap				0
99 #define ImageModeGrayScale			1
100 #define ImageModeIndexedColor		2
101 #define ImageModeRGBColor			3
102 #define ImageModeCMYKColor			4
103 #define ImageModeHSLColor			5
104 #define ImageModeHSBColor			6
105 #define ImageModeMultichannel		7
106 #define ImageModeDuotone			8
107 #define ImageModeLabColor			9
108 #define ImageModeGray16				10		// 565
109 #define ImageModeRGB48				11
110 #define ImageModeLab48				12
111 #define ImageModeCMYK64				13
112 #define ImageModeDeepMultichannel	14
113 #define ImageModeDuotone16			15
114 // pgf extension
115 #define ImageModeRGBA				17
116 #define ImageModeGray32				18		// MSB is 0 (can be interpreted as signed 15.16 fixed point format)
117 #define ImageModeRGB12				19
118 #define ImageModeRGB16				20
119 #define ImageModeUnknown			255
120 
121 
122 //-------------------------------------------------------------------------------
123 // WINDOWS
124 //-------------------------------------------------------------------------------
125 #if defined(WIN32) || defined(WINCE) || defined(WIN64)
126 #define VC_EXTRALEAN		// Exclude rarely-used stuff from Windows headers
127 
128 //-------------------------------------------------------------------------------
129 // MFC
130 //-------------------------------------------------------------------------------
131 #ifdef _MFC_VER
132 #ifndef _WIN32_WINNT            // Specifies that the minimum required platform is Windows Vista.
133 #define _WIN32_WINNT 0x0600     // Change this to the appropriate value to target other versions of Windows.
134 #endif
135 #include <afx.h>
136 #include <afxwin.h>         // MFC core and standard components
137 #include <afxext.h>         // MFC extensions
138 #include <afxdtctl.h>		// MFC support for Internet Explorer 4 Common Controls
139 #ifndef _AFX_NO_AFXCMN_SUPPORT
140 #include <afxcmn.h>			// MFC support for Windows Common Controls
141 #endif // _AFX_NO_AFXCMN_SUPPORT
142 
143 #else
144 
145 #include <windows.h>
146 #include <ole2.h>
147 
148 #endif // _MFC_VER
149 //-------------------------------------------------------------------------------
150 
151 #define DllExport   __declspec( dllexport )
152 
153 //-------------------------------------------------------------------------------
154 // unsigned number type definitions
155 //-------------------------------------------------------------------------------
156 typedef unsigned char		UINT8;
157 typedef unsigned char		BYTE;
158 typedef unsigned short		UINT16;
159 typedef unsigned short      WORD;
160 typedef	unsigned int		UINT32;
161 typedef unsigned long       DWORD;
162 typedef unsigned long       ULONG;
163 typedef unsigned __int64	UINT64;
164 typedef unsigned __int64	ULONGLONG;
165 
166 //-------------------------------------------------------------------------------
167 // signed number type definitions
168 //-------------------------------------------------------------------------------
169 typedef signed char			INT8;
170 typedef signed short		INT16;
171 typedef signed int			INT32;
172 typedef signed int			BOOL;
173 typedef signed long			LONG;
174 typedef signed __int64		INT64;
175 typedef signed __int64		LONGLONG;
176 
177 //-------------------------------------------------------------------------------
178 // other types
179 //-------------------------------------------------------------------------------
180 typedef int OSError;
181 typedef bool (__cdecl *CallbackPtr)(double percent, bool escapeAllowed, void *data);
182 
183 //-------------------------------------------------------------------------------
184 // struct type definitions
185 //-------------------------------------------------------------------------------
186 
187 //-------------------------------------------------------------------------------
188 // DEBUG macros
189 //-------------------------------------------------------------------------------
190 #ifndef ASSERT
191 	#ifdef _DEBUG
192 		#define ASSERT(x)	assert(x)
193 	#else
194 		#if defined(__GNUC__)
195 			#define ASSERT(ignore)((void) 0)
196 		#elif _MSC_VER >= 1300
197 			#define ASSERT		__noop
198 		#else
199 			#define ASSERT ((void)0)
200 		#endif
201 	#endif //_DEBUG
202 #endif //ASSERT
203 
204 //-------------------------------------------------------------------------------
205 // Exception handling macros
206 //-------------------------------------------------------------------------------
207 #ifdef NEXCEPTIONS
208 	extern OSError _PGF_Error_;
209 	extern OSError GetLastPGFError();
210 
211 	#define ReturnWithError(err) { _PGF_Error_ = err; return; }
212 	#define ReturnWithError2(err, ret) { _PGF_Error_ = err; return ret; }
213 #else
214 	#define ReturnWithError(err) throw IOException(err)
215 	#define ReturnWithError2(err, ret) throw IOException(err)
216 #endif //NEXCEPTIONS
217 
218 //-------------------------------------------------------------------------------
219 // constants
220 //-------------------------------------------------------------------------------
221 #define FSFromStart		FILE_BEGIN				// 0
222 #define FSFromCurrent	FILE_CURRENT			// 1
223 #define FSFromEnd		FILE_END				// 2
224 
225 #define INVALID_SET_FILE_POINTER ((DWORD)-1)
226 
227 //-------------------------------------------------------------------------------
228 // IO Error constants
229 //-------------------------------------------------------------------------------
230 #define NoError				ERROR_SUCCESS		///< no error
231 #define AppError			0x20000000			///< all application error messages must be larger than this value
232 #define InsufficientMemory	0x20000001			///< memory allocation was not successfull
233 #define InvalidStreamPos	0x20000002			///< invalid memory stream position
234 #define EscapePressed		0x20000003			///< user break by ESC
235 #define WrongVersion		0x20000004			///< wrong PGF version
236 #define FormatCannotRead	0x20000005			///< wrong data file format
237 #define ImageTooSmall		0x20000006			///< image is too small
238 #define ZlibError			0x20000007			///< error in zlib functions
239 #define ColorTableError		0x20000008			///< errors related to color table size
240 #define PNGError			0x20000009			///< errors in png functions
241 #define MissingData			0x2000000A			///< expected data cannot be read
242 
243 //-------------------------------------------------------------------------------
244 // methods
245 //-------------------------------------------------------------------------------
FileRead(HANDLE hFile,int * count,void * buffPtr)246 inline OSError FileRead(HANDLE hFile, int *count, void *buffPtr) {
247 	if (ReadFile(hFile, buffPtr, *count, (ULONG *)count, nullptr)) {
248 		return NoError;
249 	} else {
250 		return GetLastError();
251 	}
252 }
253 
FileWrite(HANDLE hFile,int * count,void * buffPtr)254 inline OSError FileWrite(HANDLE hFile, int *count, void *buffPtr) {
255 	if (WriteFile(hFile, buffPtr, *count, (ULONG *)count, nullptr)) {
256 		return NoError;
257 	} else {
258 		return GetLastError();
259 	}
260 }
261 
GetFPos(HANDLE hFile,UINT64 * pos)262 inline OSError GetFPos(HANDLE hFile, UINT64 *pos) {
263 #ifdef WINCE
264 	LARGE_INTEGER li;
265 	li.QuadPart = 0;
266 
267 	li.LowPart = SetFilePointer (hFile, li.LowPart, &li.HighPart, FILE_CURRENT);
268 	if (li.LowPart == INVALID_SET_FILE_POINTER) {
269 		OSError err = GetLastError();
270 		if (err != NoError) {
271 			return err;
272 		}
273 	}
274 	*pos = li.QuadPart;
275 	return NoError;
276 #else
277 	LARGE_INTEGER li;
278 	li.QuadPart = 0;
279 	if (SetFilePointerEx(hFile, li, (PLARGE_INTEGER)pos, FILE_CURRENT)) {
280 		return NoError;
281 	} else {
282 		return GetLastError();
283 	}
284 #endif
285 }
286 
SetFPos(HANDLE hFile,int posMode,INT64 posOff)287 inline OSError SetFPos(HANDLE hFile, int posMode, INT64 posOff) {
288 #ifdef WINCE
289 	LARGE_INTEGER li;
290 	li.QuadPart = posOff;
291 
292 	if (SetFilePointer (hFile, li.LowPart, &li.HighPart, posMode) == INVALID_SET_FILE_POINTER) {
293 		OSError err = GetLastError();
294 		if (err != NoError) {
295 			return err;
296 		}
297 	}
298 	return NoError;
299 #else
300 	LARGE_INTEGER li;
301 	li.QuadPart = posOff;
302 	if (SetFilePointerEx(hFile, li, nullptr, posMode)) {
303 		return NoError;
304 	} else {
305 		return GetLastError();
306 	}
307 #endif
308 }
309 #endif //WIN32
310 
311 
312 //-------------------------------------------------------------------------------
313 // Apple OSX
314 //-------------------------------------------------------------------------------
315 #ifdef __APPLE__
316 #define __POSIX__
317 #endif // __APPLE__
318 
319 
320 //-------------------------------------------------------------------------------
321 // LINUX
322 //-------------------------------------------------------------------------------
323 #if defined(__linux__) || defined(__GLIBC__)
324 #define __POSIX__
325 #endif // __linux__ or __GLIBC__
326 
327 
328 //-------------------------------------------------------------------------------
329 // SOLARIS
330 //-------------------------------------------------------------------------------
331 #ifdef __sun
332 #define __POSIX__
333 #endif // __sun
334 
335 
336 //-------------------------------------------------------------------------------
337 // *BSD and Haiku
338 //-------------------------------------------------------------------------------
339 #if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__HAIKU__) || defined(__DragonFly__)
340 #ifndef __POSIX__
341 #define __POSIX__
342 #endif
343 
344 #ifndef off64_t
345 #define off64_t off_t
346 #endif
347 
348 #ifndef lseek64
349 #define lseek64 lseek
350 #endif
351 
352 #endif // __NetBSD__ or __OpenBSD__ or __FreeBSD__ or __HAIKU__
353 
354 
355 //-------------------------------------------------------------------------------
356 // POSIX *NIXes
357 //-------------------------------------------------------------------------------
358 
359 #ifdef __POSIX__
360 #include <unistd.h>
361 #include <errno.h>
362 #include <stdint.h>		// for int64_t and uint64_t
363 #include <string.h>		// memcpy()
364 
365 #undef major
366 
367 //-------------------------------------------------------------------------------
368 // unsigned number type definitions
369 //-------------------------------------------------------------------------------
370 
371 typedef unsigned char		UINT8;
372 typedef unsigned char		BYTE;
373 typedef unsigned short		UINT16;
374 typedef unsigned short		WORD;
375 typedef unsigned int		UINT32;
376 typedef unsigned int		DWORD;
377 typedef unsigned long		ULONG;
378 typedef unsigned long long  __Uint64;
379 typedef __Uint64			UINT64;
380 typedef __Uint64			ULONGLONG;
381 
382 //-------------------------------------------------------------------------------
383 // signed number type definitions
384 //-------------------------------------------------------------------------------
385 typedef signed char			INT8;
386 typedef signed short		INT16;
387 typedef signed int			INT32;
388 typedef signed int			BOOL;
389 typedef signed long			LONG;
390 typedef int64_t				INT64;
391 typedef int64_t				LONGLONG;
392 
393 //-------------------------------------------------------------------------------
394 // other types
395 //-------------------------------------------------------------------------------
396 typedef int					OSError;
397 typedef int					HANDLE;
398 typedef unsigned long		ULONG_PTR;
399 typedef void*				PVOID;
400 typedef char*				LPTSTR;
401 typedef bool (*CallbackPtr)(double percent, bool escapeAllowed, void *data);
402 
403 //-------------------------------------------------------------------------------
404 // struct type definitions
405 //-------------------------------------------------------------------------------
406 typedef struct tagRGBTRIPLE {
407 	BYTE rgbtBlue;
408 	BYTE rgbtGreen;
409 	BYTE rgbtRed;
410 } RGBTRIPLE;
411 
412 typedef struct tagRGBQUAD {
413 	BYTE rgbBlue;
414 	BYTE rgbGreen;
415 	BYTE rgbRed;
416 	BYTE rgbReserved;
417 } RGBQUAD;
418 
419 typedef union _LARGE_INTEGER {
420   struct {
421     DWORD LowPart;
422     LONG HighPart;
423   } u;
424   LONGLONG QuadPart;
425 } LARGE_INTEGER, *PLARGE_INTEGER;
426 #endif // __POSIX__
427 
428 
429 #if defined(__POSIX__) || defined(WINCE)
430 // CMYK macros
431 #define GetKValue(cmyk)      ((BYTE)(cmyk))
432 #define GetYValue(cmyk)      ((BYTE)((cmyk)>> 8))
433 #define GetMValue(cmyk)      ((BYTE)((cmyk)>>16))
434 #define GetCValue(cmyk)      ((BYTE)((cmyk)>>24))
435 #define CMYK(c,m,y,k)		 ((COLORREF)((((BYTE)(k)|((WORD)((BYTE)(y))<<8))|(((DWORD)(BYTE)(m))<<16))|(((DWORD)(BYTE)(c))<<24)))
436 
437 //-------------------------------------------------------------------------------
438 // methods
439 //-------------------------------------------------------------------------------
440 /* The MulDiv function multiplies two 32-bit values and then divides the 64-bit
441  * result by a third 32-bit value. The return value is rounded up or down to
442  * the nearest integer.
443  * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winprog/winprog/muldiv.asp
444  * */
MulDiv(int nNumber,int nNumerator,int nDenominator)445 __inline int MulDiv(int nNumber, int nNumerator, int nDenominator) {
446 	INT64 multRes = nNumber*nNumerator;
447 	INT32 divRes = INT32(multRes/nDenominator);
448 	return divRes;
449 }
450 #endif // __POSIX__ or WINCE
451 
452 
453 #ifdef __POSIX__
454 //-------------------------------------------------------------------------------
455 // DEBUG macros
456 //-------------------------------------------------------------------------------
457 #ifndef ASSERT
458 	#ifdef _DEBUG
459 		#define ASSERT(x)	assert(x)
460 	#else
461 		#define ASSERT(x)
462 	#endif //_DEBUG
463 #endif //ASSERT
464 
465 //-------------------------------------------------------------------------------
466 // Exception handling macros
467 //-------------------------------------------------------------------------------
468 #ifdef NEXCEPTIONS
469 	extern OSError _PGF_Error_;
470 	extern OSError GetLastPGFError();
471 
472 	#define ReturnWithError(err) { _PGF_Error_ = err; return; }
473 	#define ReturnWithError2(err, ret) { _PGF_Error_ = err; return ret; }
474 #else
475 	#define ReturnWithError(err) throw IOException(err)
476 	#define ReturnWithError2(err, ret) throw IOException(err)
477 #endif //NEXCEPTIONS
478 
479 // Dynamic exceptions specifications are deprecated in C++11
480 #if __cplusplus < 201103L
481 #define THROW_ throw(IOException)
482 #else
483 #define THROW_
484 #endif
485 #define CONST const
486 
487 //-------------------------------------------------------------------------------
488 // constants
489 //-------------------------------------------------------------------------------
490 #define FSFromStart			SEEK_SET
491 #define FSFromCurrent		SEEK_CUR
492 #define FSFromEnd			SEEK_END
493 
494 //-------------------------------------------------------------------------------
495 // IO Error constants
496 //-------------------------------------------------------------------------------
497 #define NoError					0x0000			///< no error
498 #define AppError				0x2000			///< all application error messages must be larger than this value
499 #define InsufficientMemory		0x2001			///< memory allocation wasn't successfull
500 #define InvalidStreamPos		0x2002			///< invalid memory stream position
501 #define EscapePressed			0x2003			///< user break by ESC
502 #define WrongVersion			0x2004			///< wrong pgf version
503 #define FormatCannotRead		0x2005			///< wrong data file format
504 #define ImageTooSmall			0x2006			///< image is too small
505 #define ZlibError				0x2007			///< error in zlib functions
506 #define ColorTableError			0x2008			///< errors related to color table size
507 #define PNGError				0x2009			///< errors in png functions
508 #define MissingData				0x200A			///< expected data cannot be read
509 
510 //-------------------------------------------------------------------------------
511 // methods
512 //-------------------------------------------------------------------------------
FileRead(HANDLE hFile,int * count,void * buffPtr)513 __inline OSError FileRead(HANDLE hFile, int *count, void *buffPtr) {
514 	*count = (int)read(hFile, buffPtr, *count);
515 	if (*count != -1) {
516 		return NoError;
517 	} else {
518 		return errno;
519 	}
520 }
521 
FileWrite(HANDLE hFile,int * count,void * buffPtr)522 __inline OSError FileWrite(HANDLE hFile, int *count, void *buffPtr) {
523 	*count = (int)write(hFile, buffPtr, (size_t)*count);
524 	if (*count != -1) {
525 		return NoError;
526 	} else {
527 		return errno;
528 	}
529 }
530 
GetFPos(HANDLE hFile,UINT64 * pos)531 __inline OSError GetFPos(HANDLE hFile, UINT64 *pos) {
532 	#ifdef __APPLE__
533 		off_t ret;
534 		if ((ret = lseek(hFile, 0, SEEK_CUR)) == -1) {
535 			return errno;
536 		} else {
537 			*pos = (UINT64)ret;
538 			return NoError;
539 		}
540 	#else
541 		off64_t ret;
542 		if ((ret = lseek64(hFile, 0, SEEK_CUR)) == -1) {
543 			return errno;
544 		} else {
545 			*pos = (UINT64)ret;
546 			return NoError;
547 		}
548 	#endif
549 }
550 
SetFPos(HANDLE hFile,int posMode,INT64 posOff)551 __inline OSError SetFPos(HANDLE hFile, int posMode, INT64 posOff) {
552 	#ifdef __APPLE__
553 		if ((lseek(hFile, (off_t)posOff, posMode)) == -1) {
554 			return errno;
555 		} else {
556 			return NoError;
557 		}
558 	#else
559 		if ((lseek64(hFile, (off64_t)posOff, posMode)) == -1) {
560 			return errno;
561 		} else {
562 			return NoError;
563 		}
564 	#endif
565 }
566 
567 #endif /* __POSIX__ */
568 //-------------------------------------------------------------------------------
569 
570 
571 //-------------------------------------------------------------------------------
572 //	Big Endian
573 //-------------------------------------------------------------------------------
574 #ifdef PGF_USE_BIG_ENDIAN
575 
576 #ifndef _lrotl
577 	#define _lrotl(x,n)	(((x) << ((UINT32)(n))) | ((x) >> (32 - (UINT32)(n))))
578 #endif
579 
ByteSwap(UINT16 wX)580 __inline UINT16 ByteSwap(UINT16 wX) {
581 	return ((wX & 0xFF00) >> 8) | ((wX & 0x00FF) << 8);
582 }
583 
ByteSwap(UINT32 dwX)584 __inline UINT32 ByteSwap(UINT32 dwX) {
585 #ifdef _X86_
586 	_asm mov eax, dwX
587 	_asm bswap eax
588 	_asm mov dwX, eax
589 	return dwX;
590 #else
591 	return _lrotl(((dwX & 0xFF00FF00) >> 8) | ((dwX & 0x00FF00FF) << 8), 16);
592 #endif
593 }
594 
595 #if defined(WIN32) || defined(WIN64)
ByteSwap(UINT64 ui64)596 __inline UINT64 ByteSwap(UINT64 ui64) {
597 	return _byteswap_uint64(ui64);
598 }
599 #endif
600 
601 #define __VAL(x) ByteSwap(x)
602 
603 #else //PGF_USE_BIG_ENDIAN
604 
605 	#define __VAL(x) (x)
606 
607 #endif //PGF_USE_BIG_ENDIAN
608 
609 // OpenMP rules (inspired from libraw project)
610 // NOTE: Use LIBPGF_DISABLE_OPENMP to disable OpenMP support in whole libpgf
611 #define LIBPGF_DISABLE_OPENMP
612 #undef LIBPGF_USE_OPENMP
613 
614 #ifndef LIBPGF_DISABLE_OPENMP
615 # if defined (_OPENMP)
616 #  if defined (WIN32) || defined(WIN64)
617 #   if defined (_MSC_VER) && (_MSC_VER >= 1500)
618 //   VS2008 SP1 and VS2010+ : OpenMP works OK
619 #    define LIBPGF_USE_OPENMP
620 #   elif defined (__INTEL_COMPILER) && (__INTEL_COMPILER >=910)
621 //   untested on 9.x and 10.x, Intel documentation claims OpenMP 2.5 support in 9.1
622 #    define LIBPGF_USE_OPENMP
623 #   else
624 #    undef LIBPGF_USE_OPENMP
625 #   endif
626 //  Not Win32
627 #  elif (defined(__APPLE__) || defined(__MACOSX__)) && defined(_REENTRANT)
628 #   undef LIBPGF_USE_OPENMP
629 #  else
630 #   define LIBPGF_USE_OPENMP
631 #  endif
632 # endif // defined (_OPENMP)
633 #endif // ifndef LIBPGF_DISABLE_OPENMP
634 #ifdef LIBPGF_USE_OPENMP
635 #include <omp.h>
636 #endif
637 
638 #endif //PGF_PGFPLATFORM_H
639