mirror of https://github.com/swig/swig
Add $isvoid special variable expansion for directors
Complete the removal of Ruby's output_helper macro and replacement with SWIG_AppendOutput for director typemaps. Requires $isvoid special variable support in director code.
This commit is contained in:
parent
a95017050e
commit
09001ee302
|
@ -10,7 +10,9 @@ Version 4.3.0 (in progress)
|
|||
2024-10-05: wsfulton
|
||||
[Ruby] Removed backwards compatible output_helper fragment and macro.
|
||||
Use SWIG_AppendOutput instead of output_helper (does not require the
|
||||
output_helper macro).
|
||||
output_helper fragment).
|
||||
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
2024-10-05: wsfulton
|
||||
[Ruby] #2907 Fix returning null from functions with output parameters.
|
||||
|
@ -315,6 +317,8 @@ Version 4.3.0 (in progress)
|
|||
[Python] Removed deprecated pytuplehlp.swg file and t_output_helper.
|
||||
Use SWIG_Python_AppendOutput instead of t_output_helper.
|
||||
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
2024-06-15: vadz
|
||||
[Python] #2907 Fix returning null from functions with output parameters.
|
||||
Ensures OUTPUT and INOUT typemaps are handled consistently wrt return
|
||||
|
|
|
@ -2885,9 +2885,9 @@ example:</p>
|
|||
$1 = &temp;
|
||||
}
|
||||
|
||||
%typemap(argout, fragment="output_helper") int *out {
|
||||
%typemap(argout) int *out {
|
||||
// Append output value $1 to $result (assuming a single integer in this case)
|
||||
$result = output_helper( $result, INT2NUM(*$1) );
|
||||
$result = SWIG_AppendOutput( $result, INT2NUM(*$1) );
|
||||
}</pre>
|
||||
</div>
|
||||
|
||||
|
@ -3187,9 +3187,8 @@ exception.
|
|||
member functions.</p>
|
||||
|
||||
<div class="code"><pre>
|
||||
%typemap(directorargout,
|
||||
fragment="output_helper") int {
|
||||
$result = output_helper( $result, NUM2INT($1) );
|
||||
%typemap(directorargout) int {
|
||||
$result = SWIG_AppendOutput( $result, NUM2INT($1) );
|
||||
}
|
||||
</pre></div>
|
||||
|
||||
|
|
|
@ -127,6 +127,7 @@ void DirectorTest_director_testmethodSwigExplicitDirectorTest(int i) {}
|
|||
%}
|
||||
%typemap(directorargout) int i {
|
||||
$symname(99);
|
||||
int isvoid_special_variable = $isvoid;
|
||||
}
|
||||
%feature("director") DirectorTest;
|
||||
%inline %{
|
||||
|
|
|
@ -4440,6 +4440,7 @@ public:
|
|||
} else {
|
||||
Replaceall(w->code, "$null", "");
|
||||
}
|
||||
Replaceall(w->code, "$isvoid", is_void ? "1" : "0");
|
||||
if (!ignored_method)
|
||||
Printv(director_delegate_callback, "\n", callback_def, callback_code, NIL);
|
||||
if (!Getattr(n, "defaultargs")) {
|
||||
|
|
|
@ -2347,6 +2347,7 @@ public:
|
|||
} else {
|
||||
Replaceall(w->code, "$null", "");
|
||||
}
|
||||
Replaceall(w->code, "$isvoid", is_void ? "1" : "0");
|
||||
if (!ignored_method)
|
||||
Printv(director_dcallbacks_code, callback_def, callback_code, NIL);
|
||||
if (!Getattr(n, "defaultargs")) {
|
||||
|
|
|
@ -3264,7 +3264,9 @@ private:
|
|||
Swig_typemap_attach_parms("imtype", parms, NULL);
|
||||
int parm_count = emit_num_arguments(parms);
|
||||
|
||||
SwigType *result = Getattr(n, "type");
|
||||
SwigType *returntype = Getattr(n, "type");
|
||||
SwigType *result = returntype;
|
||||
bool is_void = !(Cmp(returntype, "void"));
|
||||
|
||||
// Save the type for overload processing.
|
||||
Setattr(n, "go:type", result);
|
||||
|
@ -3998,6 +4000,7 @@ private:
|
|||
|
||||
Printv(w->code, "}", NULL);
|
||||
|
||||
Replaceall(w->code, "$isvoid", is_void ? "1" : "0");
|
||||
Replaceall(w->code, "$symname", symname);
|
||||
Wrapper_print(w, f_c_directors);
|
||||
}
|
||||
|
|
|
@ -4518,6 +4518,7 @@ public:
|
|||
} else {
|
||||
Replaceall(w->code, "$null", "");
|
||||
}
|
||||
Replaceall(w->code, "$isvoid", is_void ? "1" : "0");
|
||||
if (!GetFlag(n, "feature:ignore"))
|
||||
Printv(imclass_directors, callback_def, callback_code, NIL);
|
||||
if (!Getattr(n, "defaultargs")) {
|
||||
|
|
|
@ -1669,6 +1669,7 @@ public:
|
|||
|
||||
/* emit the director method */
|
||||
if (status == SWIG_OK) {
|
||||
Replaceall(w->code, "$isvoid", is_void ? "1" : "0");
|
||||
if (!Getattr(n, "defaultargs")) {
|
||||
Replaceall(w->code, "$symname", symname);
|
||||
Wrapper_print(w, f_directors);
|
||||
|
|
|
@ -1538,6 +1538,7 @@ public:
|
|||
}
|
||||
// emit the director method
|
||||
if (status == SWIG_OK) {
|
||||
Replaceall(w->code, "$isvoid", is_void ? "1" : "0");
|
||||
if (!Getattr(n, "defaultargs")) {
|
||||
Replaceall(w->code, "$symname", symname);
|
||||
Wrapper_print(w, f_directors);
|
||||
|
|
|
@ -2442,6 +2442,7 @@ public:
|
|||
|
||||
/* emit the director method */
|
||||
if (status == SWIG_OK) {
|
||||
Replaceall(w->code, "$isvoid", is_void ? "1" : "0");
|
||||
if (!Getattr(n, "defaultargs")) {
|
||||
Replaceall(w->code, "$symname", symname);
|
||||
Wrapper_print(w, f_directors);
|
||||
|
@ -2456,6 +2457,7 @@ public:
|
|||
DelWrapper(w);
|
||||
return status;
|
||||
}
|
||||
|
||||
int classDirectorDisown(Node *n) {
|
||||
int rv;
|
||||
member_func = 1;
|
||||
|
@ -2468,6 +2470,7 @@ public:
|
|||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
int classDirectorDestructor(Node *n) {
|
||||
/* TODO: it would be nice if this didn't have to copy the body of Language::classDirectorDestructor() */
|
||||
String *DirectorClassName = directorClassName(getCurrentClass());
|
||||
|
|
|
@ -2517,6 +2517,7 @@ public:
|
|||
|
||||
/* emit the director method */
|
||||
if (status == SWIG_OK) {
|
||||
Replaceall(w->code, "$isvoid", is_void ? "1" : "0");
|
||||
if (!Getattr(n, "defaultargs")) {
|
||||
Replaceall(w->code, "$symname", symname);
|
||||
Wrapper_print(w, f_directors);
|
||||
|
|
|
@ -5891,6 +5891,7 @@ int PYTHON::classDirectorMethod(Node *n, Node *parent, String *super) {
|
|||
|
||||
/* emit the director method */
|
||||
if (status == SWIG_OK) {
|
||||
Replaceall(w->code, "$isvoid", is_void ? "1" : "0");
|
||||
if (!Getattr(n, "defaultargs")) {
|
||||
Replaceall(w->code, "$symname", symname);
|
||||
Wrapper_print(w, f_directors);
|
||||
|
|
|
@ -3366,6 +3366,7 @@ public:
|
|||
|
||||
/* emit the director method */
|
||||
if (status == SWIG_OK) {
|
||||
Replaceall(w->code, "$isvoid", is_void ? "1" : "0");
|
||||
if (!Getattr(n, "defaultargs")) {
|
||||
Replaceall(w->code, "$symname", symname);
|
||||
Wrapper_print(w, f_directors);
|
||||
|
|
Loading…
Reference in New Issue