/****************************************************************************************


		MCBasicTypes.h

		Copyright: (c) 2001 Eovia Corp. All rights reserved.

		Author:	Ian
		Date:	12/11/97

		Revision History

		when		who			what & why
		==========	==========	======================================================	 
		4/6/99		Ian			Added ResFileRef, used to describe a resource file, even
								after it has been closed.
		10/5/98		dsm			changed IDType into a class
		9/28/98		MAZ			removed double declare of boolean - didn't compile on mac
		9/15/98		tsh			conditional TMCRGBCOLOR on C++ compiler
		9/14/98		cph/tsh		moved TMCRGBColor here from MCBasicTypes.h
		7/9/98		Ian			Removed MCOSConfig.h, replaced MAC test with __MWERKS__,
								type definitions are compiler dependent, not OS dependent.
		7/08/98		cph			Added include of MCOSConfig.h for now
		6/25/98		scooper		Add 64 bits typdefs for Mac.
		6/2/98		Ian			Made ResourceID a int16.
		4/16/98		psq			Removed HRESULT
		4/3/98		pbk			Included more types as per lcoopet suggestions
		3/15/98		Ian			Made MCErr uint32.

*****************************************************************************************/

#ifndef __MCBasicTypes__		 
#define __MCBasicTypes__		 

#include "MCCompiler.h"
#include <stddef.h>
#ifdef _MAC
#include <stdint.h> // uintptr_t is defined there
#endif

typedef char					int8;
typedef unsigned char			uint8;
typedef short					int16;
typedef unsigned short			uint16;

#if defined WIN32 
typedef long					int32;
typedef unsigned long		uint32;
#elif defined __MWERKS__ || __GNUC__

typedef int						int32;
typedef unsigned int			uint32;
#else
#error "Not handled"
#endif

typedef void*					voidp;
typedef char* 					pointer;
typedef unsigned char*			upointer;
typedef uint8 					byte;
typedef uint8 					boolean;
typedef double 					lreal;
typedef uintptr_t				uintpointer;
typedef ptrdiff_t				pointerdiff;

typedef const signed char		cint8;
typedef const unsigned char		cuint8;
typedef const signed short		cint16;
typedef const unsigned short	cuint16;
typedef const signed int		cint32;
typedef const unsigned int		cuint32;

typedef float					real32;
typedef double					real64;
typedef real32					real;

/* libas types */
typedef const char				cchar;
typedef unsigned char			uchar;
typedef const unsigned char		cuchar;

typedef const short				cshort;
typedef unsigned short			ushort;
typedef const unsigned short	cushort;

typedef const int				cint;
typedef unsigned int			uint;
typedef const unsigned int		cuint;

typedef const long				clong;
typedef unsigned long			ulong;
typedef const unsigned long		culong;

typedef const float				cfloat;
typedef const float				cdouble;
typedef const void				*cvoidp;

typedef uint32					FourCharT;			//ie, 'TEXT'
typedef int32					MCErr;
typedef int32					ActionNumber;
typedef int16					ResourceID;
typedef uint32					ResFileRef;			//Unique identifier for a resource file that
													//has been opened.

typedef FourCharT				IDType;

//Four letter long for non Mac Compilers
#ifndef IDTYPE
#define IDTYPE(x,y,z,t) ((int32)((((int32)x)<<24)|(((int32)y)<<16)|(((int32)z)<<8)|((int32)t)))
#endif


const uint32 kUInt32Minus1 = (uint32)-1;			//to avoid gcc warnings


/* int64 */
#if (_MIPS_SZLONG == 64)
typedef signed long					int64;
typedef const signed long			cint64;
typedef unsigned long				uint64;
typedef const unsigned long			cuint64;
#elif (_MIPS_SZLONG == 32)
typedef signed long long			int64;
typedef const signed long long		cint64;
typedef unsigned long long			uint64;
typedef const unsigned long long	cuint64;
#elif defined WIN32 
typedef signed __int64				int64;
typedef const signed __int64		cint64;
typedef unsigned __int64			uint64;
typedef const unsigned __int64		cuint64;
#elif defined __MWERKS__ || __GNUC__
typedef signed long long			int64;
typedef const signed long long		cint64;
typedef unsigned long long			uint64;
typedef const unsigned long long	cuint64;
#endif

#if MAC
#ifdef __x86_64
#include <Carbon/Carbon.h>
typedef FSIORefNum                  CFileHandleType;
#else
typedef short                       CFileHandleType;
#endif
#else
typedef void*						CFileHandleType;
#endif // MAC

#endif
