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