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

void PFailHandler(void); 

// egcs ne semble pas connaitre set_new_handler (Reza 26/04/99)
// ca ne passe plus avec SGI-CC -LANG:std $CHECK$ Reza 14/02/2003
#if defined( __GNUG__ ) || defined(__SGICC__)
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);
}
#endif

string SOPHYA::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);
}
