/*
*	Global type define
*
*	92.10.18.	Ogochan	V0.0 create & release
*/

#ifndef	_INCLUDE_TYPES_H
#define	_INCLUDE_TYPES_H

#include	<sys/types.h>

#ifndef	offsetof
#define	offsetof(t,m)	(size_t)(&(((t *)0)->m))
#endif

#ifndef	byte
#define	byte		unsigned char
#endif

#ifndef	word
#define	word		unsigned short
#endif

#ifndef	dword
#define	dword		unsigned long
#endif

#ifndef	uint
#define	uint	unsigned
#endif

#ifndef	ulong
#define	ulong	unsigned long
#endif

#ifndef	Bool
#undef	TRUE
#undef	FALSE
#define	Bool		int
#define	FALSE		0
#define	TRUE		(!FALSE)
#endif

#define	IntToBool(v)		((v)?TRUE:FALSE)
#define	BOOL(b)				((b) ? "TRUE" : "FALSE")

#define	CAST(type,val)		(*(type *)(&(val)))

#define	FLOAT		double
#define	FIXED		long
#define	INT			int

#define	GETA		(1<<12)

#define	ToFIXED(x)	((FIXED)((x)*GETA))
#define	ToFLOAT(x)	(((FLOAT)(x))/GETA)
#define	ToByte(x)	((byte)((x)/GETA))

#ifndef	SEEK_SET
#define	SEEK_SET		0
#define	SEEK_CUR		1
#define	SEEK_END		2
#endif

#ifdef	__GNUC__
#define	far				/*	*/
#else
#define	inline			/*	*/
#endif

#ifdef	MSDOS
#define	ALIGN_BYTES		1
#else
#define	ALIGN_BYTES		4
#endif

#define	ROUND_ALIGN(p)	\
	((((p)%ALIGN_BYTES) == 0) ? (p) : (((p)/ALIGN_BYTES)+1)*ALIGN_BYTES)

#endif

