//////////////////////////////////////////////////////////////////////
//
//                             Pixie
//
// Copyright © 1999 - 2003, Okan Arikan
//
// Contact: okan@cs.berkeley.edu
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
// 
// This library 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.  See the GNU
// General Public License for more details.
// 
// You should have received a copy of the GNU General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
//
//  File				:	global.h
//  Classes				:	-
//  Description			:	Some global definitions
//
////////////////////////////////////////////////////////////////////////


//
//
//
//
//
//
//		This header has to be included from every file
//
//
//
//
//
//
//
#ifndef GLOBAL_H
#define	GLOBAL_H

// The Pixie version
#define	VERSION_RELEASE	1
#define	VERSION_BETA	3
#define	VERSION_ALPHA	26

// Come constant definitions
// Math constants

#ifdef C_INFINITY
#undef C_INFINITY
#endif

#ifdef C_EPSILON
#undef C_EPSILON
#endif

#define	C_INFINITY							(float) 1e30
#define	C_EPSILON							(float) 1e-6
#define C_PI                                (float) 3.141592653589793238462643383279502884197169399375105820974944592308
#define C_DOUBLE_PI                         3.141592653589793238462643383279502884197169399375105820974944592308


// The most famous number
#ifndef PI
#ifdef M_PI
#define PI M_PI
#else
#define PI                                  (float) 3.141592653589793238462643383279502884197169399375105820974944592308
#endif
#endif

#ifndef DOUBLE_PI
#ifdef M_PIl
#define DOUBLE_PI M_PIl
#else
#define DOUBLE_PI                           3.141592653589793238462643383279502884197169399375105820974944592308
#endif
#endif



// Logic constants
#define	TRUE								1
#define	FALSE								0


// Misc Options and Attributes constants
#ifdef min
#undef min
#endif

#ifdef max
#undef max
#endif

#ifdef radians
#undef radians
#endif

#ifdef degrees
#undef degrees
#endif

#define			min(a,b)					((a) < (b) ? (a) : (b))
#define			max(a,b)					((a) > (b) ? (a) : (b))
#define			radians(a)					((a)*DOUBLE_PI/180.)
#define			degrees(a)					((a)*180./ DOUBLE_PI)

#define			getPointer(a)				(((unsigned long) a) & (~3))
#define			getData(a)					(((unsigned long) a) & 3)
#define			getToken(a,b)				(((unsigned long) a) | b)


// This structure encapsulates a 32 bit word
typedef union {
	int				integer;
	unsigned int	uinteger;
	float			real;
	char			character;
} T32;

// This class encapsulates a potentially 64 bit word (this is still 32 bits on 32 bit machines)
typedef union {
	long int		integer;
	void			*pointer;
	char			*string;
	float			real;
	double			dreal;
} T64;



#define USE_MEMORY_MANAGER

#include "memoryman.h"


#ifdef WIN32
#ifdef _DEBUG
#include <assert.h>
#endif
#endif

#ifndef assert
#define assert(__cond)
#endif


#endif
