From ca58db87b660d90a5dcb1b2e5ad96ec99d20601c Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Mon, 29 May 2023 11:40:53 +1200 Subject: [PATCH] Update lingering uses of %addmethods This was renamed to %extend 21 years ago! The remaining uses are either in docs for the reference example or in xml examples (which can't actually be run because they the SWIG command line syntax they try to use is wrong). --- Examples/go/reference/index.html | 2 +- Examples/go/template/index.html | 4 ++-- Examples/java/reference/index.html | 2 +- Examples/java/template/index.html | 4 ++-- Examples/perl5/reference/index.html | 2 +- Examples/python/reference/index.html | 2 +- Examples/ruby/reference/index.html | 2 +- Examples/tcl/reference/index.html | 2 +- Examples/xml/example_ro.i | 2 +- Examples/xml/example_title_add.expected-xml | 4 ++-- Examples/xml/example_title_add.i | 2 +- 11 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Examples/go/reference/index.html b/Examples/go/reference/index.html index 5e8589349..ebf366bc0 100644 --- a/Examples/go/reference/index.html +++ b/Examples/go/reference/index.html @@ -99,7 +99,7 @@ functions like this: class VectorArray { public: ... - %addmethods { + %extend { Vector &get(int index) { return (*self)[index]; } diff --git a/Examples/go/template/index.html b/Examples/go/template/index.html index cf2b1337b..a389c196a 100644 --- a/Examples/go/template/index.html +++ b/Examples/go/template/index.html @@ -42,7 +42,7 @@ template class vector { v[index] = val; } #ifdef SWIG - %addmethods { + %extend { T getitem(int index) { return self->get(index); } @@ -54,7 +54,7 @@ template class vector { }; -The %addmethods is used for a neater interface from Go as the +The %extend is used for a neater interface from Go as the functions get and set use C++ references to primitive types. These are tricky to use from Go as they end up as pointers, which only work when the C++ and Go types correspond diff --git a/Examples/java/reference/index.html b/Examples/java/reference/index.html index 33c80c50f..97729e1ad 100644 --- a/Examples/java/reference/index.html +++ b/Examples/java/reference/index.html @@ -104,7 +104,7 @@ with a pair of set/get functions like this: class VectorArray { public: ... - %addmethods { + %extend { Vector &get(int index) { return (*self)[index]; } diff --git a/Examples/java/template/index.html b/Examples/java/template/index.html index 31dba6d8e..027aa60e4 100644 --- a/Examples/java/template/index.html +++ b/Examples/java/template/index.html @@ -41,7 +41,7 @@ template class vector { v[index] = val; } #ifdef SWIG - %addmethods { + %extend { T getitem(int index) { return self->get(index); } @@ -53,7 +53,7 @@ template class vector { }; -The %addmethods is used for a neater interface from Java as the functions get and set use C++ references to primitive types. These are tricky to use from Java as they end up as a pointer in Java (Java long). +The %extend is used for a neater interface from Java as the functions get and set use C++ references to primitive types. These are tricky to use from Java as they end up as a pointer in Java (Java long).

The SWIG interface

diff --git a/Examples/perl5/reference/index.html b/Examples/perl5/reference/index.html index 70b4f3d34..5b2912522 100644 --- a/Examples/perl5/reference/index.html +++ b/Examples/perl5/reference/index.html @@ -104,7 +104,7 @@ with a pair of set/get functions like this: class VectorArray { public: ... - %addmethods { + %extend { Vector &get(int index) { return (*self)[index]; } diff --git a/Examples/python/reference/index.html b/Examples/python/reference/index.html index 7ad39797b..49bd3fae2 100644 --- a/Examples/python/reference/index.html +++ b/Examples/python/reference/index.html @@ -104,7 +104,7 @@ with a pair of set/get functions like this: class VectorArray { public: ... - %addmethods { + %extend { Vector &get(int index) { return (*self)[index]; } diff --git a/Examples/ruby/reference/index.html b/Examples/ruby/reference/index.html index d45dbe3d9..f5d134f4f 100644 --- a/Examples/ruby/reference/index.html +++ b/Examples/ruby/reference/index.html @@ -104,7 +104,7 @@ with a pair of set/get functions like this: class VectorArray { public: ... - %addmethods { + %extend { Vector &get(int index) { return (*self)[index]; } diff --git a/Examples/tcl/reference/index.html b/Examples/tcl/reference/index.html index ef799fa90..95059c07f 100644 --- a/Examples/tcl/reference/index.html +++ b/Examples/tcl/reference/index.html @@ -104,7 +104,7 @@ with a pair of set/get functions like this: class VectorArray { public: ... - %addmethods { + %extend { Vector &get(int index) { return (*self)[index]; } diff --git a/Examples/xml/example_ro.i b/Examples/xml/example_ro.i index 23bd1a8e4..b494e1e28 100644 --- a/Examples/xml/example_ro.i +++ b/Examples/xml/example_ro.i @@ -1,5 +1,5 @@ /* File : example.i */ -%readonly +%immutable; extern int status; extern char path[256]; diff --git a/Examples/xml/example_title_add.expected-xml b/Examples/xml/example_title_add.expected-xml index 5aed72972..fc4af4ff6 100644 --- a/Examples/xml/example_title_add.expected-xml +++ b/Examples/xml/example_title_add.expected-xml @@ -76,7 +76,7 @@ Vector addv(Vector &a, Vector &b) { - + @@ -106,7 +106,7 @@ Vector addv(Vector &a, Vector &b) { - + diff --git a/Examples/xml/example_title_add.i b/Examples/xml/example_title_add.i index 33209191c..88a4b3cb8 100644 --- a/Examples/xml/example_title_add.i +++ b/Examples/xml/example_title_add.i @@ -32,7 +32,7 @@ public: int size(); /* This wrapper provides an alternative to the [] operator */ - %addmethods { + %extend { Vector &get(int index) { return (*self)[index]; }