⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cplport.h

📁 国际海图标准S-57格式数据读取源码VC
💻 H
字号:
#ifndef CPL_BASE_H_INCLUDED#define CPL_BASE_H_INCLUDED/** * \file cpl_port.h * * Core portability definitions for CPL. * *//* ==================================================================== *//*      We will use macos_pre10 to indicate compilation with MacOS      *//*      versions before MacOS X.                                        *//* ==================================================================== */#ifdef macintosh#  define macos_pre10#endif/* ==================================================================== *//*      We will use WIN32 as a standard windows define.                 *//* ==================================================================== */#if defined(_WIN32) && !defined(WIN32)#  define WIN32#endif#if defined(_WINDOWS) && !defined(WIN32)#  define WIN32#endif#include "CplConfig.h"/* ==================================================================== *//*      This will disable most WIN32 stuff in a Cygnus build which      *//*      defines unix to 1.                                              *//* ==================================================================== */#ifdef unix#  undef WIN32#endif#if defined(VSI_NEED_LARGEFILE64_SOURCE) && !defined(_LARGEFILE64_SOURCE)#  define _LARGEFILE64_SOURCE 1#endif/* ==================================================================== *//*      Standard include files.                                         *//* ==================================================================== */#include <stdio.h>#include <stdlib.h>#include <math.h>#include <stdarg.h>#include <string.h>#include <ctype.h>#include <errno.h>#include <time.h>#ifdef HAVE_LOCALE_H#  include <locale.h>#endif#ifdef _AIX#  include <strings.h>#endif#if defined(HAVE_LIBDBMALLOC) && defined(HAVE_DBMALLOC_H) && defined(DEBUG)#  define DBMALLOC#  include <dbmalloc.h>#endif#if !defined(DBMALLOC) && defined(HAVE_DMALLOC_H)#  define USE_DMALLOC#  include <dmalloc.h>#endif/* ==================================================================== *//*      Base portability stuff ... this stuff may need to be            *//*      modified for new platforms.                                     *//* ==================================================================== *//*--------------------------------------------------------------------- *        types for 16 and 32 bits integers, etc... *--------------------------------------------------------------------*/#if UINT_MAX == 65535typedef long            GInt32;typedef unsigned long   GUInt32;#elsetypedef int             GInt32;typedef unsigned int    GUInt32;#endiftypedef short           GInt16;typedef unsigned short  GUInt16;typedef unsigned char   GByte;typedef int             GBool;/* -------------------------------------------------------------------- *//*      64bit support                                                   *//* -------------------------------------------------------------------- */#if defined(WIN32) && defined(_MSC_VER)#define VSI_LARGE_API_SUPPORTEDtypedef __int64          GIntBig;typedef unsigned __int64 GUIntBig;#elif HAVE_LONG_LONGtypedef long long        GIntBig;typedef unsigned long long GUIntBig;#elsetypedef long             GIntBig;typedef unsigned long    GUIntBig;#endif/* ==================================================================== *//*      Other standard services.                                        *//* ==================================================================== */#ifdef __cplusplus#  define CPL_C_START           extern "C" {#  define CPL_C_END             }#else#  define CPL_C_START#  define CPL_C_END#endif#ifndef CPL_DLL#if defined(_MSC_VER) && !defined(CPL_DISABLE_DLL)#  define CPL_DLL     __declspec(dllexport)#else#  define CPL_DLL#endif#endif#ifndef NULL#  define NULL  0#endif#ifndef FALSE#  define FALSE 0#endif#ifndef TRUE#  define TRUE  1#endif#ifndef MAX#  define MIN(a,b)      ((a<b) ? a : b)#  define MAX(a,b)      ((a>b) ? a : b)#endif#ifndef ABS#  define ABS(x)        ((x<0) ? (-1*(x)) : x)#endif#ifndef EQUAL#ifdef WIN32#  define EQUALN(a,b,n)           (strnicmp(a,b,n)==0)#  define EQUAL(a,b)              (stricmp(a,b)==0)#else#  define EQUALN(a,b,n)           (strncasecmp(a,b,n)==0)#  define EQUAL(a,b)              (strcasecmp(a,b)==0)#endif#endif#ifdef macos_pre10int strcasecmp(char * str1, char * str2);int strncasecmp(char * str1, char * str2, int len);char * strdup (char *instr);#endif/*--------------------------------------------------------------------- *                         CPL_LSB and CPL_MSB * Only one of these 2 macros should be defined and specifies the byte  * ordering for the current platform.   * This should be defined in the Makefile, but if it is not then * the default is CPL_LSB (Intel ordering, LSB first). *--------------------------------------------------------------------*/#if defined(WORDS_BIGENDIAN) && !defined(CPL_MSB) && !defined(CPL_LSB)#  define CPL_MSB#endif#if ! ( defined(CPL_LSB) || defined(CPL_MSB) )#define CPL_LSB#endif#if defined(CPL_LSB)#  define CPL_IS_LSB 1#else#  define CPL_IS_LSB 0#endif/*--------------------------------------------------------------------- *        Little endian <==> big endian byte swap macros. *--------------------------------------------------------------------*/#define CPL_SWAP16(x) \        ((GUInt16)( \            (((GUInt16)(x) & 0x00ffU) << 8) | \            (((GUInt16)(x) & 0xff00U) >> 8) ))#define CPL_SWAP16PTR(x) \{                                                                 \    GByte       byTemp, *_pabyDataT = (GByte *) (x);              \                                                                  \    byTemp = _pabyDataT[0];                                       \    _pabyDataT[0] = _pabyDataT[1];                                \    _pabyDataT[1] = byTemp;                                       \}                                                                                                                                #define CPL_SWAP32(x) \        ((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) \{                                                                 \    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) \{                                                                 \    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;                                       \}                                                                                                                                /* Until we have a safe 64 bits integer data type defined, we'll replacem * this version of the CPL_SWAP64() macro with a less efficient one. *//*#define CPL_SWAP64(x) \        ((uint64)( \            (uint64)(((uint64)(x) & (uint64)0x00000000000000ffULL) << 56) | \            (uint64)(((uint64)(x) & (uint64)0x000000000000ff00ULL) << 40) | \            (uint64)(((uint64)(x) & (uint64)0x0000000000ff0000ULL) << 24) | \            (uint64)(((uint64)(x) & (uint64)0x00000000ff000000ULL) << 8) | \            (uint64)(((uint64)(x) & (uint64)0x000000ff00000000ULL) >> 8) | \            (uint64)(((uint64)(x) & (uint64)0x0000ff0000000000ULL) >> 24) | \            (uint64)(((uint64)(x) & (uint64)0x00ff000000000000ULL) >> 40) | \            (uint64)(((uint64)(x) & (uint64)0xff00000000000000ULL) >> 56) ))*/#define CPL_SWAPDOUBLE(p) CPL_SWAP64PTR(p)#ifdef CPL_MSB#  define CPL_MSBWORD16(x)      (x)#  define CPL_LSBWORD16(x)      CPL_SWAP16(x)#  define CPL_MSBWORD32(x)      (x)#  define CPL_LSBWORD32(x)      CPL_SWAP32(x)#  define CPL_MSBPTR16(x)       #  define CPL_LSBPTR16(x)       CPL_SWAP16PTR(x)#  define CPL_MSBPTR32(x)       #  define CPL_LSBPTR32(x)       CPL_SWAP32PTR(x)#  define CPL_MSBPTR64(x)       #  define CPL_LSBPTR64(x)       CPL_SWAP64PTR(x)#else#  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)#endif/*********************************************************************** * Define CPL_CVSID() macro.  It can be disabled during a build by * defining DISABLE_CPLID in the compiler options. * * The cvsid_aw() function is just there to prevent reports of cpl_cvsid() * being unused. */#ifndef DISABLE_CVSID#  define CPL_CVSID(string)     static char cpl_cvsid[] = string; \static char *cvsid_aw() { return( cvsid_aw() ? ((char *) NULL) : cpl_cvsid ); }#else#  define CPL_CVSID(string)#endif#endif /* ndef CPL_BASE_H_INCLUDED */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -