Add support for "ret" typemap where missing and improve documentation on it.
This commit is contained in:
parent
7bfa5fb951
commit
08688d7d9d
11 changed files with 123 additions and 17 deletions
|
|
@ -2722,6 +2722,13 @@ int ALLEGROCL::functionWrapper(Node *n) {
|
|||
}
|
||||
}
|
||||
|
||||
/* See if there is any return cleanup code */
|
||||
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);
|
||||
}
|
||||
|
||||
emit_return_variable(n, t, f);
|
||||
|
||||
if (CPlusPlus) {
|
||||
|
|
|
|||
|
|
@ -543,6 +543,14 @@ int CFFI::functionWrapper(Node *n) {
|
|||
|
||||
cleanupFunction(n, f, parms);
|
||||
|
||||
/* See if there is any return cleanup code */
|
||||
String *tm = 0;
|
||||
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 (!is_void_return) {
|
||||
Printf(f->code, " return lresult;\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2599,6 +2599,14 @@ private:
|
|||
Replaceall(f->code, "$cleanup", cleanup);
|
||||
Delete(cleanup);
|
||||
|
||||
/* See if there is any return cleanup code */
|
||||
String *tm;
|
||||
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);
|
||||
}
|
||||
|
||||
Replaceall(f->code, "$symname", Getattr(n, "sym:name"));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1354,6 +1354,11 @@ void JSEmitter::emitCleanupCode(Node *n, Wrapper *wrapper, ParmList *params) {
|
|||
}
|
||||
}
|
||||
|
||||
/* See if there is any return cleanup code */
|
||||
if ((tm = Swig_typemap_lookup("ret", n, Swig_cresult_name(), 0))) {
|
||||
Printf(wrapper->code, "%s\n", tm);
|
||||
Delete(tm);
|
||||
}
|
||||
}
|
||||
|
||||
int JSEmitter::switchNamespace(Node *n) {
|
||||
|
|
|
|||
|
|
@ -676,6 +676,14 @@ public:
|
|||
Printv(f->code, tm, "\n", NIL);
|
||||
}
|
||||
}
|
||||
|
||||
/* See if there is any return cleanup code */
|
||||
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);
|
||||
}
|
||||
|
||||
// Free any memory allocated by the function being wrapped..
|
||||
|
||||
if ((tm = Swig_typemap_lookup("swig_result", n, Swig_cresult_name(), 0))) {
|
||||
|
|
|
|||
|
|
@ -2097,6 +2097,13 @@ int R::functionWrapper(Node *n) {
|
|||
}
|
||||
}
|
||||
|
||||
/* See if there is any return cleanup code */
|
||||
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);
|
||||
}
|
||||
|
||||
Printv(f->code, UnProtectWrapupCode, NIL);
|
||||
|
||||
/*If the user gave us something to convert the result in */
|
||||
|
|
|
|||
|
|
@ -412,7 +412,7 @@ public:
|
|||
emit_return_variable(node, functionReturnType, wrapper);
|
||||
|
||||
/* Return the function value if necessary */
|
||||
String *functionReturnTypemap = Swig_typemap_lookup_out("out", node, "result", wrapper, functionActionCode);
|
||||
String *functionReturnTypemap = Swig_typemap_lookup_out("out", node, Swig_cresult_name(), wrapper, functionActionCode);
|
||||
if (functionReturnTypemap) {
|
||||
// Result is actually the position of output value on stack
|
||||
if (Len(functionReturnTypemap) > 0) {
|
||||
|
|
@ -471,6 +471,13 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
/* See if there is any return cleanup code */
|
||||
String *tm;
|
||||
if ((tm = Swig_typemap_lookup("ret", node, Swig_cresult_name(), 0))) {
|
||||
Replaceall(tm, "$source", Swig_cresult_name());
|
||||
Printf(wrapper->code, "%s\n", tm);
|
||||
Delete(tm);
|
||||
}
|
||||
|
||||
/* Close the function(ok) */
|
||||
Printv(wrapper->code, "return SWIG_OK;\n", NIL);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue