Merge from trunk
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-sploving@12733 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
commit
e48855bfbf
60 changed files with 1099 additions and 545 deletions
|
|
@ -292,18 +292,18 @@ SIMPLE_MAP(unsigned long long, gh_scm2ulong_long, gh_ulong_long2scm, integer);
|
|||
%typemap (varin, doc="NEW-VALUE is a string") char * {$1 = ($1_ltype)SWIG_scm2str($input);}
|
||||
%typemap (out, doc="<string>") char * {$result = gh_str02scm((const char *)$1);}
|
||||
%typemap (varout, doc="<string>") char * {$result = gh_str02scm($1);}
|
||||
%typemap (in, doc="$NAME is a string") char * *INPUT(char * temp, int must_free = 0) {
|
||||
%typemap (in, doc="$NAME is a string") char **INPUT(char * temp, int must_free = 0) {
|
||||
temp = (char *) SWIG_scm2str($input); $1 = &temp;
|
||||
must_free = 1;
|
||||
}
|
||||
%typemap (in,numinputs=0) char * *OUTPUT (char * temp)
|
||||
%typemap (in,numinputs=0) char **OUTPUT (char * temp)
|
||||
{$1 = &temp;}
|
||||
%typemap (argout,doc="$NAME (a string)") char * *OUTPUT
|
||||
%typemap (argout,doc="$NAME (a string)") char **OUTPUT
|
||||
{SWIG_APPEND_VALUE(gh_str02scm(*$1));}
|
||||
%typemap (in) char * *BOTH = char * *INPUT;
|
||||
%typemap (argout) char * *BOTH = char * *OUTPUT;
|
||||
%typemap (in) char * *INOUT = char * *INPUT;
|
||||
%typemap (argout) char * *INOUT = char * *OUTPUT;
|
||||
%typemap (in) char **BOTH = char **INPUT;
|
||||
%typemap (argout) char **BOTH = char **OUTPUT;
|
||||
%typemap (in) char **INOUT = char **INPUT;
|
||||
%typemap (argout) char **INOUT = char **OUTPUT;
|
||||
|
||||
/* SWIG_scm2str makes a malloc'ed copy of the string, so get rid of it after
|
||||
the function call. */
|
||||
|
|
@ -406,7 +406,7 @@ typedef unsigned long SCM;
|
|||
const std::size_t &, const std::ptrdiff_t &,
|
||||
enum SWIGTYPE
|
||||
{
|
||||
$1 = SCM_NFALSEP(scm_integer_p($input)) ? 1 : 0;
|
||||
$1 = SCM_NFALSEP(scm_integer_p($input)) && SCM_NFALSEP(scm_exact_p($input))? 1 : 0;
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_BOOL)
|
||||
|
|
|
|||
|
|
@ -4,17 +4,17 @@
|
|||
the complex Constructor method, and the Real and Imag complex
|
||||
accesor methods.
|
||||
|
||||
See the std_complex.i and ccomplex.i for concret examples.
|
||||
See the std_complex.i and ccomplex.i for concrete examples.
|
||||
*/
|
||||
|
||||
/* the common from conversor */
|
||||
%define %swig_fromcplx_conv(Type, Real, Imag)
|
||||
%define %swig_fromcplx_conv(Type, OctConstructor, Real, Imag)
|
||||
%fragment(SWIG_From_frag(Type),"header")
|
||||
{
|
||||
SWIGINTERNINLINE octave_value
|
||||
SWIG_From(Type)(%ifcplusplus(const Type&, Type) c)
|
||||
SWIG_From(Type)(const Type& c)
|
||||
{
|
||||
return octave_value(Complex(Real(c), Imag(c)));
|
||||
return octave_value(OctConstructor(Real(c), Imag(c)));
|
||||
}
|
||||
}
|
||||
%enddef
|
||||
|
|
@ -45,7 +45,7 @@
|
|||
return SWIG_TypeError;
|
||||
}
|
||||
}
|
||||
%swig_fromcplx_conv(Type, Real, Imag);
|
||||
%swig_fromcplx_conv(Type, Complex, Real, Imag);
|
||||
%enddef
|
||||
|
||||
// the float case
|
||||
|
|
@ -53,7 +53,7 @@
|
|||
%fragment(SWIG_AsVal_frag(Type),"header",
|
||||
fragment=SWIG_AsVal_frag(float)) {
|
||||
SWIGINTERN int
|
||||
SWIG_AsVal(Type)(PyObject *o, Type *val)
|
||||
SWIG_AsVal(Type) (const octave_value& ov, Type* val)
|
||||
{
|
||||
if (ov.is_complex_scalar()) {
|
||||
if (val) {
|
||||
|
|
@ -81,7 +81,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
%swig_fromcplx_conv(Type, Real, Imag);
|
||||
%swig_fromcplx_conv(Type, FloatComplex, Real, Imag);
|
||||
%enddef
|
||||
|
||||
#define %swig_cplxflt_convn(Type, Constructor, Real, Imag) \
|
||||
|
|
@ -90,6 +90,3 @@
|
|||
|
||||
#define %swig_cplxdbl_convn(Type, Constructor, Real, Imag) \
|
||||
%swig_cplxdbl_conv(Type, Constructor, Real, Imag)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -457,22 +457,26 @@ namespace Swig {
|
|||
rhs.members.clear();
|
||||
}
|
||||
|
||||
void install_global() {
|
||||
void install_global(bool global_load) {
|
||||
for (member_map::const_iterator it = members.begin(); it != members.end(); ++it) {
|
||||
if (it->second.first && it->second.first->method)
|
||||
bool is_global_op = (it->first.substr(0, strlen(SWIG_op_prefix)) == SWIG_op_prefix);
|
||||
bool is_func_defined = (it->second.first && it->second.first->method);
|
||||
if (is_func_defined && (is_global_op || global_load)) {
|
||||
install_builtin_function(it->second.first->method, it->first,
|
||||
it->second.first->doc?it->second.first->doc:std::string());
|
||||
else if (it->second.second.is_defined()) {
|
||||
it->second.first->doc ? it->second.first->doc : std::string());
|
||||
}
|
||||
octave_value global_val = is_global_op ? make_fcn_handle(it->first) : it->second.second;
|
||||
if (global_val.is_defined() && (is_global_op || global_load)) {
|
||||
#if OCTAVE_API_VERSION_NUMBER<37
|
||||
link_to_global_variable(curr_sym_tab->lookup(it->first, true));
|
||||
#else
|
||||
symbol_table::varref(it->first);
|
||||
symbol_table::mark_global(it->first);
|
||||
#endif
|
||||
set_global_value(it->first, it->second.second);
|
||||
set_global_value(it->first, global_val);
|
||||
|
||||
#if OCTAVE_API_VERSION_NUMBER<37
|
||||
octave_swig_type *ost = Swig::swig_value_deref(it->second.second);
|
||||
octave_swig_type *ost = Swig::swig_value_deref(global_val);
|
||||
if (ost) {
|
||||
const char* h = ost->help_text();
|
||||
if (h) {
|
||||
|
|
@ -715,9 +719,15 @@ namespace Swig {
|
|||
return outarg(0).string_value();
|
||||
}
|
||||
|
||||
#if OCTAVE_API_VERSION_NUMBER >= 40
|
||||
virtual octave_map map_value() const {
|
||||
return octave_map();
|
||||
}
|
||||
#else
|
||||
virtual Octave_map map_value() const {
|
||||
return Octave_map();
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual string_vector map_keys() const {
|
||||
member_map tmp;
|
||||
|
|
@ -769,7 +779,7 @@ namespace Swig {
|
|||
}
|
||||
|
||||
static bool dispatch_global_op(const std::string &symbol, const octave_value_list &args, octave_value &ret) {
|
||||
// we assume that "op_"-prefixed functions are installed in global namespace
|
||||
// we assume that SWIG_op_prefix-prefixed functions are installed in global namespace
|
||||
// (rather than any module namespace).
|
||||
|
||||
octave_value fcn = get_global_value(symbol, true);
|
||||
|
|
@ -786,7 +796,7 @@ namespace Swig {
|
|||
octave_value ret;
|
||||
if (ost->dispatch_unary_op(std::string("__") + op_name + std::string("__"), ret))
|
||||
return ret;
|
||||
std::string symbol = "op_" + ost->swig_type_name() + "_" + op_name;
|
||||
std::string symbol = SWIG_op_prefix + ost->swig_type_name() + "_" + op_name;
|
||||
octave_value_list args;
|
||||
args.append(make_value_hack(x));
|
||||
if (dispatch_global_op(symbol, args, ret))
|
||||
|
|
@ -803,13 +813,23 @@ namespace Swig {
|
|||
octave_value ret;
|
||||
if (lhs_ost && lhs_ost->dispatch_binary_op(std::string("__") + op_name + std::string("__"), rhs, ret))
|
||||
return ret;
|
||||
if (rhs_ost) {
|
||||
if (strlen(op_name) == 2 && (op_name[1] == 't' || op_name[1] == 'e')) {
|
||||
if (op_name[0] == 'l' && rhs_ost->dispatch_binary_op(std::string("__g") + op_name[1] + std::string("__"), lhs, ret))
|
||||
return ret;
|
||||
if (op_name[0] == 'g' && rhs_ost->dispatch_binary_op(std::string("__l") + op_name[1] + std::string("__"), lhs, ret))
|
||||
return ret;
|
||||
}
|
||||
if (rhs_ost->dispatch_binary_op(std::string("__r") + op_name + std::string("__"), lhs, ret))
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::string symbol;
|
||||
octave_value_list args;
|
||||
args.append(make_value_hack(lhs));
|
||||
args.append(make_value_hack(rhs));
|
||||
|
||||
symbol = "op_";
|
||||
symbol = SWIG_op_prefix;
|
||||
symbol += lhs_ost ? lhs_ost->swig_type_name() : lhs.type_name();
|
||||
symbol += "_";
|
||||
symbol += op_name;
|
||||
|
|
@ -818,7 +838,7 @@ namespace Swig {
|
|||
if (dispatch_global_op(symbol, args, ret))
|
||||
return ret;
|
||||
|
||||
symbol = "op_";
|
||||
symbol = SWIG_op_prefix;
|
||||
symbol += lhs_ost ? lhs_ost->swig_type_name() : lhs.type_name();
|
||||
symbol += "_";
|
||||
symbol += op_name;
|
||||
|
|
@ -827,7 +847,7 @@ namespace Swig {
|
|||
if (dispatch_global_op(symbol, args, ret))
|
||||
return ret;
|
||||
|
||||
symbol = "op_";
|
||||
symbol = SWIG_op_prefix;
|
||||
symbol += "any";
|
||||
symbol += "_";
|
||||
symbol += op_name;
|
||||
|
|
@ -849,26 +869,32 @@ namespace Swig {
|
|||
member_map tmp;
|
||||
load_members(tmp);
|
||||
|
||||
os << "{" << std::endl;
|
||||
indent(os);
|
||||
os << "{"; newline(os);
|
||||
increment_indent_level();
|
||||
for (unsigned int j = 0; j < types.size(); ++j) {
|
||||
indent(os);
|
||||
if (types[j].first->clientdata) {
|
||||
const swig_octave_class *c = (const swig_octave_class *) types[j].first->clientdata;
|
||||
os << " " << c->name << ", ptr = " << types[j].second.ptr << std::endl;
|
||||
os << c->name << ", ptr = " << types[j].second.ptr; newline(os);
|
||||
} else {
|
||||
os << " " << types[j].first->name << ", ptr = " << types[j].second.ptr << std::endl;
|
||||
os << types[j].first->name << ", ptr = " << types[j].second.ptr; newline(os);
|
||||
}
|
||||
}
|
||||
for (member_map::const_iterator it = tmp.begin(); it != tmp.end(); ++it) {
|
||||
indent(os);
|
||||
if (it->second.first) {
|
||||
const char *objtype = it->second.first->method ? "method" : "variable";
|
||||
const char *modifier = (it->second.first->flags &1) ? "static " : (it->second.first->flags &2) ? "global " : "";
|
||||
os << " " << it->second.first->name << " (" << modifier << objtype << ")" << std::endl;
|
||||
os << it->second.first->name << " (" << modifier << objtype << ")"; newline(os);
|
||||
assert(it->second.first->name == it->first);
|
||||
} else {
|
||||
os << " " << it->first << std::endl;
|
||||
os << it->first; newline(os);
|
||||
}
|
||||
}
|
||||
os << "}" << std::endl;
|
||||
decrement_indent_level();
|
||||
indent(os);
|
||||
os << "}"; newline(os);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -923,8 +949,13 @@ namespace Swig {
|
|||
virtual std::string string_value(bool force = false) const
|
||||
{ return ptr->string_value(force); }
|
||||
|
||||
#if OCTAVE_API_VERSION_NUMBER >= 40
|
||||
virtual octave_map map_value() const
|
||||
{ return ptr->map_value(); }
|
||||
#else
|
||||
virtual Octave_map map_value() const
|
||||
{ return ptr->map_value(); }
|
||||
#endif
|
||||
|
||||
virtual string_vector map_keys() const
|
||||
{ return ptr->map_keys(); }
|
||||
|
|
@ -998,7 +1029,8 @@ namespace Swig {
|
|||
}
|
||||
|
||||
void print(std::ostream &os, bool pr_as_read_syntax = false) const {
|
||||
os << "swig packed type: name = " << (type ? type->name : std::string()) << ", len = " << buf.size() << std::endl;
|
||||
indent(os);
|
||||
os << "swig packed type: name = " << (type ? type->name : std::string()) << ", len = " << buf.size(); newline(os);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
%insert(runtime) %{
|
||||
#include <iostream>
|
||||
#include <octave/oct.h>
|
||||
#include <octave/parse.h>
|
||||
#include <octave/ov-fcn-handle.h>
|
||||
|
|
@ -20,6 +21,45 @@ DEFUN_DLD (SWIG_name,args,nargout,SWIG_name_d) {
|
|||
static bool already_init=false;
|
||||
if (already_init)
|
||||
return octave_value_list();
|
||||
|
||||
// parse command line
|
||||
const char* usage="usage: " SWIG_name_d " [-global|-noglobal] [-globals <name>]";
|
||||
bool global_load=SWIG_global_load;
|
||||
std::string global_name=SWIG_global_name;
|
||||
for (int j=0;j<args.length();++j)
|
||||
if (args(j).is_string()) {
|
||||
if (args(j).string_value()=="-help") {
|
||||
std::cout << usage << std::endl;
|
||||
return octave_value_list();
|
||||
} else if (args(j).string_value()=="-global") {
|
||||
global_load = true;
|
||||
} else if (args(j).string_value()=="-noglobal") {
|
||||
global_load = false;
|
||||
} else if (args(j).string_value()=="-globals") {
|
||||
if (j+1<args.length()&&args(j+1).is_string()) {
|
||||
global_name = args(j+1).string_value();
|
||||
++j;
|
||||
} else {
|
||||
std::cerr << "error: " SWIG_name_d ": option '-globals' requires an argument." << std::endl;
|
||||
std::cerr << usage << std::endl;
|
||||
return octave_value_list();
|
||||
}
|
||||
} else {
|
||||
std::cerr << "error: " SWIG_name_d ": unrecognised argument '" << args(j).string_value() << "'." << std::endl;
|
||||
std::cerr << usage << std::endl;
|
||||
return octave_value_list();
|
||||
}
|
||||
} else {
|
||||
std::cerr << "error: " SWIG_name_d ": unrecognised non-string argument." << std::endl;
|
||||
std::cerr << usage << std::endl;
|
||||
return octave_value_list();
|
||||
}
|
||||
|
||||
if (!valid_identifier(global_name)) {
|
||||
std::cerr << "error: " SWIG_name_d ": '" << global_name << "' is not a valid Octave identifier." << std::endl;
|
||||
return octave_value_list();
|
||||
}
|
||||
|
||||
already_init=true;
|
||||
|
||||
octave_swig_ref::register_type();
|
||||
|
|
@ -32,20 +72,13 @@ DEFUN_DLD (SWIG_name,args,nargout,SWIG_name_d) {
|
|||
install_builtin_function(swig_this,"swig_this",std::string());
|
||||
install_builtin_function(swig_subclass,"subclass",std::string());
|
||||
|
||||
bool global_option=true; // * swig cli option should control this default
|
||||
for (int j=0;j<args.length();++j)
|
||||
if (args(j).is_string()&&args(j).string_value()=="noglobal")
|
||||
global_option=true;
|
||||
else if (args(j).is_string()&&args(j).string_value()=="noglobal")
|
||||
global_option=false;
|
||||
|
||||
octave_swig_type* cvar_ns=new octave_swig_type;
|
||||
for (int j=0;swig_globals[j].name;++j)
|
||||
if (swig_globals[j].get_method)
|
||||
cvar_ns->assign(swig_globals[j].name,&swig_globals[j]);
|
||||
|
||||
octave_swig_type* module_ns=new octave_swig_type(0, 0, 0, true);
|
||||
module_ns->assign("cvar",Swig::swig_value_ref(cvar_ns));
|
||||
module_ns->assign(global_name,Swig::swig_value_ref(cvar_ns));
|
||||
for (int j=0;swig_globals[j].name;++j)
|
||||
if (swig_globals[j].method)
|
||||
module_ns->assign(swig_globals[j].name,&swig_globals[j]);
|
||||
|
|
@ -68,8 +101,7 @@ DEFUN_DLD (SWIG_name,args,nargout,SWIG_name_d) {
|
|||
// the incref is necessary so install_global doesn't destroy module_ns,
|
||||
// as it would if it installed something with the same name as the module.
|
||||
module_ns->incref();
|
||||
if (global_option)
|
||||
module_ns->install_global();
|
||||
module_ns->install_global(global_load);
|
||||
module_ns->decref();
|
||||
|
||||
#if OCTAVE_API_VERSION_NUMBER<37
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@
|
|||
%typemap(out) octave_value_list {
|
||||
_outp->append($1);
|
||||
}
|
||||
%typemap(out,noblock=1) Octave_map {
|
||||
%typemap(out,noblock=1) octave_map, Octave_map {
|
||||
$result=$1;
|
||||
}
|
||||
%typemap(out,noblock=1) NDArray {
|
||||
|
|
|
|||
|
|
@ -274,8 +274,14 @@ SWIG_Perl_ConvertPtrAndOwn(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_
|
|||
return SWIG_OK;
|
||||
} else if (SvTYPE(sv) == SVt_RV) { /* Check for NULL pointer */
|
||||
if (!SvROK(sv)) {
|
||||
*(ptr) = (void *) 0;
|
||||
return SWIG_OK;
|
||||
/* In Perl 5.12 and later, SVt_RV == SVt_IV, so sv could be a valid integer value. */
|
||||
if (SvIOK(sv)) {
|
||||
return SWIG_ERROR;
|
||||
} else {
|
||||
/* NULL pointer (reference to undef). */
|
||||
*(ptr) = (void *) 0;
|
||||
return SWIG_OK;
|
||||
}
|
||||
} else {
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,13 +107,11 @@ namespace Swig {
|
|||
}
|
||||
|
||||
bool swig_is_overridden_method(char *cname, char *lc_fname) {
|
||||
zval classname;
|
||||
zend_class_entry **ce;
|
||||
zend_function *mptr;
|
||||
int name_len = strlen(lc_fname);
|
||||
|
||||
ZVAL_STRING(&classname, cname, 0);
|
||||
if (zend_lookup_class(Z_STRVAL_P(&classname), Z_STRLEN_P(&classname), &ce TSRMLS_CC) != SUCCESS) {
|
||||
if (zend_lookup_class(cname, strlen(cname), &ce TSRMLS_CC) != SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
if (zend_hash_find(&(*ce)->function_table, lc_fname, name_len + 1, (void**) &mptr) != SUCCESS) {
|
||||
|
|
|
|||
|
|
@ -347,7 +347,7 @@
|
|||
SWIGTYPE [],
|
||||
SWIGTYPE &
|
||||
%{
|
||||
SWIG_SetPointerZval($input, (void *)&$1_name, $1_descriptor, $owner);
|
||||
SWIG_SetPointerZval($input, (void *)&$1_name, $1_descriptor, ($owner)|2);
|
||||
%}
|
||||
|
||||
%typemap(out, fragment="swig_php_init_member_ptr") SWIGTYPE (CLASS::*)
|
||||
|
|
|
|||
|
|
@ -96,7 +96,6 @@ static ZEND_RSRC_DTOR_FUNC(SWIG_landfill) { (void)rsrc; }
|
|||
|
||||
static void
|
||||
SWIG_ZTS_SetPointerZval(zval *z, void *ptr, swig_type_info *type, int newobject TSRMLS_DC) {
|
||||
swig_object_wrapper *value=NULL;
|
||||
/*
|
||||
* First test for Null pointers. Return those as PHP native NULL
|
||||
*/
|
||||
|
|
@ -105,12 +104,13 @@ SWIG_ZTS_SetPointerZval(zval *z, void *ptr, swig_type_info *type, int newobject
|
|||
return;
|
||||
}
|
||||
if (type->clientdata) {
|
||||
swig_object_wrapper *value;
|
||||
if (! (*(int *)(type->clientdata)))
|
||||
zend_error(E_ERROR, "Type: %s failed to register with zend",type->name);
|
||||
value=(swig_object_wrapper *)emalloc(sizeof(swig_object_wrapper));
|
||||
value->ptr=ptr;
|
||||
value->newobject=newobject;
|
||||
if (newobject <= 1) {
|
||||
value->newobject=(newobject & 1);
|
||||
if ((newobject & 2) == 0) {
|
||||
/* Just register the pointer as a resource. */
|
||||
ZEND_REGISTER_RESOURCE(z, value, *(int *)(type->clientdata));
|
||||
} else {
|
||||
|
|
@ -119,18 +119,32 @@ SWIG_ZTS_SetPointerZval(zval *z, void *ptr, swig_type_info *type, int newobject
|
|||
* via the "_cPtr" member. This is currently only used by
|
||||
* directorin typemaps.
|
||||
*/
|
||||
value->newobject = 0;
|
||||
zval *resource;
|
||||
zend_class_entry **ce = NULL;
|
||||
const char *type_name = type->name+3; /* +3 so: _p_Foo -> Foo */
|
||||
size_t type_name_len;
|
||||
int result;
|
||||
const char * p;
|
||||
|
||||
/* Namespace__Foo -> Foo */
|
||||
/* FIXME: ugly and goes wrong for classes with __ in their names. */
|
||||
while ((p = strstr(type_name, "__")) != NULL) {
|
||||
type_name = p + 2;
|
||||
}
|
||||
type_name_len = strlen(type_name);
|
||||
|
||||
MAKE_STD_ZVAL(resource);
|
||||
ZEND_REGISTER_RESOURCE(resource, value, *(int *)(type->clientdata));
|
||||
zend_class_entry **ce = NULL;
|
||||
zval *classname;
|
||||
MAKE_STD_ZVAL(classname);
|
||||
/* _p_Foo -> Foo */
|
||||
ZVAL_STRING(classname, (char*)type->name+3, 1);
|
||||
/* class names are stored in lowercase */
|
||||
php_strtolower(Z_STRVAL_PP(&classname), Z_STRLEN_PP(&classname));
|
||||
if (zend_lookup_class(Z_STRVAL_P(classname), Z_STRLEN_P(classname), &ce TSRMLS_CC) != SUCCESS) {
|
||||
if (SWIG_PREFIX_LEN > 0) {
|
||||
char * classname = (char*)emalloc(SWIG_PREFIX_LEN + type_name_len + 1);
|
||||
strcpy(classname, SWIG_PREFIX);
|
||||
strcpy(classname + SWIG_PREFIX_LEN, type_name);
|
||||
result = zend_lookup_class(classname, SWIG_PREFIX_LEN + type_name_len, &ce TSRMLS_CC);
|
||||
efree(classname);
|
||||
} else {
|
||||
result = zend_lookup_class((char *)type_name, type_name_len, &ce TSRMLS_CC);
|
||||
}
|
||||
if (result != SUCCESS) {
|
||||
/* class does not exist */
|
||||
object_init(z);
|
||||
} else {
|
||||
|
|
@ -139,7 +153,6 @@ SWIG_ZTS_SetPointerZval(zval *z, void *ptr, swig_type_info *type, int newobject
|
|||
Z_SET_REFCOUNT_P(z, 1);
|
||||
Z_SET_ISREF_P(z);
|
||||
zend_hash_update(HASH_OF(z), (char*)"_cPtr", sizeof("_cPtr"), (void*)&resource, sizeof(zval), NULL);
|
||||
FREE_ZVAL(classname);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
@ -192,7 +205,7 @@ SWIG_ZTS_ConvertResourcePtr(zval *z, swig_type_info *ty, int flags TSRMLS_DC) {
|
|||
swig_object_wrapper *value;
|
||||
void *p;
|
||||
int type;
|
||||
char *type_name;
|
||||
const char *type_name;
|
||||
|
||||
value = (swig_object_wrapper *) zend_list_find(z->value.lval, &type);
|
||||
if ( flags & SWIG_POINTER_DISOWN ) {
|
||||
|
|
|
|||
|
|
@ -285,17 +285,18 @@ SwigPyBuiltin_FunpackSetterClosure (PyObject *obj, PyObject *val, void *closure)
|
|||
SWIGINTERN void
|
||||
SwigPyStaticVar_dealloc(PyDescrObject *descr) {
|
||||
_PyObject_GC_UNTRACK(descr);
|
||||
Py_XDECREF(descr->d_type);
|
||||
Py_XDECREF(descr->d_name);
|
||||
Py_XDECREF(PyDescr_TYPE(descr));
|
||||
Py_XDECREF(PyDescr_NAME(descr));
|
||||
PyObject_GC_Del(descr);
|
||||
}
|
||||
|
||||
SWIGINTERN PyObject *
|
||||
SwigPyStaticVar_repr(PyGetSetDescrObject *descr) {
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
return PyUnicode_FromFormat("<class attribute '%S' of type '%s'>", descr->d_name, descr->d_type->tp_name);
|
||||
|
||||
return PyUnicode_FromFormat("<class attribute '%S' of type '%s'>", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name);
|
||||
#else
|
||||
return PyString_FromFormat("<class attribute '%s' of type '%s'>", PyString_AsString(descr->d_name), descr->d_type->tp_name);
|
||||
return PyString_FromFormat("<class attribute '%s' of type '%s'>", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -303,7 +304,7 @@ SWIGINTERN int
|
|||
SwigPyStaticVar_traverse(PyObject *self, visitproc visit, void *arg) {
|
||||
PyDescrObject *descr;
|
||||
descr = (PyDescrObject *)self;
|
||||
Py_VISIT((PyObject*) descr->d_type);
|
||||
Py_VISIT((PyObject*) PyDescr_TYPE(descr));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -312,9 +313,9 @@ SwigPyStaticVar_get(PyGetSetDescrObject *descr, PyObject *obj, PyObject *SWIGUNU
|
|||
if (descr->d_getset->get != NULL)
|
||||
return descr->d_getset->get(obj, descr->d_getset->closure);
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
PyErr_Format(PyExc_AttributeError, "attribute '%.300S' of '%.100s' objects is not readable", descr->d_name, descr->d_type->tp_name);
|
||||
PyErr_Format(PyExc_AttributeError, "attribute '%.300S' of '%.100s' objects is not readable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name);
|
||||
#else
|
||||
PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not readable", PyString_AsString(descr->d_name), descr->d_type->tp_name);
|
||||
PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not readable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -324,75 +325,13 @@ SwigPyStaticVar_set(PyGetSetDescrObject *descr, PyObject *obj, PyObject *value)
|
|||
if (descr->d_getset->set != NULL)
|
||||
return descr->d_getset->set(obj, value, descr->d_getset->closure);
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
PyErr_Format(PyExc_AttributeError, "attribute '%.300S' of '%.100s' objects is not writable", descr->d_name, descr->d_type->tp_name);
|
||||
PyErr_Format(PyExc_AttributeError, "attribute '%.300S' of '%.100s' objects is not writable", PyDescr_NAME(descr), PyDescr_TYPE(descr)->tp_name);
|
||||
#else
|
||||
PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not writable", PyString_AsString(descr->d_name), descr->d_type->tp_name);
|
||||
PyErr_Format(PyExc_AttributeError, "attribute '%.300s' of '%.100s' objects is not writable", PyString_AsString(PyDescr_NAME(descr)), PyDescr_TYPE(descr)->tp_name);
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
SWIGINTERN PyTypeObject SwigPyStaticVar_Type = {
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||
#else
|
||||
PyObject_HEAD_INIT(&PyType_Type)
|
||||
0,
|
||||
#endif
|
||||
"swig_static_var_getset_descriptor",
|
||||
sizeof(PyGetSetDescrObject),
|
||||
0,
|
||||
(destructor)SwigPyStaticVar_dealloc, /* tp_dealloc */
|
||||
0, /* tp_print */
|
||||
0, /* tp_getattr */
|
||||
0, /* tp_setattr */
|
||||
0, /* tp_compare */
|
||||
(reprfunc)SwigPyStaticVar_repr, /* tp_repr */
|
||||
0, /* tp_as_number */
|
||||
0, /* tp_as_sequence */
|
||||
0, /* tp_as_mapping */
|
||||
0, /* tp_hash */
|
||||
0, /* tp_call */
|
||||
0, /* tp_str */
|
||||
PyObject_GenericGetAttr, /* tp_getattro */
|
||||
0, /* tp_setattro */
|
||||
0, /* tp_as_buffer */
|
||||
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_CLASS, /* tp_flags */
|
||||
0, /* tp_doc */
|
||||
SwigPyStaticVar_traverse, /* tp_traverse */
|
||||
0, /* tp_clear */
|
||||
0, /* tp_richcompare */
|
||||
0, /* tp_weaklistoffset */
|
||||
0, /* tp_iter */
|
||||
0, /* tp_iternext */
|
||||
0, /* tp_methods */
|
||||
0, /* tp_members */
|
||||
0, /* tp_getset */
|
||||
0, /* tp_base */
|
||||
0, /* tp_dict */
|
||||
(descrgetfunc)SwigPyStaticVar_get, /* tp_descr_get */
|
||||
(descrsetfunc)SwigPyStaticVar_set, /* tp_descr_set */
|
||||
0, /* tp_dictoffset */
|
||||
0, /* tp_init */
|
||||
0, /* tp_alloc */
|
||||
0, /* tp_new */
|
||||
0, /* tp_free */
|
||||
0, /* tp_is_gc */
|
||||
0, /* tp_bases */
|
||||
0, /* tp_mro */
|
||||
0, /* tp_cache */
|
||||
0, /* tp_subclasses */
|
||||
0, /* tp_weaklist */
|
||||
#if PY_VERSION_HEX >= 0x02030000
|
||||
0, /* tp_del */
|
||||
#endif
|
||||
#if PY_VERSION_HEX >= 0x02060000
|
||||
0, /* tp_version */
|
||||
#endif
|
||||
#ifdef COUNT_ALLOCS
|
||||
0,0,0,0 /* tp_alloc -> tp_next */
|
||||
#endif
|
||||
};
|
||||
|
||||
SWIGINTERN int
|
||||
SwigPyObjectType_setattro(PyTypeObject *type, PyObject *name, PyObject *value) {
|
||||
PyObject *attribute;
|
||||
|
|
@ -419,16 +358,96 @@ SwigPyObjectType_setattro(PyTypeObject *type, PyObject *name, PyObject *value) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
SWIGINTERN PyTypeObject*
|
||||
SwigPyStaticVar_Type(void) {
|
||||
static PyTypeObject staticvar_type;
|
||||
static int type_init = 0;
|
||||
if (!type_init) {
|
||||
const PyTypeObject tmp = {
|
||||
/* PyObject header changed in Python 3 */
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||
#else
|
||||
PyObject_HEAD_INIT(&PyType_Type)
|
||||
0,
|
||||
#endif
|
||||
"swig_static_var_getset_descriptor",
|
||||
sizeof(PyGetSetDescrObject),
|
||||
0,
|
||||
(destructor)SwigPyStaticVar_dealloc, /* tp_dealloc */
|
||||
0, /* tp_print */
|
||||
0, /* tp_getattr */
|
||||
0, /* tp_setattr */
|
||||
0, /* tp_compare */
|
||||
(reprfunc)SwigPyStaticVar_repr, /* tp_repr */
|
||||
0, /* tp_as_number */
|
||||
0, /* tp_as_sequence */
|
||||
0, /* tp_as_mapping */
|
||||
0, /* tp_hash */
|
||||
0, /* tp_call */
|
||||
0, /* tp_str */
|
||||
PyObject_GenericGetAttr, /* tp_getattro */
|
||||
0, /* tp_setattro */
|
||||
0, /* tp_as_buffer */
|
||||
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_CLASS, /* tp_flags */
|
||||
0, /* tp_doc */
|
||||
SwigPyStaticVar_traverse, /* tp_traverse */
|
||||
0, /* tp_clear */
|
||||
0, /* tp_richcompare */
|
||||
0, /* tp_weaklistoffset */
|
||||
0, /* tp_iter */
|
||||
0, /* tp_iternext */
|
||||
0, /* tp_methods */
|
||||
0, /* tp_members */
|
||||
0, /* tp_getset */
|
||||
0, /* tp_base */
|
||||
0, /* tp_dict */
|
||||
(descrgetfunc)SwigPyStaticVar_get, /* tp_descr_get */
|
||||
(descrsetfunc)SwigPyStaticVar_set, /* tp_descr_set */
|
||||
0, /* tp_dictoffset */
|
||||
0, /* tp_init */
|
||||
0, /* tp_alloc */
|
||||
0, /* tp_new */
|
||||
0, /* tp_free */
|
||||
0, /* tp_is_gc */
|
||||
0, /* tp_bases */
|
||||
0, /* tp_mro */
|
||||
0, /* tp_cache */
|
||||
0, /* tp_subclasses */
|
||||
0, /* tp_weaklist */
|
||||
#if PY_VERSION_HEX >= 0x02030000
|
||||
0, /* tp_del */
|
||||
#endif
|
||||
#if PY_VERSION_HEX >= 0x02060000
|
||||
0, /* tp_version */
|
||||
#endif
|
||||
#ifdef COUNT_ALLOCS
|
||||
0,0,0,0 /* tp_alloc -> tp_next */
|
||||
#endif
|
||||
};
|
||||
staticvar_type = tmp;
|
||||
type_init = 1;
|
||||
#if PY_VERSION_HEX < 0x02020000
|
||||
staticvar_type.ob_type = &PyType_Type;
|
||||
#else
|
||||
if (PyType_Ready(&staticvar_type) < 0)
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
return &staticvar_type;
|
||||
}
|
||||
|
||||
SWIGINTERN PyGetSetDescrObject *
|
||||
SwigPyStaticVar_new_getset(PyTypeObject *type, PyGetSetDef *getset) {
|
||||
|
||||
PyGetSetDescrObject *descr;
|
||||
descr = (PyGetSetDescrObject *)PyType_GenericAlloc(&SwigPyStaticVar_Type, 0);
|
||||
descr = (PyGetSetDescrObject *)PyType_GenericAlloc(SwigPyStaticVar_Type(), 0);
|
||||
assert(descr);
|
||||
Py_XINCREF(type);
|
||||
descr->d_type = type;
|
||||
descr->d_name = PyString_InternFromString(getset->name);
|
||||
PyDescr_TYPE(descr) = type;
|
||||
PyDescr_NAME(descr) = PyString_InternFromString(getset->name);
|
||||
descr->d_getset = getset;
|
||||
if (descr->d_name == NULL) {
|
||||
if (PyDescr_NAME(descr) == NULL) {
|
||||
Py_DECREF(descr);
|
||||
descr = NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -250,7 +250,7 @@ namespace Swig {
|
|||
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;
|
||||
<< "Exception is being re-thrown, program will likely abort/terminate." << std::endl;
|
||||
throw;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -206,3 +206,8 @@ typedef destructor freefunc;
|
|||
# define SWIGPY_USE_CAPSULE
|
||||
# define SWIGPY_CAPSULE_NAME ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME)
|
||||
#endif
|
||||
|
||||
#if PY_VERSION_HEX < 0x03020000
|
||||
#define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
|
||||
#define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name)
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ swig_varlink_type(void) {
|
|||
const PyTypeObject tmp = {
|
||||
/* PyObject header changed in Python 3 */
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
PyVarObject_HEAD_INIT(&PyType_Type, 0)
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
#else
|
||||
PyObject_HEAD_INIT(NULL)
|
||||
0, /* ob_size */
|
||||
|
|
@ -186,11 +186,13 @@ swig_varlink_type(void) {
|
|||
#endif
|
||||
};
|
||||
varlink_type = tmp;
|
||||
/* for Python 3 we already assigned ob_type in PyVarObject_HEAD_INIT() */
|
||||
#if PY_VERSION_HEX < 0x03000000
|
||||
varlink_type.ob_type = &PyType_Type;
|
||||
#endif
|
||||
type_init = 1;
|
||||
#if PY_VERSION_HEX < 0x02020000
|
||||
varlink_type.ob_type = &PyType_Type;
|
||||
#else
|
||||
if (PyType_Ready(&varlink_type) < 0)
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
return &varlink_type;
|
||||
}
|
||||
|
|
@ -325,7 +327,16 @@ SWIG_init(void) {
|
|||
PyObject *m, *d, *md;
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
static struct PyModuleDef SWIG_module = {
|
||||
# if PY_VERSION_HEX >= 0x03020000
|
||||
PyModuleDef_HEAD_INIT,
|
||||
# else
|
||||
{
|
||||
PyObject_HEAD_INIT(NULL)
|
||||
NULL, /* m_init */
|
||||
0, /* m_index */
|
||||
NULL, /* m_copy */
|
||||
},
|
||||
# endif
|
||||
(char *) SWIG_name,
|
||||
NULL,
|
||||
-1,
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ SWIG_AsVal_dec(bool)(PyObject *obj, bool *val)
|
|||
/* long */
|
||||
|
||||
%fragment(SWIG_From_frag(long),"header") {
|
||||
%define_as(SWIG_From_dec(long), PyInt_FromLong)
|
||||
%define_as(SWIG_From_dec(long), PyLong_FromLong)
|
||||
}
|
||||
|
||||
%fragment(SWIG_AsVal_frag(long),"header",
|
||||
|
|
@ -80,7 +80,7 @@ SWIGINTERNINLINE PyObject*
|
|||
SWIG_From_dec(unsigned long)(unsigned long value)
|
||||
{
|
||||
return (value > LONG_MAX) ?
|
||||
PyLong_FromUnsignedLong(value) : PyInt_FromLong(%numeric_cast(value,long));
|
||||
PyLong_FromUnsignedLong(value) : PyLong_FromLong(%numeric_cast(value,long));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -139,7 +139,7 @@ SWIGINTERNINLINE PyObject*
|
|||
SWIG_From_dec(long long)(long long value)
|
||||
{
|
||||
return ((value < LONG_MIN) || (value > LONG_MAX)) ?
|
||||
PyLong_FromLongLong(value) : PyInt_FromLong(%numeric_cast(value,long));
|
||||
PyLong_FromLongLong(value) : PyLong_FromLong(%numeric_cast(value,long));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -193,7 +193,7 @@ SWIGINTERNINLINE PyObject*
|
|||
SWIG_From_dec(unsigned long long)(unsigned long long value)
|
||||
{
|
||||
return (value > LONG_MAX) ?
|
||||
PyLong_FromUnsignedLongLong(value) : PyInt_FromLong(%numeric_cast(value,long));
|
||||
PyLong_FromUnsignedLongLong(value) : PyLong_FromLong(%numeric_cast(value,long));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1070,6 +1070,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj)
|
|||
return (SwigPyObject *) pyobj;
|
||||
|
||||
#ifdef SWIGPYTHON_BUILTIN
|
||||
(void)obj;
|
||||
# ifdef PyWeakref_CheckProxy
|
||||
if (PyWeakref_CheckProxy(pyobj)) {
|
||||
pyobj = PyWeakref_GET_OBJECT(pyobj);
|
||||
|
|
|
|||
|
|
@ -168,10 +168,6 @@
|
|||
swig::SwigPyIterator* iteritems(PyObject **PYTHON_SELF) {
|
||||
return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
|
||||
}
|
||||
|
||||
PyObject* asdict() {
|
||||
return swig::traits_from< Map >::asdict(*self);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
|
@ -292,14 +288,17 @@
|
|||
void __setitem__(const key_type& key) {
|
||||
self->erase(key);
|
||||
}
|
||||
}
|
||||
|
||||
%extend {
|
||||
void __setitem__(const key_type& key, const mapped_type& x) throw (std::out_of_range) {
|
||||
(*self)[key] = x;
|
||||
}
|
||||
|
||||
PyObject* asdict() {
|
||||
return swig::traits_from< Map >::asdict(*self);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
%enddef
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -34,52 +34,7 @@
|
|||
|
||||
*/
|
||||
|
||||
namespace swig {
|
||||
|
||||
%nodirector GC_VALUE;
|
||||
|
||||
// We ignore the constructor so that user can never create a GC_VALUE
|
||||
// manually
|
||||
%ignore GC_VALUE::GC_VALUE;
|
||||
|
||||
struct GC_VALUE {
|
||||
VALUE inspect() const;
|
||||
VALUE to_s() const;
|
||||
GC_VALUE();
|
||||
protected:
|
||||
GC_VALUE( const GC_VALUE& );
|
||||
~GC_VALUE();
|
||||
};
|
||||
|
||||
%exception GC_VALUE {};
|
||||
|
||||
|
||||
%apply VALUE {GC_VALUE};
|
||||
|
||||
// Make sure this is the last typecheck done
|
||||
%typecheck(999999,noblock=1) GC_VALUE, GC_VALUE&,
|
||||
const GC_VALUE& { $1 = 1; };
|
||||
|
||||
/* For input */
|
||||
%typemap(in,noblock=1) GC_VALUE* (GC_VALUE r), GC_VALUE& (GC_VALUE r) {
|
||||
r = $input; $1 = &r;
|
||||
}
|
||||
|
||||
/* For output */
|
||||
%typemap(out,noblock=1) GC_VALUE {
|
||||
$result = (VALUE)$1;
|
||||
}
|
||||
|
||||
%typemap(out,noblock=1) GC_VALUE*, GC_VALUE const & {
|
||||
$result = (VALUE)*$1;
|
||||
}
|
||||
|
||||
%ignore LANGUAGE_OBJ;
|
||||
typedef GC_VALUE LANGUAGE_OBJ;
|
||||
}
|
||||
|
||||
|
||||
%{
|
||||
%fragment("GC_VALUE_definition","header") {
|
||||
namespace swig {
|
||||
class GC_VALUE {
|
||||
protected:
|
||||
|
|
@ -213,7 +168,7 @@ namespace swig {
|
|||
}
|
||||
|
||||
|
||||
#define GC_VALUE_CMP( op_id, op, cmp, cmpval ) \
|
||||
%#define GC_VALUE_CMP( op_id, op, cmp, cmpval ) \
|
||||
bool op( const GC_VALUE& other ) const \
|
||||
{ \
|
||||
if ( FIXNUM_P(_obj) && FIXNUM_P(other._obj) ) \
|
||||
|
|
@ -253,14 +208,14 @@ namespace swig {
|
|||
GC_VALUE_CMP( le_id, operator<=, <=, <= 0 )
|
||||
GC_VALUE_CMP( gt_id, operator>, > , > 0 )
|
||||
GC_VALUE_CMP( ge_id, operator>=, >=, >= 0 )
|
||||
#undef GC_VALUE_CMP
|
||||
%#undef GC_VALUE_CMP
|
||||
|
||||
bool operator!=( const GC_VALUE& other )
|
||||
{
|
||||
return !(this->operator==(other));
|
||||
}
|
||||
|
||||
#define GC_VALUE_UNARY( proc_id, op ) \
|
||||
%#define GC_VALUE_UNARY( proc_id, op ) \
|
||||
GC_VALUE op() const \
|
||||
{ \
|
||||
VALUE ret = Qnil; \
|
||||
|
|
@ -280,9 +235,9 @@ namespace swig {
|
|||
GC_VALUE_UNARY( pos_id, operator+ )
|
||||
GC_VALUE_UNARY( neg_id, operator- )
|
||||
GC_VALUE_UNARY( inv_id, operator~ )
|
||||
#undef GC_VALUE_BINARY
|
||||
%#undef GC_VALUE_BINARY
|
||||
|
||||
#define GC_VALUE_BINARY( proc_id, op ) \
|
||||
%#define GC_VALUE_BINARY( proc_id, op ) \
|
||||
GC_VALUE op( const GC_VALUE& other ) const \
|
||||
{ \
|
||||
VALUE ret = Qnil; \
|
||||
|
|
@ -311,7 +266,7 @@ namespace swig {
|
|||
|
||||
GC_VALUE_BINARY( lshift_id, operator<< );
|
||||
GC_VALUE_BINARY( rshift_id, operator>> );
|
||||
#undef GC_VALUE_BINARY
|
||||
%#undef GC_VALUE_BINARY
|
||||
|
||||
};
|
||||
|
||||
|
|
@ -345,7 +300,53 @@ namespace swig {
|
|||
|
||||
} // namespace swig
|
||||
|
||||
%}
|
||||
} // %fragment(GC_VALUE_definition)
|
||||
|
||||
|
||||
|
||||
namespace swig {
|
||||
|
||||
%apply VALUE {GC_VALUE};
|
||||
|
||||
// Make sure this is the last typecheck done
|
||||
%typecheck(999999,fragment="GC_VALUE_definition",noblock=1) GC_VALUE, GC_VALUE&,
|
||||
const GC_VALUE& { $1 = 1; };
|
||||
|
||||
/* For input */
|
||||
%typemap(in,fragment="GC_VALUE_definition",noblock=1) GC_VALUE* (GC_VALUE r), GC_VALUE& (GC_VALUE r) {
|
||||
r = $input; $1 = &r;
|
||||
}
|
||||
|
||||
/* For output */
|
||||
%typemap(out,fragment="GC_VALUE_definition",noblock=1) GC_VALUE {
|
||||
$result = (VALUE)$1;
|
||||
}
|
||||
|
||||
%typemap(out,fragment="GC_VALUE_definition",noblock=1) GC_VALUE*, GC_VALUE const & {
|
||||
$result = (VALUE)*$1;
|
||||
}
|
||||
|
||||
%nodirector GC_VALUE;
|
||||
|
||||
// We ignore the constructor so that user can never create a GC_VALUE
|
||||
// manually
|
||||
%ignore GC_VALUE::GC_VALUE;
|
||||
|
||||
struct GC_VALUE {
|
||||
VALUE inspect() const;
|
||||
VALUE to_s() const;
|
||||
GC_VALUE();
|
||||
protected:
|
||||
GC_VALUE( const GC_VALUE& );
|
||||
~GC_VALUE();
|
||||
};
|
||||
|
||||
%exception GC_VALUE {};
|
||||
|
||||
|
||||
%ignore LANGUAGE_OBJ;
|
||||
typedef GC_VALUE LANGUAGE_OBJ;
|
||||
}
|
||||
|
||||
|
||||
%init {
|
||||
|
|
@ -359,7 +360,7 @@ namespace swig {
|
|||
// These functions may be invoked as a need of the from(), asval(),
|
||||
// asptr() and as() template functors, usually used in %typemaps.
|
||||
//
|
||||
%fragment(SWIG_Traits_frag(swig::GC_VALUE),"header",fragment="StdTraits") {
|
||||
%fragment(SWIG_Traits_frag(swig::GC_VALUE),"header",fragment="StdTraits",fragment="GC_VALUE_definition") {
|
||||
namespace swig {
|
||||
template <> struct traits<GC_VALUE > {
|
||||
typedef value_category category;
|
||||
|
|
|
|||
|
|
@ -972,7 +972,8 @@ namespace swig
|
|||
|
||||
%fragment("StdSequenceTraits","header",
|
||||
fragment="StdTraits",
|
||||
fragment="RubySequence_Cont")
|
||||
fragment="RubySequence_Cont",
|
||||
fragment="GC_VALUE_definition")
|
||||
{
|
||||
namespace swig {
|
||||
template <class RubySeq, class Seq>
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
%include <std_common.i>
|
||||
|
||||
|
||||
%fragment("ConstIterator","header") {
|
||||
%fragment("ConstIterator","header",fragment="GC_VALUE_definition") {
|
||||
namespace swig {
|
||||
struct stop_iteration {
|
||||
};
|
||||
|
|
|
|||
|
|
@ -200,66 +200,3 @@ namespace swig {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Define GC marking template traits for a container type
|
||||
%define %create_mark_traits(Type)
|
||||
%{
|
||||
namespace swig {
|
||||
template <class T>
|
||||
struct mark_traits {
|
||||
typedef typename Type<T >::const_iterator const_iterator;
|
||||
|
||||
inline void operator()(const Type<T >& c ) const
|
||||
{
|
||||
const_iterator i = c.begin();
|
||||
const_iterator e = c.end();
|
||||
for ( ; i != e; ++i )
|
||||
{
|
||||
rb_gc_mark( swig::from( &(*i) ) );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Partial specializations for classes that requires no GC marking
|
||||
// or a special GC marking algorithm.
|
||||
template< >
|
||||
struct mark_traits<bool> {
|
||||
inline void operator()(const Type<bool >& c ) const {}
|
||||
};
|
||||
|
||||
template< >
|
||||
struct mark_traits<char> {
|
||||
inline void operator()(const Type<char >& c ) const {}
|
||||
};
|
||||
|
||||
template< >
|
||||
struct mark_traits<int> {
|
||||
inline void operator()(const Type<int >& c ) const {}
|
||||
};
|
||||
|
||||
template< >
|
||||
struct mark_traits<unsigned> {
|
||||
inline void operator()(const Type<unsigned >& c ) const {}
|
||||
};
|
||||
|
||||
template< >
|
||||
struct mark_traits<GC_VALUE> {
|
||||
typedef Type<GC_VALUE >::const_iterator const_iterator;
|
||||
|
||||
inline void operator()(const Type<GC_VALUE >& c ) const {
|
||||
const_iterator i = c.begin();
|
||||
const_iterator e = c.end();
|
||||
for ( ; i != e; ++i )
|
||||
{
|
||||
VALUE v = *i;
|
||||
if ( FIXNUM_P(v) || SPECIAL_CONST_P(v) || SYMBOL_P(v) ||
|
||||
( BUILTIN_TYPE(v) == T_NONE ) ) continue;
|
||||
|
||||
rb_gc_mark( v );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
%}
|
||||
%enddef
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ namespace swig {
|
|||
}
|
||||
|
||||
|
||||
%fragment("StdFunctors","header",fragment="StdTraits")
|
||||
%fragment("StdFunctors","header",fragment="StdTraits",fragment="GC_VALUE_definition")
|
||||
{
|
||||
namespace swig {
|
||||
|
||||
|
|
|
|||
|
|
@ -500,12 +500,6 @@ namespace std {
|
|||
}
|
||||
}
|
||||
|
||||
/* Typemap for variable length arguments sentinel value. Used
|
||||
by the %varargs directive. */
|
||||
|
||||
%typemap(in,numinputs=0) SWIGTYPE *VARARGS_SENTINEL, SWIGTYPE VARARGS_SENTINEL "";
|
||||
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Overloading support
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
|
|
|||
|
|
@ -277,7 +277,7 @@ SWIG_Tcl_SetModule(Tcl_Interp *interp, swig_module_info *module) {
|
|||
/* create a new pointer */
|
||||
data = SWIG_PackData(buf, &module, sizeof(swig_type_info **));
|
||||
*data = 0;
|
||||
Tcl_SetVar(interp, (char *)"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, buf, 0);
|
||||
Tcl_SetVar(interp, (char *)"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, buf, TCL_GLOBAL_ONLY);
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------*
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* ------------------------------------------------------------ */
|
||||
|
||||
/*
|
||||
in Tcl we need to pass the interp value, so, we define the decl/call
|
||||
In Tcl we need to pass the interp value, so we define the decl/call
|
||||
macros as needed.
|
||||
*/
|
||||
|
||||
|
|
@ -15,13 +15,13 @@
|
|||
#define SWIG_AS_CALL_ARGS SWIG_TCL_CALL_ARGS_2
|
||||
|
||||
|
||||
/* Include fundamental fragemt definitions */
|
||||
/* Include fundamental fragment definitions */
|
||||
%include <typemaps/fragments.swg>
|
||||
|
||||
/* Look for user fragments file. */
|
||||
%include <tclfragments.swg>
|
||||
|
||||
/* Tcl fragments for primitve types */
|
||||
/* Tcl fragments for primitive types */
|
||||
%include <tclprimtypes.swg>
|
||||
|
||||
/* Tcl fragments for char* strings */
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
* Unified typemap section
|
||||
* ------------------------------------------------------------ */
|
||||
|
||||
/* No director supported in Tcl */
|
||||
/* No director support in Tcl */
|
||||
#ifdef SWIG_DIRECTOR_TYPEMAPS
|
||||
#undef SWIG_DIRECTOR_TYPEMAPS
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@
|
|||
|
||||
which can always be redefined in the swig target language if needed.
|
||||
|
||||
The fragments for the following types, however, need to be defined
|
||||
in the target language always:
|
||||
The fragments for the following types, however, always need to be
|
||||
defined in the target language:
|
||||
|
||||
long
|
||||
unsigned long
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
%typemaps_primitive(CheckCode, Type)
|
||||
|
||||
which generate the typemaps for a primitive type with a given
|
||||
which generates the typemaps for a primitive type with a given
|
||||
checkcode. It is assumed that the primitive type is 'normalized' and
|
||||
the corresponding SWIG_AsVal(Type) and SWIG_From(Type) methods are
|
||||
provided via fragments.
|
||||
|
|
|
|||
|
|
@ -559,11 +559,6 @@
|
|||
* --- Special typemaps ---
|
||||
* ------------------------------------------------------------ */
|
||||
|
||||
/* VARARGS_SENTINEL typemap. Used by the %varargs directive. */
|
||||
|
||||
%typemap(in,numinputs=0) SWIGTYPE *VARARGS_SENTINEL, SWIGTYPE VARARGS_SENTINEL "";
|
||||
|
||||
|
||||
/* DISOWN typemap */
|
||||
|
||||
%typemap(in, noblock=1) SWIGTYPE *DISOWN (int res = 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue