Merge branch 'master' of github.com:swig/swig

This commit is contained in:
Oliver Buchtala 2014-05-28 04:27:54 +02:00
commit f19592acf4
8 changed files with 41 additions and 29 deletions

View file

@ -1,4 +1,4 @@
*** ANNOUNCE: SWIG 3.0.1 (in progress) *** *** ANNOUNCE: SWIG 3.0.1 (27 May 2014) ***
http://www.swig.org http://www.swig.org
@ -10,11 +10,11 @@ What is SWIG?
SWIG is a software development tool that reads C/C++ header files and SWIG is a software development tool that reads C/C++ header files and
generates the wrapper code needed to make C and C++ code accessible generates the wrapper code needed to make C and C++ code accessible
from other programming languages including Perl, Python, Tcl, Ruby, from other programming languages including Perl, Python, Tcl, Ruby,
PHP, C#, Go, Java, Lua, Scheme (Guile, MzScheme, CHICKEN), D, Ocaml, PHP, C#, Go, Java, Javascript, Lua, Scheme (Guile, MzScheme, CHICKEN),
Pike, Modula-3, Octave, R, Common Lisp (CLISP, Allegro CL, CFFI, UFFI). D, Ocaml, Pike, Modula-3, Octave, R, Common Lisp (CLISP, Allegro CL,
SWIG can also export its parse tree in the form of XML and Lisp CFFI, UFFI). SWIG can also export its parse tree in the form of XML
s-expressions. Major applications of SWIG include generation of and Lisp s-expressions. Major applications of SWIG include generation
scripting language extension modules, rapid prototyping, testing, of scripting language extension modules, rapid prototyping, testing,
and user interface development for large C/C++ systems. and user interface development for large C/C++ systems.
Availability Availability

View file

@ -2,9 +2,18 @@ Below are the changes for the current release.
See the CHANGES file for changes in older releases. See the CHANGES file for changes in older releases.
See the RELEASENOTES file for a summary of changes in each release. See the RELEASENOTES file for a summary of changes in each release.
Version 3.0.1 (in progress) Version 3.0.1 (27 May 2014)
=========================== ===========================
2014-05-25: hfalcic
[Python] Python 3 byte string output: use errors="surrogateescape"
if available on the version of Python that's in use. This allows
obtaining the original byte string (and potentially trying a fallback
encoding) if the bytes can't be decoded as UTF-8.
Previously, a UnicodeDecodeError would be raised with no way to treat
the data as bytes or try another codec.
2014-05-18: vkalinin 2014-05-18: vkalinin
Bug #175 - Restore %extend to work for unnamed nested structures by using a C Bug #175 - Restore %extend to work for unnamed nested structures by using a C
symbol comprising the outer structure name and unnamed variable instance name. symbol comprising the outer structure name and unnamed variable instance name.

View file

@ -1056,7 +1056,7 @@
<ul> <ul>
<li><a href="Javascript.html#Javascript_running_swig">Running SWIG</a> <li><a href="Javascript.html#Javascript_running_swig">Running SWIG</a>
<li><a href="Javascript.html#Javascript_running_tests_examples">Running Tests and Examples</a> <li><a href="Javascript.html#Javascript_running_tests_examples">Running Tests and Examples</a>
<li><a href="Javascript.html#Javascript_future_work">Future work</a> <li><a href="Javascript.html#Javascript_known_issues">Known Issues</a>
</ul> </ul>
<li><a href="Javascript.html#Javascript_integration">Integration</a> <li><a href="Javascript.html#Javascript_integration">Integration</a>
<ul> <ul>
@ -1082,6 +1082,7 @@
<li><a href="Javascript.html#Javascript_code_templates">Code Templates</a> <li><a href="Javascript.html#Javascript_code_templates">Code Templates</a>
<li><a href="Javascript.html#Javascript_emitter">Emitter</a> <li><a href="Javascript.html#Javascript_emitter">Emitter</a>
<li><a href="Javascript.html#Javascript_emitter_states">Emitter states</a> <li><a href="Javascript.html#Javascript_emitter_states">Emitter states</a>
<li><a href="Javascript.html#Javascript_jsc_exceptions">Handling Exceptions in JavascriptCore</a>
</ul> </ul>
</ul> </ul>
</div> </div>
@ -1566,6 +1567,7 @@
<li><a href="Python.html#Python_nn74">Function annotation</a> <li><a href="Python.html#Python_nn74">Function annotation</a>
<li><a href="Python.html#Python_nn75">Buffer interface</a> <li><a href="Python.html#Python_nn75">Buffer interface</a>
<li><a href="Python.html#Python_nn76">Abstract base classes</a> <li><a href="Python.html#Python_nn76">Abstract base classes</a>
<li><a href="Python.html#Python_nn77">Byte string output conversion</a>
</ul> </ul>
</ul> </ul>
</div> </div>

View file

@ -6,7 +6,7 @@
</head> </head>
<body> <body>
<H1><a name="Javascript_nn1"></a>26 SWIG and Javascript</H1> <H1><a name="Javascript"></a>26 SWIG and Javascript</H1>
<!-- INDEX --> <!-- INDEX -->
<div class="sectiontoc"> <div class="sectiontoc">
<ul> <ul>
@ -130,13 +130,14 @@ $ make check-javascript-examples ENGINE=jsc</pre>
$ make check-javascript-test-suite ENGINE=jsc</pre> $ make check-javascript-test-suite ENGINE=jsc</pre>
</div> </div>
<H3><a name="Javascript_known_issues"></a>26.2.1 Known Issues</H3> <H3><a name="Javascript_known_issues"></a>26.2.3 Known Issues</H3>
<p>At the moment, the Javascript generators pass all tests syntactically, i.e., the generated source code compiles. However, there are still remaining runtime issues.</p> <p>At the moment, the Javascript generators pass all tests syntactically, i.e., the generated source code compiles. However, there are still remaining runtime issues.</p>
<ul> <ul>
<li><p>Default optional arguments do not work for all targeted interpreters</p></li> <li><p>Default optional arguments do not work for all targeted interpreters</p></li>
<li><p>Mutliple output arguments do not work for JSC</p></li> <li><p>Multiple output arguments do not work for JSC</p></li>
<li><p>C89 incompatibily: the JSC generator might still generate C89 violating code</p></li> <li><p>C89 incompatibily: the JSC generator might still generate C89 violating code</p></li>
<li><p><code>long long</code> is not supported</p></li> <li><p><code>long long</code> is not supported</p></li>
<li><p><code>%native</code> is not supported</p></li> <li><p><code>%native</code> is not supported</p></li>
@ -891,7 +892,7 @@ state.clazz(NAME, Getattr(n, "sym:name"));</pre>
<p>State information can be retrieved using <code>state.clazz(NAME)</code> or with <code>Getattr</code> on <code>state.clazz()</code> which actually returns a <code>Hash</code> instance.</p> <p>State information can be retrieved using <code>state.clazz(NAME)</code> or with <code>Getattr</code> on <code>state.clazz()</code> which actually returns a <code>Hash</code> instance.</p>
<H3><a name="Javascript_jsc_exceptions"></a>26.5.5. Handling Exceptions in JavascriptCore</H3> <H3><a name="Javascript_jsc_exceptions"></a>26.5.5 Handling Exceptions in JavascriptCore</H3>
<p>Applications with an embedded JavascriptCore should be able to present detailed exception messages that occur in the Javascript engine. Below is an example derived from code provided by Brian Barnes on how these exception details can be extracted.</p> <p>Applications with an embedded JavascriptCore should be able to present detailed exception messages that occur in the Javascript engine. Below is an example derived from code provided by Brian Barnes on how these exception details can be extracted.</p>

View file

@ -5929,7 +5929,7 @@ For details of abstract base class, please see
<a href="http://www.python.org/dev/peps/pep-3119/">PEP 3119</a>. <a href="http://www.python.org/dev/peps/pep-3119/">PEP 3119</a>.
</p> </p>
<H3><a name="Python_nn77"></a>35.12.4 Byte string output conversion</H3> <H3><a name="Python_nn77"></a>36.12.4 Byte string output conversion</H3>
<p> <p>

View file

@ -6,7 +6,7 @@
<body bgcolor="#ffffff"> <body bgcolor="#ffffff">
<H1><a name="Sections"></a>SWIG-3.0 Documentation</H1> <H1><a name="Sections"></a>SWIG-3.0 Documentation</H1>
Last update : SWIG-3.0.1 (in progress) Last update : SWIG-3.0.1 (27 May 2014)
<H2>Sections</H2> <H2>Sections</H2>
@ -42,7 +42,7 @@ Last update : SWIG-3.0.1 (in progress)
<li><a href="Go.html#Go">Go support</a></li> <li><a href="Go.html#Go">Go support</a></li>
<li><a href="Guile.html#Guile">Guile support</a></li> <li><a href="Guile.html#Guile">Guile support</a></li>
<li><a href="Java.html#Java">Java support</a></li> <li><a href="Java.html#Java">Java support</a></li>
<li><a href="Javascript.html#Java">Javascript support</a></li> <li><a href="Javascript.html#Javascript">Javascript support</a></li>
<li><a href="Lisp.html#Lisp">Common Lisp support</a></li> <li><a href="Lisp.html#Lisp">Common Lisp support</a></li>
<li><a href="Lua.html#Lua">Lua support</a></li> <li><a href="Lua.html#Lua">Lua support</a></li>
<li><a href="Modula3.html#Modula3">Modula3 support</a></li> <li><a href="Modula3.html#Modula3">Modula3 support</a></li>

2
README
View file

@ -1,6 +1,6 @@
SWIG (Simplified Wrapper and Interface Generator) SWIG (Simplified Wrapper and Interface Generator)
Version: 3.0.1 (in progress) Version: 3.0.1 (27 May 2014)
Tagline: SWIG is a compiler that integrates C and C++ with languages Tagline: SWIG is a compiler that integrates C and C++ with languages
including Perl, Python, Tcl, Ruby, PHP, Java, C#, D, Go, Lua, including Perl, Python, Tcl, Ruby, PHP, Java, C#, D, Go, Lua,

View file

@ -724,19 +724,19 @@ int JSEmitter::emitWrapperFunction(Node *n) {
// detected via the 'view' attribute. // detected via the 'view' attribute.
|| (Equal(kind, "variable") && Equal(Getattr(n, "view"), "globalfunctionHandler")) || (Equal(kind, "variable") && Equal(Getattr(n, "view"), "globalfunctionHandler"))
) { ) {
bool is_member = GetFlag(n, "ismember") | GetFlag(n, "feature:extend"); bool is_member = GetFlag(n, "ismember") != 0 || GetFlag(n, "feature:extend") != 0;
bool is_static = GetFlag(state.function(), IS_STATIC); bool is_static = GetFlag(state.function(), IS_STATIC) != 0;
ret = emitFunction(n, is_member, is_static); ret = emitFunction(n, is_member, is_static);
} else if (Cmp(kind, "variable") == 0) { } else if (Cmp(kind, "variable") == 0) {
bool is_static = GetFlag(state.variable(), IS_STATIC); bool is_static = GetFlag(state.variable(), IS_STATIC) != 0;
// HACK: smartpointeraccessed static variables are not treated as statics // HACK: smartpointeraccessed static variables are not treated as statics
if (GetFlag(n, "allocate:smartpointeraccess")) { if (GetFlag(n, "allocate:smartpointeraccess")) {
is_static = false; is_static = false;
} }
bool is_member = GetFlag(n, "ismember"); bool is_member = GetFlag(n, "ismember") != 0;
bool is_setter = GetFlag(n, "memberset") || GetFlag(n, "varset"); bool is_setter = GetFlag(n, "memberset") != 0 || GetFlag(n, "varset") != 0;
bool is_getter = GetFlag(n, "memberget") || GetFlag(n, "varget"); bool is_getter = GetFlag(n, "memberget") != 0 || GetFlag(n, "varget") != 0;
if (is_setter) { if (is_setter) {
ret = emitSetter(n, is_member, is_static); ret = emitSetter(n, is_member, is_static);
} else if (is_getter) { } else if (is_getter) {
@ -840,7 +840,7 @@ int JSEmitter::emitCtor(Node *n) {
Wrapper *wrapper = NewWrapper(); Wrapper *wrapper = NewWrapper();
bool is_overloaded = GetFlag(n, "sym:overloaded"); bool is_overloaded = GetFlag(n, "sym:overloaded") != 0;
Template t_ctor(getTemplate("js_ctor")); Template t_ctor(getTemplate("js_ctor"));
@ -1160,7 +1160,7 @@ int JSEmitter::emitFunction(Node *n, bool is_member, bool is_static) {
Wrapper *wrapper = NewWrapper(); Wrapper *wrapper = NewWrapper();
Template t_function(getTemplate("js_function")); Template t_function(getTemplate("js_function"));
bool is_overloaded = GetFlag(n, "sym:overloaded"); bool is_overloaded = GetFlag(n, "sym:overloaded") != 0;
// prepare the function wrapper name // prepare the function wrapper name
String *iname = Getattr(n, "sym:name"); String *iname = Getattr(n, "sym:name");
@ -1288,7 +1288,7 @@ void JSEmitter::marshalOutput(Node *n, ParmList *params, Wrapper *wrapper, Strin
cresult = defaultResultName; cresult = defaultResultName;
tm = Swig_typemap_lookup_out("out", n, cresult, wrapper, actioncode); tm = Swig_typemap_lookup_out("out", n, cresult, wrapper, actioncode);
bool should_own = GetFlag(n, "feature:new"); bool should_own = GetFlag(n, "feature:new") != 0;
if (tm) { if (tm) {
Replaceall(tm, "$objecttype", Swig_scopename_last(SwigType_str(SwigType_strip_qualifiers(type), 0))); Replaceall(tm, "$objecttype", Swig_scopename_last(SwigType_str(SwigType_strip_qualifiers(type), 0)));
@ -1628,8 +1628,8 @@ int JSCEmitter::enterFunction(Node *n) {
int JSCEmitter::exitFunction(Node *n) { int JSCEmitter::exitFunction(Node *n) {
Template t_function = getTemplate("jsc_function_declaration"); Template t_function = getTemplate("jsc_function_declaration");
bool is_member = GetFlag(n, "ismember") | GetFlag(n, "feature:extend"); bool is_member = GetFlag(n, "ismember") != 0 || GetFlag(n, "feature:extend") != 0;
bool is_overloaded = GetFlag(n, "sym:overloaded"); bool is_overloaded = GetFlag(n, "sym:overloaded") != 0;
// handle overloaded functions // handle overloaded functions
if (is_overloaded) { if (is_overloaded) {
@ -2077,10 +2077,10 @@ int V8Emitter::exitVariable(Node *n) {
} }
int V8Emitter::exitFunction(Node *n) { int V8Emitter::exitFunction(Node *n) {
bool is_member = GetFlag(n, "ismember") | GetFlag(n, "feature:extend"); bool is_member = GetFlag(n, "ismember") != 0 || GetFlag(n, "feature:extend") != 0;
// create a dispatcher for overloaded functions // create a dispatcher for overloaded functions
bool is_overloaded = GetFlag(n, "sym:overloaded"); bool is_overloaded = GetFlag(n, "sym:overloaded") != 0;
if (is_overloaded) { if (is_overloaded) {
if (!Getattr(n, "sym:nextSibling")) { if (!Getattr(n, "sym:nextSibling")) {
//state.function(WRAPPER_NAME, Swig_name_wrapper(Getattr(n, "name"))); //state.function(WRAPPER_NAME, Swig_name_wrapper(Getattr(n, "name")));