//	Zinc Application Framework - Z_ENV.HPP
//	COPYRIGHT (C) 1990-1999.  All Rights Reserved.
//	Zinc Software Incorporated.  Pleasant Grove, Utah  USA

#ifndef Z_ENV_HPP
#define Z_ENV_HPP

// ----- Version Information ------------------------------------------------

#define ZAF_VERSION		520
#define ZAF_REVISION	  1	

// ----- International Language Support -------------------------------------

// Only one (or neither) of the following should be defined.
//#define ZAF_UNICODE		// Support for UNICODE
#if !defined(ZAF_UNICODE)
#	define ZAF_ISO8859_1	// Support for ISO8859-1
#endif

// ----- Modularization -----------------------------------------------------
//#define USE_ZAF_RTTI // Uncomment this line to use ZAF's definition of RTTI
							  // instead of any built in support for RTTI.
// The following defines affect the autmatic initialization of global classes.
#define USE_ZAF_CODE_SET_DATA // Necessary for ZAF_UNICODE. Uncommenting this
										// initializes the ZafCodeSetData class and its 
										// helper classes (ZafCharLookup or ZafWcharLookup)
#define USE_ZAF_ERROR_SYSTEM // Uncommenting this initializes the ZafErrorSystem
									  // class.	
#define USE_ZAF_HELP_TIPS // Uncommenting this initializes the ZafHelpTips class.
#define USE_ZAF_KEYBOARD // Uncommenting this initializes the ZafKeyboard class.
#define USE_ZAF_MOUSE // Uncommenting this initializes the ZafMouse class.
#define USE_ZAF_PERSISTENCE // Uncommenting this initializes the 
									 // ZafDataPersistence and ZafObjectPersistence 
									 // classes.
#define USE_ZAF_SEARCH_PATH // Uncommenting this initializes the ZafPath class.

// ----- ZAF_ITEXT ----------------------------------------------------------

#if defined(ZAF_UNICODE)
#	define ZAF_ITEXT(x)	L ## x
#else
#	define ZAF_ITEXT(x)	x
#endif

// ----- Environment Information --------------------------------------------

//#define ZAF_INDEPENDENT	// Does not rely on native GUI.
#if !defined(ZAF_INDEPENDENT)
#	if defined(_WINDOWS) || (defined(_Windows) && !defined(DOS386)) || defined(WIN32) || defined(__WINDOWS__) || defined(__NT__)
#		include <w_env.hpp>
#	elif defined(__hpux) || defined(__sgi) || defined(sun) || defined(_SINIX) || defined(__DVX__) || (defined(__alpha) && !defined(WIN32)) || defined(_IBM_RS6000) || defined(__QNX__) || defined(SCO_UNIX) || defined(__linux__)
#		include <m_env.hpp>
#	elif defined(__OS2__) || defined(__GLOCKENSPIEL__)
#		include <o_env.hpp>
#	elif defined(macintosh)
#		include <a_env.hpp>
#	else
#		define ZAF_INDEPENDENT
#	endif
#endif
#if defined(ZAF_INDEPENDENT)
#	include <i_env.hpp>
#endif

// ----- ZafIChar -----------------------------------------------------------

#if defined(ZAF_UNICODE)
#	if defined(__MWERKS__)
		typedef unsigned short ZafIChar;
#	else
		typedef wchar_t ZafIChar;
#	endif
#else
	typedef char ZafIChar;
#endif

// ----- General Zinc Switches ----------------------------------------------

// Zinc persistence.
#define ZAF_READ			// Allow read operations
#define ZAF_WRITE			// Allow write operations

// International language.
//#define ZAF_DECOMPOSE		// Support to decompose compound Unicode
//#define ZAF_REARRANGEARGS	// Support for argument rearrangement in sprintf() and sscanf()
#define ZAF_DO_OS_I18N		// Do possibly broken OS I18n support

// ----- ZAF_NULLP, ZAF_NULLF, ZAF_NULLH ------------------------------------

#define ZAF_NULLP(type)		((type *)0)
#define ZAF_NULLF(type)		((type)0)
#define ZAF_NULLH(type)		((type)0)

// ----- Compiler/Hardware Typedef Sizes ------------------------------------

#if defined(ZAF_VXWORKS)
	typedef	int8_t		ZafInt8;
	typedef	uint8_t		ZafUInt8;
#elif defined(__DVX__) || defined(_IBM_RS6000) || defined(__QNX__) || \
	defined(__sgi) || defined(__WATCOMC__) || defined(__HIGHC__) || \
	defined(__CADUL__)
	typedef	signed char		ZafInt8;
	typedef	unsigned char	ZafUInt8;
#else
	typedef	char			ZafInt8;
	typedef	unsigned char	ZafUInt8;
#endif
#if (ZAF_WORD_SIZE == 16)
	typedef	short		   	ZafInt16;
	typedef	unsigned short	ZafUInt16;
	typedef	long			ZafInt32;
	typedef	unsigned long	ZafUInt32;
#elif (ZAF_WORD_SIZE == 32)
	typedef	short			ZafInt16;
	typedef	unsigned short	ZafUInt16;
	typedef	long			ZafInt32;
	typedef	unsigned long	ZafUInt32;
#elif (ZAF_WORD_SIZE == 64)
	typedef	short			ZafInt16;
	typedef	unsigned short	ZafUInt16;
	typedef	int				ZafInt32;
	typedef	unsigned int	ZafUInt32;
#else
	???? set your word size;
#endif

// ----- ZafFlags -----------------------------------------------------------

typedef ZafUInt16 ZafFlags;
typedef ZafUInt16 ZafStatus;

// --- Errors ---------------------------------------------------------------

typedef int ZafError;
const ZafError ZAF_ERROR_NONE 					= 0;	// No error
const ZafError ZAF_ERROR_INVALID 				= 1;	// Invalid value
const ZafError ZAF_ERROR_INVALID_NAME			= 2;	// Invalid name
const ZafError ZAF_ERROR_AMBIGUOUS				= 3;	// Ambiguous value
const ZafError ZAF_ERROR_VALUE_MISSING			= 4;	// Required value not present
const ZafError ZAF_ERROR_OUT_OF_RANGE			= 5;	// Value out of range
const ZafError ZAF_ERROR_LESS_THAN_RANGE		= 6;	// Value less than positively open-ended range
const ZafError ZAF_ERROR_GREATER_THAN_RANGE	= 7;	// Value greater than negatively open-ended range
const ZafError ZAF_ERROR_INVALID_ID				= 8;	// Invalid identifier
const ZafError ZAF_ERROR_INVALID_CLASS			= 9;	// Invalid class object
const ZafError ZAF_ERROR_INVALID_TARGET		= 10;	// Invalid target
const ZafError ZAF_ERROR_INVALID_SOURCE		= 11;	// Invalid source
const ZafError ZAF_ERROR_LEAVE_INVALID 		= 12;	// Leave the value invalid
const ZafError ZAF_ERROR_CONSTRUCTOR 			= 13;	// Constructor detected an error
const ZafError ZAF_ERROR_FILE_OPEN				= 14;	// File open error
const ZafError ZAF_ERROR_FILE_POSITION			= 15;	// File pointer positioning error
const ZafError ZAF_ERROR_FILE_READ				= 16;	// File read error (not because of eof)
const ZafError ZAF_ERROR_FILE_WRITE				= 17;	// File write error
const ZafError ZAF_ERROR_STORAGE_VERSION		= 18;	// Storage file is wrong version
const ZafError ZAF_ERROR_INVALID_INDEX			= 19;	// Invalid table index
const ZafError ZAF_ERROR_UNKNOWN					= 20;	// Unknown value or function
const ZafError ZAF_ERROR_LOW_MEMORY				= 21;	// Not enough memory to complete operation
const ZafError ZAF_ERROR_NOT_RESPONDING		= 22;	// I/O device not responding
const ZafError ZAF_ERROR_OUT_OF_PAPER			= 23;	// Output device out of paper
const ZafError ZAF_ERROR_OUTPUT_FAILED			= 24;	// Output device output failed
const ZafError ZAF_ERROR_UNAVAILABLE			= 25;	// Device or object unavailable

// ----- Miscellaneous ------------------------------------------------------

const int ZAF_DYNAMIC_ARRAY_INCREMENT			= 5;
const int ZAF_MAXPATHLEN						= 256; // Largest full path to a file.
const int ZAF_MAXNAMELEN						= 64;
const int ZAF_MAXENVLEN							= 1024; // Largest environment variable obtainable by getenv.

#if defined(ZAF_POSIX) && !defined(ZAF_DIR_SEP_CHAR)
#	define ZAF_DIR_SEP_CHAR        '/'
#endif
#if defined(ZAF_POSIX) && !defined(ZAF_DIR_SEP_STR)
#	define ZAF_DIR_SEP_STR         ZAF_ITEXT("/")
#endif

typedef ZafInt32 ZafEventType;
typedef unsigned int ZafRawCode;

typedef ZafInt16 ZafClassID;

typedef unsigned int ZafInfoRequest;

typedef ZafIChar ZafClassNameChar;
typedef const ZafIChar *ZafClassName;

typedef ZafIChar ZafStringIDChar;
typedef const ZafIChar *ZafStringID;

typedef ZafIChar ZafDataNameChar;
typedef const ZafIChar *ZafDataName;

#endif // Z_ENV_HPP

