#include "pexceptions.h"
#include <iostream.h>

void PFailHandler(void); 

// egcs ne semble pas connaitre set_new_handler (Reza 26/04/99)
#ifdef __GNUG__
void PFailHandler(void) {}
void InitFailNewHandler() {}
#else

void PFailHandler(void)
{
  set_new_handler(NULL);
  cerr << "Allocation exception -- out of memory" << endl;
  throw(AllocationError("new"));
}

void InitFailNewHandler()
{
   set_new_handler(PFailHandler);
}

string BuildLongExceptionMessage(const char * s, const char *file, int line)
{
  char buff[32];
  sprintf(buff," Line=%d", line);
  string rs=s;
  rs += " File="; rs += file; rs += buff;
  return(rs);
}

#endif
