dtinfo subtree DtMmdb
This commit is contained in:
committed by
Jon Trulson
parent
b92cf08899
commit
8c8363f4a5
@@ -80,7 +80,7 @@ Destructable::~Destructable()
|
||||
inline void
|
||||
Destructable::destruct()
|
||||
{
|
||||
#if defined(linux)
|
||||
#if defined(linux) || defined(CSRG_BASED)
|
||||
delete this;
|
||||
#else
|
||||
// Have to call this here since some compilers don't allow
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
// $TOG: Exception.hh /main/11 1998/04/20 09:55:15 mgreess $
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#define G_TEMP_SPACE_SIZE 1024
|
||||
|
||||
#if defined(linux)
|
||||
#define CASTEXCEPT (Exception*)
|
||||
#else
|
||||
#define CASTEXCEPT
|
||||
#endif
|
||||
|
||||
class Exception : public Destructable
|
||||
{
|
||||
@@ -158,7 +154,7 @@ private:
|
||||
{ Exception *temp; \
|
||||
if (in_stack()) { \
|
||||
temp = new (0) NAME (*this); \
|
||||
(Exception *) (((NAME *)temp)->f_temporary = 1); \
|
||||
((NAME *)temp)->f_temporary = 1; \
|
||||
} else \
|
||||
temp = this; \
|
||||
temp->do_throw (line, file, dbg); } \
|
||||
|
||||
@@ -43,42 +43,47 @@ char* Exceptions::f_msg_out_of_exception_memory = 0;
|
||||
char* Exceptions::f_msg_out_of_obj_stack_memory = 0;
|
||||
char* Exceptions::f_msg_memory_already_freed = 0;
|
||||
#else
|
||||
char *Exceptions::f_msg_internal_error = "Internal exceptions error:";
|
||||
char *Exceptions::f_msg_application_error = "Application exceptions error:";
|
||||
char *Exceptions::f_msg_throw_message = "Application threw exception:";
|
||||
char *Exceptions::f_msg_internal_error =
|
||||
(char*)"Internal exceptions error:";
|
||||
|
||||
char *Exceptions::f_msg_application_error =
|
||||
(char*)"Application exceptions error:";
|
||||
|
||||
char *Exceptions::f_msg_throw_message =
|
||||
(char*)"Application threw exception:";
|
||||
|
||||
char *Exceptions::f_msg_not_initialized =
|
||||
"Exceptions library not initialized with INIT_EXCEPTIONS().";
|
||||
(char*)"Exceptions library not initialized with INIT_EXCEPTIONS().";
|
||||
|
||||
char *Exceptions::f_msg_initialized_twice =
|
||||
"Attept to call INIT_EXCEPTIONS() more than once.";
|
||||
(char*)"Attept to call INIT_EXCEPTIONS() more than once.";
|
||||
|
||||
char *Exceptions::f_msg_not_caught =
|
||||
"Exception not caught.";
|
||||
(char*)"Exception not caught.";
|
||||
|
||||
char *Exceptions::f_msg_no_current_exception =
|
||||
"There is no current exception (for catch or rethrow).";
|
||||
(char*)"There is no current exception (for catch or rethrow).";
|
||||
|
||||
char *Exceptions::f_msg_throw_from_terminate =
|
||||
"Exceptions may not be thrown from terminate.";
|
||||
(char*)"Exceptions may not be thrown from terminate.";
|
||||
|
||||
char *Exceptions::f_msg_throw_from_error_handler =
|
||||
"Exceptions may not be thrown from error handler.";
|
||||
(char*)"Exceptions may not be thrown from error handler.";
|
||||
|
||||
char *Exceptions::f_msg_throw_from_destructor =
|
||||
"Exited destructor with throw while handling an exception.";
|
||||
(char*)"Exited destructor with throw while handling an exception.";
|
||||
|
||||
char *Exceptions::f_msg_throw_ptr_to_stack =
|
||||
"Threw a pointer to an automatic (stack-based) exceptions object.";
|
||||
(char*)"Threw a pointer to an automatic (stack-based) exceptions object.";
|
||||
|
||||
char *Exceptions::f_msg_out_of_exception_memory =
|
||||
"Not enough memory to allocate an exception object.";
|
||||
(char*)"Not enough memory to allocate an exception object.";
|
||||
|
||||
char *Exceptions::f_msg_out_of_obj_stack_memory =
|
||||
"Not enough memory to allocate object stack.";
|
||||
(char*)"Not enough memory to allocate object stack.";
|
||||
|
||||
char *Exceptions::f_msg_memory_already_freed =
|
||||
"Tried to alloc or realloc pool memory that was previously freed.";
|
||||
(char*)"Tried to alloc or realloc pool memory that was previously freed.";
|
||||
|
||||
#endif
|
||||
|
||||
@@ -183,7 +188,7 @@ Exceptions::error (const char *message, error_type_t error_type)
|
||||
// Call user print function if set, otherwise just dump lines.
|
||||
if (g_error_handler != NULL)
|
||||
{
|
||||
try
|
||||
mtry
|
||||
{
|
||||
// Reset global variable to NULL before calling to prevent
|
||||
// the possibility of recursive calls.
|
||||
@@ -191,7 +196,7 @@ Exceptions::error (const char *message, error_type_t error_type)
|
||||
(*current) ((const char**)lines, count);
|
||||
set_error_handler (current);
|
||||
}
|
||||
catch_any()
|
||||
mcatch_any()
|
||||
{
|
||||
// Error handler will be NULL at this point.
|
||||
Exceptions::error (Exceptions::f_msg_throw_from_error_handler,
|
||||
|
||||
@@ -4,14 +4,27 @@
|
||||
|
||||
#define _Exceptions_hh_active
|
||||
|
||||
#ifndef C_API
|
||||
#ifndef NATIVE_EXCEPTIONS
|
||||
#define NATIVE_EXCEPTIONS
|
||||
#endif
|
||||
#define Exception mException
|
||||
#endif
|
||||
|
||||
#ifndef NATIVE_EXCEPTIONS
|
||||
extern "C" {
|
||||
#include <setjmp.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
}
|
||||
#else
|
||||
extern "C" {
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef NATIVE_EXCEPTIONS
|
||||
#ifdef EXC_DEBUG
|
||||
#define PRINTF(MSG) printf MSG
|
||||
#ifndef DEBUG
|
||||
@@ -45,12 +58,14 @@ extern "C" {
|
||||
|
||||
#define INIT_EXCEPTIONS()
|
||||
|
||||
#define throw(OBJ) throw OBJ
|
||||
#define mthrow(OBJ) throw OBJ
|
||||
#define rethrow throw
|
||||
|
||||
#define catch_any() catch(...)
|
||||
#define catch_noarg(OBJ) catch(OBJ)
|
||||
#define catch(TYPE,OBJ) catch(TYPE OBJ)
|
||||
#define mtry try
|
||||
|
||||
#define mcatch_any() catch(...)
|
||||
#define mcatch_noarg(OBJ) catch(OBJ)
|
||||
#define mcatch(TYPE,OBJ) catch(TYPE OBJ)
|
||||
|
||||
#define end_try
|
||||
|
||||
@@ -64,7 +79,7 @@ extern "C" {
|
||||
|
||||
// TRY MACRO
|
||||
|
||||
#define try \
|
||||
#define mtry \
|
||||
{ \
|
||||
Jump_Environment __jump_env; \
|
||||
if (setjmp (__jump_env.f_env) == 0) {
|
||||
@@ -81,10 +96,10 @@ extern "C" {
|
||||
// This works if OBJ is an object or a pointer since Exception objects
|
||||
// overload operator ->.
|
||||
#if !defined(hpux) && !defined(USL)
|
||||
#define throw(OBJ) \
|
||||
#define mthrow(OBJ) \
|
||||
(OBJ)->throw_it (__LINE__, __FILE__, DEBUG_THROW_FLAG)
|
||||
#else
|
||||
#define throw(OBJ) \
|
||||
#define mthrow(OBJ) \
|
||||
OBJ->throw_it (__LINE__, __FILE__, DEBUG_THROW_FLAG)
|
||||
#endif
|
||||
|
||||
@@ -105,16 +120,16 @@ extern "C" {
|
||||
#define PRINT_CATCH
|
||||
#endif
|
||||
|
||||
#define catch_any() \
|
||||
#define mcatch_any() \
|
||||
} else if (1) { \
|
||||
PRINT_CATCH
|
||||
|
||||
#define catch_noarg(OBJ) \
|
||||
#define mcatch_noarg(OBJ) \
|
||||
} else if (Exception::current_exception().isa (STRINGIFY(OBJ))) { \
|
||||
PRINT_CATCH
|
||||
|
||||
#define catch(TYPE,OBJ) \
|
||||
catch_noarg (TYPE) \
|
||||
#define mcatch(TYPE,OBJ) \
|
||||
mcatch_noarg (TYPE) \
|
||||
TYPE OBJ = (TYPE) Exception::current_exception();
|
||||
|
||||
#define end_try \
|
||||
|
||||
@@ -23,7 +23,7 @@ XCOMM .../programs/dtinfo/mmdb/<subdir>/Imakefile
|
||||
#define LargePICTable YES
|
||||
|
||||
#define CplusplusSource YES
|
||||
DEPEND_DEFINES = $(CXXDEPENDINCLUDES)
|
||||
DEPEND_DEFINES = $(CXXDEPENDINCLUDES) $(DEPENDDEFINES)
|
||||
|
||||
#if defined(SunArchitecture) && CplusplusCompilerMajorVersion > 3
|
||||
EXCEPTION_DEFINES = -DHAS_TERMINATE
|
||||
|
||||
@@ -30,42 +30,42 @@
|
||||
void initialize_exception()
|
||||
{
|
||||
|
||||
Exceptions::f_msg_internal_error = "Internal exceptions error:";
|
||||
Exceptions::f_msg_application_error = "Application exceptions error:";
|
||||
Exceptions::f_msg_throw_message = "Application threw exception:";
|
||||
Exceptions::f_msg_internal_error = (char*)"Internal exceptions error:";
|
||||
Exceptions::f_msg_application_error = (char*)"Application exceptions error:";
|
||||
Exceptions::f_msg_throw_message = (char*)"Application threw exception:";
|
||||
|
||||
Exceptions::f_msg_not_initialized =
|
||||
"Exceptions library not initialized with INIT_EXCEPTIONS().";
|
||||
(char*)"Exceptions library not initialized with INIT_EXCEPTIONS().";
|
||||
|
||||
Exceptions::f_msg_initialized_twice =
|
||||
"Attept to call INIT_EXCEPTIONS() more than once.";
|
||||
(char*)"Attept to call INIT_EXCEPTIONS() more than once.";
|
||||
|
||||
Exceptions::f_msg_not_caught =
|
||||
"Exception not caught.";
|
||||
(char*)"Exception not caught.";
|
||||
|
||||
Exceptions::f_msg_no_current_exception =
|
||||
"There is no current exception (for catch or rethrow).";
|
||||
(char*)"There is no current exception (for catch or rethrow).";
|
||||
|
||||
Exceptions::f_msg_throw_from_terminate =
|
||||
"Exceptions may not be thrown from terminate.";
|
||||
(char*)"Exceptions may not be thrown from terminate.";
|
||||
|
||||
Exceptions::f_msg_throw_from_error_handler =
|
||||
"Exceptions may not be thrown from error handler.";
|
||||
(char*)"Exceptions may not be thrown from error handler.";
|
||||
|
||||
Exceptions::f_msg_throw_from_destructor =
|
||||
"Exited destructor with throw while handling an exception.";
|
||||
(char*)"Exited destructor with throw while handling an exception.";
|
||||
|
||||
Exceptions::f_msg_throw_ptr_to_stack =
|
||||
"Threw a pointer to an automatic (stack-based) exceptions object.";
|
||||
(char*)"Threw a pointer to an automatic (stack-based) exceptions object.";
|
||||
|
||||
Exceptions::f_msg_out_of_exception_memory =
|
||||
"Not enough memory to allocate an exception object.";
|
||||
(char*)"Not enough memory to allocate an exception object.";
|
||||
|
||||
Exceptions::f_msg_out_of_obj_stack_memory =
|
||||
"Not enough memory to allocate object stack.";
|
||||
(char*)"Not enough memory to allocate object stack.";
|
||||
|
||||
Exceptions::f_msg_memory_already_freed =
|
||||
"Tried to alloc or realloc pool memory that was previously freed.";
|
||||
(char*)"Tried to alloc or realloc pool memory that was previously freed.";
|
||||
|
||||
Unwind_Stack::g_stack = new Unwind_Record[UNWIND_STACK_SIZE];
|
||||
Exception::g_temp_space = new char[G_TEMP_SPACE_SIZE];
|
||||
|
||||
@@ -54,7 +54,8 @@ void class_name::operator delete( void* p )\
|
||||
|
||||
|
||||
#else
|
||||
#include <new.h>
|
||||
#include <new>
|
||||
using namespace std;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -48,11 +48,11 @@ terminate()
|
||||
// abuse in the terminate handler.
|
||||
PFV handler = _terminate_handler;
|
||||
_terminate_handler = NULL;
|
||||
try
|
||||
mtry
|
||||
{
|
||||
(*handler)();
|
||||
}
|
||||
catch_any()
|
||||
mcatch_any()
|
||||
{
|
||||
Exceptions::error (Exceptions::f_msg_throw_from_terminate,
|
||||
Exceptions::APPLICATION_ERROR);
|
||||
|
||||
Reference in New Issue
Block a user