📄 posixadapter.h
字号:
/*
* Copyright (C) 2005-2006 Funambol
* Author Patrick Ohly
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef INCL_AUTOTOOLS_ADAPTER
#define INCL_AUTOTOOLS_ADAPTER
/** @cond DEV */
/*
* POSIX environment, configured and compiled with automake/autoconf
*/
#include <config.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <stdio.h>
#include <time.h>
#include <stdarg.h>
#include <unistd.h>
// For ntoh functions
#include <netinet/in.h>
// Workaround for wchar defines below: unit testing may depend
// on standard header files. Include its header file first.
#include <base/test.h>
// Cygwin version of gcc does have these builtin
#ifndef __CYGWIN__
# define __declspec(x)
# define __cdecl
#endif
#define EXTRA_SECTION_00
#define EXTRA_SECTION_01
#define EXTRA_SECTION_02
#define EXTRA_SECTION_03
#define EXTRA_SECTION_04
#define EXTRA_SECTION_05
#define EXTRA_SECTION_06
#define BOOL int
#define TRUE 1
#define FALSE 0
// Enable the fix for encoding when building for posix
#define VOCL_ENCODING_FIX
#ifdef USE_WCHAR
#undef WCHAR
#include <wchar.h>
#include <wctype.h>
#define WCHAR wchar_t
#define WCHAR_PRINTF "s"
#define TEXT(_x) L##_x
// FIXME: remove this and adapt VOCL.
WCHAR *wcstok(WCHAR *s, const WCHAR *delim);
inline int _wtoi(const WCHAR *s) { return (int)wcstol(s, NULL, 10); }
#define _wcsicmp wcscasecmp
#define wcsicmp wcscasecmp
#define snwprintf swprintf
#else
/* map WCHAR and its functions back to standard functions */
# undef WCHAR
# define WCHAR char
# define WCHAR_PRINTF "s"
# define TEXT(_x) _x
# define SYNC4J_LINEBREAK "\n"
# define wsprintf sprintf
# define _wfopen fopen
# define wprintf printf
# define fwprintf fprintf
# define wsprintf sprintf
# define swprintf snprintf
# define snwprintf snprintf
# define wcscpy strcpy
# define wcsncpy strncpy
# define wcsncmp strncmp
# define wcslen strlen
# define wcstol strtol
# define wcstoul strtoul
# define wcsstr strstr
# define wcscmp strcmp
# define wcstok strtok
inline char towlower(char x) { return tolower(x); }
inline char towupper(char x) { return toupper(x); }
# define wmemmove memmove
# define wmemcpy memcpy
# define wmemcmp memcmp
# define wmemset memset
# define wcschr strchr
# define wcsrchr strrchr
# define wcscat strcat
# define wcsncat strncat
# define _wtoi atoi
# define wcstod strtod
# define wcsicmp strcasecmp
# define _wcsicmp strcasecmp
# define _stricmp strcasecmp
#endif
/* some of the code compares NULL against integers, which
fails if NULL is defined as (void *)0 */
#undef NULL
#define NULL 0
#define min(x,y) ( (x) < (y) ? (x) : (y) )
#define max(x,y) ( (x) > (y) ? (x) : (y) )
/** @endcond */
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -