libpgf  6.11.32
PGF - Progressive Graphics File
PGFplatform.h
Go to the documentation of this file.
00001 /*
00002  * The Progressive Graphics File; http://www.libpgf.org
00003  * 
00004  * $Date: 2007-06-12 19:27:47 +0200 (Di, 12 Jun 2007) $
00005  * $Revision: 307 $
00006  * 
00007  * This file Copyright (C) 2006 xeraina GmbH, Switzerland
00008  * 
00009  * This program is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE
00011  * as published by the Free Software Foundation; either version 2.1
00012  * of the License, or (at your option) any later version.
00013  * 
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  * 
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00022  */
00023 
00028 
00029 #ifndef PGF_PGFPLATFORM_H
00030 #define PGF_PGFPLATFORM_H
00031 
00032 #include <cassert>
00033 #include <cmath>
00034 #include <cstdlib>
00035 
00036 //-------------------------------------------------------------------------------
00037 // Endianess detection taken from lcms2 header.
00038 // This list can be endless, so only some checks are performed over here.
00039 //-------------------------------------------------------------------------------
00040 #if defined(_HOST_BIG_ENDIAN) || defined(__BIG_ENDIAN__) || defined(WORDS_BIGENDIAN)
00041 #define PGF_USE_BIG_ENDIAN 1
00042 #endif
00043 
00044 #if defined(__sgi__) || defined(__sgi) || defined(__powerpc__) || defined(__sparc) || defined(__sparc__)
00045 #define PGF_USE_BIG_ENDIAN 1
00046 #endif
00047 
00048 #if defined(__ppc__) || defined(__s390__) || defined(__s390x__)
00049 #define PGF_USE_BIG_ENDIAN 1
00050 #endif
00051 
00052 #ifdef TARGET_CPU_PPC
00053 #define PGF_USE_BIG_ENDIAN 1
00054 #endif
00055 
00056 //-------------------------------------------------------------------------------
00057 // ROI support
00058 //-------------------------------------------------------------------------------
00059 #ifndef NPGFROI
00060 #define __PGFROISUPPORT__ // without ROI support the program code gets simpler and smaller
00061 #endif
00062 
00063 //-------------------------------------------------------------------------------
00064 // 32 bit per channel support
00065 //-------------------------------------------------------------------------------
00066 #ifndef NPGF32
00067 #define __PGF32SUPPORT__ // without 32 bit the memory consumption during encoding and decoding is much lesser
00068 #endif
00069 
00070 //-------------------------------------------------------------------------------
00071 //      32 Bit platform constants
00072 //-------------------------------------------------------------------------------
00073 #define WordWidth                       32                                      // WordBytes*8
00074 #define WordWidthLog            5                                       // ld of WordWidth
00075 #define WordMask                        0xFFFFFFE0                      // least WordWidthLog bits are zero
00076 #define WordBytes                       4                                       // sizeof(UINT32)
00077 #define WordBytesLog            2                                       // ld of WordBytes
00078 
00079 //-------------------------------------------------------------------------------
00080 // Macros
00081 //-------------------------------------------------------------------------------
00082 //#define DWWIDTH(bytes)                ((((bytes) + WordBytes - 1) >> WordBytesLog) << WordBytesLog)   // aligns scanline width in bytes to DWORD value
00083 //#define DWWIDTHBITS(bits)     ((((bits) + WordWidth - 1) >> WordWidthLog) << WordBytesLog)    // aligns scanline width in bits to DWORD value
00084 //#define DWWIDTHREST(bytes)    ((WordBytes - (bytes)%WordBytes)%WordBytes)                                             // DWWIDTHBITS(bytes*8) - bytes
00085 
00086 //-------------------------------------------------------------------------------
00087 // Min-Max macros
00088 //-------------------------------------------------------------------------------
00089 #ifndef __min
00090         #define __min(x, y)             ((x) <= (y) ? (x) : (y))
00091         #define __max(x, y)             ((x) >= (y) ? (x) : (y))
00092 #endif // __min
00093 
00094 //-------------------------------------------------------------------------------
00095 //      Defines -- Adobe image modes.
00096 //-------------------------------------------------------------------------------
00097 #define ImageModeBitmap                         0
00098 #define ImageModeGrayScale                      1
00099 #define ImageModeIndexedColor           2
00100 #define ImageModeRGBColor                       3
00101 #define ImageModeCMYKColor                      4
00102 #define ImageModeHSLColor                       5
00103 #define ImageModeHSBColor                       6
00104 #define ImageModeMultichannel           7
00105 #define ImageModeDuotone                        8
00106 #define ImageModeLabColor                       9
00107 #define ImageModeGray16                         10
00108 #define ImageModeRGB48                          11
00109 #define ImageModeLab48                          12
00110 #define ImageModeCMYK64                         13
00111 #define ImageModeDeepMultichannel       14
00112 #define ImageModeDuotone16                      15
00113 // pgf extension
00114 #define ImageModeRGBA                           17
00115 #define ImageModeGray31                         18
00116 #define ImageModeRGB12                          19
00117 #define ImageModeRGB16                          20
00118 #define ImageModeUnknown                        255
00119 
00120 
00121 //-------------------------------------------------------------------------------
00122 // WINDOWS 32
00123 //-------------------------------------------------------------------------------
00124 #if defined(WIN32) || defined(WINCE)
00125 #define VC_EXTRALEAN            // Exclude rarely-used stuff from Windows headers
00126 
00127 //-------------------------------------------------------------------------------
00128 // MFC
00129 //-------------------------------------------------------------------------------
00130 #ifdef _MFC_VER
00131 
00132 #include <afxwin.h>         // MFC core and standard components
00133 #include <afxext.h>         // MFC extensions
00134 #include <afxdtctl.h>           // MFC support for Internet Explorer 4 Common Controls
00135 #ifndef _AFX_NO_AFXCMN_SUPPORT
00136 #include <afxcmn.h>                     // MFC support for Windows Common Controls
00137 #endif // _AFX_NO_AFXCMN_SUPPORT
00138 #include <afx.h>
00139 
00140 #else
00141 
00142 #include <windows.h>
00143 #include <ole2.h>
00144 
00145 #endif // _MFC_VER 
00146 //-------------------------------------------------------------------------------
00147 
00148 #define DllExport   __declspec( dllexport ) 
00149 
00150 //-------------------------------------------------------------------------------
00151 // unsigned number type definitions
00152 //-------------------------------------------------------------------------------
00153 typedef unsigned char           UINT8;
00154 typedef unsigned char           BYTE;
00155 typedef unsigned short          UINT16;
00156 typedef unsigned short      WORD;
00157 typedef unsigned int            UINT32;
00158 typedef unsigned long       DWORD;
00159 typedef unsigned long       ULONG;
00160 typedef unsigned __int64        UINT64; 
00161 typedef unsigned __int64        ULONGLONG; 
00162 
00163 //-------------------------------------------------------------------------------
00164 // signed number type definitions
00165 //-------------------------------------------------------------------------------
00166 typedef signed char                     INT8;
00167 typedef signed short            INT16;
00168 typedef signed int                      INT32;
00169 typedef signed int                      BOOL;
00170 typedef signed long                     LONG;
00171 typedef signed __int64          INT64;
00172 typedef signed __int64          LONGLONG;
00173 
00174 //-------------------------------------------------------------------------------
00175 // other types
00176 //-------------------------------------------------------------------------------
00177 typedef int OSError;
00178 typedef bool (__cdecl *CallbackPtr)(double percent, bool escapeAllowed, void *data);
00179 
00180 //-------------------------------------------------------------------------------
00181 // struct type definitions
00182 //-------------------------------------------------------------------------------
00183 
00184 //-------------------------------------------------------------------------------
00185 // DEBUG macros
00186 //-------------------------------------------------------------------------------
00187 #ifndef ASSERT
00188         #ifdef _DEBUG
00189                 #define ASSERT(x)       assert(x)
00190         #else
00191                 #if defined(__GNUC__) 
00192                         #define ASSERT(ignore)((void) 0) 
00193                 #elif _MSC_VER >= 1300 
00194                         #define ASSERT          __noop
00195                 #else
00196                         #define ASSERT ((void)0)
00197                 #endif
00198         #endif //_DEBUG
00199 #endif //ASSERT
00200 
00201 //-------------------------------------------------------------------------------
00202 // Exception handling macros
00203 //-------------------------------------------------------------------------------
00204 #ifdef NEXCEPTIONS
00205         extern OSError _PGF_Error_;
00206         extern OSError GetLastPGFError();
00207 
00208         #define ReturnWithError(err) { _PGF_Error_ = err; return; }
00209         #define ReturnWithError2(err, ret) { _PGF_Error_ = err; return ret; }
00210 #else
00211         #define ReturnWithError(err) throw IOException(err)
00212         #define ReturnWithError2(err, ret) throw IOException(err)
00213 #endif //NEXCEPTIONS
00214 
00215 #if _MSC_VER >= 1300
00216         //#define THROW_ throw(...)
00217         #pragma warning( disable : 4290 )
00218         #define THROW_ throw(IOException)
00219 #else
00220         #define THROW_
00221 #endif
00222 
00223 //-------------------------------------------------------------------------------
00224 // constants
00225 //-------------------------------------------------------------------------------
00226 #define FSFromStart             FILE_BEGIN                              // 0
00227 #define FSFromCurrent   FILE_CURRENT                    // 1
00228 #define FSFromEnd               FILE_END                                // 2
00229 
00230 #define INVALID_SET_FILE_POINTER ((DWORD)-1)
00231 
00232 //-------------------------------------------------------------------------------
00233 // IO Error constants
00234 //-------------------------------------------------------------------------------
00235 #define NoError                         ERROR_SUCCESS           // no error
00236 #define AppError                        0x20000000                      // all application error messages must be larger than this value
00237 #define InsufficientMemory      0x20000001                      // memory allocation wasn't successfull
00238 #define InvalidStreamPos        0x20000002                      // invalid memory stream position
00239 #define EscapePressed           0x20000003                      // user break by ESC
00240 #define WrongVersion            0x20000004                      // wrong pgf version 
00241 #define FormatCannotRead        0x20000005                      // wrong data file format
00242 #define ImageTooSmall           0x20000006                      // image is too small
00243 #define ZlibError                       0x20000007                      // error in zlib functions
00244 #define ColorTableError         0x20000008                      // errors related to color table size
00245 #define PNGError                        0x20000009                      // errors in png functions
00246 #define MissingData                     0x2000000A                      // expected data cannot be read
00247 
00248 //-------------------------------------------------------------------------------
00249 // methods
00250 //-------------------------------------------------------------------------------
00251 inline OSError FileRead(HANDLE hFile, int *count, void *buffPtr) {
00252         if (ReadFile(hFile, buffPtr, *count, (ULONG *)count, NULL)) {
00253                 return NoError;
00254         } else {
00255                 return GetLastError();
00256         }
00257 }
00258 
00259 inline OSError FileWrite(HANDLE hFile, int *count, void *buffPtr) {
00260         if (WriteFile(hFile, buffPtr, *count, (ULONG *)count, NULL)) {
00261                 return NoError;
00262         } else {
00263                 return GetLastError();
00264         }
00265 }
00266 
00267 inline OSError GetFPos(HANDLE hFile, UINT64 *pos) {
00268 #ifdef WINCE
00269         LARGE_INTEGER li;
00270         li.QuadPart = 0;
00271 
00272         li.LowPart = SetFilePointer (hFile, li.LowPart, &li.HighPart, FILE_CURRENT);
00273         if (li.LowPart == INVALID_SET_FILE_POINTER) {
00274                 OSError err = GetLastError();
00275                 if (err != NoError) {
00276                         return err;
00277                 }
00278         }
00279         *pos = li.QuadPart;
00280         return NoError;
00281 #else
00282         LARGE_INTEGER li;
00283         li.QuadPart = 0;
00284         if (SetFilePointerEx(hFile, li, (PLARGE_INTEGER)pos, FILE_CURRENT)) {
00285                 return NoError;
00286         } else {
00287                 return GetLastError();
00288         }
00289 #endif
00290 }
00291 
00292 inline OSError SetFPos(HANDLE hFile, int posMode, INT64 posOff) {
00293 #ifdef WINCE
00294         LARGE_INTEGER li;
00295         li.QuadPart = posOff;
00296 
00297         if (SetFilePointer (hFile, li.LowPart, &li.HighPart, posMode) == INVALID_SET_FILE_POINTER) {
00298                 OSError err = GetLastError();
00299                 if (err != NoError) {
00300                         return err;
00301                 }
00302         }
00303         return NoError;
00304 #else
00305         LARGE_INTEGER li;
00306         li.QuadPart = posOff;
00307         if (SetFilePointerEx(hFile, li, NULL, posMode)) {
00308                 return NoError;
00309         } else {
00310                 return GetLastError();
00311         }
00312 #endif
00313 }
00314 #endif //WIN32
00315 
00316 
00317 //-------------------------------------------------------------------------------
00318 // Apple OSX
00319 //-------------------------------------------------------------------------------
00320 #ifdef __APPLE__
00321 #define __POSIX__ 
00322 #endif // __APPLE__
00323 
00324 
00325 //-------------------------------------------------------------------------------
00326 // LINUX
00327 //-------------------------------------------------------------------------------
00328 #if defined(__linux__) || defined(__GLIBC__)
00329 #define __POSIX__
00330 #endif // __linux__ or __GLIBC__
00331 
00332 
00333 //-------------------------------------------------------------------------------
00334 // SOLARIS
00335 //-------------------------------------------------------------------------------
00336 #ifdef __sun
00337 #define __POSIX__
00338 #endif // __sun
00339 
00340 
00341 //-------------------------------------------------------------------------------
00342 // NetBSD
00343 //-------------------------------------------------------------------------------
00344 #ifdef __NetBSD__
00345 #ifndef __POSIX__ 
00346 #define __POSIX__ 
00347 #endif 
00348 
00349 #ifndef off64_t 
00350 #define off64_t off_t 
00351 #endif 
00352 
00353 #ifndef lseek64 
00354 #define lseek64 lseek 
00355 #endif 
00356 
00357 #endif // __NetBSD__
00358 
00359 
00360 //-------------------------------------------------------------------------------
00361 // POSIX *NIXes
00362 //-------------------------------------------------------------------------------
00363 
00364 #ifdef __POSIX__
00365 #include <unistd.h>
00366 #include <errno.h>
00367 #include <stdint.h>             // for int64_t and uint64_t
00368 #include <string.h>             // memcpy()
00369 
00370 //-------------------------------------------------------------------------------
00371 // unsigned number type definitions
00372 //-------------------------------------------------------------------------------
00373 
00374 typedef unsigned char           UINT8;
00375 typedef unsigned char           BYTE;
00376 typedef unsigned short          UINT16;
00377 typedef unsigned short          WORD;
00378 typedef unsigned int            UINT32;
00379 typedef unsigned int            DWORD;
00380 typedef unsigned long           ULONG;
00381 typedef unsigned long long  __Uint64;
00382 typedef __Uint64                        UINT64;
00383 typedef __Uint64                        ULONGLONG;
00384 
00385 //-------------------------------------------------------------------------------
00386 // signed number type definitions
00387 //-------------------------------------------------------------------------------
00388 typedef signed char                     INT8;
00389 typedef signed short            INT16;
00390 typedef signed int                      INT32;
00391 typedef signed int                      BOOL;
00392 typedef signed long                     LONG;
00393 typedef int64_t                         INT64;
00394 typedef int64_t                         LONGLONG;
00395 
00396 //-------------------------------------------------------------------------------
00397 // other types
00398 //-------------------------------------------------------------------------------
00399 typedef int                                     OSError;
00400 typedef int                                     HANDLE; 
00401 typedef unsigned long           ULONG_PTR;
00402 typedef void*                           PVOID;
00403 typedef char*                           LPTSTR;
00404 typedef bool (*CallbackPtr)(double percent, bool escapeAllowed, void *data);
00405 
00406 //-------------------------------------------------------------------------------
00407 // struct type definitions
00408 //-------------------------------------------------------------------------------
00409 typedef struct tagRGBTRIPLE {
00410         BYTE rgbtBlue;
00411         BYTE rgbtGreen;
00412         BYTE rgbtRed;
00413 } RGBTRIPLE;
00414 
00415 typedef struct tagRGBQUAD {
00416         BYTE rgbBlue;
00417         BYTE rgbGreen;
00418         BYTE rgbRed;
00419         BYTE rgbReserved;
00420 } RGBQUAD;
00421 
00422 typedef union _LARGE_INTEGER {
00423   struct {
00424     DWORD LowPart;
00425     LONG HighPart;
00426   };
00427   struct {
00428     DWORD LowPart;
00429     LONG HighPart;
00430   } u;
00431   LONGLONG QuadPart;
00432 } LARGE_INTEGER, *PLARGE_INTEGER;
00433 #endif // __POSIX__
00434 
00435 
00436 #if defined(__POSIX__) || defined(WINCE)
00437 // CMYK macros
00438 #define GetKValue(cmyk)      ((BYTE)(cmyk))
00439 #define GetYValue(cmyk)      ((BYTE)((cmyk)>> 8))
00440 #define GetMValue(cmyk)      ((BYTE)((cmyk)>>16))
00441 #define GetCValue(cmyk)      ((BYTE)((cmyk)>>24))
00442 #define CMYK(c,m,y,k)            ((COLORREF)((((BYTE)(k)|((WORD)((BYTE)(y))<<8))|(((DWORD)(BYTE)(m))<<16))|(((DWORD)(BYTE)(c))<<24)))
00443 
00444 //-------------------------------------------------------------------------------
00445 // methods
00446 //-------------------------------------------------------------------------------
00447 /* The MulDiv function multiplies two 32-bit values and then divides the 64-bit 
00448  * result by a third 32-bit value. The return value is rounded up or down to 
00449  * the nearest integer.
00450  * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winprog/winprog/muldiv.asp
00451  * */
00452 __inline int MulDiv(int nNumber, int nNumerator, int nDenominator) {
00453         INT64 multRes = nNumber*nNumerator;
00454         INT32 divRes = INT32(multRes/nDenominator);
00455         return divRes;
00456 }
00457 #endif // __POSIX__ or WINCE
00458 
00459 
00460 #ifdef __POSIX__
00461 //-------------------------------------------------------------------------------
00462 // DEBUG macros
00463 //-------------------------------------------------------------------------------
00464 #ifndef ASSERT
00465         #ifdef _DEBUG
00466                 #define ASSERT(x)       assert(x)
00467         #else
00468                 #define ASSERT(x)       
00469         #endif //_DEBUG
00470 #endif //ASSERT
00471 
00472 //-------------------------------------------------------------------------------
00473 // Exception handling macros
00474 //-------------------------------------------------------------------------------
00475 #ifdef NEXCEPTIONS
00476         extern OSError _PGF_Error_;
00477         extern OSError GetLastPGFError();
00478 
00479         #define ReturnWithError(err) { _PGF_Error_ = err; return; }
00480         #define ReturnWithError2(err, ret) { _PGF_Error_ = err; return ret; }
00481 #else
00482         #define ReturnWithError(err) throw IOException(err)
00483         #define ReturnWithError2(err, ret) throw IOException(err)
00484 #endif //NEXCEPTIONS
00485 
00486 #define THROW_ throw(IOException)
00487 #define CONST const
00488 
00489 //-------------------------------------------------------------------------------
00490 // constants
00491 //-------------------------------------------------------------------------------
00492 #define FSFromStart                     SEEK_SET
00493 #define FSFromCurrent           SEEK_CUR
00494 #define FSFromEnd                       SEEK_END
00495 
00496 //-------------------------------------------------------------------------------
00497 // IO Error constants
00498 //-------------------------------------------------------------------------------
00499 #define NoError                                 0x0000
00500 #define AppError                                0x2000                  // all application error messages must be larger than this value
00501 #define InsufficientMemory              0x2001                  // memory allocation wasn't successfull
00502 #define InvalidStreamPos                0x2002                  // invalid memory stream position
00503 #define EscapePressed                   0x2003                  // user break by ESC
00504 #define WrongVersion                    0x2004                  // wrong pgf version 
00505 #define FormatCannotRead                0x2005                  // wrong data file format
00506 #define ImageTooSmall                   0x2006                  // image is too small
00507 #define ZlibError                               0x2007                  // error in zlib functions
00508 #define ColorTableError                 0x2008                  // errors related to color table size
00509 #define PNGError                                0x2009                  // errors in png functions
00510 #define MissingData                             0x200A                  // expected data cannot be read
00511 
00512 //-------------------------------------------------------------------------------
00513 // methods
00514 //-------------------------------------------------------------------------------
00515 __inline OSError FileRead(HANDLE hFile, int *count, void *buffPtr) {
00516         *count = (int)read(hFile, buffPtr, *count);
00517         if (*count != -1) {
00518                 return NoError;
00519         } else {
00520                 return errno;
00521         }
00522 }
00523 
00524 __inline OSError FileWrite(HANDLE hFile, int *count, void *buffPtr) {
00525         *count = (int)write(hFile, buffPtr, (size_t)*count);
00526         if (*count != -1) {
00527                 return NoError;
00528         } else {
00529                 return errno;
00530         }
00531 }
00532 
00533 __inline OSError GetFPos(HANDLE hFile, UINT64 *pos) {
00534         #ifdef __APPLE__
00535                 off_t ret;
00536                 if ((ret = lseek(hFile, 0, SEEK_CUR)) == -1) {
00537                         return errno;
00538                 } else {
00539                         *pos = (UINT64)ret;
00540                         return NoError;
00541                 }
00542         #else
00543                 off64_t ret;
00544                 if ((ret = lseek64(hFile, 0, SEEK_CUR)) == -1) {
00545                         return errno;
00546                 } else {
00547                         *pos = (UINT64)ret;
00548                         return NoError;
00549                 }
00550         #endif
00551 }
00552 
00553 __inline OSError SetFPos(HANDLE hFile, int posMode, INT64 posOff) {
00554         #ifdef __APPLE__
00555                 if ((lseek(hFile, (off_t)posOff, posMode)) == -1) {
00556                         return errno;
00557                 } else {
00558                         return NoError;
00559                 }
00560         #else
00561                 if ((lseek64(hFile, (off64_t)posOff, posMode)) == -1) {
00562                         return errno;
00563                 } else {
00564                         return NoError;
00565                 }
00566         #endif
00567 }
00568 
00569 #endif /* __POSIX__ */
00570 //-------------------------------------------------------------------------------
00571 
00572 
00573 //-------------------------------------------------------------------------------
00574 //      Big Endian
00575 //-------------------------------------------------------------------------------
00576 #ifdef PGF_USE_BIG_ENDIAN 
00577 
00578 #ifndef _lrotl
00579         #define _lrotl(x,n)     (((x) << ((UINT32)(n))) | ((x) >> (32 - (UINT32)(n))))
00580 #endif
00581 
00582 __inline UINT16 ByteSwap(UINT16 wX) {
00583         return ((wX & 0xFF00) >> 8) | ((wX & 0x00FF) << 8);
00584 }
00585 
00586 __inline UINT32 ByteSwap(UINT32 dwX) { 
00587 #ifdef _X86_     
00588         _asm mov eax, dwX     
00589         _asm bswap eax
00590         _asm mov dwX, eax      
00591         return dwX; 
00592 #else     
00593         return _lrotl(((dwX & 0xFF00FF00) >> 8) | ((dwX & 0x00FF00FF) << 8), 16); 
00594 #endif 
00595 }
00596 
00597 #if defined WIN32
00598 __inline UINT64 ByteSwap(UINT64 ui64) { 
00599         return _byteswap_uint64(ui64);
00600 }
00601 #endif
00602 
00603 #define __VAL(x) ByteSwap(x)
00604 
00605 #else //PGF_USE_BIG_ENDIAN
00606 
00607         #define __VAL(x) (x)
00608 
00609 #endif //PGF_USE_BIG_ENDIAN
00610  
00611 // OpenMP rules (inspired from libraw project)
00612 // NOTE: Use LIBPGF_DISABLE_OPENMP to disable OpenMP support in whole libpgf
00613 #ifndef LIBPGF_DISABLE_OPENMP
00614 #if defined (_OPENMP)
00615 # if defined (WIN32)
00616 #  if defined (_MSC_VER) && (_MSC_VER >= 1500)
00617 //  VS2008 SP1 and VS2010+ : OpenMP works OK
00618 #   define LIBPGF_USE_OPENMP
00619 #  elif defined (__INTEL_COMPILER) && (__INTEL_COMPILER >=910)
00620 //  untested on 9.x and 10.x, Intel documentation claims OpenMP 2.5 support in 9.1
00621 #   define LIBPGF_USE_OPENMP
00622 #  else
00623 #   undef LIBPGF_USE_OPENMP
00624 #  endif
00625 // Not Win32
00626 # elif (defined(__APPLE__) || defined(__MACOSX__)) && defined(_REENTRANT)
00627 #  undef LIBPGF_USE_OPENMP
00628 # else
00629 #  define LIBPGF_USE_OPENMP
00630 # endif
00631 #endif // defined (_OPENMP)
00632 #endif // ifndef LIBPGF_DISABLE_OPENMP
00633 #ifdef LIBPGF_USE_OPENMP
00634 #include <omp.h>
00635 #endif
00636 
00637 #endif //PGF_PGFPLATFORM_H