eliminate dead director code and convert remaining blocks
This commit is contained in:
parent
3e91ae7db7
commit
7d80d9b59e
2 changed files with 23 additions and 204 deletions
|
|
@ -17,41 +17,6 @@
|
|||
#include <map>
|
||||
|
||||
|
||||
/*
|
||||
Use -DSWIG_PYTHON_DIRECTOR_NO_VTABLE if you don't want to generate a 'virtual
|
||||
table', and avoid multiple GetAttr calls to retrieve the python
|
||||
methods.
|
||||
*/
|
||||
|
||||
#ifndef SWIG_PERL_DIRECTOR_NO_VTABLE
|
||||
#ifndef SWIG_PERL_DIRECTOR_VTABLE
|
||||
#define SWIG_PERL_DIRECTOR_VTABLE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Use -DSWIG_DIRECTOR_NO_UEH if you prefer to avoid the use of the
|
||||
Undefined Exception Handler provided by swig.
|
||||
*/
|
||||
#ifndef SWIG_DIRECTOR_NO_UEH
|
||||
#ifndef SWIG_DIRECTOR_UEH
|
||||
#define SWIG_DIRECTOR_UEH
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
Use -DSWIG_DIRECTOR_STATIC if you prefer to avoid the use of the
|
||||
'Swig' namespace. This could be useful for multi-modules projects.
|
||||
*/
|
||||
#ifdef SWIG_DIRECTOR_STATIC
|
||||
/* Force anonymous (static) namespace */
|
||||
#define Swig
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
Use -DSWIG_DIRECTOR_NORTTI if you prefer to avoid the use of the
|
||||
native C++ RTTI and dynamic_cast<>. But be aware that directors
|
||||
|
|
@ -267,77 +232,6 @@ namespace Swig {
|
|||
throw DirectorPureVirtualException(name);
|
||||
}
|
||||
};
|
||||
// /* 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 likely 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
|
||||
// };
|
||||
|
||||
#if defined(SWIG_PYTHON_THREADS)
|
||||
/* __THREAD__ is the old macro to activate some thread support */
|
||||
# if !defined(__THREAD__)
|
||||
# define __THREAD__ 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __THREAD__
|
||||
# include "pythread.h"
|
||||
class Guard
|
||||
{
|
||||
PyThread_type_lock & mutex_;
|
||||
|
||||
public:
|
||||
Guard(PyThread_type_lock & mutex) : mutex_(mutex)
|
||||
{
|
||||
PyThread_acquire_lock(mutex_, WAIT_LOCK);
|
||||
}
|
||||
|
||||
~Guard()
|
||||
{
|
||||
PyThread_release_lock(mutex_);
|
||||
}
|
||||
};
|
||||
# define SWIG_GUARD(mutex) Guard _guard(mutex)
|
||||
#else
|
||||
# define SWIG_GUARD(mutex)
|
||||
#endif
|
||||
|
||||
/* director base class */
|
||||
class Director {
|
||||
|
|
@ -410,16 +304,12 @@ namespace Swig {
|
|||
private:
|
||||
typedef std::map<void*, GCItem_var> swig_ownership_map;
|
||||
mutable swig_ownership_map swig_owner;
|
||||
#ifdef __THREAD__
|
||||
static PyThread_type_lock swig_mutex_own;
|
||||
#endif
|
||||
|
||||
public:
|
||||
template <typename Type>
|
||||
void swig_acquire_ownership_array(Type *vptr) const
|
||||
{
|
||||
if (vptr) {
|
||||
SWIG_GUARD(swig_mutex_own);
|
||||
swig_owner[vptr] = new GCArray_T<Type>(vptr);
|
||||
}
|
||||
}
|
||||
|
|
@ -428,7 +318,6 @@ namespace Swig {
|
|||
void swig_acquire_ownership(Type *vptr) const
|
||||
{
|
||||
if (vptr) {
|
||||
SWIG_GUARD(swig_mutex_own);
|
||||
swig_owner[vptr] = new GCItem_T<Type>(vptr);
|
||||
}
|
||||
}
|
||||
|
|
@ -436,7 +325,6 @@ namespace Swig {
|
|||
void swig_acquire_ownership_obj(void *vptr, int own) const
|
||||
{
|
||||
if (vptr && own) {
|
||||
SWIG_GUARD(swig_mutex_own);
|
||||
swig_owner[vptr] = new GCItem_Object(own);
|
||||
}
|
||||
}
|
||||
|
|
@ -445,7 +333,6 @@ namespace Swig {
|
|||
{
|
||||
int own = 0;
|
||||
if (vptr) {
|
||||
SWIG_GUARD(swig_mutex_own);
|
||||
swig_ownership_map::iterator iter = swig_owner.find(vptr);
|
||||
if (iter != swig_owner.end()) {
|
||||
own = iter->second->get_own();
|
||||
|
|
@ -455,22 +342,8 @@ namespace Swig {
|
|||
return own;
|
||||
}
|
||||
|
||||
//template <typename Type>
|
||||
//static PyObject* swig_pyobj_disown(PyObject *pyobj, PyObject *SWIGUNUSEDPARM(args))
|
||||
//{
|
||||
// SwigPyObject *sobj = (SwigPyObject *)pyobj;
|
||||
// sobj->own = 0;
|
||||
// Director *d = SWIG_DIRECTOR_CAST(reinterpret_cast<Type *>(sobj->ptr));
|
||||
// if (d)
|
||||
// d->swig_disown();
|
||||
// return PyWeakref_NewProxy(pyobj, NULL);
|
||||
//}
|
||||
|
||||
};
|
||||
|
||||
#ifdef __THREAD__
|
||||
PyThread_type_lock Director::swig_mutex_own = PyThread_allocate_lock();
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue