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

📄 host.h

📁 realview22.rar
💻 H
📖 第 1 页 / 共 2 页
字号:
typedef unsigned char unsigned8;
/*
 * HGB 22-July-97 - signedxx synomyms for intxx
 */
typedef int32 signed32;
typedef int16 signed16;
typedef int8 signed8;


#define YES   true
#define NO    false
#undef TRUE                     /* some OSF headers define as 1         */
#undef FALSE                    /* some OSF headers define as 0         */
#ifdef __cplusplus
   /* tragically, in C++ 'true' (a keyword) doesn't do the right thing in #if */
  #define TRUE  1
  #define FALSE 0 /* 'false' would work but we use '0' for symmetry (and 'false' might get warnings) */
#else
  #define TRUE  true
  #define FALSE false
#endif

/* 'uint' conflicts with some Unixen sys/types.h, so we now don't define it */
typedef unsigned8 uint8;
typedef unsigned16 uint16;
typedef unsigned32 uint32;

typedef unsigned Uint;
typedef unsigned8 Uint8;
typedef unsigned16 Uint16;
typedef unsigned32 Uint32;

#ifdef ALPHA_TASO_SHORT_ON_OSF  /* was __alpha && __osf.                */
/* The following sets ArgvType for 64-bit pointers so that              */
/* DEC Unix (OSF) cc can be used with the -xtaso_short compiler option  */
/* to force pointers to be 32-bit.  Not currently used since most/all   */
/* ARM tools accept 32 or 64 bit pointers transparently.  See IPtr.     */
#pragma pointer_size (save)
#pragma pointer_size (long)
    typedef char *ArgvType;
#pragma pointer_size (restore)
#else
    typedef char *ArgvType;
#endif

/*
 * Rotate macros
 */
#define ROL_32(val, n) \
((((unsigned32)(val) << (n)) | ((unsigned32)(val) >> (32-(n)))) & 0xFFFFFFFFL)
#define ROR_32(val, n) \
((((unsigned32)(val) >> (n)) | ((unsigned32)(val) << (32-(n)))) & 0xFFFFFFFFL)

/* For many hosts, this can be defined as just ((int32)val)>>(n) */
#define signed_rightshift_(val, n) \
((int32)(val)>=0 ? (val)>>(n) : ~((~(val))>>(n)))

/* The following two lines are a safety play against using ncc with a   */
/* vendor supplied library, many of which refuse to accept "wb".  POSIX */
/* and other unix standards require "wb" and "w" to have the same       */
/* effect and so the following is safe.                                 */
#ifdef COMPILING_ON_UNIX
#define FOPEN_WB     "w"
#define FOPEN_RB     "r"
#define FOPEN_RWB    "r+"
#if !defined(__STDC__) && !defined(__cplusplus)  /* caveat RISCiX... */
#define remove(file) unlink(file)
#endif
#else
#define FOPEN_WB     "wb"
#define FOPEN_RB     "rb"
#define FOPEN_RWB    "rb+"
#endif

#ifdef COMPILING_ON_HPUX
/* HPUX defines FILENAME_MAX as 14 !!! */
#include <stdio.h>
#undef FILENAME_MAX
#define FILENAME_MAX 256
#endif

#ifndef FILENAME_MAX
#define FILENAME_MAX 256
#endif

#ifdef COMPILING_ON_SUNOS
    typedef int sig_atomic_t;
/* Use bcopy rather than memmove, as memmove is not available.     */
/* There does not seem to be a header for bcopy.                   */
    void bcopy(const char *src, char *dst, int length);
#define memmove(d,s,l) bcopy((char const *)s,(char *)d,l)

/* BSD/SUN don't have strtoul() */
#define strtoul(s, ptr, base) strtol(s, ptr, base)

/* strtod is present in the C-library but is not in stdlib.h       */
    extern double strtod(const char *str, char **ptr);

/* This isn't provided by SunOS */
    extern char *strerror(int /*errnum */ );

/*
 * not all C libraries define tolower() and toupper() over all character
 * values. BSD Unix, for example, defines tolower() only over UC chars.
 */
#define safe_tolower(ch)      (isupper(ch) ? tolower(ch) : ch)
#define safe_toupper(ch)      (islower(ch) ? toupper(ch) : ch)
#else                           /* ! COMPILING_ON_SUNOS */
#define safe_tolower(ch)      tolower(ch)  /* see comment below */
#define safe_toupper(ch)      toupper(ch)  /* see comment below */
#endif                          /* ! COMPILING_ON_SUNOS */

#ifdef __CC_NORCROFT
#ifndef COMPILING_ON_UNIX       /* suppress if maybe non-norcroft lib */
#define LIBRARY_IS_NORCROFT 1
#endif
#ifdef LIBRARY_IS_ALIEN         /* unify with the 3 previous lines?   */
#undef LIBRARY_IS_NORCROFT
#endif
#endif

#ifdef LIBRARY_IS_NORCROFT
/*
 * Calls to all non-ansi functions are removable by macros here.
 */
#ifdef __cplusplus
    extern "C"
    {
#endif
/* These routines have no floating point abilities.                     */
/* one of these is used by clx/disass.c it doesn't really seem worth the trouble */
        extern int _vfprintf(FILE * stream, const char *format, __va_list arg);
        extern int _vsprintf(char *s, const char *format, __va_list arg);
        extern int _fprintf(FILE * stream, const char *format,...);
        extern int _sprintf(char *s, const char *format,...);
#ifdef __cplusplus
    }
#endif
#else                           /* LIBRARY_IS_NORCROFT */
#define _vfprintf vfprintf
#define _vsprintf vsprintf
#define _fprintf fprintf
#define _sprintf sprintf
#endif                          /* LIBRARY_IS_NORCROFT */

#ifdef COMPILING_ON_MVS

#define HOST_USES_CCOM_INTERFACE 1
#define EXIT_warn                4
#define EXIT_error               8
#define EXIT_fatal              12
#define EXIT_syserr             16

#else                           /* ! COMPILING_ON_MVS */

#define EXIT_warn                0
#define EXIT_error               1
#define EXIT_fatal               1

#ifdef  COMPILING_ON_UNIX
#define EXIT_syserr            100
#else
#define EXIT_syserr            1
#endif

#endif                          /* ! COMPILING_ON_MVS */

/* For systems that do not define EXIT_SUCCESS and EXIT_FAILURE */
#ifndef EXIT_SUCCESS
#define EXIT_SUCCESS           0
#endif
#ifndef EXIT_FAILURE
#define EXIT_FAILURE           EXIT_error
#endif

#ifdef COMPILING_ON_MPW
#include <CursorCtl.h>
#define UPDATE_PROGRESS()     SpinCursor(1)
#endif

#ifndef UPDATE_PROGRESS
#define UPDATE_PROGRESS() ((void)0)
#endif

#if defined(__STDC__) || defined(__cplusplus)
#define UNUSEDARG(X) ((void)(X)) /* Silence compiler warnings for unused arguments */
#else
#define UNUSEDARG(X) ((X) = (X))
#endif

#ifndef IGNORE 
#define IGNORE(x)  (UNUSEDARG(x))
#endif

/* Define endian-ness of host */

#if defined(__sparc) || defined(macintosh) || defined(__hppa)
#define HOST_ENDIAN_BIG
#elif defined(__acorn) || defined(__mvs) || defined(_WIN32) || \
  (defined(__alpha) && defined(__osf__)) || defined(__i386)
#define HOST_ENDIAN_LITTLE
#else
#define HOST_ENDIAN_UNKNOWN
#endif

/* Set INLINE to the correct inlining rules, if supported by the host */

#ifdef __cplusplus
  #define INLINE inline
#elif defined (__GNUC__)
  #define INLINE __inline__
#elif defined (COMPILING_ON_WINDOWS) && !defined(_WINDU_SOURCE)
  #define INLINE __inline
#elif defined (COMPILING_ON_SEMI)
  #define INLINE __inline
#else
  #define INLINE
#endif

#ifdef __cplusplus
  #if defined(__CC_ARM)
    #if defined(__EDG__)
      #define HAS_NAMESPACES 1
      #define USE_STD_NAMESPACE 1
      /* Record if this compiler allows overloading of ptrs to "C" function vs
         ptrs to "C++" functions, e.g.
            extern "C" { typedef void CFN(); }
            void f(CFN*); // ptr to "C" function
            void f(void (*)()); // ptr to "C++" function

         If so we also need to know if casting between the two kinds of
         pointer will work, e.g.
            inline void f(CFN* cfn) { f((void (*)())cfn); }
         EDG allows this as an old-style cast but not as a static_cast.
       */
      #define CAN_OVERLOAD_C_CPP_FN_PTRS 1
      #define CAN_CONVERT_C_CPP_FN_PTRS 1
    #else
      #define HAS_NAMESPACES 0
      #define USE_STD_NAMESPACE 0
      #define CAN_OVERLOAD_C_CPP_FN_PTRS 0
      #define CAN_CONVERT_C_CPP_FN_PTRS 0
    #endif
  #elif defined(__HP_aCC)
      /* HP aCC seems to support namespaces but it's version of the RW library doesn't
       * place the names there
       */
      #define HAS_NAMESPACES 1
      #define USE_STD_NAMESPACE 0
      #define CAN_OVERLOAD_C_CPP_FN_PTRS 0
      #define CAN_CONVERT_C_CPP_FN_PTRS 0
  #elif defined(__SUNPRO_CC) && __SUNPRO_CC <= 0x420 /* SparcWorks C++ 4.2 doesn't use 'std' */
      #define HAS_NAMESPACES 0
      #define USE_STD_NAMESPACE 0
      #define CAN_OVERLOAD_C_CPP_FN_PTRS 0
      #define CAN_CONVERT_C_CPP_FN_PTRS 0
  #else /* including g++, VC++ and Sparcworks (> 4.2) */
      /* Assume standard conformance about namespaces.
       * g++ 2.95.3 seems to silently treat things like 'std::foo' as '::foo'
       * and sliently ignores 'using namespace std;' and 'using std::foo;'
       * so, for g++ 2.95.3, we could set USE_STD_NAMESPACE either way.
       */
      #define HAS_NAMESPACES 1
      #define USE_STD_NAMESPACE 1
      /* Nobody except EDG seems to allow overloading ptrs to "C" functions vs
       * pointers to "C++" functions.
       */
      #define CAN_OVERLOAD_C_CPP_FN_PTRS 0
      #define CAN_CONVERT_C_CPP_FN_PTRS 0
  #endif

  /* In some cases, we do not want that STD is automatically 
   * defined.
   */
  #ifndef DO_NOT_REDEFINE_STD
    #if USE_STD_NAMESPACE
      #define STD std
    #else
      #define STD /*nothing*/
    #endif
  #endif
#endif


/*
 * 990506 KWelton
 *
 * We now have native int64 on all platforms - use it
 */
#if defined(__CC_ARM)
/*
 * long long is not available with -strict,
 * (and neither are long long constants).
 */
    typedef __int64 int64;
    typedef unsigned __int64 uint64;

#elif defined(COMPILING_ON_UNIX)
/*
 * Solaris  (EGCS), HP/UX, and ARM compilers
 */
/*__extension__*/ typedef long long int64;
/*__extension__*/ typedef unsigned long long uint64;
#elif defined(COMPILING_ON_WINDOWS)
/*
 * Windoze
 */
    typedef __int64 int64;
#ifndef __LCLINT__
    typedef unsigned __int64 uint64;
#else
    typedef __int64 uint64;
#endif

#else                           /* none of the above */
/*
 *  winDU build system - doesn't use "int64"
 */
#endif

#if defined(COMPILING_ON_UNIX) || defined(COMPILING_ON_SEMI)
  #define INT64PRId "lld"         /* like C99 PRId64 */
  #define INT64PRIu "llu"         /* like C99 PRIu64 */
  #define INT64PRIx "llx"         /* like C99 PRIx64 */

  #define CLX_INT64_C(x)  (x ## ll) /* like C99 INT64_C */
  #define CLX_UINT64_C(x) (x ## ull) /* like C99 UINT64_C */
#elif defined(COMPILING_ON_WIN32)
  #define INT64PRId "I64d"        /* like C99 PRId64 */
  #define INT64PRIu "I64u"        /* like C99 PRIu64 */
  #define INT64PRIx "I64x"        /* like C99 PRIx64 */

  #define CLX_INT64_C(x)  (x ## i64) /* like C99 INT64_C */
  #define CLX_UINT64_C(x) (x ## ui64) /* like C99 UINT64_C */
#else
  #error "platform not supported"
#endif

#define CLX_INT64_MAX    CLX_INT64_C(9223372036854775807) /* like C99 INT64_MAX */
#define CLX_UINT64_MAX CLX_UINT64_C(18446744073709551615) /* like C99 UINT64_MAX */

void int64tos(char *str, int64 number);
void uint64tos(char *str, uint64 number);

/* Allow functions to be exported from DLLs without .def files. */
#ifndef CLX_EXPORTED
#ifdef COMPILING_ON_WINDOWS
# define CLX_EXPORTED __declspec(dllexport)
#else
# define CLX_EXPORTED
#endif
#endif

#if defined(__cplusplus) && !defined(CLX_CPP_LINKAGE)
} /* extern C */
#endif

#ifndef EXTERN_C
  #ifdef __cplusplus
   #define EXTERN_C extern "C"
  #else
   #define EXTERN_C extern
  #endif
#endif

#endif                          /* ndef DO_NOT_INCLUDE_HOST_H */

#endif                          /* host_h */

/* end of host.h */

⌨️ 快捷键说明

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