145 lines
3.0 KiB
C
145 lines
3.0 KiB
C
/**
|
|
* @file: $RCSfile: platform.h,v $
|
|
* @brief: $为平台无关性而定义的基本数据等的定义
|
|
*
|
|
* @version: $Revision: 1.1 $
|
|
* @date: $Date: 2018/11/24 06:54:50 $
|
|
* @author: $Author: lizhongming $
|
|
* @state: $State: Exp $
|
|
*
|
|
* @latest: $Id: platform.h,v 1.1 2018/11/24 06:54:50 lizhongming Exp $
|
|
*/
|
|
|
|
#ifndef _PLATFORM_H
|
|
#define _PLATFORM_H
|
|
|
|
#ifdef __cplusplus
|
|
#define C_MODE_START extern "C" {
|
|
#define C_MODE_END }
|
|
#else
|
|
#define C_MODE_START
|
|
#define C_MODE_END
|
|
#endif
|
|
|
|
/*********************************************************************
|
|
* Linux & GCC platform dependencies
|
|
*/
|
|
#ifdef __GNUC__
|
|
|
|
#ifndef _OS_UNIX_
|
|
#define _OS_UNIX_
|
|
#endif
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <assert.h>
|
|
#include <unistd.h>
|
|
#include <arpa/inet.h>
|
|
#include <time.h>
|
|
#include <math.h>
|
|
#include <syslog.h>
|
|
|
|
#include <sys/types.h>
|
|
#include <sys/socket.h>
|
|
#ifndef USRDEFINEBAUD
|
|
#include <termios.h>
|
|
#include <sys/ioctl.h>
|
|
#endif
|
|
#include <net/if.h>
|
|
#include <netinet/in.h>
|
|
#include <net/if_arp.h>
|
|
|
|
typedef unsigned char byte_t;
|
|
typedef unsigned char uchar_t;
|
|
typedef unsigned short ushort_t;
|
|
typedef unsigned int uint_t;
|
|
typedef unsigned long ulong_t;
|
|
|
|
typedef float float32_t;
|
|
typedef double float64_t;
|
|
|
|
#define ALIGNPACKED __attribute__((packed))
|
|
|
|
#endif /* __GNUC__ */
|
|
/* Linux & GCC platform dependencies
|
|
*********************************************************************/
|
|
|
|
|
|
/*********************************************************************
|
|
* VS.NET 2003 platform dependencies
|
|
*/
|
|
#ifdef _MSC_VER
|
|
|
|
#ifndef _OS_WIN32_
|
|
#define _OS_WIN32_
|
|
#endif
|
|
|
|
#ifndef ACE_USED
|
|
#ifndef _AFX_ALL_WARNINGS
|
|
#include <windows.h>
|
|
#endif
|
|
#endif
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <assert.h>
|
|
#include <math.h>
|
|
#include <winsock.h>
|
|
|
|
/**
|
|
* Basic system type definitions, taken from the BSD file sys/types.h.
|
|
*/
|
|
typedef unsigned char uchar_t;
|
|
typedef unsigned short ushort_t;
|
|
typedef unsigned int uint_t;
|
|
typedef unsigned long ulong_t;
|
|
typedef unsigned char byte_t;
|
|
typedef unsigned int uint_t;
|
|
|
|
typedef char int8_t;
|
|
typedef unsigned char uint8_t;
|
|
typedef short int16_t;
|
|
typedef unsigned short uint16_t;
|
|
typedef int int32_t;
|
|
typedef unsigned int uint32_t;
|
|
typedef __int64 int64_t;
|
|
typedef unsigned __int64 uint64_t;
|
|
|
|
typedef float float32_t;
|
|
typedef double float64_t;
|
|
#define ALIGNPACKED
|
|
|
|
#endif /* _MSC_VER */
|
|
/* Win32 & VC++ 6.0 platform dependencies
|
|
*********************************************************************/
|
|
|
|
#ifndef LITTLE_ENDIAN
|
|
#define LITTLE_ENDIAN 1
|
|
#endif
|
|
|
|
#ifndef BIG_ENDIAN
|
|
#define BIG_ENDIAN 2
|
|
#endif
|
|
|
|
#ifndef BYTE_ORDER
|
|
#define BYTE_ORDER LITTLE_ENDIAN
|
|
#endif
|
|
|
|
#ifndef FALSE
|
|
#define FALSE ((char)0)
|
|
#endif
|
|
|
|
#ifndef TRUE
|
|
#define TRUE (!(FALSE))
|
|
#endif
|
|
|
|
#ifndef false
|
|
#define false ((char)0)
|
|
#endif
|
|
|
|
#ifndef true
|
|
#define true (!(false))
|
|
#endif
|
|
|
|
#endif /* _PLATFORM_H */
|