
/*
**  This file forms part of the GOBLIN C++ Class Library.
**
**  Written by Christian Fremuth-Paeger, April 1999.
**  
**  Copying, compiling, distribution and modification
**  of this source code is permitted only in accordance
**  with the GOBLIN general licence information.
*/             


#if !defined(_GLOBALS_H_)

#define _GLOBALS_H_



// Standard C/C++ declarations

#include <climits>
#include <cfloat>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <cstring>

#include <iostream>
#include <fstream>
#include <iomanip>
#include <exception>
#include <new>

using namespace std;


// GOBLIN Configuration

#include <config.h>



// Basic Types

#if defined(_BIG_NODES_)

typedef unsigned long   TNode;

#else

typedef unsigned short  TNode;

#endif


#if defined(_SMALL_ARCS_)

typedef unsigned short  TArc;

#else

typedef unsigned long   TArc;

#endif


typedef float           TCap;
typedef double          TFloat;
typedef unsigned long   THandle;
typedef unsigned long   TIndex;
typedef unsigned long   TSize;
typedef unsigned short  TOption;
typedef unsigned long   TVar;
typedef unsigned long   TRestr;


// Limits and Undefined Symbols 

extern TNode     NoNode;
extern TArc      NoArc;
extern TCap      InfCap;
extern TFloat    InfFloat;
extern THandle   NoHandle;
extern TIndex    NoIndex;
extern TVar      NoVar;
extern TRestr    NoRestr;

    
// Class Identifier Constants

enum objectType
    {IDSparseGraph,IDSparseDiGraph,IDSparseBiGraph,IDBalancedFNW,
     IDMixedGraph,IDDenseGraph,IDDenseDiGraph,IDDenseBiGraph,IDUnknown};


// Message Classes

enum msgType
    {ERR_CHECK=0,ERR_PARSE=1,ERR_FILE=2,ERR_RANGE=3,ERR_REJECTED=4,ERR_FATAL=5,
     MSG_APPEND=6,MSG_WARN=7,MSG_TRACE=8,MSG_TRACE2=9,MSG_TIMES=10,MSG_ECHO=11,
     LOG_IO=12,LOG_MAN=13,LOG_MEM=14,LOG_MEM2=15,LOG_RES=16,LOG_RES2=17,
     LOG_METH=18,LOG_METH2=19,LOG_FORMULA=20,LOG_TITLE=21,LOG_SHELL=22,NO_MSG=23};


// Exception Handling

class ERGoblin                              {};

class ERIO          : protected ERGoblin    {};
class ERFile        : protected ERIO        {};
class ERParse       : protected ERIO        {};

class ERFatal       : protected ERGoblin    {};

class ERRejected    : protected ERGoblin    {};
class ERRange       : protected ERRejected  {};
class ERCheck       : protected ERRejected  {};


// Memory management

extern long unsigned goblinHeapSize;
extern long unsigned goblinMaxSize;
extern long unsigned goblinNFragments;
extern long unsigned goblinNAllocs;
extern long unsigned goblinNObjects;

void* GoblinRealloc(void* p,size_t size) throw (std::bad_alloc);




#endif
