# cpl_port.h File Reference

Core portability definitions for CPL. More...

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

Go to the source code of this file.

## Defines
#define | CPL_FRMT_GB_WITHOUT_PREFIX "ll"
#define | CPL_FRMT_GIB "%" CPL_FRMT_GB_WITHOUT_PREFIX "d"
#define | CPL_FRMT_GUIB "%" CPL_FRMT_GB_WITHOUT_PREFIX "u"
#define | GUINTBIG_TO_DOUBLE(x) (double)(x)
#define | CPL_C_START extern "C" {
#define | CPL_C_END }
#define | CPL_ODLL
#define | FORCE_CDECL
#define | CPL_INLINE
#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((x) - (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_LSBINT16PTR(x) ((*(GByte*)(x)) | ((*(GByte*)((x)+1)) << 8))
| Return a Int16 from the 2 bytes ordered in LSB order at address x.
#define | CPL_LSBINT32PTR(x)
| Return a Int32 from the 4 bytes ordered in LSB order at address x.
#define | UNREFERENCED_PARAM(param) ((void)param)
#define | CPL_CVSID(string)
#define | CPL_PRINT_FUNC_FORMAT(format_idx, arg_idx)
## 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_LSBINT32PTR | ( | x |  | ) |

Value:

    ((*(GByte*)(x)) | ((*(GByte*)((x)+1)) << 8) | \
                                  ((*(GByte*)((x)+2)) << 16) | ((*(GByte*)((x)+3)) << 24))

Return a Int32 from the 4 bytes ordered in LSB order at address x.

#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.6.