mirror of https://github.com/swig/swig
Merge branch 'master' into C
This commit is contained in:
commit
4ea006c4f4
|
@ -7,6 +7,25 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
|||
Version 4.3.0 (in progress)
|
||||
===========================
|
||||
|
||||
2024-09-12: olly
|
||||
Remove remains of %nestedworkaround and the nestedworkaround
|
||||
feature it uses, which were deprecated over 10 years ago in SWIG
|
||||
3.0.0. Since then uses of these have done nothing except emit a
|
||||
warning.
|
||||
|
||||
2024-09-11: wsfulton
|
||||
[C# Java] #1188 Add the %interface_additional macro to the family of
|
||||
%interface macros for adding additional interfaces for the generated
|
||||
interface to extend/derive from.
|
||||
|
||||
2024-09-11: olly
|
||||
#197 #675 #1677 #2047 Fix incorrect inclusion of "enum " when
|
||||
qualifying C++11 "enum class" enumerator names.
|
||||
|
||||
2024-09-11: olly
|
||||
[Perl] #630 Fix wrapping of C++11 enum class when -const command line
|
||||
option is specified.
|
||||
|
||||
2024-09-07: wsfulton
|
||||
#2875 Fix swig-4.1.0 regression using the %interface family of macros
|
||||
for multiple inheritance and common bases.
|
||||
|
|
|
@ -2146,11 +2146,23 @@ to make the method and constructor public:
|
|||
Alternatively, instead of exposing these as public, consider
|
||||
using the <tt>[assembly:InternalsVisibleTo("Name")]</tt> attribute available in the .NET framework when you
|
||||
know which assemblies these can be exposed to.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Another approach would be to make these public, but also to hide them from intellisense by using
|
||||
the <tt>[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]</tt> attribute
|
||||
if you don't want users to easily stumble upon these so called 'internal workings' of the wrappers.
|
||||
if you don't want users to easily stumble upon these so called 'internal workings' of the wrappers. You can
|
||||
do this like so:
|
||||
</p>
|
||||
|
||||
<div class="code">
|
||||
<pre>
|
||||
#define PUBLIC_BUT_HIDDEN [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public
|
||||
SWIG_CSBODY_PROXY(PUBLIC_BUT_HIDDEN, PUBLIC_BUT_HIDDEN, SWIGTYPE)
|
||||
SWIG_CSBODY_TYPEWRAPPER(PUBLIC_BUT_HIDDEN, PUBLIC_BUT_HIDDEN, PUBLIC_BUT_HIDDEN, SWIGTYPE)
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
||||
<H2><a name="CSharp_named_arguments">23.8 C# named and optional arguments</a></H2>
|
||||
|
||||
|
|
|
@ -3445,6 +3445,10 @@ There is more than one macro in order to provide a choice for choosing the Java
|
|||
<td><tt>%interface_custom("PROXY", "INTERFACE", CTYPE)</tt></td>
|
||||
<td>For C++ class <tt>CTYPE</tt>, proxy class name is given by the string <tt>PROXY</tt>, interface name is given by the string <tt>INTERFACE</tt>. The <tt>PROXY</tt> and <tt>INTERFACE</tt> names can use the <a href="SWIG.html#SWIG_advanced_renaming">string formatting functions</a> used in <tt>%rename</tt>.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><tt>%interface_additional("PROXY", "INTERFACE", "ADDITIONAL", CTYPE)</tt></td>
|
||||
<td>For C++ class <tt>CTYPE</tt>, proxy class name is given by the string <tt>PROXY</tt>, interface name is given by the string <tt>INTERFACE</tt>. The <tt>PROXY</tt> and <tt>INTERFACE</tt> names can use the <a href="SWIG.html#SWIG_advanced_renaming">string formatting functions</a> used in <tt>%rename</tt>. <tt>ADDITIONAL</tt> should contain a comma separated list of interfaces for the interface class to additionally extend. This is for adding interfaces not parsed by SWIG and is useful for adding in pure Java interfaces</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
|
@ -3648,8 +3652,82 @@ which calls an appropriate C++ cast of the pointer up the inheritance chain.
|
|||
</p>
|
||||
|
||||
<p>
|
||||
The <tt>%interface_additional</tt> macro is useful for adding additional interfaces to the Java interface class.
|
||||
Consider a simple class hierarchy, where <tt>Whizz</tt> inherits from <tt>Bang</tt> and we want
|
||||
these two classes to be wrapped as Java interfaces and the <tt>Whizz</tt> interface to additionally extend from the pure Java interface <tt>java.util.EventListener</tt>.
|
||||
</p>
|
||||
|
||||
<div class="code">
|
||||
<pre>
|
||||
%interface_custom("Bang", "IBang", Space::Bang);
|
||||
%interface_additional("Whizz", "IWhizz", "java.util.EventListener", Space::Whizz)
|
||||
|
||||
namespace Space {
|
||||
struct Bang {
|
||||
virtual void bang() = 0;
|
||||
};
|
||||
struct Whizz : Bang {
|
||||
virtual void whizz() = 0;
|
||||
};
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
The classes and interfaces generated are shown below, noting that <tt>IWhizz</tt> extends the additional interface <tt>java.util.EventListener</tt>:
|
||||
</p>
|
||||
|
||||
<div class="code">
|
||||
<pre>
|
||||
public interface IBang { ... }
|
||||
|
||||
public interface IWhizz extends java.util.EventListener, IBang { ... }
|
||||
|
||||
public class Bang implements IBang { ... }
|
||||
|
||||
public class Whizz implements IWhizz, IBang { ... }
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Note the subtle difference to the <tt>javainterfaces</tt> typemap discussed elsewhere.
|
||||
The typemap applies to the generated Java proxy class only, not the Java interface.
|
||||
A slight change to our example above as follows:
|
||||
</p>
|
||||
|
||||
<div class="code">
|
||||
<pre>
|
||||
%interface_custom("Bang", "IBang", Space::Bang);
|
||||
%interface_custom("Whizz", "IWhizz", Space::Whizz)
|
||||
%typemap(javainterfaces) Space::Whizz "java.util.EventListener"
|
||||
|
||||
namespace Space {
|
||||
... as shown above ...
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
will then the generate different code for the proxy class <tt>Whizz</tt> and the interface <tt>IWhizz</tt> as follows:
|
||||
</p>
|
||||
|
||||
<div class="code">
|
||||
<pre>
|
||||
public interface IBang { ... }
|
||||
|
||||
public interface IWhizz extends IBang { ... }
|
||||
|
||||
public class Bang implements IBang { ... }
|
||||
|
||||
public class Whizz implements IWhizz, IBang, java.util.EventListener { ... }
|
||||
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Finally, a note on the implementation of the interface macros.
|
||||
The interface macros are implemented using the <tt>interface</tt> feature and typemaps.
|
||||
For example:
|
||||
A couple of examples:
|
||||
</p>
|
||||
|
||||
<div class="code">
|
||||
|
@ -3658,18 +3736,30 @@ For example:
|
|||
%feature("interface", name="%sSwigInterface") CTYPE;
|
||||
INTERFACE_TYPEMAPS(CTYPE)
|
||||
%enddef
|
||||
|
||||
%define %interface_additional(PROXY, INTERFACE, ADDITIONAL, CTYPE...)
|
||||
%rename(PROXY) CTYPE;
|
||||
%feature("interface", name=INTERFACE, additional=ADDITIONAL) CTYPE;
|
||||
INTERFACE_TYPEMAPS(CTYPE)
|
||||
%enddef
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
The feature accepts one attribute called <tt>name</tt>, which is the name of the Java interface mentioned earlier.
|
||||
The feature accepts two attributes named <tt>name</tt> and <tt>additional</tt>.
|
||||
The <tt>name</tt> attribute should contain the name of the Java interface.
|
||||
The <tt>additional</tt> attribute should contain additional interfaces for the interface class, not parsed by SWIG.
|
||||
The <tt>INTERFACE_TYPEMAPS</tt> macro implements the typemaps and can be viewed in the
|
||||
<tt>swiginterface.i</tt> file and contain
|
||||
<tt>swiginterface.i</tt> file and contains
|
||||
the usual Java typemaps for generating code plus the <tt>javainterfacecode</tt>
|
||||
typemap which is only used when a class is marked with the <tt>interface</tt> feature.
|
||||
See <a href="Java.html#Java_code_typemaps">Java code typemaps</a> for details.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>Compatibility note:</b> The <tt>additional</tt> attribute and <tt>%interface_additional</tt> macro was added in SWIG-4.3.0.
|
||||
</p>
|
||||
|
||||
<H2><a name="Java_directors">27.5 Cross language polymorphism using directors</a></H2>
|
||||
|
||||
|
||||
|
@ -6987,7 +7077,7 @@ The "javaimports" typemap is ignored if the enum class is wrapped by an inner Ja
|
|||
<div class="code">
|
||||
<pre>
|
||||
[ javaimports typemap ]
|
||||
[ javainterfacemodifiers typemap ] [ javainterfacename ] {
|
||||
[ javainterfacemodifiers typemap ] [ name ] [extends additional [, ...] ] {
|
||||
[ javainterfacecode:cptrmethod typemap attribute ]
|
||||
... interface declarations ...
|
||||
}
|
||||
|
@ -6995,7 +7085,9 @@ The "javaimports" typemap is ignored if the enum class is wrapped by an inner Ja
|
|||
</div>
|
||||
|
||||
<p>
|
||||
where <tt>javainterfacename</tt> is the <tt>name</tt> attribute in the <a href="Java.html#Java_interfaces">interface feature</a>.
|
||||
where <tt>name</tt> is the <tt>name</tt> attribute and
|
||||
<tt>additional</tt> is the <tt>additional</tt> attribute
|
||||
in the <a href="Java.html#Java_interfaces">interface feature</a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
|
|
@ -5963,12 +5963,12 @@ However, there was a workaround for nested class support in these older versions
|
|||
the nested class in the global scope, adding in a typedef for the nested class in the global scope and
|
||||
using the "nestedworkaround" feature on the nested class. This resulted in approximately the
|
||||
same behaviour as the "flatnested" feature. With proper nested class support now available in SWIG-3.0.0, this
|
||||
feature has been deprecated and no longer works requiring code changes. If you see the following warning:
|
||||
feature was deprecated and has now been removed. If you see the following error:
|
||||
</p>
|
||||
|
||||
<div class="shell">
|
||||
<pre>
|
||||
example.i:8: Warning 126: The nestedworkaround feature is deprecated
|
||||
example.i:8: Error: Unknown directive '%nestedworkaround'
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -371,8 +371,8 @@ example.i(4) : Syntax error in input(1).
|
|||
<H3><a name="Warnings_nn10">19.9.1 Deprecated features (100-199)</a></H3>
|
||||
|
||||
|
||||
<ul>
|
||||
<li>126. The 'nestedworkaround' feature is deprecated.
|
||||
<p>None currently.</p>
|
||||
|
||||
</ul>
|
||||
|
||||
<H3><a name="Warnings_nn11">19.9.2 Preprocessor (200-299)</a></H3>
|
||||
|
|
|
@ -136,7 +136,6 @@ OBJS = $(SRCS:.c=.@OBJEXT@) $(CXXSRCS:.cxx=.@OBJEXT@)
|
|||
|
||||
distclean:
|
||||
rm -f Makefile
|
||||
rm -f xml/Makefile
|
||||
|
||||
##################################################################
|
||||
# Very generic invocation of swig
|
||||
|
|
|
@ -263,3 +263,48 @@ private:
|
|||
Val2 = 1172,
|
||||
};
|
||||
%}
|
||||
|
||||
// Test handling of %rename of enum class and an enumerator.
|
||||
%rename(Enum18) QEnum18;
|
||||
%rename(Val1) QVal1;
|
||||
%inline %{
|
||||
enum class QEnum18
|
||||
{
|
||||
QVal1 = 1181,
|
||||
Val2 = 1182,
|
||||
};
|
||||
%}
|
||||
|
||||
// Regression tests for cases where SWIG incorrectly included "enum " when
|
||||
// qualifying the emunerator name:
|
||||
|
||||
// #197
|
||||
%include <std_vector.i>
|
||||
%inline %{
|
||||
template<Enum17 E> class Bar {};
|
||||
%}
|
||||
%template(Enum17Vector) std::vector<Bar<Enum17::Val1>>;
|
||||
|
||||
// #675
|
||||
%template(Enum17Bar) Bar<Enum17::Val2>;
|
||||
%inline %{
|
||||
class SubEnum17Bar : public Bar<Enum17::Val2> {};
|
||||
%}
|
||||
|
||||
// #1677
|
||||
%inline %{
|
||||
#include <bitset>
|
||||
typedef std::bitset<static_cast<unsigned>(Enum17::Val1)> type1677;
|
||||
type1677 classify(int a) { return type1677{}; }
|
||||
bool has_type(const type1677&, const Enum17&) { return false; }
|
||||
%}
|
||||
|
||||
// #2047
|
||||
%feature("compactdefaultargs") MyClass::my_func;
|
||||
%inline %{
|
||||
class MyClass {
|
||||
public:
|
||||
enum class PRINT_SETUP { TO_CONSOLE, TO_CSV };
|
||||
void my_func(const PRINT_SETUP& e = PRINT_SETUP::TO_CONSOLE) { (void)e; }
|
||||
};
|
||||
%}
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
%module cpp11_strongly_typed_enumerations_perl_const
|
||||
|
||||
%include "cpp11_strongly_typed_enumerations.i"
|
|
@ -77,6 +77,13 @@ public class multiple_inheritance_interfaces_runme {
|
|||
checkBaseAndInterfaces(typeof(V), false, "S", new string[] {"IQ"});
|
||||
checkBaseAndInterfaces(typeof(W), false, "T", new string[] {"IQ"});
|
||||
|
||||
checkBaseAndInterfaces(typeof(IV1SwigInterface), true, "", new string[] {"IA"});
|
||||
checkBaseAndInterfaces(typeof(IV2SwigInterface), true, "", new string[] {"IA"});
|
||||
checkBaseAndInterfaces(typeof(IV1), false, "", new string[] {"IV1SwigInterface", "IA"});
|
||||
checkBaseAndInterfaces(typeof(IV2), false, "", new string[] {"IV2SwigInterface", "IA"});
|
||||
checkBaseAndInterfaces(typeof(V3), false, "", new string[] {"V3SwigInterface", "IV1SwigInterface", "IA", "IV2SwigInterface"});
|
||||
checkBaseAndInterfaces(typeof(V3SwigInterface), true, "", new string[] {"IA", "IV1SwigInterface", "IV2SwigInterface"});
|
||||
|
||||
// overloaded methods check
|
||||
D d = new D();
|
||||
d.ia();
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
int x /= 2;
|
|
@ -0,0 +1 @@
|
|||
c_unexpected_token.i:1: Error: Unexpected token '/='.
|
|
@ -0,0 +1 @@
|
|||
int x = a->*b;
|
|
@ -0,0 +1 @@
|
|||
cpp_unexpected_token.i:1: Error: Unexpected token '->*'.
|
|
@ -57,3 +57,7 @@ comment */
|
|||
// Bad octal escape sequences.
|
||||
%constant char * badbinstring = "\400";
|
||||
%constant char badbinchar = '\777';
|
||||
|
||||
// SWIG < 4.3.0 used to allow a bitfield width here, which makes no sense.
|
||||
%constant int colon_not_allowed : 3;
|
||||
%constant short (Funcs::*pmf)(bool) const : 1;
|
||||
|
|
|
@ -11,3 +11,5 @@ pp_constant.i:55: Error: Invalid digit '8' in octal constant
|
|||
pp_constant.i:55: Error: Invalid digit '8' in octal constant
|
||||
pp_constant.i:58: Error: octal escape sequence out of range
|
||||
pp_constant.i:59: Error: octal escape sequence out of range
|
||||
pp_constant.i:62: Warning 305: Bad constant value (ignored).
|
||||
pp_constant.i:63: Warning 305: Bad constant value (ignored).
|
||||
|
|
|
@ -130,3 +130,48 @@ namespace Space {
|
|||
};
|
||||
}
|
||||
%}
|
||||
|
||||
// Test additional interfaces - these are designed for non-C++ interfaces
|
||||
#if defined(SWIGJAVA) || defined(SWIGCSHARP)
|
||||
%interface_custom("Additional1", "IAdditional1", IAdditional1)
|
||||
#endif
|
||||
|
||||
#if defined(SWIGJAVA)
|
||||
%interface_additional("Additional2", "IAdditional2", "java.util.EventListener", IAdditional2)
|
||||
%interface_additional("Additional3", "IAdditional3", "java.util.EventListener", IAdditional3)
|
||||
#elif defined(SWIGCSHARP)
|
||||
%interface_additional("Additional2", "IAdditional2", "global::System.ICloneable", IAdditional2)
|
||||
%interface_additional("Additional3", "IAdditional3", "global::System.ICloneable", IAdditional3)
|
||||
%extend IAdditional2 {
|
||||
%proxycode %{
|
||||
public virtual object Clone() {
|
||||
return new Additional2(this);
|
||||
}
|
||||
%}
|
||||
}
|
||||
%extend IAdditional3 {
|
||||
%proxycode %{
|
||||
public virtual object Clone() {
|
||||
return new Additional3(this);
|
||||
}
|
||||
%}
|
||||
}
|
||||
%extend AdditionalConcrete {
|
||||
%proxycode %{
|
||||
public virtual object Clone() {
|
||||
return new AdditionalConcrete(this);
|
||||
}
|
||||
%}
|
||||
}
|
||||
#endif
|
||||
|
||||
%copyctor AdditionalConcrete;
|
||||
%copyctor IAdditional2;
|
||||
%copyctor IAdditional3;
|
||||
|
||||
%inline %{
|
||||
struct IAdditional1 { virtual ~IAdditional1() {} };
|
||||
struct IAdditional2 { virtual ~IAdditional2() {} };
|
||||
struct IAdditional3 : IAdditional1, IAdditional2 {};
|
||||
struct AdditionalConcrete : IAdditional1, IAdditional2 {};
|
||||
%}
|
||||
|
|
|
@ -23,6 +23,9 @@ CPP_TEST_CASES += \
|
|||
memberin1 \
|
||||
director_nestedmodule \
|
||||
|
||||
CPP11_TEST_CASES += \
|
||||
cpp11_strongly_typed_enumerations_perl_const
|
||||
|
||||
C_TEST_CASES += \
|
||||
li_cstring \
|
||||
li_cdata_carrays \
|
||||
|
@ -34,7 +37,7 @@ include $(srcdir)/../common.mk
|
|||
# none!
|
||||
|
||||
# Custom tests - tests with additional commandline options
|
||||
# none!
|
||||
cpp11_strongly_typed_enumerations_perl_const.cpptest: SWIGOPT += -const
|
||||
|
||||
# Rules for the different types of tests
|
||||
%.cpptest:
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 4;
|
||||
BEGIN { use_ok('cpp11_strongly_typed_enumerations_perl_const') }
|
||||
require_ok('cpp11_strongly_typed_enumerations_perl_const');
|
||||
|
||||
is(cpp11_strongly_typed_enumerations_perl_const::Enum18::Val1, 1181);
|
||||
is(cpp11_strongly_typed_enumerations_perl_const::Enum18::Val2, 1182);
|
|
@ -1,6 +1,6 @@
|
|||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 78;
|
||||
use Test::More tests => 80;
|
||||
BEGIN { use_ok('cpp11_strongly_typed_enumerations') }
|
||||
require_ok('cpp11_strongly_typed_enumerations');
|
||||
|
||||
|
@ -166,3 +166,5 @@ enumCheck(cpp11_strongly_typed_enumerations::globalTest1($cpp11_strongly_typed_e
|
|||
enumCheck(cpp11_strongly_typed_enumerations::globalTest2($cpp11_strongly_typed_enumerations::Class1::Enum12_Val5c), 1121);
|
||||
#enumCheck(cpp11_strongly_typed_enumerations::globalTest3($cpp11_strongly_typed_enumerations::Class1::Struct1::Enum12_Val5f), 3121);
|
||||
|
||||
$val = enumCheck($cpp11_strongly_typed_enumerations::Enum18_Val1, 1181);
|
||||
$val = enumCheck($cpp11_strongly_typed_enumerations::Enum18_Val2, 1182);
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
# Examples/xml/Makefile
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
top_builddir = @top_builddir@
|
||||
|
||||
SWIGEXE = $(top_builddir)/swig
|
||||
SWIG_LIB_DIR = $(top_srcdir)/Lib
|
||||
SWIG_LIB_SET = @SWIG_LIB_SET@
|
||||
SWIGINVOKE = $(SWIG_LIB_SET) $(SWIGTOOL) $(SWIGEXE)
|
||||
|
||||
cleanup = tail +2 \
|
||||
| sed -e 's/ident="ID[0-9A-F]*"//g' \
|
||||
-e 's,name="/[^"]*/\([^/]*\.swg\)",name="\1",g'
|
||||
|
||||
all-dot-i-files = \
|
||||
error.i \
|
||||
example.i \
|
||||
example_apply.i \
|
||||
example_const.i \
|
||||
example_gif.i \
|
||||
example_inl.i \
|
||||
example_p5.i \
|
||||
example_ro.i \
|
||||
example_title_add.i \
|
||||
example_xml.i \
|
||||
gnarly.i
|
||||
|
||||
check:
|
||||
for f in $(all-dot-i-files) ; do \
|
||||
base=`basename $$f .i` ; \
|
||||
xml=$$base.xml ; \
|
||||
$(SWIGINVOKE) -xml -o $$xml ${srcdir}/$$f ; \
|
||||
cat $$xml | $(cleanup) | diff -c ${srcdir}/$$base.expected-xml - ; \
|
||||
done
|
||||
|
||||
clean:
|
||||
rm -f *.xml
|
||||
|
||||
distclean: clean
|
||||
rm -f Makefile
|
||||
|
||||
# from here on, non-developers beware!
|
||||
|
||||
%.expected-xml : %.i
|
||||
$(SWIGINVOKE) -xml -o tmp-file.xml $^
|
||||
cat tmp-file.xml | $(cleanup) > $@
|
||||
rm -f tmp-file.xml
|
||||
|
||||
all-expected-xml:
|
||||
for f in $(all-dot-i-files) ; do \
|
||||
make `basename $$f .i`.expected-xml ; done
|
||||
|
||||
all-expected-xml-clean:
|
||||
rm -f *.expected-xml
|
||||
|
||||
# Examples/xml/Makefile ends here
|
|
@ -1,24 +0,0 @@
|
|||
<swigxml:swig name="namespaces" xmlns:swigxml="http://jniplusplus.sourceforge.net" xmlns:swig="http://swig.sourceforge.net" xmlns:c="http://www.ansi.org" >
|
||||
<swig:top >
|
||||
<swigxml:child >
|
||||
<swig:file name="../../Lib/swig.swg" >
|
||||
<swigxml:type string="include" />
|
||||
</swig:file>
|
||||
<swig:file name="error.i" >
|
||||
<swigxml:child >
|
||||
<swig:module name="error" />
|
||||
<c:enum >
|
||||
<swigxml:child >
|
||||
<c:enumvalue name="RED" >
|
||||
<swigxml:value string="RED" />
|
||||
</c:enumvalue>
|
||||
<c:enumvalue name="GREEN" />
|
||||
<c:enumvalue name="BLUE" />
|
||||
</swigxml:child>
|
||||
</c:enum>
|
||||
</swigxml:child>
|
||||
<swigxml:type string="include" />
|
||||
</swig:file>
|
||||
</swigxml:child>
|
||||
</swig:top>
|
||||
</swigxml:swig>
|
|
@ -1,2 +0,0 @@
|
|||
%module error
|
||||
enum { RED=10, GREEN, BLUE };
|
|
@ -1,23 +0,0 @@
|
|||
<swigxml:swig name="namespaces" xmlns:swigxml="http://jniplusplus.sourceforge.net" xmlns:swig="http://swig.sourceforge.net" xmlns:c="http://www.ansi.org" >
|
||||
<swig:top >
|
||||
<swigxml:child >
|
||||
<swig:file name="../../Lib/swig.swg" >
|
||||
<swigxml:type string="include" />
|
||||
</swig:file>
|
||||
<swig:file name="example.i" >
|
||||
<swigxml:child >
|
||||
<swig:module name="example" />
|
||||
<swig:apply name="OUTPUT" >
|
||||
<swigxml:parms >
|
||||
<swigxml:none name="r" >
|
||||
<swigxml:type string="p.int" />
|
||||
</swigxml:none>
|
||||
</swigxml:parms>
|
||||
<swigxml:type string="p.int" />
|
||||
</swig:apply>
|
||||
</swigxml:child>
|
||||
<swigxml:type string="include" />
|
||||
</swig:file>
|
||||
</swigxml:child>
|
||||
</swig:top>
|
||||
</swigxml:swig>
|
|
@ -1,3 +0,0 @@
|
|||
// i add this file because it's referenced by other files.
|
||||
// someone should replace these comments w/ proper content.
|
||||
// --ttn, 2001/01/16 17:44:19
|
|
@ -1,8 +0,0 @@
|
|||
/* File : example.i */
|
||||
%module example
|
||||
|
||||
%apply int *OUTPUT { int *r };
|
||||
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -1,23 +0,0 @@
|
|||
/* File : example.i */
|
||||
%module example
|
||||
|
||||
/* This example illustrates a couple of different techniques
|
||||
for manipulating C pointers */
|
||||
|
||||
/* First we'll use the pointer library */
|
||||
extern void add(int *x, int *y, int *result);
|
||||
%include cpointer.i
|
||||
|
||||
/* Next we'll use some typemaps */
|
||||
|
||||
%include typemaps.i
|
||||
extern void sub(int *INPUT, int *INPUT, int *OUTPUT);
|
||||
|
||||
/* Next we'll use typemaps and the %apply directive */
|
||||
|
||||
%apply int *OUTPUT { int *r };
|
||||
extern int divide(int n, int d, int *r);
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
<swigxml:swig name="namespaces" xmlns:swigxml="http://jniplusplus.sourceforge.net" xmlns:swig="http://swig.sourceforge.net" xmlns:c="http://www.ansi.org" >
|
||||
<swig:top >
|
||||
<swigxml:child >
|
||||
<swig:file name="../../Lib/swig.swg" >
|
||||
<swigxml:type string="include" />
|
||||
</swig:file>
|
||||
<swig:file name="example_const.i" >
|
||||
<swigxml:child >
|
||||
<swig:module name="example" />
|
||||
<swig:constant name="ICONST" >
|
||||
<swigxml:value string="42" />
|
||||
<swigxml:type string="int" />
|
||||
</swig:constant>
|
||||
<swig:constant name="FCONST" >
|
||||
<swigxml:value string="2.1828" />
|
||||
<swigxml:type string="double" />
|
||||
</swig:constant>
|
||||
<swig:constant name="CCONST" >
|
||||
<swigxml:value string="x" />
|
||||
<swigxml:type string="char" />
|
||||
</swig:constant>
|
||||
<swig:constant name="CCONST2" >
|
||||
<swigxml:value string="\n" />
|
||||
<swigxml:type string="char" />
|
||||
</swig:constant>
|
||||
<swig:constant name="SCONST" >
|
||||
<swigxml:value string="Hello World" />
|
||||
<swigxml:type string="p.char" />
|
||||
</swig:constant>
|
||||
<swig:constant name="SCONST2" >
|
||||
<swigxml:value string="\"Hello World\"" />
|
||||
<swigxml:type string="p.char" />
|
||||
</swig:constant>
|
||||
<swig:constant name="EXPR" >
|
||||
<swigxml:value string="42+3*(2.1828)" />
|
||||
<swigxml:type string="double" />
|
||||
</swig:constant>
|
||||
<c:variable name="iconst" >
|
||||
<swigxml:value string="37" />
|
||||
<swigxml:type string="q(const).int" />
|
||||
</c:variable>
|
||||
<c:variable name="fconst" >
|
||||
<swigxml:value string="3.14" />
|
||||
<swigxml:type string="q(const).double" />
|
||||
</c:variable>
|
||||
</swigxml:child>
|
||||
<swigxml:type string="include" />
|
||||
</swig:file>
|
||||
</swigxml:child>
|
||||
</swig:top>
|
||||
</swigxml:swig>
|
|
@ -1,26 +0,0 @@
|
|||
/* File : example.i */
|
||||
%module example
|
||||
|
||||
/* A few preprocessor macros */
|
||||
|
||||
#define ICONST 42
|
||||
#define FCONST 2.1828
|
||||
#define CCONST 'x'
|
||||
#define CCONST2 '\n'
|
||||
#define SCONST "Hello World"
|
||||
#define SCONST2 "\"Hello World\""
|
||||
|
||||
/* This should work just fine */
|
||||
#define EXPR ICONST + 3*(FCONST)
|
||||
|
||||
/* This shouldn't do anything */
|
||||
#define EXTERN extern
|
||||
|
||||
/* Neither should this (BAR isn't defined) */
|
||||
#define FOO (ICONST + BAR)
|
||||
|
||||
/* The following statements also produce constants */
|
||||
const int iconst = 37;
|
||||
const double fconst = 3.14;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -1,104 +0,0 @@
|
|||
<swigxml:swig name="namespaces" xmlns:swigxml="http://jniplusplus.sourceforge.net" xmlns:swig="http://swig.sourceforge.net" xmlns:c="http://www.ansi.org" >
|
||||
<swig:top >
|
||||
<swigxml:child >
|
||||
<swig:file name="../../Lib/swig.swg" >
|
||||
<swigxml:type string="include" />
|
||||
</swig:file>
|
||||
<swig:file name="example_inl.i" >
|
||||
<swigxml:child >
|
||||
<swig:module name="example" />
|
||||
<swig:insert >
|
||||
<swigxml:code >
|
||||
|
||||
#include "example.h"
|
||||
</swigxml:code>
|
||||
</swig:insert>
|
||||
<c:function name="dot_product" >
|
||||
<swigxml:parms >
|
||||
<swigxml:parm name="a" >
|
||||
<swigxml:type string="Vector" />
|
||||
</swigxml:parm>
|
||||
<swigxml:parm name="b" >
|
||||
<swigxml:type string="Vector" />
|
||||
</swigxml:parm>
|
||||
</swigxml:parms>
|
||||
<swigxml:storage string="extern" />
|
||||
<swigxml:type string="double" />
|
||||
</c:function>
|
||||
<c:function name="vector_add" >
|
||||
<swigxml:parms >
|
||||
<swigxml:parm name="a" >
|
||||
<swigxml:type string="Vector" />
|
||||
</swigxml:parm>
|
||||
<swigxml:parm name="b" >
|
||||
<swigxml:type string="Vector" />
|
||||
</swigxml:parm>
|
||||
</swigxml:parms>
|
||||
<swigxml:storage string="extern" />
|
||||
<swigxml:type string="Vector" />
|
||||
</c:function>
|
||||
<c:function name="free" >
|
||||
<swigxml:parms >
|
||||
<swigxml:parm >
|
||||
<swigxml:type string="p.void" />
|
||||
</swigxml:parm>
|
||||
</swigxml:parms>
|
||||
<swigxml:type string="void" />
|
||||
</c:function>
|
||||
<swig:insert >
|
||||
<swigxml:code >
|
||||
|
||||
|
||||
Vector *new_Vector(double x, double y, double z) {
|
||||
Vector *v = (Vector *) malloc(sizeof(Vector));
|
||||
v->x = x;
|
||||
v->y = y;
|
||||
v->z = z;
|
||||
return v;
|
||||
}
|
||||
|
||||
void vector_print(Vector *v) {
|
||||
printf("Vector %x = (%g, %g, %g)\n", v, v->x, v->y, v->z);
|
||||
}
|
||||
</swigxml:code>
|
||||
</swig:insert>
|
||||
<c:function name="new_Vector" >
|
||||
<swigxml:parms >
|
||||
<swigxml:parm name="x" >
|
||||
<swigxml:type string="double" />
|
||||
</swigxml:parm>
|
||||
<swigxml:parm name="y" >
|
||||
<swigxml:type string="double" />
|
||||
</swigxml:parm>
|
||||
<swigxml:parm name="z" >
|
||||
<swigxml:type string="double" />
|
||||
</swigxml:parm>
|
||||
</swigxml:parms>
|
||||
<swigxml:code >
|
||||
{
|
||||
Vector *v = (Vector *) malloc(sizeof(Vector));
|
||||
v->x = x;
|
||||
v->y = y;
|
||||
v->z = z;
|
||||
return v;
|
||||
} </swigxml:code>
|
||||
<swigxml:type string="p.Vector" />
|
||||
</c:function>
|
||||
<c:function name="vector_print" >
|
||||
<swigxml:parms >
|
||||
<swigxml:parm name="v" >
|
||||
<swigxml:type string="p.Vector" />
|
||||
</swigxml:parm>
|
||||
</swigxml:parms>
|
||||
<swigxml:code >
|
||||
{
|
||||
printf("Vector %x = (%g, %g, %g)\n", v, v->x, v->y, v->z);
|
||||
} </swigxml:code>
|
||||
<swigxml:type string="void" />
|
||||
</c:function>
|
||||
</swigxml:child>
|
||||
<swigxml:type string="include" />
|
||||
</swig:file>
|
||||
</swigxml:child>
|
||||
</swig:top>
|
||||
</swigxml:swig>
|
|
@ -1,5 +0,0 @@
|
|||
/* File : example.h */
|
||||
|
||||
typedef struct {
|
||||
double x, y, z;
|
||||
} Vector;
|
|
@ -1,30 +0,0 @@
|
|||
// Tests SWIG's handling of pass-by-value for complex datatypes
|
||||
%module example
|
||||
|
||||
%{
|
||||
#include "example.h"
|
||||
%}
|
||||
|
||||
/* Some functions that manipulate Vectors by value */
|
||||
extern double dot_product(Vector a, Vector b);
|
||||
extern Vector vector_add(Vector a, Vector b);
|
||||
|
||||
/* Include this because the vector_add() function will leak memory */
|
||||
void free(void *);
|
||||
|
||||
/* Some helper functions for our interface */
|
||||
%inline %{
|
||||
|
||||
Vector *new_Vector(double x, double y, double z) {
|
||||
Vector *v = (Vector *) malloc(sizeof(Vector));
|
||||
v->x = x;
|
||||
v->y = y;
|
||||
v->z = z;
|
||||
return v;
|
||||
}
|
||||
|
||||
void vector_print(Vector *v) {
|
||||
printf("Vector %p = (%g, %g, %g)\n", v, v->x, v->y, v->z);
|
||||
}
|
||||
%}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
<swigxml:swig name="namespaces" xmlns:swigxml="http://jniplusplus.sourceforge.net" xmlns:swig="http://swig.sourceforge.net" xmlns:c="http://www.ansi.org" >
|
||||
<swig:top >
|
||||
<swigxml:child >
|
||||
<swig:file name="../../Lib/swig.swg" >
|
||||
<swigxml:type string="include" />
|
||||
</swig:file>
|
||||
<swig:file name="example_p5.i" >
|
||||
<swigxml:child >
|
||||
<swig:module name="example" />
|
||||
<swig:insert >
|
||||
<swigxml:code >
|
||||
|
||||
#include "example.h"
|
||||
</swigxml:code>
|
||||
</swig:insert>
|
||||
<swig:file name="example.h" >
|
||||
<swigxml:type string="include" />
|
||||
</swig:file>
|
||||
</swigxml:child>
|
||||
<swigxml:type string="include" />
|
||||
</swig:file>
|
||||
</swigxml:child>
|
||||
</swig:top>
|
||||
</swigxml:swig>
|
|
@ -1,11 +0,0 @@
|
|||
/* File : example.i */
|
||||
%module example
|
||||
|
||||
%{
|
||||
#include "example.h"
|
||||
%}
|
||||
|
||||
/* Let's just grab the original header file here */
|
||||
|
||||
%include "example.h"
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
<swigxml:swig name="namespaces" xmlns:swigxml="http://jniplusplus.sourceforge.net" xmlns:swig="http://swig.sourceforge.net" xmlns:c="http://www.ansi.org" >
|
||||
<swig:top >
|
||||
<swigxml:child >
|
||||
<swig:file name="../../Lib/swig.swg" >
|
||||
<swigxml:type string="include" />
|
||||
</swig:file>
|
||||
<swig:file name="example_ro.i" >
|
||||
<swigxml:child >
|
||||
<swig:pragma name="readonly" />
|
||||
<c:variable name="status" >
|
||||
<swigxml:storage string="extern" />
|
||||
<swigxml:type string="int" />
|
||||
</c:variable>
|
||||
<c:variable name="path" >
|
||||
<swigxml:storage string="extern" />
|
||||
<swigxml:type string="a(256).char" />
|
||||
</c:variable>
|
||||
</swigxml:child>
|
||||
<swigxml:type string="include" />
|
||||
</swig:file>
|
||||
</swigxml:child>
|
||||
</swig:top>
|
||||
</swigxml:swig>
|
|
@ -1,6 +0,0 @@
|
|||
/* File : example.i */
|
||||
%immutable;
|
||||
extern int status;
|
||||
extern char path[256];
|
||||
|
||||
|
|
@ -1,119 +0,0 @@
|
|||
<swigxml:swig name="namespaces" xmlns:swigxml="http://jniplusplus.sourceforge.net" xmlns:swig="http://swig.sourceforge.net" xmlns:c="http://www.ansi.org" >
|
||||
<swig:top >
|
||||
<swigxml:child >
|
||||
<swig:file name="../../Lib/swig.swg" >
|
||||
<swigxml:type string="include" />
|
||||
</swig:file>
|
||||
<swig:file name="example_title_add.i" >
|
||||
<swigxml:child >
|
||||
<swig:module name="example" />
|
||||
<swig:insert >
|
||||
<swigxml:code >
|
||||
|
||||
#include "example.h"
|
||||
</swigxml:code>
|
||||
</swig:insert>
|
||||
<c:class name="Vector" >
|
||||
<swigxml:child >
|
||||
<c:access name="public" />
|
||||
<c:function name="Vector" >
|
||||
<swigxml:parms >
|
||||
<swigxml:parm name="x" >
|
||||
<swigxml:type string="double" />
|
||||
</swigxml:parm>
|
||||
<swigxml:parm name="y" >
|
||||
<swigxml:type string="double" />
|
||||
</swigxml:parm>
|
||||
<swigxml:parm name="z" >
|
||||
<swigxml:type string="double" />
|
||||
</swigxml:parm>
|
||||
</swigxml:parms>
|
||||
<swigxml:type string="int" />
|
||||
</c:function>
|
||||
<c:destructor name="Vector" />
|
||||
<c:function name="print" >
|
||||
<swigxml:type string="p.char" />
|
||||
</c:function>
|
||||
</swigxml:child>
|
||||
<swigxml:classtype string="class" />
|
||||
<swigxml:namespace string="Vector" />
|
||||
</c:class>
|
||||
<swig:insert >
|
||||
<swigxml:code >
|
||||
|
||||
Vector addv(Vector &a, Vector &b) {
|
||||
return a+b;
|
||||
}
|
||||
</swigxml:code>
|
||||
</swig:insert>
|
||||
<c:function name="addv" >
|
||||
<swigxml:parms >
|
||||
<swigxml:parm name="a" >
|
||||
<swigxml:type string="r.Vector" />
|
||||
</swigxml:parm>
|
||||
<swigxml:parm name="b" >
|
||||
<swigxml:type string="r.Vector" />
|
||||
</swigxml:parm>
|
||||
</swigxml:parms>
|
||||
<swigxml:code >
|
||||
{
|
||||
return a+b;
|
||||
} </swigxml:code>
|
||||
<swigxml:type string="Vector" />
|
||||
</c:function>
|
||||
<c:class name="VectorArray" >
|
||||
<swigxml:child >
|
||||
<c:access name="public" />
|
||||
<c:function name="VectorArray" >
|
||||
<swigxml:parms >
|
||||
<swigxml:parm name="maxsize" >
|
||||
<swigxml:type string="int" />
|
||||
</swigxml:parm>
|
||||
</swigxml:parms>
|
||||
<swigxml:type string="int" />
|
||||
</c:function>
|
||||
<c:destructor name="VectorArray" />
|
||||
<c:function name="size" >
|
||||
<swigxml:type string="int" />
|
||||
</c:function>
|
||||
<swig:extend >
|
||||
<swigxml:child >
|
||||
<c:function name="get" >
|
||||
<swigxml:parms >
|
||||
<swigxml:parm name="index" >
|
||||
<swigxml:type string="int" />
|
||||
</swigxml:parm>
|
||||
</swigxml:parms>
|
||||
<swigxml:code >
|
||||
{
|
||||
return (*self)[index];
|
||||
} </swigxml:code>
|
||||
<swigxml:type string="r.Vector" />
|
||||
</c:function>
|
||||
<c:function name="set" >
|
||||
<swigxml:parms >
|
||||
<swigxml:parm name="index" >
|
||||
<swigxml:type string="int" />
|
||||
</swigxml:parm>
|
||||
<swigxml:parm name="a" >
|
||||
<swigxml:type string="r.Vector" />
|
||||
</swigxml:parm>
|
||||
</swigxml:parms>
|
||||
<swigxml:code >
|
||||
{
|
||||
(*self)[index] = a;
|
||||
} </swigxml:code>
|
||||
<swigxml:type string="void" />
|
||||
</c:function>
|
||||
</swigxml:child>
|
||||
</swig:extend>
|
||||
</swigxml:child>
|
||||
<swigxml:classtype string="class" />
|
||||
<swigxml:namespace string="VectorArray" />
|
||||
</c:class>
|
||||
</swigxml:child>
|
||||
<swigxml:type string="include" />
|
||||
</swig:file>
|
||||
</swigxml:child>
|
||||
</swig:top>
|
||||
</swigxml:swig>
|
|
@ -1,47 +0,0 @@
|
|||
/* File : example.i */
|
||||
/* Matrix and vector package */
|
||||
|
||||
/* This file has a few "typical" uses of C++ references. */
|
||||
|
||||
%module example
|
||||
|
||||
%{
|
||||
#include "example.h"
|
||||
%}
|
||||
|
||||
class Vector {
|
||||
public:
|
||||
Vector(double x, double y, double z);
|
||||
~Vector();
|
||||
char *print();
|
||||
};
|
||||
|
||||
/* This helper function calls an overloaded operator */
|
||||
%inline %{
|
||||
Vector addv(Vector &a, Vector &b) {
|
||||
return a+b;
|
||||
}
|
||||
%}
|
||||
|
||||
/* Wrapper around an array of vectors class */
|
||||
|
||||
class VectorArray {
|
||||
public:
|
||||
VectorArray(int maxsize);
|
||||
~VectorArray();
|
||||
int size();
|
||||
|
||||
/* This wrapper provides an alternative to the [] operator */
|
||||
%extend {
|
||||
Vector &get(int index) {
|
||||
return (*self)[index];
|
||||
}
|
||||
void set(int index, Vector &a) {
|
||||
(*self)[index] = a;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -1,39 +0,0 @@
|
|||
/* File : example.h */
|
||||
|
||||
class Shape {
|
||||
public:
|
||||
Shape() {
|
||||
nshapes++;
|
||||
}
|
||||
virtual ~Shape() {
|
||||
nshapes--;
|
||||
};
|
||||
double x, y;
|
||||
void move(double dx, double dy);
|
||||
virtual double area() = 0;
|
||||
virtual double perimeter() = 0;
|
||||
static int nshapes;
|
||||
};
|
||||
|
||||
class Circle : public Shape {
|
||||
private:
|
||||
double radius;
|
||||
public:
|
||||
Circle(double r) : radius(r) { };
|
||||
virtual double area();
|
||||
virtual double perimeter();
|
||||
};
|
||||
|
||||
class Square : public Shape {
|
||||
private:
|
||||
double width;
|
||||
public:
|
||||
Square(double w) : width(w) { };
|
||||
virtual double area();
|
||||
virtual double perimeter();
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
/* File : example.i */
|
||||
%module my_example
|
||||
|
||||
enum color { RED=10, BLUE, GREEN };
|
||||
|
||||
class Foo {
|
||||
public:
|
||||
Foo() { }
|
||||
enum speed { IMPULSE, WARP, LUDICROUS };
|
||||
void enum_test(speed s);
|
||||
};
|
||||
|
||||
void enum_test(color c, Foo::speed s);
|
||||
|
||||
|
||||
|
||||
%include cpointer.i
|
||||
|
||||
/* Next we'll use some typemaps */
|
||||
|
||||
%include typemaps.i
|
||||
|
||||
%typemap(out) int * {
|
||||
WHATEVER MAKES YOU HAPPY AS RESULT
|
||||
}
|
||||
|
||||
%typemap(in) int * {
|
||||
WHATEVER MAKES YOU HAPPY AS PARAMETER
|
||||
}
|
||||
|
||||
%pragma(xml) DEBUG="false";
|
||||
|
||||
extern int * my_gcd(const char * x, int * y[], int * r, int (*op)(int,int)) const;
|
||||
extern double my_foo;
|
||||
void my_void();
|
||||
my_empty();
|
||||
|
||||
const double my_dutch = 1.0;
|
||||
|
||||
union my_union
|
||||
{
|
||||
int my_iii;
|
||||
char my_ccc;
|
||||
};
|
||||
|
||||
struct my_struct
|
||||
{
|
||||
public:
|
||||
virtual ~my_struct();
|
||||
int my_foo();
|
||||
protected:
|
||||
int my_bar;
|
||||
double x, y;
|
||||
virtual double area() = 0;
|
||||
static int nshapes;
|
||||
};
|
||||
|
||||
class my_class : public my_struct, public my_union
|
||||
{
|
||||
public:
|
||||
my_class( char c );
|
||||
private:
|
||||
~my_class();
|
||||
virtual const int * my_func( my_class , char * * x, int y[], const int & r) const;
|
||||
double my_foo[128];
|
||||
const my_int i;
|
||||
};
|
||||
|
||||
typedef int my_int;
|
|
@ -1,206 +0,0 @@
|
|||
<swigxml:swig name="namespaces" xmlns:swigxml="http://jniplusplus.sourceforge.net" xmlns:swig="http://swig.sourceforge.net" xmlns:c="http://www.ansi.org" >
|
||||
<swig:top >
|
||||
<swigxml:child >
|
||||
<swig:file name="../../Lib/swig.swg" >
|
||||
<swigxml:type string="include" />
|
||||
</swig:file>
|
||||
<swig:file name="gnarly.i" >
|
||||
<swigxml:child >
|
||||
<swig:module name="my_check" />
|
||||
<c:enum name="color" >
|
||||
<swigxml:child >
|
||||
<c:enumvalue name="RED" >
|
||||
<swigxml:value string="RED" />
|
||||
</c:enumvalue>
|
||||
<c:enumvalue name="BLUE" />
|
||||
<c:enumvalue name="GREEN" />
|
||||
</swigxml:child>
|
||||
</c:enum>
|
||||
<c:class name="Foo" >
|
||||
<swigxml:child >
|
||||
<c:access name="public" />
|
||||
<c:function name="Foo" >
|
||||
<swigxml:code >
|
||||
{ } </swigxml:code>
|
||||
<swigxml:type string="int" />
|
||||
</c:function>
|
||||
<c:enum name="speed" >
|
||||
<swigxml:child >
|
||||
<c:enumvalue name="IMPULSE" />
|
||||
<c:enumvalue name="WARP" />
|
||||
<c:enumvalue name="LUDICROUS" />
|
||||
</swigxml:child>
|
||||
</c:enum>
|
||||
<c:function name="enum_test" >
|
||||
<swigxml:parms >
|
||||
<swigxml:parm name="s" >
|
||||
<swigxml:type string="speed" />
|
||||
</swigxml:parm>
|
||||
</swigxml:parms>
|
||||
<swigxml:type string="void" />
|
||||
</c:function>
|
||||
</swigxml:child>
|
||||
<swigxml:classtype string="class" />
|
||||
<swigxml:namespace string="Foo" />
|
||||
</c:class>
|
||||
<c:function name="enum_test" >
|
||||
<swigxml:parms >
|
||||
<swigxml:parm name="c" >
|
||||
<swigxml:type string="color" />
|
||||
</swigxml:parm>
|
||||
<swigxml:parm name="s" >
|
||||
<swigxml:type string="Foo::speed" />
|
||||
</swigxml:parm>
|
||||
</swigxml:parms>
|
||||
<swigxml:type string="void" />
|
||||
</c:function>
|
||||
<swig:typemap >
|
||||
<swigxml:code >
|
||||
{
|
||||
WHATEVER MAKES YOU HAPPY AS RESULT
|
||||
} </swigxml:code>
|
||||
<swigxml:method string="out" />
|
||||
<swigxml:type string="p.int" />
|
||||
</swig:typemap>
|
||||
<swig:typemap >
|
||||
<swigxml:code >
|
||||
{
|
||||
WHATEVER MAKES YOU HAPPY AS PARAMETER
|
||||
} </swigxml:code>
|
||||
<swigxml:method string="in" />
|
||||
<swigxml:type string="p.int" />
|
||||
</swig:typemap>
|
||||
<swig:pragma name="DEBUG" >
|
||||
<swigxml:value string="false" />
|
||||
<swigxml:lang string="xml" />
|
||||
</swig:pragma>
|
||||
<c:function name="my_gcd" >
|
||||
<swigxml:parms >
|
||||
<swigxml:parm name="x" >
|
||||
<swigxml:type string="p.q(const).char" />
|
||||
</swigxml:parm>
|
||||
<swigxml:parm name="y" >
|
||||
<swigxml:type string="a().p.int" />
|
||||
</swigxml:parm>
|
||||
<swigxml:parm name="r" >
|
||||
<swigxml:type string="p.int" />
|
||||
</swigxml:parm>
|
||||
<swigxml:parm name="op" >
|
||||
<swigxml:type string="p.f(int,int).int" />
|
||||
</swigxml:parm>
|
||||
</swigxml:parms>
|
||||
<swigxml:storage string="extern" />
|
||||
<swigxml:type string="p.int" />
|
||||
</c:function>
|
||||
<c:variable name="my_foo" >
|
||||
<swigxml:storage string="extern" />
|
||||
<swigxml:type string="double" />
|
||||
</c:variable>
|
||||
<c:function name="my_void" >
|
||||
<swigxml:type string="void" />
|
||||
</c:function>
|
||||
<c:function name="my_empty" >
|
||||
<swigxml:type string="int" />
|
||||
</c:function>
|
||||
<c:variable name="my_dutch" >
|
||||
<swigxml:value string="1.0" />
|
||||
<swigxml:type string="q(const).double" />
|
||||
</c:variable>
|
||||
<c:class name="my_union" >
|
||||
<swigxml:child >
|
||||
<c:variable name="my_iii" >
|
||||
<swigxml:type string="int" />
|
||||
</c:variable>
|
||||
<c:variable name="my_ccc" >
|
||||
<swigxml:type string="char" />
|
||||
</c:variable>
|
||||
</swigxml:child>
|
||||
<swigxml:classtype string="union" />
|
||||
<swigxml:namespace string="my_union" />
|
||||
</c:class>
|
||||
<c:class name="my_struct" >
|
||||
<swigxml:child >
|
||||
<c:access name="public" />
|
||||
<c:destructor name="my_struct" >
|
||||
<swigxml:storage string="virtual" />
|
||||
</c:destructor>
|
||||
<c:function name="my_foo" >
|
||||
<swigxml:type string="int" />
|
||||
</c:function>
|
||||
<c:access name="protected" />
|
||||
<c:variable name="my_bar" >
|
||||
<swigxml:type string="int" />
|
||||
</c:variable>
|
||||
<c:variable name="x" >
|
||||
<swigxml:type string="double" />
|
||||
</c:variable>
|
||||
<c:variable name="y" >
|
||||
<swigxml:type string="double" />
|
||||
</c:variable>
|
||||
<c:function name="area" >
|
||||
<swigxml:abstract string="1" />
|
||||
<swigxml:storage string="virtual" />
|
||||
<swigxml:type string="double" />
|
||||
</c:function>
|
||||
<c:variable name="nshapes" >
|
||||
<swigxml:storage string="static" />
|
||||
<swigxml:type string="int" />
|
||||
</c:variable>
|
||||
</swigxml:child>
|
||||
<swigxml:classtype string="struct" />
|
||||
<swigxml:namespace string="my_struct" />
|
||||
</c:class>
|
||||
<c:class name="my_class" >
|
||||
<swigxml:child >
|
||||
<c:access name="public" />
|
||||
<c:function name="my_class" >
|
||||
<swigxml:parms >
|
||||
<swigxml:parm name="c" >
|
||||
<swigxml:type string="char" />
|
||||
</swigxml:parm>
|
||||
</swigxml:parms>
|
||||
<swigxml:type string="int" />
|
||||
</c:function>
|
||||
<c:access name="private" />
|
||||
<c:destructor name="my_class" />
|
||||
<c:function name="my_func" >
|
||||
<swigxml:parms >
|
||||
<swigxml:parm >
|
||||
<swigxml:type string="my_class" />
|
||||
</swigxml:parm>
|
||||
<swigxml:parm name="x" >
|
||||
<swigxml:type string="p.p.char" />
|
||||
</swigxml:parm>
|
||||
<swigxml:parm name="y" >
|
||||
<swigxml:type string="a().int" />
|
||||
</swigxml:parm>
|
||||
<swigxml:parm name="r" >
|
||||
<swigxml:type string="r.q(const).int" />
|
||||
</swigxml:parm>
|
||||
</swigxml:parms>
|
||||
<swigxml:storage string="virtual" />
|
||||
<swigxml:type string="p.q(const).int" />
|
||||
</c:function>
|
||||
<c:variable name="my_foo" >
|
||||
<swigxml:type string="a(128).double" />
|
||||
</c:variable>
|
||||
<c:variable name="i" >
|
||||
<swigxml:type string="q(const).my_int" />
|
||||
</c:variable>
|
||||
</swigxml:child>
|
||||
<swigxml:classtype string="class" />
|
||||
<swigxml:bases >
|
||||
<swigxml:item name="my_struct" />
|
||||
<swigxml:item name="my_union" />
|
||||
</swigxml:bases>
|
||||
<swigxml:namespace string="my_class" />
|
||||
</c:class>
|
||||
<c:typedef name="my_int" >
|
||||
<swigxml:type string="int" />
|
||||
</c:typedef>
|
||||
</swigxml:child>
|
||||
<swigxml:type string="include" />
|
||||
</swig:file>
|
||||
</swigxml:child>
|
||||
</swig:top>
|
||||
</swigxml:swig>
|
|
@ -1,63 +0,0 @@
|
|||
/* File : check.i */
|
||||
%module my_check
|
||||
|
||||
enum color { RED=10, BLUE, GREEN };
|
||||
|
||||
class Foo {
|
||||
public:
|
||||
Foo() { }
|
||||
enum speed { IMPULSE, WARP, LUDICROUS };
|
||||
void enum_test(speed s);
|
||||
};
|
||||
|
||||
void enum_test(color c, Foo::speed s);
|
||||
|
||||
|
||||
|
||||
%typemap(out) int * {
|
||||
WHATEVER MAKES YOU HAPPY AS RESULT
|
||||
}
|
||||
|
||||
%typemap(in) int * {
|
||||
WHATEVER MAKES YOU HAPPY AS PARAMETER
|
||||
}
|
||||
|
||||
%pragma(xml) DEBUG="false";
|
||||
|
||||
extern int * my_gcd(const char * x, int * y[], int * r, int (*op)(int,int)) const;
|
||||
extern double my_foo;
|
||||
void my_void();
|
||||
my_empty();
|
||||
|
||||
const double my_dutch = 1.0;
|
||||
|
||||
union my_union
|
||||
{
|
||||
int my_iii;
|
||||
char my_ccc;
|
||||
};
|
||||
|
||||
struct my_struct
|
||||
{
|
||||
public:
|
||||
virtual ~my_struct();
|
||||
int my_foo();
|
||||
protected:
|
||||
int my_bar;
|
||||
double x, y;
|
||||
virtual double area() = 0;
|
||||
static int nshapes;
|
||||
};
|
||||
|
||||
class my_class : public my_struct, public my_union
|
||||
{
|
||||
public:
|
||||
my_class( char c );
|
||||
private:
|
||||
~my_class();
|
||||
virtual const int * my_func( my_class , char * * x, int y[], const int & r) const;
|
||||
double my_foo[128];
|
||||
const my_int i;
|
||||
};
|
||||
|
||||
typedef int my_int;
|
|
@ -61,3 +61,8 @@ INTERFACE_TYPEMAPS(CTYPE)
|
|||
INTERFACE_TYPEMAPS(CTYPE)
|
||||
%enddef
|
||||
|
||||
%define %interface_additional(PROXY, INTERFACE, ADDITIONAL, CTYPE...)
|
||||
%rename(PROXY) CTYPE;
|
||||
%feature("interface", name=INTERFACE, additional=ADDITIONAL) CTYPE;
|
||||
INTERFACE_TYPEMAPS(CTYPE)
|
||||
%enddef
|
||||
|
|
|
@ -72,3 +72,8 @@ INTERFACE_TYPEMAPS(CTYPE)
|
|||
INTERFACE_TYPEMAPS(CTYPE)
|
||||
%enddef
|
||||
|
||||
%define %interface_additional(PROXY, INTERFACE, ADDITIONAL, CTYPE...)
|
||||
%rename(PROXY) CTYPE;
|
||||
%feature("interface", name=INTERFACE, additional=ADDITIONAL) CTYPE;
|
||||
INTERFACE_TYPEMAPS(CTYPE)
|
||||
%enddef
|
||||
|
|
|
@ -14,6 +14,11 @@ extern "C" {
|
|||
# error These bindings need PHP 8 or later - to generate PHP7 bindings use SWIG < 4.1.0; to generate PHP5 bindings use: SWIG < 4.0.0 and swig -php5
|
||||
#endif
|
||||
|
||||
/* For PHP 8.0 */
|
||||
#ifndef ZSTR_INIT_LITERAL
|
||||
# define ZSTR_INIT_LITERAL(S, P) zend_string_init((S), strlen(S), (P))
|
||||
#endif
|
||||
|
||||
#include "zend_inheritance.h"
|
||||
#include "zend_exceptions.h"
|
||||
#include "zend_inheritance.h"
|
||||
|
|
|
@ -115,11 +115,6 @@
|
|||
#define %nocallback %feature("callback","0")
|
||||
#define %clearcallback %feature("callback","")
|
||||
|
||||
/* the %nestedworkaround directive (deprecated) */
|
||||
#define %nestedworkaround %feature("nestedworkaround")
|
||||
#define %nonestedworkaround %feature("nestedworkaround","0")
|
||||
#define %clearnestedworkaround %feature("nestedworkaround","")
|
||||
|
||||
/* the %flatnested directive */
|
||||
#define %flatnested %feature("flatnested")
|
||||
#define %noflatnested %feature("flatnested","0")
|
||||
|
|
|
@ -43,6 +43,11 @@ int cparse_cplusplusout = 0;
|
|||
/* To allow better error reporting */
|
||||
String *cparse_unknown_directive = 0;
|
||||
|
||||
// Default-initialised instances of token types to avoid uninitialised fields.
|
||||
// The compiler will initialise all fields to zero or NULL for us.
|
||||
|
||||
static const struct Define default_dtype;
|
||||
|
||||
/* Private vars */
|
||||
static int scan_init = 0;
|
||||
static int num_brace = 0;
|
||||
|
@ -536,8 +541,8 @@ static int yylook(void) {
|
|||
case SWIG_TOKEN_BACKSLASH:
|
||||
break;
|
||||
default:
|
||||
Swig_error(cparse_file, cparse_line, "Illegal token '%s'.\n", Scanner_text(scan));
|
||||
return (ILLEGAL);
|
||||
Swig_error(cparse_file, cparse_line, "Unexpected token '%s'.\n", Scanner_text(scan));
|
||||
Exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -614,39 +619,46 @@ int yylex(void) {
|
|||
switch (l) {
|
||||
|
||||
case NUM_INT:
|
||||
yylval.dtype = default_dtype;
|
||||
yylval.dtype.type = T_INT;
|
||||
goto num_common;
|
||||
case NUM_DOUBLE:
|
||||
yylval.dtype = default_dtype;
|
||||
yylval.dtype.type = T_DOUBLE;
|
||||
goto num_common;
|
||||
case NUM_FLOAT:
|
||||
yylval.dtype = default_dtype;
|
||||
yylval.dtype.type = T_FLOAT;
|
||||
goto num_common;
|
||||
case NUM_LONGDOUBLE:
|
||||
yylval.dtype = default_dtype;
|
||||
yylval.dtype.type = T_LONGDOUBLE;
|
||||
goto num_common;
|
||||
case NUM_ULONG:
|
||||
yylval.dtype = default_dtype;
|
||||
yylval.dtype.type = T_ULONG;
|
||||
goto num_common;
|
||||
case NUM_LONG:
|
||||
yylval.dtype = default_dtype;
|
||||
yylval.dtype.type = T_LONG;
|
||||
goto num_common;
|
||||
case NUM_UNSIGNED:
|
||||
yylval.dtype = default_dtype;
|
||||
yylval.dtype.type = T_UINT;
|
||||
goto num_common;
|
||||
case NUM_LONGLONG:
|
||||
yylval.dtype = default_dtype;
|
||||
yylval.dtype.type = T_LONGLONG;
|
||||
goto num_common;
|
||||
case NUM_ULONGLONG:
|
||||
yylval.dtype = default_dtype;
|
||||
yylval.dtype.type = T_ULONGLONG;
|
||||
goto num_common;
|
||||
case NUM_BOOL:
|
||||
yylval.dtype = default_dtype;
|
||||
yylval.dtype.type = T_BOOL;
|
||||
num_common:
|
||||
yylval.dtype.unary_arg_type = 0;
|
||||
yylval.dtype.val = NewString(Scanner_text(scan));
|
||||
yylval.dtype.bitfield = 0;
|
||||
yylval.dtype.throws = 0;
|
||||
return (l);
|
||||
|
||||
case ID:
|
||||
|
@ -945,7 +957,6 @@ num_common:
|
|||
return (SIZEOF);
|
||||
|
||||
if (strcmp(yytext, "typedef") == 0) {
|
||||
yylval.intvalue = 0;
|
||||
return (TYPEDEF);
|
||||
}
|
||||
|
||||
|
@ -982,7 +993,6 @@ num_common:
|
|||
if (strcmp(yytext, "%constant") == 0)
|
||||
return (CONSTANT);
|
||||
if (strcmp(yytext, "%typedef") == 0) {
|
||||
yylval.intvalue = 1;
|
||||
return (TYPEDEF);
|
||||
}
|
||||
if (strcmp(yytext, "%native") == 0)
|
||||
|
@ -1049,8 +1059,6 @@ num_common:
|
|||
return (ID);
|
||||
case POUND:
|
||||
return yylex();
|
||||
case SWIG_TOKEN_COMMENT:
|
||||
return yylex();
|
||||
default:
|
||||
return (l);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -110,7 +110,7 @@ typedef struct {
|
|||
unsigned int flag_marked:1; /* Mark flag. Used to avoid recursive loops in places */
|
||||
unsigned int flag_user:1; /* User flag */
|
||||
unsigned int flag_usermark:1; /* User marked */
|
||||
unsigned int refcount:28; /* Reference count (max 16 million) */
|
||||
unsigned int refcount:28; /* Reference count (max 256 million) */
|
||||
} DohBase;
|
||||
|
||||
/* Macros for decrefing and increfing (safe for null objects). */
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
/* Unused since 4.2.0: #define WARN_DEPRECATED_NODEFAULT 123 */
|
||||
/* Unused since 4.1.0: #define WARN_DEPRECATED_TYPEMAP_LANG 124 */
|
||||
/* Unused since 4.2.0: #define WARN_DEPRECATED_INPUT_FILE 125 */
|
||||
#define WARN_DEPRECATED_NESTED_WORKAROUND 126
|
||||
/* Unused since 4.3.0: #define WARN_DEPRECATED_NESTED_WORKAROUND 126 */
|
||||
|
||||
/* -- Preprocessor -- */
|
||||
|
||||
|
|
|
@ -2103,8 +2103,10 @@ public:
|
|||
Printv(f_interface, typemapLookup(n, "csimports", Getattr(n, "classtypeobj"), WARN_NONE), "\n", NIL);
|
||||
Printv(f_interface, typemapLookup(n, "csinterfacemodifiers", Getattr(n, "classtypeobj"), WARN_CSHARP_TYPEMAP_INTERFACEMODIFIERS_UNDEF), NIL);
|
||||
Printf(f_interface, " %s", interface_name);
|
||||
|
||||
String *additional = Getattr(n, "feature:interface:additional");
|
||||
String *bases = additional ? NewStringf(" : %s", additional) : 0;
|
||||
if (List *baselist = Getattr(n, "bases")) {
|
||||
String *bases = 0;
|
||||
for (Iterator base = First(baselist); base.item; base = Next(base)) {
|
||||
if (GetFlag(base.item, "feature:ignore") || !GetFlag(base.item, "feature:interface"))
|
||||
continue; // TODO: warn about skipped non-interface bases
|
||||
|
@ -2116,10 +2118,10 @@ public:
|
|||
Append(bases, base_iname);
|
||||
}
|
||||
}
|
||||
if (bases) {
|
||||
Printv(f_interface, bases, NIL);
|
||||
Delete(bases);
|
||||
}
|
||||
}
|
||||
if (bases) {
|
||||
Printv(f_interface, bases, NIL);
|
||||
Delete(bases);
|
||||
}
|
||||
Printf(f_interface, " {\n");
|
||||
|
||||
|
|
|
@ -2094,8 +2094,10 @@ public:
|
|||
Printv(f_interface, typemapLookup(n, "javaimports", Getattr(n, "classtypeobj"), WARN_NONE), "\n", NIL);
|
||||
Printv(f_interface, typemapLookup(n, "javainterfacemodifiers", Getattr(n, "classtypeobj"), WARN_JAVA_TYPEMAP_INTERFACEMODIFIERS_UNDEF), NIL);
|
||||
Printf(f_interface, " %s", interface_name);
|
||||
|
||||
String *additional = Getattr(n, "feature:interface:additional");
|
||||
String *bases = additional ? Copy(additional) : 0;
|
||||
if (List *baselist = Getattr(n, "bases")) {
|
||||
String *bases = 0;
|
||||
for (Iterator base = First(baselist); base.item; base = Next(base)) {
|
||||
if (GetFlag(base.item, "feature:ignore") || !GetFlag(base.item, "feature:interface"))
|
||||
continue; // TODO: warn about skipped non-interface bases
|
||||
|
@ -2107,10 +2109,10 @@ public:
|
|||
Append(bases, base_iname);
|
||||
}
|
||||
}
|
||||
if (bases) {
|
||||
Printv(f_interface, " extends ", bases, NIL);
|
||||
Delete(bases);
|
||||
}
|
||||
}
|
||||
if (bases) {
|
||||
Printv(f_interface, " extends ", bases, NIL);
|
||||
Delete(bases);
|
||||
}
|
||||
Printf(f_interface, " {\n");
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ static String *pcode = 0; /* Perl code associated with each class */
|
|||
static int member_func = 0; /* Set to 1 when wrapping a member function */
|
||||
static String *func_stubs = 0; /* Function stubs */
|
||||
static String *const_stubs = 0; /* Constant stubs */
|
||||
static int num_consts = 0; /* Number of constants */
|
||||
static Node *const_stubs_enum_class = 0; /* Node for enum class if we're currently generating one */
|
||||
static String *var_stubs = 0; /* Variable stubs */
|
||||
static String *exported = 0; /* Exported symbols */
|
||||
static String *pragma_include = 0;
|
||||
|
@ -585,10 +585,9 @@ public:
|
|||
/* Emit package code for different classes */
|
||||
Printf(f_pm, "%s", pm);
|
||||
|
||||
if (num_consts > 0) {
|
||||
if (Len(const_stubs) > 0) {
|
||||
/* Emit constant stubs */
|
||||
Printf(f_pm, "\n# ------- CONSTANT STUBS -------\n\n");
|
||||
Printf(f_pm, "package %s;\n\n", namespace_module);
|
||||
Printf(f_pm, "%s", const_stubs);
|
||||
}
|
||||
|
||||
|
@ -1120,8 +1119,22 @@ public:
|
|||
"tie %__", iname, "_hash,\"", is_shadow(type), "\", $",
|
||||
cmodule, "::", iname, ";\n", "$", iname, "= \\%__", iname, "_hash;\n", "bless $", iname, ", ", is_shadow(type), ";\n", NIL);
|
||||
} else if (do_constants) {
|
||||
Printv(const_stubs, "sub ", name, " () { $", cmodule, "::", name, " }\n", NIL);
|
||||
num_consts++;
|
||||
char *dcolon = Strstr(name, "::");
|
||||
if (!dcolon) {
|
||||
if (Len(const_stubs) == 0 || const_stubs_enum_class != NULL) {
|
||||
Printf(const_stubs, "package %s;\n", namespace_module);
|
||||
const_stubs_enum_class = NULL;
|
||||
}
|
||||
Printv(const_stubs, "sub ", iname, " () { $", cmodule, "::", iname, " }\n", NIL);
|
||||
} else {
|
||||
// C++11 strongly-typed enum.
|
||||
Node *parent = Getattr(n, "parentNode");
|
||||
if (const_stubs_enum_class != parent) {
|
||||
Printf(const_stubs, "package %s::%s;\n", namespace_module, Getattr(parent, "sym:name"));
|
||||
const_stubs_enum_class = parent;
|
||||
}
|
||||
Printv(const_stubs, "sub ", Getattr(n, "enumvalueDeclaration:sym:name"), " () { $", cmodule, "::", iname, " }\n", NIL);
|
||||
}
|
||||
} else {
|
||||
Printv(var_stubs, "*", iname, " = *", cmodule, "::", iname, ";\n", NIL);
|
||||
}
|
||||
|
|
|
@ -1117,7 +1117,7 @@ public:
|
|||
Printf(f->code, "PHP_METHOD(%s%s,__set) {\n", prefix, class_name);
|
||||
|
||||
Printf(f->code, " swig_object_wrapper *arg = SWIG_Z_FETCH_OBJ_P(ZEND_THIS);\n");
|
||||
Printf(f->code, " zval args[2];\n zval tempZval;\n zend_string *arg2 = 0;\n\n");
|
||||
Printf(f->code, " zval args[2];\n zend_string *arg2 = 0;\n\n");
|
||||
Printf(f->code, " if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_array_ex(2, args) != SUCCESS) {\n");
|
||||
Printf(f->code, "\tWRONG_PARAM_COUNT;\n}\n\n");
|
||||
Printf(f->code, " if (!arg) {\n");
|
||||
|
@ -1155,7 +1155,7 @@ public:
|
|||
Printf(f->code, "PHP_METHOD(%s%s,__get) {\n",prefix, class_name);
|
||||
|
||||
Printf(f->code, " swig_object_wrapper *arg = SWIG_Z_FETCH_OBJ_P(ZEND_THIS);\n");
|
||||
Printf(f->code, " zval args[1];\n zval tempZval;\n zend_string *arg2 = 0;\n\n");
|
||||
Printf(f->code, " zval args[1];\n zend_string *arg2 = 0;\n\n");
|
||||
Printf(f->code, " if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) {\n");
|
||||
Printf(f->code, "\tWRONG_PARAM_COUNT;\n}\n\n");
|
||||
Printf(f->code, " if (!arg) {\n");
|
||||
|
@ -2060,14 +2060,18 @@ public:
|
|||
String *v_name = GetChar(n, "name");
|
||||
|
||||
Printf(magic_set, "\nelse if (strcmp(ZSTR_VAL(arg2),\"%s\") == 0) {\n", v_name);
|
||||
Printf(magic_set, "ZVAL_STRING(&tempZval, \"%s_set\");\n", v_name);
|
||||
Printf(magic_set, "call_user_function(EG(function_table),ZEND_THIS,&tempZval,return_value,1,&args[1]);\n");
|
||||
Printf(magic_set, "zval_ptr_dtor(&tempZval);\n}\n");
|
||||
Printf(magic_set, "zend_string *swig_funcname = ZSTR_INIT_LITERAL(\"%s_set\", 0);\n", v_name);
|
||||
Append(magic_set, "zend_function *swig_zend_func = zend_std_get_method(&Z_OBJ_P(ZEND_THIS), swig_funcname, NULL);\n");
|
||||
Append(magic_set, "zend_string_release(swig_funcname);\n");
|
||||
Printf(magic_set, "zend_call_known_instance_method(swig_zend_func, Z_OBJ_P(ZEND_THIS), return_value, 1, &args[1]);\n");
|
||||
Printf(magic_set, "}\n");
|
||||
|
||||
Printf(magic_get, "\nelse if (strcmp(ZSTR_VAL(arg2),\"%s\") == 0) {\n", v_name);
|
||||
Printf(magic_get, "ZVAL_STRING(&tempZval, \"%s_get\");\n", v_name);
|
||||
Printf(magic_get, "call_user_function(EG(function_table),ZEND_THIS,&tempZval,return_value,0,NULL);\n");
|
||||
Printf(magic_get, "zval_ptr_dtor(&tempZval);\n}\n");
|
||||
Printf(magic_get, "zend_string *swig_funcname = ZSTR_INIT_LITERAL(\"%s_get\", 0);\n", v_name);
|
||||
Append(magic_get, "zend_function *swig_zend_func = zend_std_get_method(&Z_OBJ_P(ZEND_THIS), swig_funcname, NULL);\n");
|
||||
Append(magic_get, "zend_string_release(swig_funcname);\n");
|
||||
Printf(magic_get, "zend_call_known_instance_method(swig_zend_func, Z_OBJ_P(ZEND_THIS), return_value, 0, NULL);\n");
|
||||
Printf(magic_get, "}\n");
|
||||
|
||||
Printf(magic_isset, "\nelse if (strcmp(ZSTR_VAL(arg2),\"%s\") == 0) {\n", v_name);
|
||||
Printf(magic_isset, "RETVAL_TRUE;\n}\n");
|
||||
|
|
|
@ -502,6 +502,9 @@ static Typetab *SwigType_find_scope(Typetab *s, const SwigType *nameprefix) {
|
|||
String *qname = Getattr(ss, "qname");
|
||||
if (qname) {
|
||||
full = NewStringf("%s::%s", qname, nameprefix);
|
||||
if (Strncmp(full, "enum ", 5) == 0) {
|
||||
Delslice(full, 0, 5);
|
||||
}
|
||||
} else {
|
||||
full = NewString(nameprefix);
|
||||
}
|
||||
|
@ -740,9 +743,11 @@ SwigType *SwigType_typedef_resolve(const SwigType *t) {
|
|||
type = Copy(namebase);
|
||||
Insert(type, 0, "::");
|
||||
Insert(type, 0, rnameprefix);
|
||||
if (strncmp(Char(type), "::", 2) == 0) {
|
||||
Delitem(type, 0);
|
||||
Delitem(type, 0);
|
||||
if (Strncmp(type, "enum ", 5) == 0) {
|
||||
Delslice(type, 0, 5);
|
||||
}
|
||||
if (Strncmp(type, "::", 2) == 0) {
|
||||
Delslice(type, 0, 2);
|
||||
}
|
||||
newtype = 1;
|
||||
} else {
|
||||
|
|
|
@ -2848,7 +2848,6 @@ AC_SUBST(SWIG_LIB_SET)
|
|||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
Examples/Makefile
|
||||
Examples/xml/Makefile
|
||||
Examples/test-suite/errors/Makefile
|
||||
Examples/test-suite/c/Makefile
|
||||
Examples/test-suite/csharp/Makefile
|
||||
|
|
Loading…
Reference in New Issue