///////////////////////////////////////////////////////////////////////////////
//                                                                           //
//  Copyright (C) 1995-1998 by the Board of Trustees of Leland Stanford      //
//  Junior University.  See LICENSE for details.                             //
//                                                                           //
///////////////////////////////////////////////////////////////////////////////

// Miscellaneous Definitions

#ifndef misc_h
#define misc_h

#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

// Boolean type
typedef unsigned Bool;
typedef Bool *PBool;
const Bool TRUE = 1;
const Bool FALSE = 0;

// Pchar, PPchar type
typedef char *Pchar;
typedef const char *PCchar;
typedef char **PPchar;
typedef const char **PPCchar;

// Use -1 to indicate INVALID for positive integers
const int INVALID = -1;

// define NULL
#ifdef NULL
#undef NULL
#endif
#define NULL 0

// define WORDBITS (number of bits in a word)
#define WORDBITS (CHAR_BIT * sizeof(unsigned))

//Misc templates & functions
template <class N>
inline N min(N a, N b) { return (a <= b) ? a : b; }

template <class N>
inline N max(N a, N b) { return (a >= b) ? a : b; }

char *copy_string (const char*);
char *int_to_string (int i);
int stringhash(const char *s);
int stringhashcase(const char *s);
int ihash(const int i);
int imatch(const int x, const int y);

#include "debug.h"

#endif
