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

📄 types.h

📁 开源GPS源码
💻 H
字号:
#ifndef _TYPES_H
#define _TYPES_H



#include <limits.h>                     /* ULONG_MAX UINT_MAX UCHAR_MAX */



#define TRUE  1
#define FALSE 0



#if defined(SUNOS)
#   define HOST_IS_BIG_ENDIAN TRUE
#else
#   define HOST_IS_BIG_ENDIAN FALSE
#endif



typedef unsigned char Bit8;
#define BIT8_MAX UCHAR_MAX
typedef char Signed8;
#define SIGNED8_MAX CHAR_MAX

typedef unsigned short Bit16;
#define BIT16_MAX USHRT_MAX
typedef short Signed16;
#define SIGNED16_MAX SHRT_MAX

#if __alpha
    typedef unsigned Bit32;
    typedef int Signed32;
    typedef unsigned long Bit64;
#   define BIT64_AVAILABLE TRUE
#   define BIT32_MAX UINT_MAX
#   define SIGNED32_MAX INT_MAX
#   define SIGNED32_MIN INT_MIN
#else
    typedef unsigned long Bit32;
    typedef long Signed32;
#   define BIT64_AVAILABLE FALSE
#   define BIT32_MAX ULONG_MAX
#   define SIGNED32_MAX LONG_MAX
#   define SIGNED32_MIN LONG_MIN

#   ifdef __cplusplus

#       define DWORD_SIZE    4294967296.0      /* 4G */
#       ifdef __BORLANDC__
            // must be called before any further arithmetic occurs!
            //
#           define ADD_HAD_CARRY(before,after)       (_FLAGS&1)
#           define SUBTRACT_HAD_BORROW(before,after) (_FLAGS&1)
#       else
            // safe to call at any time
            //
#           define ADD_HAD_CARRY(before,after)       (after<before)
#           define SUBTRACT_HAD_BORROW(before,after) (after>before)
#       endif

#endif
#endif

typedef struct
{
    Bit32 offset;
    Bit16 selector;
} Bit48;

/* pointer to a function that accepts
 * no arguments and returns nothing
 */
typedef void (*vfp)( void );

/* increment up to some limit, but no further
 */
#define saturated_inc(x,y) if((x)<(y)) (x)++
#define saturated_inc_bit8(x) saturated_inc(x,255)
#define saturated_dec(x) if((x)>0) (x)--

/* fold the halves of words (of various sizes) together
 */
#define fold_64_to_32(x) ((((x)>>32) ^ (x)) & 0xFFFFFFFF)
#define fold_32_to_16(x) ((((x)>>16) ^ (x)) & 0xFFFF)
#define fold_32_to_8(x) ((((x)>>24) ^ ((x)>>16) ^ ((x)>>8) ^ (x)) & 0xFF)

#ifdef __unix__
/* lets DOS programs, which try to specify to open()
 * whether CR-LF should be converted to/from LF,
 * compile under UNIX
 */
#define O_BINARY        0
#define O_TEXT          0

/* lets DOS programs, which try to print the textual
 * description of a C library error, compile and run
 * under UNIX
 */
#define _sys_errlist    sys_errlist
extern int sys_nerr;
extern char *sys_errlist[];

#define stricmp         strcasecmp
extern int      strcasecmp( /* const char *s1, const char *s2 */ );

/* lets DOS programs, which try to do special actions
 * when a key is pressed, compile and run under UNIX
 */
#include <unistd.h>                     /* STDIN_FILENO */
#ifdef __cplusplus
extern "C"
#endif
long dataready( int handle );
#define kbhit() dataready(STDIN_FILENO)
#endif

#endif      /* not included yet */

⌨️ 快捷键说明

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