- Main Page
- Classes
- Files
- Related Pages

- File List
- File Members

# cpl_port.h File Reference

`#include "cpl_config.h"`
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <math.h>`
`#include <stdarg.h>`
`#include <string.h>`
`#include <ctype.h>`
`#include <time.h>`
`#include <locale.h>`

Go to the source code of this file.

## Defines
#define | CPL_C_START extern "C" {
#define | CPL_C_END }
#define | CPL_ODLL
#define | FORCE_CDECL
#define | NULL 0
#define | FALSE 0
#define | TRUE 1
#define | MIN(a, b) ((a<b) ? a : b)
#define | MAX(a, b) ((a>b) ? a : b)
#define | ABS(x) ((x<0) ? (-1*(x)) : x)
#define | CPLIsEqual(x, y) (fabs(fabs(x) - fabs(y)) < 0.0000000000001)
#define | EQUALN(a, b, n) (strncasecmp(a,b,n)==0)
#define | EQUAL(a, b) (strcasecmp(a,b)==0)
#define | CPLIsNan(x) isnan(x)
#define | CPLIsInf(x) FALSE
#define | CPLIsFinite(x) (!isnan(x))
#define | CPL_LSB
#define | CPL_IS_LSB 1
#define | CPL_SWAP16(x)
#define | CPL_SWAP16PTR(x)
#define | CPL_SWAP32(x)
#define | CPL_SWAP32PTR(x)
#define | CPL_SWAP64PTR(x)
#define | CPL_SWAPDOUBLE(p) CPL_SWAP64PTR(p)
#define | CPL_LSBWORD16(x) (x)
#define | CPL_MSBWORD16(x) CPL_SWAP16(x)
#define | CPL_LSBWORD32(x) (x)
#define | CPL_MSBWORD32(x) CPL_SWAP32(x)
#define | CPL_LSBPTR16(x)
#define | CPL_MSBPTR16(x) CPL_SWAP16PTR(x)
#define | CPL_LSBPTR32(x)
#define | CPL_MSBPTR32(x) CPL_SWAP32PTR(x)
#define | CPL_LSBPTR64(x)
#define | CPL_MSBPTR64(x) CPL_SWAP64PTR(x)
#define | CPL_CVSID(string)
## Typedefs
typedef int | GInt32
typedef unsigned int | GUInt32
typedef short | GInt16
typedef unsigned short | GUInt16
typedef unsigned char | GByte
typedef int | GBool
typedef long long | GIntBig
typedef unsigned long long | GUIntBig

## Detailed Description

Core portability definitions for CPL.

## Define Documentation

#define CPL_CVSID | ( | string |  | ) |

Value:

    static char cpl_cvsid[] = string; \
    static char *cvsid_aw() { return( cvsid_aw() ? ((char *) NULL) : cpl_cvsid ); }

#define CPL_SWAP16 | ( | x |  | ) |

Value:

    ((GUInt16)( \
                (((GUInt16)(x) & 0x00ffU) << 8) | \
                (((GUInt16)(x) & 0xff00U) >> 8) ))

#define CPL_SWAP16PTR | ( | x |  | ) |

Value:

    {                                                                 \
        GByte       byTemp, *_pabyDataT = (GByte *) (x);              \
                                                                      \
        byTemp = _pabyDataT[0];                                       \
        _pabyDataT[0] = _pabyDataT[1];                                \
        _pabyDataT[1] = byTemp;                                       \
    }

#define CPL_SWAP32 | ( | x |  | ) |

Value:

    ((GUInt32)( \
                (((GUInt32)(x) & (GUInt32)0x000000ffUL) << 24) | \
                (((GUInt32)(x) & (GUInt32)0x0000ff00UL) <<  8) | \
                (((GUInt32)(x) & (GUInt32)0x00ff0000UL) >>  8) | \
                (((GUInt32)(x) & (GUInt32)0xff000000UL) >> 24) ))

#define CPL_SWAP32PTR | ( | x |  | ) |

Value:

    {                                                                 \
        GByte       byTemp, *_pabyDataT = (GByte *) (x);              \
                                                                      \
        byTemp = _pabyDataT[0];                                       \
        _pabyDataT[0] = _pabyDataT[3];                                \
        _pabyDataT[3] = byTemp;                                       \
        byTemp = _pabyDataT[1];                                       \
        _pabyDataT[1] = _pabyDataT[2];                                \
        _pabyDataT[2] = byTemp;                                       \
    }

#define CPL_SWAP64PTR | ( | x |  | ) |

Value:

    {                                                                 \
        GByte       byTemp, *_pabyDataT = (GByte *) (x);              \
                                                                      \
        byTemp = _pabyDataT[0];                                       \
        _pabyDataT[0] = _pabyDataT[7];                                \
        _pabyDataT[7] = byTemp;                                       \
        byTemp = _pabyDataT[1];                                       \
        _pabyDataT[1] = _pabyDataT[6];                                \
        _pabyDataT[6] = byTemp;                                       \
        byTemp = _pabyDataT[2];                                       \
        _pabyDataT[2] = _pabyDataT[5];                                \
        _pabyDataT[5] = byTemp;                                       \
        byTemp = _pabyDataT[3];                                       \
        _pabyDataT[3] = _pabyDataT[4];                                \
        _pabyDataT[4] = byTemp;                                       \
    }

Generated for GDAL by 1.5.1.