Merge branch 'master' of https://github.com/swig/swig into Cmerge

This commit is contained in:
Joey Yakimowich-Payne 2023-02-18 00:05:36 -07:00
commit 5a06ca1ed7
No known key found for this signature in database
GPG key ID: 6BFE655FA5ABD1E1
312 changed files with 10813 additions and 7218 deletions

View file

@ -120,8 +120,11 @@ jobs:
- SWIGLANG: php
VER: '7.4'
- SWIGLANG: php
VER: '8.0'
- SWIGLANG: php
VER: '8.1'
- SWIGLANG: php
VER: '8.2'
- SWIGLANG: python
PY2: 2
- SWIGLANG: python
@ -186,6 +189,7 @@ jobs:
CPPSTD: c++11
- SWIGLANG: scilab
VER: '5.5.2'
continue-on-error: true # downloads have moved, awaiting URL redirect
- SWIGLANG: scilab
os: ubuntu-18.04 # scilab 6.0
- SWIGLANG: scilab

62
.github/workflows/nuget.yml vendored Normal file
View file

@ -0,0 +1,62 @@
name: Windows Nuget Build
on:
push:
paths-ignore:
- 'CHANGES*'
- 'Doc/**'
- 'appveyor.yml'
pull_request:
branches: master
paths-ignore:
- 'CHANGES*'
- 'Doc/**'
- 'appveyor.yml'
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
build:
runs-on: windows-2019
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install Dependencies
shell: powershell
run: |
nuget install CMake-win64 -Version 3.15.5 -OutputDirectory C:\Tools\CMake
nuget install Bison -Version 3.7.4 -OutputDirectory C:\Tools\bison
nuget install PCRE2 -Version 10.39 -OutputDirectory C:\Tools\pcre2
- name: Build
shell: powershell
run: |
$env:PATH="C:\Tools\CMake\CMake-win64.3.15.5\bin;C:\Tools\bison\Bison.3.7.4\bin;" + $env:PATH
$PCRE_ROOT="C:\Tools\pcre2\PCRE2.10.39.0"
$PCRE_PLATFORM="x64"
$WORKING_DIR=(Get-Location).ToString() -replace "\\","/"
cmake -G "Visual Studio 16 2019" -A "x64" `
-DCMAKE_INSTALL_PREFIX="$WORKING_DIR/install2" `
-DCMAKE_C_FLAGS="/DPCRE2_STATIC" `
-DCMAKE_CXX_FLAGS="/DPCRE2_STATIC" `
-DPCRE2_INCLUDE_DIR="$PCRE_ROOT/include" `
-DPCRE2_LIBRARY="$PCRE_ROOT/lib/pcre2-8-static.lib" `
-S . -B build
cmake --build build --config Release
- name: Install
shell: powershell
run: |
cmake --install build --config Release
- name: Test
shell: powershell
working-directory: install2/bin
run: |
swig.exe -version

1
.gitignore vendored
View file

@ -81,7 +81,6 @@ Tools/javascript/Makefile
config.log
config.status
preinst-swig
swig.spec
# Build Artifacts
.dirstamp

View file

@ -1,8 +1,8 @@
*** ANNOUNCE: SWIG 4.1.0 (in progress) ***
*** ANNOUNCE: SWIG 4.2.0 (in progress) ***
http://www.swig.org
https://www.swig.org
We're pleased to announce SWIG-4.1.0, the latest SWIG release.
We're pleased to announce SWIG-4.2.0, the latest SWIG release.
What is SWIG?
=============
@ -19,20 +19,20 @@ and user interface development for large C/C++ systems.
Release Notes
=============
Detailed release notes are available with the release and are also
published on the SWIG web site at http://swig.org/release.html.
published on the SWIG web site at https://swig.org/release.html.
Availability
============
The release is available for download on Sourceforge at
https://prdownloads.sourceforge.net/swig/swig-4.1.0.tar.gz
https://prdownloads.sourceforge.net/swig/swig-4.2.0.tar.gz
A Windows version is also available at
https://prdownloads.sourceforge.net/swig/swigwin-4.1.0.zip
https://prdownloads.sourceforge.net/swig/swigwin-4.2.0.zip
Please report problems with this release to the swig-devel mailing list,
details at http://www.swig.org/mail.html.
details at https://www.swig.org/mail.html.
--- The SWIG Developers

View file

@ -735,13 +735,15 @@ static void from_cache(int first)
}
/* send the cpp stderr, if applicable */
fd_cpp_stderr = open(cpp_stderr, O_RDONLY | O_BINARY);
if (fd_cpp_stderr != -1) {
copy_fd(fd_cpp_stderr, 2);
close(fd_cpp_stderr);
unlink(cpp_stderr);
free(cpp_stderr);
cpp_stderr = NULL;
if (cpp_stderr) {
fd_cpp_stderr = open(cpp_stderr, O_RDONLY | O_BINARY);
if (fd_cpp_stderr != -1) {
copy_fd(fd_cpp_stderr, 2);
close(fd_cpp_stderr);
unlink(cpp_stderr);
free(cpp_stderr);
cpp_stderr = NULL;
}
}
/* send the stderr */

View file

@ -409,7 +409,7 @@ ccache was adapted to create ccache-swig for use with SWIG by William Fulton.
If you wish to report a problem or make a suggestion then please email
the SWIG developers on the swig-devel mailing list, see
url(http://www.swig.org/mail.html)(http://www.swig.org/mail.html)
url(https://www.swig.org/mail.html)(https://www.swig.org/mail.html)
ccache is released under the GNU General Public License version 2 or
later. Please see the file COPYING for license details.

View file

@ -88,8 +88,8 @@ static void copy64(uint32 *M, const unsigned char *in)
int i;
for (i=0;i<16;i++)
M[i] = (in[i*4+3]<<24) | (in[i*4+2]<<16) |
(in[i*4+1]<<8) | (in[i*4+0]<<0);
M[i] = ((uint32)in[i*4+3]<<24) | ((uint32)in[i*4+2]<<16) |
((uint32)in[i*4+1]<<8) | ((uint32)in[i*4+0]<<0);
}
static void copy4(unsigned char *out,uint32 x)

1364
CHANGES

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -20,8 +20,11 @@ endif ()
set (SWIG_ROOT ${PROJECT_SOURCE_DIR})
set (SWIG_LIB share/swig/${SWIG_VERSION})
if (WIN32)
set (SWIG_LIB bin/Lib)
else ()
set (SWIG_LIB share/swig/${SWIG_VERSION})
endif ()
# Project wide configuration variables
# ------------------------------------
@ -80,10 +83,10 @@ if (WITH_PCRE)
include_directories (${PCRE2_INCLUDE_DIRS})
endif()
if (WIN32)
file (TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX}/${SWIG_LIB} SWIG_LIB_WIN_UNIX)
string (REGEX REPLACE "\\\\" "\\\\\\\\" SWIG_LIB_WIN_UNIX "${SWIG_LIB_WIN_UNIX}")
endif ()
#if (WIN32)
# file (TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX}/${SWIG_LIB} SWIG_LIB_WIN_UNIX)
# string (REGEX REPLACE "\\\\" "\\\\\\\\" SWIG_LIB_WIN_UNIX "${SWIG_LIB_WIN_UNIX}")
#endif ()
configure_file (${SWIG_ROOT}/Tools/cmake/swigconfig.h.in
${CMAKE_CURRENT_BINARY_DIR}/Source/Include/swigconfig.h)
@ -127,6 +130,7 @@ install (FILES ${CMAKE_CURRENT_BINARY_DIR}/swigwarn.swg DESTINATION ${SWIG_LIB})
# ---------
file (GLOB DOH_SOURCES ${SWIG_SOURCE_DIR}/DOH/*.c)
file (GLOB CPARSE_SOURCES ${SWIG_SOURCE_DIR}/CParse/*.c)
list (REMOVE_ITEM CPARSE_SOURCES ${SWIG_SOURCE_DIR}/CParse/parser.c)
list (APPEND CPARSE_SOURCES)
file (GLOB PREPROCESSOR_SOURCES ${SWIG_SOURCE_DIR}/Preprocessor/*.c)
file (GLOB CORE_SOURCES ${SWIG_SOURCE_DIR}/Swig/*.c)

View file

@ -130,7 +130,7 @@ like this:
* terms also apply to certain portions of SWIG. The full details of the SWIG
* license and copyrights can be found in the LICENSE and COPYRIGHT files
* included with the SWIG source code as distributed by the SWIG developers
* and at http://www.swig.org/legal.html.
* and at https://www.swig.org/legal.html.
*
* xxx.c
*

View file

@ -463,7 +463,7 @@ ccache was adapted to create ccache-swig for use with SWIG by William Fulton.
<p>
If you wish to report a problem or make a suggestion then please email
the SWIG developers on the swig-devel mailing list, see
<a href="http://www.swig.org/mail.html">http://www.swig.org/mail.html</a>
<a href="https://www.swig.org/mail.html">https://www.swig.org/mail.html</a>
<p>
ccache is released under the GNU General Public License version 2 or
later. Please see the file COPYING for license details.

View file

@ -720,18 +720,45 @@ AltStruct var2{2, 4.3}; // calls the constructor
<H3><a name="CPlusPlus11_type_inference">7.2.6 Type inference</a></H3>
<p>SWIG supports <tt>decltype()</tt> with some limitations. Single
variables are allowed, however, expressions are not supported yet. For
<p>SWIG supports <tt>decltype()</tt> with limitations. Single
variables are allowed, however, non-trivial expressions are not supported very well. For
example, the following code will work:</p>
<div class="code"><pre>
int i;
decltype(i) j;
</pre></div>
<p>However, using an expression inside the decltype results in syntax error:</p>
<p>SWIG is able to deduce that the variable, <tt>i</tt>, is type <tt>int</tt>.
</p>
<p>
Using a non-trivial expression for the decltype results in a warning:</p>
<div class="code"><pre>
int i; int j;
decltype(i+j) k; // syntax error
decltype(i+j) k; // Warning 344: Unable to deduce decltype for 'i+j'.
</pre></div>
<p>
This warning should be viewed as a prompt to add in a manual ignore of the variable/function as
in most cases the generated code will not compile.
For the example above, ignore the symbol that uses decltype and perhaps additionally
suppress the warning as follows:
</p>
<div class="code"><pre>
#pragma SWIG nowarn=SWIGWARN_CPP11_DECLTYPE
%ignore k;
</pre></div>
<p>
If an ignore is not acceptable, a workaround is to redefine the symbol with the actual type, for example:
</p>
<div class="code"><pre>
int k; // define k with the actual type
%ignore k; // ignore the real definition of k
int i; int j;
decltype(i+j) k; // Warning 344: Unable to deduce decltype for 'i+j'.
</pre></div>
<p>SWIG does not support <tt>auto</tt> as a type specifier for variables, only
@ -891,6 +918,19 @@ struct DerivedStruct : BaseStruct {
};
</pre></div>
<p>
Classes can also be marked as final, such as
</p>
<div class="code"><pre>
struct FinalDerivedStruct final : BaseStruct {
virtual void ab() const override;
};
</pre></div>
<p>
<b>Compatibility note:</b> Final methods were supported much earlier than final classes. SWIG-4.1.0 was the first version to support classes marked as final.
</p>
<H3><a name="CPlusPlus11_null_pointer_constant">7.2.12 Null pointer constant</a></H3>
@ -1085,38 +1125,71 @@ union P {
<H3><a name="CPlusPlus11_variadic_templates">7.2.18 Variadic templates</a></H3>
<p>SWIG supports the variadic templates syntax (inside the &lt;&gt;
block, variadic class inheritance and variadic constructor and
initializers) with some limitations. The following code is correctly parsed:</p>
<p>SWIG supports the variadic templates including the &lt;&gt;
variadic class inheritance, variadic methods, variadic constructors and
initializers. Example:</p>
<div class="code"><pre>
template &lt;typename... BaseClasses&gt; class ClassName : public BaseClasses... {
public:
ClassName (BaseClasses &amp;&amp;... baseClasses) : BaseClasses(baseClasses)... {}
}
ClassName(BaseClasses &amp;&amp;... baseClasses) : BaseClasses(baseClasses)... {}
void InstanceMethod(const BaseClasses&amp;... baseClasses) {}
};
</pre></div>
<p>
For now however, the <tt>%template</tt> directive only accepts one parameter substitution
for the variable template parameters.
The <tt>%template</tt> directive works as expected for variable template parameters.
</p>
<div class="code"><pre>
%template(MyVariant1) ClassName&lt;&gt; // zero argument not supported yet
%template(MyVariant2) ClassName&lt;int&gt; // ok
%template(MyVariant3) ClassName&lt;int, int&gt; // too many arguments not supported yet
struct A {
virtual void amethod();
virtual ~A();
};
struct B {
virtual void bmethod();
virtual ~B();
};
%template(ClassName0) ClassName&lt;&gt;
%template(ClassName1) ClassName&lt;A&gt;
%template(ClassName2) ClassName&lt;A, B&gt;
</pre></div>
<p>Support for the variadic <tt>sizeof()</tt> function is correctly parsed:</p>
<p>
Example usage from say Python:
</p>
<div class="targetlang"><pre>
cn0 = ClassName0()
cn0.InstanceMethod()
a = A()
cn1 = ClassName1(a)
cn1.amethod()
cn1.InstanceMethod(a)
b = B()
cn2 = ClassName2(a, b)
cn2.InstanceMethod(a, b)
cn2.amethod()
cn2.bmethod()
</pre></div>
<p>Support for the variadic <tt>sizeof()</tt> function also works:</p>
<div class="code"><pre>
const int SIZE = sizeof...(ClassName&lt;int, int&gt;);
const int SIZE = sizeof...(ClassName&lt;A, B&gt;);
</pre></div>
<p>
In the above example <tt>SIZE</tt> is of course wrapped as a constant.
</p>
<p>
<b>Compatibility note:</b> SWIG-4.2.0 was the first version to fully support variadic templates.
SWIG-3.0.0 provided initial support and was limited to only one variadic parameter.
</p>
<H3><a name="CPlusPlus11_new_char_literals">7.2.19 New character literals</a></H3>

View file

@ -566,7 +566,7 @@ After SWIG has run and both the C# and C/C++ compilers have finished building,
the examples will be run, by either running <tt>runme.exe</tt> or by running
<tt>mono runme.exe</tt> (Mono C# compiler).
Windows users can also get the examples working using a
<a href="http://www.cygwin.com">Cygwin</a> or <a href="http://www.mingw.org">MinGW</a> environment for automatic configuration of the example makefiles.
<a href="http://www.cygwin.com">Cygwin</a> or <a href="https://osdn.net/projects/mingw/">MinGW</a> environment for automatic configuration of the example makefiles.
Any one of the C# compilers (Mono or Microsoft) can be detected from within a Cygwin or Mingw environment if installed in your path.
<H2><a name="CSharp_void_pointers">23.3 Void pointers</a></H2>

View file

@ -260,6 +260,7 @@
<li><a href="SWIGPlus.html#SWIGPlus_template_functions">Function templates</a>
<li><a href="SWIGPlus.html#SWIGPlus_template_classes">Default template arguments</a>
<li><a href="SWIGPlus.html#SWIGPlus_template_class_inheritance">Template base classes</a>
<li><a href="SWIGPlus.html#SWIGPlus_template_empty">Empty template instantiation</a>
<li><a href="SWIGPlus.html#SWIGPlus_template_specialization">Template specialization</a>
<li><a href="SWIGPlus.html#SWIGPlus_template_member">Member templates</a>
<li><a href="SWIGPlus.html#SWIGPlus_template_scoping">Scoping and templates</a>
@ -1351,6 +1352,7 @@
<li><a href="Php.html#Php_nn2_6_3">Static Member Variables</a>
<li><a href="Php.html#Php_nn2_6_4">Static Member Functions</a>
<li><a href="Php.html#Php_nn2_6_5">Specifying Implemented Interfaces</a>
<li><a href="Php.html#Php_nn2_6_6">Dynamic Properties</a>
</ul>
<li><a href="Php.html#Php_nn2_7">PHP Pragmas, Startup and Shutdown code</a>
</ul>

View file

@ -44,7 +44,7 @@
<H2><a name="D_introduction">24.1 Introduction</a></H2>
<p>From the <a href="http://www.digitalmars.com/d/">D Programming Language</a> web site: <em>D is a systems programming language. Its focus is on combining the power and high performance of C and C++ with the programmer productivity of modern languages like Ruby and Python. [...] The D language is statically typed and compiles directly to machine code.</em> As such, it is not very surprising that D is able to directly <a href="http://www.digitalmars.com/d/1.0/interfaceToC.html">interface with C libraries</a>. Why would a SWIG module for D be needed then in the first place?</p>
<p>From the <a href="https://www.digitalmars.com/d/">D Programming Language</a> web site: <em>D is a systems programming language. Its focus is on combining the power and high performance of C and C++ with the programmer productivity of modern languages like Ruby and Python. [...] The D language is statically typed and compiles directly to machine code.</em> As such, it is not very surprising that D is able to directly <a href="https://www.digitalmars.com/d/1.0/interfaceToC.html">interface with C libraries</a>. Why would a SWIG module for D be needed then in the first place?</p>
<p>Well, besides the obvious downside that the C header files have to be manually converted to D modules for this to work, there is one major inconvenience with this approach: D code usually is on a higher abstraction level than C, and many of the features that make D interesting are simply not available when dealing with C libraries, requiring you e.g. to manually convert strings between pointers to <tt>\0</tt>-terminated char arrays and D char arrays, making the algorithms from the D2 standard library unusable with C arrays and data structures, and so on.</p>
@ -421,7 +421,7 @@ struct A {
<p>The first key difference is that C++ supports free functions as operators (along with argument-dependent lookup), while D requires operators to be member functions of the class they are operating on. SWIG can only automatically generate wrapping code for member function operators; if you want to use operators defined as free functions in D, you need to handle them manually.</p>
<p>Another set of differences between C++ and D concerns individual operators. For example, there are quite a few operators which are overloadable in C++, but not in D, for example <tt>&amp;&amp;</tt> and <tt>||</tt>, but also <tt>!</tt>, and prefix increment/decrement operators in <a href="http://www.digitalmars.com/d/1.0/operatoroverloading.html">D1</a> resp. their postfix pendants in <a href="http://www.digitalmars.com/d/2.0/operatoroverloading.html">D2</a>.</p>
<p>Another set of differences between C++ and D concerns individual operators. For example, there are quite a few operators which are overloadable in C++, but not in D, for example <tt>&amp;&amp;</tt> and <tt>||</tt>, but also <tt>!</tt>, and prefix increment/decrement operators in <a href="https://www.digitalmars.com/d/1.0/operatoroverloading.html">D1</a> resp. their postfix pendants in <a href="https://www.digitalmars.com/d/2.0/operatoroverloading.html">D2</a>.</p>
<p>There are also some cases where the operators can be translated to D, but the differences in the implementation details are big enough that a rather involved scheme would be required for automatic wrapping them, which has not been implemented yet. This affects, for example, the array subscript operator, <tt>[]</tt>, in combination with assignments - while <tt>operator []</tt> in C++ simply returns a reference which is then written to, D resorts to a separate <tt>opIndexAssign</tt> method -, or implicit casting (which was introduced in D2 via <tt>alias this</tt>). Despite the lack of automatic support, manually handling these cases should be perfectly possible.</p>

View file

@ -67,7 +67,7 @@ supported.
<p>
The Doxygen Translation module of SWIG adds an extra layer of
functionality to SWIG, allowing automated translation of <a href=
"http://www.doxygen.nl/manual/">Doxygen</a> formatted comments
"https://www.doxygen.nl/manual/">Doxygen</a> formatted comments
from input files into a documentation language more suited for the
target language. Currently this module only translates into Javadoc
and Pydoc for the SWIG Java and Python modules.
@ -83,14 +83,14 @@ Code</a> proposal from Summer 2008.
<p>
To make use of the comment translation system, your documentation
comments must be in properly formatted <a href=
"http://www.doxygen.nl/manual/">Doxygen.</a> Doxygen comments can be
"https://www.doxygen.nl/manual/">Doxygen.</a> Doxygen comments can be
present in your main SWIG interface file or any header file that it
imports. You are advised to be validate that your comments compile
properly with Doxygen before you try to translate them. Doxygen
itself is a more comprehensive tool and can provide you better feedback for
correcting any syntax errors that may be present. Please look at
Doxygen's <a href=
"http://www.doxygen.nl/manual/docblocks.html"> Documenting the
"https://www.doxygen.nl/manual/docblocks.html"> Documenting the
code</a> for the full comment format specifications. However, SWIG's
Doxygen parser will still report many errors and warnings found
in comments (like unterminated strings or missing ending tags).
@ -98,7 +98,7 @@ in comments (like unterminated strings or missing ending tags).
<p>
Currently, the whole subset of Doxygen comment styles is supported
(See <a href="http://www.doxygen.nl/manual/docblocks.html">
(See <a href="https://www.doxygen.nl/manual/docblocks.html">
Documenting the code</a>). Here they are:
</p>
@ -298,7 +298,7 @@ make much sense for the other languages without explicit ownership management.
<p>
Doxygen syntax is rather rich and, in addition to simple commands such as
<tt>@transferfull</tt>, it is also possible to define commands with arguments.
As explained in <a href="http://www.doxygen.nl/manual/commands.html">Doxygen documentation</a>,
As explained in <a href="https://www.doxygen.nl/manual/commands.html">Doxygen documentation</a>,
the arguments can have a range of a single word, everything until the end of
line or everything until the end of the next paragraph. Currently, only the "end
of line" case is supported using the <tt>range="line"</tt> argument of the
@ -1079,7 +1079,7 @@ class Shape(_object):
<p>
If any parameters of a function or a method are documented in the Doxygen comment,
their description is copied into the generated output using
<a href="http://sphinx-doc.org/">Sphinx </a> documentation conventions. For example
<a href="https://www.sphinx-doc.org/">Sphinx </a> documentation conventions. For example
</p>
<div class="code"><pre>
/**
@ -1167,7 +1167,7 @@ completely (doxygen:notranslate feature). Then SWIG will just copy
the comments to the proxy file and reformat them if needed, but all
the comment content will be left as is. As Doxygen doesn't support
special commands in Python comments
(see <a href="http://www.doxygen.nl/manual/docblocks.html#pythonblocks">Doxygen
(see <a href="https://www.doxygen.nl/manual/docblocks.html#pythonblocks">Doxygen
docs</a>), you may want to use some tool like doxypy
(<a href="https://pypi.org/project/doxypy/">doxypy</a>)
to do the work.

View file

@ -1244,6 +1244,14 @@ if an object was removed, 0 otherwise.
Returns the list of hash table keys.
</div>
<p>
<b><tt>List *SortedKeys(Hash *h, int (*cmp) (const DOH *, const DOH *))</tt></b>
</p>
<div class="indent">
Returns the list of sorted hash table keys.
</div>
<H3><a name="Extending_nn17">40.5.3 Lists</a></H3>
@ -3141,7 +3149,7 @@ As you can see, most usages are direct.
<dd> This file is processed by
<p>
<A HREF="http://www.gnu.org/software/autoconf/">autoconf</A>
<A HREF="https://www.gnu.org/software/autoconf/">autoconf</A>
to generate the <TT>configure</TT> script. This is where you
need to add shell script fragments and autoconf macros to detect the
presence of whatever development support your language module requires,
@ -3489,7 +3497,7 @@ Advanced usage of the test-suite facilitates running tools on some of the five s
The make variables <tt>SWIGTOOL</tt> and <tt>RUNTOOL</tt> are used to specify a tool to respectively, invoke SWIG
and the execution of the runtime test.
You are advised to view the <tt>Examples/test-suite/common.mk</tt> file for details but for a short summary,
the classic usage is to use <a href="http://valgrind.org/">Valgrind</a> for memory checking.
the classic usage is to use <a href="https://valgrind.org/">Valgrind</a> for memory checking.
For example, checking for memory leaks when running the runtime test in the target language interpreter:
</p>

View file

@ -56,7 +56,7 @@
<p>
This chapter describes SWIG's support of Go. For more information on
the Go programming language
see <a href="http://golang.org/">golang.org</a>.
see <a href="https://golang.org/">golang.org</a>.
</p>
<H2><a name="Go_overview">25.1 Overview</a></H2>

View file

@ -76,7 +76,7 @@ we explicitly prefix the context, e.g., "guile-module".
<p>Guile 1.8 and older could be interfaced using two different api's, the SCM
or the GH API. The GH interface to guile is deprecated. Read more about why in the
<a href="http://www.gnu.org/software/guile/docs/docs-1.6/guile-ref/GH.html#GH">Guile manual</a>.
<a href="https://www.gnu.org/software/guile/docs/docs-1.6/guile-ref/GH.html#GH">Guile manual</a>.
<p>Support for the guile GH wrapper code generation has been dropped from SWIG. The last
version of SWIG that can still generate guile GH wrapper code is 2.0.9. Please

View file

@ -453,14 +453,14 @@ Microsoft Visual Studio.
<p>
If you are using the GNU Autotools
(<a href="http://www.gnu.org/software/autoconf/">Autoconf</a>/
<a href="http://www.gnu.org/software/automake/">Automake</a>/
<a href="http://www.gnu.org/software/libtool/">Libtool</a>)
(<a href="https://www.gnu.org/software/autoconf/">Autoconf</a>/
<a href="https://www.gnu.org/software/automake/">Automake</a>/
<a href="https://www.gnu.org/software/libtool/">Libtool</a>)
to configure SWIG use in your project, the SWIG Autoconf macros can be used.
The primary macro is <tt>ax_pkg_swig</tt>, see
<a href="http://www.gnu.org/software/autoconf-archive/ax_pkg_swig.html#ax_pkg_swig">http://www.gnu.org/software/autoconf-archive/ax_pkg_swig.html#ax_pkg_swig</a>.
<a href="https://www.gnu.org/software/autoconf-archive/ax_pkg_swig.html#ax_pkg_swig">http://www.gnu.org/software/autoconf-archive/ax_pkg_swig.html#ax_pkg_swig</a>.
The <tt>ax_python_devel</tt> macro is also helpful for generating Python extensions. See the
<a href="http://www.gnu.org/software/autoconf-archive/">Autoconf Archive</a>
<a href="https://www.gnu.org/software/autoconf-archive/">Autoconf Archive</a>
for further information on this and other Autoconf macros.
</p>

View file

@ -279,7 +279,7 @@ extern bool example_initialize(JSGlobalContextRef context, JSObjectRef* exports)
<H4><a name="Javascript_gtk">28.3.2.2 GTK</a></H4>
<p>There is general information about programming GTK at <a href="https://developer.gnome.org/gtk2/">GTK documentation</a> and in the <a href="https://developer.gnome.org/gtk-tutorial/">GTK tutorial</a>, and for Webkit there is a <a href="http://webkitgtk.org/reference/webkitgtk/stable/index.html">Webkit GTK+ API Reference</a>.</p>
<p>There is general information about programming GTK at <a href="https://developer.gnome.org/gtk2/">GTK documentation</a> and in the <a href="https://developer.gnome.org/gtk-tutorial/">GTK tutorial</a>, and for Webkit there is a <a href="https://webkitgtk.org/reference/webkitgtk/stable/index.html">Webkit GTK+ API Reference</a>.</p>
<p>An integration of a native extension 'example' would look like this:</p>
<div class="code">
<pre>
@ -310,7 +310,7 @@ int main(int argc, char* argv[])
...
// Load a web page into the browser instance
webkit_web_view_load_uri(webView, "http://www.webkitgtk.org/");
webkit_web_view_load_uri(webView, "https://www.webkitgtk.org/");
...
@ -465,7 +465,7 @@ example.Foo = 3.1415926;</pre>
</div>
<p>First the module <code>example</code> is loaded from the previously built extension. Global methods and variables are available in the scope of the module.</p>
<p><b>Note</b>: ECMAScript 5, the currently implemented Javascript standard, does not have modules. <code>node.js</code> and other implementations provide this mechanism defined by the <a href="http://wiki.commonjs.org/wiki/CommonJS">CommonJS</a> group. For browsers this is provided by <a href="http://browserify.org">Browserify</a>, for instance.</p>
<p><b>Note</b>: ECMAScript 5, the currently implemented Javascript standard, does not have modules. <code>node.js</code> and other implementations provide this mechanism defined by the <a href="https://wiki.commonjs.org/wiki/CommonJS">CommonJS</a> group. For browsers this is provided by <a href="https://browserify.org">Browserify</a>, for instance.</p>
<H3><a name="Javascript_class_example">28.4.2 Class</a></H3>

View file

@ -1,604 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>SWIG and Common Lisp</title>
<link rel="stylesheet" type="text/css" href="style.css">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="#ffffff">
<H1><a name="Lisp">29 SWIG and Common Lisp</a></H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
<li><a href="#Lisp_nn3">Common Foreign Function Interface(CFFI)</a>
<ul>
<li><a href="#Lisp_nn4">Additional Commandline Options </a>
<li><a href="#Lisp_nn5">Generating CFFI bindings</a>
<li><a href="#Lisp_nn6">Generating CFFI bindings for C++ code</a>
<li><a href="#Lisp_nn7">Inserting user code into generated files</a>
</ul>
<ul>
<li><a href="#Lisp_nn9">Additional Commandline Options </a>
</ul>
</ul>
</div>
<!-- INDEX -->
<p>
Common Lisp is a high-level, all-purpose, object-oriented,
dynamic, functional programming language with long history.
Common Lisp is used in many fields, ranging from web development to
finance, and also common in computer science education.
There are more than 9 different implementations of common lisp which
are available, all have different foreign function
interfaces. SWIG currently supports the
Common Foreign Function Interface(CFFI).
</p>
<H2><a name="Lisp_nn3">29.2 Common Foreign Function Interface(CFFI)</a></H2>
<p>
CFFI, the Common Foreign Function Interface, is a portable foreign
function interface for ANSI Common Lisp systems.
CFFI requires only a small set of
low-level functionality from the Lisp implementation, such as
calling a foreign function by name, allocating foreign memory,
and dereferencing pointers.
</p>
<p>
To run the cffi module of SWIG requires very little effort, you
just need to run:
</p>
<div class="code"><pre>
swig -cffi -module <i>module-name</i> <i>file-name</i>
</pre></div>
<p>
But a better was of using all the power of SWIG is to write SWIG
interface files. Below we will explain how to write interface
files and the various things which you can do with them.
</p>
<H3><a name="Lisp_nn4">29.2.1 Additional Commandline Options </a></H3>
<table summary="CFFI specific options">
<tr>
<th> CFFI specific options</th>
</tr>
<tr>
<td>-generate-typedef</td>
<td>If this option is given then defctype will be used to generate<br/>
shortcuts according to the typedefs in the input.
</td>
</tr>
<tr>
<td>-[no]cwrap</td>
<td>Turn on or turn off generation of an intermediate C file when<br/>
creating a C interface. By default this is only done for C++ code.
</td>
</tr>
<tr>
<td>-[no]swig-lisp</td>
<td>Turns on or off generation of code for helper lisp macro, functions,
etc. which SWIG uses while generating wrappers. These macros, functions
may still be used by generated wrapper code.
</td>
</tr>
</table>
<H3><a name="Lisp_nn5">29.2.2 Generating CFFI bindings</a></H3>
<p>
As we mentioned earlier the ideal way to use SWIG is to use interface
files. To illustrate the use of it, let's assume that we have a
file named <i>test.h</i> with the following C code:
</p>
<div class="code"><pre>
#define y 5
#define x (y &gt;&gt; 1)
typedef int days;
struct bar {
short p, q;
char a, b;
int *z[1000];
struct bar * n;
};
struct bar * my_struct;
struct foo {
int a;
struct foo * b[100];
};
int pointer_func(void (*ClosureFun)( void* _fun, void* _data, void* _evt ), int p);
int func123(div_t * p, int **q[100], int r[][1000][10]);
void lispsort_double (int n, double * array);
enum color { RED, BLUE, GREEN};
</pre></div>
<p>
Corresponding to this we will write a simple interface file:
</p>
<div class="code"><pre>
%module test
%include "test.h"
</pre></div>
<p>
The generated SWIG Code will be:
</p>
<div class="targetlang"><pre>
;;;SWIG wrapper code starts here
(cl:defmacro defanonenum (&amp;body enums)
"Converts anonymous enums to defconstants."
`(cl:progn , @(cl:loop for value in enums
for index = 0 then (cl:1+ index)
when (cl:listp value) do (cl:setf index (cl:second value)
value (cl:first value))
collect `(cl:defconstant , value , index))))
(cl:eval-when (:compile-toplevel :load-toplevel)
(cl:unless (cl:fboundp 'swig-lispify)
(cl:defun swig-lispify (name flag cl:&amp;optional (package cl:*package*))
(cl:labels ((helper (lst last rest cl:&amp;aux (c (cl:car lst)))
(cl:cond
((cl:null lst)
rest)
((cl:upper-case-p c)
(helper (cl:cdr lst) 'upper
(cl:case last
((lower digit) (cl:list* c #\- rest))
(cl:t (cl:cons c rest)))))
((cl:lower-case-p c)
(helper (cl:cdr lst) 'lower (cl:cons (cl:char-upcase c) rest)))
((cl:digit-char-p c)
(helper (cl:cdr lst) 'digit
(cl:case last
((upper lower) (cl:list* c #\- rest))
(cl:t (cl:cons c rest)))))
((cl:char-equal c #\_)
(helper (cl:cdr lst) '_ (cl:cons #\- rest)))
(cl:t
(cl:error "Invalid character: ~A" c)))))
(cl:let ((fix (cl:case flag
((constant enumvalue) "+")
(variable "*")
(cl:t ""))))
(cl:intern
(cl:concatenate
'cl:string
fix
(cl:nreverse (helper (cl:concatenate 'cl:list name) cl:nil cl:nil))
fix)
package))))))
;;;SWIG wrapper code ends here
(cl:defconstant y 5)
(cl:defconstant x (cl:ash 5 -1))
(cffi:defcstruct bar
(p :short)
(q :short)
(a :char)
(b :char)
(z :pointer)
(n :pointer))
(cffi:defcvar ("my_struct" my_struct)
:pointer)
(cffi:defcstruct foo
(a :int)
(b :pointer))
(cffi:defcfun ("pointer_func" pointer_func) :int
(ClosureFun :pointer)
(p :int))
(cffi:defcfun ("func123" func123) :int
(p :pointer)
(q :pointer)
(r :pointer))
(cffi:defcfun ("lispsort_double" lispsort_double) :void
(n :int)
(array :pointer))
(cffi:defcenum color
:RED
:BLUE
:GREEN)
</pre></div>
<p>
The <i>SWIG wrapper</i> code refers to the special code which SWIG
may need to use while wrapping C code. You can turn on/off the
generation of this code by using the <i>-[no]swig-lisp</i>
option. You must have noticed that SWIG goes one extra step to
ensure that CFFI does not do automatic lispification of the C
function names. The reason SWIG does this is because quite often
developers want to build a nice CLOS based lispy API, and this one
to one correspondence between C function names and lisp function
name helps.
</p>
<p> Maybe you want to have your own convention for generating lisp
function names for corresponding C function names, or you just
want to lispify the names, also, before we forget you want to
export the generated lisp names. To do this, we will use the
SWIG <a
href="Customization.html#Customization_features">feature directive</a>.
Let's edit the interface file such that the C type "div_t*" is changed
to Lisp type ":my-pointer", we lispify all names,
export everything, and do some more stuff.
</p>
<div class="code"><pre>
%module test
%typemap(cin) div_t* ":my-pointer"
%feature("intern_function", "1");
%feature("export");
%feature("inline") lispsort_double;
%feature("intern_function", "my-lispify") lispsort_double;
%feature("export", package="'some-other-package") lispsort_double;
%rename func123 renamed_cool_func;
%ignore "pointer_func";
%include "test.h"
</pre></div>
<p>
The <i>typemap(cin)</i> ensures that for all arguments which are input
to C with the type "div_t*", the ":my-pointer" type be
used. Similarly <i>typemap(cout)</i> are used for all types which
are returned from C.
</p>
<p>
The feature <i>intern_function</i> ensures that all C names are
interned using the <b>swig-lispify</b> function. The "1" given
to the feature is optional. The use of feature like
<i>%feature("intern_function", "1");</i> globally enables
interning for everything. If you want to target a single
function, or declaration then use the targeted version of
feature, <i>%feature("intern_function", "my-lispify")
lispsort_double;</i>, here we are using an additional feature
which allows us to use our lispify function.
</p>
<p>The <i>export</i> feature allows us to export the symbols. If
the <i>package</i> argument is given, then the symbol will be exported to
the specified Lisp package. The <i>inline</i> feature declaims the
declared function as inline. The <i>rename</i> directive allows us to
change the name(it is useful when generating C wrapper code for handling
overloaded functions). The <i>ignore</i> directive ignores a certain
declaration.
</p>
<p>There are several other things which are possible, to see some
example of usage of SWIG look at the Lispbuilder and wxCL
projects. The generated code with 'noswig-lisp' option is:
</p>
<div class="targetlang"><pre>
(cl:defconstant #.(swig-lispify "y" 'constant) 5)
(cl:export '#.(swig-lispify "y" 'constant))
(cl:defconstant #.(swig-lispify "x" 'constant) (cl:ash 5 -1))
(cl:export '#.(swig-lispify "x" 'constant))
(cffi:defcstruct #.(swig-lispify "bar" 'classname)
(#.(swig-lispify "p" 'slotname) :short)
(#.(swig-lispify "q" 'slotname) :short)
(#.(swig-lispify "a" 'slotname) :char)
(#.(swig-lispify "b" 'slotname) :char)
(#.(swig-lispify "z" 'slotname) :pointer)
(#.(swig-lispify "n" 'slotname) :pointer))
(cl:export '#.(swig-lispify "bar" 'classname))
(cl:export '#.(swig-lispify "p" 'slotname))
(cl:export '#.(swig-lispify "q" 'slotname))
(cl:export '#.(swig-lispify "a" 'slotname))
(cl:export '#.(swig-lispify "b" 'slotname))
(cl:export '#.(swig-lispify "z" 'slotname))
(cl:export '#.(swig-lispify "n" 'slotname))
(cffi:defcvar ("my_struct" #.(swig-lispify "my_struct" 'variable))
:pointer)
(cl:export '#.(swig-lispify "my_struct" 'variable))
(cffi:defcstruct #.(swig-lispify "foo" 'classname)
(#.(swig-lispify "a" 'slotname) :int)
(#.(swig-lispify "b" 'slotname) :pointer))
(cl:export '#.(swig-lispify "foo" 'classname))
(cl:export '#.(swig-lispify "a" 'slotname))
(cl:export '#.(swig-lispify "b" 'slotname))
(cffi:defcfun ("renamed_cool_func" #.(swig-lispify "renamed_cool_func" 'function)) :int
(p :my-pointer)
(q :pointer)
(r :pointer))
(cl:export '#.(swig-lispify "renamed_cool_func" 'function))
(cl:declaim (cl:inline #.(my-lispify "lispsort_double" 'function)))
(cffi:defcfun ("lispsort_double" #.(my-lispify "lispsort_double" 'function)) :void
(n :int)
(array :pointer))
(cl:export '#.(my-lispify "lispsort_double" 'function) 'some-other-package)
(cffi:defcenum #.(swig-lispify "color" 'enumname)
#.(swig-lispify "RED" 'enumvalue :keyword)
#.(swig-lispify "BLUE" 'enumvalue :keyword)
#.(swig-lispify "GREEN" 'enumvalue :keyword))
(cl:export '#.(swig-lispify "color" 'enumname))
</pre></div>
<H3><a name="Lisp_nn6">29.2.3 Generating CFFI bindings for C++ code</a></H3>
<p>This feature to SWIG (for CFFI) is very new and still far from
complete. Pitch in with your patches, bug reports and feature
requests to improve it.
</p>
<p> Generating bindings for C++ code, requires <i>-c++</i> option to be
present and it first generates C binding which will wrap the C++
code, and then generates the
corresponding CFFI wrapper code. In the generated C wrapper
code, you will often want to put your own C code, such as the
code to include various files. This can be done by making use of
"%{" and "%}" as shown below.
</p>
<div class="code"><pre>
%{
#include "Test/test.h"
%}
</pre></div>
<p>
Also, while parsing the C++ file and generating C wrapper code SWIG
may need to be able to understand various symbols used in other
header files. To help SWIG in doing this while ensuring that
wrapper code is generated for the target file, use the "import"
directive. The "include" directive specifies the target file for
which wrapper code will be generated.
</p>
<div class="code"><pre>
%import "ancillary/header.h"
%include "target/header.h"
</pre></div>
<p>
Various features which were available for C headers can also be used
here. The target header which we are going to use here is:
</p>
<div class="code"><pre>
namespace OpenDemo {
class Test
{
public:
float x;
// constructors
Test (void) {x = 0;}
Test (float X) {x = X;}
// vector addition
Test operator+ (const Test&amp; v) const {return Test (x+v.x);}
// length squared
float lengthSquared (void) const {return this-&gt;dot (*this);}
static float distance (const Test&amp; a, const Test&amp; b){return(a-b).length();}
inline Test parallelComponent (const Test&amp; unitBasis) const {
return unitBasis * projection;
}
Test setYtoZero (void) const {return Test (this-&gt;x);}
static const Test zero;
};
inline Test operator* (float s, const Test&amp; v) {return v*s;}
inline std::ostream&amp; operator&lt;&lt; (std::ostream&amp; o, const Test&amp; v)
{
return o &lt;&lt; "(" &lt;&lt; v.x &lt;&lt; ")";
}
inline Test RandomUnitVectorOnXZPlane (void)
{
return RandomVectorInUnitRadiusSphere().setYtoZero().normalize();
}
}
</pre></div>
<p>The interface used is: </p>
<div class="code"><pre>
%module test
%include "test.cpp"
</pre></div>
<p>
SWIG generates 3 files, the first one is a C wrap which we don't show,
the second is the plain CFFI wrapper which is as shown below:
</p>
<div class="targetlang"><pre>
(cffi:defcfun ("_wrap_Test_x_set" Test_x_set) :void
(self :pointer)
(x :float))
(cffi:defcfun ("_wrap_Test_x_get" Test_x_get) :float
(self :pointer))
(cffi:defcfun ("_wrap_new_Test__SWIG_0" new_Test) :pointer)
(cffi:defcfun ("_wrap_new_Test__SWIG_1" new_Test) :pointer
(X :float))
(cffi:defcfun ("_wrap_Test___add__" Test___add__) :pointer
(self :pointer)
(v :pointer))
(cffi:defcfun ("_wrap_Test_lengthSquared" Test_lengthSquared) :float
(self :pointer))
(cffi:defcfun ("_wrap_Test_distance" Test_distance) :float
(a :pointer)
(b :pointer))
(cffi:defcfun ("_wrap_Test_parallelComponent" Test_parallelComponent) :pointer
(self :pointer)
(unitBasis :pointer))
(cffi:defcfun ("_wrap_Test_setYtoZero" Test_setYtoZero) :pointer
(self :pointer))
(cffi:defcvar ("Test_zero" Test_zero)
:pointer)
(cffi:defcfun ("_wrap_delete_Test" delete_Test) :void
(self :pointer))
(cffi:defcfun ("_wrap___mul__" __mul__) :pointer
(s :float)
(v :pointer))
(cffi:defcfun ("_wrap___lshift__" __lshift__) :pointer
(o :pointer)
(v :pointer))
(cffi:defcfun ("_wrap_RandomUnitVectorOnXZPlane" RandomUnitVectorOnXZPlane) :pointer)
</pre></div>
<p>
The output is pretty good but it fails in disambiguating overloaded
functions such as the constructor, in this case. One way of
resolving this problem is to make the interface use the rename
directiv, but hopefully there are better solutions.
In addition SWIG also generates, a CLOS file
</p>
<div class="targetlang"><pre>
(clos:defclass test()
((ff :reader ff-pointer)))
(clos:defmethod (cl:setf x) (arg0 (obj test))
(Test_x_set (ff-pointer obj) arg0))
(clos:defmethod x ((obj test))
(Test_x_get (ff-pointer obj)))
(cl:shadow "+")
(clos:defmethod + ((obj test) (self test) (v test))
(Test___add__ (ff-pointer obj) (ff-pointer self) (ff-pointer v)))
(clos:defmethod length-squared ((obj test) (self test))
(Test_lengthSquared (ff-pointer obj) (ff-pointer self)))
(clos:defmethod parallel-component ((obj test) (self test) (unitBasis test))
(Test_parallelComponent (ff-pointer obj) (ff-pointer self) (ff-pointer unitBasis)))
(clos:defmethod set-yto-zero ((obj test) (self test))
(Test_setYtoZero (ff-pointer obj) (ff-pointer self)))
</pre></div>
<p>I agree that the CFFI C++ module needs lot more work. But I hope it
provides a starting point, on which you can base your work of
importing C++ libraries to Lisp.
</p>
<p>
If you have any questions, suggestions, patches, etc., related to CFFI
module feel free to contact us on the SWIG mailing list, and
also please add a "[CFFI]" tag in the subject line.
<H3><a name="Lisp_nn7">29.2.4 Inserting user code into generated files</a></H3>
<p>
It is often necessary to <a href="SWIG.html#SWIG_nn40">include user-defined code</a>
into the automatically generated interface files. For example, when building
a C++ interface, example_wrap.cxx will likely not compile unless
you add a <tt>#include "header.h"</tt> directive. This can be done
using the SWIG <tt>%insert(section) %{ ...code... %}</tt> directive:
</p>
<div class="code">
<pre>
%module example
%{
#include "header.h"
%}
%include "header.h"
int fact(int n);
</pre>
</div>
<p>
Additional sections have been added for inserting into the
generated lisp interface file:
</p>
<ul>
<li><tt>lisphead</tt> - inserts before type declarations</li>
<li><tt>swiglisp</tt> - inserts after type declarations according to
where it appears in the .i file</li>
</ul>
<p>
Note that the block <tt>%{ ... %}</tt> is effectively a shortcut for
<tt>%insert("header") %{ ... %}</tt>.
</p>
</body>
</html>

View file

@ -77,7 +77,7 @@
<p>
Lua is an extension programming language designed to support general procedural programming with data description facilities. It also offers good support for object-oriented programming, functional programming, and data-driven programming. Lua is intended to be used as a powerful, light-weight configuration language for any program that needs one. Lua is implemented as a library, written in clean C (that is, in the common subset of ISO C and C++). It's also a <em>really</em> tiny language, less than 6000 lines of code, which compiles to &lt;100 kilobytes of binary code. It can be found at <a href="http://www.lua.org">http://www.lua.org</a>
Lua is an extension programming language designed to support general procedural programming with data description facilities. It also offers good support for object-oriented programming, functional programming, and data-driven programming. Lua is intended to be used as a powerful, light-weight configuration language for any program that needs one. Lua is implemented as a library, written in clean C (that is, in the common subset of ISO C and C++). It's also a <em>really</em> tiny language, less than 6000 lines of code, which compiles to &lt;100 kilobytes of binary code. It can be found at <a href="https://www.lua.org">https://www.lua.org</a>
</p>
<p>
eLua stands for Embedded Lua (can be thought of as a flavor of Lua) and offers the full implementation of the Lua programming language to the embedded world, extending it with specific features for efficient and portable software embedded development. eLua runs on smaller devices like microcontrollers and provides the full features of the regular Lua desktop version. More information on eLua can be found here: <a href="http://www.eluaproject.net">http://www.eluaproject.net</a>
@ -566,7 +566,7 @@ If the <tt>-no-old-metatable-bindings</tt> option is used, then these old-style
</p>
<p>
It is worth mentioning, that <tt>example.Test.TEST1</tt> and <tt>example.Test_TEST1</tt> are different entities and changing one does not change the other.
Given the fact that these are constantes and they are not supposed to be changed, it is up to you to avoid such issues.
Given the fact that these are constants and they are not supposed to be changed, it is up to you to avoid such issues.
</p>
<H3><a name="Lua_nn12">29.3.5 Pointers</a></H3>

View file

@ -1,7 +1,7 @@
# Makefile for generating the SWIG documentation
#
# Note that the htmldoc package needs to be installed. wkhtmltopdf patched with qt is also required
# and can be installed from http://wkhtmltopdf.org/downloads.html.
# and the prebuilt binaries can be installed from https://wkhtmltopdf.org/downloads.html.
#
# The .html files are first processed and updated with chapter numbering and anchor names
# are added to the HTML headings using the python scripts. The htmldoc program is then
@ -43,8 +43,8 @@ check:
# 3) <pre> <tt> <code> elements do not always select a fixed-width font - try installing the
# Courier font to fix - these have been added to style.css.
generate: SWIGDocumentation.html
wkhtmltopdf --version | grep "with patched qt" || (echo "wkhtmltopdf is not the patched qt version and so cannot be used - download it from http://wkhtmltopdf.org/downloads.html" && false)
wkhtmltopdf --margin-top 20mm --margin-bottom 20mm --margin-left 10mm --margin-right 10mm --header-font-size 6 --footer-font-size 6 --header-spacing 6 --footer-spacing 6 --header-center '[doctitle]' --footer-left '[subsection]' --footer-right '[page]' SWIGDocumentation.html SWIGDocumentation.pdf
wkhtmltopdf --version | grep "with patched qt" || (echo "wkhtmltopdf is not the patched qt version and so cannot be used - download it from https://wkhtmltopdf.org/downloads.html" && false)
wkhtmltopdf --margin-top 20mm --margin-bottom 20mm --margin-left 10mm --margin-right 10mm --header-font-size 6 --footer-font-size 6 --header-spacing 6 --footer-spacing 6 --header-center '[doctitle]' --footer-left '[subsection]' --footer-right '[page]' --allow . SWIGDocumentation.html SWIGDocumentation.pdf
SWIGDocumentation.html: swightml.book
htmldoc --batch swightml.book || true

View file

@ -85,7 +85,7 @@ variants, functions, classes, etc.
<p>
If you're not familiar with the Objective Caml language, you can visit
<a href="http://ocaml.org/">The Ocaml Website</a>.
<a href="https://ocaml.org/">The Ocaml Website</a>.
</p>
<H2><a name="Ocaml_nn2">39.1 Preliminaries</a></H2>

View file

@ -52,7 +52,7 @@
<p>
Octave is a high-level language intended for numerical programming that is mostly compatible with MATLAB.
More information can be found at <a href="http://www.gnu.org/software/octave/">Octave web site</a>.
More information can be found at <a href="https://www.gnu.org/software/octave/">Octave web site</a>.
</p>
<p>
@ -625,6 +625,16 @@ On the C++ side, the default mappings are as follows:
Octave can also utilise friend (i.e. non-member) operators with a simple %rename: see the example in the Examples/octave/operator directory.
</p>
<p>
Octave has several operators for which no corresponding C++ operators exist. For example, the Octave code
</p>
<div class="targetlang"><pre>
x=[a,b,c];
</pre></div>
<p>
calls the Octave operator <tt>horzcat</tt> of the class of <tt>a</tt>. Hence, if <tt>a</tt> is of type <tt>swig_ref</tt> you can write an overload for this operator for your wrapped C++ class by placing a file <tt>@swig_ref/horzcat.m</tt> in the Octave load path (like for every Octave class, see <a href="https://docs.octave.org/latest/Creating-a-Class.html">Creating a Class</a>). This Octave function file is then called whenever the above Octave code is executed for a variable of type <tt>swig_ref</tt>.
</p>
<H3><a name="Octave_nn19">30.3.10 Class extension with %extend</a></H3>

View file

@ -604,7 +604,7 @@ source has a list of macros that are known to conflict with either standard head
other headers. But if you get macro type conflicts from other macros not included
in Lib/perl5/noembed.h while compiling the wrapper, you will
have to find the macro that conflicts and add an #undef into the .i file. Please report
any conflicting macros you find to <a href="http://www.swig.org/mail.html">swig-user mailing list</a>.
any conflicting macros you find to <a href="https://www.swig.org/mail.html">swig-user mailing list</a>.
</p>
<H3><a name="Perl5_nn10">31.2.7 Compiling for 64-bit platforms</a></H3>

View file

@ -30,6 +30,7 @@
<li><a href="#Php_nn2_6_3">Static Member Variables</a>
<li><a href="#Php_nn2_6_4">Static Member Functions</a>
<li><a href="#Php_nn2_6_5">Specifying Implemented Interfaces</a>
<li><a href="#Php_nn2_6_6">Dynamic Properties</a>
</ul>
<li><a href="#Php_nn2_7">PHP Pragmas, Startup and Shutdown code</a>
</ul>
@ -634,18 +635,12 @@ variable, or assigning <tt>NULL</tt> to a variable.
<p>
SWIG defaults to wrapping C++ structs and classes with PHP classes.
SWIG wraps C++ structs and classes with PHP classes.
Since SWIG 4.1.0, this is done entirely via PHP's C API - earlier SWIG
versions generated a PHP wrapper script which defined proxy classes
which called a set of flat functions which actually wrapped the C++ class.
</p>
<p>
If you don't want the class wrappers, you can pass the command-line option
"-noproxy" in which case you'll get C++ classes wrapped as flat functions
as described below.
</p>
<p>
This interface file
</p>
@ -698,33 +693,16 @@ Member variables and methods are accessed using the <tt>-&gt;</tt> operator.
<p>
The <tt>-noproxy</tt> option flattens the object structure and
generates collections of named functions. The above example results
in the following PHP functions:
SWIG/PHP used to support a <tt>-noproxy</tt> option to flatten the class
structure and generate collections of named flat functions. This is no
longer supported as of SWIG 4.1.0.
</p>
<div class="code"><pre>
new_Vector();
Vector_x_set($obj, $d);
Vector_x_get($obj);
Vector_y_set($obj, $d);
Vector_y_get($obj);
Vector_z_set($obj, $d);
Vector_z_get($obj);
Vector_magnitude($obj);
new_Complex();
Complex_re_set($obj, $d);
Complex_re_get($obj);
Complex_im_set($obj, $d);
Complex_im_get($obj);
</pre></div>
<H4><a name="Php_nn2_6_2">32.2.6.2 Constructors and Destructors</a></H4>
<p>
The constructor is called when <tt>new Object()</tt> (or
<tt>new_Object()</tt> if using <tt>-noproxy</tt>) is used to create an
The constructor is called when <tt>new Object()</tt> is used to create an
instance of the object. If multiple constructors are defined for an
object, function overloading will be used to determine which
constructor to execute.
@ -843,6 +821,53 @@ so:
If there are multiple interfaces, just list them separated by commas.
</p>
<H4><a name="Php_nn2_6_6">32.2.6.6 Dynamic Properties</a></H4>
<p>
Historically PHP has supported dynamic class properties and SWIG
has implemented them too (because we implement the magic <tt>__get()</tt>,
<tt>__set()</tt> and <tt>__isset()</tt> methods we need to include explicit
handling).
</p>
<p>
PHP 8.2 <a
href="https://wiki.php.net/rfc/deprecate_dynamic_properties">deprecates
dynamic class properties</a> - initially they'll warn, and apparently they'll
not work by default in PHP 9.0.
</p>
<p>
In PHP code dynamic properties can be enabled for a class by
marking that class with the attribute <tt>#[AllowDynamicProperties]</tt>.
</p>
<p>
To follow this PHP change, as of SWIG 4.1.0 you now need enable dynamic
properties for any classes you want to support them. To enable for class
<tt>Foo</tt>:
</p>
<div class="code"><pre>
%feature("php:allowdynamicproperties", 1) Foo;
</pre></div>
<p>
or to enable them for all wrapped classes:
</p>
<div class="code"><pre>
%feature("php:allowdynamicproperties", 1);
</pre></div>
<p>
Note that unknown features are ignored, so you can add use these
unconditionally in your interface file and it'll work with older SWIG too.
</p>
<H3><a name="Php_nn2_7">32.2.7 PHP Pragmas, Startup and Shutdown code</a></H3>

View file

@ -80,7 +80,7 @@ Some target languages were disabled as part of a clean up and others were given
<p>
The LICENSE file shipped with SWIG in the top level directory contains the SWIG license.
For further insight into the license including the license of SWIG's output code, please visit
the SWIG legal page - <a href="http://www.swig.org/legal.html">http://www.swig.org/legal.html</a>.
the SWIG legal page - <a href="https://www.swig.org/legal.html">https://www.swig.org/legal.html</a>.
</p>
<p>
@ -98,7 +98,7 @@ The official location of SWIG related material is
</p>
<div class="shell"><pre>
<a href="http://www.swig.org">http://www.swig.org</a>
<a href="https://www.swig.org">https://www.swig.org</a>
</pre></div>
<p>
@ -111,7 +111,7 @@ You can also subscribe to the swig-user mailing list by visiting the page
</p>
<div class="shell"><pre>
<a href="http://www.swig.org/mail.html">http://www.swig.org/mail.html</a>
<a href="https://www.swig.org/mail.html">https://www.swig.org/mail.html</a>
</pre></div>
<p>
@ -125,7 +125,7 @@ about this can be obtained at:
</p>
<div class="shell"><pre>
<a href="http://www.swig.org/svn.html">SWIG Bleeding Edge</a>
<a href="https://www.swig.org/svn.html">SWIG Bleeding Edge</a>
</pre></div>
@ -231,7 +231,7 @@ detailed release notes for previous releases and summary release notes from SWIG
SWIG is an unfunded project that would not be possible without the
contributions of many people working in their spare time.
If you have benefitted from using SWIG, please consider
<a href="http://www.swig.org/donate.html">Donating to SWIG</a> to keep development going.
<a href="https://www.swig.org/donate.html">Donating to SWIG</a> to keep development going.
There have been a large varied number of people
who have made contributions at all levels over time. Contributors
are mentioned either in the COPYRIGHT file or CHANGES files shipped with SWIG or in submitted bugs.
@ -244,8 +244,8 @@ are mentioned either in the COPYRIGHT file or CHANGES files shipped with SWIG or
Although every attempt has been made to make SWIG bug-free, we are also trying
to make feature improvements that may introduce bugs.
To report a bug, either send mail to the SWIG developer
list at the <a href="http://www.swig.org/mail.html">swig-devel mailing list</a> or report a bug
at the <a href="http://www.swig.org/bugs.html">SWIG bug tracker</a>. In your report, be as specific as
list at the <a href="https://www.swig.org/mail.html">swig-devel mailing list</a> or report a bug
at the <a href="https://www.swig.org/bugs.html">SWIG bug tracker</a>. In your report, be as specific as
possible, including (if applicable), error messages, tracebacks (if a
core dump occurred), corresponding portions of the SWIG interface file
used, and any important pieces of the SWIG generated wrapper code. We
@ -273,15 +273,15 @@ the main SWIG distribution. There is no need to download anything else.
These installation instructions are for using the distributed tarball,
for example, <tt>swig-3.0.8.tar.gz</tt>.
If you wish to build and install from source on Github, extra steps are required.
Please see the <a href="http://swig.org/svn.html">Bleeding Edge</a> page on the SWIG website.
Please see the <a href="https://swig.org/svn.html">Bleeding Edge</a> page on the SWIG website.
</p>
<p>
You must use <a href="http://www.gnu.org/software/make/">GNU make</a> to build and install SWIG.
You must use <a href="https://www.gnu.org/software/make/">GNU make</a> to build and install SWIG.
</p>
<p>
<a href="http://www.pcre.org/">PCRE2</a>
<a href="https://www.pcre.org/">PCRE2</a>
needs to be installed on your system to build SWIG, in particular
pcre2-config must be available. If you have PCRE2 headers and libraries but not
pcre2-config itself or, alternatively, wish to override the compiler or linker
@ -357,7 +357,7 @@ Note:
If you checked the code out via Git, you will have to run <tt>./autogen.sh</tt>
before <tt>./configure</tt>. In addition, a full build of SWIG requires
a number of packages to be installed. Full instructions at
<a href="http://www.swig.org/svn.html">SWIG bleeding edge</a>.
<a href="https://www.swig.org/svn.html">SWIG bleeding edge</a>.
</li>
</ul>

View file

@ -147,6 +147,14 @@ SWIGTCL Defined when using Tcl
SWIGXML Defined when using XML
</pre></div>
<p>
SWIG also defines <tt>SWIG_VERSION</tt> and a target language macro in
the generated wrapper file (since SWIG 4.1.0 - in older versions these
were defined for some target languages but this wasn't consistent). Best
practice is to use SWIG-time conditional checks because that results in smaller
generated wrapper sources.
</p>
<p>
In addition, SWIG defines the following set of standard C/C++ macros:
</p>

View file

@ -3128,9 +3128,7 @@ likely cause your program to segfault.
<p>
To help ensure that no references to the Python object remain after
calling <tt>__disown__()</tt>, this method returns a weak reference to
the Python object. Weak references are only available in Python versions
2.1 and higher, so for older versions you must explicitly delete all
references. Here is an example:
the Python object. Here is an example:
</p>
<div class="code">
@ -3504,7 +3502,7 @@ The insert code can be seen at the start of the generated <tt>.py</tt> file:
<div class="code">
<pre>
# This file was automatically generated by SWIG (http://www.swig.org).
# This file was automatically generated by SWIG (https://www.swig.org).
# Version 4.0.0
#
# Do not make changes to this file unless you know what you are doing--modify
@ -5377,10 +5375,9 @@ int SWIG_ConvertPtr(PyObject *obj, void **ptr, swig_type_info *ty, int flags)</t
Converts a Python object <tt>obj</tt> to a C pointer. The result of the conversion is placed
into the pointer located at <tt>ptr</tt>. <tt>ty</tt> is a SWIG type descriptor structure.
<tt>flags</tt> is used to handle error checking and other aspects of conversion. It is the
bitwise-or of several flag values including <tt>SWIG_POINTER_EXCEPTION</tt> and
<tt>SWIG_POINTER_DISOWN</tt>. The first flag makes the function raise an exception on type
error. The second flag additionally
steals ownership of an object. Returns 0 on success and -1 on error.
bitwise-or of several flag values including <tt>SWIG_POINTER_DISOWN</tt> (which steals
ownership of the object) and <tt>SWIG_POINTER_NO_NULL</tt> (which makes the conversion fail
if the C pointer would be <tt>NULL</tt>). Returns 0 on success and -1 on error.
</div>
<p>

View file

@ -30,7 +30,7 @@
<p>
R is a GPL'ed open source statistical and plotting environment.
Information about R can be found at <a
href="http://www.r-project.org/">www.r-project.org</a>.
href="https://www.r-project.org/">www.r-project.org</a>.
</p>
<p>
@ -39,7 +39,7 @@ compile and run an R interface to QuantLib running on Mandriva Linux
with gcc. They are also used to create the SimpleITK R package, which
runs on Linux and MacOS. SWIG is used to create all wrapper
interfaces
to <a href="http://http://www.simpleitk.org/">SimpleITK</a>. The R
to <a href="https://www.simpleitk.org/">SimpleITK</a>. The R
bindings also work on Microsoft Windows using Visual C++.
</p>
@ -321,7 +321,7 @@ and forth between integers.
<p>
The details of enumeration names and contents are stored in hidden R
environments, which are named according the the enumeration name - for
environments, which are named according to the enumeration name - for
example, an enumeration colour:
</p>

View file

@ -134,11 +134,11 @@ Supported Target Language Options
-ruby - Generate Ruby wrappers
-scilab - Generate Scilab wrappers
-tcl8 - Generate Tcl 8 wrappers
-xml - Generate XML wrappers
Experimental Target Language Options
-mzscheme - Generate MzScheme/Racket wrappers
-ocaml - Generate OCaml wrappers
-xml - Generate XML wrappers
General Options
-addextern - Add extra extern declarations
@ -219,7 +219,7 @@ General Options
-Wall - Remove all warning suppression, also implies -Wextra
-Wallkw - Enable keyword warnings for all the supported languages
-Werror - Treat warnings as errors
-Wextra - Adds the following additional warnings: 202,309,403,405,512,321,322
-Wextra - Adds the following additional warnings: 309,403,405,512,321,322
-w&lt;list&gt; - Suppress/add warning messages, eg -w401,+321 - see Warnings.html
-xmlout &lt;file&gt; - Write XML version of the parse tree to &lt;file&gt; after normal processing
</pre></div>
@ -2046,7 +2046,7 @@ and a more descriptive one, but the two functions are otherwise equivalent:
<td>String after (Perl-like) regex substitution operation. This function
allows applying arbitrary regular expressions to the identifier names. The
<i>pattern</i> part is a regular expression in Perl syntax (as supported
by the <a href="http://www.pcre.org/">Perl Compatible Regular Expressions</a>)
by the <a href="https://www.pcre.org/">Perl Compatible Regular Expressions</a>)
(PCRE2 library) and the <i>subst</i> string
can contain back-references of the form <tt>\N</tt> where <tt>N</tt> is a digit
from 0 to 9, or one of the following escape sequences: <tt>\l</tt>, <tt>\L</tt>,
@ -3664,8 +3664,8 @@ In the process of building an interface, SWIG may encounter syntax errors or
other problems. The best way to deal with this is to simply copy the offending
code into a separate interface file and edit it. However, the SWIG developers
have worked very hard to improve the SWIG parser--you should report parsing errors
to the <a href="http://www.swig.org/mail.html">swig-devel mailing list</a> or to the
<a href="http://www.swig.org/bugs.html">SWIG bug tracker</a>.
to the <a href="https://www.swig.org/mail.html">swig-devel mailing list</a> or to the
<a href="https://www.swig.org/bugs.html">SWIG bug tracker</a>.
</p>
<H3><a name="SWIG_nn47">5.7.2 The SWIG interface file</a></H3>

View file

@ -57,6 +57,7 @@
<li><a href="#SWIGPlus_template_functions">Function templates</a>
<li><a href="#SWIGPlus_template_classes">Default template arguments</a>
<li><a href="#SWIGPlus_template_class_inheritance">Template base classes</a>
<li><a href="#SWIGPlus_template_empty">Empty template instantiation</a>
<li><a href="#SWIGPlus_template_specialization">Template specialization</a>
<li><a href="#SWIGPlus_template_member">Member templates</a>
<li><a href="#SWIGPlus_template_scoping">Scoping and templates</a>
@ -254,7 +255,7 @@ details. The SWIG Wiki also has further details.
</p>
<b>Compatibility Note:</b> Early versions of SWIG generated just a flattened low-level C style API to C++ classes by default.
The <tt>-noproxy</tt> commandline option is recognised by many target languages and will generate just this
The <tt>-noproxy</tt> commandline option is recognised by some target languages and will generate just this
interface as in earlier versions.
<H2><a name="SWIGPlus_nn38">6.5 Proxy classes</a></H2>
@ -2147,7 +2148,7 @@ This error means that the target language module supports overloading,
but for some reason there is no type-checking rule that can be used to
generate a working dispatch function. The resulting behavior is then
undefined. You should report this as a bug to the
<a href="http://www.swig.org/bugs.html">SWIG bug tracking database</a>
<a href="https://www.swig.org/bugs.html">SWIG bug tracking database</a>
if this is due to one of the typemaps supplied with SWIG.
</p>
@ -2324,7 +2325,7 @@ members (of all classes):
Note: the <tt>*::</tt> syntax is non-standard C++, but the '*' is meant to be a
wildcard that matches any class name (we couldn't think of a better
alternative so if you have a better idea, send email to
the <a href="http://www.swig.org/mail.html">swig-devel mailing list</a>.
the <a href="https://www.swig.org/mail.html">swig-devel mailing list</a>.
</p>
<p>
@ -3261,10 +3262,28 @@ void foo(List&lt;Integer&gt; *x);
In this case, <tt>List&lt;Integer&gt;</tt> is exactly the same type as
<tt>List&lt;int&gt;</tt>. Any use of <tt>List&lt;Integer&gt;</tt> is mapped back to the
instantiation of <tt>List&lt;int&gt;</tt> created earlier. Therefore, it is
not necessary to instantiate a new class for the type <tt>Integer</tt> (doing so is
redundant and will simply result in code bloat).
not correct to instantiate a new class for the type <tt>Integer</tt>.
An attempt to do so such as:
</p>
<div class="code">
<pre>
%template(intList) List&lt;int&gt;;
%template(IntegerList) List&lt;Integer&gt;; // Ignored
</pre>
</div>
<p>
will result in the duplicate instantiation being ignored with a warning:
</p>
<div class="shell">
<pre>
example.i:48: Warning 404: Duplicate template instantiation of 'List&lt; Integer &gt;' with name 'IntegerList' ignored,
example.i:47: Warning 404: previous instantiation of 'List&lt; int &gt;' with name 'intList'.
</pre>
</div>
<p>
The template provided to <tt>%template</tt> for instantiation must be the actual template and not a typedef to a template.
</p>
@ -3333,36 +3352,49 @@ original template definition. Template default arguments are supported. For ex
<div class="code">
<pre>
template vector&lt;typename T, int max=100&gt; class vector {
template &lt;typename T, int max=100&gt; class vector {
...
};
%template(intvec) vector&lt;int&gt;; // OK
%template(intvec) vector&lt;int&gt;; // OK
%template(vec1000) vector&lt;int, 1000&gt;; // OK
</pre>
</div>
<p>
The <tt>%template</tt> directive should not be used to wrap the same
template instantiation more than once in the same scope. This will
generate an error. For example:
template instantiation more than once. This also applies to default parameters
where a template parameter specified in the instantiation is the same as the default parameter.
For example:
</p>
<div class="code">
<pre>
%template(intList) List&lt;int&gt;;
%template(Listint) List&lt;int&gt;; // Error. Template already wrapped.
%template(vec) vector&lt;double&gt;; // OK
%template(vec100) vector&lt;double, 100&gt;; // Ignored
</pre>
</div>
<p>
This error is caused because the template expansion results in two
identical classes with the same name. This generates a symbol table
conflict. Besides, it probably more efficient to only wrap a specific
instantiation only once in order to reduce the potential for code
bloat.
will warn:
</p>
<div class="shell">
<pre>
example.i:59: Warning 404: Duplicate template instantiation of 'vector&lt; double,100 &gt;' with name 'vec100' ignored,
example.i:58: Warning 404: previous instantiation of 'vector&lt; double &gt;' with name 'vec'.
</pre>
</div>
<p>
If this was not ignored, the template expansion would result in two identical classes.
An identical instantiation is only wrapped once in order to reduce code bloat.
</p>
<p>
<b>Compatibility Note</b>: Versions prior to SWIG-4.2.0 would sometimes not detect and prevent duplicate
instantiations, such as when the wrapped name was different.
</p>
<H3><a name="SWIGPlus_template_class_inheritance">6.18.4 Template base classes</a></H3>
@ -3429,20 +3461,6 @@ code (and base classes need to be wrapped before derived classes).
Don't worry--if you get the order wrong, SWIG should generate a warning message.
</p>
<p>
Occasionally, you may need to tell SWIG about base classes that are defined by templates,
but which aren't supposed to be wrapped. Since SWIG is not able to automatically
instantiate templates for this purpose, you must do it manually. To do this, simply
use the empty template instantiation, that is, <tt>%template</tt> with no name. For example:
</p>
<div class="code">
<pre>
// Instantiate traits&lt;double, double&gt;, but don't wrap it.
%template() traits&lt;double, double&gt;;
</pre>
</div>
<p>
If you have to instantiate a lot of different classes for many different types,
you might consider writing a SWIG macro. For example:
@ -3468,7 +3486,66 @@ TEMPLATE_WRAP(PairStringInt, std::pair&lt;string, int&gt;)
Note the use of a vararg macro for the type T. If this wasn't used, the comma in the templated type in the last example would not be possible.
</p>
<H3><a name="SWIGPlus_template_specialization">6.18.5 Template specialization</a></H3>
<H3><a name="SWIGPlus_template_empty">6.18.5 Empty template instantiation</a></H3>
<p>
Occasionally, you may need to tell SWIG about classes that are defined by templates,
but which aren't supposed to be wrapped. Since SWIG is not able to automatically
instantiate templates for this purpose, you must do it manually. To do this, simply
use <tt>%template()</tt>, that is the empty template instantiation that omits providing a name. For example:
</p>
<div class="code">
<pre>
template&lt;typename T&gt; struct Traits {
typedef T type;
};
%}
%template() Traits&lt;int&gt;; // instantiate Traits&lt;int&gt;, but don't wrap it
void traitor(Traits&lt;int&gt;::type val);
</pre>
</div>
<p>
Without a template instantiation, SWIG does not know that the first parameter to the <tt>traitor</tt>
function is type int and passing an integer to this function from any target language won't work.
The empty template instantiation adds the appropriate type information into SWIG's type system, without
forcing one to wrap the <tt>Traits</tt> class.
</p>
<p>
Duplicate template instantiation are not allowed, as described in the
<a href="#SWIGPlus_template_classes">Default template arguments</a> section above.
There is one exception where a named template instantiation can be followed by an empty template instantiation.
Duplicate empty template instantiations are silently ignored, unlike duplicate named template instantiations.
</p>
<p>
Unlike template class instantiations, template function instantiations must have a name.
Consider the following:
</p>
<div class="code">
<pre>
template&lt;class T&gt; T tfunc(T x) { };
%template() tfunc&lt;double&gt;;
</pre>
</div>
<p>
The empty template instantiation will be ignored with:
</p>
<div class="shell">
<pre>
example.i:9: Warning 519: %template() contains no name. Template method ignored: tfunc&lt; double &gt;(double)
</pre>
</div>
<H3><a name="SWIGPlus_template_specialization">6.18.6 Template specialization</a></H3>
<p>
@ -3558,7 +3635,7 @@ SWIG implements template argument deduction so that the following partial specia
</pre>
</div>
<H3><a name="SWIGPlus_template_member">6.18.6 Member templates</a></H3>
<H3><a name="SWIGPlus_template_member">6.18.7 Member templates</a></H3>
<p>
@ -3770,7 +3847,7 @@ constructor, that will dispatch the proper call depending on the argument
type.
</p>
<H3><a name="SWIGPlus_template_scoping">6.18.7 Scoping and templates</a></H3>
<H3><a name="SWIGPlus_template_scoping">6.18.8 Scoping and templates</a></H3>
<p>
@ -3871,7 +3948,7 @@ template class C&lt;int&gt;;
</p>
<H3><a name="SWIGPlus_template_more">6.18.8 More on templates</a></H3>
<H3><a name="SWIGPlus_template_more">6.18.9 More on templates</a></H3>
<p>

View file

@ -80,7 +80,7 @@
<p>
Scilab is a scientific software package for numerical computations providing a powerful open computing environment for engineering and scientific applications that is mostly compatible with MATLAB. More information can be found at <a href="http://www.scilab.org">www.scilab.org</a>.
Scilab is a scientific software package for numerical computations providing a powerful open computing environment for engineering and scientific applications that is mostly compatible with MATLAB. More information can be found at <a href="https://www.scilab.org">www.scilab.org</a>.
</p>
<p>
@ -2142,7 +2142,7 @@ clear get_file_path;
<ul>
<li>Example use cases can be found in the <tt>Examples/scilab</tt> directory.</li>
<li>The test suite in the <tt>Examples/test-suite/scilab</tt> can be another source of useful use cases.</li>
<li>The <a href="http://help.scilab.org/docs/5.5.0/en_US/api_scilab.html">Scilab API</a> is used in the generated code and is a useful reference when examining the output.</li>
<li>This <a href="http://wiki.scilab.org/howto/Create%20a%20toolbox">guide</a> describes the Scilab external modules structure and files, in particular the files that are generated by SWIG for Scilab.</li>
<li>The <a href="https://help.scilab.org/docs/5.5.0/en_US/api_scilab.html">Scilab API</a> is used in the generated code and is a useful reference when examining the output.</li>
<li>This <a href="https://wiki.scilab.org/howto/Create%20a%20toolbox">guide</a> describes the Scilab external modules structure and files, in particular the files that are generated by SWIG for Scilab.</li>
</ul>

View file

@ -1,14 +1,14 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>SWIG-4.0 Documentation</title>
<title>SWIG-4.2 Documentation</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="#ffffff">
<H1><a name="Sections">SWIG-4.0 Documentation</a></H1>
<H1><a name="Sections">SWIG-4.2 Documentation</a></H1>
<p>
Last update : SWIG-4.1.0 (in progress)
Last update : SWIG-4.2.0 (in progress)
</p>
<H2><a name="Sections_Sections">Sections</a></H2>

View file

@ -613,7 +613,7 @@ you need to bring out some bigger guns.
<p>
One way to do this is to use a special purpose library such as libffi
(<a
href="http://www.sourceware.org/libffi/">http://www.sourceware.org/libffi/</a>).
href="https://www.sourceware.org/libffi/">https://www.sourceware.org/libffi/</a>).
libffi is a library that allows you to dynamically construct
call-stacks and invoke procedures in a relatively platform independent
manner. Details about the library can be found in the libffi

View file

@ -164,6 +164,15 @@ to provide additional diagnostics. These warnings can be turned on using the
</pre>
</div>
<p>
Preprocessor warning 202 ("Could not evaluate expression <em>expr</em>.") was
formally off by default and enabled by <tt>-Wextra</tt>, but since SWIG 4.1.0
this warning is on by default because suppressing it tends to hide genuine
problems. If you really don't want to see it, you can suppress it with
<tt>-w202</tt> or using <tt>%warnfilter</tt> as described below. Both will work
with older versions of SWIG too.
</p>
<p>
To selectively turn on extra warning messages, you can use the directives and options in the
previous section--simply add a "+" to all warning numbers. For example:
@ -211,7 +220,7 @@ You can of course also enable all warnings and suppress a select few, for exampl
</div>
<p>
The warnings on the right take precedence over the warnings on the left, so in the above example <tt>-Wextra</tt> adds numerous warnings including 452, but then <tt>-w309,452</tt> overrides this and so 452 is suppressesed.
The warnings on the right take precedence over the warnings on the left, so in the above example <tt>-Wextra</tt> adds numerous warnings including 452, but then <tt>-w309,452</tt> overrides this and so 452 is suppressed.
</p>
<p>
@ -429,6 +438,8 @@ example.i(4) : Syntax error in input(1).
<li>325. Nested <em>kind</em> not currently supported (<em>name</em> ignored).
<li>326. Deprecated %extend name used - the <em>kind</em> name '<em>name</em>' should be used instead of the typedef name '<em>name</em>'.
<li>327. Extern template ignored.
<li>340. Lambda expressions and closures are not fully supported yet.
<li>344. Unable to deduce decltype for '<em>expr</em>'.
<li>350. operator new ignored.
<li>351. operator delete ignored.
<li>352. operator+ ignored.
@ -484,6 +495,7 @@ example.i(4) : Syntax error in input(1).
<li>401. Nothing known about class 'name'. Ignored.
<li>402. Base class 'name' is incomplete.
<li>403. Class 'name' might be abstract.
<li>404. Duplicate template instantiation of '<em>type</em>' with name '<em>name</em>' ignored, previous instantiation of '<em>type</em>' with name '<em>name</em>'.
<li>450. Reserved
<li>451. Setting const char * variable may leak memory.
<li>452. Reserved

View file

@ -60,7 +60,7 @@ Usage within the Unix like environments MinGW and Cygwin is also detailed.
SWIG does not come with the usual Windows type installation program, however it is quite easy to get started. The main steps are:
</p>
<ul>
<li>Download the swigwin zip package from the <a href="http://www.swig.org">SWIG website</a> and unzip into a directory. This is all that needs downloading for the Windows platform.
<li>Download the swigwin zip package from the <a href="https://www.swig.org">SWIG website</a> and unzip into a directory. This is all that needs downloading for the Windows platform.
<li>Set environment variables as described in the <a href="#Windows_examples">SWIG Windows Examples</a> section in order to run examples using Visual C++.
</ul>
@ -220,7 +220,7 @@ Normally this is not needed, so most people will want to ignore this section.
<p>
There are various ways to build the SWIG executable including <a href="https://cmake.org/">CMake</a> which is able to generate project files for building with Visual Studio.
SWIG can also be compiled and run using <a href="https://www.msys2.org/">MSYS2</a>, <a href="http://www.cygwin.com">Cygwin</a> or <a href="http://www.mingw.org">MinGW</a>, all of which provide a Unix like front end to Windows and comes free with the gcc C/C++ compiler.
SWIG can also be compiled and run using <a href="https://www.msys2.org/">MSYS2</a>, <a href="https://www.cygwin.com">Cygwin</a> or <a href="https://osdn.net/projects/mingw/">MinGW</a>, all of which provide a Unix like front end to Windows and comes free with the gcc C/C++ compiler.
</p>
@ -230,7 +230,7 @@ SWIG can also be compiled and run using <a href="https://www.msys2.org/">MSYS2</
<p>
SWIG can be built using <a href="https://cmake.org/">CMake</a> and Visual Studio rather than autotools. As with the other approaches to
building SWIG the dependencies need to be installed. The steps below are one of a number of ways of installing the dependencies without requiring Cygwin or MinGW.
For fully working build steps always check the Continuous Integration (CI) setups currently detailed in the <a href="https://github.com/swig/swig/blob/master/appveyor.yml">Appveyor YAML file</a>.
For fully working build steps always check the Continuous Integration (CI) setups currently detailed in the <a href="https://github.com/swig/swig/tree/master/.github/workflows/nuget.yml">GitHub Actions YAML file</a>.
</p>
<ol>
@ -240,6 +240,7 @@ For fully working build steps always check the Continuous Integration (CI) setup
</li>
<li>
Install <a href="https://www.nuget.org/packages/CMake-win64/">CMake-win64 Nuget package</a> using the following command: <pre>C:\Tools\nuget install CMake-win64 -Version 3.15.5 -OutputDirectory C:\Tools\CMake</pre>
Using PowerShell the equivalent syntax is: <pre>&amp; "C:\Tools\nuget" install CMake-win64 -Version 3.15.5 -OutputDirectory C:\Tools\CMake</pre>
Alternatively you can download CMake from <a href="https://cmake.org/download/">https://cmake.org/download/</a>.
</li>
<li>
@ -248,44 +249,48 @@ For fully working build steps always check the Continuous Integration (CI) setup
and save to a folder e.g. <tt>C:\Tools\Bison</tt>
</li>
<li>
Unfortunately, PCRE2 is not yet available on Nuget. Instead we will use CMake to build and install <a href="https://www.pcre.org/">PCRE2</a> to <tt>C:\Tools\pcre2</tt> using the following commands:
<div class="shell"><pre>
cd C:\
SET PATH=C:\Tools\CMake\CMake-win64.3.15.5\bin;%PATH%
git clone https://github.com/PhilipHazel/pcre2.git
cd pcre2
cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX=C:/Tools/pcre2 -S . -B build
cmake --build build --config Release --target install
</pre></div>
Alternatively, set <tt>WITH_PCRE=OFF</tt> to disable PCRE2 support if you are sure you do not require it.
Install the <a href="https://www.nuget.org/packages/pcre2/">PCRE2 Nuget package</a> using the following command: <pre>C:\Tools\nuget install PCRE2 -Version 10.39 -OutputDirectory C:\Tools\pcre2</pre>
Note this is a x64 build, if this is not suitable PCRE2 can be built from source using <a href="https://github.com/PhilipHazel/pcre2/">https://github.com/PhilipHazel/pcre2/</a>.
Alternatively, set <tt>WITH_PCRE=OFF</tt> to disable PCRE2 support if you are sure you do not require it.
</li>
<li>
We will also need the SWIG source code. Either download a zipped archive from GitHub, or if git is installed clone the latest codebase
using <pre>git clone https://github.com/swig/swig.git</pre>
using: <pre>git clone https://github.com/swig/swig.git</pre>
In this example we are assuming the source code is available at <tt>C:\swig</tt>
</li>
<li>
<p>
Now we have all the required dependencies we can build SWIG using the commands below. We are assuming Visual Studio 2019 is installed. For other versions of Visual Studio change <tt>"Visual Studio 16 2019 -A x64"</tt> to the relevant
Now we have all the required dependencies we can build SWIG using PowerShell and the commands below. We are assuming Visual Studio 2019 is installed. For other versions of Visual Studio change <tt>"Visual Studio 16 2019 -A x64"</tt> to the relevant
<a href="https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html#visual-studio-generators">Visual Studio Generator</a> and
architecture. We add the required build tools to the system PATH, and then
build a Release version of SWIG. If all runs successfully a new swig.exe should be generated in the <tt>C:/swig/install2/bin</tt> folder.
</p>
<div class="shell"> <pre>
cd C:\swig
SET PATH=C:\Tools\CMake\CMake-win64.3.15.5\bin;C:\Tools\bison\Bison.3.7.4\bin;%PATH%
SET PCRE_ROOT=C:/Tools/pcre2
SET PCRE_PLATFORM=x64
cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX="%CD:\=/%/install2" -DCMAKE_C_FLAGS="/DPCRE2_STATIC" ^
-DCMAKE_CXX_FLAGS="/DPCRE2_STATIC" -DPCRE2_INCLUDE_DIR=%PCRE_ROOT%/include -DPCRE2_LIBRARY=%PCRE_ROOT%/lib/pcre2-8-static.lib -S . -B build
cmake --build build --config Release --target install
REM to test the exe
cd install2/bin
swig.exe -help
</pre></div>
</li>
</ol>
<div class="shell"><pre>
cd C:\swig
$env:PATH="C:\Tools\CMake\CMake-win64.3.15.5\bin;C:\Tools\bison\Bison.3.7.4\bin;" + $env:PATH
$PCRE_ROOT="C:\Tools\pcre2\PCRE2.10.39.0"
$PCRE_PLATFORM="x64"
cmake -G "Visual Studio 16 2019" -A "x64" `
-DCMAKE_INSTALL_PREFIX="C:/swig/install2" `
-DCMAKE_C_FLAGS="/DPCRE2_STATIC" `
-DCMAKE_CXX_FLAGS="/DPCRE2_STATIC" `
-DPCRE2_INCLUDE_DIR="$PCRE_ROOT/include" `
-DPCRE2_LIBRARY="$PCRE_ROOT/lib/pcre2-8-static.lib" `
-S . -B build
cmake --build build --config Release
cmake --install build --config Release
# to test the exe built correctly
cd install2/bin
./swig.exe -version
./swig.exe -help
</pre></div>
<p>
In addition to Release builds you can create a Debug build using:
</p>
@ -359,13 +364,13 @@ The short abbreviated instructions follow...
</p>
<ul>
<li>Install MinGW and MSYS from the <a href="http://www.mingw.org">MinGW</a> site. This provides a Unix environment on Windows.
<li>Install MinGW and MSYS from the <a href="https://osdn.net/projects/mingw/">MinGW</a> site. This provides a Unix environment on Windows.
<li>Follow the usual Unix instructions in the README file in the SWIG root directory to build swig.exe from the MinGW command prompt.
</ul>
<p>
The step by step instructions to download and install MinGW and MSYS, then download and build the latest version of SWIG from Github follow...
Note that the instructions for obtaining SWIG from Github are also online at <a href="http://www.swig.org/svn.html">SWIG Bleeding Edge</a>.
Note that the instructions for obtaining SWIG from Github are also online at <a href="https://www.swig.org/svn.html">SWIG Bleeding Edge</a>.
</p>
<p>
@ -375,8 +380,7 @@ Execute the steps in the order shown and don't use spaces in path names. In fact
<ol>
<li>
Download the following packages from the <a href="http://www.mingw.org/download.shtml">MinGW download page</a>
or <a href="https://sourceforge.net/projects/mingw/files/">MinGW SourceForge download page</a>.
Download the following packages from the <a href="https://osdn.net/projects/mingw/releases/">MinGW download page</a>.
Note that at the time of writing, the majority of these are in the Current
release list and some are in the Snapshot or Previous release list.
<ul>
@ -448,7 +452,7 @@ the autotools will fail miserably on those.
<li>
The PCRE2 third party library needs to be built next.
Download the latest PCRE2 source tarball, such as <tt>pcre2-10.39.tar.bz2</tt>, from
<a href=http://www.pcre.org>www.pcre.org</a> and place in the <tt>/usr/src/swig</tt> directory.
<a href=https://www.pcre.org>www.pcre.org</a> and place in the <tt>/usr/src/swig</tt> directory.
Build PCRE2 as a static library using the Tools/pcre-build.sh script as follows:
<div class="shell"><pre>

View file

@ -1,11 +1,11 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>SWIG-4.0 Documentation</title>
<title>SWIG-4.1 Documentation</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="#ffffff">
<H1><a name="index">SWIG-4.0 Documentation</a></H1>
<H1><a name="index">SWIG-4.1 Documentation</a></H1>
The SWIG documentation is available in one of the following formats.
<ul>

File diff suppressed because it is too large Load diff

View file

@ -94,6 +94,6 @@ All of the examples were last tested with the following configuration
</ul>
Your mileage may vary. If you experience a problem, please let us know by
contacting us on the <a href="http://www.swig.org/mail.html">mailing lists</a>.
contacting us on the <a href="https://www.swig.org/mail.html">mailing lists</a>.
</body>
</html>

View file

@ -58,7 +58,7 @@ The examples have been extensively tested on the following platforms:
</ul>
Your mileage may vary. If you experience a problem, please let us know by
contacting us on the <a href="http://www.swig.org/mail.html">mailing lists</a>.
contacting us on the <a href="https://www.swig.org/mail.html">mailing lists</a>.
</body>
</html>

View file

@ -10,7 +10,7 @@ try{
if(error == -1) {
console.log("t.unknown() didn't throw");
} else {
console.log("successfully caught throw in Test::unknown().");
console.log("successfully caught throw in Test::unknown() :" + error);
}
}
@ -22,7 +22,7 @@ catch(error){
if(error == -1) {
console.log("t.simple() did not throw");
} else {
console.log("successfully caught throw in Test::simple().");
console.log("successfully caught throw in Test::simple() :" + error);
}
}
@ -33,7 +33,7 @@ try{
if(error == -1) {
console.log("t.message() did not throw");
} else {
console.log("successfully caught throw in Test::message().");
console.log("successfully caught throw in Test::message() :" + error);
}
}
@ -45,7 +45,7 @@ catch(error){
if(error == -1) {
console.log("t.hosed() did not throw");
} else {
console.log("successfully caught throw in Test::hosed().");
console.log("successfully caught throw in Test::hosed() :" + error);
}
}
@ -58,7 +58,7 @@ for (var i=1; i<4; i++) {
if(error == -1) {
console.log("t.multi(" + i + ") did not throw");
} else {
console.log("successfully caught throw in Test::multi().");
console.log("successfully caught throw in Test::multi() :" + error);
}
}
}
}

View file

@ -1,6 +1,9 @@
% test octaves concatenation operator
function ret=horzcat(a, b)
% return the concatenation of two ComplexVal values as a cell array.
function ret=horzcat(varargin)
% return the concatenation of several ComplexVal values as a cell array.
% (not really useful but it tests the concatenation of swig_ref objects)
ret={a, b};
ret={};
for i=1:length(varargin)
ret{i}=varargin{i};
end
end

View file

@ -47,6 +47,5 @@ if swig_octave_prereq(3,8,0)
endif
# concatenation operator, note: calls @swig_ref/horzcat.m
# g = [a, b, c];
# printf("g = %s\n",disp(g));
# Above temporarily removed as broken in octave-7.2.0, see https://github.com/swig/swig/issues/2353
g = [a, b, c];
printf("g = %s\n",disp(g));

View file

@ -72,7 +72,7 @@ Please see the <a href="../../Doc/Manual/Windows.html">Windows</a> page in the m
Due to wide variations in the Perl C API and differences between versions such as the ActivePerl release for Windows,
the code generated by SWIG is extremely messy.
If the code doesn't compile or work with your version of Perl, please let us know by
contacting us on the <a href="http://www.swig.org/mail.html">mailing lists</a>.
contacting us on the <a href="https://www.swig.org/mail.html">mailing lists</a>.
Better yet, send us a patch.
</body>

View file

@ -25,7 +25,7 @@ print "----------------------\n";
$list = new EmployeeList();
# EmployeeList owns its items, so we must surrender ownership of objects
# we add. This involves first clearing the ->disown member to tell the
# we add. This involves first clearing the ->thisown member to tell the
# C++ director to start reference counting.
$e->thisown = 0;

View file

@ -4,7 +4,7 @@ and the C/C++ part is not in any package at all. Historically SWIG has
supported this sort of thing.
From SWIG 4.0.0 onwards, split modules are not supported by default.
The %module directive needs to be customised with the moduleimport attribute
in order to import the a global C/C++ module.
in order to import a global C/C++ module.
vanilla # "plane Jane" module both halves in pkg1
vanilla_split # python 1/2 in pkg1 C 1/2 in global namespace

View file

@ -92,7 +92,7 @@ For Python 2, set the environment variable <tt>PY2=1</tt>.
<p>
Your mileage may vary. If you experience a problem, please let us know by
contacting us on the <a href="http://www.swig.org/mail.html">mailing lists</a>.
contacting us on the <a href="https://www.swig.org/mail.html">mailing lists</a>.
</body>
</html>

View file

@ -87,7 +87,7 @@ The examples have been extensively tested on the following platforms:
</ul>
Your mileage may vary. If you experience a problem, please let us know by
contacting us on the <a href="http://www.swig.org/mail.html">mailing lists</a>.
contacting us on the <a href="https://www.swig.org/mail.html">mailing lists</a>.
</body>
</html>

View file

@ -63,7 +63,7 @@ The examples have been extensively tested on the following platforms:
</ul>
Your mileage may vary. If you experience a problem, please let us know by
contacting us on the <a href="http://www.swig.org/mail.html">mailing lists</a>.
contacting us on the <a href="https://www.swig.org/mail.html">mailing lists</a>.
</body>
</html>

View file

@ -0,0 +1,17 @@
%module catches_strings
%include <std_string.i>
%catches(const char *) StringsThrower::charstring;
%catches(std::string) StringsThrower::stdstring;
%inline %{
struct StringsThrower {
static void charstring() {
throw "charstring message";
}
static void stdstring() {
throw std::string("stdstring message");
}
};
%}

View file

@ -1,55 +0,0 @@
#######################################################################
# Makefile for cffi test-suite
#######################################################################
LANGUAGE = cffi
CFFI = @CFFIBIN@
SCRIPTSUFFIX = _runme.lisp
HAVE_CXX11 = @HAVE_CXX11@
HAVE_CXX14 = @HAVE_CXX14@
HAVE_CXX17 = @HAVE_CXX17@
HAVE_CXX20 = @HAVE_CXX20@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
include $(srcdir)/../common.mk
# Overridden variables here
# no C++ tests for now
CPP_TEST_CASES =
#C_TEST_CASES +=
# Custom tests - tests with additional commandline options
# none!
# Rules for the different types of tests
%.cpptest:
$(setup)
+$(swig_and_compile_cpp)
$(run_testcase)
%.ctest:
$(setup)
+$(swig_and_compile_c)
$(run_testcase)
%.multicpptest:
$(setup)
+$(swig_and_compile_multi_cpp)
$(run_testcase)
# Runs the testcase. A testcase is only run if
# a file is found which has _runme.lisp appended after the testcase name.
run_testcase = \
if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(CFFI) -batch -s $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
# Clean: (does nothing, we don't generate extra cffi code)
%.clean:
@exit 0
clean:
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' cffi_clean

View file

@ -90,7 +90,6 @@ CPP_TEST_BROKEN += \
nested_private \
template_default_pointer \
template_private_assignment \
template_expr \
$(CPP11_TEST_BROKEN) \
$(CPP14_TEST_BROKEN) \
$(CPP17_TEST_BROKEN) \
@ -133,6 +132,7 @@ CPP_TEST_CASES += \
bloody_hell \
bools \
catches \
catches_strings \
cast_operator \
casts \
char_binary \
@ -215,13 +215,16 @@ CPP_TEST_CASES += \
director_ref \
director_simple \
director_smartptr \
director_template \
director_thread \
director_unroll \
director_unwrap_result \
director_using \
director_using_member_scopes \
director_void \
director_wombat \
disown \
duplicate_class_name_in_ns \
dynamic_cast \
empty \
enum_ignore \
@ -455,10 +458,12 @@ CPP_TEST_CASES += \
template_enum_ns_inherit \
template_enum_typedef \
template_explicit \
template_expr \
template_extend1 \
template_extend2 \
template_extend_overload \
template_extend_overload_2 \
template_function_parm \
template_forward \
template_inherit \
template_inherit_abstract \
@ -482,6 +487,7 @@ CPP_TEST_CASES += \
template_parameters_global_scope \
template_partial_arg \
template_partial_specialization \
template_partial_specialization_more \
template_partial_specialization_typedef \
template_qualifier \
template_ref_type \
@ -493,6 +499,7 @@ CPP_TEST_CASES += \
template_static \
template_tbase_template \
template_template_parameters \
template_template_template_parameters \
template_typedef \
template_typedef_class_template \
template_typedef_cplx \
@ -590,6 +597,7 @@ CPP11_TEST_CASES += \
cpp11_director_enums \
cpp11_directors \
cpp11_explicit_conversion_operators \
cpp11_final_class \
cpp11_final_directors \
cpp11_final_override \
cpp11_function_objects \
@ -619,16 +627,18 @@ CPP11_TEST_CASES += \
cpp11_thread_local \
cpp11_template_double_brackets \
cpp11_template_explicit \
cpp11_template_parameters_decltype \
cpp11_template_typedefs \
cpp11_type_traits \
cpp11_type_aliasing \
cpp11_uniform_initialization \
cpp11_unrestricted_unions \
cpp11_userdefined_literals \
cpp11_variadic_function_templates \
cpp11_variadic_templates \
# Broken C++11 test cases.
CPP11_TEST_BROKEN = \
# cpp11_variadic_templates \ # Broken for some languages (such as Java)
# cpp11_reference_wrapper \ # No typemaps
# C++14 test cases.
@ -640,6 +650,7 @@ CPP14_TEST_BROKEN = \
# C++17 test cases.
CPP17_TEST_CASES += \
cpp17_enable_if_t \
cpp17_hex_floating_literals \
cpp17_nested_namespaces \
cpp17_nspace_nested_namespaces \
@ -709,6 +720,7 @@ CPP_STD_TEST_CASES += \
li_std_vector_enum \
li_std_vector_member_var\
li_std_vector_ptr \
li_std_vector_vector \
li_std_wstring \
smart_pointer_inherit \
template_typedef_fnc \
@ -753,6 +765,7 @@ C_TEST_CASES += \
enum_macro \
enum_missing \
extern_declaration \
final_c \
funcptr \
function_typedef \
global_functions \
@ -786,6 +799,7 @@ C_TEST_CASES += \
preproc_gcc_output \
preproc_include \
preproc_line_file \
preproc_predefined \
register_par \
ret_by_value \
simple_array \

View file

@ -19,6 +19,7 @@
#if defined(_MSC_VER)
#pragma warning(disable : 4996) // For the deprecated attributes in this testcase
#pragma warning(disable : 5030) // attribute is not recognized ('likely' and 'unlikely')
#endif

View file

@ -9,11 +9,35 @@
int i;
decltype(i) j;
auto foo( decltype(i) a ) -> decltype(i) {
auto get_number(decltype(i) a) -> decltype(i) {
if (a==5)
return 10;
else
return 0;
}
};
%}
%}
// These are ignored as unable to deduce decltype for (i+j)
%ignore B::k;
%ignore B::get_number_sum;
%ignore B::get_number_address;
#pragma SWIG nowarn=SWIGWARN_CPP11_DECLTYPE
%inline %{
class B {
public:
int i;
decltype(i) j;
decltype(i+j) k;
auto get_number_sum(decltype(i+j) a) -> decltype(i+j) {
return i+j;
}
auto get_number_address(decltype(&i) a) -> decltype(&i) {
return &i;
}
};
%}

View file

@ -0,0 +1,141 @@
%module cpp11_final_class
%warnfilter(SWIGWARN_PARSE_KEYWORD) final; // 'final' is a java keyword, renaming to '_final'
%warnfilter(SWIGWARN_PARSE_KEYWORD) override; // 'override' is a C# keyword, renaming to '_override'
%ignore Space1::final::operator=;
#if defined(SWIGPHP)
%rename(Space1_final) Space1::final::final;
#endif
#if defined(SWIGOCAML)
%rename(finale) BrokenSpace::FinalEnum1::final;
#endif
%inline %{
struct FinalBase {
virtual ~FinalBase() {}
};
struct FinalClass1 final : FinalBase {
void method1() {}
};
class FinalClass2 final : public FinalBase {
public:
void method2() {}
};
struct FinalClass3 final {
void method3() {}
};
struct FinalClass4 {
void method4() {}
} final;
struct override final {
void omethod() {}
};
%}
%rename(Space1_final) Space1::final;
%inline %{
namespace Space1 {
struct final final {
void finalmethod() {}
final() {}
final(const final &other) = default;
final& operator=(const final &other) = default;
};
struct FinalClass5 final {
void method5() {}
final final_member_var;
final get_final_member() { return final_member_var; }
Space1::final get_final_member2() { return final_member_var; }
};
struct FinalClass6 {
void method6() {}
virtual void final() final {}
virtual ~FinalClass6() = default;
};
typedef final Space1_final_typedef1;
typedef struct final Space1_final_typedef2;
}
typedef Space1::final Space1_final_typedef3;
typedef struct Space1::final Space1_final_typedef4;
%}
%inline %{
namespace Space2 {
class Y {
public:
Y(int i=0) {}
};
struct FinalVar1 {
class Y notfinal;
// class Y final; // SWIG (C++ only) fails to parse (same for struct and union)
};
struct FinalVar2 {
class Y notfinal = {};
// class Y final = {}; // SWIG (C++ only) fails to parse (same for struct and union)
};
struct FinalVar3 {
class Y notfinal = Y();
// class Y final = Y(); // SWIG (C++ only) fails to parse (same for struct and union)
};
struct FinalVar4 {
class Y* final;
FinalVar4() : final() {}
};
struct FinalVar5 {
Y final;
};
struct FinalVar6 {
Y final = {};
};
struct FinalVar7 {
Y final = Y();
};
struct FinalVar8 {
Y final{};
};
struct FinalVar9 {
Y final{9};
};
struct FinalVar10 {
void b10(Y final) {}
};
}
%}
// Unfortunately the use of final in BrokenSpace does not work with Visual C++
// so we limit testing to parsing these by SWIG and then ignoring it all.
%ignore BrokenSpace::FinalVar11;
%ignore BrokenSpace::FinalEnum1;
%ignore BrokenSpace::FinalEnum2;
namespace BrokenSpace {
using Space2::Y;
struct FinalVar11 {
void a11(class Y final) {}
};
struct FinalEnum1 {
enum Enum1 { one, two, final };
void enum_in(Enum1 e) {}
};
struct FinalEnum2 {
enum Enum2 { one, two, three, four };
enum Enum2 final;
};
}
%rename(Space3_final) Space3::final;
%inline %{
namespace Space3 {
typedef struct final {
void fmethod() {}
} final;
}
%}

View file

@ -27,7 +27,7 @@ struct Base {
virtual ~Base() {}
};
struct Derived /*final*/ : Base {
struct Derived final : Base {
virtual void stuff() const noexcept override final {}
virtual void override1() const noexcept override;
virtual void override2() const noexcept override;

View file

@ -39,7 +39,7 @@ class C {
public:
C(std::initializer_list<const char *> init) {
for (auto& val : init)
joined += val;
joined = joined + val;
}
C() {}
const char * get_joined_string() {

View file

@ -2,6 +2,10 @@
%include "cpp11_move_only_helper.i"
#if defined(SWIGOCAML)
%rename(valu) val;
#endif
%ignore MoveOnly::operator=;
//%valuewrapper MoveOnly; // SWIG sets %valuewrapper by default for move-only types

View file

@ -4,7 +4,7 @@
* This test case checks SwigValueWrapper and move assignment.
* Although not necessary, the test case was developed testing with C++98 compatibility for comparing improvements.
* C++11 and later is of course required for the move assignment support.
* C++98 is not actually necesary now as the test-suite only runs this test with compilers that support C++11 and later.
* C++98 is not actually necessary now as the test-suite only runs this test with compilers that support C++11 and later.
*/
%{

View file

@ -0,0 +1,51 @@
%module cpp11_template_parameters_decltype
%include <std_string.i>
%include <std_vector.i>
%include <std_pair.i>
#pragma SWIG nowarn=SWIGWARN_CPP11_DECLTYPE
#if 0
// to fix (non-template expression equivalent to template expression further down):
%inline %{
#include <utility>
#include <vector>
void f(bool c = std::is_constructible<std::string, decltype(std::declval<std::vector<std::pair<int, int>>>().begin()->first)>::value) {}
%}
#endif
%inline %{
// Github issue #1590
struct Converter {
std::string to_json() const { return std::string(); }
};
struct Json {
Json(std::string s) {}
template < class T, class = decltype(&T::to_json) >
Json(const T & t) : Json(t.to_json()) {}
// Github issue #1589
// To fix
#if !defined(SWIG)
// Implicit constructor: map-like objects (std::map, std::unordered_map, etc)
template <class M, typename std::enable_if<
std::is_constructible<std::string, decltype(std::declval<M>().begin()->first)>::value,
int>::type = 0>
Json(const M & m) : Json(object(m.begin(), m.end())) {}
#endif
};
%}
// %template(Json) Json::Json<Converter>; // not working
%template(Json) Json::Json<Converter, std::string>; // workaround
%inline %{
// Github issue #1589
template <decltype(true) X = true>
void A() { }
%}
// %template(A) A<>; // not working
%template(A) A<true>; // workaround

View file

@ -112,3 +112,39 @@ using callback_t = int(*)(int);
callback_t get_callback() { return mult2; }
int call(callback_t funk, int param) { return funk(param); }
%}
// Template template parameters - from #1021
%inline %{
#include <type_traits>
class Node {};
struct AnyVal { typedef AnyVal Super; };
template<template<typename D, typename O> class C, typename T, typename Super, typename Root, typename O>
using DeriveToBase = typename std::conditional<std::is_same<T, AnyVal>::value, Root, C<Super, O> >::type;
template<class T, class Root, class RParent>
using ImmediateBase = typename std::conditional<std::is_same<T, AnyVal>::value, Root, RParent >::type;
template<class D, typename _Super=AnyVal> class Expression {
typedef _Super Super;
};
void TestInstantiationsPart4() {
Expression<AnyVal, AnyVal::Super> express;
DeriveToBase<Expression, AnyVal, AnyVal, AnyVal, AnyVal> derive_to_base = AnyVal();
}
%}
#if 0
// TODO define and instantiate std::conditional and std::is_same
%template(ExpressionInstantiation) Expression<AnyVal, AnyVal::Super>;
%template(AnyTypeInstantiation) DeriveToBase<Expression, AnyVal, AnyVal, AnyVal, AnyVal>;
%inline %{
AnyVal takeAnyVal(DeriveToBase<Expression, AnyVal, AnyVal, AnyVal, AnyVal> av) {
return av;
}
%}
#endif

View file

@ -4,6 +4,8 @@
// This doesn't really directly test functionality in type_traits as it doesn't provide
// much for use by target languages, rather it tests usage of it.
%warnfilter(509) elaborate;
%inline %{
#include <type_traits>

View file

@ -0,0 +1,96 @@
%module cpp11_variadic_function_templates
// Some tests for variadic function templates
%inline %{
class A {
public:
A() {
a = 100;
}
virtual ~A() {}
int a;
};
class B {
public:
B() {
b = 200;
}
virtual ~B() {}
int b;
};
class C {
public:
C() {
c = 300;
}
virtual ~C() {}
int c;
};
class D {
public:
D() {
d = 400;
}
virtual ~D() {}
int d;
};
%}
// #1863
%inline %{
class Container {
public:
template<typename... Args>
static void notifyMyTypes(void (fn)(Args...)); // unconventional function (ptr)
template<typename... Args>
static void notifyMyTypesA(void (*fn)(Args...)) {} // conventional function ptr
template<typename... Args>
static void notifyMyTypesB(void fn(Args...)) {}; // unconventional function (ptr)
};
%}
%{
template<typename... Args>
void Container::notifyMyTypes(void (fn)(Args...)) {}
// Explicit template instantiations
template void Container::notifyMyTypes<>(void (tt)());
template void Container::notifyMyTypes<int>(void (tt)(int));
template void Container::notifyMyTypes<int, double>(void (tt)(int, double));
%}
// Not supported (most vexing parse), see Extending.html#Extending_nn7
//%template(ContainerNotifyMyTypes1) Container::notifyMyTypes<int>;
%template(ContainerNotifyMyTypesA1) Container::notifyMyTypesA<int>;
%template(ContainerNotifyMyTypesB1) Container::notifyMyTypesB<int>;
// #1863
%inline %{
#include <type_traits>
class EmplaceContainer {
public:
template<typename T, typename... Args>
void emplace(Args &&... args) noexcept(
std::is_nothrow_constructible<T, Args &&...>::value) {}
};
%}
%template(emplace) EmplaceContainer::emplace<int,A>;
%template(emplace) EmplaceContainer::emplace<int,A,B>;
%template(emplace) EmplaceContainer::emplace<int,A,B,C>;
%template(emplace) EmplaceContainer::emplace<int,A,B,C,D>;
// Overloading mix of variadic and non-variadic templates
%inline %{
template<typename T, typename U> int variadicmix1(T t, U u) { return 10; }
template<typename... T> int variadicmix1(T... t) { return 20; }
%}
%template(variadicmix1) variadicmix1<>;
%template(variadicmix1) variadicmix1<A>;
%template(variadicmix1) variadicmix1<A,B>;
%template(variadicmix1) variadicmix1<A,B,C>;
%template(variadicmix1) variadicmix1<int, int>;

View file

@ -4,9 +4,21 @@
using variadic number of classes.
*/
%module cpp11_variadic_templates
%warnfilter(SWIGWARN_CPP11_VARIADIC_TEMPLATE) MultiArgs;
%warnfilter(SWIGWARN_CPP11_VARIADIC_TEMPLATE) SizeOf;
%warnfilter(SWIGWARN_CPP11_VARIADIC_TEMPLATE) MultiInherit;
%warnfilter(SWIGWARN_JAVA_MULTIPLE_INHERITANCE,
SWIGWARN_CSHARP_MULTIPLE_INHERITANCE,
SWIGWARN_D_MULTIPLE_INHERITANCE,
SWIGWARN_PHP_MULTIPLE_INHERITANCE,
SWIGWARN_RUBY_MULTIPLE_INHERITANCE) MultiInherit;
%warnfilter(SWIGWARN_JAVA_MULTIPLE_INHERITANCE,
SWIGWARN_CSHARP_MULTIPLE_INHERITANCE,
SWIGWARN_D_MULTIPLE_INHERITANCE,
SWIGWARN_PHP_MULTIPLE_INHERITANCE,
SWIGWARN_RUBY_MULTIPLE_INHERITANCE) NumerousInherit;
%warnfilter(SWIGWARN_JAVA_MULTIPLE_INHERITANCE,
SWIGWARN_CSHARP_MULTIPLE_INHERITANCE,
SWIGWARN_D_MULTIPLE_INHERITANCE,
SWIGWARN_PHP_MULTIPLE_INHERITANCE,
SWIGWARN_RUBY_MULTIPLE_INHERITANCE) LotsInherit;
////////////////////////
// Variadic templates //
@ -24,7 +36,6 @@ class MultiArgs<int, std::vector<int>, std::map<std::string, std::vector<int>>>
%}
// TODO
%template (MultiArgs1) MultiArgs<int, std::vector<int>, std::map<std::string, std::vector<int>>>;
////////////////////////
@ -36,7 +47,10 @@ template<typename... Args> struct SizeOf {
};
%}
%template (SizeOf1) SizeOf<int, int>;
%template (SizeOf0) SizeOf<>;
%template (SizeOf1) SizeOf<int>;
%template (SizeOf2) SizeOf<int, int>;
%template (SizeOf3) SizeOf<int, int, int>;
//////////////////////////
// Variadic inheritance //
@ -60,18 +74,147 @@ public:
int b;
};
class C {
public:
C() {
c = 300;
}
virtual ~C() {}
int c;
};
class D {
public:
D() {
d = 400;
}
virtual ~D() {}
int d;
};
template <typename... BaseClasses> class MultiInherit : public BaseClasses... {
public:
MultiInherit(BaseClasses&... baseClasses) : BaseClasses(baseClasses)... {}
void MultiInstanceMethod(BaseClasses&... baseClasses) {}
static void MultiStaticMethod(BaseClasses&... baseClasses) {}
int InstanceMethod() { return 123; }
static int StaticMethod() { return 456; }
};
%}
// TODO
//%template (MultiInherit0) MultiInherit<>;
%template (MultiInherit0) MultiInherit<>;
%template (MultiInherit1) MultiInherit<A>;
// TODO
%template (MultiInherit2) MultiInherit<A,B>;
%template (MultiInherit3) MultiInherit<A,B,C>;
%inline %{
template <typename... BaseClasses> class NumerousInherit : public BaseClasses... {
public:
NumerousInherit(int i, BaseClasses&... baseClasses) : BaseClasses(baseClasses)... {}
void NumerousInstanceMethod(int i, BaseClasses&... baseClasses) {}
static void NumerousStaticMethod(int i, BaseClasses&... baseClasses) {}
int InstanceMethod() { return 123; }
static int StaticMethod() { return 456; }
};
%}
%template (NumerousInherit0) NumerousInherit<>;
%template (NumerousInherit1) NumerousInherit<A>;
%template (NumerousInherit2) NumerousInherit<A,B>;
%template (NumerousInherit3) NumerousInherit<A,B,C>;
%inline %{
template <typename T, typename... BaseClasses> class LotsInherit : public T, public BaseClasses... {
public:
LotsInherit(T t, BaseClasses&... baseClasses) : BaseClasses(baseClasses)... {}
void LotsInstanceMethod(T t, BaseClasses&... baseClasses) {}
static void LotsStaticMethod(T t, BaseClasses&... baseClasses) {}
int InstanceMethod() { return 123; }
static int StaticMethod() { return 456; }
};
%}
%template (LotsInherit1) LotsInherit<A>;
%template (LotsInherit2) LotsInherit<A,B>;
%template (LotsInherit3) LotsInherit<A,B,C>;
%template (LotsInherit4) LotsInherit<A,B,C,D>;
%inline %{
struct KlassMemFuncs {
int memfunc0() { return 0; }
int memfunc1() { return 1; }
int memfunc2() { return 2; }
int memfunc3() { return 3; }
};
template <typename... V> struct VariadicParms {
void ParmsVal(V... vparms_v) {}
void ParmsPtr(V*... vparms_p) {}
void ParmsPtrRef(V*&... vparms_pr) {}
void ParmsPtrRValueRef(V*&&... vparms_rvr) {}
void ParmsRef(V&... vparms_r) {}
void ParmsRValueRef(V&&... vparms_r) {}
void ParmsConstRef(const V&... vparms_cr) {}
// Conventional unnamed parameter function ptr
void ParmsFuncPtrVal(int (*)(V...)) {}
void ParmsFuncPtrPtr(int (*)(V*...)) {}
void ParmsFuncPtrPtrRef(int (*)(V*&...)) {}
void ParmsFuncPtrPtrRValueRef(int (*)(V*&&...)) {}
void ParmsFuncPtrRef(int (*)(V&...)) {}
void ParmsFuncPtrRValueRef(int (*)(V&&...)) {}
void ParmsFuncPtrConstRef(int (*)(const V&...)) {}
// Unconventional unnamed parameter function ptr
void ParmsFuncUnnamedVal(int (V...)) {}
void ParmsFuncUnnamedPtr(int (V*...)) {}
void ParmsFuncUnnamedPtrRef(int (V*&...)) {}
void ParmsFuncUnnamedPtrRValueRef(int (V*&&...)) {}
void ParmsFuncUnnamedRef(int (V&...)) {}
void ParmsFuncUnnamedRValueRef(int (V&&...)) {}
void ParmsFuncUnnamedConstRef(int (const V&...)) {}
// Unconventional named parameter function ptr
void ParmsFuncNamedVal(int fn(V...)) {}
void ParmsFuncNamedPtr(int fn(V*...)) {}
void ParmsFuncNamedPtrRef(int fn(V*&...)) {}
void ParmsFuncNamedPtrRValueRef(int fn(V*&&...)) {}
void ParmsFuncNamedRef(int fn(V&...)) {}
void ParmsFuncNamedRValueRef(int fn(V&&...)) {}
void ParmsFuncNamedConstRef(int fn(const V&...)) {}
// Conventional unnamed parameter member function ptr
void ParmsMemFuncPtrVal(int (KlassMemFuncs::*)(V...)) {}
void ParmsMemFuncPtrPtr(int (KlassMemFuncs::*)(V*...)) {}
void ParmsMemFuncPtrPtrRef(int (KlassMemFuncs::*)(V*&...)) {}
void ParmsMemFuncPtrPtrRValueRef(int (KlassMemFuncs::*)(V*&&...)) {}
void ParmsMemFuncPtrRef(int (KlassMemFuncs::*)(V&...)) {}
void ParmsMemFuncPtrRValueRef(int (KlassMemFuncs::*)(V&&...)) {}
void ParmsMemFuncPtrConstRef(int (KlassMemFuncs::*)(const V&...)) {}
};
%}
%template(VariadicParms0) VariadicParms<>;
%template(VariadicParms1) VariadicParms<A>;
%template(VariadicParms2) VariadicParms<A,B>;
%template(VariadicParms3) VariadicParms<A,B,C>;
%inline %{
template <typename... V> struct FixedAndVariadicParms {
public:
void ParmsVal(short shortvar, V... vparms_v) {}
void ParmsPtr(short shortvar, V*... vparms_p) {}
void ParmsPtrRef(short shortvar, V*&... vparms_pr) {}
void ParmsPtrRValueRef(short shortvar, V*&&... vparms_rvr) {}
void ParmsRef(short shortvar, V&... vparms_r) {}
void ParmsRValueRef(short shortvar, V&&... vparms_r) {}
void ParmsConstRef(short shortvar, const V&... vparms_cr) {}
void ParmsFuncPtrVal(short shortvar, int (*)(short, V...)) {}
void ParmsMemFuncPtrVal(int (KlassMemFuncs::*)(V...)) {}
};
%}
%template(FixedAndVariadicParms0) FixedAndVariadicParms<>;
%template(FixedAndVariadicParms1) FixedAndVariadicParms<A>;
%template(FixedAndVariadicParms2) FixedAndVariadicParms<A,B>;
%template(FixedAndVariadicParms3) FixedAndVariadicParms<A,B,C>;

View file

@ -0,0 +1,89 @@
%module cpp17_enable_if_t
// test use of enable_if_t but without full %template instantiation, that is no enable_if_t definition is parsed
%inline %{
#if defined(_MSC_VER) && _MSC_VER < 1920
#define or ||
#define and &&
#endif
#include <type_traits>
typedef int node_t;
typedef int position_t;
template <typename A, typename B, std::enable_if_t<std::is_integral_v<A>, bool> = true>
void enableif1(const A a, const B b) {}
// tests non-type template parameters within () brackets - was causing an infinite loop, issue #2418
template <typename A, typename B, std::enable_if_t<(std::is_integral_v<A>), bool> = true>
void enableif2(const A a, const B b) {}
template <typename A, typename B, std::enable_if_t<(std::is_integral_v<A> || std::is_same_v<A, node_t>), bool> = true>
void enableif3(const A a, const B b) {}
template <typename A, typename B, std::enable_if_t<(std::is_integral_v<A> or std::is_same_v<A, node_t>) and (std::is_integral_v<B> or std::is_same_v<B, position_t>), bool> = true>
void enableif4(const A a, const B b) {}
template <typename A, typename B, std::enable_if_t<(std::is_integral_v<A> and std::is_integral_v<B>), bool> = true>
int enableif5(const A a, const B b) {
return a + b;
}
void tester() {
enableif5<int, int>(10, 20);
enableif5(10, 20);
}
%}
// non-type template parameters working well in SWIG, below is a simple workaround as the 3rd parameter is defaulted for enable_if_t (which is just SFINAE to give a nice C++ compiler error)
%template(enableif5) enableif5<int, int, true>; // workaround (overriding default)
%inline %{
// #1037 infinite loop
template <typename T, std::enable_if_t<sizeof(T) <= 4>>
void destId(T el) {}
template <typename T, std::enable_if_t<sizeof(T) >= 3>>
void destId(const T& el) {}
%}
%inline %{
// #961 no name for defaulted template parameter
template<typename T, typename = std::enable_if_t<std::is_enum<T>::value>>
void uuu() {}
template<typename T, typename E = std::enable_if_t<std::is_enum<T>::value>>
void uuuE() {}
template<typename T, typename = typename std::enable_if<std::is_floating_point<T>::value>::type>
void vvv() {}
template<typename T, typename E = typename std::enable_if<std::is_floating_point<T>::value>::type>
void vvvE() {}
// More variations of enable_if and enable_if_t
template<typename T, typename std::enable_if<std::is_floating_point<T>::value>::type* = nullptr>
void www() {}
template<typename T, typename std::enable_if_t<std::is_enum<T>::value, int> = 0>
void xxx() {}
enum TestEnum { Enum1 = 1, Enum2 };
struct TestStruct {};
void tester2() {
uuu<TestEnum>();
// uuu<TestStruct>(); // compilation error
uuuE<TestEnum>();
// uuuE<TestStruct>(); // compilation error
vvv<double>();
// vvv<TestStruct>(); // compilation error
vvvE<double>();
// vvvE<TestStruct>(); // compilation error
www<double>();
// www<TestStruct>(); // compilation error
xxx<TestEnum>();
// xxx<TestStruct>(); // compilation error
}
%}

View file

@ -4,6 +4,8 @@
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) global_cint; /* Ruby, wrong constant name */
%feature("php:allowdynamicproperties", 1) Foo; /* Allow PHP-specific custom property testing in _runme.php */
%module cpp_basic
%newobject Bar::testFoo;

View file

@ -0,0 +1,32 @@
using System;
using catches_stringsNamespace;
public class catches_strings_runme {
public static void Main()
{
{
bool exception_thrown = false;
try {
StringsThrower.charstring();
} catch (ApplicationException e) {
if (!e.Message.Contains("charstring message"))
throw new ApplicationException("incorrect exception message:" + e);
exception_thrown = true;
}
if (!exception_thrown)
throw new ApplicationException("Should have thrown an exception");
}
{
bool exception_thrown = false;
try {
StringsThrower.stdstring();
} catch (ApplicationException e) {
if (!e.Message.Contains("stdstring message"))
throw new ApplicationException("incorrect exception message:" + e);
exception_thrown = true;
}
if (!exception_thrown)
throw new ApplicationException("Should have thrown an exception");
}
}
}

View file

@ -0,0 +1,32 @@
module catches_strings_runme;
import catches_strings.catches_strings;
import catches_strings.StringsThrower;
import std.algorithm;
void main() {
{
bool exception_thrown = false;
try {
StringsThrower.charstring();
} catch (Exception e) {
if (!canFind(e.msg, "charstring message"))
throw new Exception("incorrect exception message:" ~ e.msg);
exception_thrown = true;
}
if (!exception_thrown)
throw new Exception("Should have thrown an exception");
}
{
bool exception_thrown = false;
try {
StringsThrower.stdstring();
} catch (Exception e) {
if (!canFind(e.msg, "stdstring message"))
throw new Exception("incorrect exception message:" ~ e.msg);
exception_thrown = true;
}
if (!exception_thrown)
throw new Exception("Should have thrown an exception");
}
}

View file

@ -0,0 +1,32 @@
module catches_strings_runme;
import catches_strings.catches_strings;
import catches_strings.StringsThrower;
import std.algorithm;
void main() {
{
bool exception_thrown = false;
try {
StringsThrower.charstring();
} catch (Exception e) {
if (!canFind(e.msg, "charstring message"))
throw new Exception("incorrect exception message:" ~ e.msg);
exception_thrown = true;
}
if (!exception_thrown)
throw new Exception("Should have thrown an exception");
}
{
bool exception_thrown = false;
try {
StringsThrower.stdstring();
} catch (Exception e) {
if (!canFind(e.msg, "stdstring message"))
throw new Exception("incorrect exception message:" ~ e.msg);
exception_thrown = true;
}
if (!exception_thrown)
throw new Exception("Should have thrown an exception");
}
}

View file

@ -29,7 +29,7 @@ struct TfToken {
struct Tokens {
const TfToken face;
const TfToken *pface;
const TfToken& g_face() const { return face; }
const TfToken& g_face(int = 0, int = 0) const { return face; }
const TfToken* g_pface() const { return pface; }
Tokens() : face(), pface(&face) {}
};
@ -68,4 +68,6 @@ void CreateMaterialBindSubsetu(int num = UsdGeomTokensPtr->g_pface()->g_val().g_
void CreateMaterialBindSubsetv(int num = UsdGeomTokensPtr->g_pface()->g_ptr()->g_val()) {}
void CreateMaterialBindSubsetw(int num = UsdGeomTokensPtr->g_face().g_val().g_val()) {}
void CreateMaterialBindSubsetx(int num = UsdGeomTokens.g_face().g_val().g_val()) {}
void CreateMaterialBindSubsety(int num = UsdGeomTokens.g_face(1).g_val().g_val()) {}
void CreateMaterialBindSubsetz(int num = UsdGeomTokens.g_face(1,2).g_val().g_val()) {}
%}

View file

@ -49,7 +49,7 @@
%inline %{
struct A{
A(std::complex<int> i, double d=0.0) {}
A(std::complex<double> i, double d=0.0) {}
A(int i, bool j=false) {}
virtual ~A() {}
@ -60,7 +60,7 @@
namespace hi {
struct A1 : public A {
A1(std::complex<int> i, double d=0.0) : A(i, d) {}
A1(std::complex<double> i, double d=0.0) : A(i, d) {}
A1(int i, bool j=false) : A(i, j) {}
virtual int ff(int i = 0) {return i;}

View file

@ -54,7 +54,7 @@
%inline %{
struct A{
A(std::complex<int> i, double d=0.0) {}
A(std::complex<double> i, double d=0.0) {}
A(int i, bool j=false) {}
virtual ~A() {}
@ -65,7 +65,7 @@
namespace hi {
struct A1 : public A {
A1(std::complex<int> i, double d=0.0) : A(i, d) {}
A1(std::complex<double> i, double d=0.0) : A(i, d) {}
A1(int i, bool j=false) : A(i, j) {}
virtual int ff(int i = 0) {return i;}

View file

@ -0,0 +1,28 @@
%module(directors="1") director_template
%{
#include <vector>
%}
%include <std_vector.i>
%feature("director") HandleBytes;
%inline %{
template <typename X, typename Y> class TwoTemplateParms {};
%}
%template(TT_int_double) TwoTemplateParms<int, double>;
%inline %{
class HandleBytes {
public:
virtual void handle(const std::vector<unsigned char> data) = 0; // Note: not instantiated with %template
virtual void handle2(TwoTemplateParms<int, double> data) = 0;
virtual ~HandleBytes() {}
};
void bytes_wrapper(const std::vector<unsigned char> data, HandleBytes *handler) {
handler->handle(data);
}
%}

View file

@ -0,0 +1,93 @@
%module(directors="1") director_unwrap_result
%warnfilter(SWIGWARN_TYPEMAP_DIRECTOROUT_PTR) Storage;
%warnfilter(SWIGWARN_TYPEMAP_DIRECTOROUT_PTR) StorageTmpl;
%feature("director") Element;
%feature("director") Storage;
%feature("director") StorageTmpl;
%inline %{
class Element {
Element* self;
Element** selfptr;
public:
Element() {
self = this;
selfptr = &self;
}
virtual ~Element() {}
Element **getPtrPtr() {
return &self;
}
Element ***getPtrPtrPtr() {
return &selfptr;
}
};
typedef Element * element_ptr_t;
typedef Element & element_ref_t;
class Storage {
public:
virtual ~Storage() {}
virtual Element **getIt() = 0;
Element getElement() {
return **getIt();
}
Element* const getElementPtr() {
return *getIt();
}
Element& getElementRef() {
return **getIt();
}
Element* const *getElementPtrPtr() {
return getIt();
}
Element *&getElementPtrRef() {
return *getIt();
}
element_ref_t getElementRefTypedef() {
return **getIt();
}
element_ptr_t getElementPtrTypedef() {
return *getIt();
}
element_ptr_t &getElementPtrRefTypedef() {
return *getIt();
}
};
template<class T> class StorageTmpl {
public:
virtual ~StorageTmpl() {}
virtual T &getIt() = 0;
T getVal() {
return getIt();
}
T *getPtr() {
return &getIt();
}
T &getRef() {
return getIt();
}
};
%}
%template(ElementStorage) StorageTmpl<Element>;
%template(ElementPtrStorage) StorageTmpl<Element *>;
%template(ElementPtrPtrStorage) StorageTmpl<Element *const *>;
%inline %{
template<class T> T getParam(T t) {
return t;
}
%}
%template(getIntParam) getParam<int>;
%template(getIntPtrParam) getParam<int*>;
%template(getElementPtrParam) getParam<Element *>;

View file

@ -95,13 +95,68 @@
class ClassWithNestedEnum {
public:
/**
* Enum description.
* ENested description.
*/
typedef enum {ONE, ///< desc of one
TWO, ///< desc of two
THREE ///< desc of three
} ENested;
/**
* ENestedOdd description.
*/
typedef enum {ODD_ONE ///< desc of odd_one
,ODD_TWO ///< desc of odd_two
,ODD_THREE ///< desc of odd_three
} ENestedOdd;
/**
* ENestedOddPartial1 description.
*/
typedef enum {ODD_PARTIAL1_ONE
,ODD_PARTIAL1_TWO ///< desc of odd_partial1_two
,ODD_PARTIAL1_THREE ///< desc of odd_partial1_three
} ENestedOddPartial1;
/**
* ENestedOddPartial3 description.
*/
typedef enum {ODD_PARTIAL3_ONE ///< desc of odd_partial3_one
,ODD_PARTIAL3_TWO ///< desc of odd_partial3_two
,ODD_PARTIAL3_THREE
} ENestedOddPartial3;
/** Description for TESTENUM. */
enum TESTENUM
{
/** something for none */
TEST_NONE = 0,
/** something for one */
TEST_ONE,
/** something for two */
TEST_TWO /** something more for two */
};
};
/// SIOBeam struct description
struct SIOBeam {
/** testfunction - testing extra trailing doc comment */
void testfunction(
/** testfunction aaa parm */
int testf_aaa,
/** testfunction bbb parm */
double testf_bbb,
/** testfunction ccc parm */
bool testf_ccc /** testfunction more for two parm */
) {}
/// Constructor for input from an existing SIO file
explicit SIOBeam(
const char * filename, ///< Name of input SIO file.
int elevationOrder=1, ///< Interpolation order (0-3) in elevation
int bearingOrder=1 ///< Interpolation order (0-3) in bearing
) {}
};
/// @return This is a bad place for this tag, but it should be ignored.
@ -121,6 +176,13 @@
*/
void showList() { }
/** Incorrectly documented members, these should be post document comments, Github issue #1636 */
struct IncorrectlyDocumentedMembers
{
int aaaa; //! really for bbbb value
int bbbb; //! not for bbbb value, is quietly ignored by Doxygen and SWIG
};
#include "doxygen_misc_constructs.h"
%}

View file

@ -133,6 +133,16 @@ struct SomeAnotherStruct
}
};
struct Foo1636
{
///@{
/// groupmember1 description
int groupmember1;
/// groupmember2 description
int groupmember2;
///@}
};
struct Foo1750
{
/// @name Group name

View file

@ -59,6 +59,7 @@
* \endif
*
* \image html testImage.bmp "Hello, world!" width=10cm
* \image html "test image.jpg" "Test jpeg" width=10cm
*
* <ul>
*

View file

@ -0,0 +1,88 @@
%module duplicate_class_name_in_ns
%rename(XA) A::X;
%rename(XB) B::X;
%inline %{
namespace A
{
class X
{
public:
X(){};
};
template<typename T>
class Foo
{
public:
Foo(){};
};
class Bar
{
public:
Bar(){};
};
template<typename T>
class Baz
{
public:
Baz(){};
};
}
namespace B
{
// non-template derived from non-template
class X : public A::X
{
public:
X(){};
A::X do_x(){return A::X();}
};
// template derived from template with different template args
template<typename T, typename U>
class Foo : public A::Foo<U>
{
public:
Foo(){};
A::Foo<U> do_foo(){return A::Foo<U>();}
};
// template derived from non-template
template<typename T, typename U>
class Bar : public A::Bar
{
public:
Bar(){};
A::Bar do_bar(){return A::Bar();}
};
// template derived from template with same template args
template<typename T>
class Baz : public A::Baz<T>
{
public:
Baz(){};
A::Baz<T> do_baz(){return A::Baz<T>();}
};
}
%}
%template(AFoo) A::Foo<double>;
%template(ABaz) A::Baz<double>;
%template(BFoo) B::Foo<int, double>;
%template(BBar) B::Bar<int, double>;
%template(BBaz) B::Baz<double>;
%inline %{
A::X get_a_x() {B::X x; return x.do_x();}
A::Foo<double> get_a_foo() {B::Foo<int, double> x; return x.do_foo();}
A::Bar get_a_bar() {B::Bar<int, double> x; return x.do_bar();}
A::Baz<double> get_a_baz() {B::Baz<double> x; return x.do_baz();}
%}

View file

@ -1,5 +1,5 @@
%module xxx
/* Note: needs -Wextra to see these warnings */
/* Spaceship operator doesn't seem to be allowed in preprocessor expressions. */
#if (4 <=> 2) < 0

View file

@ -0,0 +1,34 @@
%module xxx
template<typename T> struct A {};
%template(Aint) A<int>;
%template(Aint2) A<int>; // Now ignored and issues a warning
template<typename T> struct B {};
%template() B<int>;
%template(Bint) B<int>; // OK
template<typename T> struct C {};
%template() C<int>;
%template() C<int>; // Quietly ignored now
%template(Cint) C<int>; // OK
template <typename T, typename U = short> struct D {};
%template(Dint) D<int>;
%template(Dintshort) D<int, short>;
template<typename T> struct E {};
%template(Eint) E<int>;
%template(Eint) E<int>; // Always has been ignored as a redefined identifier
template<typename T> struct F {};
%template(Fint) F<int>;
%template() F<int>; // Quietly ignored
%template() F<int>; // Quietly ignored
template<typename T> struct G {};
%template() G<int>;
%template() G<int>; // Quietly ignored
%template(Gint) G<int>;
%template() G<int>; // Quietly ignored

View file

@ -0,0 +1,6 @@
cpp_template_class_repeat.i:5: Warning 404: Duplicate template instantiation of 'A< int >' with name 'Aint2' ignored,
cpp_template_class_repeat.i:4: Warning 404: previous instantiation of 'A< int >' with name 'Aint'.
cpp_template_class_repeat.i:18: Warning 404: Duplicate template instantiation of 'D< int,short >' with name 'Dintshort' ignored,
cpp_template_class_repeat.i:17: Warning 404: previous instantiation of 'D< int >' with name 'Dint'.
cpp_template_class_repeat.i:22: Warning 404: Duplicate template instantiation of 'E< int >' with name 'Eint' ignored,
cpp_template_class_repeat.i:21: Warning 404: previous instantiation of 'E< int >' with name 'Eint'.

View file

@ -2,13 +2,13 @@ cpp_template_duplicate_names.i:14: Warning 302: Identifier 'Duplicate1' redefine
cpp_template_duplicate_names.i:13: Warning 302: previous definition of 'Duplicate1'.
cpp_template_duplicate_names.i:14: Warning 302: Identifier 'Duplicate1' redefined (ignored),
cpp_template_duplicate_names.i:13: Warning 302: previous definition of 'Duplicate1'.
cpp_template_duplicate_names.i:25: Warning 302: Identifier 'Duplicate2_0' redefined (ignored) (Renamed from 'Duplicate2< 0 >'),
cpp_template_duplicate_names.i:24: Warning 302: previous definition of 'Duplicate2_0' (Renamed from 'Duplicate2< 0 >').
cpp_template_duplicate_names.i:35: Warning 302: Identifier 'Duplicate3' redefined (ignored) (Renamed from 'Duplicate3< 0 >'),
cpp_template_duplicate_names.i:31: Warning 302: previous definition of 'Duplicate3'.
cpp_template_duplicate_names.i:25: Warning 404: Duplicate template instantiation of 'Duplicate2< 0 >' with name 'Duplicate2_0' ignored,
cpp_template_duplicate_names.i:24: Warning 404: previous instantiation of 'Duplicate2< 0 >' with name 'Duplicate2_0'.
cpp_template_duplicate_names.i:35: Warning 404: Duplicate template instantiation of 'Duplicate3< 0 >' with name 'Duplicate3' ignored,
cpp_template_duplicate_names.i:34: Warning 404: previous instantiation of 'Duplicate3< 0 >' with name 'Duplicate3'.
cpp_template_duplicate_names.i:47: Warning 302: Identifier 'Duplicate4' redefined (ignored),
cpp_template_duplicate_names.i:46: Warning 302: previous definition of 'Duplicate4'.
cpp_template_duplicate_names.i:47: Warning 302: Identifier 'Duplicate4' redefined (ignored),
cpp_template_duplicate_names.i:46: Warning 302: previous definition of 'Duplicate4'.
cpp_template_duplicate_names.i:50: Warning 302: Identifier 'Duplicate4' redefined (ignored) (Renamed from 'Duplicate4< 0 >'),
cpp_template_duplicate_names.i:46: Warning 302: previous definition of 'Duplicate4'.
cpp_template_duplicate_names.i:50: Warning 404: Duplicate template instantiation of 'Duplicate4< 0 >' with name 'Duplicate4' ignored,
cpp_template_duplicate_names.i:49: Warning 404: previous instantiation of 'Duplicate4< 0 >' with name 'Duplicate4'.

View file

@ -4,4 +4,15 @@ template<class T> T blah(T x) { };
%template(iblah) blah<int>;
%template(iiblah) blah<int>;
// The second %template instantiation above should surely be ignored with a warning, but doesn't atm
// empty template instantiations for template functions warn (unlike for template classes)
%template() blah<double>;
%template() blah<double>;
%template() blah<double>;
%template(sblah) blah<short>;
%template(sblah) blah<short>;
%template() blah<const char *>;
%template() blah<const char *>;
%template(sblah) blah<const char *>;

View file

@ -0,0 +1,6 @@
cpp_template_repeat.i:6: Warning 404: Duplicate template instantiation of 'blah< int >' with name 'iiblah' ignored,
cpp_template_repeat.i:5: Warning 404: previous instantiation of 'blah< int >' with name 'iblah'.
cpp_template_repeat.i:14: Warning 404: Duplicate template instantiation of 'blah< short >' with name 'sblah' ignored,
cpp_template_repeat.i:13: Warning 404: previous instantiation of 'blah< short >' with name 'sblah'.
cpp_template_repeat.i:9: Warning 519: %template() contains no name. Template method ignored: blah< double >(double)
cpp_template_repeat.i:16: Warning 519: %template() contains no name. Template method ignored: blah< char const * >(char const *)

View file

@ -1,5 +1,5 @@
%module xxx
/* Note: needs -Wextra to see these warnings */
/* Divide by zero */
#define ZERO 0

View file

@ -1,6 +1,7 @@
%module exception_memory_leak
%include <std_string.i>
%include <exception.i>
%typemap(in) Foo* foo
{
@ -11,12 +12,23 @@
Foo::inc_freearg_count();
delete $1;
}
%typemap(out) Foo* verify_no_memory_leak
%typemap(out) Foo* trigger_internal_swig_exception
{
if ($1 == NULL)
SWIG_exception_fail(SWIG_RuntimeError, "Let's see how the bindings manage this exception!");
if ($1 == NULL) {
SWIG_exception(SWIG_RuntimeError, "Let's see how the bindings manage this exception!");
#ifdef SWIG_fail
SWIG_fail;
#endif
}
$1 = NULL;
}
%typemap(out) Foo trigger_internal_swig_exception
{
SWIG_exception(SWIG_RuntimeError, "Let's see how the bindings manage this exception!");
#ifdef SWIG_fail
SWIG_fail;
#endif
}
%inline %{
#include <string>
@ -42,4 +54,9 @@
return (message == "null") ? NULL : foo;
}
static Foo trigger_internal_swig_exception(const std::string& message)
{
return Foo();
}
%}

View file

@ -0,0 +1,13 @@
%module final_c
%warnfilter(SWIGWARN_PARSE_KEYWORD) final; // 'final' is a java keyword, renaming to '_final'
%inline %{
struct Y {
int yval;
};
struct Y final;
void init() {
final.yval = 123;
}
%}

View file

@ -1,7 +1,7 @@
%module global_immutable_vars
// Test immutable and mutable global variables,
// see http://www.swig.org/Doc4.0/SWIGDocumentation.html#SWIG_readonly_variables
// see https://www.swig.org/Doc4.0/SWIGDocumentation.html#SWIG_readonly_variables
%inline %{
int default_mutable_var = 40;

View file

@ -1,7 +1,7 @@
%module global_immutable_vars_cpp
// Test immutable and mutable global variables,
// see http://www.swig.org/Doc4.0/SWIGDocumentation.html#SWIG_readonly_variables
// see https://www.swig.org/Doc4.0/SWIGDocumentation.html#SWIG_readonly_variables
%inline %{
int default_mutable_var = 40;

View file

@ -0,0 +1,32 @@
package main
import "strings"
import . "swigtests/catches_strings"
func main() {
{
exception_thrown := false
func() {
defer func() {
exception_thrown = strings.Index(recover().(string), "charstring message") == 0
}()
StringsThrowerCharstring()
}()
if !exception_thrown {
panic(0)
}
}
{
exception_thrown := false
func() {
defer func() {
exception_thrown = strings.Index(recover().(string), "stdstring message") == 0
}()
StringsThrowerStdstring()
}()
if !exception_thrown {
panic(0)
}
}
}

View file

@ -28,4 +28,9 @@ func main() {
if x != "Grok::blah" {
panic(x)
}
x = d.Far()
if x != "Spam::far" {
panic(x)
}
}

View file

@ -0,0 +1,3 @@
(dynamic-call "scm_init_catches_strings_module" (dynamic-link "./libcatches_strings"))
(load "testsuite.scm")
(load "../schemerunme/catches_strings.scm")

View file

@ -0,0 +1,41 @@
import catches_strings.*;
public class catches_strings_runme {
static {
try {
System.loadLibrary("catches_strings");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
System.exit(1);
}
}
public static void main(String argv[]) throws Throwable
{
{
boolean exception_thrown = false;
try {
StringsThrower.charstring();
} catch (RuntimeException e) {
if (!e.getMessage().contains("charstring message"))
throw new RuntimeException("incorrect exception message");
exception_thrown = true;
}
if (!exception_thrown)
throw new RuntimeException("Should have thrown an exception");
}
{
boolean exception_thrown = false;
try {
StringsThrower.stdstring();
} catch (RuntimeException e) {
if (!e.getMessage().contains("stdstring message"))
throw new RuntimeException("incorrect exception message");
exception_thrown = true;
}
if (!exception_thrown)
throw new RuntimeException("Should have thrown an exception");
}
}
}

View file

@ -0,0 +1,19 @@
import cpp17_enable_if_t.*;
public class cpp17_enable_if_t_runme {
static {
try {
System.loadLibrary("cpp17_enable_if_t");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
System.exit(1);
}
}
public static void main(String argv[])
{
if (cpp17_enable_if_t.enableif5(10, 20) != 30)
throw new RuntimeException("enableif5 not working");
}
}

View file

@ -97,7 +97,7 @@ public class doxygen_misc_constructs_runme {
"\n");
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENested",
" Enum description.\n" +
" ENested description.\n" +
"\n");
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENested.ONE",
@ -109,6 +109,81 @@ public class doxygen_misc_constructs_runme {
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENested.THREE",
" desc of three\n");
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENestedOdd",
" ENestedOdd description.\n" +
"\n");
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENestedOdd.ODD_ONE",
" desc of odd_one\n");
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENestedOdd.ODD_TWO",
" desc of odd_two\n");
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENestedOdd.ODD_THREE",
" desc of odd_three\n");
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENestedOddPartial1",
" ENestedOddPartial1 description.\n" +
"\n");
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENestedOddPartial1.ODD_PARTIAL1_THREE",
" desc of odd_partial1_three\n");
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENestedOddPartial1.ODD_PARTIAL1_TWO",
" desc of odd_partial1_two\n");
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENestedOddPartial3",
" ENestedOddPartial3 description.\n" +
"\n");
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENestedOddPartial3.ODD_PARTIAL3_ONE",
" desc of odd_partial3_one\n");
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENestedOddPartial3.ODD_PARTIAL3_TWO",
" desc of odd_partial3_two\n");
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.TESTENUM",
" Description for TESTENUM.\n" +
"\n");
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.TESTENUM.TEST_NONE",
" something for none\n");
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.TESTENUM.TEST_ONE",
" something for one\n");
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.TESTENUM.TEST_TWO",
" something for two something more for two\n");
wantedComments.put("doxygen_misc_constructs.SIOBeam",
" SIOBeam struct description\n" +
"\n");
wantedComments.put("doxygen_misc_constructs.SIOBeam.testfunction(int, double, boolean)",
" testfunction - testing extra trailing doc comment <br>\n" +
" @param testf_aaa testfunction aaa parm <br>\n" +
" @param testf_bbb testfunction bbb parm <br>\n" +
" @param testf_ccc testfunction ccc parm testfunction more for two parm\n" +
"\n");
wantedComments.put("doxygen_misc_constructs.SIOBeam(java.lang.String, int, int)",
" Constructor for input from an existing SIO file<br>\n" +
" @param filename Name of input SIO file.<br>\n" +
" @param elevationOrder Interpolation order (0-3) in elevation<br>\n" +
" @param bearingOrder Interpolation order (0-3) in bearing\n" +
"\n");
wantedComments.put("doxygen_misc_constructs.SIOBeam(java.lang.String, int)",
" Constructor for input from an existing SIO file<br>\n" +
" @param filename Name of input SIO file.<br>\n" +
" @param elevationOrder Interpolation order (0-3) in elevation<br>\n" +
"\n");
wantedComments.put("doxygen_misc_constructs.SIOBeam(java.lang.String)",
" Constructor for input from an existing SIO file<br>\n" +
" @param filename Name of input SIO file.<br>\n" +
"\n");
wantedComments.put("doxygen_misc_constructs.StructWithReturnComment",
" @return This is a bad place for this tag, but it should be ignored.");
@ -124,6 +199,16 @@ public class doxygen_misc_constructs_runme {
" <br>\n" +
" And this is not a list item any more.\n" +
"");
wantedComments.put("doxygen_misc_constructs.IncorrectlyDocumentedMembers",
" Incorrectly documented members, these should be post document comments, Github issue #1636");
wantedComments.put("doxygen_misc_constructs.IncorrectlyDocumentedMembers.setBbbb(int)",
" really for bbbb value");
wantedComments.put("doxygen_misc_constructs.IncorrectlyDocumentedMembers.getBbbb()",
" really for bbbb value");
wantedComments.put("doxygen_misc_constructs.doxygen_misc_constructs.isNoSpaceValidA()",
" This comment without space after '*' is valid in Doxygen.\n" +
"\n" +

View file

@ -132,6 +132,14 @@ public class doxygen_parsing_runme {
wantedComments.put("doxygen_parsing.doxygen_parsingConstants.CONSTANT_VALUE",
"The constant comment \n" +
"");
wantedComments.put("doxygen_parsing.Foo1636.getGroupmember1()",
"groupmember1 description");
wantedComments.put("doxygen_parsing.Foo1636.setGroupmember1(int)",
"groupmember1 description");
wantedComments.put("doxygen_parsing.Foo1636.getGroupmember2()",
"groupmember2 description");
wantedComments.put("doxygen_parsing.Foo1636.setGroupmember2(int)",
"groupmember2 description");
wantedComments.put("doxygen_parsing.Foo1750.getA()",
"");
wantedComments.put("doxygen_parsing.Foo1750.getB()",

Some files were not shown because too many files have changed in this diff Show more