//	utf-8

/*	Copyright  (c)	Günter Woigk   1994-2002
  					mailto:kio@little-bat.de

	This file is free software

 	This program is distributed in the hope that it will be useful,
 	but WITHOUT ANY WARRANTY; without even the implied warranty of
 	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  

 	Permission to use, copy, modify, distribute, and sell this software and
 	its documentation for any purpose is hereby granted without fee, provided
 	that the above copyright notice appear in all copies and that both that
 	copyright notice and this permission notice appear in supporting
 	documentation, and that the name of the copyright holder not be used
 	in advertising or publicity pertaining to distribution of the software
 	without specific, written prior permission. The copyright holder makes no
 	representations about the suitability of this software for any purpose.
 	It is provided "as is" without express or implied warranty.

 	THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 	INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
 	EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
 	CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
 	DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
 	TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 	PERFORMANCE OF THIS SOFTWARE.

	Kio's universal standard header.
*/

#ifndef	_kio_h_
#define	_kio_h_


#define	myName					"Günter Woigk"
#define	myAddress				"Sankt Johann 6/246, 91056 Erlangen, Germany"
#define	myEmail					"kio@little-bat.de"
#define	myHomepage				"little-bat.de"



/* ----	include "config.h" ----------------------------------------
		on unix systems  "config.h" should be generated from "configure.in" 
		using autoconf and should not be part of the cvs repository.
		
		on other systems put this file into the platform specific subfolder
		and edit this file directly. this platform specific variant should 
		go into the cvs.
*/
#include "config.h"



/* ----	determine platform ----------------------------------------

		platform identifier:
		guarantee that platform is detected.
		_UNIX, _WINDOWS, _BEOS, _MACINTOSH      undefined or 1

		sub platform identifier:
		guarantee that sub platform is detected.
		_LINUX, _BSD, _MINIX					undefined or 1

		vendor identifier:
		not guaranteed that a vendor is detected.
		_FREEBSD, _OPENBSD, _NETBSD, _MACOSX	undefined or 1 ((or version number))
		_SUSE, _DEBIAN, _REDHAT, _YELLOWDOG		undefined or 1 ((or version number))
*/
#if !defined(_UNIX) && !defined(_WINDOWS) && !defined(_BEOS) && !defined(_MACINTOSH)
	#error platform not #defined in "config.h"!
#endif

#if defined(_UNIX) && !defined(_LINUX) && !defined(_BSD) && !defined(_MINIX) && !defined(_SOLARIS)
	#error UNIX sub platform not #defined in "config.h"!
#endif

#if defined(_BSD) && !defined(_FREEBSD) && !defined(_OPENBSD) && !defined(_NETBSD) && !defined(_MACOSX)
//	#error BSD sub platform not #defined in "config.h"!
#endif

#if defined(_LINUX) && !defined(_SUSE) && !defined(_DEBIAN) && !defined(_REDHAT) && !defined(_YELLOWDOG)
//	#error LINUX sub platform not #defined in "config.h"!
#endif



/* ----	determine compiler ----------------------------------
		guarantee that compiler is detected.
		_METROWERKS, _GCC, _MPW
*/
#if !defined(_METROWERKS) && !defined(_GCC) && !defined(_MPW)
	#if defined(_MPW_C) || defined(_MPW_CPLUS)
		#define _MPW			1
		
	#elif defined(_MACINTOSH)
		#define	_METROWERKS 	1

	#elif defined(__GNUC__) || defined(__GNUG__)
		#define _GCC			1
	
	#else
		#error "can't determine compiler"
	#endif
#endif



/* ----	determine processor -----------------------------------
		guarantee that processor is detected.
		_POWERPC, _M68K, _I386, _ALPHA, _SPARC, _I386x64
*/
#if !( defined(_POWERPC) || defined(_M68K) || defined(_I386) || defined(_ALPHA) || defined(_SPARC) || defined(_I386x64) )
	#if defined(__i386__)
		#define	_I386		1
	
	#elif defined(__ppc__) || defined(__PPC__) || defined(__powerpc__)
		#define	_POWERPC	1
	
	#elif defined(__alpha__)
		#define	_ALPHA		1
	
	#elif defined(__sparc__)
		#define	_SPARC		1
	
	#else
		#error "can't determine processor"
	#endif
#endif



/* ----	basic system headers -----------------------
*/
#if HAVE_STDLIB_H
#include <stdlib.h>
#endif
#if HAVE_ERRNO_H
#include <errno.h>
#endif
#if HAVE_STDARG_H
#include <stdarg.h>
#endif
#if HAVE_STDIO_H
#include <stdio.h>
#endif
#if HAVE_STRING_H
#include <string.h>
#endif
#if HAVE_CTYPE_H
#include <ctype.h>
#endif
#if HAVE_ASSERT_H
#include <assert.h>
#endif
#if defined(_BSD)
#include <machine/endian.h>
#elif defined(_LINUX)
#include <endian.h>
#endif



/* ==== dependencies ==============================================
*/



/* ---- directory separator ------------------------
		guaranteed constant.
*/
#if defined(_MACINTOSH)
	const char		dirsep	=	':';
#elif defined(_WINDOWS)
	const char		dirsep	=	'\\';
#else
	const char		dirsep	=	'/';
#endif



/* ----	newline separator --------------------------
		guaranteed constant.
		note: *MAYBE* we'll support DOS a little better?
*/
#if defined(_MACINTOSH)
	const char		nl		=	13;
#else
	const char		nl		=	10;
#endif



/* ----	byte order ---------------------------------
		guarantee that byte order is detected.
		_BIG_ENDIAN  	e.g. M68k	dc.l '4321' = dc.b '4','3','2','1'	(ok.)
		_LITTLE_ENDIAN	e.g. i386	dc.l '4321' = dc.b '1','2','3','4'	(idiotic!)
		_PDP_ENDIAN  	e.g. PDP	dc.l '4321' = dc.b '3','4','1','2'	(even more brain dead!)
*/
#if !defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN) && !defined(_PDP_ENDIAN)
	#if defined(BYTE_ORDER)
		#if defined(BIG_ENDIAN) && BYTE_ORDER==BIG_ENDIAN
			#define			_BIG_ENDIAN		1		// dc.l '4321' = dc.b '4','3','2','1'	-> POWERPC, M68K, SPARC
		#elif defined(LITTLE_ENDIAN) && BYTE_ORDER==LITTLE_ENDIAN
			#define			_LITTLE_ENDIAN	1		// dc.l '4321' = dc.b '1','2','3','4'	-> I386, ALPHA
		#elif defined(PDP_ENDIAN) && BYTE_ORDER==PDP_ENDIAN
			#define			_PDP_ENDIAN		1		// dc.l '4321' = dc.b '3','4','1','2'	-> PDP
		#endif
	#endif
	#if !defined(_BIG_ENDIAN) && ( defined(_POWERPC) || defined(_M68K) || defined(_SPARC) )
		#define			_BIG_ENDIAN		1
	#endif
	#if !defined(_LITTLE_ENDIAN) && ( defined(_I386) || defined(_ALPHA) )
		#define			_LITTLE_ENDIAN	1
	#endif
	#if !defined(_PDP_ENDIAN) && defined(_PDP)
		#define			_PDP_ENDIAN		1
	#endif
#endif
#if !defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN) && !defined(_PDP_ENDIAN)
	#error "can't determine byte order"
#endif



/* ----	no_index -----------------------
		guaranteed macro.
		in structs and classes the last data member may be a variable length array.
		this is handled differently by different compilers:
		either you set the index to 0 or you leave it completely out.
*/
#if defined(_GCC)
	#define		no_index		0
#elif defined(_METROWERKS)
	#define		no_index		// ((empty))
#elif defined(_MPW)
	#error please set no_index to what is supported by MPW. thanks.
#else
	#error
#endif



/* ----	LOG and SAFE -----------------------------------
		guaranteed macros.
		each file should contain a #define for the LOG and SAFE level 
		before the first include. the LOG and SAFE level given there may be 
		overridden by global settings in "config.h".
*/
#ifdef GLOB_LOG
	#undef	LOG
	#define	LOG	GLOB_LOG
#else
	#ifndef LOG
	#define LOG 0
	#endif
#endif

#ifdef GLOB_SAFE
	#undef	SAFE
	#define	SAFE GLOB_SAFE
#else
	#ifndef SAFE
	#define SAFE 1
	#endif
#endif



/* ----	other standard headers ---------------------
*/
#include	"kio/standard_types.h"
#include	"kio/nice_defines.h"
#include	"cstrings/cstrings.h"
#include	"kio/abort.h"
#include	"kio/errors.h"
#include	"kio/log.h"
#include	"random/random.h"



#if defined(_MACINTOSH)
	#include	"macos_classic/kio headers/apple_glue.h"
	#include	"kio/atexit.h"

	#if USE_KIOS_MALLOC
	#include	"malloc/malloc.h"
	#endif

	extern int strcasecmp  ( cstr s1, cstr s2 );
	extern int strncasecmp ( cstr s1, cstr s2, int n );
#endif


#endif






