Octave: whitespace/indentation/style cleanup of octave.cxx
- Used "astyle -A10 -s2 -N -p -H -U -k1" for style cleanup
- Replaced NewString("") with NewStringEmpty()
- Used 'w' instead of 'f' for Wrapper() objects
This commit is contained in:
parent
a93d5eac4e
commit
5ac475cbcd
1 changed files with 437 additions and 392 deletions
|
|
@ -25,7 +25,8 @@ Octave Options (available with -octave)\n\
|
||||||
\n";
|
\n";
|
||||||
|
|
||||||
|
|
||||||
class OCTAVE:public Language {
|
class OCTAVE: public Language
|
||||||
|
{
|
||||||
private:
|
private:
|
||||||
File* f_begin;
|
File* f_begin;
|
||||||
File* f_runtime;
|
File* f_runtime;
|
||||||
|
|
@ -50,8 +51,7 @@ private:
|
||||||
if (dld) {
|
if (dld) {
|
||||||
String* tname = texinfo_name(n, "std::string()");
|
String* tname = texinfo_name(n, "std::string()");
|
||||||
Printf(f, "SWIG_DEFUN( %s, %s, %s ) {", cname, wname, tname);
|
Printf(f, "SWIG_DEFUN( %s, %s, %s ) {", cname, wname, tname);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Printf(f, "static octave_value_list %s (const octave_value_list& args, int nargout) {", wname);
|
Printf(f, "static octave_value_list %s (const octave_value_list& args, int nargout) {", wname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -73,10 +73,9 @@ public:
|
||||||
have_constructor(0),
|
have_constructor(0),
|
||||||
have_destructor(0),
|
have_destructor(0),
|
||||||
constructor_name(0),
|
constructor_name(0),
|
||||||
docs(0)
|
docs(0) {
|
||||||
{
|
|
||||||
/* Add code to manage protected constructors and directors */
|
/* Add code to manage protected constructors and directors */
|
||||||
director_prot_ctor_code = NewString("");
|
director_prot_ctor_code = NewStringEmpty();
|
||||||
Printv(director_prot_ctor_code,
|
Printv(director_prot_ctor_code,
|
||||||
"if ( $comparison ) { /* subclassed */\n",
|
"if ( $comparison ) { /* subclassed */\n",
|
||||||
" $director_new \n",
|
" $director_new \n",
|
||||||
|
|
@ -116,10 +115,12 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!global_name)
|
if (!global_name) {
|
||||||
global_name = NewString("cvar");
|
global_name = NewString("cvar");
|
||||||
if (!op_prefix)
|
}
|
||||||
|
if (!op_prefix) {
|
||||||
op_prefix = NewString("op_");
|
op_prefix = NewString("op_");
|
||||||
|
}
|
||||||
|
|
||||||
SWIG_library_directory("octave");
|
SWIG_library_directory("octave");
|
||||||
Preprocessor_define("SWIGOCTAVE 1", 0);
|
Preprocessor_define("SWIGOCTAVE 1", 0);
|
||||||
|
|
@ -128,9 +129,10 @@ public:
|
||||||
allow_overloading();
|
allow_overloading();
|
||||||
|
|
||||||
// Octave API is C++, so output must be C++ compatibile even when wrapping C code
|
// Octave API is C++, so output must be C++ compatibile even when wrapping C code
|
||||||
if (!cparse_cplusplus)
|
if (!cparse_cplusplus) {
|
||||||
Swig_cparse_cplusplusout(1);
|
Swig_cparse_cplusplusout(1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
virtual int top(Node* n) {
|
virtual int top(Node* n) {
|
||||||
{
|
{
|
||||||
|
|
@ -147,12 +149,13 @@ public:
|
||||||
}
|
}
|
||||||
if (Getattr(options, "directors")) {
|
if (Getattr(options, "directors")) {
|
||||||
allow_directors();
|
allow_directors();
|
||||||
if (dirprot)
|
if (dirprot) {
|
||||||
allow_dirprot();
|
allow_dirprot();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String* module = Getattr(n, "name");
|
String* module = Getattr(n, "name");
|
||||||
String* outfile = Getattr(n, "outfile");
|
String* outfile = Getattr(n, "outfile");
|
||||||
|
|
@ -161,15 +164,15 @@ public:
|
||||||
FileErrorDisplay(outfile);
|
FileErrorDisplay(outfile);
|
||||||
SWIG_exit(EXIT_FAILURE);
|
SWIG_exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
f_runtime = NewString("");
|
f_runtime = NewStringEmpty();
|
||||||
f_header = NewString("");
|
f_header = NewStringEmpty();
|
||||||
f_doc = NewString("");
|
f_doc = NewStringEmpty();
|
||||||
f_wrappers = NewString("");
|
f_wrappers = NewStringEmpty();
|
||||||
f_init = NewString("");
|
f_init = NewStringEmpty();
|
||||||
f_initbeforefunc = NewString("");
|
f_initbeforefunc = NewStringEmpty();
|
||||||
f_directors_h = NewString("");
|
f_directors_h = NewStringEmpty();
|
||||||
f_directors = NewString("");
|
f_directors = NewStringEmpty();
|
||||||
s_global_tab = NewString("");
|
s_global_tab = NewStringEmpty();
|
||||||
Swig_register_filebyname("begin", f_begin);
|
Swig_register_filebyname("begin", f_begin);
|
||||||
Swig_register_filebyname("runtime", f_runtime);
|
Swig_register_filebyname("runtime", f_runtime);
|
||||||
Swig_register_filebyname("header", f_header);
|
Swig_register_filebyname("header", f_header);
|
||||||
|
|
@ -205,19 +208,23 @@ public:
|
||||||
Printf(s_global_tab, "\nstatic const struct swig_octave_member swig_globals[] = {\n");
|
Printf(s_global_tab, "\nstatic const struct swig_octave_member swig_globals[] = {\n");
|
||||||
Printf(f_init, "static bool SWIG_init_user(octave_swig_type* module_ns)\n{\n");
|
Printf(f_init, "static bool SWIG_init_user(octave_swig_type* module_ns)\n{\n");
|
||||||
|
|
||||||
if (!CPlusPlus)
|
if (!CPlusPlus) {
|
||||||
Printf(f_header, "extern \"C\" {\n");
|
Printf(f_header, "extern \"C\" {\n");
|
||||||
|
}
|
||||||
|
|
||||||
Language::top(n);
|
Language::top(n);
|
||||||
|
|
||||||
if (!CPlusPlus)
|
if (!CPlusPlus) {
|
||||||
Printf(f_header, "}\n");
|
Printf(f_header, "}\n");
|
||||||
|
}
|
||||||
|
|
||||||
if (Len(docs))
|
if (Len(docs)) {
|
||||||
emit_doc_texinfo();
|
emit_doc_texinfo();
|
||||||
|
}
|
||||||
|
|
||||||
if (directorsEnabled())
|
if (directorsEnabled()) {
|
||||||
Swig_insert_file("director.swg", f_runtime);
|
Swig_insert_file("director.swg", f_runtime);
|
||||||
|
}
|
||||||
|
|
||||||
Printf(f_init, "return true;\n}\n");
|
Printf(f_init, "return true;\n}\n");
|
||||||
Printf(s_global_tab, "{0,0,0,0,0}\n};\n");
|
Printf(s_global_tab, "{0,0,0,0,0}\n};\n");
|
||||||
|
|
@ -251,9 +258,10 @@ public:
|
||||||
|
|
||||||
String* texinfo_escape(String* _s) {
|
String* texinfo_escape(String* _s) {
|
||||||
const char* s = (const char*) Data(_s);
|
const char* s = (const char*) Data(_s);
|
||||||
while (*s&&(*s=='\t'||*s=='\r'||*s=='\n'||*s==' '))
|
while (*s && (*s == '\t' || *s == '\r' || *s == '\n' || *s == ' ')) {
|
||||||
++s;
|
++s;
|
||||||
String *r = NewString("");
|
}
|
||||||
|
String* r = NewStringEmpty();
|
||||||
for (int j = 0; s[j]; ++j) {
|
for (int j = 0; s[j]; ++j) {
|
||||||
if (s[j] == '\n') {
|
if (s[j] == '\n') {
|
||||||
Append(r, "\\n\\\n");
|
Append(r, "\\n\\\n");
|
||||||
|
|
@ -267,9 +275,10 @@ public:
|
||||||
Append(r, "\\\'");
|
Append(r, "\\\'");
|
||||||
} else if (s[j] == '\"') {
|
} else if (s[j] == '\"') {
|
||||||
Append(r, "\\\"");
|
Append(r, "\\\"");
|
||||||
} else
|
} else {
|
||||||
Putc(s[j], r);
|
Putc(s[j], r);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
void emit_doc_texinfo() {
|
void emit_doc_texinfo() {
|
||||||
|
|
@ -281,15 +290,16 @@ public:
|
||||||
String* cdecl_info = Getattr(it.item, "cdecl_info");
|
String* cdecl_info = Getattr(it.item, "cdecl_info");
|
||||||
String* args_info = Getattr(it.item, "args_info");
|
String* args_info = Getattr(it.item, "args_info");
|
||||||
|
|
||||||
String *doc_str = NewString("");
|
String* doc_str = NewStringEmpty();
|
||||||
Printv(doc_str, synopsis, decl_info, cdecl_info, args_info, NIL);
|
Printv(doc_str, synopsis, decl_info, cdecl_info, args_info, NIL);
|
||||||
String* escaped_doc_str = texinfo_escape(doc_str);
|
String* escaped_doc_str = texinfo_escape(doc_str);
|
||||||
|
|
||||||
if (Len(doc_str) > 0) {
|
if (Len(doc_str) > 0) {
|
||||||
Printf(f_doc, "static const char* %s_texinfo = ", wrap_name);
|
Printf(f_doc, "static const char* %s_texinfo = ", wrap_name);
|
||||||
Printf(f_doc, "\"-*- texinfo -*-\\n\\\n%s", escaped_doc_str);
|
Printf(f_doc, "\"-*- texinfo -*-\\n\\\n%s", escaped_doc_str);
|
||||||
if (Len(decl_info))
|
if (Len(decl_info)) {
|
||||||
Printf(f_doc, "\\n\\\n@end deftypefn");
|
Printf(f_doc, "\\n\\\n@end deftypefn");
|
||||||
|
}
|
||||||
Printf(f_doc, "\";\n");
|
Printf(f_doc, "\";\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -300,8 +310,9 @@ public:
|
||||||
Printf(f_doc, "\n");
|
Printf(f_doc, "\n");
|
||||||
}
|
}
|
||||||
bool is_empty_doc_node(Node* n) {
|
bool is_empty_doc_node(Node* n) {
|
||||||
if (!n)
|
if (!n) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
String* synopsis = Getattr(n, "synopsis");
|
String* synopsis = Getattr(n, "synopsis");
|
||||||
String* decl_info = Getattr(n, "decl_info");
|
String* decl_info = Getattr(n, "decl_info");
|
||||||
String* cdecl_info = Getattr(n, "cdecl_info");
|
String* cdecl_info = Getattr(n, "cdecl_info");
|
||||||
|
|
@ -310,15 +321,16 @@ public:
|
||||||
!Len(cdecl_info) && !Len(args_info);
|
!Len(cdecl_info) && !Len(args_info);
|
||||||
}
|
}
|
||||||
String* texinfo_name(Node* n, const char* defval = "0") {
|
String* texinfo_name(Node* n, const char* defval = "0") {
|
||||||
String *tname = NewString("");
|
String* tname = NewStringEmpty();
|
||||||
String* iname = Getattr(n, "sym:name");
|
String* iname = Getattr(n, "sym:name");
|
||||||
String* wname = Swig_name_wrapper(iname);
|
String* wname = Swig_name_wrapper(iname);
|
||||||
Node* d = Getattr(docs, wname);
|
Node* d = Getattr(docs, wname);
|
||||||
|
|
||||||
if (is_empty_doc_node(d))
|
if (is_empty_doc_node(d)) {
|
||||||
Printf(tname, defval);
|
Printf(tname, defval);
|
||||||
else
|
} else {
|
||||||
Printf(tname, "%s_texinfo", wname);
|
Printf(tname, "%s_texinfo", wname);
|
||||||
|
}
|
||||||
|
|
||||||
return tname;
|
return tname;
|
||||||
}
|
}
|
||||||
|
|
@ -331,10 +343,10 @@ public:
|
||||||
Node* d = Getattr(docs, wname);
|
Node* d = Getattr(docs, wname);
|
||||||
if (!d) {
|
if (!d) {
|
||||||
d = NewHash();
|
d = NewHash();
|
||||||
Setattr(d, "synopsis", NewString(""));
|
Setattr(d, "synopsis", NewStringEmpty());
|
||||||
Setattr(d, "decl_info", NewString(""));
|
Setattr(d, "decl_info", NewStringEmpty());
|
||||||
Setattr(d, "cdecl_info", NewString(""));
|
Setattr(d, "cdecl_info", NewStringEmpty());
|
||||||
Setattr(d, "args_info", NewString(""));
|
Setattr(d, "args_info", NewStringEmpty());
|
||||||
Setattr(docs, wname, d);
|
Setattr(docs, wname, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -346,8 +358,8 @@ public:
|
||||||
// * couldn't we just emit the docs here?
|
// * couldn't we just emit the docs here?
|
||||||
|
|
||||||
if (autodoc_enabled) {
|
if (autodoc_enabled) {
|
||||||
String *decl_str = NewString("");
|
String* decl_str = NewStringEmpty();
|
||||||
String *args_str = NewString("");
|
String* args_str = NewStringEmpty();
|
||||||
make_autodocParmList(n, decl_str, args_str);
|
make_autodocParmList(n, decl_str, args_str);
|
||||||
Append(decl_info, "@deftypefn {Loadable Function} ");
|
Append(decl_info, "@deftypefn {Loadable Function} ");
|
||||||
|
|
||||||
|
|
@ -384,8 +396,9 @@ public:
|
||||||
|
|
||||||
virtual int importDirective(Node* n) {
|
virtual int importDirective(Node* n) {
|
||||||
String* modname = Getattr(n, "module");
|
String* modname = Getattr(n, "module");
|
||||||
if (modname)
|
if (modname) {
|
||||||
Printf(f_init, "if (!SWIG_Octave_LoadModule(\"%s\")) return false;\n", modname);
|
Printf(f_init, "if (!SWIG_Octave_LoadModule(\"%s\")) return false;\n", modname);
|
||||||
|
}
|
||||||
return Language::importDirective(n);
|
return Language::importDirective(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -463,17 +476,20 @@ public:
|
||||||
type = type ? type : Getattr(p, "type");
|
type = type ? type : Getattr(p, "type");
|
||||||
value = value ? value : Getattr(p, "value");
|
value = value ? value : Getattr(p, "value");
|
||||||
|
|
||||||
if (SwigType_isvarargs(type))
|
if (SwigType_isvarargs(type)) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
String *tex_name = NewString("");
|
String* tex_name = NewStringEmpty();
|
||||||
if (name)
|
if (name) {
|
||||||
Printf(tex_name, "@var{%s}", name);
|
Printf(tex_name, "@var{%s}", name);
|
||||||
else
|
} else {
|
||||||
Printf(tex_name, "@var{?}");
|
Printf(tex_name, "@var{?}");
|
||||||
|
}
|
||||||
|
|
||||||
if (Len(decl_str))
|
if (Len(decl_str)) {
|
||||||
Append(decl_str, ", ");
|
Append(decl_str, ", ");
|
||||||
|
}
|
||||||
Append(decl_str, tex_name);
|
Append(decl_str, tex_name);
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
|
|
@ -482,9 +498,10 @@ public:
|
||||||
value = new_value;
|
value = new_value;
|
||||||
} else {
|
} else {
|
||||||
Node* lookup = Swig_symbol_clookup(value, 0);
|
Node* lookup = Swig_symbol_clookup(value, 0);
|
||||||
if (lookup)
|
if (lookup) {
|
||||||
value = Getattr(lookup, "sym:name");
|
value = Getattr(lookup, "sym:name");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Printf(decl_str, " = %s", value);
|
Printf(decl_str, " = %s", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -496,8 +513,9 @@ public:
|
||||||
Delete(tex_name);
|
Delete(tex_name);
|
||||||
Delete(name);
|
Delete(name);
|
||||||
}
|
}
|
||||||
if (pdocs)
|
if (pdocs) {
|
||||||
Setattr(n, "feature:pdocs", pdocs);
|
Setattr(n, "feature:pdocs", pdocs);
|
||||||
|
}
|
||||||
Delete(plist);
|
Delete(plist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -511,18 +529,22 @@ public:
|
||||||
char fc = (Char(v)) [0];
|
char fc = (Char(v)) [0];
|
||||||
if (('0' <= fc && fc <= '9') || '\'' == fc || '"' == fc) {
|
if (('0' <= fc && fc <= '9') || '\'' == fc || '"' == fc) {
|
||||||
/* number or string (or maybe NULL pointer) */
|
/* number or string (or maybe NULL pointer) */
|
||||||
if (SwigType_ispointer(t) && Strcmp(v, "0") == 0)
|
if (SwigType_ispointer(t) && Strcmp(v, "0") == 0) {
|
||||||
return NewString("None");
|
return NewString("None");
|
||||||
else
|
} else {
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
if (Strcmp(v, "NULL") == 0 || Strcmp(v, "nullptr") == 0)
|
}
|
||||||
|
if (Strcmp(v, "NULL") == 0 || Strcmp(v, "nullptr") == 0) {
|
||||||
return SwigType_ispointer(t) ? NewString("nil") : NewString("0");
|
return SwigType_ispointer(t) ? NewString("nil") : NewString("0");
|
||||||
if (Strcmp(v, "true") == 0 || Strcmp(v, "TRUE") == 0)
|
}
|
||||||
|
if (Strcmp(v, "true") == 0 || Strcmp(v, "TRUE") == 0) {
|
||||||
return NewString("true");
|
return NewString("true");
|
||||||
if (Strcmp(v, "false") == 0 || Strcmp(v, "FALSE") == 0)
|
}
|
||||||
|
if (Strcmp(v, "false") == 0 || Strcmp(v, "FALSE") == 0) {
|
||||||
return NewString("false");
|
return NewString("false");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -544,20 +566,23 @@ public:
|
||||||
SwigType* d = Getattr(n, "type");
|
SwigType* d = Getattr(n, "type");
|
||||||
ParmList* l = Getattr(n, "parms");
|
ParmList* l = Getattr(n, "parms");
|
||||||
|
|
||||||
if (!overloaded && !addSymbol(iname, n))
|
if (!overloaded && !addSymbol(iname, n)) {
|
||||||
return SWIG_ERROR;
|
return SWIG_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
if (overloaded)
|
if (overloaded) {
|
||||||
Append(overname, Getattr(n, "sym:overname"));
|
Append(overname, Getattr(n, "sym:overname"));
|
||||||
|
}
|
||||||
|
|
||||||
if (!overloaded || last_overload)
|
if (!overloaded || last_overload) {
|
||||||
process_autodoc(n);
|
process_autodoc(n);
|
||||||
|
}
|
||||||
|
|
||||||
Wrapper *f = NewWrapper();
|
Wrapper* w = NewWrapper();
|
||||||
Octave_begin_function(n, f->def, iname, overname, !overloaded);
|
Octave_begin_function(n, w->def, iname, overname, !overloaded);
|
||||||
|
|
||||||
emit_parameter_variables(l, f);
|
emit_parameter_variables(l, w);
|
||||||
emit_attach_parmmaps(l, f);
|
emit_attach_parmmaps(l, w);
|
||||||
Setattr(n, "wrap:parms", l);
|
Setattr(n, "wrap:parms", l);
|
||||||
|
|
||||||
int num_arguments = emit_num_arguments(l);
|
int num_arguments = emit_num_arguments(l);
|
||||||
|
|
@ -565,7 +590,7 @@ public:
|
||||||
int varargs = emit_isvarargs(l);
|
int varargs = emit_isvarargs(l);
|
||||||
char source[64];
|
char source[64];
|
||||||
|
|
||||||
Printf(f->code, "if (!SWIG_check_num_args(\"%s\",args.length(),%i,%i,%i)) "
|
Printf(w->code, "if (!SWIG_check_num_args(\"%s\",args.length(),%i,%i,%i)) "
|
||||||
"{\n SWIG_fail;\n }\n", iname, num_arguments, num_required, varargs);
|
"{\n SWIG_fail;\n }\n", iname, num_arguments, num_required, varargs);
|
||||||
|
|
||||||
if (constructor && num_arguments == 1 && num_required == 1) {
|
if (constructor && num_arguments == 1 && num_required == 1) {
|
||||||
|
|
@ -573,7 +598,7 @@ public:
|
||||||
Node* parent = Swig_methodclass(n);
|
Node* parent = Swig_methodclass(n);
|
||||||
if (GetFlag(parent, "feature:implicitconv")) {
|
if (GetFlag(parent, "feature:implicitconv")) {
|
||||||
String* desc = NewStringf("SWIGTYPE%s", SwigType_manglestr(Getattr(n, "type")));
|
String* desc = NewStringf("SWIGTYPE%s", SwigType_manglestr(Getattr(n, "type")));
|
||||||
Printf(f->code, "if (SWIG_CheckImplicit(%s)) SWIG_fail;\n", desc);
|
Printf(w->code, "if (SWIG_CheckImplicit(%s)) SWIG_fail;\n", desc);
|
||||||
Delete(desc);
|
Delete(desc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -616,12 +641,13 @@ public:
|
||||||
Setattr(p, "implicitconv", convflag);
|
Setattr(p, "implicitconv", convflag);
|
||||||
}
|
}
|
||||||
|
|
||||||
String *getargs = NewString("");
|
String* getargs = NewStringEmpty();
|
||||||
if (j >= num_required)
|
if (j >= num_required) {
|
||||||
Printf(getargs, "if (%d<args.length()) {\n%s\n}", j, tm);
|
Printf(getargs, "if (%d<args.length()) {\n%s\n}", j, tm);
|
||||||
else
|
} else {
|
||||||
Printv(getargs, tm, NIL);
|
Printv(getargs, tm, NIL);
|
||||||
Printv(f->code, getargs, "\n", NIL);
|
}
|
||||||
|
Printv(w->code, getargs, "\n", NIL);
|
||||||
Delete(getargs);
|
Delete(getargs);
|
||||||
|
|
||||||
p = Getattr(p, "tmap:in:next");
|
p = Getattr(p, "tmap:in:next");
|
||||||
|
|
@ -636,7 +662,7 @@ public:
|
||||||
if (varargs) {
|
if (varargs) {
|
||||||
if (p && (tm = Getattr(p, "tmap:in"))) {
|
if (p && (tm = Getattr(p, "tmap:in"))) {
|
||||||
Replaceall(tm, "$input", "varargs");
|
Replaceall(tm, "$input", "varargs");
|
||||||
Printv(f->code, tm, "\n", NIL);
|
Printv(w->code, tm, "\n", NIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -644,7 +670,7 @@ public:
|
||||||
for (p = l; p;) {
|
for (p = l; p;) {
|
||||||
if ((tm = Getattr(p, "tmap:check"))) {
|
if ((tm = Getattr(p, "tmap:check"))) {
|
||||||
Replaceall(tm, "$target", Getattr(p, "lname"));
|
Replaceall(tm, "$target", Getattr(p, "lname"));
|
||||||
Printv(f->code, tm, "\n", NIL);
|
Printv(w->code, tm, "\n", NIL);
|
||||||
p = Getattr(p, "tmap:check:next");
|
p = Getattr(p, "tmap:check:next");
|
||||||
} else {
|
} else {
|
||||||
p = nextSibling(p);
|
p = nextSibling(p);
|
||||||
|
|
@ -652,7 +678,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert cleanup code
|
// Insert cleanup code
|
||||||
String *cleanup = NewString("");
|
String* cleanup = NewStringEmpty();
|
||||||
for (p = l; p;) {
|
for (p = l; p;) {
|
||||||
if ((tm = Getattr(p, "tmap:freearg"))) {
|
if ((tm = Getattr(p, "tmap:freearg"))) {
|
||||||
if (Getattr(p, "tmap:freearg:implicitconv")) {
|
if (Getattr(p, "tmap:freearg:implicitconv")) {
|
||||||
|
|
@ -676,7 +702,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert argument output code
|
// Insert argument output code
|
||||||
String *outarg = NewString("");
|
String* outarg = NewStringEmpty();
|
||||||
for (p = l; p;) {
|
for (p = l; p;) {
|
||||||
if ((tm = Getattr(p, "tmap:argout"))) {
|
if ((tm = Getattr(p, "tmap:argout"))) {
|
||||||
Replaceall(tm, "$source", Getattr(p, "lname"));
|
Replaceall(tm, "$source", Getattr(p, "lname"));
|
||||||
|
|
@ -693,70 +719,72 @@ public:
|
||||||
|
|
||||||
int director_method = is_member_director(n) && !is_smart_pointer() && !destructor;
|
int director_method = is_member_director(n) && !is_smart_pointer() && !destructor;
|
||||||
if (director_method) {
|
if (director_method) {
|
||||||
Wrapper_add_local(f, "upcall", "bool upcall = false");
|
Wrapper_add_local(w, "upcall", "bool upcall = false");
|
||||||
Append(f->code, "upcall = !!dynamic_cast<Swig::Director*>(arg1);\n");
|
Append(w->code, "upcall = !!dynamic_cast<Swig::Director*>(arg1);\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
Setattr(n, "wrap:name", overname);
|
Setattr(n, "wrap:name", overname);
|
||||||
|
|
||||||
Swig_director_emit_dynamic_cast(n, f);
|
Swig_director_emit_dynamic_cast(n, w);
|
||||||
String* actioncode = emit_action(n);
|
String* actioncode = emit_action(n);
|
||||||
|
|
||||||
Wrapper_add_local(f, "_out", "octave_value_list _out");
|
Wrapper_add_local(w, "_out", "octave_value_list _out");
|
||||||
Wrapper_add_local(f, "_outp", "octave_value_list *_outp=&_out");
|
Wrapper_add_local(w, "_outp", "octave_value_list *_outp=&_out");
|
||||||
Wrapper_add_local(f, "_outv", "octave_value _outv");
|
Wrapper_add_local(w, "_outv", "octave_value _outv");
|
||||||
|
|
||||||
// Return the function value
|
// Return the function value
|
||||||
if ((tm = Swig_typemap_lookup_out("out", n, Swig_cresult_name(), f, actioncode))) {
|
if ((tm = Swig_typemap_lookup_out("out", n, Swig_cresult_name(), w, actioncode))) {
|
||||||
Replaceall(tm, "$source", Swig_cresult_name());
|
Replaceall(tm, "$source", Swig_cresult_name());
|
||||||
Replaceall(tm, "$target", "_outv");
|
Replaceall(tm, "$target", "_outv");
|
||||||
Replaceall(tm, "$result", "_outv");
|
Replaceall(tm, "$result", "_outv");
|
||||||
|
|
||||||
if (GetFlag(n, "feature:new"))
|
if (GetFlag(n, "feature:new")) {
|
||||||
Replaceall(tm, "$owner", "1");
|
Replaceall(tm, "$owner", "1");
|
||||||
else
|
} else {
|
||||||
Replaceall(tm, "$owner", "0");
|
Replaceall(tm, "$owner", "0");
|
||||||
|
}
|
||||||
|
|
||||||
Printf(f->code, "%s\n", tm);
|
Printf(w->code, "%s\n", tm);
|
||||||
Printf(f->code, "if (_outv.is_defined()) _outp = " "SWIG_Octave_AppendOutput(_outp, _outv);\n");
|
Printf(w->code, "if (_outv.is_defined()) _outp = " "SWIG_Octave_AppendOutput(_outp, _outv);\n");
|
||||||
Delete(tm);
|
Delete(tm);
|
||||||
} else {
|
} else {
|
||||||
Swig_warning(WARN_TYPEMAP_OUT_UNDEF, input_file, line_number, "Unable to use return type %s in function %s.\n", SwigType_str(d, 0), iname);
|
Swig_warning(WARN_TYPEMAP_OUT_UNDEF, input_file, line_number, "Unable to use return type %s in function %s.\n", SwigType_str(d, 0), iname);
|
||||||
}
|
}
|
||||||
emit_return_variable(n, d, f);
|
emit_return_variable(n, d, w);
|
||||||
|
|
||||||
Printv(f->code, outarg, NIL);
|
Printv(w->code, outarg, NIL);
|
||||||
Printv(f->code, cleanup, NIL);
|
Printv(w->code, cleanup, NIL);
|
||||||
|
|
||||||
if (GetFlag(n, "feature:new")) {
|
if (GetFlag(n, "feature:new")) {
|
||||||
if ((tm = Swig_typemap_lookup("newfree", n, Swig_cresult_name(), 0))) {
|
if ((tm = Swig_typemap_lookup("newfree", n, Swig_cresult_name(), 0))) {
|
||||||
Replaceall(tm, "$source", Swig_cresult_name());
|
Replaceall(tm, "$source", Swig_cresult_name());
|
||||||
Printf(f->code, "%s\n", tm);
|
Printf(w->code, "%s\n", tm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((tm = Swig_typemap_lookup("ret", n, Swig_cresult_name(), 0))) {
|
if ((tm = Swig_typemap_lookup("ret", n, Swig_cresult_name(), 0))) {
|
||||||
Replaceall(tm, "$source", Swig_cresult_name());
|
Replaceall(tm, "$source", Swig_cresult_name());
|
||||||
Replaceall(tm, "$result", "_outv");
|
Replaceall(tm, "$result", "_outv");
|
||||||
Printf(f->code, "%s\n", tm);
|
Printf(w->code, "%s\n", tm);
|
||||||
Delete(tm);
|
Delete(tm);
|
||||||
}
|
}
|
||||||
|
|
||||||
Printf(f->code, "return _out;\n");
|
Printf(w->code, "return _out;\n");
|
||||||
Printf(f->code, "fail:\n"); // we should free locals etc if this happens
|
Printf(w->code, "fail:\n"); // we should free locals etc if this happens
|
||||||
Printv(f->code, cleanup, NIL);
|
Printv(w->code, cleanup, NIL);
|
||||||
Printf(f->code, "return octave_value_list();\n");
|
Printf(w->code, "return octave_value_list();\n");
|
||||||
Printf(f->code, "}\n");
|
Printf(w->code, "}\n");
|
||||||
|
|
||||||
/* Substitute the cleanup code */
|
/* Substitute the cleanup code */
|
||||||
Replaceall(f->code, "$cleanup", cleanup);
|
Replaceall(w->code, "$cleanup", cleanup);
|
||||||
|
|
||||||
Replaceall(f->code, "$symname", iname);
|
Replaceall(w->code, "$symname", iname);
|
||||||
Wrapper_print(f, f_wrappers);
|
Wrapper_print(w, f_wrappers);
|
||||||
DelWrapper(f);
|
DelWrapper(w);
|
||||||
|
|
||||||
if (last_overload)
|
if (last_overload) {
|
||||||
dispatchFunction(n);
|
dispatchFunction(n);
|
||||||
|
}
|
||||||
|
|
||||||
if (!overloaded || last_overload) {
|
if (!overloaded || last_overload) {
|
||||||
String* tname = texinfo_name(n);
|
String* tname = texinfo_name(n);
|
||||||
|
|
@ -773,29 +801,30 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void dispatchFunction(Node* n) {
|
void dispatchFunction(Node* n) {
|
||||||
Wrapper *f = NewWrapper();
|
Wrapper* w = NewWrapper();
|
||||||
|
|
||||||
String* iname = Getattr(n, "sym:name");
|
String* iname = Getattr(n, "sym:name");
|
||||||
String* wname = Swig_name_wrapper(iname);
|
String* wname = Swig_name_wrapper(iname);
|
||||||
int maxargs;
|
int maxargs;
|
||||||
String* dispatch = Swig_overload_dispatch(n, "return %s(args, nargout);", &maxargs);
|
String* dispatch = Swig_overload_dispatch(n, "return %s(args, nargout);", &maxargs);
|
||||||
String *tmp = NewString("");
|
String* tmp = NewStringEmpty();
|
||||||
|
|
||||||
Octave_begin_function(n, f->def, iname, wname, true);
|
Octave_begin_function(n, w->def, iname, wname, true);
|
||||||
Wrapper_add_local(f, "argc", "int argc = args.length()");
|
Wrapper_add_local(w, "argc", "int argc = args.length()");
|
||||||
Printf(tmp, "octave_value_ref argv[%d]={", maxargs);
|
Printf(tmp, "octave_value_ref argv[%d]={", maxargs);
|
||||||
for (int j = 0; j < maxargs; ++j)
|
for (int j = 0; j < maxargs; ++j) {
|
||||||
Printf(tmp, "%soctave_value_ref(args,%d)", j ? "," : " ", j);
|
Printf(tmp, "%soctave_value_ref(args,%d)", j ? "," : " ", j);
|
||||||
|
}
|
||||||
Printf(tmp, "}");
|
Printf(tmp, "}");
|
||||||
Wrapper_add_local(f, "argv", tmp);
|
Wrapper_add_local(w, "argv", tmp);
|
||||||
Printv(f->code, dispatch, "\n", NIL);
|
Printv(w->code, dispatch, "\n", NIL);
|
||||||
Printf(f->code, "error(\"No matching function for overload\");\n", iname);
|
Printf(w->code, "error(\"No matching function for overload\");\n", iname);
|
||||||
Printf(f->code, "return octave_value_list();\n");
|
Printf(w->code, "return octave_value_list();\n");
|
||||||
Printv(f->code, "}\n", NIL);
|
Printv(w->code, "}\n", NIL);
|
||||||
|
|
||||||
Wrapper_print(f, f_wrappers);
|
Wrapper_print(w, f_wrappers);
|
||||||
Delete(tmp);
|
Delete(tmp);
|
||||||
DelWrapper(f);
|
DelWrapper(w);
|
||||||
Delete(dispatch);
|
Delete(dispatch);
|
||||||
Delete(wname);
|
Delete(wname);
|
||||||
}
|
}
|
||||||
|
|
@ -805,12 +834,13 @@ public:
|
||||||
String* iname = Getattr(n, "sym:name");
|
String* iname = Getattr(n, "sym:name");
|
||||||
SwigType* t = Getattr(n, "type");
|
SwigType* t = Getattr(n, "type");
|
||||||
|
|
||||||
if (!addSymbol(iname, n))
|
if (!addSymbol(iname, n)) {
|
||||||
return SWIG_ERROR;
|
return SWIG_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
String* tm;
|
String* tm;
|
||||||
Wrapper *getf = NewWrapper();
|
Wrapper* getw = NewWrapper();
|
||||||
Wrapper *setf = NewWrapper();
|
Wrapper* setw = NewWrapper();
|
||||||
|
|
||||||
String* getname = Swig_name_get(NSPACE_TODO, iname);
|
String* getname = Swig_name_get(NSPACE_TODO, iname);
|
||||||
String* setname = Swig_name_set(NSPACE_TODO, iname);
|
String* setname = Swig_name_set(NSPACE_TODO, iname);
|
||||||
|
|
@ -818,8 +848,8 @@ public:
|
||||||
String* getwname = Swig_name_wrapper(getname);
|
String* getwname = Swig_name_wrapper(getname);
|
||||||
String* setwname = Swig_name_wrapper(setname);
|
String* setwname = Swig_name_wrapper(setname);
|
||||||
|
|
||||||
Octave_begin_function(n, setf->def, setname, setwname, true);
|
Octave_begin_function(n, setw->def, setname, setwname, true);
|
||||||
Printf(setf->def, "if (!SWIG_check_num_args(\"%s_set\",args.length(),1,1,0)) return octave_value_list();", iname);
|
Printf(setw->def, "if (!SWIG_check_num_args(\"%s_set\",args.length(),1,1,0)) return octave_value_list();", iname);
|
||||||
if (is_assignable(n)) {
|
if (is_assignable(n)) {
|
||||||
Setattr(n, "wrap:name", setname);
|
Setattr(n, "wrap:name", setname);
|
||||||
if ((tm = Swig_typemap_lookup("varin", n, name, 0))) {
|
if ((tm = Swig_typemap_lookup("varin", n, name, 0))) {
|
||||||
|
|
@ -829,46 +859,46 @@ public:
|
||||||
if (Getattr(n, "tmap:varin:implicitconv")) {
|
if (Getattr(n, "tmap:varin:implicitconv")) {
|
||||||
Replaceall(tm, "$implicitconv", get_implicitconv_flag(n));
|
Replaceall(tm, "$implicitconv", get_implicitconv_flag(n));
|
||||||
}
|
}
|
||||||
emit_action_code(n, setf->code, tm);
|
emit_action_code(n, setw->code, tm);
|
||||||
Delete(tm);
|
Delete(tm);
|
||||||
} else {
|
} else {
|
||||||
Swig_warning(WARN_TYPEMAP_VARIN_UNDEF, input_file, line_number, "Unable to set variable of type %s.\n", SwigType_str(t, 0));
|
Swig_warning(WARN_TYPEMAP_VARIN_UNDEF, input_file, line_number, "Unable to set variable of type %s.\n", SwigType_str(t, 0));
|
||||||
}
|
}
|
||||||
Append(setf->code, "fail:\n");
|
Append(setw->code, "fail:\n");
|
||||||
Printf(setf->code, "return octave_value_list();\n");
|
Printf(setw->code, "return octave_value_list();\n");
|
||||||
} else {
|
} else {
|
||||||
Printf(setf->code, "return octave_set_immutable(args,nargout);");
|
Printf(setw->code, "return octave_set_immutable(args,nargout);");
|
||||||
}
|
}
|
||||||
Append(setf->code, "}\n");
|
Append(setw->code, "}\n");
|
||||||
Wrapper_print(setf, f_wrappers);
|
Wrapper_print(setw, f_wrappers);
|
||||||
|
|
||||||
Setattr(n, "wrap:name", getname);
|
Setattr(n, "wrap:name", getname);
|
||||||
int addfail = 0;
|
int addfail = 0;
|
||||||
Octave_begin_function(n, getf->def, getname, getwname, true);
|
Octave_begin_function(n, getw->def, getname, getwname, true);
|
||||||
Wrapper_add_local(getf, "obj", "octave_value obj");
|
Wrapper_add_local(getw, "obj", "octave_value obj");
|
||||||
if ((tm = Swig_typemap_lookup("varout", n, name, 0))) {
|
if ((tm = Swig_typemap_lookup("varout", n, name, 0))) {
|
||||||
Replaceall(tm, "$source", name);
|
Replaceall(tm, "$source", name);
|
||||||
Replaceall(tm, "$target", "obj");
|
Replaceall(tm, "$target", "obj");
|
||||||
Replaceall(tm, "$result", "obj");
|
Replaceall(tm, "$result", "obj");
|
||||||
addfail = emit_action_code(n, getf->code, tm);
|
addfail = emit_action_code(n, getw->code, tm);
|
||||||
Delete(tm);
|
Delete(tm);
|
||||||
} else {
|
} else {
|
||||||
Swig_warning(WARN_TYPEMAP_VAROUT_UNDEF, input_file, line_number, "Unable to read variable of type %s\n", SwigType_str(t, 0));
|
Swig_warning(WARN_TYPEMAP_VAROUT_UNDEF, input_file, line_number, "Unable to read variable of type %s\n", SwigType_str(t, 0));
|
||||||
}
|
}
|
||||||
Append(getf->code, " return obj;\n");
|
Append(getw->code, " return obj;\n");
|
||||||
if (addfail) {
|
if (addfail) {
|
||||||
Append(getf->code, "fail:\n");
|
Append(getw->code, "fail:\n");
|
||||||
Append(getf->code, " return octave_value_list();\n");
|
Append(getw->code, " return octave_value_list();\n");
|
||||||
}
|
}
|
||||||
Append(getf->code, "}\n");
|
Append(getw->code, "}\n");
|
||||||
Wrapper_print(getf, f_wrappers);
|
Wrapper_print(getw, f_wrappers);
|
||||||
|
|
||||||
Printf(s_global_tab, "{\"%s\",0,%s,%s,2,0},\n", iname, getwname, setwname);
|
Printf(s_global_tab, "{\"%s\",0,%s,%s,2,0},\n", iname, getwname, setwname);
|
||||||
|
|
||||||
Delete(getwname);
|
Delete(getwname);
|
||||||
Delete(setwname);
|
Delete(setwname);
|
||||||
DelWrapper(setf);
|
DelWrapper(setw);
|
||||||
DelWrapper(getf);
|
DelWrapper(getw);
|
||||||
|
|
||||||
return SWIG_OK;
|
return SWIG_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -882,8 +912,9 @@ public:
|
||||||
String* cppvalue = Getattr(n, "cppvalue");
|
String* cppvalue = Getattr(n, "cppvalue");
|
||||||
String* tm;
|
String* tm;
|
||||||
|
|
||||||
if (!addSymbol(iname, n))
|
if (!addSymbol(iname, n)) {
|
||||||
return SWIG_ERROR;
|
return SWIG_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
if (SwigType_type(type) == T_MPOINTER) {
|
if (SwigType_type(type) == T_MPOINTER) {
|
||||||
String* wname = Swig_name_wrapper(iname);
|
String* wname = Swig_name_wrapper(iname);
|
||||||
|
|
@ -929,8 +960,9 @@ public:
|
||||||
|
|
||||||
class_name = Getattr(n, "sym:name");
|
class_name = Getattr(n, "sym:name");
|
||||||
|
|
||||||
if (!addSymbol(class_name, n))
|
if (!addSymbol(class_name, n)) {
|
||||||
return SWIG_ERROR;
|
return SWIG_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
// This is a bug, due to the fact that swig_type -> octave_class mapping
|
// This is a bug, due to the fact that swig_type -> octave_class mapping
|
||||||
// is 1-to-n.
|
// is 1-to-n.
|
||||||
|
|
@ -944,7 +976,7 @@ public:
|
||||||
Delete(mangled_classname);
|
Delete(mangled_classname);
|
||||||
|
|
||||||
assert(!s_members_tab);
|
assert(!s_members_tab);
|
||||||
s_members_tab = NewString("");
|
s_members_tab = NewStringEmpty();
|
||||||
Printv(s_members_tab, "static swig_octave_member swig_", class_name, "_members[] = {\n", NIL);
|
Printv(s_members_tab, "static swig_octave_member swig_", class_name, "_members[] = {\n", NIL);
|
||||||
|
|
||||||
Language::classHandler(n);
|
Language::classHandler(n);
|
||||||
|
|
@ -980,8 +1012,8 @@ public:
|
||||||
Printf(s_members_tab, "{0,0,0,0}\n};\n");
|
Printf(s_members_tab, "{0,0,0,0}\n};\n");
|
||||||
Printv(f_wrappers, s_members_tab, NIL);
|
Printv(f_wrappers, s_members_tab, NIL);
|
||||||
|
|
||||||
String *base_class_names = NewString("");
|
String* base_class_names = NewStringEmpty();
|
||||||
String *base_class = NewString("");
|
String* base_class = NewStringEmpty();
|
||||||
List* baselist = Getattr(n, "bases");
|
List* baselist = Getattr(n, "bases");
|
||||||
if (baselist && Len(baselist)) {
|
if (baselist && Len(baselist)) {
|
||||||
Iterator b;
|
Iterator b;
|
||||||
|
|
@ -1016,8 +1048,9 @@ public:
|
||||||
Delete(tname);
|
Delete(tname);
|
||||||
Delete(wcname);
|
Delete(wcname);
|
||||||
Delete(cname);
|
Delete(cname);
|
||||||
} else
|
} else {
|
||||||
Printv(f_wrappers, "0,0,", NIL);
|
Printv(f_wrappers, "0,0,", NIL);
|
||||||
|
}
|
||||||
if (have_destructor) {
|
if (have_destructor) {
|
||||||
String* nspace = Getattr(n, "sym:nspace");
|
String* nspace = Getattr(n, "sym:nspace");
|
||||||
String* cname = Swig_name_destroy(nspace, class_name);
|
String* cname = Swig_name_destroy(nspace, class_name);
|
||||||
|
|
@ -1025,8 +1058,9 @@ public:
|
||||||
Printf(f_wrappers, "%s,", wcname);
|
Printf(f_wrappers, "%s,", wcname);
|
||||||
Delete(wcname);
|
Delete(wcname);
|
||||||
Delete(cname);
|
Delete(cname);
|
||||||
} else
|
} else {
|
||||||
Printv(f_wrappers, "0", ",", NIL);
|
Printv(f_wrappers, "0", ",", NIL);
|
||||||
|
}
|
||||||
Printf(f_wrappers, "swig_%s_members,swig_%s_base_names,swig_%s_base };\n\n", class_name, class_name, class_name);
|
Printf(f_wrappers, "swig_%s_members,swig_%s_base_names,swig_%s_base };\n\n", class_name, class_name, class_name);
|
||||||
|
|
||||||
Delete(base_class);
|
Delete(base_class);
|
||||||
|
|
@ -1054,8 +1088,9 @@ public:
|
||||||
String* tname = texinfo_name(n);
|
String* tname = texinfo_name(n);
|
||||||
String* rname = Copy(wname);
|
String* rname = Copy(wname);
|
||||||
bool overloaded = !!Getattr(n, "sym:overloaded");
|
bool overloaded = !!Getattr(n, "sym:overloaded");
|
||||||
if (overloaded)
|
if (overloaded) {
|
||||||
Delslice(rname, Len(rname) - Len(Getattr(n, "sym:overname")), DOH_END);
|
Delslice(rname, Len(rname) - Len(Getattr(n, "sym:overname")), DOH_END);
|
||||||
|
}
|
||||||
Printf(s_members_tab, "{\"%s\",%s,0,0,0,%s},\n",
|
Printf(s_members_tab, "{\"%s\",%s,0,0,0,%s},\n",
|
||||||
realname, rname, tname);
|
realname, rname, tname);
|
||||||
Delete(rname);
|
Delete(rname);
|
||||||
|
|
@ -1090,8 +1125,9 @@ public:
|
||||||
|
|
||||||
virtual int constructorHandler(Node* n) {
|
virtual int constructorHandler(Node* n) {
|
||||||
have_constructor = 1;
|
have_constructor = 1;
|
||||||
if (!constructor_name)
|
if (!constructor_name) {
|
||||||
constructor_name = NewString(Getattr(n, "sym:name"));
|
constructor_name = NewString(Getattr(n, "sym:name"));
|
||||||
|
}
|
||||||
|
|
||||||
int use_director = Swig_directorclass(n);
|
int use_director = Swig_directorclass(n);
|
||||||
if (use_director) {
|
if (use_director) {
|
||||||
|
|
@ -1104,8 +1140,9 @@ public:
|
||||||
Delete(type);
|
Delete(type);
|
||||||
Delete(name);
|
Delete(name);
|
||||||
Setattr(self, "lname", "self_obj");
|
Setattr(self, "lname", "self_obj");
|
||||||
if (parms)
|
if (parms) {
|
||||||
set_nextSibling(self, parms);
|
set_nextSibling(self, parms);
|
||||||
|
}
|
||||||
Setattr(n, "parms", self);
|
Setattr(n, "parms", self);
|
||||||
Setattr(n, "wrap:self", "1");
|
Setattr(n, "wrap:self", "1");
|
||||||
Setattr(n, "hidden", "1");
|
Setattr(n, "hidden", "1");
|
||||||
|
|
@ -1135,8 +1172,9 @@ public:
|
||||||
String* tname = texinfo_name(n);
|
String* tname = texinfo_name(n);
|
||||||
String* rname = Copy(wname);
|
String* rname = Copy(wname);
|
||||||
bool overloaded = !!Getattr(n, "sym:overloaded");
|
bool overloaded = !!Getattr(n, "sym:overloaded");
|
||||||
if (overloaded)
|
if (overloaded) {
|
||||||
Delslice(rname, Len(rname) - Len(Getattr(n, "sym:overname")), DOH_END);
|
Delslice(rname, Len(rname) - Len(Getattr(n, "sym:overname")), DOH_END);
|
||||||
|
}
|
||||||
Printf(s_members_tab, "{\"%s\",%s,0,0,1,%s},\n",
|
Printf(s_members_tab, "{\"%s\",%s,0,0,1,%s},\n",
|
||||||
realname, rname, tname);
|
realname, rname, tname);
|
||||||
Delete(rname);
|
Delete(rname);
|
||||||
|
|
@ -1191,10 +1229,10 @@ public:
|
||||||
|
|
||||||
int classDirectorConstructor(Node* n) {
|
int classDirectorConstructor(Node* n) {
|
||||||
Node* parent = Getattr(n, "parentNode");
|
Node* parent = Getattr(n, "parentNode");
|
||||||
String *sub = NewString("");
|
String* sub = NewStringEmpty();
|
||||||
String* decl = Getattr(n, "decl");
|
String* decl = Getattr(n, "decl");
|
||||||
String* supername = Swig_class_name(parent);
|
String* supername = Swig_class_name(parent);
|
||||||
String *classname = NewString("");
|
String* classname = NewStringEmpty();
|
||||||
Printf(classname, "SwigDirector_%s", supername);
|
Printf(classname, "SwigDirector_%s", supername);
|
||||||
|
|
||||||
// insert self parameter
|
// insert self parameter
|
||||||
|
|
@ -1262,11 +1300,11 @@ public:
|
||||||
String* classname = Getattr(parent, "sym:name");
|
String* classname = Getattr(parent, "sym:name");
|
||||||
String* c_classname = Getattr(parent, "name");
|
String* c_classname = Getattr(parent, "name");
|
||||||
String* symname = Getattr(n, "sym:name");
|
String* symname = Getattr(n, "sym:name");
|
||||||
String *declaration = NewString("");
|
String* declaration = NewStringEmpty();
|
||||||
ParmList* l = Getattr(n, "parms");
|
ParmList* l = Getattr(n, "parms");
|
||||||
Wrapper* w = NewWrapper();
|
Wrapper* w = NewWrapper();
|
||||||
String* tm;
|
String* tm;
|
||||||
String *wrap_args = NewString("");
|
String* wrap_args = NewStringEmpty();
|
||||||
String* value = Getattr(n, "value");
|
String* value = Getattr(n, "value");
|
||||||
String* storage = Getattr(n, "storage");
|
String* storage = Getattr(n, "storage");
|
||||||
bool pure_virtual = false;
|
bool pure_virtual = false;
|
||||||
|
|
@ -1309,8 +1347,9 @@ public:
|
||||||
Append(w->def, " throw(");
|
Append(w->def, " throw(");
|
||||||
Append(declaration, " throw(");
|
Append(declaration, " throw(");
|
||||||
|
|
||||||
if (throw_parm_list)
|
if (throw_parm_list) {
|
||||||
Swig_typemap_attach_parms("throws", throw_parm_list, 0);
|
Swig_typemap_attach_parms("throws", throw_parm_list, 0);
|
||||||
|
}
|
||||||
for (p = throw_parm_list; p; p = nextSibling(p)) {
|
for (p = throw_parm_list; p; p = nextSibling(p)) {
|
||||||
if (Getattr(p, "tmap:throws")) {
|
if (Getattr(p, "tmap:throws")) {
|
||||||
if (gencomma++) {
|
if (gencomma++) {
|
||||||
|
|
@ -1344,8 +1383,9 @@ public:
|
||||||
|
|
||||||
if (ignored_method) {
|
if (ignored_method) {
|
||||||
if (!pure_virtual) {
|
if (!pure_virtual) {
|
||||||
if (!is_void)
|
if (!is_void) {
|
||||||
Printf(w->code, "return ");
|
Printf(w->code, "return ");
|
||||||
|
}
|
||||||
String* super_call = Swig_method_call(super, l);
|
String* super_call = Swig_method_call(super, l);
|
||||||
Printf(w->code, "%s;\n", super_call);
|
Printf(w->code, "%s;\n", super_call);
|
||||||
Delete(super_call);
|
Delete(super_call);
|
||||||
|
|
@ -1355,7 +1395,7 @@ public:
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// attach typemaps to arguments (C/C++ -> Python)
|
// attach typemaps to arguments (C/C++ -> Python)
|
||||||
String *parse_args = NewString("");
|
String* parse_args = NewStringEmpty();
|
||||||
|
|
||||||
Swig_director_parms_fixup(l);
|
Swig_director_parms_fixup(l);
|
||||||
|
|
||||||
|
|
@ -1366,8 +1406,9 @@ public:
|
||||||
Parm* p;
|
Parm* p;
|
||||||
|
|
||||||
int outputs = 0;
|
int outputs = 0;
|
||||||
if (!is_void)
|
if (!is_void) {
|
||||||
outputs++;
|
outputs++;
|
||||||
|
}
|
||||||
|
|
||||||
// build argument list and type conversion string
|
// build argument list and type conversion string
|
||||||
p = l;
|
p = l;
|
||||||
|
|
@ -1377,8 +1418,9 @@ public:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Getattr(p, "tmap:directorargout") != 0)
|
if (Getattr(p, "tmap:directorargout") != 0) {
|
||||||
outputs++;
|
outputs++;
|
||||||
|
}
|
||||||
|
|
||||||
String* pname = Getattr(p, "name");
|
String* pname = Getattr(p, "name");
|
||||||
String* ptype = Getattr(p, "type");
|
String* ptype = Getattr(p, "type");
|
||||||
|
|
@ -1398,9 +1440,10 @@ public:
|
||||||
Setattr(p, "emit:directorinput", pname);
|
Setattr(p, "emit:directorinput", pname);
|
||||||
Replaceall(tm, "$input", pname);
|
Replaceall(tm, "$input", pname);
|
||||||
Replaceall(tm, "$owner", "0");
|
Replaceall(tm, "$owner", "0");
|
||||||
if (Len(tm) == 0)
|
if (Len(tm) == 0) {
|
||||||
Append(tm, pname);
|
Append(tm, pname);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
p = Getattr(p, "tmap:directorin:next");
|
p = Getattr(p, "tmap:directorin:next");
|
||||||
continue;
|
continue;
|
||||||
} else if (Cmp(ptype, "void")) {
|
} else if (Cmp(ptype, "void")) {
|
||||||
|
|
@ -1425,8 +1468,8 @@ public:
|
||||||
Printf(w->code, "idx.push_back(args);\n");
|
Printf(w->code, "idx.push_back(args);\n");
|
||||||
Printf(w->code, "out=swig_get_self()->subsref(\".(\",idx,%d);\n", outputs);
|
Printf(w->code, "out=swig_get_self()->subsref(\".(\",idx,%d);\n", outputs);
|
||||||
|
|
||||||
String *cleanup = NewString("");
|
String* cleanup = NewStringEmpty();
|
||||||
String *outarg = NewString("");
|
String* outarg = NewStringEmpty();
|
||||||
idx = 0;
|
idx = 0;
|
||||||
|
|
||||||
// marshal return value
|
// marshal return value
|
||||||
|
|
@ -1492,14 +1535,15 @@ public:
|
||||||
Append(w->code, "}\n");
|
Append(w->code, "}\n");
|
||||||
|
|
||||||
// We expose protected methods via an extra public inline method which makes a straight call to the wrapped class' method
|
// We expose protected methods via an extra public inline method which makes a straight call to the wrapped class' method
|
||||||
String *inline_extra_method = NewString("");
|
String* inline_extra_method = NewStringEmpty();
|
||||||
if (dirprot_mode() && !is_public(n) && !pure_virtual) {
|
if (dirprot_mode() && !is_public(n) && !pure_virtual) {
|
||||||
Printv(inline_extra_method, declaration, NIL);
|
Printv(inline_extra_method, declaration, NIL);
|
||||||
String* extra_method_name = NewStringf("%sSwigPublic", name);
|
String* extra_method_name = NewStringf("%sSwigPublic", name);
|
||||||
Replaceall(inline_extra_method, name, extra_method_name);
|
Replaceall(inline_extra_method, name, extra_method_name);
|
||||||
Replaceall(inline_extra_method, ";\n", " {\n ");
|
Replaceall(inline_extra_method, ";\n", " {\n ");
|
||||||
if (!is_void)
|
if (!is_void) {
|
||||||
Printf(inline_extra_method, "return ");
|
Printf(inline_extra_method, "return ");
|
||||||
|
}
|
||||||
String* methodcall = Swig_method_call(super, l);
|
String* methodcall = Swig_method_call(super, l);
|
||||||
Printv(inline_extra_method, methodcall, ";\n }\n", NIL);
|
Printv(inline_extra_method, methodcall, ";\n }\n", NIL);
|
||||||
Delete(methodcall);
|
Delete(methodcall);
|
||||||
|
|
@ -1522,7 +1566,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
String* runtimeCode() {
|
String* runtimeCode() {
|
||||||
String *s = NewString("");
|
String* s = NewStringEmpty();
|
||||||
String* srun = Swig_include_sys("octrun.swg");
|
String* srun = Swig_include_sys("octrun.swg");
|
||||||
if (!srun) {
|
if (!srun) {
|
||||||
Printf(stderr, "*** Unable to open 'octrun.swg'\n");
|
Printf(stderr, "*** Unable to open 'octrun.swg'\n");
|
||||||
|
|
@ -1538,6 +1582,7 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
extern "C" Language *swig_octave(void) {
|
extern "C" Language* swig_octave(void)
|
||||||
|
{
|
||||||
return new OCTAVE();
|
return new OCTAVE();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue