Fix varargs.
Allow manual construction of entire result octave_value_list. Make octrun.swg conform to style conventions. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10316 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
b697a8fc75
commit
fe15a5a87c
3 changed files with 1146 additions and 1006 deletions
|
|
@ -17,17 +17,28 @@ SWIGRUNTIME octave_value_list* SWIG_Octave_AppendOutput(octave_value_list* ovl,c
|
||||||
|
|
||||||
SWIGRUNTIME octave_value SWIG_ErrorType(int code) {
|
SWIGRUNTIME octave_value SWIG_ErrorType(int code) {
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case SWIG_MemoryError: return "SWIG_MemoryError";
|
case SWIG_MemoryError:
|
||||||
case SWIG_IOError: return "SWIG_IOError";
|
return "SWIG_MemoryError";
|
||||||
case SWIG_RuntimeError: return "SWIG_RuntimeError";
|
case SWIG_IOError:
|
||||||
case SWIG_IndexError: return "SWIG_IndexError";
|
return "SWIG_IOError";
|
||||||
case SWIG_TypeError: return "SWIG_TypeError";
|
case SWIG_RuntimeError:
|
||||||
case SWIG_DivisionByZero: return "SWIG_DivisionByZero";
|
return "SWIG_RuntimeError";
|
||||||
case SWIG_OverflowError: return "SWIG_OverflowError";
|
case SWIG_IndexError:
|
||||||
case SWIG_SyntaxError: return "SWIG_SyntaxError";
|
return "SWIG_IndexError";
|
||||||
case SWIG_ValueError: return "SWIG_ValueError";
|
case SWIG_TypeError:
|
||||||
case SWIG_SystemError: return "SWIG_SystemError";
|
return "SWIG_TypeError";
|
||||||
case SWIG_AttributeError: return "SWIG_AttributeError";
|
case SWIG_DivisionByZero:
|
||||||
|
return "SWIG_DivisionByZero";
|
||||||
|
case SWIG_OverflowError:
|
||||||
|
return "SWIG_OverflowError";
|
||||||
|
case SWIG_SyntaxError:
|
||||||
|
return "SWIG_SyntaxError";
|
||||||
|
case SWIG_ValueError:
|
||||||
|
return "SWIG_ValueError";
|
||||||
|
case SWIG_SystemError:
|
||||||
|
return "SWIG_SystemError";
|
||||||
|
case SWIG_AttributeError:
|
||||||
|
return "SWIG_AttributeError";
|
||||||
}
|
}
|
||||||
return "SWIG unknown error";
|
return "SWIG unknown error";
|
||||||
}
|
}
|
||||||
|
|
@ -126,12 +137,15 @@ namespace Swig {
|
||||||
module->clientdata = new rtdir_map;
|
module->clientdata = new rtdir_map;
|
||||||
return *(rtdir_map *) module->clientdata;
|
return *(rtdir_map *) module->clientdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
SWIGINTERNINLINE void set_rtdir(void *vptr, Director *d) {
|
SWIGINTERNINLINE void set_rtdir(void *vptr, Director *d) {
|
||||||
get_rtdir_map()[vptr] = d;
|
get_rtdir_map()[vptr] = d;
|
||||||
}
|
}
|
||||||
|
|
||||||
SWIGINTERNINLINE void erase_rtdir(void *vptr) {
|
SWIGINTERNINLINE void erase_rtdir(void *vptr) {
|
||||||
get_rtdir_map().erase(vptr);
|
get_rtdir_map().erase(vptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
SWIGINTERNINLINE Director *get_rtdir(void *vptr) {
|
SWIGINTERNINLINE Director *get_rtdir(void *vptr) {
|
||||||
rtdir_map::const_iterator pos = get_rtdir_map().find(vptr);
|
rtdir_map::const_iterator pos = get_rtdir_map().find(vptr);
|
||||||
Director *rtdir = (pos != get_rtdir_map().end())? pos->second : 0;
|
Director *rtdir = (pos != get_rtdir_map().end())? pos->second : 0;
|
||||||
|
|
@ -148,11 +162,11 @@ struct swig_octave_member {
|
||||||
const char *doc;
|
const char *doc;
|
||||||
bool is_static() const {
|
bool is_static() const {
|
||||||
return flags &1;
|
return flags &1;
|
||||||
}
|
} bool is_global() const {
|
||||||
bool is_global() const {
|
|
||||||
return flags &2;
|
return flags &2;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct swig_octave_class {
|
struct swig_octave_class {
|
||||||
const char *name;
|
const char *name;
|
||||||
swig_type_info **type;
|
swig_type_info **type;
|
||||||
|
|
@ -175,8 +189,8 @@ class octave_swig_type : public octave_base_value {
|
||||||
struct cpp_ptr {
|
struct cpp_ptr {
|
||||||
void *ptr;
|
void *ptr;
|
||||||
bool destroyed;
|
bool destroyed;
|
||||||
cpp_ptr(void* _ptr) : ptr(_ptr),destroyed(false) {}
|
cpp_ptr(void *_ptr):ptr(_ptr), destroyed(false) {
|
||||||
};
|
}};
|
||||||
typedef std::pair < const swig_type_info *, cpp_ptr > type_ptr_pair;
|
typedef std::pair < const swig_type_info *, cpp_ptr > type_ptr_pair;
|
||||||
|
|
||||||
swig_module_info *module;
|
swig_module_info *module;
|
||||||
|
|
@ -189,8 +203,7 @@ class octave_swig_type : public octave_base_value {
|
||||||
typedef std::map < std::string, member_value_pair > member_map;
|
typedef std::map < std::string, member_value_pair > member_map;
|
||||||
member_map members;
|
member_map members;
|
||||||
|
|
||||||
const swig_octave_member* find_member(const swig_type_info* type,
|
const swig_octave_member *find_member(const swig_type_info *type, const std::string &name) {
|
||||||
const std::string& name) {
|
|
||||||
if (!type->clientdata)
|
if (!type->clientdata)
|
||||||
return 0;
|
return 0;
|
||||||
swig_octave_class *c = (swig_octave_class *) type->clientdata;
|
swig_octave_class *c = (swig_octave_class *) type->clientdata;
|
||||||
|
|
@ -203,8 +216,7 @@ class octave_swig_type : public octave_base_value {
|
||||||
if (!module)
|
if (!module)
|
||||||
module = SWIG_GetModule(0);
|
module = SWIG_GetModule(0);
|
||||||
assert(module);
|
assert(module);
|
||||||
c->base[j]=SWIG_MangledTypeQueryModule
|
c->base[j] = SWIG_MangledTypeQueryModule(module, module, c->base_names[j]);
|
||||||
(module,module,c->base_names[j]);
|
|
||||||
}
|
}
|
||||||
if (!c->base[j])
|
if (!c->base[j])
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -214,23 +226,20 @@ class octave_swig_type : public octave_base_value {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
member_value_pair* find_member(const std::string& name,
|
member_value_pair *find_member(const std::string &name, bool insert_if_not_found) {
|
||||||
bool insert_if_not_found) {
|
|
||||||
member_map::iterator it = members.find(name);
|
member_map::iterator it = members.find(name);
|
||||||
if (it != members.end())
|
if (it != members.end())
|
||||||
return &it->second;
|
return &it->second;
|
||||||
const swig_octave_member *m;
|
const swig_octave_member *m;
|
||||||
for (unsigned int j = 0; j < types.size(); ++j)
|
for (unsigned int j = 0; j < types.size(); ++j)
|
||||||
if ((m = find_member(types[j].first, name)))
|
if ((m = find_member(types[j].first, name)))
|
||||||
return &members.insert
|
return &members.insert(std::make_pair(name, std::make_pair(m, octave_value()))).first->second;
|
||||||
(std::make_pair(name,std::make_pair(m,octave_value()))).first->second;
|
|
||||||
if (!insert_if_not_found)
|
if (!insert_if_not_found)
|
||||||
return 0;
|
return 0;
|
||||||
return &members[name];
|
return &members[name];
|
||||||
}
|
}
|
||||||
|
|
||||||
const swig_type_info* find_base(const std::string& name,
|
const swig_type_info *find_base(const std::string &name, const swig_type_info *base) {
|
||||||
const swig_type_info* base) {
|
|
||||||
if (!base) {
|
if (!base) {
|
||||||
for (unsigned int j = 0; j < types.size(); ++j) {
|
for (unsigned int j = 0; j < types.size(); ++j) {
|
||||||
assert(types[j].first->clientdata);
|
assert(types[j].first->clientdata);
|
||||||
|
|
@ -247,8 +256,7 @@ class octave_swig_type : public octave_base_value {
|
||||||
if (!module)
|
if (!module)
|
||||||
module = SWIG_GetModule(0);
|
module = SWIG_GetModule(0);
|
||||||
assert(module);
|
assert(module);
|
||||||
c->base[j]=SWIG_MangledTypeQueryModule
|
c->base[j] = SWIG_MangledTypeQueryModule(module, module, c->base_names[j]);
|
||||||
(module,module,c->base_names[j]);
|
|
||||||
}
|
}
|
||||||
if (!c->base[j])
|
if (!c->base[j])
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -260,8 +268,7 @@ class octave_swig_type : public octave_base_value {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
octave_value_list member_invoke(member_value_pair* m,
|
octave_value_list member_invoke(member_value_pair *m, const octave_value_list &args, int nargout) {
|
||||||
const octave_value_list& args,int nargout) {
|
|
||||||
if (m->second.is_defined())
|
if (m->second.is_defined())
|
||||||
return m->second.subsref("(", std::list < octave_value_list > (1, args), nargout);
|
return m->second.subsref("(", std::list < octave_value_list > (1, args), nargout);
|
||||||
else if (m->first && m->first->method)
|
else if (m->first && m->first->method)
|
||||||
|
|
@ -270,8 +277,7 @@ class octave_swig_type : public octave_base_value {
|
||||||
return octave_value_list();
|
return octave_value_list();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dispatch_unary_op(const std::string& symbol,
|
bool dispatch_unary_op(const std::string &symbol, octave_value &ret) {
|
||||||
octave_value& ret) {
|
|
||||||
member_value_pair *m = find_member(symbol, false);
|
member_value_pair *m = find_member(symbol, false);
|
||||||
if (!m || m->first->is_static() || m->first->is_global())
|
if (!m || m->first->is_static() || m->first->is_global())
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -284,9 +290,7 @@ class octave_swig_type : public octave_base_value {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dispatch_binary_op(const std::string& symbol,
|
bool dispatch_binary_op(const std::string &symbol, const octave_base_value &rhs, octave_value &ret) {
|
||||||
const octave_base_value& rhs,
|
|
||||||
octave_value& ret) {
|
|
||||||
member_value_pair *m = find_member(symbol, false);
|
member_value_pair *m = find_member(symbol, false);
|
||||||
if (!m || m->first->is_static() || m->first->is_global())
|
if (!m || m->first->is_static() || m->first->is_global())
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -300,9 +304,7 @@ class octave_swig_type : public octave_base_value {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dispatch_index_op(const std::string& symbol,
|
bool dispatch_index_op(const std::string &symbol, const octave_value_list &rhs, octave_value_list &ret) {
|
||||||
const octave_value_list& rhs,
|
|
||||||
octave_value_list& ret) {
|
|
||||||
member_value_pair *m = find_member(symbol, false);
|
member_value_pair *m = find_member(symbol, false);
|
||||||
if (!m || m->first->is_static() || m->first->is_global())
|
if (!m || m->first->is_static() || m->first->is_global())
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -315,8 +317,7 @@ class octave_swig_type : public octave_base_value {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
octave_value_list member_deref(member_value_pair* m,
|
octave_value_list member_deref(member_value_pair *m, const octave_value_list &args) {
|
||||||
const octave_value_list& args) {
|
|
||||||
if (m->second.is_defined())
|
if (m->second.is_defined())
|
||||||
return m->second;
|
return m->second;
|
||||||
else if (m->first) {
|
else if (m->first) {
|
||||||
|
|
@ -337,6 +338,7 @@ class octave_swig_type : public octave_base_value {
|
||||||
octave_swig_type(const octave_swig_type &x);
|
octave_swig_type(const octave_swig_type &x);
|
||||||
octave_swig_type &operator=(const octave_swig_type &rhs);
|
octave_swig_type &operator=(const octave_swig_type &rhs);
|
||||||
public:
|
public:
|
||||||
|
|
||||||
octave_swig_type(void *_ptr = 0, const swig_type_info *_type = 0, int _own = 0)
|
octave_swig_type(void *_ptr = 0, const swig_type_info *_type = 0, int _own = 0)
|
||||||
: module(0), construct_type(_ptr ? 0 : _type), own(_own) {
|
: module(0), construct_type(_ptr ? 0 : _type), own(_own) {
|
||||||
if (_type || _ptr)
|
if (_type || _ptr)
|
||||||
|
|
@ -347,6 +349,7 @@ class octave_swig_type : public octave_base_value {
|
||||||
Swig::swig_director_set_self(d, this);
|
Swig::swig_director_set_self(d, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
~octave_swig_type() {
|
~octave_swig_type() {
|
||||||
if (own) {
|
if (own) {
|
||||||
++count;
|
++count;
|
||||||
|
|
@ -354,8 +357,7 @@ class octave_swig_type : public octave_base_value {
|
||||||
if (!types[j].first || !types[j].first->clientdata)
|
if (!types[j].first || !types[j].first->clientdata)
|
||||||
continue;
|
continue;
|
||||||
swig_octave_class *c = (swig_octave_class *) types[j].first->clientdata;
|
swig_octave_class *c = (swig_octave_class *) types[j].first->clientdata;
|
||||||
if (c->destructor&&!types[j].second.destroyed&&
|
if (c->destructor && !types[j].second.destroyed && types[j].second.ptr) {
|
||||||
types[j].second.ptr) {
|
|
||||||
c->destructor(as_value(), 0);
|
c->destructor(as_value(), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -368,9 +370,11 @@ class octave_swig_type : public octave_base_value {
|
||||||
++count;
|
++count;
|
||||||
return Swig::swig_value_ref(this);
|
return Swig::swig_value_ref(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void incref() {
|
void incref() {
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
|
|
||||||
void decref() {
|
void decref() {
|
||||||
if (!--count)
|
if (!--count)
|
||||||
delete this;
|
delete this;
|
||||||
|
|
@ -381,6 +385,7 @@ class octave_swig_type : public octave_base_value {
|
||||||
return (long) this;
|
return (long) this;
|
||||||
return (long) types[0].second.ptr;
|
return (long) types[0].second.ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string swig_type_name() const {
|
std::string swig_type_name() const {
|
||||||
// * need some way to manually name subclasses.
|
// * need some way to manually name subclasses.
|
||||||
// * eg optional first arg to subclass(), or named_subclass()
|
// * eg optional first arg to subclass(), or named_subclass()
|
||||||
|
|
@ -396,6 +401,7 @@ class octave_swig_type : public octave_base_value {
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void merge(octave_swig_type &rhs) {
|
void merge(octave_swig_type &rhs) {
|
||||||
rhs.own = 0;
|
rhs.own = 0;
|
||||||
for (unsigned int j = 0; j < rhs.types.size(); ++j) {
|
for (unsigned int j = 0; j < rhs.types.size(); ++j) {
|
||||||
|
|
@ -409,6 +415,7 @@ class octave_swig_type : public octave_base_value {
|
||||||
rhs.types.clear();
|
rhs.types.clear();
|
||||||
rhs.members.clear();
|
rhs.members.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void install_global() {
|
void install_global() {
|
||||||
for (member_map::const_iterator it = members.begin(); it != members.end(); ++it) {
|
for (member_map::const_iterator it = members.begin(); it != members.end(); ++it) {
|
||||||
if (it->second.first && it->second.first->method)
|
if (it->second.first && it->second.first->method)
|
||||||
|
|
@ -420,6 +427,7 @@ class octave_swig_type : public octave_base_value {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void *cast(swig_type_info *type, int *_own, int flags) {
|
void *cast(swig_type_info *type, int *_own, int flags) {
|
||||||
if (_own)
|
if (_own)
|
||||||
*_own = own;
|
*_own = own;
|
||||||
|
|
@ -441,9 +449,11 @@ class octave_swig_type : public octave_base_value {
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_owned() const {
|
bool is_owned() const {
|
||||||
return own;
|
return own;
|
||||||
}
|
}
|
||||||
|
|
||||||
void director_destroyed(Swig::Director *d) {
|
void director_destroyed(Swig::Director *d) {
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (unsigned int j = 0; j < types.size(); ++j) {
|
for (unsigned int j = 0; j < types.size(); ++j) {
|
||||||
|
|
@ -459,6 +469,7 @@ class octave_swig_type : public octave_base_value {
|
||||||
void assign(const std::string &name, const octave_value &ov) {
|
void assign(const std::string &name, const octave_value &ov) {
|
||||||
members[name] = std::make_pair((const swig_octave_member *) 0, ov);
|
members[name] = std::make_pair((const swig_octave_member *) 0, ov);
|
||||||
}
|
}
|
||||||
|
|
||||||
void assign(const std::string &name, const swig_octave_member *m) {
|
void assign(const std::string &name, const swig_octave_member *m) {
|
||||||
members[name] = std::make_pair(m, octave_value());
|
members[name] = std::make_pair(m, octave_value());
|
||||||
}
|
}
|
||||||
|
|
@ -466,26 +477,29 @@ class octave_swig_type : public octave_base_value {
|
||||||
octave_base_value *clone() const {
|
octave_base_value *clone() const {
|
||||||
// pass-by-value is probably not desired, and is harder;
|
// pass-by-value is probably not desired, and is harder;
|
||||||
// requires calling copy constructors of contained types etc.
|
// requires calling copy constructors of contained types etc.
|
||||||
assert(0); *(int*)0=0; return 0;
|
assert(0);
|
||||||
|
*(int *) 0 = 0;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
octave_base_value *empty_clone() const {
|
octave_base_value *empty_clone() const {
|
||||||
return new octave_swig_type();
|
return new octave_swig_type();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_defined() const {
|
bool is_defined() const {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool is_map() const {
|
virtual bool is_map() const {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual octave_value subsref(const std::string& ops,
|
virtual octave_value subsref(const std::string &ops, const std::list < octave_value_list > &idx) {
|
||||||
const std::list<octave_value_list>& idx) {
|
|
||||||
octave_value_list ovl = subsref(ops, idx, 1);
|
octave_value_list ovl = subsref(ops, idx, 1);
|
||||||
return ovl.length()? ovl(0) : octave_value();
|
return ovl.length()? ovl(0) : octave_value();
|
||||||
}
|
}
|
||||||
virtual octave_value_list subsref(const std::string& ops,
|
|
||||||
const std::list<octave_value_list>& idx,
|
virtual octave_value_list subsref(const std::string &ops, const std::list < octave_value_list > &idx, int nargout) {
|
||||||
int nargout) {
|
|
||||||
assert(ops.size() > 0);
|
assert(ops.size() > 0);
|
||||||
assert(ops.size() == idx.size());
|
assert(ops.size() == idx.size());
|
||||||
|
|
||||||
|
|
@ -503,13 +517,11 @@ class octave_swig_type : public octave_base_value {
|
||||||
}
|
}
|
||||||
octave_value_list args;
|
octave_value_list args;
|
||||||
if (c->director)
|
if (c->director)
|
||||||
args.append(Swig::swig_value_ref
|
args.append(Swig::swig_value_ref(new octave_swig_type(this, 0, 0)));
|
||||||
(new octave_swig_type(this,0,0)));
|
|
||||||
args.append(*idx_it++);
|
args.append(*idx_it++);
|
||||||
++skip;
|
++skip;
|
||||||
sub_ovl = c->constructor(args, nargout);
|
sub_ovl = c->constructor(args, nargout);
|
||||||
}
|
}
|
||||||
|
|
||||||
// member dereference or invocation
|
// member dereference or invocation
|
||||||
else if (ops[skip] == '.') {
|
else if (ops[skip] == '.') {
|
||||||
std::string subname;
|
std::string subname;
|
||||||
|
|
@ -517,8 +529,7 @@ class octave_swig_type : public octave_base_value {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
octave_value_list subname_ovl(*idx_it++);
|
octave_value_list subname_ovl(*idx_it++);
|
||||||
++skip;
|
++skip;
|
||||||
assert(subname_ovl.length()==1&&
|
assert(subname_ovl.length() == 1 && subname_ovl(0).is_string());
|
||||||
subname_ovl(0).is_string());
|
|
||||||
subname = subname_ovl(0).string_value();
|
subname = subname_ovl(0).string_value();
|
||||||
|
|
||||||
const swig_type_info *next_base = find_base(subname, base);
|
const swig_type_info *next_base = find_base(subname, base);
|
||||||
|
|
@ -536,12 +547,9 @@ class octave_swig_type : public octave_base_value {
|
||||||
}
|
}
|
||||||
|
|
||||||
octave_value_list args;
|
octave_value_list args;
|
||||||
if (!m->first||(!m->first->is_static()&&
|
if (!m->first || (!m->first->is_static() && !m->first->is_global()))
|
||||||
!m->first->is_global()))
|
|
||||||
args.append(as_value());
|
args.append(as_value());
|
||||||
if (skip<(int)ops.size()&&ops[skip]=='('&&
|
if (skip < (int) ops.size() &&ops[skip] == '(' && ((m->first && m->first->method) || m->second.is_function() || m->second.is_function_handle())) {
|
||||||
((m->first&&m->first->method)||m->second.is_function()||
|
|
||||||
m->second.is_function_handle())) {
|
|
||||||
args.append(*idx_it++);
|
args.append(*idx_it++);
|
||||||
++skip;
|
++skip;
|
||||||
sub_ovl = member_invoke(m, args, nargout);
|
sub_ovl = member_invoke(m, args, nargout);
|
||||||
|
|
@ -549,7 +557,6 @@ class octave_swig_type : public octave_base_value {
|
||||||
sub_ovl = member_deref(m, args);
|
sub_ovl = member_deref(m, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// index operator
|
// index operator
|
||||||
else {
|
else {
|
||||||
if (ops[skip] == '(' || ops[skip] == '{') {
|
if (ops[skip] == '(' || ops[skip] == '{') {
|
||||||
|
|
@ -576,9 +583,7 @@ class octave_swig_type : public octave_base_value {
|
||||||
return sub_ovl(0).next_subsref(nargout, ops, idx, skip);
|
return sub_ovl(0).next_subsref(nargout, ops, idx, skip);
|
||||||
}
|
}
|
||||||
|
|
||||||
octave_value subsasgn(const std::string& ops,
|
octave_value subsasgn(const std::string &ops, const std::list < octave_value_list > &idx, const octave_value &rhs) {
|
||||||
const std::list<octave_value_list>& idx,
|
|
||||||
const octave_value& rhs) {
|
|
||||||
assert(ops.size() > 0);
|
assert(ops.size() > 0);
|
||||||
assert(ops.size() == idx.size());
|
assert(ops.size() == idx.size());
|
||||||
|
|
||||||
|
|
@ -590,8 +595,7 @@ class octave_swig_type : public octave_base_value {
|
||||||
--last;
|
--last;
|
||||||
std::list < octave_value_list > next_idx(idx.begin(), last);
|
std::list < octave_value_list > next_idx(idx.begin(), last);
|
||||||
octave_value next_ov = subsref(ops.substr(0, ops.size() - 1), next_idx);
|
octave_value next_ov = subsref(ops.substr(0, ops.size() - 1), next_idx);
|
||||||
next_ov.subsasgn(ops.substr(ops.size()-1),
|
next_ov.subsasgn(ops.substr(ops.size() - 1), std::list < octave_value_list > (1, *last), rhs);
|
||||||
std::list<octave_value_list>(1,*last),rhs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (ops[skip] == '(' || ops[skip] == '{') {
|
else if (ops[skip] == '(' || ops[skip] == '{') {
|
||||||
|
|
@ -610,8 +614,7 @@ class octave_swig_type : public octave_base_value {
|
||||||
else if (ops[skip] == '.') {
|
else if (ops[skip] == '.') {
|
||||||
octave_value_list subname_ovl(*idx_it++);
|
octave_value_list subname_ovl(*idx_it++);
|
||||||
++skip;
|
++skip;
|
||||||
assert(subname_ovl.length()==1&&
|
assert(subname_ovl.length() == 1 &&subname_ovl(0).is_string());
|
||||||
subname_ovl(0).is_string());
|
|
||||||
std::string subname = subname_ovl(0).string_value();
|
std::string subname = subname_ovl(0).string_value();
|
||||||
|
|
||||||
member_value_pair *m = find_member(subname, true);
|
member_value_pair *m = find_member(subname, true);
|
||||||
|
|
@ -636,6 +639,7 @@ class octave_swig_type : public octave_base_value {
|
||||||
octave_swig_type *nc_this = const_cast < octave_swig_type *>(this);
|
octave_swig_type *nc_this = const_cast < octave_swig_type *>(this);
|
||||||
return !!nc_this->find_member("__str", false);
|
return !!nc_this->find_member("__str", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual std::string string_value(bool force = false) const {
|
virtual std::string string_value(bool force = false) const {
|
||||||
octave_swig_type *nc_this = const_cast < octave_swig_type *>(this);
|
octave_swig_type *nc_this = const_cast < octave_swig_type *>(this);
|
||||||
member_value_pair *m = nc_this->find_member("__str", false);
|
member_value_pair *m = nc_this->find_member("__str", false);
|
||||||
|
|
@ -643,27 +647,23 @@ class octave_swig_type : public octave_base_value {
|
||||||
error("__str method not defined");
|
error("__str method not defined");
|
||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
octave_value_list outarg=nc_this->member_invoke
|
octave_value_list outarg = nc_this->member_invoke(m, octave_value_list(nc_this->as_value()), 1);
|
||||||
(m,octave_value_list(nc_this->as_value()),1);
|
|
||||||
if (outarg.length() < 1 || !outarg(0).is_string()) {
|
if (outarg.length() < 1 || !outarg(0).is_string()) {
|
||||||
error("__str method did not return a string");
|
error("__str method did not return a string");
|
||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
return outarg(0).string_value();
|
return outarg(0).string_value();
|
||||||
}
|
}
|
||||||
virtual octave_value
|
|
||||||
convert_to_str(bool pad=false,bool force=false,
|
virtual octave_value convert_to_str(bool pad = false, bool force = false, char type = '"') const {
|
||||||
char type='"') const {
|
|
||||||
return string_value();
|
|
||||||
}
|
|
||||||
virtual octave_value
|
|
||||||
convert_to_str_internal(bool pad,bool force,char type) const {
|
|
||||||
return string_value();
|
return string_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool dispatch_global_op(const std::string& symbol,
|
virtual octave_value convert_to_str_internal(bool pad, bool force, char type) const {
|
||||||
const octave_value_list& args,
|
return string_value();
|
||||||
octave_value& ret) {
|
}
|
||||||
|
|
||||||
|
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 "op_"-prefixed functions are installed in global namespace
|
||||||
// (rather than any module namespace).
|
// (rather than any module namespace).
|
||||||
|
|
||||||
|
|
@ -674,8 +674,7 @@ class octave_swig_type : public octave_base_value {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static octave_value dispatch_unary_op(const octave_base_value& x,
|
static octave_value dispatch_unary_op(const octave_base_value &x, const char *op_name) {
|
||||||
const char* op_name) {
|
|
||||||
octave_swig_type *ost = Swig::swig_value_deref(x);
|
octave_swig_type *ost = Swig::swig_value_deref(x);
|
||||||
assert(ost);
|
assert(ost);
|
||||||
|
|
||||||
|
|
@ -692,15 +691,12 @@ class octave_swig_type : public octave_base_value {
|
||||||
return octave_value();
|
return octave_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
static octave_value dispatch_binary_op(const octave_base_value& lhs,
|
static octave_value dispatch_binary_op(const octave_base_value &lhs, const octave_base_value &rhs, const char *op_name) {
|
||||||
const octave_base_value& rhs,
|
|
||||||
const char* op_name) {
|
|
||||||
octave_swig_type *lhs_ost = Swig::swig_value_deref(lhs);
|
octave_swig_type *lhs_ost = Swig::swig_value_deref(lhs);
|
||||||
octave_swig_type *rhs_ost = Swig::swig_value_deref(rhs);
|
octave_swig_type *rhs_ost = Swig::swig_value_deref(rhs);
|
||||||
|
|
||||||
octave_value ret;
|
octave_value ret;
|
||||||
if (lhs_ost&&
|
if (lhs_ost && lhs_ost->dispatch_binary_op(std::string("__") + op_name, rhs, ret))
|
||||||
lhs_ost->dispatch_binary_op(std::string("__")+op_name,rhs,ret))
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
std::string symbol;
|
std::string symbol;
|
||||||
|
|
@ -757,10 +753,8 @@ class octave_swig_type : public octave_base_value {
|
||||||
for (member_map::const_iterator it = members.begin(); it != members.end(); ++it) {
|
for (member_map::const_iterator it = members.begin(); it != members.end(); ++it) {
|
||||||
if (it->second.first) {
|
if (it->second.first) {
|
||||||
const char *objtype = it->second.first->method ? "method" : "variable";
|
const char *objtype = it->second.first->method ? "method" : "variable";
|
||||||
const char* modifier=(it->second.first->flags&1)?"static":
|
const char *modifier = (it->second.first->flags &1) ? "static" : (it->second.first->flags &2) ? "global" : "";
|
||||||
(it->second.first->flags&2)?"global":"";
|
os << it->second.first->name << " (c++ " << modifier << " " << objtype << ")" << std::endl;
|
||||||
os<<it->second.first->name<<" (c++ "<<
|
|
||||||
modifier<<" "<<objtype<<")"<<std::endl;
|
|
||||||
assert(it->second.first->name == it->first);
|
assert(it->second.first->name == it->first);
|
||||||
} else {
|
} else {
|
||||||
os << it->first << " (octave value)" << std::endl;
|
os << it->first << " (octave value)" << std::endl;
|
||||||
|
|
@ -785,63 +779,54 @@ class octave_swig_type : public octave_base_value {
|
||||||
class octave_swig_ref:public octave_base_value {
|
class octave_swig_ref:public octave_base_value {
|
||||||
octave_swig_type *ptr;
|
octave_swig_type *ptr;
|
||||||
public:
|
public:
|
||||||
octave_swig_ref(octave_swig_type* _ptr=0) : ptr(_ptr) {}
|
octave_swig_ref(octave_swig_type *_ptr = 0)
|
||||||
~octave_swig_ref() {
|
:ptr(_ptr) { }
|
||||||
if (ptr)
|
|
||||||
ptr->decref();
|
~octave_swig_ref()
|
||||||
}
|
{ if (ptr) ptr->decref(); }
|
||||||
octave_swig_type* get_ptr() const {
|
|
||||||
return ptr;
|
octave_swig_type *get_ptr() const
|
||||||
}
|
{ return ptr; }
|
||||||
octave_base_value *clone() const {
|
|
||||||
if (ptr)
|
octave_base_value *clone() const
|
||||||
ptr->incref();
|
{ if (ptr) ptr->incref(); return new octave_swig_ref(ptr); }
|
||||||
return new octave_swig_ref(ptr);
|
|
||||||
}
|
octave_base_value *empty_clone() const
|
||||||
octave_base_value *empty_clone() const {
|
{ return new octave_swig_ref(0); }
|
||||||
return new octave_swig_ref(0);
|
|
||||||
}
|
bool is_defined() const
|
||||||
bool is_defined() const {
|
{ return ptr->is_defined(); }
|
||||||
return ptr->is_defined();
|
|
||||||
}
|
virtual bool is_map() const
|
||||||
virtual bool is_map() const {
|
{ return ptr->is_map(); }
|
||||||
return ptr->is_map();
|
|
||||||
}
|
virtual octave_value subsref(const std::string &ops, const std::list < octave_value_list > &idx)
|
||||||
virtual octave_value subsref(const std::string& ops,
|
{ return ptr->subsref(ops, idx); }
|
||||||
const std::list<octave_value_list>& idx) {
|
|
||||||
return ptr->subsref(ops,idx);
|
virtual octave_value_list subsref(const std::string &ops, const std::list < octave_value_list > &idx, int nargout)
|
||||||
}
|
{ return ptr->subsref(ops, idx, nargout); }
|
||||||
virtual octave_value_list subsref(const std::string& ops,
|
|
||||||
const std::list<octave_value_list>& idx,
|
octave_value subsasgn(const std::string &ops, const std::list < octave_value_list > &idx, const octave_value &rhs)
|
||||||
int nargout) {
|
{ return ptr->subsasgn(ops, idx, rhs); }
|
||||||
return ptr->subsref(ops,idx,nargout);
|
|
||||||
}
|
virtual bool is_string() const
|
||||||
octave_value subsasgn(const std::string& ops,
|
{ return ptr->is_string(); }
|
||||||
const std::list<octave_value_list>& idx,
|
|
||||||
const octave_value& rhs) {
|
virtual std::string string_value(bool force = false) const
|
||||||
return ptr->subsasgn(ops,idx,rhs);
|
{ return ptr->string_value(force); }
|
||||||
}
|
|
||||||
virtual bool is_string() const {
|
virtual octave_value convert_to_str(bool pad = false, bool force = false, char type = '"') const
|
||||||
return ptr->is_string();
|
{ return ptr->convert_to_str(pad, force, type); }
|
||||||
}
|
|
||||||
virtual std::string string_value(bool force=false) const {
|
virtual octave_value convert_to_str_internal(bool pad, bool force, char type) const
|
||||||
return ptr->string_value(force);
|
{ return ptr->convert_to_str_internal(pad, force, type); }
|
||||||
}
|
|
||||||
virtual octave_value
|
void print(std::ostream &os, bool pr_as_read_syntax = false) const
|
||||||
convert_to_str(bool pad=false,bool force=false,
|
{ return ptr->print(os, pr_as_read_syntax); }
|
||||||
char type='"') const {
|
|
||||||
return ptr->convert_to_str(pad,force,type);
|
|
||||||
}
|
|
||||||
virtual octave_value
|
|
||||||
convert_to_str_internal(bool pad,bool force,char type) const {
|
|
||||||
return ptr->convert_to_str_internal(pad,force,type);
|
|
||||||
}
|
|
||||||
void print(std::ostream& os,bool pr_as_read_syntax=false) const {
|
|
||||||
return ptr->print(os,pr_as_read_syntax);
|
|
||||||
}
|
|
||||||
private:
|
private:
|
||||||
DECLARE_OCTAVE_ALLOCATOR
|
DECLARE_OCTAVE_ALLOCATOR;
|
||||||
DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
|
DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA;
|
||||||
};
|
};
|
||||||
DEFINE_OCTAVE_ALLOCATOR(octave_swig_ref);
|
DEFINE_OCTAVE_ALLOCATOR(octave_swig_ref);
|
||||||
DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(octave_swig_ref, "swig_ref", "swig_ref");
|
DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(octave_swig_ref, "swig_ref", "swig_ref");
|
||||||
|
|
@ -850,9 +835,11 @@ class octave_swig_packed : public octave_base_value {
|
||||||
swig_type_info *type;
|
swig_type_info *type;
|
||||||
std::vector < char > buf;
|
std::vector < char > buf;
|
||||||
public:
|
public:
|
||||||
octave_swig_packed(swig_type_info *_type=0,
|
|
||||||
const char* _buf=0,size_t _buf_len=0)
|
octave_swig_packed(swig_type_info *_type = 0, const char *_buf = 0, size_t _buf_len = 0)
|
||||||
: type(_type),buf(_buf,_buf+_buf_len) {}
|
: type(_type), buf(_buf, _buf + _buf_len) {
|
||||||
|
}
|
||||||
|
|
||||||
bool copy(swig_type_info *outtype, char *ptr, size_t sz) {
|
bool copy(swig_type_info *outtype, char *ptr, size_t sz) {
|
||||||
if (outtype && outtype != type)
|
if (outtype && outtype != type)
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -860,21 +847,25 @@ class octave_swig_packed : public octave_base_value {
|
||||||
std::copy(&buf[0], &buf[sz], ptr);
|
std::copy(&buf[0], &buf[sz], ptr);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
octave_base_value *clone() const {
|
octave_base_value *clone() const {
|
||||||
return new octave_swig_packed(*this);
|
return new octave_swig_packed(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
octave_base_value *empty_clone() const {
|
octave_base_value *empty_clone() const {
|
||||||
return new octave_swig_packed();
|
return new octave_swig_packed();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_defined() const {
|
bool is_defined() const {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void print(std::ostream &os, bool pr_as_read_syntax = false) const {
|
void print(std::ostream &os, bool pr_as_read_syntax = false) const {
|
||||||
os << "swig packed type: name = " << type->name << ", len = " << buf.size() << std::endl;
|
os << "swig packed type: name = " << type->name << ", len = " << buf.size() << std::endl;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
DECLARE_OCTAVE_ALLOCATOR
|
DECLARE_OCTAVE_ALLOCATOR;
|
||||||
DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
|
DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA;
|
||||||
};
|
};
|
||||||
DEFINE_OCTAVE_ALLOCATOR(octave_swig_packed);
|
DEFINE_OCTAVE_ALLOCATOR(octave_swig_packed);
|
||||||
DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(octave_swig_packed, "swig_packed", "swig_packed");
|
DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(octave_swig_packed, "swig_packed", "swig_packed");
|
||||||
|
|
@ -887,10 +878,14 @@ static octave_value_list octave_set_immutable(const octave_value_list& args, int
|
||||||
struct octave_value_ref {
|
struct octave_value_ref {
|
||||||
const octave_value_list &ovl;
|
const octave_value_list &ovl;
|
||||||
int j;
|
int j;
|
||||||
octave_value_ref(const octave_value_list& _ovl,int _j) : ovl(_ovl),j(_j) {}
|
|
||||||
|
octave_value_ref(const octave_value_list &_ovl, int _j)
|
||||||
|
:ovl(_ovl), j(_j) { }
|
||||||
|
|
||||||
operator octave_value() const {
|
operator octave_value() const {
|
||||||
return ovl(j);
|
return ovl(j);
|
||||||
}
|
}
|
||||||
|
|
||||||
octave_value operator*() const {
|
octave_value operator*() const {
|
||||||
return ovl(j);
|
return ovl(j);
|
||||||
}
|
}
|
||||||
|
|
@ -943,8 +938,7 @@ octave_value_list swig_typequery(const octave_value_list& args,int nargout) {
|
||||||
return octave_value_list();
|
return octave_value_list();
|
||||||
}
|
}
|
||||||
swig_module_info *module = SWIG_GetModule(0);
|
swig_module_info *module = SWIG_GetModule(0);
|
||||||
swig_type_info *type=SWIG_TypeQueryModule
|
swig_type_info *type = SWIG_TypeQueryModule(module, module, args(0).string_value().c_str());
|
||||||
(module,module,args(0).string_value().c_str());
|
|
||||||
if (!type)
|
if (!type)
|
||||||
return octave_value("<unknown>");
|
return octave_value("<unknown>");
|
||||||
return octave_value(type->name);
|
return octave_value(type->name);
|
||||||
|
|
@ -977,21 +971,26 @@ namespace Swig {
|
||||||
Director(const Director &x);
|
Director(const Director &x);
|
||||||
Director &operator=(const Director &rhs);
|
Director &operator=(const Director &rhs);
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Director(void *vptr):self(0), disowned(false) {
|
Director(void *vptr):self(0), disowned(false) {
|
||||||
set_rtdir(vptr, this);
|
set_rtdir(vptr, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
~Director() {
|
~Director() {
|
||||||
swig_director_destroyed(self, this);
|
swig_director_destroyed(self, this);
|
||||||
if (disowned)
|
if (disowned)
|
||||||
self->decref();
|
self->decref();
|
||||||
}
|
}
|
||||||
|
|
||||||
void swig_set_self(octave_swig_type *new_self) {
|
void swig_set_self(octave_swig_type *new_self) {
|
||||||
assert(!disowned);
|
assert(!disowned);
|
||||||
self = new_self;
|
self = new_self;
|
||||||
}
|
}
|
||||||
|
|
||||||
octave_swig_type *swig_get_self() const {
|
octave_swig_type *swig_get_self() const {
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
void swig_disown() {
|
void swig_disown() {
|
||||||
if (disowned)
|
if (disowned)
|
||||||
return;
|
return;
|
||||||
|
|
@ -1005,6 +1004,7 @@ namespace Swig {
|
||||||
// ... todo
|
// ... todo
|
||||||
throw(DirectorTypeMismatchException());
|
throw(DirectorTypeMismatchException());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void raise(const octave_value &ov, const char *msg) {
|
static void raise(const octave_value &ov, const char *msg) {
|
||||||
// ... todo
|
// ... todo
|
||||||
raise(msg);
|
raise(msg);
|
||||||
|
|
@ -1015,6 +1015,7 @@ namespace Swig {
|
||||||
// ... todo
|
// ... todo
|
||||||
throw(DirectorPureVirtualException());
|
throw(DirectorPureVirtualException());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void raise(const octave_value &ov, const char *msg) {
|
static void raise(const octave_value &ov, const char *msg) {
|
||||||
// ... todo
|
// ... todo
|
||||||
raise(msg);
|
raise(msg);
|
||||||
|
|
@ -1027,10 +1028,12 @@ void swig_acquire_ownership(void* vptr) {
|
||||||
// assert(0);
|
// assert(0);
|
||||||
// ... todo
|
// ... todo
|
||||||
}
|
}
|
||||||
|
|
||||||
void swig_acquire_ownership_array(void *vptr) {
|
void swig_acquire_ownership_array(void *vptr) {
|
||||||
// assert(0);
|
// assert(0);
|
||||||
// ... todo
|
// ... todo
|
||||||
}
|
}
|
||||||
|
|
||||||
void swig_acquire_ownership_obj(void *vptr, int own) {
|
void swig_acquire_ownership_obj(void *vptr, int own) {
|
||||||
// assert(0);
|
// assert(0);
|
||||||
// ... todo
|
// ... todo
|
||||||
|
|
@ -1040,6 +1043,7 @@ namespace Swig {
|
||||||
void swig_director_destroyed(octave_swig_type *self, Director *d) {
|
void swig_director_destroyed(octave_swig_type *self, Director *d) {
|
||||||
self->director_destroyed(d);
|
self->director_destroyed(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
void swig_director_set_self(Director *d, octave_swig_type *self) {
|
void swig_director_set_self(Director *d, octave_swig_type *self) {
|
||||||
d->swig_set_self(self);
|
d->swig_set_self(self);
|
||||||
}
|
}
|
||||||
|
|
@ -1047,9 +1051,11 @@ namespace Swig {
|
||||||
octave_base_value *swig_value_ref(octave_swig_type *ost) {
|
octave_base_value *swig_value_ref(octave_swig_type *ost) {
|
||||||
return new octave_swig_ref(ost);
|
return new octave_swig_ref(ost);
|
||||||
}
|
}
|
||||||
|
|
||||||
octave_swig_type *swig_value_deref(const octave_value &ov) {
|
octave_swig_type *swig_value_deref(const octave_value &ov) {
|
||||||
return swig_value_deref(*ov.internal_rep());
|
return swig_value_deref(*ov.internal_rep());
|
||||||
}
|
}
|
||||||
|
|
||||||
octave_swig_type *swig_value_deref(const octave_base_value &ov) {
|
octave_swig_type *swig_value_deref(const octave_base_value &ov) {
|
||||||
if (ov.type_id() != octave_swig_ref::static_type_id())
|
if (ov.type_id() != octave_swig_ref::static_type_id())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -1059,8 +1065,7 @@ namespace Swig {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SWIGRUNTIME octave_value
|
SWIGRUNTIME octave_value SWIG_Octave_NewPointerObj(void *ptr, swig_type_info *type, int flags) {
|
||||||
SWIG_Octave_NewPointerObj(void *ptr,swig_type_info *type,int flags) {
|
|
||||||
int own = (flags &SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
|
int own = (flags &SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
|
||||||
|
|
||||||
Swig::Director *d = Swig::get_rtdir(ptr);
|
Swig::Director *d = Swig::get_rtdir(ptr);
|
||||||
|
|
@ -1069,9 +1074,7 @@ SWIG_Octave_NewPointerObj(void *ptr,swig_type_info *type,int flags) {
|
||||||
return Swig::swig_value_ref(new octave_swig_type(ptr, type, own));
|
return Swig::swig_value_ref(new octave_swig_type(ptr, type, own));
|
||||||
}
|
}
|
||||||
|
|
||||||
SWIGRUNTIME int
|
SWIGRUNTIME int SWIG_Octave_ConvertPtrAndOwn(const octave_value &ov, void **ptr, swig_type_info *type, int flags, int *own) {
|
||||||
SWIG_Octave_ConvertPtrAndOwn(const octave_value& ov,void **ptr,
|
|
||||||
swig_type_info *type,int flags,int *own) {
|
|
||||||
if (!ov.is_defined()) {
|
if (!ov.is_defined()) {
|
||||||
if (ptr)
|
if (ptr)
|
||||||
*ptr = 0;
|
*ptr = 0;
|
||||||
|
|
@ -1089,14 +1092,11 @@ SWIG_Octave_ConvertPtrAndOwn(const octave_value& ov,void **ptr,
|
||||||
return SWIG_OK;
|
return SWIG_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SWIGRUNTIMEINLINE octave_value
|
SWIGRUNTIMEINLINE octave_value SWIG_Octave_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
|
||||||
SWIG_Octave_NewPackedObj(void *ptr,size_t sz,swig_type_info *type) {
|
|
||||||
return new octave_swig_packed(type, (char *) ptr, sz);
|
return new octave_swig_packed(type, (char *) ptr, sz);
|
||||||
}
|
}
|
||||||
|
|
||||||
SWIGRUNTIME int
|
SWIGRUNTIME int SWIG_Octave_ConvertPacked(const octave_value &ov, void *ptr, size_t sz, swig_type_info *type) {
|
||||||
SWIG_Octave_ConvertPacked(const octave_value& ov,void *ptr,size_t sz,
|
|
||||||
swig_type_info *type) {
|
|
||||||
if (!ov.is_defined())
|
if (!ov.is_defined())
|
||||||
return SWIG_TypeError;
|
return SWIG_TypeError;
|
||||||
if (ov.type_id() != octave_swig_packed::static_type_id())
|
if (ov.type_id() != octave_swig_packed::static_type_id())
|
||||||
|
|
@ -1105,8 +1105,7 @@ SWIG_Octave_ConvertPacked(const octave_value& ov,void *ptr,size_t sz,
|
||||||
return ost->copy(type, (char *) ptr, sz) ? SWIG_OK : SWIG_TypeError;
|
return ost->copy(type, (char *) ptr, sz) ? SWIG_OK : SWIG_TypeError;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SWIG_Octave_SetConstant(octave_swig_type* module_ns,
|
void SWIG_Octave_SetConstant(octave_swig_type *module_ns, const std::string &name, const octave_value &ov) {
|
||||||
const std::string& name,const octave_value& ov) {
|
|
||||||
module_ns->assign(name, ov);
|
module_ns->assign(name, ov);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1126,25 +1125,65 @@ octave_value_typeinfo::register_unary_op(octave_value::op_##name,tid,swig_unary_
|
||||||
if (!octave_value_typeinfo::lookup_binary_op(octave_value::op_##name,tid1,tid2)) \
|
if (!octave_value_typeinfo::lookup_binary_op(octave_value::op_##name,tid1,tid2)) \
|
||||||
octave_value_typeinfo::register_binary_op(octave_value::op_##name,tid1,tid2,swig_binary_op_##name);
|
octave_value_typeinfo::register_binary_op(octave_value::op_##name,tid1,tid2,swig_binary_op_##name);
|
||||||
|
|
||||||
swig_unary_op(not); swig_unary_op(uplus); swig_unary_op(uminus); swig_unary_op(transpose);
|
swig_unary_op(not);
|
||||||
swig_unary_op(hermitian); swig_unary_op(incr); swig_unary_op(decr);
|
swig_unary_op(uplus);
|
||||||
|
swig_unary_op(uminus);
|
||||||
|
swig_unary_op(transpose);
|
||||||
|
swig_unary_op(hermitian);
|
||||||
|
swig_unary_op(incr);
|
||||||
|
swig_unary_op(decr);
|
||||||
|
|
||||||
swig_binary_op(add); swig_binary_op(sub); swig_binary_op(mul); swig_binary_op(div);
|
swig_binary_op(add);
|
||||||
swig_binary_op(pow); swig_binary_op(ldiv); swig_binary_op(lshift); swig_binary_op(rshift);
|
swig_binary_op(sub);
|
||||||
swig_binary_op(lt); swig_binary_op(le); swig_binary_op(eq); swig_binary_op(ge);
|
swig_binary_op(mul);
|
||||||
swig_binary_op(gt); swig_binary_op(ne); swig_binary_op(el_mul); swig_binary_op(el_div);
|
swig_binary_op(div);
|
||||||
swig_binary_op(el_pow); swig_binary_op(el_ldiv); swig_binary_op(el_and); swig_binary_op(el_or);
|
swig_binary_op(pow);
|
||||||
|
swig_binary_op(ldiv);
|
||||||
|
swig_binary_op(lshift);
|
||||||
|
swig_binary_op(rshift);
|
||||||
|
swig_binary_op(lt);
|
||||||
|
swig_binary_op(le);
|
||||||
|
swig_binary_op(eq);
|
||||||
|
swig_binary_op(ge);
|
||||||
|
swig_binary_op(gt);
|
||||||
|
swig_binary_op(ne);
|
||||||
|
swig_binary_op(el_mul);
|
||||||
|
swig_binary_op(el_div);
|
||||||
|
swig_binary_op(el_pow);
|
||||||
|
swig_binary_op(el_ldiv);
|
||||||
|
swig_binary_op(el_and);
|
||||||
|
swig_binary_op(el_or);
|
||||||
|
|
||||||
void swig_install_unary_ops(int tid) {
|
void swig_install_unary_ops(int tid) {
|
||||||
swigreg_unary_op(not); swigreg_unary_op(uplus); swigreg_unary_op(uminus); swigreg_unary_op(transpose);
|
swigreg_unary_op(not);
|
||||||
swigreg_unary_op(hermitian); swigreg_unary_op(incr); swigreg_unary_op(decr);
|
swigreg_unary_op(uplus);
|
||||||
|
swigreg_unary_op(uminus);
|
||||||
|
swigreg_unary_op(transpose);
|
||||||
|
swigreg_unary_op(hermitian);
|
||||||
|
swigreg_unary_op(incr);
|
||||||
|
swigreg_unary_op(decr);
|
||||||
}
|
}
|
||||||
void swig_install_binary_ops(int tid1, int tid2) {
|
void swig_install_binary_ops(int tid1, int tid2) {
|
||||||
swigreg_binary_op(add); swigreg_binary_op(sub); swigreg_binary_op(mul); swigreg_binary_op(div);
|
swigreg_binary_op(add);
|
||||||
swigreg_binary_op(pow); swigreg_binary_op(ldiv); swigreg_binary_op(lshift); swigreg_binary_op(rshift);
|
swigreg_binary_op(sub);
|
||||||
swigreg_binary_op(lt); swigreg_binary_op(le); swigreg_binary_op(eq); swigreg_binary_op(ge);
|
swigreg_binary_op(mul);
|
||||||
swigreg_binary_op(gt); swigreg_binary_op(ne); swigreg_binary_op(el_mul); swigreg_binary_op(el_div);
|
swigreg_binary_op(div);
|
||||||
swigreg_binary_op(el_pow); swigreg_binary_op(el_ldiv); swigreg_binary_op(el_and); swigreg_binary_op(el_or);
|
swigreg_binary_op(pow);
|
||||||
|
swigreg_binary_op(ldiv);
|
||||||
|
swigreg_binary_op(lshift);
|
||||||
|
swigreg_binary_op(rshift);
|
||||||
|
swigreg_binary_op(lt);
|
||||||
|
swigreg_binary_op(le);
|
||||||
|
swigreg_binary_op(eq);
|
||||||
|
swigreg_binary_op(ge);
|
||||||
|
swigreg_binary_op(gt);
|
||||||
|
swigreg_binary_op(ne);
|
||||||
|
swigreg_binary_op(el_mul);
|
||||||
|
swigreg_binary_op(el_div);
|
||||||
|
swigreg_binary_op(el_pow);
|
||||||
|
swigreg_binary_op(el_ldiv);
|
||||||
|
swigreg_binary_op(el_and);
|
||||||
|
swigreg_binary_op(el_or);
|
||||||
}
|
}
|
||||||
void swig_install_ops(int tid) {
|
void swig_install_ops(int tid) {
|
||||||
// here we assume that tid are conseq integers increasing from zero, and
|
// here we assume that tid are conseq integers increasing from zero, and
|
||||||
|
|
@ -1160,4 +1199,3 @@ void swig_install_ops(int tid) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
%typecheck(SWIG_TYPECHECK_SWIGOBJECT) SWIG_Object "$1 = (*$input).is_defined();";
|
%typecheck(SWIG_TYPECHECK_SWIGOBJECT) SWIG_Object "$1 = (*$input).is_defined();";
|
||||||
|
%typecheck(SWIG_TYPECHECK_SWIGOBJECT) octave_value_list "$1 = true;";
|
||||||
|
|
||||||
|
%typemap(in) (octave_value_list varargs,...) {
|
||||||
|
for (int j=$argnum-1;j<args.length();++j)
|
||||||
|
$1.append(args(j));
|
||||||
|
}
|
||||||
|
%typemap(out) octave_value_list {
|
||||||
|
_outp->append($1);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// Smart Pointers
|
// Smart Pointers
|
||||||
|
|
|
||||||
|
|
@ -164,8 +164,10 @@ public:
|
||||||
if (!CPlusPlus)
|
if (!CPlusPlus)
|
||||||
Printf(f_header,"}\n");
|
Printf(f_header,"}\n");
|
||||||
|
|
||||||
|
/*
|
||||||
if (docs.size())
|
if (docs.size())
|
||||||
emit_doc_texinfo();
|
emit_doc_texinfo();
|
||||||
|
*/
|
||||||
|
|
||||||
if (directorsEnabled())
|
if (directorsEnabled())
|
||||||
Swig_insert_file("director.swg", f_runtime);
|
Swig_insert_file("director.swg", f_runtime);
|
||||||
|
|
@ -199,6 +201,7 @@ public:
|
||||||
return SWIG_OK;
|
return SWIG_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
void emit_doc_texinfo() {
|
void emit_doc_texinfo() {
|
||||||
for (doc_info_map::iterator it=docs.begin();
|
for (doc_info_map::iterator it=docs.begin();
|
||||||
it!=docs.end();++it) {
|
it!=docs.end();++it) {
|
||||||
|
|
@ -208,11 +211,13 @@ public:
|
||||||
Delete(wrap_name);
|
Delete(wrap_name);
|
||||||
Printf(f_doc,"-*- texinfo -*-\\n");
|
Printf(f_doc,"-*- texinfo -*-\\n");
|
||||||
Printv(f_doc,d.decl_info,d.cdecl_info,d.inarg_info,d.outarg_info,NIL);
|
Printv(f_doc,d.decl_info,d.cdecl_info,d.inarg_info,d.outarg_info,NIL);
|
||||||
|
if (Len(d.decl_info))
|
||||||
Printf(f_doc,"@end deftypefn");
|
Printf(f_doc,"@end deftypefn");
|
||||||
Printf(f_doc,"\";\n");
|
Printf(f_doc,"\";\n");
|
||||||
}
|
}
|
||||||
Printf(f_doc,"\n");
|
Printf(f_doc,"\n");
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
virtual int importDirective(Node *n) {
|
virtual int importDirective(Node *n) {
|
||||||
String *modname = Getattr(n, "module");
|
String *modname = Getattr(n, "module");
|
||||||
|
|
@ -229,6 +234,98 @@ public:
|
||||||
return conv ? "SWIG_POINTER_IMPLICIT_CONV" : "0";
|
return conv ? "SWIG_POINTER_IMPLICIT_CONV" : "0";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String *make_autodocParmList(Node *n, bool showTypes) {
|
||||||
|
String *doc = NewString("");
|
||||||
|
String *pdocs = Copy(Getattr(n, "feature:pdocs"));
|
||||||
|
ParmList *plist = CopyParmList(Getattr(n, "parms"));
|
||||||
|
Parm *p;
|
||||||
|
Parm *pnext;
|
||||||
|
Node *lookup;
|
||||||
|
int lines = 0;
|
||||||
|
const int maxwidth = 50;
|
||||||
|
|
||||||
|
if (pdocs)
|
||||||
|
Append(pdocs, "\n");
|
||||||
|
|
||||||
|
|
||||||
|
Swig_typemap_attach_parms("in", plist, 0);
|
||||||
|
Swig_typemap_attach_parms("doc", plist, 0);
|
||||||
|
|
||||||
|
for (p = plist; p; p = pnext) {
|
||||||
|
String *name = 0;
|
||||||
|
String *type = 0;
|
||||||
|
String *value = 0;
|
||||||
|
String *ptype = 0;
|
||||||
|
String *pdoc = Getattr(p, "tmap:doc");
|
||||||
|
if (pdoc) {
|
||||||
|
name = Getattr(p, "tmap:doc:name");
|
||||||
|
type = Getattr(p, "tmap:doc:type");
|
||||||
|
value = Getattr(p, "tmap:doc:value");
|
||||||
|
ptype = Getattr(p, "tmap:doc:pytype");
|
||||||
|
}
|
||||||
|
|
||||||
|
name = name ? name : Getattr(p, "name");
|
||||||
|
type = type ? type : Getattr(p, "type");
|
||||||
|
value = value ? value : Getattr(p, "value");
|
||||||
|
|
||||||
|
String *tm = Getattr(p, "tmap:in");
|
||||||
|
if (tm) {
|
||||||
|
pnext = Getattr(p, "tmap:in:next");
|
||||||
|
} else {
|
||||||
|
pnext = nextSibling(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Len(doc)) {
|
||||||
|
// add a comma to the previous one if any
|
||||||
|
Append(doc, ", ");
|
||||||
|
|
||||||
|
// Do we need to wrap a long line?
|
||||||
|
if ((Len(doc) - lines * maxwidth) > maxwidth) {
|
||||||
|
Printf(doc, "\n%s", tab4);
|
||||||
|
lines += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Do the param type too?
|
||||||
|
if (showTypes) {
|
||||||
|
type = SwigType_base(type);
|
||||||
|
lookup = Swig_symbol_clookup(type, 0);
|
||||||
|
if (lookup)
|
||||||
|
type = Getattr(lookup, "sym:name");
|
||||||
|
Printf(doc, "%s ", type);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name) {
|
||||||
|
Append(doc, name);
|
||||||
|
if (pdoc) {
|
||||||
|
if (!pdocs)
|
||||||
|
pdocs = NewString("Parameters:\n");
|
||||||
|
Printf(pdocs, " %s\n", pdoc);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Append(doc, "?");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value) {
|
||||||
|
if (Strcmp(value, "NULL") == 0)
|
||||||
|
value = NewString("None");
|
||||||
|
else if (Strcmp(value, "true") == 0 || Strcmp(value, "TRUE") == 0)
|
||||||
|
value = NewString("True");
|
||||||
|
else if (Strcmp(value, "false") == 0 || Strcmp(value, "FALSE") == 0)
|
||||||
|
value = NewString("False");
|
||||||
|
else {
|
||||||
|
lookup = Swig_symbol_clookup(value, 0);
|
||||||
|
if (lookup)
|
||||||
|
value = Getattr(lookup, "sym:name");
|
||||||
|
}
|
||||||
|
Printf(doc, "=%s", value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (pdocs)
|
||||||
|
Setattr(n, "feature:pdocs", pdocs);
|
||||||
|
Delete(plist);
|
||||||
|
return doc;
|
||||||
|
}
|
||||||
|
|
||||||
virtual int functionWrapper(Node *n) {
|
virtual int functionWrapper(Node *n) {
|
||||||
Wrapper *f = NewWrapper();
|
Wrapper *f = NewWrapper();
|
||||||
Parm *p;
|
Parm *p;
|
||||||
|
|
@ -256,7 +353,8 @@ public:
|
||||||
|
|
||||||
Printv(f->def, "static octave_value_list ", overname, " (const octave_value_list& args, int nargout) {", NIL);
|
Printv(f->def, "static octave_value_list ", overname, " (const octave_value_list& args, int nargout) {", NIL);
|
||||||
if (!overloaded || last_overload)
|
if (!overloaded || last_overload)
|
||||||
Printf(s_global_tab, "{\"%s\",%s,0,0,2,%s_texinfo},\n", iname, wname, wname);
|
Printf(s_global_tab, "{\"%s\",%s,0,0,2,0},\n", iname, wname, wname);
|
||||||
|
// Printf(s_global_tab, "{\"%s\",%s,0,0,2,%s_texinfo},\n", iname, wname, wname);
|
||||||
|
|
||||||
emit_args(d, l, f);
|
emit_args(d, l, f);
|
||||||
emit_attach_parmmaps(l, f);
|
emit_attach_parmmaps(l, f);
|
||||||
|
|
@ -340,6 +438,7 @@ public:
|
||||||
Printv(f->code, tm, "\n", NIL);
|
Printv(f->code, tm, "\n", NIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert constraint checking code
|
// Insert constraint checking code
|
||||||
for (p = l; p;) {
|
for (p = l; p;) {
|
||||||
if ((tm = Getattr(p, "tmap:check"))) {
|
if ((tm = Getattr(p, "tmap:check"))) {
|
||||||
|
|
@ -446,14 +545,6 @@ public:
|
||||||
|
|
||||||
Replaceall(f->code, "$symname", iname);
|
Replaceall(f->code, "$symname", iname);
|
||||||
|
|
||||||
// SwigType_str(Getattr(sibl, "name"), 0), ParmList_protostr(Getattr(sibl, "wrap:parms")
|
|
||||||
{
|
|
||||||
const char* wname_cstr = (const char*)Data(wname);
|
|
||||||
doc_info& d=docs[wname_cstr];
|
|
||||||
Printf(d.cdecl_info, "%s(%s)\\n", iname, ParmList_protostr(l));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Wrapper_print(f, f_wrappers);
|
Wrapper_print(f, f_wrappers);
|
||||||
DelWrapper(f);
|
DelWrapper(f);
|
||||||
Delete(overname);
|
Delete(overname);
|
||||||
|
|
@ -722,7 +813,8 @@ public:
|
||||||
String *rname = Swig_name_wrapper(Swig_name_member(class_name, realname));
|
String *rname = Swig_name_wrapper(Swig_name_member(class_name, realname));
|
||||||
|
|
||||||
if (!Getattr(n, "sym:nextSibling"))
|
if (!Getattr(n, "sym:nextSibling"))
|
||||||
Printf(s_members_tab, "{\"%s\",%s,0,0,0,%s_texinfo},\n",
|
// Printf(s_members_tab, "{\"%s\",%s,0,0,0,%s_texinfo},\n",
|
||||||
|
Printf(s_members_tab, "{\"%s\",%s,0,0,0,0},\n",
|
||||||
realname, rname, rname);
|
realname, rname, rname);
|
||||||
|
|
||||||
Delete(rname);
|
Delete(rname);
|
||||||
|
|
@ -790,7 +882,8 @@ public:
|
||||||
String *rname = Swig_name_wrapper(Swig_name_member(class_name, realname));
|
String *rname = Swig_name_wrapper(Swig_name_member(class_name, realname));
|
||||||
|
|
||||||
if (!Getattr(n, "sym:nextSibling"))
|
if (!Getattr(n, "sym:nextSibling"))
|
||||||
Printf(s_members_tab, "{\"%s\",%s,0,0,1,%s_texinfo},\n",
|
// Printf(s_members_tab, "{\"%s\",%s,0,0,1,%s_texinfo},\n",
|
||||||
|
Printf(s_members_tab, "{\"%s\",%s,0,0,1,0},\n",
|
||||||
realname, rname, rname);
|
realname, rname, rname);
|
||||||
|
|
||||||
Delete(rname);
|
Delete(rname);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue