fix for old VC 6.0 and linking issue reported by Roy Sutton
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9039 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
418b2d8ea3
commit
c4c03726c1
3 changed files with 85 additions and 95 deletions
|
|
@ -38,30 +38,6 @@ namespace Swig {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void UnknownExceptionHandler::handler() {
|
|
||||||
try {
|
|
||||||
throw;
|
|
||||||
} catch (DirectorException& e) {
|
|
||||||
std::cerr << "Swig Director exception caught:" << std::endl
|
|
||||||
<< e.getMessage() << std::endl;
|
|
||||||
} catch (std::exception& e) {
|
|
||||||
std::cerr << "std::exception caught: "<< e.what() << std::endl;
|
|
||||||
} catch (...) {
|
|
||||||
std::cerr << "Unknown exception caught." << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::cerr << std::endl
|
|
||||||
<< "Python interpreter traceback:" << std::endl;
|
|
||||||
PyErr_Print();
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
std::cerr << "This exception was caught by the SWIG unexpected exception handler." << std::endl
|
|
||||||
<< "Try using %feature(\"director:except\") to avoid reaching this point." << std::endl
|
|
||||||
<< std::endl
|
|
||||||
<< "Exception is being re-thrown, program will like abort/terminate." << std::endl;
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
|
||||||
|
|
@ -194,27 +194,6 @@ namespace Swig {
|
||||||
Type *_ptr;
|
Type *_ptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* unknown exception handler */
|
|
||||||
class UnknownExceptionHandler
|
|
||||||
{
|
|
||||||
static void handler();
|
|
||||||
public:
|
|
||||||
|
|
||||||
#ifdef SWIG_DIRECTOR_UEH
|
|
||||||
std::unexpected_handler old;
|
|
||||||
UnknownExceptionHandler(std::unexpected_handler nh = handler)
|
|
||||||
{
|
|
||||||
old = std::set_unexpected(nh);
|
|
||||||
}
|
|
||||||
|
|
||||||
~UnknownExceptionHandler()
|
|
||||||
{
|
|
||||||
std::set_unexpected(old);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
/* base class for director exceptions */
|
/* base class for director exceptions */
|
||||||
class DirectorException {
|
class DirectorException {
|
||||||
protected:
|
protected:
|
||||||
|
|
@ -252,6 +231,48 @@ namespace Swig {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* unknown exception handler */
|
||||||
|
class UnknownExceptionHandler
|
||||||
|
{
|
||||||
|
#ifdef SWIG_DIRECTOR_UEH
|
||||||
|
static void handler() {
|
||||||
|
try {
|
||||||
|
throw;
|
||||||
|
} catch (DirectorException& e) {
|
||||||
|
std::cerr << "Swig Director exception caught:" << std::endl
|
||||||
|
<< e.getMessage() << std::endl;
|
||||||
|
} catch (std::exception& e) {
|
||||||
|
std::cerr << "std::exception caught: "<< e.what() << std::endl;
|
||||||
|
} catch (...) {
|
||||||
|
std::cerr << "Unknown exception caught." << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cerr << std::endl
|
||||||
|
<< "Python interpreter traceback:" << std::endl;
|
||||||
|
PyErr_Print();
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
std::cerr << "This exception was caught by the SWIG unexpected exception handler." << std::endl
|
||||||
|
<< "Try using %feature(\"director:except\") to avoid reaching this point." << std::endl
|
||||||
|
<< std::endl
|
||||||
|
<< "Exception is being re-thrown, program will like abort/terminate." << std::endl;
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
std::unexpected_handler old;
|
||||||
|
UnknownExceptionHandler(std::unexpected_handler nh = handler)
|
||||||
|
{
|
||||||
|
old = std::set_unexpected(nh);
|
||||||
|
}
|
||||||
|
|
||||||
|
~UnknownExceptionHandler()
|
||||||
|
{
|
||||||
|
std::set_unexpected(old);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
/* type mismatch in the return value from a python method call */
|
/* type mismatch in the return value from a python method call */
|
||||||
class DirectorTypeMismatchException : public Swig::DirectorException {
|
class DirectorTypeMismatchException : public Swig::DirectorException {
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,9 @@ namespace Swig {
|
||||||
/* memory handler */
|
/* memory handler */
|
||||||
struct GCItem
|
struct GCItem
|
||||||
{
|
{
|
||||||
virtual ~GCItem() = 0;
|
virtual ~GCItem()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
virtual ruby_owntype get_own() const
|
virtual ruby_owntype get_own() const
|
||||||
{
|
{
|
||||||
|
|
@ -126,26 +128,6 @@ namespace Swig {
|
||||||
int argc;
|
int argc;
|
||||||
VALUE *argv;
|
VALUE *argv;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* unknown exception handler */
|
|
||||||
class UnknownExceptionHandler
|
|
||||||
{
|
|
||||||
static void handler();
|
|
||||||
public:
|
|
||||||
|
|
||||||
#ifdef SWIG_DIRECTOR_UEH
|
|
||||||
std::unexpected_handler old;
|
|
||||||
UnknownExceptionHandler(std::unexpected_handler nh = handler)
|
|
||||||
{
|
|
||||||
old = std::set_unexpected(nh);
|
|
||||||
}
|
|
||||||
|
|
||||||
~UnknownExceptionHandler()
|
|
||||||
{
|
|
||||||
std::set_unexpected(old);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Base class for director exceptions */
|
/* Base class for director exceptions */
|
||||||
class DirectorException {
|
class DirectorException {
|
||||||
|
|
@ -186,6 +168,46 @@ namespace Swig {
|
||||||
virtual ~DirectorException() {}
|
virtual ~DirectorException() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* unknown exception handler */
|
||||||
|
|
||||||
|
class UnknownExceptionHandler
|
||||||
|
{
|
||||||
|
#ifdef SWIG_DIRECTOR_UEH
|
||||||
|
static void handler() {
|
||||||
|
try {
|
||||||
|
throw;
|
||||||
|
} catch (DirectorException& e) {
|
||||||
|
std::cerr << "Swig Director exception caught:" << std::endl
|
||||||
|
<< e.getMessage() << std::endl;
|
||||||
|
} catch (std::exception& e) {
|
||||||
|
std::cerr << "std::exception caught: "<< e.what() << std::endl;
|
||||||
|
} catch (...) {
|
||||||
|
std::cerr << "Unknown exception caught." << std::endl;
|
||||||
|
}
|
||||||
|
std::cerr << std::endl
|
||||||
|
<< "Ruby interpreter traceback:" << std::endl;
|
||||||
|
std::cerr << std::endl;
|
||||||
|
std::cerr << "This exception was caught by the SWIG unexpected exception handler." << std::endl
|
||||||
|
<< "Try using %feature(\"director:except\") to avoid reaching this point." << std::endl
|
||||||
|
<< std::endl
|
||||||
|
<< "Exception is being re-thrown, program will like abort/terminate." << std::endl;
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
std::unexpected_handler old;
|
||||||
|
UnknownExceptionHandler(std::unexpected_handler nh = handler)
|
||||||
|
{
|
||||||
|
old = std::set_unexpected(nh);
|
||||||
|
}
|
||||||
|
|
||||||
|
~UnknownExceptionHandler()
|
||||||
|
{
|
||||||
|
std::set_unexpected(old);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Type mismatch in the return value from a Ruby method call */
|
/* Type mismatch in the return value from a Ruby method call */
|
||||||
class DirectorTypeMismatchException : public Swig::DirectorException {
|
class DirectorTypeMismatchException : public Swig::DirectorException {
|
||||||
|
|
@ -424,35 +446,6 @@ namespace Swig {
|
||||||
pthread_t Swig::Director::swig_mutex_thread;
|
pthread_t Swig::Director::swig_mutex_thread;
|
||||||
bool Swig::Director::swig_mutex_active = false;
|
bool Swig::Director::swig_mutex_active = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void UnknownExceptionHandler::handler() {
|
|
||||||
try {
|
|
||||||
throw;
|
|
||||||
} catch (DirectorException& e) {
|
|
||||||
std::cerr << "Swig Director exception caught:" << std::endl
|
|
||||||
<< e.getMessage() << std::endl;
|
|
||||||
} catch (std::exception& e) {
|
|
||||||
std::cerr << "std::exception caught: "<< e.what() << std::endl;
|
|
||||||
} catch (...) {
|
|
||||||
std::cerr << "Unknown exception caught." << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::cerr << std::endl
|
|
||||||
<< "Ruby interpreter traceback:" << std::endl;
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
std::cerr << "This exception was caught by the SWIG unexpected exception handler." << std::endl
|
|
||||||
<< "Try using %feature(\"director:except\") to avoid reaching this point." << std::endl
|
|
||||||
<< std::endl
|
|
||||||
<< "Exception is being re-thrown, program will like abort/terminate." << std::endl;
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
GCItem::~GCItem()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue