code_app/base/HGDef.h

133 lines
2.6 KiB
C

#ifndef __HGDEF_H__
#define __HGDEF_H__
/****************************************************************************
* Platform Dependent Definitions and Typedefs *
****************************************************************************/
/* Microsoft C/C++ Compiler */
#if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) || defined (_WINDOWS)
#define HG_CMP_MSC
#if defined(_WIN64) || defined(WIN64)
#define HG_64BIT
#elif defined(_WIN32) || defined(WIN32)
#define HG_32BIT
#endif
/* Apple Compiler (which is GNU now) */
#elif defined(__APPLE__)
#define HG_CMP_XCODE
#define HG_64BIT
/* GNU C/C++ Compiler */
#elif defined(__GNUC__)
#define HG_CMP_GNU
#if defined(__alpha__) || defined(__ia64__) || defined(__ppc64__) || defined(__s390x__) || defined(__x86_64__)
#define HG_64BIT
#else
#define HG_32BIT
#endif
/* Unrecognized */
#else
#error Unrecognized compiler
#endif
#if defined(HG_CMP_MSC)
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#endif
/* type defines */
typedef char HGChar;
typedef unsigned char HGByte;
typedef short HGShort;
typedef unsigned short HGUShort;
typedef int HGInt;
typedef unsigned int HGUInt;
typedef long long HGLonglong;
typedef unsigned long long HGULonglong;
typedef void* HGPointer;
typedef HGInt HGBool;
typedef float HGFloat;
typedef double HGDouble;
#ifdef HG_64BIT
typedef HGLonglong HGSize;
typedef HGULonglong HGUSize;
#else
typedef HGInt HGSize;
typedef HGUInt HGUSize;
#endif
/* error code */
typedef HGUInt HGResult;
#define HGTRUE 1
#define HGFALSE 0
#ifndef HGMAX
#define HGMAX(a,b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef HGMIN
#define HGMIN(a,b) (((a) < (b)) ? (a) : (b))
#endif
#if defined(HG_CMP_MSC)
#ifdef __cplusplus
#define HGEXPORT extern "C"
#else
#define HGEXPORT
#endif /* __cplusplus */
#define HGAPI __stdcall
#define HGAPIV __cdecl
#else
#ifdef __cplusplus
#define HGEXPORT extern "C" __attribute ((visibility("default")))
#else
#define HGEXPORT __attribute ((visibility("default")))
#endif /* __cplusplus */
#define HGAPI
#define HGAPIV
#endif
#define HG_DECLARE_HANDLE(name) struct name##__{int unused;}; typedef struct name##__ *name
typedef struct
{
HGInt left;
HGInt top;
HGInt right;
HGInt bottom;
}HGRect;
typedef struct
{
HGFloat left;
HGFloat top;
HGFloat right;
HGFloat bottom;
}HGRectF;
typedef struct
{
HGInt x;
HGInt y;
}HGPoint;
typedef struct
{
HGFloat x;
HGFloat y;
}HGPointF;
#endif /* __HGDEF_H__ */