Remove numerous hard coded 'result' variable name in generated c/c++ wrappers. The variable name is now defined in just one place, making it possible to change the name easily if a target language so wishes - see cwrap.c.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12830 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
d1dc016b68
commit
24133bacd7
29 changed files with 252 additions and 227 deletions
|
|
@ -92,15 +92,15 @@
|
|||
// intrusive_ptr by value
|
||||
smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >**)&$input;
|
||||
if (smartarg) {
|
||||
$1 = SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >(smartarg->get(), true);
|
||||
$1 = SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >(smartarg->get(), true);
|
||||
}
|
||||
%}
|
||||
%typemap(out, fragment="SWIG_intrusive_deleter") SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > %{
|
||||
if ($1) {
|
||||
intrusive_ptr_add_ref(result.get());
|
||||
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(result.get(), SWIG_intrusive_deleter< CONST TYPE >());
|
||||
intrusive_ptr_add_ref($1.get());
|
||||
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1.get(), SWIG_intrusive_deleter< CONST TYPE >());
|
||||
} else {
|
||||
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = 0;
|
||||
*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = 0;
|
||||
}
|
||||
%}
|
||||
|
||||
|
|
@ -116,11 +116,11 @@
|
|||
%typemap(in) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > & ($*1_ltype tempnull, $*1_ltype temp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * smartarg) %{
|
||||
// intrusive_ptr by reference
|
||||
if ( $input ) {
|
||||
smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >**)&$input;
|
||||
temp = SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >(smartarg->get(), true);
|
||||
$1 = &temp;
|
||||
smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >**)&$input;
|
||||
temp = SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >(smartarg->get(), true);
|
||||
$1 = &temp;
|
||||
} else {
|
||||
$1 = &tempnull;
|
||||
$1 = &tempnull;
|
||||
}
|
||||
%}
|
||||
%typemap(memberin) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > & %{
|
||||
|
|
@ -142,11 +142,11 @@
|
|||
%typemap(in) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > * ($*1_ltype tempnull, $*1_ltype temp, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * smartarg) %{
|
||||
// intrusive_ptr by pointer
|
||||
if ( $input ) {
|
||||
smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >**)&$input;
|
||||
temp = SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >(smartarg->get(), true);
|
||||
$1 = &temp;
|
||||
smartarg = *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >**)&$input;
|
||||
temp = SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE >(smartarg->get(), true);
|
||||
$1 = &temp;
|
||||
} else {
|
||||
$1 = &tempnull;
|
||||
$1 = &tempnull;
|
||||
}
|
||||
%}
|
||||
%typemap(memberin) SWIG_INTRUSIVE_PTR_QNAMESPACE::intrusive_ptr< CONST TYPE > * %{
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@
|
|||
/* exception checking omitted */
|
||||
|
||||
for (i=0; i<len; i++) {
|
||||
temp_string = JCALL1(NewStringUTF, jenv, *result++);
|
||||
temp_string = JCALL1(NewStringUTF, jenv, *$1++);
|
||||
JCALL3(SetObjectArrayElement, jenv, jresult, i, temp_string);
|
||||
JCALL1(DeleteLocalRef, jenv, temp_string);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2424,7 +2424,7 @@ int ALLEGROCL::emit_defun(Node *n, File *fcl) {
|
|||
Wrapper *wrap = NewWrapper();
|
||||
Swig_typemap_attach_parms("lin", pl, wrap);
|
||||
// Swig_typemap_attach_parms("ffitype", pl, wrap);
|
||||
Swig_typemap_lookup("lout", n, "result", 0);
|
||||
Swig_typemap_lookup("lout", n, Swig_cresult_name(), 0);
|
||||
|
||||
SwigType *result_type = Swig_cparse_type(Getattr(n, "tmap:ctype"));
|
||||
// prime the pump, with support for OUTPUT, INOUT typemaps.
|
||||
|
|
@ -2589,7 +2589,7 @@ int ALLEGROCL::emit_defun(Node *n, File *fcl) {
|
|||
/////////////////////////////////////////////////////
|
||||
// Lisp foreign call return type and optimizations //
|
||||
/////////////////////////////////////////////////////
|
||||
Printf(fcl, " (:returning (%s %s)", compose_foreign_type(n, result_type), get_lisp_type(n, Getattr(n, "type"), "result"));
|
||||
Printf(fcl, " (:returning (%s %s)", compose_foreign_type(n, result_type), get_lisp_type(n, Getattr(n, "type"), Swig_cresult_name()));
|
||||
|
||||
for (Iterator option = First(n); option.item; option = Next(option)) {
|
||||
if (Strncmp("feature:ffargs:", option.key, 15))
|
||||
|
|
@ -2748,7 +2748,7 @@ int ALLEGROCL::functionWrapper(Node *n) {
|
|||
|
||||
String *actioncode = emit_action(n);
|
||||
|
||||
String *tm = Swig_typemap_lookup_out("out", n, "result", f, actioncode);
|
||||
String *tm = Swig_typemap_lookup_out("out", n, Swig_cresult_name(), f, actioncode);
|
||||
if (!is_void_return && tm) {
|
||||
if (tm) {
|
||||
Replaceall(tm, "$result", "lresult");
|
||||
|
|
|
|||
|
|
@ -461,7 +461,7 @@ int CFFI::functionWrapper(Node *n) {
|
|||
|
||||
String *actioncode = emit_action(n);
|
||||
|
||||
String *result_convert = Swig_typemap_lookup_out("out", n, "result", f, actioncode);
|
||||
String *result_convert = Swig_typemap_lookup_out("out", n, Swig_cresult_name(), f, actioncode);
|
||||
Replaceall(result_convert, "$result", "lresult");
|
||||
Printf(f->code, "%s\n", result_convert);
|
||||
if(!is_void_return) Printf(f->code, " return lresult;\n");
|
||||
|
|
|
|||
|
|
@ -533,8 +533,8 @@ int CHICKEN::functionWrapper(Node *n) {
|
|||
String *actioncode = emit_action(n);
|
||||
|
||||
/* Return the function value */
|
||||
if ((tm = Swig_typemap_lookup_out("out", n, "result", f, actioncode))) {
|
||||
Replaceall(tm, "$source", "result");
|
||||
if ((tm = Swig_typemap_lookup_out("out", n, Swig_cresult_name(), f, actioncode))) {
|
||||
Replaceall(tm, "$source", Swig_cresult_name());
|
||||
Replaceall(tm, "$target", "resultobj");
|
||||
Replaceall(tm, "$result", "resultobj");
|
||||
if (GetFlag(n, "feature:new")) {
|
||||
|
|
@ -561,15 +561,15 @@ int CHICKEN::functionWrapper(Node *n) {
|
|||
|
||||
/* Look to see if there is any newfree cleanup code */
|
||||
if (GetFlag(n, "feature:new")) {
|
||||
if ((tm = Swig_typemap_lookup("newfree", n, "result", 0))) {
|
||||
Replaceall(tm, "$source", "result");
|
||||
if ((tm = Swig_typemap_lookup("newfree", n, Swig_cresult_name(), 0))) {
|
||||
Replaceall(tm, "$source", Swig_cresult_name());
|
||||
Printf(f->code, "%s\n", tm);
|
||||
}
|
||||
}
|
||||
|
||||
/* See if there is any return cleanup code */
|
||||
if ((tm = Swig_typemap_lookup("ret", n, "result", 0))) {
|
||||
Replaceall(tm, "$source", "result");
|
||||
if ((tm = Swig_typemap_lookup("ret", n, Swig_cresult_name(), 0))) {
|
||||
Replaceall(tm, "$source", Swig_cresult_name());
|
||||
Printf(f->code, "%s\n", tm);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ String *Contracts::make_expression(String *s, Node *n) {
|
|||
for (ei = First(list_assert); ei.item; ei = Next(ei)) {
|
||||
expr = ei.item;
|
||||
if (Len(expr)) {
|
||||
Replaceid(expr, Getattr(n, "name"), "result");
|
||||
Replaceid(expr, Getattr(n, "name"), Swig_cresult_name());
|
||||
if (Len(str_assert))
|
||||
Append(str_assert, "&&");
|
||||
Printf(str_assert, "(%s)", expr);
|
||||
|
|
|
|||
|
|
@ -933,7 +933,7 @@ public:
|
|||
|
||||
// below based on Swig_VargetToFunction()
|
||||
SwigType *ty = Swig_wrapped_var_type(Getattr(n, "type"), use_naturalvar_mode(n));
|
||||
Setattr(n, "wrap:action", NewStringf("result = (%s)(%s);", SwigType_lstr(ty, 0), Getattr(n, "value")));
|
||||
Setattr(n, "wrap:action", NewStringf("%s = (%s)(%s);", Swig_cresult_name(), SwigType_lstr(ty, 0), Getattr(n, "value")));
|
||||
}
|
||||
|
||||
Swig_director_emit_dynamic_cast(n, f);
|
||||
|
|
@ -943,9 +943,9 @@ public:
|
|||
Swig_restore(n);
|
||||
|
||||
/* Return value if necessary */
|
||||
if ((tm = Swig_typemap_lookup_out("out", n, "result", f, actioncode))) {
|
||||
if ((tm = Swig_typemap_lookup_out("out", n, Swig_cresult_name(), f, actioncode))) {
|
||||
canThrow(n, "out", n);
|
||||
Replaceall(tm, "$source", "result"); /* deprecated */
|
||||
Replaceall(tm, "$source", Swig_cresult_name()); /* deprecated */
|
||||
Replaceall(tm, "$target", "jresult"); /* deprecated */
|
||||
Replaceall(tm, "$result", "jresult");
|
||||
|
||||
|
|
@ -972,18 +972,18 @@ public:
|
|||
|
||||
/* Look to see if there is any newfree cleanup code */
|
||||
if (GetFlag(n, "feature:new")) {
|
||||
if ((tm = Swig_typemap_lookup("newfree", n, "result", 0))) {
|
||||
if ((tm = Swig_typemap_lookup("newfree", n, Swig_cresult_name(), 0))) {
|
||||
canThrow(n, "newfree", n);
|
||||
Replaceall(tm, "$source", "result"); /* deprecated */
|
||||
Replaceall(tm, "$source", Swig_cresult_name()); /* deprecated */
|
||||
Printf(f->code, "%s\n", tm);
|
||||
}
|
||||
}
|
||||
|
||||
/* See if there is any return cleanup code */
|
||||
if (!native_function_flag) {
|
||||
if ((tm = Swig_typemap_lookup("ret", n, "result", 0))) {
|
||||
if ((tm = Swig_typemap_lookup("ret", n, Swig_cresult_name(), 0))) {
|
||||
canThrow(n, "ret", n);
|
||||
Replaceall(tm, "$source", "result"); /* deprecated */
|
||||
Replaceall(tm, "$source", Swig_cresult_name()); /* deprecated */
|
||||
Printf(f->code, "%s\n", tm);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1708,7 +1708,7 @@ public:
|
|||
|
||||
// below based on Swig_VargetToFunction()
|
||||
SwigType *ty = Swig_wrapped_var_type(Getattr(n, "type"), use_naturalvar_mode(n));
|
||||
Setattr(n, "wrap:action", NewStringf("result = (%s) %s;", SwigType_lstr(ty, 0), Getattr(n, "value")));
|
||||
Setattr(n, "wrap:action", NewStringf("%s = (%s) %s;", Swig_cresult_name(), SwigType_lstr(ty, 0), Getattr(n, "value")));
|
||||
}
|
||||
|
||||
Swig_director_emit_dynamic_cast(n, f);
|
||||
|
|
@ -1718,7 +1718,7 @@ public:
|
|||
Swig_restore(n);
|
||||
|
||||
/* Return value if necessary */
|
||||
if ((tm = Swig_typemap_lookup_out("out", n, "result", f, actioncode))) {
|
||||
if ((tm = Swig_typemap_lookup_out("out", n, Swig_cresult_name(), f, actioncode))) {
|
||||
canThrow(n, "out", n);
|
||||
Replaceall(tm, "$result", "jresult");
|
||||
|
||||
|
|
@ -1745,7 +1745,7 @@ public:
|
|||
|
||||
/* Look to see if there is any newfree cleanup code */
|
||||
if (GetFlag(n, "feature:new")) {
|
||||
if ((tm = Swig_typemap_lookup("newfree", n, "result", 0))) {
|
||||
if ((tm = Swig_typemap_lookup("newfree", n, Swig_cresult_name(), 0))) {
|
||||
canThrow(n, "newfree", n);
|
||||
Printf(f->code, "%s\n", tm);
|
||||
}
|
||||
|
|
@ -1753,7 +1753,7 @@ public:
|
|||
|
||||
/* See if there is any return cleanup code */
|
||||
if (!native_function_flag) {
|
||||
if ((tm = Swig_typemap_lookup("ret", n, "result", 0))) {
|
||||
if ((tm = Swig_typemap_lookup("ret", n, Swig_cresult_name(), 0))) {
|
||||
canThrow(n, "ret", n);
|
||||
Printf(f->code, "%s\n", tm);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,11 +32,11 @@ void emit_return_variable(Node *n, SwigType *rt, Wrapper *f) {
|
|||
SwigType *vt = cplus_value_type(rt);
|
||||
SwigType *tt = vt ? vt : rt;
|
||||
SwigType *lt = SwigType_ltype(tt);
|
||||
String *lstr = SwigType_str(lt, "result");
|
||||
String *lstr = SwigType_str(lt, Swig_cresult_name());
|
||||
if (SwigType_ispointer(lt)) {
|
||||
Wrapper_add_localv(f, "result", lstr, "= 0", NULL);
|
||||
Wrapper_add_localv(f, Swig_cresult_name(), lstr, "= 0", NULL);
|
||||
} else {
|
||||
Wrapper_add_local(f, "result", lstr);
|
||||
Wrapper_add_local(f, Swig_cresult_name(), lstr);
|
||||
}
|
||||
if (vt) {
|
||||
Delete(vt);
|
||||
|
|
@ -496,7 +496,7 @@ String *emit_action(Node *n) {
|
|||
}
|
||||
|
||||
/* Look for except typemap (Deprecated) */
|
||||
tm = Swig_typemap_lookup("except", n, "result", 0);
|
||||
tm = Swig_typemap_lookup("except", n, Swig_cresult_name(), 0);
|
||||
if (tm) {
|
||||
Setattr(n, "feature:except", tm);
|
||||
tm = 0;
|
||||
|
|
|
|||
|
|
@ -550,7 +550,7 @@ private:
|
|||
Getattr(n, "parms"));
|
||||
SwigType *type = Copy(getClassType());
|
||||
SwigType_add_pointer(type);
|
||||
String *cres = Swig_cresult(type, "result", call);
|
||||
String *cres = Swig_cresult(type, Swig_cresult_name(), call);
|
||||
Setattr(n, "wrap:action", cres);
|
||||
}
|
||||
} else if (Cmp(nodetype, "destructor") == 0) {
|
||||
|
|
@ -1156,7 +1156,7 @@ private:
|
|||
}
|
||||
if (SwigType_type(result) != T_VOID) {
|
||||
Printv(f->code, "\t\tlong : 0;\n", NULL);
|
||||
String *ln = NewString("result");
|
||||
String *ln = NewString(Swig_cresult_name());
|
||||
String *ct = gcCTypeForGoValue(n, result, ln);
|
||||
Delete(ln);
|
||||
Printv(f->code, "\t\t", ct, ";\n", NULL);
|
||||
|
|
@ -1417,12 +1417,13 @@ private:
|
|||
|
||||
Setattr(n, "type", result);
|
||||
|
||||
String *tm = Swig_typemap_lookup_out("out", n, "result", f, actioncode);
|
||||
String *tm = Swig_typemap_lookup_out("out", n, Swig_cresult_name(), f, actioncode);
|
||||
if (!tm) {
|
||||
Swig_warning(WARN_TYPEMAP_OUT_UNDEF, input_file, line_number, "Unable to use return type %s\n", SwigType_str(result, 0));
|
||||
} else {
|
||||
if (!gccgo_flag) {
|
||||
Replaceall(tm, "$result", "swig_a->result");
|
||||
static const String *swig_a_result = NewStringf("swig_a->%s", Swig_cresult_name());
|
||||
Replaceall(tm, "$result", swig_a_result);
|
||||
} else {
|
||||
Replaceall(tm, "$result", "go_result");
|
||||
}
|
||||
|
|
@ -1453,7 +1454,7 @@ private:
|
|||
if (!tm) {
|
||||
p = nextSibling(p);
|
||||
} else {
|
||||
Replaceall(tm, "$result", "result");
|
||||
Replaceall(tm, "$result", Swig_cresult_name());
|
||||
Replaceall(tm, "$input", Getattr(p, "emit:input"));
|
||||
Printv(f->code, tm, "\n", NULL);
|
||||
p = Getattr(p, "tmap:argout:next");
|
||||
|
|
@ -1496,9 +1497,9 @@ private:
|
|||
Printv(f->code, cleanup, NULL);
|
||||
|
||||
if (GetFlag(n, "feature:new")) {
|
||||
String *tm = Swig_typemap_lookup("newfree", n, "result", 0);
|
||||
String *tm = Swig_typemap_lookup("newfree", n, Swig_cresult_name(), 0);
|
||||
if (tm) {
|
||||
Replaceall(tm, "$source", "result");
|
||||
Replaceall(tm, "$source", Swig_cresult_name());
|
||||
Printv(f->code, tm, "\n", NULL);
|
||||
Delete(tm);
|
||||
}
|
||||
|
|
@ -1690,7 +1691,7 @@ private:
|
|||
}
|
||||
|
||||
String *get = NewString("");
|
||||
Printv(get, "result = ", NULL);
|
||||
Printv(get, Swig_cresult_name(), " = ", NULL);
|
||||
|
||||
char quote;
|
||||
if (Getattr(n, "wrappedasconstant")) {
|
||||
|
|
@ -2040,7 +2041,7 @@ private:
|
|||
}
|
||||
} else {
|
||||
String *call = Swig_cfunction_call(Getattr(method, "name"), Getattr(method, "parms"));
|
||||
Setattr(method, "wrap:action", Swig_cresult(Getattr(method, "type"), "result", call));
|
||||
Setattr(method, "wrap:action", Swig_cresult(Getattr(method, "type"), Swig_cresult_name(), call));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2230,7 +2231,7 @@ private:
|
|||
|
||||
String *pn = Swig_cparm_name(parm, 0);
|
||||
String *action = NewString("");
|
||||
Printv(action, "result = (", Getattr(b.item, "classtype"), "*)", pn, ";", NULL);
|
||||
Printv(action, Swig_cresult_name(), " = (", Getattr(b.item, "classtype"), "*)", pn, ";", NULL);
|
||||
Delete(pn);
|
||||
|
||||
Setattr(n, "wrap:action", action);
|
||||
|
|
@ -2556,7 +2557,7 @@ private:
|
|||
Setattr(n, "wrap:name", Swig_name_wrapper(name));
|
||||
|
||||
String *action = NewString("");
|
||||
Printv(action, "result = new SwigDirector_", class_name, "(", NULL);
|
||||
Printv(action, Swig_cresult_name(), " = new SwigDirector_", class_name, "(", NULL);
|
||||
String *pname = Swig_cparm_name(NULL, 0);
|
||||
Printv(action, pname, NULL);
|
||||
Delete(pname);
|
||||
|
|
@ -2677,8 +2678,7 @@ private:
|
|||
Setattr(n, "wrap:parms", parms);
|
||||
|
||||
String *result = NewString("void");
|
||||
int r = makeWrappers(n, fnname, fnname, NULL, wname, NULL, parms, result,
|
||||
isStatic(n));
|
||||
int r = makeWrappers(n, fnname, fnname, NULL, wname, NULL, parms, result, isStatic(n));
|
||||
if (r != SWIG_OK) {
|
||||
return r;
|
||||
}
|
||||
|
|
@ -3130,7 +3130,7 @@ private:
|
|||
|
||||
String *action = NewString("");
|
||||
if (SwigType_type(result) != T_VOID) {
|
||||
Printv(action, "result = (", SwigType_lstr(result, 0), ")", NULL);
|
||||
Printv(action, Swig_cresult_name(), " = (", SwigType_lstr(result, 0), ")", NULL);
|
||||
if (SwigType_isreference(result)) {
|
||||
Printv(action, "&", NULL);
|
||||
}
|
||||
|
|
@ -3399,7 +3399,7 @@ private:
|
|||
}
|
||||
if (SwigType_type(result) != T_VOID) {
|
||||
Printv(f->code, " long : 0;\n", NULL);
|
||||
String *rname = NewString("result");
|
||||
String *rname = NewString(Swig_cresult_name());
|
||||
String *cg = gcCTypeForGoValue(n, result, rname);
|
||||
Printv(f->code, " ", cg, ";\n", NULL);
|
||||
Delete(cg);
|
||||
|
|
@ -3440,7 +3440,8 @@ private:
|
|||
Swig_warning(WARN_TYPEMAP_DIRECTOROUT_UNDEF, input_file, line_number,
|
||||
"Unable to use type %s as director method result\n", SwigType_str(result, 0));
|
||||
} else {
|
||||
Replaceall(tm, "$input", "swig_a.result");
|
||||
static const String *swig_a_result = NewStringf("swig_a.%s", Swig_cresult_name());
|
||||
Replaceall(tm, "$input", swig_a_result);
|
||||
Replaceall(tm, "$result", "c_result");
|
||||
Printv(f->code, " ", tm, "\n", NULL);
|
||||
String *retstr = SwigType_rcaststr(Getattr(n, "returntype"), "c_result");
|
||||
|
|
@ -3462,7 +3463,7 @@ private:
|
|||
Printv(f_gc_wrappers, "}\n\n", NULL);
|
||||
} else {
|
||||
if (SwigType_type(result) != T_VOID) {
|
||||
String *r = NewString("result");
|
||||
String *r = NewString(Swig_cresult_name());
|
||||
String *tm = gccgoCTypeForGoValue(n, result, r);
|
||||
Wrapper_add_local(f, r, tm);
|
||||
Delete(tm);
|
||||
|
|
@ -3502,7 +3503,7 @@ private:
|
|||
|
||||
Printv(f->code, " ", NULL);
|
||||
if (SwigType_type(result) != T_VOID) {
|
||||
Printv(f->code, "result = ", NULL);
|
||||
Printv(f->code, Swig_cresult_name(), " = ", NULL);
|
||||
}
|
||||
Printv(f->code, callback_wname, "(go_val", args, ");\n", NULL);
|
||||
|
||||
|
|
@ -3514,7 +3515,7 @@ private:
|
|||
Swig_warning(WARN_TYPEMAP_DIRECTOROUT_UNDEF, input_file, line_number,
|
||||
"Unable to use type %s as director method result\n", SwigType_str(result, 0));
|
||||
} else {
|
||||
Replaceall(tm, "$input", "result");
|
||||
Replaceall(tm, "$input", Swig_cresult_name());
|
||||
Replaceall(tm, "$result", "c_result");
|
||||
Printv(f->code, " ", tm, "\n", NULL);
|
||||
String *retstr = SwigType_rcaststr(Getattr(n, "returntype"), "c_result");
|
||||
|
|
|
|||
|
|
@ -882,10 +882,10 @@ public:
|
|||
Printv(actioncode, tab4, "gh_allow_ints();\n", NIL);
|
||||
|
||||
// Now have return value, figure out what to do with it.
|
||||
if ((tm = Swig_typemap_lookup_out("out", n, "result", f, actioncode))) {
|
||||
if ((tm = Swig_typemap_lookup_out("out", n, Swig_cresult_name(), f, actioncode))) {
|
||||
Replaceall(tm, "$result", "gswig_result");
|
||||
Replaceall(tm, "$target", "gswig_result");
|
||||
Replaceall(tm, "$source", "result");
|
||||
Replaceall(tm, "$source", Swig_cresult_name());
|
||||
if (GetFlag(n, "feature:new"))
|
||||
Replaceall(tm, "$owner", "1");
|
||||
else
|
||||
|
|
@ -922,14 +922,14 @@ public:
|
|||
// Look for any remaining cleanup
|
||||
|
||||
if (GetFlag(n, "feature:new")) {
|
||||
if ((tm = Swig_typemap_lookup("newfree", n, "result", 0))) {
|
||||
Replaceall(tm, "$source", "result");
|
||||
if ((tm = Swig_typemap_lookup("newfree", n, Swig_cresult_name(), 0))) {
|
||||
Replaceall(tm, "$source", Swig_cresult_name());
|
||||
Printv(f->code, tm, "\n", NIL);
|
||||
}
|
||||
}
|
||||
// Free any memory allocated by the function being wrapped..
|
||||
if ((tm = Swig_typemap_lookup("ret", n, "result", 0))) {
|
||||
Replaceall(tm, "$source", "result");
|
||||
if ((tm = Swig_typemap_lookup("ret", n, Swig_cresult_name(), 0))) {
|
||||
Replaceall(tm, "$source", Swig_cresult_name());
|
||||
Printv(f->code, tm, "\n", NIL);
|
||||
}
|
||||
// Wrap things up (in a manner of speaking)
|
||||
|
|
|
|||
|
|
@ -1021,7 +1021,7 @@ public:
|
|||
|
||||
// below based on Swig_VargetToFunction()
|
||||
SwigType *ty = Swig_wrapped_var_type(Getattr(n, "type"), use_naturalvar_mode(n));
|
||||
Setattr(n, "wrap:action", NewStringf("result = (%s)(%s);", SwigType_lstr(ty, 0), Getattr(n, "value")));
|
||||
Setattr(n, "wrap:action", NewStringf("%s = (%s)(%s);", Swig_cresult_name(), SwigType_lstr(ty, 0), Getattr(n, "value")));
|
||||
}
|
||||
|
||||
// Now write code to make the function call
|
||||
|
|
@ -1035,9 +1035,9 @@ public:
|
|||
Swig_restore(n);
|
||||
|
||||
/* Return value if necessary */
|
||||
if ((tm = Swig_typemap_lookup_out("out", n, "result", f, actioncode))) {
|
||||
if ((tm = Swig_typemap_lookup_out("out", n, Swig_cresult_name(), f, actioncode))) {
|
||||
addThrows(n, "tmap:out", n);
|
||||
Replaceall(tm, "$source", "result"); /* deprecated */
|
||||
Replaceall(tm, "$source", Swig_cresult_name()); /* deprecated */
|
||||
Replaceall(tm, "$target", "jresult"); /* deprecated */
|
||||
Replaceall(tm, "$result", "jresult");
|
||||
|
||||
|
|
@ -1063,18 +1063,18 @@ public:
|
|||
|
||||
/* Look to see if there is any newfree cleanup code */
|
||||
if (GetFlag(n, "feature:new")) {
|
||||
if ((tm = Swig_typemap_lookup("newfree", n, "result", 0))) {
|
||||
if ((tm = Swig_typemap_lookup("newfree", n, Swig_cresult_name(), 0))) {
|
||||
addThrows(n, "tmap:newfree", n);
|
||||
Replaceall(tm, "$source", "result"); /* deprecated */
|
||||
Replaceall(tm, "$source", Swig_cresult_name()); /* deprecated */
|
||||
Printf(f->code, "%s\n", tm);
|
||||
}
|
||||
}
|
||||
|
||||
/* See if there is any return cleanup code */
|
||||
if (!native_function_flag) {
|
||||
if ((tm = Swig_typemap_lookup("ret", n, "result", 0))) {
|
||||
if ((tm = Swig_typemap_lookup("ret", n, Swig_cresult_name(), 0))) {
|
||||
addThrows(n, "tmap:ret", n);
|
||||
Replaceall(tm, "$source", "result"); /* deprecated */
|
||||
Replaceall(tm, "$source", Swig_cresult_name()); /* deprecated */
|
||||
Printf(f->code, "%s\n", tm);
|
||||
}
|
||||
}
|
||||
|
|
@ -1848,7 +1848,6 @@ public:
|
|||
"SWIGEXPORT jlong JNICALL ", wname, "(JNIEnv *jenv, jclass jcls, jlong jarg1) {\n",
|
||||
" jlong baseptr = 0;\n"
|
||||
" ", smartnamestr, " *argp1;\n"
|
||||
" ", bsmartnamestr, " result;\n"
|
||||
" (void)jenv;\n"
|
||||
" (void)jcls;\n"
|
||||
" argp1 = *(", smartnamestr, " **)&jarg1;\n"
|
||||
|
|
|
|||
|
|
@ -1111,7 +1111,7 @@ int Language::globalfunctionHandler(Node *n) {
|
|||
}
|
||||
Setattr(n, "parms", nonvoid_parms(parms));
|
||||
String *call = Swig_cfunction_call(name, parms);
|
||||
String *cres = Swig_cresult(type, "result", call);
|
||||
String *cres = Swig_cresult(type, Swig_cresult_name(), call);
|
||||
Setattr(n, "wrap:action", cres);
|
||||
Delete(cres);
|
||||
Delete(call);
|
||||
|
|
|
|||
|
|
@ -637,7 +637,7 @@ public:
|
|||
// }
|
||||
// else returnval++;
|
||||
Replaceall(tm, "$source", Getattr(p, "lname"));
|
||||
Replaceall(tm, "$target", "result");
|
||||
Replaceall(tm, "$target", Swig_cresult_name());
|
||||
Replaceall(tm, "$arg", Getattr(p, "emit:input"));
|
||||
Replaceall(tm, "$input", Getattr(p, "emit:input"));
|
||||
Printv(outarg, tm, "\n", NIL);
|
||||
|
|
@ -658,7 +658,7 @@ public:
|
|||
this is because there is a typemap for void
|
||||
NEW LANGUAGE NOTE:END ************************************************/
|
||||
// Return value if necessary
|
||||
if ((tm = Swig_typemap_lookup_out("out", n, "result", f, actioncode))) {
|
||||
if ((tm = Swig_typemap_lookup_out("out", n, Swig_cresult_name(), f, actioncode))) {
|
||||
// managing the number of returning variables
|
||||
// if (numoutputs=Getattr(tm,"numoutputs")){
|
||||
// int i=GetInt(tm,"numoutputs");
|
||||
|
|
@ -666,7 +666,7 @@ public:
|
|||
// returnval+=GetInt(tm,"numoutputs");
|
||||
// }
|
||||
// else returnval++;
|
||||
Replaceall(tm, "$source", "result");
|
||||
Replaceall(tm, "$source", Swig_cresult_name());
|
||||
if (GetFlag(n, "feature:new")) {
|
||||
Replaceall(tm, "$owner", "1");
|
||||
} else {
|
||||
|
|
@ -687,15 +687,15 @@ public:
|
|||
|
||||
/* Look to see if there is any newfree cleanup code */
|
||||
if (GetFlag(n, "feature:new")) {
|
||||
if ((tm = Swig_typemap_lookup("newfree", n, "result", 0))) {
|
||||
Replaceall(tm, "$source", "result");
|
||||
if ((tm = Swig_typemap_lookup("newfree", n, Swig_cresult_name(), 0))) {
|
||||
Replaceall(tm, "$source", Swig_cresult_name());
|
||||
Printf(f->code, "%s\n", tm);
|
||||
}
|
||||
}
|
||||
|
||||
/* See if there is any return cleanup code */
|
||||
if ((tm = Swig_typemap_lookup("ret", n, "result", 0))) {
|
||||
Replaceall(tm, "$source", "result");
|
||||
if ((tm = Swig_typemap_lookup("ret", n, Swig_cresult_name(), 0))) {
|
||||
Replaceall(tm, "$source", Swig_cresult_name());
|
||||
Printf(f->code, "%s\n", tm);
|
||||
}
|
||||
|
||||
|
|
@ -714,7 +714,7 @@ public:
|
|||
|
||||
/* Substitute the function name */
|
||||
Replaceall(f->code, "$symname", iname);
|
||||
Replaceall(f->code, "$result", "result");
|
||||
Replaceall(f->code, "$result", Swig_cresult_name());
|
||||
|
||||
/* Dump the function out */
|
||||
/* in Lua we will not emit the destructor as a wrappered function,
|
||||
|
|
|
|||
|
|
@ -1422,7 +1422,7 @@ MODULA3():
|
|||
|
||||
// below based on Swig_VargetToFunction()
|
||||
SwigType *ty = Swig_wrapped_var_type(Getattr(n, "type"), use_naturalvar_mode(n));
|
||||
Setattr(n, "wrap:action", NewStringf("result = (%s)(%s);", SwigType_lstr(ty, 0), Getattr(n, "value")));
|
||||
Setattr(n, "wrap:action", NewStringf("%s = (%s)(%s);", Swig_cresult_name(), SwigType_lstr(ty, 0), Getattr(n, "value")));
|
||||
}
|
||||
|
||||
Setattr(n, "wrap:name", wname);
|
||||
|
|
@ -1437,9 +1437,9 @@ MODULA3():
|
|||
|
||||
/* Return value if necessary */
|
||||
String *tm;
|
||||
if ((tm = Swig_typemap_lookup_out("out", n, "result", f, actioncode))) {
|
||||
if ((tm = Swig_typemap_lookup_out("out", n, Swig_cresult_name(), f, actioncode))) {
|
||||
addThrows(throws_hash, "out", n);
|
||||
Replaceall(tm, "$source", "result"); /* deprecated */
|
||||
Replaceall(tm, "$source", Swig_cresult_name()); /* deprecated */
|
||||
Replaceall(tm, "$target", "cresult"); /* deprecated */
|
||||
Replaceall(tm, "$result", "cresult");
|
||||
Printf(f->code, "%s", tm);
|
||||
|
|
@ -1459,19 +1459,19 @@ MODULA3():
|
|||
|
||||
/* Look to see if there is any newfree cleanup code */
|
||||
if (GetFlag(n, "feature:new")) {
|
||||
String *tm = Swig_typemap_lookup("newfree", n, "result", 0);
|
||||
String *tm = Swig_typemap_lookup("newfree", n, Swig_cresult_name(), 0);
|
||||
if (tm != NIL) {
|
||||
addThrows(throws_hash, "newfree", n);
|
||||
Replaceall(tm, "$source", "result"); /* deprecated */
|
||||
Replaceall(tm, "$source", Swig_cresult_name()); /* deprecated */
|
||||
Printf(f->code, "%s\n", tm);
|
||||
}
|
||||
}
|
||||
|
||||
/* See if there is any return cleanup code */
|
||||
if (!native_function_flag) {
|
||||
String *tm = Swig_typemap_lookup("ret", n, "result", 0);
|
||||
String *tm = Swig_typemap_lookup("ret", n, Swig_cresult_name(), 0);
|
||||
if (tm != NIL) {
|
||||
Replaceall(tm, "$source", "result"); /* deprecated */
|
||||
Replaceall(tm, "$source", Swig_cresult_name()); /* deprecated */
|
||||
Printf(f->code, "%s\n", tm);
|
||||
}
|
||||
}
|
||||
|
|
@ -3197,7 +3197,7 @@ MODULA3():
|
|||
writeArg(return_variables, state, NIL, NIL, NIL, NIL);
|
||||
|
||||
if (multiretval) {
|
||||
Printv(result_name, "result", NIL);
|
||||
Printv(result_name, Swig_cresult_name(), NIL);
|
||||
Printf(result_m3wraptype, "%sResult", func_name);
|
||||
m3wrap_intf.enterBlock(blocktype);
|
||||
Printf(m3wrap_intf.f, "%s =\nRECORD\n%sEND;\n", result_m3wraptype, return_variables);
|
||||
|
|
@ -3455,7 +3455,7 @@ MODULA3():
|
|||
if ((hasContent(outcheck) || hasContent(storeout)
|
||||
|| hasContent(cleanup)) && (!hasContent(result_name))
|
||||
&& (return_raw == NIL)) {
|
||||
Printv(result_name, "result", NIL);
|
||||
Printv(result_name, Swig_cresult_name(), NIL);
|
||||
Printf(local_variables, "%s: %s;\n", result_name, result_m3wraptype);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -250,7 +250,7 @@ public:
|
|||
ParmList *parms = Getattr(n, "parms");
|
||||
SwigType *type = Getattr(n, "type");
|
||||
String *name = NewString("caller");
|
||||
Setattr(n, "wrap:action", Swig_cresult(type, "result", Swig_cfunction_call(name, parms)));
|
||||
Setattr(n, "wrap:action", Swig_cresult(type, Swig_cresult_name(), Swig_cfunction_call(name, parms)));
|
||||
}
|
||||
// PATCH DLOPEN
|
||||
|
||||
|
|
@ -403,8 +403,8 @@ public:
|
|||
String *actioncode = emit_action(n);
|
||||
|
||||
// Now have return value, figure out what to do with it.
|
||||
if ((tm = Swig_typemap_lookup_out("out", n, "result", f, actioncode))) {
|
||||
Replaceall(tm, "$source", "result");
|
||||
if ((tm = Swig_typemap_lookup_out("out", n, Swig_cresult_name(), f, actioncode))) {
|
||||
Replaceall(tm, "$source", Swig_cresult_name());
|
||||
Replaceall(tm, "$target", "values[0]");
|
||||
Replaceall(tm, "$result", "values[0]");
|
||||
if (GetFlag(n, "feature:new"))
|
||||
|
|
@ -426,15 +426,15 @@ public:
|
|||
// Look for any remaining cleanup
|
||||
|
||||
if (GetFlag(n, "feature:new")) {
|
||||
if ((tm = Swig_typemap_lookup("newfree", n, "result", 0))) {
|
||||
Replaceall(tm, "$source", "result");
|
||||
if ((tm = Swig_typemap_lookup("newfree", n, Swig_cresult_name(), 0))) {
|
||||
Replaceall(tm, "$source", Swig_cresult_name());
|
||||
Printv(f->code, tm, "\n", NIL);
|
||||
}
|
||||
}
|
||||
// Free any memory allocated by the function being wrapped..
|
||||
|
||||
if ((tm = Swig_typemap_lookup("ret", n, "result", 0))) {
|
||||
Replaceall(tm, "$source", "result");
|
||||
if ((tm = Swig_typemap_lookup("ret", n, Swig_cresult_name(), 0))) {
|
||||
Replaceall(tm, "$source", Swig_cresult_name());
|
||||
Printv(f->code, tm, "\n", NIL);
|
||||
}
|
||||
// Wrap things up (in a manner of speaking)
|
||||
|
|
|
|||
|
|
@ -657,7 +657,7 @@ public:
|
|||
Swig_director_emit_dynamic_cast(n, f);
|
||||
String *actioncode = emit_action(n);
|
||||
|
||||
if ((tm = Swig_typemap_lookup_out("out", n, "result", f, actioncode))) {
|
||||
if ((tm = Swig_typemap_lookup_out("out", n, Swig_cresult_name(), f, actioncode))) {
|
||||
Replaceall(tm, "$source", "swig_result");
|
||||
Replaceall(tm, "$target", "rv");
|
||||
Replaceall(tm, "$result", "rv");
|
||||
|
|
@ -677,15 +677,15 @@ public:
|
|||
// Look for any remaining cleanup
|
||||
|
||||
if (GetFlag(n, "feature:new")) {
|
||||
if ((tm = Swig_typemap_lookup("newfree", n, "result", 0))) {
|
||||
if ((tm = Swig_typemap_lookup("newfree", n, Swig_cresult_name(), 0))) {
|
||||
Replaceall(tm, "$source", "swig_result");
|
||||
Printv(f->code, tm, "\n", NIL);
|
||||
}
|
||||
}
|
||||
// Free any memory allocated by the function being wrapped..
|
||||
|
||||
if ((tm = Swig_typemap_lookup("swig_result", n, "result", 0))) {
|
||||
Replaceall(tm, "$source", "result");
|
||||
if ((tm = Swig_typemap_lookup("swig_result", n, Swig_cresult_name(), 0))) {
|
||||
Replaceall(tm, "$source", Swig_cresult_name());
|
||||
Printv(f->code, tm, "\n", NIL);
|
||||
}
|
||||
// Wrap things up (in a manner of speaking)
|
||||
|
|
@ -1586,12 +1586,12 @@ public:
|
|||
"swig_result = caml_swig_alloc(1,C_list);\n" "SWIG_Store_field(swig_result,0,args);\n" "args = swig_result;\n" "swig_result = Val_unit;\n", 0);
|
||||
Printf(w->code, "swig_result = " "callback3(*caml_named_value(\"swig_runmethod\")," "swig_get_self(),copy_string(\"%s\"),args);\n", Getattr(n, "name"));
|
||||
/* exception handling */
|
||||
tm = Swig_typemap_lookup("director:except", n, "result", 0);
|
||||
tm = Swig_typemap_lookup("director:except", n, Swig_cresult_name(), 0);
|
||||
if (!tm) {
|
||||
tm = Getattr(n, "feature:director:except");
|
||||
}
|
||||
if ((tm) && Len(tm) && (Strcmp(tm, "1") != 0)) {
|
||||
Printf(w->code, "if (!result) {\n");
|
||||
Printf(w->code, "if (!%s) {\n", Swig_cresult_name());
|
||||
Printf(w->code, " CAML_VALUE error = *caml_named_value(\"director_except\");\n");
|
||||
Replaceall(tm, "$error", "error");
|
||||
Printv(w->code, Str(tm), "\n", NIL);
|
||||
|
|
|
|||
|
|
@ -694,8 +694,8 @@ public:
|
|||
Wrapper_add_local(f, "_outv", "octave_value _outv");
|
||||
|
||||
// Return the function value
|
||||
if ((tm = Swig_typemap_lookup_out("out", n, "result", f, actioncode))) {
|
||||
Replaceall(tm, "$source", "result");
|
||||
if ((tm = Swig_typemap_lookup_out("out", n, Swig_cresult_name(), f, actioncode))) {
|
||||
Replaceall(tm, "$source", Swig_cresult_name());
|
||||
Replaceall(tm, "$target", "_outv");
|
||||
Replaceall(tm, "$result", "_outv");
|
||||
|
||||
|
|
@ -716,14 +716,14 @@ public:
|
|||
Printv(f->code, cleanup, NIL);
|
||||
|
||||
if (GetFlag(n, "feature:new")) {
|
||||
if ((tm = Swig_typemap_lookup("newfree", n, "result", 0))) {
|
||||
Replaceall(tm, "$source", "result");
|
||||
if ((tm = Swig_typemap_lookup("newfree", n, Swig_cresult_name(), 0))) {
|
||||
Replaceall(tm, "$source", Swig_cresult_name());
|
||||
Printf(f->code, "%s\n", tm);
|
||||
}
|
||||
}
|
||||
|
||||
if ((tm = Swig_typemap_lookup("ret", n, "result", 0))) {
|
||||
Replaceall(tm, "$source", "result");
|
||||
if ((tm = Swig_typemap_lookup("ret", n, Swig_cresult_name(), 0))) {
|
||||
Replaceall(tm, "$source", Swig_cresult_name());
|
||||
Replaceall(tm, "$result", "_outv");
|
||||
Printf(f->code, "%s\n", tm);
|
||||
Delete(tm);
|
||||
|
|
@ -1402,7 +1402,7 @@ public:
|
|||
Printf(w->code, "}\n");
|
||||
|
||||
Setattr(n, "type", return_type);
|
||||
tm = Swig_typemap_lookup("directorout", n, "result", w);
|
||||
tm = Swig_typemap_lookup("directorout", n, Swig_cresult_name(), w);
|
||||
Setattr(n, "type", type);
|
||||
if (tm != 0) {
|
||||
char temp[24];
|
||||
|
|
|
|||
|
|
@ -730,9 +730,9 @@ public:
|
|||
Swig_director_emit_dynamic_cast(n, f);
|
||||
String *actioncode = emit_action(n);
|
||||
|
||||
if ((tm = Swig_typemap_lookup_out("out", n, "result", f, actioncode))) {
|
||||
if ((tm = Swig_typemap_lookup_out("out", n, Swig_cresult_name(), f, actioncode))) {
|
||||
SwigType *t = Getattr(n, "type");
|
||||
Replaceall(tm, "$source", "result");
|
||||
Replaceall(tm, "$source", Swig_cresult_name());
|
||||
Replaceall(tm, "$target", "ST(argvi)");
|
||||
Replaceall(tm, "$result", "ST(argvi)");
|
||||
if (is_shadow(t)) {
|
||||
|
|
@ -760,14 +760,14 @@ public:
|
|||
Printv(f->code, cleanup, NIL);
|
||||
|
||||
if (GetFlag(n, "feature:new")) {
|
||||
if ((tm = Swig_typemap_lookup("newfree", n, "result", 0))) {
|
||||
Replaceall(tm, "$source", "result");
|
||||
if ((tm = Swig_typemap_lookup("newfree", n, Swig_cresult_name(), 0))) {
|
||||
Replaceall(tm, "$source", Swig_cresult_name());
|
||||
Printf(f->code, "%s\n", tm);
|
||||
}
|
||||
}
|
||||
|
||||
if ((tm = Swig_typemap_lookup("ret", n, "result", 0))) {
|
||||
Replaceall(tm, "$source", "result");
|
||||
if ((tm = Swig_typemap_lookup("ret", n, Swig_cresult_name(), 0))) {
|
||||
Replaceall(tm, "$source", Swig_cresult_name());
|
||||
Printf(f->code, "%s\n", tm);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -961,9 +961,9 @@ public:
|
|||
/* emit function call */
|
||||
String *actioncode = emit_action(n);
|
||||
|
||||
if ((tm = Swig_typemap_lookup_out("out", n, "result", f, actioncode))) {
|
||||
Replaceall(tm, "$input", "result");
|
||||
Replaceall(tm, "$source", "result");
|
||||
if ((tm = Swig_typemap_lookup_out("out", n, Swig_cresult_name(), f, actioncode))) {
|
||||
Replaceall(tm, "$input", Swig_cresult_name());
|
||||
Replaceall(tm, "$source", Swig_cresult_name());
|
||||
Replaceall(tm, "$target", "return_value");
|
||||
Replaceall(tm, "$result", "return_value");
|
||||
Replaceall(tm, "$owner", newobject ? "1" : "0");
|
||||
|
|
@ -983,14 +983,14 @@ public:
|
|||
|
||||
/* Look to see if there is any newfree cleanup code */
|
||||
if (GetFlag(n, "feature:new")) {
|
||||
if ((tm = Swig_typemap_lookup("newfree", n, "result", 0))) {
|
||||
if ((tm = Swig_typemap_lookup("newfree", n, Swig_cresult_name(), 0))) {
|
||||
Printf(f->code, "%s\n", tm);
|
||||
Delete(tm);
|
||||
}
|
||||
}
|
||||
|
||||
/* See if there is any return cleanup code */
|
||||
if ((tm = Swig_typemap_lookup("ret", n, "result", 0))) {
|
||||
if ((tm = Swig_typemap_lookup("ret", n, Swig_cresult_name(), 0))) {
|
||||
Printf(f->code, "%s\n", tm);
|
||||
Delete(tm);
|
||||
}
|
||||
|
|
@ -2253,13 +2253,13 @@ done:
|
|||
director_prot_ctor_code = NewStringEmpty();
|
||||
Printf(director_ctor_code, "if ( arg0->type == IS_NULL ) { /* not subclassed */\n");
|
||||
Printf(director_prot_ctor_code, "if ( arg0->type == IS_NULL ) { /* not subclassed */\n");
|
||||
Printf(director_ctor_code, " result = (%s *)new %s(%s);\n", ctype, ctype, args);
|
||||
Printf(director_ctor_code, " %s = (%s *)new %s(%s);\n", Swig_cresult_name(), ctype, ctype, args);
|
||||
Printf(director_prot_ctor_code, " SWIG_PHP_Error(E_ERROR, \"accessing abstract class or protected constructor\");\n", name, name, args);
|
||||
if (i) {
|
||||
Insert(args, 0, ", ");
|
||||
}
|
||||
Printf(director_ctor_code, "} else {\n result = (%s *)new SwigDirector_%s(arg0%s TSRMLS_CC);\n}\n", ctype, sname, args);
|
||||
Printf(director_prot_ctor_code, "} else {\n result = (%s *)new SwigDirector_%s(arg0%s TSRMLS_CC);\n}\n", ctype, sname, args);
|
||||
Printf(director_ctor_code, "} else {\n %s = (%s *)new SwigDirector_%s(arg0%s TSRMLS_CC);\n}\n", Swig_cresult_name(), ctype, sname, args);
|
||||
Printf(director_prot_ctor_code, "} else {\n %s = (%s *)new SwigDirector_%s(arg0%s TSRMLS_CC);\n}\n", Swig_cresult_name(), ctype, sname, args);
|
||||
Delete(args);
|
||||
|
||||
wrapperType = directorconstructor;
|
||||
|
|
@ -2595,7 +2595,7 @@ done:
|
|||
}
|
||||
|
||||
/* exception handling */
|
||||
tm = Swig_typemap_lookup("director:except", n, "result", 0);
|
||||
tm = Swig_typemap_lookup("director:except", n, Swig_cresult_name(), 0);
|
||||
if (!tm) {
|
||||
tm = Getattr(n, "feature:director:except");
|
||||
if (tm)
|
||||
|
|
@ -2616,8 +2616,8 @@ done:
|
|||
} else {
|
||||
Printf(w->code, "zval *args[%d];\n", idx);
|
||||
}
|
||||
Append(w->code, "zval *result, funcname;\n");
|
||||
Append(w->code, "MAKE_STD_ZVAL(result);\n");
|
||||
Printf(w->code, "zval *%s, funcname;\n", Swig_cresult_name());
|
||||
Printf(w->code, "MAKE_STD_ZVAL(%s);\n", Swig_cresult_name());
|
||||
Printf(w->code, "ZVAL_STRING(&funcname, (char *)\"%s\", 0);\n", GetChar(n, "sym:name"));
|
||||
Append(w->code, "if (!swig_self) {\n");
|
||||
Append(w->code, " SWIG_PHP_Error(E_ERROR, \"this pointer is NULL\");");
|
||||
|
|
@ -2627,7 +2627,7 @@ done:
|
|||
Printv(w->code, wrap_args, NIL);
|
||||
|
||||
Append(w->code, "call_user_function(EG(function_table), (zval**)&swig_self, &funcname,\n");
|
||||
Printf(w->code, " result, %d, args TSRMLS_CC);\n", idx);
|
||||
Printf(w->code, " %s, %d, args TSRMLS_CC);\n", Swig_cresult_name(), idx);
|
||||
|
||||
if (tm) {
|
||||
Printv(w->code, Str(tm), "\n", NIL);
|
||||
|
|
@ -2651,10 +2651,11 @@ done:
|
|||
* occurs in Language::cDeclaration().
|
||||
*/
|
||||
Setattr(n, "type", return_type);
|
||||
tm = Swig_typemap_lookup("directorout", n, "result", w);
|
||||
tm = Swig_typemap_lookup("directorout", n, Swig_cresult_name(), w);
|
||||
Setattr(n, "type", type);
|
||||
if (tm != 0) {
|
||||
Replaceall(tm, "$input", "&result");
|
||||
static const String *amp_result = NewStringf("&%s", Swig_cresult_name());
|
||||
Replaceall(tm, "$input", amp_result);
|
||||
char temp[24];
|
||||
sprintf(temp, "%d", idx);
|
||||
Replaceall(tm, "$argnum", temp);
|
||||
|
|
@ -2679,7 +2680,7 @@ done:
|
|||
/* marshal outputs */
|
||||
for (p = l; p;) {
|
||||
if ((tm = Getattr(p, "tmap:directorargout")) != 0) {
|
||||
Replaceall(tm, "$input", "result");
|
||||
Replaceall(tm, "$input", Swig_cresult_name());
|
||||
Replaceall(tm, "$result", Getattr(p, "name"));
|
||||
Printv(w->code, tm, "\n", NIL);
|
||||
p = Getattr(p, "tmap:directorargout:next");
|
||||
|
|
@ -2688,7 +2689,7 @@ done:
|
|||
}
|
||||
}
|
||||
|
||||
Append(w->code, "FREE_ZVAL(result);\n");
|
||||
Printf(w->code, "FREE_ZVAL(%s);\n", Swig_cresult_name());
|
||||
|
||||
Delete(parse_args);
|
||||
Delete(cleanup);
|
||||
|
|
|
|||
|
|
@ -421,15 +421,15 @@ public:
|
|||
|
||||
/* Return the function value */
|
||||
if (current == CONSTRUCTOR) {
|
||||
Printv(actioncode, "THIS = (void *) result;\n", NIL);
|
||||
Printv(actioncode, "THIS = (void *) ", Swig_cresult_name(), ";\n", NIL);
|
||||
Printv(description, ", tVoid", NIL);
|
||||
} else if (current == DESTRUCTOR) {
|
||||
Printv(description, ", tVoid", NIL);
|
||||
} else {
|
||||
Printv(description, ", ", NIL);
|
||||
if ((tm = Swig_typemap_lookup_out("out", n, "result", f, actioncode))) {
|
||||
if ((tm = Swig_typemap_lookup_out("out", n, Swig_cresult_name(), f, actioncode))) {
|
||||
actioncode = 0;
|
||||
Replaceall(tm, "$source", "result");
|
||||
Replaceall(tm, "$source", Swig_cresult_name());
|
||||
Replaceall(tm, "$target", "resultobj");
|
||||
Replaceall(tm, "$result", "resultobj");
|
||||
if (GetFlag(n, "feature:new")) {
|
||||
|
|
@ -460,15 +460,15 @@ public:
|
|||
|
||||
/* Look to see if there is any newfree cleanup code */
|
||||
if (GetFlag(n, "feature:new")) {
|
||||
if ((tm = Swig_typemap_lookup("newfree", n, "result", 0))) {
|
||||
Replaceall(tm, "$source", "result");
|
||||
if ((tm = Swig_typemap_lookup("newfree", n, Swig_cresult_name(), 0))) {
|
||||
Replaceall(tm, "$source", Swig_cresult_name());
|
||||
Printf(f->code, "%s\n", tm);
|
||||
}
|
||||
}
|
||||
|
||||
/* See if there is any return cleanup code */
|
||||
if ((tm = Swig_typemap_lookup("ret", n, "result", 0))) {
|
||||
Replaceall(tm, "$source", "result");
|
||||
if ((tm = Swig_typemap_lookup("ret", n, Swig_cresult_name(), 0))) {
|
||||
Replaceall(tm, "$source", Swig_cresult_name());
|
||||
Printf(f->code, "%s\n", tm);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2445,7 +2445,7 @@ public:
|
|||
/* This part below still needs cleanup */
|
||||
|
||||
/* Return the function value */
|
||||
tm = Swig_typemap_lookup_out("out", n, "result", f, actioncode);
|
||||
tm = Swig_typemap_lookup_out("out", n, Swig_cresult_name(), f, actioncode);
|
||||
|
||||
if (tm) {
|
||||
if (builtin_self) {
|
||||
|
|
@ -2455,7 +2455,7 @@ public:
|
|||
} else {
|
||||
Replaceall(tm, "$self", "obj0");
|
||||
}
|
||||
Replaceall(tm, "$source", "result");
|
||||
Replaceall(tm, "$source", Swig_cresult_name());
|
||||
Replaceall(tm, "$target", "resultobj");
|
||||
Replaceall(tm, "$result", "resultobj");
|
||||
if (builtin_ctor) {
|
||||
|
|
@ -2491,7 +2491,7 @@ public:
|
|||
}
|
||||
if (unwrap) {
|
||||
Wrapper_add_local(f, "director", "Swig::Director *director = 0");
|
||||
Append(f->code, "director = SWIG_DIRECTOR_CAST(result);\n");
|
||||
Printf(f->code, "director = SWIG_DIRECTOR_CAST(%s);\n", Swig_cresult_name());
|
||||
Append(f->code, "if (director) {\n");
|
||||
Append(f->code, " resultobj = director->swig_get_self();\n");
|
||||
Append(f->code, " Py_INCREF(resultobj);\n");
|
||||
|
|
@ -2521,23 +2521,23 @@ public:
|
|||
|
||||
/* Look to see if there is any newfree cleanup code */
|
||||
if (GetFlag(n, "feature:new")) {
|
||||
if ((tm = Swig_typemap_lookup("newfree", n, "result", 0))) {
|
||||
Replaceall(tm, "$source", "result");
|
||||
if ((tm = Swig_typemap_lookup("newfree", n, Swig_cresult_name(), 0))) {
|
||||
Replaceall(tm, "$source", Swig_cresult_name());
|
||||
Printf(f->code, "%s\n", tm);
|
||||
Delete(tm);
|
||||
}
|
||||
}
|
||||
|
||||
/* See if there is any return cleanup code */
|
||||
if ((tm = Swig_typemap_lookup("ret", n, "result", 0))) {
|
||||
Replaceall(tm, "$source", "result");
|
||||
if ((tm = Swig_typemap_lookup("ret", n, Swig_cresult_name(), 0))) {
|
||||
Replaceall(tm, "$source", Swig_cresult_name());
|
||||
Printf(f->code, "%s\n", tm);
|
||||
Delete(tm);
|
||||
}
|
||||
|
||||
if (director_method) {
|
||||
if ((tm = Swig_typemap_lookup("directorfree", n, "result", 0))) {
|
||||
Replaceall(tm, "$input", "result");
|
||||
if ((tm = Swig_typemap_lookup("directorfree", n, Swig_cresult_name(), 0))) {
|
||||
Replaceall(tm, "$input", Swig_cresult_name());
|
||||
Replaceall(tm, "$result", "resultobj");
|
||||
Printf(f->code, "%s\n", tm);
|
||||
Delete(tm);
|
||||
|
|
@ -4818,33 +4818,32 @@ int PYTHON::classDirectorMethod(Node *n, Node *parent, String *super) {
|
|||
Append(w->code, "PyObject* method = swig_get_method(swig_method_index, swig_method_name);\n");
|
||||
if (Len(parse_args) > 0) {
|
||||
if (use_parse || !modernargs) {
|
||||
Printf(w->code, "swig::SwigVar_PyObject result = PyObject_CallFunction(method, (char *)\"(%s)\" %s);\n", parse_args, arglist);
|
||||
Printf(w->code, "swig::SwigVar_PyObject %s = PyObject_CallFunction(method, (char *)\"(%s)\" %s);\n", Swig_cresult_name(), parse_args, arglist);
|
||||
} else {
|
||||
Printf(w->code, "swig::SwigVar_PyObject result = PyObject_CallFunctionObjArgs(method %s, NULL);\n", arglist);
|
||||
Printf(w->code, "swig::SwigVar_PyObject %s = PyObject_CallFunctionObjArgs(method %s, NULL);\n", Swig_cresult_name(), arglist);
|
||||
}
|
||||
} else {
|
||||
if (modernargs) {
|
||||
Append(w->code, "swig::SwigVar_PyObject args = PyTuple_New(0);\n");
|
||||
Append(w->code, "swig::SwigVar_PyObject result = PyObject_Call(method, (PyObject*) args, NULL);\n");
|
||||
Printf(w->code, "swig::SwigVar_PyObject %s = PyObject_Call(method, (PyObject*) args, NULL);\n", Swig_cresult_name());
|
||||
} else {
|
||||
Printf(w->code, "swig::SwigVar_PyObject result = PyObject_CallFunction(method, NULL, NULL);\n");
|
||||
Printf(w->code, "swig::SwigVar_PyObject %s = PyObject_CallFunction(method, NULL, NULL);\n", Swig_cresult_name());
|
||||
}
|
||||
}
|
||||
Append(w->code, "#else\n");
|
||||
if (Len(parse_args) > 0) {
|
||||
if (use_parse || !modernargs) {
|
||||
Printf(w->code, "swig::SwigVar_PyObject result = PyObject_CallMethod(swig_get_self(), (char *)\"%s\", (char *)\"(%s)\" %s);\n",
|
||||
pyname, parse_args, arglist);
|
||||
Printf(w->code, "swig::SwigVar_PyObject %s = PyObject_CallMethod(swig_get_self(), (char *)\"%s\", (char *)\"(%s)\" %s);\n", Swig_cresult_name(), pyname, parse_args, arglist);
|
||||
} else {
|
||||
Printf(w->code, "swig::SwigVar_PyObject swig_method_name = SWIG_Python_str_FromChar((char *)\"%s\");\n", pyname);
|
||||
Printf(w->code, "swig::SwigVar_PyObject result = PyObject_CallMethodObjArgs(swig_get_self(), (PyObject *) swig_method_name %s, NULL);\n", arglist);
|
||||
Printf(w->code, "swig::SwigVar_PyObject swig_method_name = SWIG_Python_str_FromChar((char *)\"%s\");\n", Swig_cresult_name(), pyname);
|
||||
Printf(w->code, "swig::SwigVar_PyObject %s = PyObject_CallMethodObjArgs(swig_get_self(), (PyObject *) swig_method_name %s, NULL);\n", Swig_cresult_name(), arglist);
|
||||
}
|
||||
} else {
|
||||
if (!modernargs) {
|
||||
Printf(w->code, "swig::SwigVar_PyObject result = PyObject_CallMethod(swig_get_self(), (char *) \"%s\", NULL);\n", pyname);
|
||||
Printf(w->code, "swig::SwigVar_PyObject %s = PyObject_CallMethod(swig_get_self(), (char *) \"%s\", NULL);\n", Swig_cresult_name(), pyname);
|
||||
} else {
|
||||
Printf(w->code, "swig::SwigVar_PyObject swig_method_name = SWIG_Python_str_FromChar((char *)\"%s\");\n", pyname);
|
||||
Append(w->code, "swig::SwigVar_PyObject result = PyObject_CallMethodObjArgs(swig_get_self(), (PyObject *) swig_method_name, NULL);\n");
|
||||
Printf(w->code, "swig::SwigVar_PyObject %s = PyObject_CallMethodObjArgs(swig_get_self(), (PyObject *) swig_method_name, NULL);\n", Swig_cresult_name());
|
||||
}
|
||||
}
|
||||
Append(w->code, "#endif\n");
|
||||
|
|
@ -4853,13 +4852,13 @@ int PYTHON::classDirectorMethod(Node *n, Node *parent, String *super) {
|
|||
Printf(w->code, "swig_set_inner(\"%s\", false);\n", name);
|
||||
|
||||
/* exception handling */
|
||||
tm = Swig_typemap_lookup("director:except", n, "result", 0);
|
||||
tm = Swig_typemap_lookup("director:except", n, Swig_cresult_name(), 0);
|
||||
if (!tm) {
|
||||
tm = Getattr(n, "feature:director:except");
|
||||
if (tm)
|
||||
tm = Copy(tm);
|
||||
}
|
||||
Append(w->code, "if (!result) {\n");
|
||||
Printf(w->code, "if (!%s) {\n", Swig_cresult_name());
|
||||
Append(w->code, " PyObject *error = PyErr_Occurred();\n");
|
||||
if ((tm) && Len(tm) && (Strcmp(tm, "1") != 0)) {
|
||||
Replaceall(tm, "$error", "error");
|
||||
|
|
@ -4886,7 +4885,7 @@ int PYTHON::classDirectorMethod(Node *n, Node *parent, String *super) {
|
|||
|
||||
if (outputs > 1) {
|
||||
Wrapper_add_local(w, "output", "PyObject *output");
|
||||
Append(w->code, "if (!PyTuple_Check(result)) {\n");
|
||||
Printf(w->code, "if (!PyTuple_Check(%s)) {\n", Swig_cresult_name());
|
||||
Printf(w->code, " Swig::DirectorTypeMismatchException::raise(\"Python method %s.%sfailed to return a tuple.\");\n", classname, pyname);
|
||||
Append(w->code, "}\n");
|
||||
}
|
||||
|
|
@ -4903,14 +4902,14 @@ int PYTHON::classDirectorMethod(Node *n, Node *parent, String *super) {
|
|||
* occurs in Language::cDeclaration().
|
||||
*/
|
||||
Setattr(n, "type", return_type);
|
||||
tm = Swig_typemap_lookup("directorout", n, "result", w);
|
||||
tm = Swig_typemap_lookup("directorout", n, Swig_cresult_name(), w);
|
||||
Setattr(n, "type", type);
|
||||
if (tm != 0) {
|
||||
if (outputs > 1) {
|
||||
Printf(w->code, "output = PyTuple_GetItem(result, %d);\n", idx++);
|
||||
Printf(w->code, "output = PyTuple_GetItem(%s, %d);\n", Swig_cresult_name(), idx++);
|
||||
Replaceall(tm, "$input", "output");
|
||||
} else {
|
||||
Replaceall(tm, "$input", "result");
|
||||
Replaceall(tm, "$input", Swig_cresult_name());
|
||||
}
|
||||
char temp[24];
|
||||
sprintf(temp, "%d", idx);
|
||||
|
|
@ -4940,10 +4939,10 @@ int PYTHON::classDirectorMethod(Node *n, Node *parent, String *super) {
|
|||
for (p = l; p;) {
|
||||
if ((tm = Getattr(p, "tmap:directorargout")) != 0) {
|
||||
if (outputs > 1) {
|
||||
Printf(w->code, "output = PyTuple_GetItem(result, %d);\n", idx++);
|
||||
Printf(w->code, "output = PyTuple_GetItem(%s, %d);\n", Swig_cresult_name(), idx++);
|
||||
Replaceall(tm, "$input", "output");
|
||||
} else {
|
||||
Replaceall(tm, "$input", "result");
|
||||
Replaceall(tm, "$input", Swig_cresult_name());
|
||||
}
|
||||
Replaceall(tm, "$result", Getattr(p, "name"));
|
||||
Printv(w->code, tm, "\n", NIL);
|
||||
|
|
|
|||
|
|
@ -675,12 +675,12 @@ String * R::createFunctionPointerHandler(SwigType *t, Node *n, int *numArgs) {
|
|||
XXX Have to be a little more clever so that we can deal with struct A * - the * is getting lost.
|
||||
Is this still true? If so, will a SwigType_push() solve things?
|
||||
*/
|
||||
Parm *bbase = NewParm(rettype, "result", n);
|
||||
String *returnTM = Swig_typemap_lookup("in", bbase, "result", f);
|
||||
Parm *bbase = NewParm(rettype, Swig_cresult_name(), n);
|
||||
String *returnTM = Swig_typemap_lookup("in", bbase, Swig_cresult_name(), f);
|
||||
if(returnTM) {
|
||||
String *tm = returnTM;
|
||||
Replaceall(tm,"$input", "r_swig_cb_data->retValue");
|
||||
Replaceall(tm,"$target", "result");
|
||||
Replaceall(tm,"$target", Swig_cresult_name());
|
||||
replaceRClass(tm, rettype);
|
||||
Replaceall(tm,"$owner", "R_SWIG_EXTERNAL");
|
||||
Replaceall(tm,"$disown","0");
|
||||
|
|
@ -693,7 +693,7 @@ String * R::createFunctionPointerHandler(SwigType *t, Node *n, int *numArgs) {
|
|||
Printv(f->code, "\n", UnProtectWrapupCode, NIL);
|
||||
|
||||
if(!isVoidType)
|
||||
Printv(f->code, "return result;\n", NIL);
|
||||
Printv(f->code, "return ", Swig_cresult_name(), ";\n", NIL);
|
||||
|
||||
Printv(f->code, "\n}\n", NIL);
|
||||
|
||||
|
|
@ -1975,7 +1975,7 @@ int R::functionWrapper(Node *n) {
|
|||
String *actioncode = emit_action(n);
|
||||
|
||||
/* Deal with the explicit return value. */
|
||||
if ((tm = Swig_typemap_lookup_out("out", n, "result", f, actioncode))) {
|
||||
if ((tm = Swig_typemap_lookup_out("out", n, Swig_cresult_name(), f, actioncode))) {
|
||||
SwigType *retType = Getattr(n, "type");
|
||||
//Printf(stderr, "Return Value for %s, array? %s\n", retType, SwigType_isarray(retType) ? "yes" : "no");
|
||||
/* if(SwigType_isarray(retType)) {
|
||||
|
|
@ -1983,7 +1983,7 @@ int R::functionWrapper(Node *n) {
|
|||
} */
|
||||
|
||||
|
||||
Replaceall(tm,"$1", "result");
|
||||
Replaceall(tm,"$1", Swig_cresult_name());
|
||||
Replaceall(tm,"$result", "r_ans");
|
||||
replaceRClass(tm, retType);
|
||||
|
||||
|
|
@ -2043,8 +2043,8 @@ int R::functionWrapper(Node *n) {
|
|||
|
||||
/* Look to see if there is any newfree cleanup code */
|
||||
if (GetFlag(n, "feature:new")) {
|
||||
if ((tm = Swig_typemap_lookup("newfree", n, "result", 0))) {
|
||||
Replaceall(tm, "$source", "result"); /* deprecated */
|
||||
if ((tm = Swig_typemap_lookup("newfree", n, Swig_cresult_name(), 0))) {
|
||||
Replaceall(tm, "$source", Swig_cresult_name()); /* deprecated */
|
||||
Printf(f->code, "%s\n", tm);
|
||||
}
|
||||
}
|
||||
|
|
@ -2052,8 +2052,7 @@ int R::functionWrapper(Node *n) {
|
|||
Printv(f->code, UnProtectWrapupCode, NIL);
|
||||
|
||||
/*If the user gave us something to convert the result in */
|
||||
if ((tm = Swig_typemap_lookup("scoerceout", n,
|
||||
"result", sfun))) {
|
||||
if ((tm = Swig_typemap_lookup("scoerceout", n, Swig_cresult_name(), sfun))) {
|
||||
Replaceall(tm,"$source","ans");
|
||||
Replaceall(tm,"$result","ans");
|
||||
replaceRClass(tm, Getattr(n, "type"));
|
||||
|
|
|
|||
|
|
@ -1827,9 +1827,9 @@ public:
|
|||
Wrapper_add_local(f, "classname", classname);
|
||||
}
|
||||
if (action) {
|
||||
Append(action, "\nDATA_PTR(self) = result;");
|
||||
Printf(action, "\nDATA_PTR(self) = %s;", Swig_cresult_name());
|
||||
if (GetFlag(pn, "feature:trackobjects")) {
|
||||
Append(action, "\nSWIG_RubyAddTracking(result, self);");
|
||||
Printf(action, "\nSWIG_RubyAddTracking(%s, self);", Swig_cresult_name());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1855,13 +1855,13 @@ public:
|
|||
if (SwigType_type(t) != T_VOID && current != CONSTRUCTOR_INITIALIZE) {
|
||||
need_result = 1;
|
||||
if (GetFlag(n, "feature:predicate")) {
|
||||
Printv(actioncode, tab4, "vresult = (result ? Qtrue : Qfalse);\n", NIL);
|
||||
Printv(actioncode, tab4, "vresult = (", Swig_cresult_name(), " ? Qtrue : Qfalse);\n", NIL);
|
||||
} else {
|
||||
tm = Swig_typemap_lookup_out("out", n, "result", f, actioncode);
|
||||
tm = Swig_typemap_lookup_out("out", n, Swig_cresult_name(), f, actioncode);
|
||||
actioncode = 0;
|
||||
if (tm) {
|
||||
Replaceall(tm, "$result", "vresult");
|
||||
Replaceall(tm, "$source", "result");
|
||||
Replaceall(tm, "$source", Swig_cresult_name());
|
||||
Replaceall(tm, "$target", "vresult");
|
||||
|
||||
if (GetFlag(n, "feature:new"))
|
||||
|
|
@ -1890,7 +1890,7 @@ public:
|
|||
}
|
||||
if (unwrap) {
|
||||
Wrapper_add_local(f, "director", "Swig::Director *director = 0");
|
||||
Printf(f->code, "director = dynamic_cast<Swig::Director *>(result);\n");
|
||||
Printf(f->code, "director = dynamic_cast<Swig::Director *>(%s);\n", Swig_cresult_name());
|
||||
Printf(f->code, "if (director) {\n");
|
||||
Printf(f->code, " vresult = director->swig_get_self();\n");
|
||||
Printf(f->code, "} else {\n");
|
||||
|
|
@ -1925,7 +1925,6 @@ public:
|
|||
Printf(f->code, "#endif\n");
|
||||
} else if (current == CONSTRUCTOR_INITIALIZE) {
|
||||
need_result = 1;
|
||||
// Printf(f->code, "DATA_PTR(self) = result;\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1953,25 +1952,25 @@ public:
|
|||
|
||||
/* Look for any remaining cleanup. This processes the %new directive */
|
||||
if (current != CONSTRUCTOR_ALLOCATE && GetFlag(n, "feature:new")) {
|
||||
tm = Swig_typemap_lookup("newfree", n, "result", 0);
|
||||
tm = Swig_typemap_lookup("newfree", n, Swig_cresult_name(), 0);
|
||||
if (tm) {
|
||||
Replaceall(tm, "$source", "result");
|
||||
Replaceall(tm, "$source", Swig_cresult_name());
|
||||
Printv(f->code, tm, "\n", NIL);
|
||||
Delete(tm);
|
||||
}
|
||||
}
|
||||
|
||||
/* Special processing on return value. */
|
||||
tm = Swig_typemap_lookup("ret", n, "result", 0);
|
||||
tm = Swig_typemap_lookup("ret", n, Swig_cresult_name(), 0);
|
||||
if (tm) {
|
||||
Replaceall(tm, "$source", "result");
|
||||
Replaceall(tm, "$source", Swig_cresult_name());
|
||||
Printv(f->code, tm, NIL);
|
||||
Delete(tm);
|
||||
}
|
||||
|
||||
if (director_method) {
|
||||
if ((tm = Swig_typemap_lookup("directorfree", n, "result", 0))) {
|
||||
Replaceall(tm, "$input", "result");
|
||||
if ((tm = Swig_typemap_lookup("directorfree", n, Swig_cresult_name(), 0))) {
|
||||
Replaceall(tm, "$input", Swig_cresult_name());
|
||||
Replaceall(tm, "$result", "vresult");
|
||||
Printf(f->code, "%s\n", tm);
|
||||
}
|
||||
|
|
@ -2947,7 +2946,7 @@ public:
|
|||
String *depthCountName = NewStringf("%s_%s_call_depth", className, methodName);
|
||||
|
||||
// Check for an exception typemap of some kind
|
||||
String *tm = Swig_typemap_lookup("director:except", n, "result", 0);
|
||||
String *tm = Swig_typemap_lookup("director:except", n, Swig_cresult_name(), 0);
|
||||
if (!tm) {
|
||||
tm = Getattr(n, "feature:director:except");
|
||||
}
|
||||
|
|
@ -2960,11 +2959,11 @@ public:
|
|||
// Function body
|
||||
Printf(body->def, "VALUE %s(VALUE data) {\n", bodyName);
|
||||
Wrapper_add_localv(body, "args", "Swig::body_args *", "args", "= reinterpret_cast<Swig::body_args *>(data)", NIL);
|
||||
Wrapper_add_localv(body, "result", "VALUE", "result", "= Qnil", NIL);
|
||||
Wrapper_add_localv(body, Swig_cresult_name(), "VALUE", Swig_cresult_name(), "= Qnil", NIL);
|
||||
Printf(body->code, "%s++;\n", depthCountName);
|
||||
Printv(body->code, "result = rb_funcall2(args->recv, args->id, args->argc, args->argv);\n", NIL);
|
||||
Printv(body->code, Swig_cresult_name(), " = rb_funcall2(args->recv, args->id, args->argc, args->argv);\n", NIL);
|
||||
Printf(body->code, "%s--;\n", depthCountName);
|
||||
Printv(body->code, "return result;\n", NIL);
|
||||
Printv(body->code, "return ", Swig_cresult_name(), ";\n", NIL);
|
||||
Printv(body->code, "}", NIL);
|
||||
|
||||
// Exception handler
|
||||
|
|
@ -2991,7 +2990,7 @@ public:
|
|||
} else {
|
||||
Printv(w->code, "args.argv = 0;\n", NIL);
|
||||
}
|
||||
Printf(w->code, "result = rb_protect(PROTECTFUNC(%s), reinterpret_cast<VALUE>(&args), &status);\n", bodyName);
|
||||
Printf(w->code, "%s = rb_protect(PROTECTFUNC(%s), reinterpret_cast<VALUE>(&args), &status);\n", Swig_cresult_name(), bodyName);
|
||||
if ( initstack ) Printf(w->code, "SWIG_RELEASE_STACK;\n");
|
||||
Printf(w->code, "if (status) {\n");
|
||||
Printf(w->code, "VALUE lastErr = rb_gv_get(\"$!\");\n");
|
||||
|
|
@ -3005,9 +3004,9 @@ public:
|
|||
Wrapper_print(rescue, f_directors_helpers);
|
||||
} else {
|
||||
if (argc > 0) {
|
||||
Printf(w->code, "result = rb_funcall(swig_get_self(), rb_intern(\"%s\"), %d%s);\n", methodName, argc, args);
|
||||
Printf(w->code, "%s = rb_funcall(swig_get_self(), rb_intern(\"%s\"), %d%s);\n", Swig_cresult_name(), methodName, argc, args);
|
||||
} else {
|
||||
Printf(w->code, "result = rb_funcall(swig_get_self(), rb_intern(\"%s\"), 0, NULL);\n", methodName);
|
||||
Printf(w->code, "%s = rb_funcall(swig_get_self(), rb_intern(\"%s\"), 0, NULL);\n", Swig_cresult_name(), methodName);
|
||||
}
|
||||
if ( initstack ) Printf(w->code, "SWIG_RELEASE_STACK;\n");
|
||||
}
|
||||
|
|
@ -3273,7 +3272,9 @@ public:
|
|||
}
|
||||
|
||||
/* declare Ruby return value */
|
||||
Wrapper_add_local(w, "result", "VALUE result");
|
||||
String *value_result = NewStringf("VALUE %s", Swig_cresult_name());
|
||||
Wrapper_add_local(w, Swig_cresult_name(), value_result);
|
||||
Delete(value_result);
|
||||
|
||||
/* wrap complex arguments to VALUEs */
|
||||
Printv(w->code, wrap_args, NIL);
|
||||
|
|
@ -3294,7 +3295,7 @@ public:
|
|||
|
||||
if (outputs > 1) {
|
||||
Wrapper_add_local(w, "output", "VALUE output");
|
||||
Printf(w->code, "if (TYPE(result) != T_ARRAY) {\n");
|
||||
Printf(w->code, "if (TYPE(%s) != T_ARRAY) {\n", Swig_cresult_name());
|
||||
Printf(w->code, "Ruby_DirectorTypeMismatchException(\"Ruby method failed to return an array.\");\n");
|
||||
Printf(w->code, "}\n");
|
||||
}
|
||||
|
|
@ -3309,14 +3310,14 @@ public:
|
|||
* It's not just me, similar silliness also occurs in Language::cDeclaration().
|
||||
*/
|
||||
Setattr(n, "type", return_type);
|
||||
tm = Swig_typemap_lookup("directorout", n, "result", w);
|
||||
tm = Swig_typemap_lookup("directorout", n, Swig_cresult_name(), w);
|
||||
Setattr(n, "type", type);
|
||||
if (tm != 0) {
|
||||
if (outputs > 1 && !asvoid ) {
|
||||
Printf(w->code, "output = rb_ary_entry(result, %d);\n", idx++);
|
||||
Printf(w->code, "output = rb_ary_entry(%s, %d);\n", Swig_cresult_name(), idx++);
|
||||
Replaceall(tm, "$input", "output");
|
||||
} else {
|
||||
Replaceall(tm, "$input", "result");
|
||||
Replaceall(tm, "$input", Swig_cresult_name());
|
||||
}
|
||||
/* TODO check this */
|
||||
if (Getattr(n, "wrap:disown")) {
|
||||
|
|
@ -3338,10 +3339,10 @@ public:
|
|||
for (p = l; p;) {
|
||||
if ((tm = Getattr(p, "tmap:directorargout")) != 0) {
|
||||
if (outputs > 1) {
|
||||
Printf(w->code, "output = rb_ary_entry(result, %d);\n", idx++);
|
||||
Printf(w->code, "output = rb_ary_entry(%s, %d);\n", Swig_cresult_name(), idx++);
|
||||
Replaceall(tm, "$input", "output");
|
||||
} else {
|
||||
Replaceall(tm, "$input", "result");
|
||||
Replaceall(tm, "$input", Swig_cresult_name());
|
||||
}
|
||||
Replaceall(tm, "$result", Getattr(p, "name"));
|
||||
Printv(w->code, tm, "\n", NIL);
|
||||
|
|
|
|||
|
|
@ -460,8 +460,8 @@ public:
|
|||
/* Need to redo all of this code (eventually) */
|
||||
|
||||
/* Return value if necessary */
|
||||
if ((tm = Swig_typemap_lookup_out("out", n, "result", f, actioncode))) {
|
||||
Replaceall(tm, "$source", "result");
|
||||
if ((tm = Swig_typemap_lookup_out("out", n, Swig_cresult_name(), f, actioncode))) {
|
||||
Replaceall(tm, "$source", Swig_cresult_name());
|
||||
#ifdef SWIG_USE_RESULTOBJ
|
||||
Replaceall(tm, "$target", "resultobj");
|
||||
Replaceall(tm, "$result", "resultobj");
|
||||
|
|
@ -488,14 +488,14 @@ public:
|
|||
|
||||
/* Look for any remaining cleanup */
|
||||
if (GetFlag(n, "feature:new")) {
|
||||
if ((tm = Swig_typemap_lookup("newfree", n, "result", 0))) {
|
||||
Replaceall(tm, "$source", "result");
|
||||
if ((tm = Swig_typemap_lookup("newfree", n, Swig_cresult_name(), 0))) {
|
||||
Replaceall(tm, "$source", Swig_cresult_name());
|
||||
Printf(f->code, "%s\n", tm);
|
||||
}
|
||||
}
|
||||
|
||||
if ((tm = Swig_typemap_lookup("ret", n, "result", 0))) {
|
||||
Replaceall(tm, "$source", "result");
|
||||
if ((tm = Swig_typemap_lookup("ret", n, Swig_cresult_name(), 0))) {
|
||||
Replaceall(tm, "$source", Swig_cresult_name());
|
||||
Printf(f->code, "%s\n", tm);
|
||||
}
|
||||
#ifdef SWIG_USE_RESULTOBJ
|
||||
|
|
|
|||
|
|
@ -324,7 +324,7 @@ int UFFI::functionWrapper(Node *n) {
|
|||
//" :strings-convert t\n"
|
||||
//" :call-direct %s\n"
|
||||
//" :optimize-for-space t"
|
||||
")\n", get_ffi_type(n, Getattr(n, "type"), "result")
|
||||
")\n", get_ffi_type(n, Getattr(n, "type"), Swig_cresult_name())
|
||||
//,varargs ? "nil" : "t"
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ char cvsroot_cwrap_c[] = "$Id$";
|
|||
#include "swig.h"
|
||||
|
||||
extern int cparse_cplusplus;
|
||||
static const char *cresult_variable_name = "result";
|
||||
|
||||
static Parm *nonvoid_parms(Parm *p) {
|
||||
if (p) {
|
||||
|
|
@ -28,7 +29,28 @@ static Parm *nonvoid_parms(Parm *p) {
|
|||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Swig_parm_name()
|
||||
* Swig_cresult_name_set()
|
||||
*
|
||||
* Change the name of the variable used to hold the return value from C/C++ wrapper functions
|
||||
* from the default "result".
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void Swig_cresult_name_set(const char *new_name) {
|
||||
cresult_variable_name = new_name;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Swig_cresult_name()
|
||||
*
|
||||
* Get the name of the variable used to hold the return value from C/C++ wrapper functions
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
const char *Swig_cresult_name(void) {
|
||||
return cresult_variable_name;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Swig_cparm_name()
|
||||
*
|
||||
* Generates a name for the ith argument in an argument list
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
|
@ -880,7 +902,7 @@ int Swig_MethodToFunction(Node *n, const_String_or_char_ptr nspace, String *clas
|
|||
}
|
||||
|
||||
call = Swig_cmethod_call(explicitcall_name ? explicitcall_name : name, p, self, explicit_qualifier, director_type);
|
||||
cres = Swig_cresult(Getattr(n, "type"), "result", call);
|
||||
cres = Swig_cresult(Getattr(n, "type"), Swig_cresult_name(), call);
|
||||
|
||||
if (pure_virtual && is_director && (flags & CWRAP_DIRECTOR_TWO_CALLS)) {
|
||||
String *qualifier = SwigType_namestr(Getattr(Getattr(parentNode(n), "typescope"), "qname"));
|
||||
|
|
@ -893,7 +915,7 @@ int Swig_MethodToFunction(Node *n, const_String_or_char_ptr nspace, String *clas
|
|||
/* Create two method calls, one to call the explicit method, the other a normal polymorphic function call */
|
||||
String *cres_both_calls = NewStringf("");
|
||||
String *call_extra = Swig_cmethod_call(name, p, self, 0, director_type);
|
||||
String *cres_extra = Swig_cresult(Getattr(n, "type"), "result", call_extra);
|
||||
String *cres_extra = Swig_cresult(Getattr(n, "type"), Swig_cresult_name(), call_extra);
|
||||
Printv(cres_both_calls, "if (upcall) {\n", cres, "\n", "} else {", cres_extra, "\n}", NIL);
|
||||
Setattr(n, "wrap:action", cres_both_calls);
|
||||
Delete(cres_extra);
|
||||
|
|
@ -974,12 +996,12 @@ int Swig_MethodToFunction(Node *n, const_String_or_char_ptr nspace, String *clas
|
|||
}
|
||||
}
|
||||
Append(func, ")");
|
||||
cres = Swig_cresult(Getattr(n, "type"), "result", func);
|
||||
cres = Swig_cresult(Getattr(n, "type"), Swig_cresult_name(), func);
|
||||
Setattr(n, "wrap:action", cres);
|
||||
Delete(cres);
|
||||
} else {
|
||||
String *call = Swig_cfunction_call(mangled, p);
|
||||
String *cres = Swig_cresult(Getattr(n, "type"), "result", call);
|
||||
String *cres = Swig_cresult(Getattr(n, "type"), Swig_cresult_name(), call);
|
||||
Setattr(n, "wrap:action", cres);
|
||||
Delete(call);
|
||||
Delete(cres);
|
||||
|
|
@ -1089,7 +1111,7 @@ int Swig_ConstructorToFunction(Node *n, const_String_or_char_ptr nspace, String
|
|||
}
|
||||
|
||||
call = Swig_cfunction_call(mangled, parms);
|
||||
cres = Swig_cresult(type, "result", call);
|
||||
cres = Swig_cresult(type, Swig_cresult_name(), call);
|
||||
Setattr(n, "wrap:action", cres);
|
||||
Delete(cres);
|
||||
Delete(call);
|
||||
|
|
@ -1120,7 +1142,7 @@ int Swig_ConstructorToFunction(Node *n, const_String_or_char_ptr nspace, String
|
|||
* implemented in the target language, calls to those methods will
|
||||
* generate Swig::DirectorPureVirtualException exceptions.
|
||||
*/
|
||||
String *cres = Swig_cresult(type, "result", director_call);
|
||||
String *cres = Swig_cresult(type, Swig_cresult_name(), director_call);
|
||||
Append(action, cres);
|
||||
Delete(cres);
|
||||
} else {
|
||||
|
|
@ -1135,11 +1157,11 @@ int Swig_ConstructorToFunction(Node *n, const_String_or_char_ptr nspace, String
|
|||
Append(action, director_ctor);
|
||||
Replaceall(action, "$comparison", tmp_none_comparison);
|
||||
|
||||
cres = Swig_cresult(type, "result", director_call);
|
||||
cres = Swig_cresult(type, Swig_cresult_name(), director_call);
|
||||
Replaceall(action, "$director_new", cres);
|
||||
Delete(cres);
|
||||
|
||||
cres = Swig_cresult(type, "result", nodirector_call);
|
||||
cres = Swig_cresult(type, Swig_cresult_name(), nodirector_call);
|
||||
Replaceall(action, "$nondirector_new", cres);
|
||||
Delete(cres);
|
||||
}
|
||||
|
|
@ -1149,14 +1171,14 @@ int Swig_ConstructorToFunction(Node *n, const_String_or_char_ptr nspace, String
|
|||
Delete(directorname);
|
||||
} else {
|
||||
String *call = Swig_cppconstructor_call(classname, parms);
|
||||
String *cres = Swig_cresult(type, "result", call);
|
||||
String *cres = Swig_cresult(type, Swig_cresult_name(), call);
|
||||
Setattr(n, "wrap:action", cres);
|
||||
Delete(cres);
|
||||
Delete(call);
|
||||
}
|
||||
} else {
|
||||
String *call = Swig_cconstructor_call(classname);
|
||||
String *cres = Swig_cresult(type, "result", call);
|
||||
String *cres = Swig_cresult(type, Swig_cresult_name(), call);
|
||||
Setattr(n, "wrap:action", cres);
|
||||
Delete(cres);
|
||||
Delete(call);
|
||||
|
|
@ -1371,7 +1393,7 @@ int Swig_MembergetToFunction(Node *n, String *classname, int flags) {
|
|||
Swig_add_extension_code(n, mangled, parms, ty, code, cparse_cplusplus, "self");
|
||||
}
|
||||
call = Swig_cfunction_call(mangled, parms);
|
||||
cres = Swig_cresult(ty, "result", call);
|
||||
cres = Swig_cresult(ty, Swig_cresult_name(), call);
|
||||
Setattr(n, "wrap:action", cres);
|
||||
|
||||
Delete(cres);
|
||||
|
|
@ -1381,7 +1403,7 @@ int Swig_MembergetToFunction(Node *n, String *classname, int flags) {
|
|||
Delete(gname);
|
||||
} else {
|
||||
String *call = Swig_cmemberget_call(name, type, self, varcref);
|
||||
String *cres = Swig_cresult(ty, "result", call);
|
||||
String *cres = Swig_cresult(ty, Swig_cresult_name(), call);
|
||||
Setattr(n, "wrap:action", cres);
|
||||
Delete(call);
|
||||
Delete(cres);
|
||||
|
|
@ -1472,14 +1494,14 @@ int Swig_VargetToFunction(Node *n, int flags) {
|
|||
String *sname = Swig_name_get(0, name);
|
||||
String *mangled = Swig_name_mangle(sname);
|
||||
call = Swig_cfunction_call(mangled, 0);
|
||||
cres = Swig_cresult(ty, "result", call);
|
||||
cres = Swig_cresult(ty, Swig_cresult_name(), call);
|
||||
Setattr(n, "wrap:action", cres);
|
||||
Delete(mangled);
|
||||
Delete(sname);
|
||||
} else {
|
||||
String *nname = SwigType_namestr(name);
|
||||
call = Swig_wrapped_var_assign(type, nname, varcref);
|
||||
cres = Swig_cresult(ty, "result", call);
|
||||
cres = Swig_cresult(ty, Swig_cresult_name(), call);
|
||||
Setattr(n, "wrap:action", cres);
|
||||
Delete(nname);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -335,6 +335,8 @@ extern int ParmList_is_compactdefargs(ParmList *p);
|
|||
extern String *Swig_stringify_with_location(DOH *object);
|
||||
|
||||
/* --- C Wrappers --- */
|
||||
extern void Swig_cresult_name_set(const char *new_name);
|
||||
extern const char *Swig_cresult_name(void);
|
||||
extern String *Swig_cparm_name(Parm *p, int i);
|
||||
extern String *Swig_wrapped_var_type(SwigType *t, int varcref);
|
||||
extern int Swig_cargs(Wrapper *w, ParmList *l);
|
||||
|
|
|
|||
|
|
@ -1390,6 +1390,7 @@ static String *Swig_typemap_lookup_impl(const_String_or_char_ptr tmap_method, No
|
|||
* If f and actioncode are NULL, then the caller is just looking to attach the "out" attributes
|
||||
* ie, not use the typemap code, otherwise both f and actioncode must be non null. */
|
||||
if (actioncode) {
|
||||
const String *result_equals = NewStringf("%s = ", Swig_cresult_name());
|
||||
clname = Copy(actioncode);
|
||||
/* check that the code in the typemap can be used in this optimal way.
|
||||
* The code should be in the form "result = ...;\n". We need to extract
|
||||
|
|
@ -1398,8 +1399,8 @@ static String *Swig_typemap_lookup_impl(const_String_or_char_ptr tmap_method, No
|
|||
* hack and circumvents the normal requirement for a temporary variable
|
||||
* to hold the result returned from a wrapped function call.
|
||||
*/
|
||||
if (Strncmp(clname, "result = ", 9) == 0) {
|
||||
int numreplacements = Replace(clname, "result = ", "", DOH_REPLACE_ID_BEGIN);
|
||||
if (Strncmp(clname, result_equals, 9) == 0) {
|
||||
int numreplacements = Replace(clname, result_equals, "", DOH_REPLACE_ID_BEGIN);
|
||||
if (numreplacements == 1) {
|
||||
numreplacements = Replace(clname, ";\n", "", DOH_REPLACE_ID_END);
|
||||
if (numreplacements == 1) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue