Initial import of the CDE 2.1.30 sources from the Open Group.

This commit is contained in:
Peter Howkins
2012-03-10 18:21:40 +00:00
commit 83b6996daa
18978 changed files with 3945623 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
// $TOG: terminate.C /main/4 1997/09/05 11:30:17 samborn $
#if !defined(NATIVE_EXCEPTIONS) && !defined(HAS_TERMINATE)
#include "Exceptions.hh"
typedef void (*PFV)();
static PFV _terminate_handler = NULL;
PFV
set_terminate (PFV handler)
{
PFV old_handler = _terminate_handler;
_terminate_handler = handler != NULL ? handler : NULL;
return (old_handler);
}
void
terminate()
{
if (_terminate_handler != NULL)
{
// Reset terminate handler to NULL before handling to
// avoid potential recursive calls due to exceptions
// abuse in the terminate handler.
PFV handler = _terminate_handler;
_terminate_handler = NULL;
try
{
(*handler)();
}
catch_any()
{
Exceptions::error (Exceptions::f_msg_throw_from_terminate,
Exceptions::APPLICATION_ERROR);
}
end_try;
}
abort();
}
#else
#ifdef hpux
// HPUX doesn't define the set_terminate function from the ARM.
typedef void (*PFV)();
PFV set_terminate (PFV) { return (0); }
#endif
#endif /* NATIVE_EXCEPTIONS */