GDAL
Classes | Macros | Typedefs
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>
#include <strings.h>

Go to the source code of this file.

Classes

struct  CPLStaticAssert< b >
 
struct  CPLStaticAssert< true >
 

Macros

#define CPL_RECODE_ICONV
 
#define CPL_RECODE_STUB
 
#define CPL_GBOOL_DEFINED
 
#define GINTBIG_MIN   ((GIntBig)(0x80000000) << 32)
 
#define GINTBIG_MAX   (((GIntBig)(0x7FFFFFFF) << 32) | 0xFFFFFFFFU)
 
#define GUINTBIG_MAX   (((GUIntBig)(0xFFFFFFFFU) << 32) | 0xFFFFFFFFU)
 
#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_INT64_FITS_ON_INT32(x)   (((GIntBig)(int)(x)) == (x))
 
#define CPL_C_START   extern "C" {
 
#define CPL_C_END   }
 
#define CPL_ODLL
 
#define FORCE_CDECL
 
#define CPL_INLINE
 
#define NULL   0
 
#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 M_PI   3.14159265358979323846
 
#define CPLIsEqual(x, y)   (fabs((x) - (y)) < 0.0000000000001)
 
#define STRCASECMP(a, b)    (strcasecmp(a,b))
 
#define STRNCASECMP(a, b, n)    (strncasecmp(a,b,n))
 
#define EQUALN(a, b, n)    (STRNCASECMP(a,b,n)==0)
 
#define EQUAL(a, b)    (STRCASECMP(a,b)==0)
 
#define STARTS_WITH(a, b)    (strncmp(a,b,strlen(b)) == 0)
 
#define STARTS_WITH_CI(a, b)    EQUALN(a,b,strlen(b))
 
#define CPL_THREADLOCAL
 
#define CPLIsNan(x)   isnan(x)
 
#define CPLIsInf(x)    (0)
 
#define CPLIsFinite(x)   (!isnan(x))
 
#define CPL_LSB
 
#define CPL_IS_LSB   1
 
#define CPL_STATIC_ASSERT(x)   CPLStaticAssert<x>::my_function()
 
#define CPL_STATIC_ASSERT_IF_AVAILABLE(x)   CPL_STATIC_ASSERT(x)
 
#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)    CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 2)
 
#define CPL_MSBPTR16(x)    CPL_SWAP16PTR(x)
 
#define CPL_LSBPTR32(x)    CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 4)
 
#define CPL_MSBPTR32(x)    CPL_SWAP32PTR(x)
 
#define CPL_LSBPTR64(x)    CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 8)
 
#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. More...
 
#define CPL_LSBSINT16PTR(x)   ((GInt16) CPL_LSBINT16PTR(x))
 Return a signed Int16 from the 2 bytes ordered in LSB order at address x.
 
#define CPL_LSBUINT16PTR(x)   ((GUInt16)CPL_LSBINT16PTR(x))
 Return a unsigned Int16 from the 2 bytes ordered in LSB order at address x.
 
#define CPL_LSBSINT32PTR(x)   ((GInt32) CPL_LSBINT32PTR(x))
 Return a signed Int32 from the 4 bytes ordered in LSB order at address x.
 
#define CPL_LSBUINT32PTR(x)   ((GUInt32)CPL_LSBINT32PTR(x))
 Return a unsigned Int32 from the 4 bytes ordered in LSB order at address x.
 
#define UNREFERENCED_PARAM(param)   ((void)param)
 
#define CPL_CVSID(string)
 
#define CPL_NULL_TERMINATED
 
#define CPL_PRINT_FUNC_FORMAT(format_idx, arg_idx)
 
#define CPL_SCAN_FUNC_FORMAT(format_idx, arg_idx)
 
#define CPL_WARN_UNUSED_RESULT
 
#define CPL_UNUSED
 
#define CPL_NO_RETURN
 
#define __has_attribute(x)   0
 
#define CPL_RETURNS_NONNULL
 
#define CPL_RESTRICT
 
#define CPL_FINAL
 
#define CPL_DISALLOW_COPY_ASSIGN(ClassName)
 
#define CPL_CPU_REQUIRES_ALIGNED_ACCESS
 
#define CPL_IS_DOUBLE_A_INT(d)   ( (d) >= INT_MIN && (d) <= INT_MAX && (double)(int)(d) == (d) )
 
#define CPL_ARRAYSIZE(array)
 
#define CPL_FALLTHROUGH
 
#define FALSE   0
 
#define TRUE   1
 
#define EMULATED_BOOL   bool
 
#define VOLATILE_BOOL   volatile bool
 

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
 
typedef GIntBig GPtrDiff_t
 

Detailed Description

Core portability definitions for CPL.

Macro Definition Documentation

#define CPL_ARRAYSIZE (   array)
Value:
((sizeof(array) / sizeof(*(array))) / \
static_cast<size_t>(!(sizeof(array) % sizeof(*(array)))))
#define CPL_CVSID (   string)
Value:
static const char cpl_cvsid[] = string; \
static const char *cvsid_aw() { return( cvsid_aw() ? NULL : cpl_cvsid ); }
#define CPL_DISALLOW_COPY_ASSIGN (   ClassName)
Value:
ClassName( const ClassName & ); \
ClassName &operator=( const ClassName & );
#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); \
CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 2); \
\
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); \
CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 4); \
\
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); \
CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) == 8); \
\
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 doxygen 1.8.11.