/*****************************************************************************
 * $Id: gfx_defs.hh,v 1.18 2006/10/31 01:54:02 devel Exp $
 * @file
 * @author	Jim E. Brooks  http://www.jimbrooks.org
 * @brief	Definitions, constants.
 *//*
 * LEGAL:	COPYRIGHT (C) 2004 JIM E. BROOKS
 *          THIS SOURCE CODE IS RELEASED UNDER THE TERMS
 *          OF THE GNU GENERAL PUBLIC LICENSE (GPL).
 *****************************************************************************/

#ifndef GFX_DEFS_HH
#define GFX_DEFS_HH 1

#include "gfx_os.hh"

namespace gfx {

////////////////////////////////////////////////////////////////////////////////
// Definitions, constants.
#undef  FALSE
#undef  TRUE
#define FALSE 0
#define TRUE  1
#define CHAR_LF	'\n'
#define CHAR_CR	'\r'
#define KILOBYTE (1024u)
#define MEGABYTE (1048576u)
#define GIGABYTE (1073741824u)

// DEBUG_FLAG is guaranteed to be 0 or 1 (DEBUG may be undefined,0,1,2).
#if DEBUG
#define DEBUG_FLAG 1
#else
#define DEBUG_FLAG 0
#endif

////////////////////////////////////////////////////////////////////////////////
// @def Numeric limits.
// *_LARGE are the largest positive values.
// *_SMALL are the smallest negative values.
// Defined by limits.h: INT_MIN, INT_MAX, UINT_MAX
// Defined by float.h: FLT_MAX, FLT_MIN
#define INT_SMALL (INT_MIN)
#define INT_LARGE (INT_MAX)
#define FLOAT_SMALL (-9999999999.0)		// FLOAT_SMALL is supposed to be negative
#define FLOAT_LARGE ( 9999999999.0)		// so it cannot be based on FLT_MIN which is zero.

/// @def ILLEGAL_PTR
/// ILLEGAL_PTR is a non-zero value for initializing/asserting pointers
/// that normally can hold either a non-NULL or NULL address.
#define ILLEGAL_PTR ((void*)13) // an unlucky address in the faulty zero page

////////////////////////////////////////////////////////////////////////////////
// enums
enum { XX, YY, ZZ };  // for searchability on any indexed 3D struct rather than [0..2]
enum { AXIS_X, AXIS_Y, AXIS_Z, AXIS_INVALID = INT_MAX };  // AXIS_INVALID segfaults as array index
enum { NW, SW, SE, NE };  // 4 corners
enum { WIDTH, HEIGHT, DEPTH };  // idx

} // namespace gfx

#endif // GFX_DEFS_HH
