Remove support for $source and $target

These were officially deprecated in 2001, and attempts to use them have
resulted in a warning (including a pointer to what to update them to)
for most if not all of that time.

Fixes #1984
This commit is contained in:
Olly Betts 2021-04-29 13:24:16 +12:00
commit 9ddc9dceb7
27 changed files with 21 additions and 279 deletions

View file

@ -1425,16 +1425,14 @@ public:
* applyInputTypemap()
*
* Look up the appropriate "in" typemap for this parameter (p),
* substitute the correct strings for the $target and $input typemap
* parameters, and dump the resulting code to the wrapper file.
* substitute the correct strings for the typemap parameters, and dump the
* resulting code to the wrapper file.
* --------------------------------------------------------------------- */
Parm *applyInputTypemap(Parm *p, String *ln, String *source, Wrapper *f, String *symname) {
Parm *applyInputTypemap(Parm *p, String *source, Wrapper *f, String *symname) {
String *tm;
SwigType *pt = Getattr(p, "type");
if ((tm = Getattr(p, "tmap:in"))) {
Replaceall(tm, "$target", ln);
Replaceall(tm, "$source", source);
Replaceall(tm, "$input", source);
Replaceall(tm, "$symname", symname);
@ -1474,10 +1472,8 @@ public:
Parm *p;
String *tm;
String *source;
String *target;
source = NewString("");
target = NewString("");
bool ctor_director = (current == CONSTRUCTOR_INITIALIZE && Swig_directorclass(n));
@ -1498,7 +1494,6 @@ public:
p = skipIgnoredArgs(p);
String *pn = Getattr(p, "name");
String *ln = Getattr(p, "lname");
/* Produce string representation of source argument */
Clear(source);
@ -1510,10 +1505,6 @@ public:
Printf(source, "argv[%d]", i - start);
}
/* Produce string representation of target argument */
Clear(target);
Printf(target, "%s", Char(ln));
if (i >= (numreq)) { /* Check if parsing an optional argument */
Printf(f->code, " if (argc > %d) {\n", i - start);
}
@ -1526,7 +1517,7 @@ public:
}
/* Look for an input typemap */
p = applyInputTypemap(p, ln, source, f, Getattr(n, "name"));
p = applyInputTypemap(p, source, f, Getattr(n, "name"));
if (i >= numreq) {
Printf(f->code, "}\n");
}
@ -1553,7 +1544,6 @@ public:
}
Delete(source);
Delete(target);
}
/* ---------------------------------------------------------------------
@ -1569,7 +1559,6 @@ public:
String *tm;
for (p = l; p;) {
if ((tm = Getattr(p, "tmap:check"))) {
Replaceall(tm, "$target", Getattr(p, "lname"));
Printv(f->code, tm, "\n", NIL);
p = Getattr(p, "tmap:check:next");
} else {
@ -1591,7 +1580,6 @@ public:
for (Parm *p = l; p;) {
if ((tm = Getattr(p, "tmap:freearg"))) {
if (Len(tm) != 0) {
Replaceall(tm, "$source", Getattr(p, "lname"));
Printv(cleanup, tm, "\n", NIL);
}
p = Getattr(p, "tmap:freearg:next");
@ -1613,8 +1601,6 @@ public:
String *tm;
for (Parm *p = l; p;) {
if ((tm = Getattr(p, "tmap:argout"))) {
Replaceall(tm, "$source", Getattr(p, "lname"));
Replaceall(tm, "$target", "vresult");
Replaceall(tm, "$result", "vresult");
Replaceall(tm, "$arg", Getattr(p, "emit:input"));
Replaceall(tm, "$input", Getattr(p, "emit:input"));
@ -1876,8 +1862,6 @@ public:
actioncode = 0;
if (tm) {
Replaceall(tm, "$result", "vresult");
Replaceall(tm, "$source", Swig_cresult_name());
Replaceall(tm, "$target", "vresult");
if (GetFlag(n, "feature:new"))
Replaceall(tm, "$owner", "SWIG_POINTER_OWN");
@ -1975,7 +1959,6 @@ public:
if (current != CONSTRUCTOR_ALLOCATE && GetFlag(n, "feature:new")) {
tm = Swig_typemap_lookup("newfree", n, Swig_cresult_name(), 0);
if (tm) {
Replaceall(tm, "$source", Swig_cresult_name());
Printv(f->code, tm, "\n", NIL);
Delete(tm);
}
@ -1984,7 +1967,6 @@ public:
/* Special processing on return value. */
tm = Swig_typemap_lookup("ret", n, Swig_cresult_name(), 0);
if (tm) {
Replaceall(tm, "$source", Swig_cresult_name());
Printv(f->code, tm, NIL);
Delete(tm);
}
@ -2214,8 +2196,6 @@ public:
tm = Swig_typemap_lookup("varout", n, name, 0);
if (tm) {
Replaceall(tm, "$result", "_val");
Replaceall(tm, "$target", "_val");
Replaceall(tm, "$source", name);
/* Printv(getf->code,tm, NIL); */
addfail = emit_action_code(n, getf->code, tm);
} else {
@ -2250,8 +2230,6 @@ public:
tm = Swig_typemap_lookup("varin", n, name, 0);
if (tm) {
Replaceall(tm, "$input", "_val");
Replaceall(tm, "$source", "_val");
Replaceall(tm, "$target", name);
/* Printv(setf->code,tm,"\n",NIL); */
emit_action_code(n, setf->code, tm);
} else {
@ -2363,8 +2341,6 @@ public:
if (!tm)
tm = Swig_typemap_lookup("constcode", n, value, 0);
if (tm) {
Replaceall(tm, "$source", value);
Replaceall(tm, "$target", iname);
Replaceall(tm, "$symname", iname);
Replaceall(tm, "$value", value);
if (current == CLASS_CONST) {