📄 cpl_port.h
字号:
/******************************************************************************
* $Id: cpl_port.h 11983 2007-08-28 17:35:15Z warmerdam $
*
* Project: CPL - Common Portability Library
* Author: Frank Warmerdam, warmerdam@pobox.com
* Purpose: Include file providing low level portability services for CPL.
* This should be the first include file for any CPL based code.
*
******************************************************************************
* Copyright (c) 1998, 2005, Frank Warmerdam <warmerdam@pobox.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
****************************************************************************/
#ifndef CPL_BASE_H_INCLUDED
#define CPL_BASE_H_INCLUDED
/* Remove annoying warnings Microsoft Visual C++ */
#if defined(_MSC_VER)
# pragma warning(disable:4251 4275 4786)
#endif
/**
* \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) && !defined(_WIN32_WCE)
# define WIN32
#endif
#if defined(_WINDOWS) && !defined(WIN32) && !defined(_WIN32_WCE)
# define WIN32
#endif
/* ==================================================================== */
/* We will use WIN32CE as a standard Windows CE (Mobile) define. */
/* ==================================================================== */
#if defined(_WIN32_WCE)
# define WIN32CE
#endif
/* -------------------------------------------------------------------- */
/* The following apparently allow you to use strcpy() and other */
/* functions judged "unsafe" by microsoft in VS 8 (2005). */
/* -------------------------------------------------------------------- */
#ifdef _MSC_VER
# ifndef _CRT_SECURE_NO_DEPRECATE
# define _CRT_SECURE_NO_DEPRECATE
# endif
# ifndef _CRT_NONSTDC_NO_DEPRECATE
# define _CRT_NONSTDC_NO_DEPRECATE
# endif
#endif
#include "cpl_config.h"
/* ==================================================================== */
/* This will disable most WIN32 stuff in a Cygnus build which */
/* defines unix to 1. */
/* ==================================================================== */
#ifdef unix
# undef WIN32
# undef WIN32CE
#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>
#if !defined(WIN32CE)
# include <time.h>
#else
# include <wce_time.h>
# include <wce_errno.h>
#endif
#if defined(HAVE_ERRNO_H)
# include <errno.h>
#endif
#ifdef HAVE_LOCALE_H
# include <locale.h>
#endif
#ifdef HAVE_DIRECT_H
# include <direct.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 == 65535
typedef long GInt32;
typedef unsigned long GUInt32;
#else
typedef int GInt32;
typedef unsigned int GUInt32;
#endif
typedef 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_SUPPORTED
typedef __int64 GIntBig;
typedef unsigned __int64 GUIntBig;
#elif HAVE_LONG_LONG
typedef long long GIntBig;
typedef unsigned long long GUIntBig;
#else
typedef 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
/* Should optional (normally private) interfaces be exported? */
#ifdef CPL_OPTIONAL_APIS
# define CPL_ODLL CPL_DLL
#else
# define CPL_ODLL
#endif
#ifndef CPL_STDCALL
#if defined(_MSC_VER) && !defined(CPL_DISABLE_STDCALL)
# define CPL_STDCALL __stdcall
#else
# define CPL_STDCALL
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -