/usr/share/swig/3.0.12/ocaml
NameSizeModeActions
carray.i32520644editdlrm
class.swg17180644editdlrm
cstring.i60710644editdlrm
director.swg30120644editdlrm
ocaml.i14500644editdlrm
ocaml.swg143900644editdlrm
ocamldec.swg53020644editdlrm
ocamlkw.swg10660644editdlrm
preamble.swg4730644editdlrm
std_common.i5520644editdlrm
std_complex.i15480644editdlrm
std_deque.i7220644editdlrm
std_list.i43240644editdlrm
std_map.i23360644editdlrm
std_pair.i7120644editdlrm
std_string.i32020644editdlrm
std_vector.i27540644editdlrm
stl.i3570644editdlrm
swig.ml46840644editdlrm
swig.mli16960644editdlrm
swigp4.ml66520644editdlrm
typecheck.i47160644editdlrm
typemaps.i100850644editdlrm
typeregister.swg550644editdlrm
Edit: /usr/share/swig/3.0.12/ocaml/director.swg (3012B)
/* ----------------------------------------------------------------------------- * director.swg * * This file contains support for director classes so that Ocaml proxy * methods can be called from C++. * ----------------------------------------------------------------------------- */ #include #include # define SWIG_DIRECTOR_CAST(ARG) dynamic_cast(ARG) namespace Swig { /* base class for director exceptions */ class DirectorException : public std::exception { protected: std::string swig_msg; public: DirectorException(const char *msg="") : swig_msg(msg) { } virtual ~DirectorException() throw() { } const char *what() const throw() { return swig_msg.c_str(); } }; /* type mismatch in the return value from a Ocaml method call */ class DirectorTypeMismatchException : public DirectorException { public: DirectorTypeMismatchException(const char *msg="") : DirectorException(msg) { } }; /* any Ocaml exception that occurs during a director method call */ class DirectorMethodException : public DirectorException {}; /* attempt to call a pure virtual method via a director method */ class DirectorPureVirtualException : public DirectorException { public: DirectorPureVirtualException(const char *msg="") : DirectorException(msg) { } static void raise(const char *msg) { throw DirectorPureVirtualException(msg); } }; /* simple thread abstraction for pthreads on win32 */ #ifdef __THREAD__ #define __PTHREAD__ #if defined(_WIN32) || defined(__WIN32__) #define pthread_mutex_lock EnterCriticalSection #define pthread_mutex_unlock LeaveCriticalSection #define pthread_mutex_t CRITICAL_SECTION #define MUTEX_INIT(var) CRITICAL_SECTION var #else #include #define MUTEX_INIT(var) pthread_mutex_t var = PTHREAD_MUTEX_INITIALIZER #endif #endif /* director base class */ class Director { private: /* pointer to the wrapped ocaml object */ CAML_VALUE swig_self; /* flag indicating whether the object is owned by ocaml or c++ */ mutable bool swig_disown_flag; public: /* wrap a ocaml object. */ Director(CAML_VALUE self) : swig_self(self), swig_disown_flag(false) { register_global_root(&swig_self); } /* discard our reference at destruction */ virtual ~Director() { remove_global_root(&swig_self); swig_disown(); // Disown is safe here because we're just divorcing a reference that points to us. } /* return a pointer to the wrapped ocaml object */ CAML_VALUE swig_get_self() const { return swig_self; } /* acquire ownership of the wrapped ocaml object (the sense of "disown" is from ocaml) */ void swig_disown() const { if (!swig_disown_flag) { swig_disown_flag=true; callback(*caml_named_value("caml_obj_disown"),swig_self); } } }; }