Merge branch 'master' into gsoc2017-php7-classes-via-c-api

This commit is contained in:
Olly Betts 2021-04-21 16:05:24 +12:00
commit 3e8373b09a
20 changed files with 76 additions and 20 deletions

View file

@ -183,7 +183,7 @@ information by including a directive like this in the interface file:
</div> </div>
<p> <p>
(The <code>%scheme</code> directive allows to insert arbitrary Scheme (The <code>%scheme</code> directive allows inserting arbitrary Scheme
code into the generated file <code><var>module.scm</var></code>; it is code into the generated file <code><var>module.scm</var></code>; it is
placed between the <code>define-module</code> form and the placed between the <code>define-module</code> form and the
<code>export</code> form.) <code>export</code> form.)

View file

@ -406,7 +406,7 @@ the main window.</p>
<p> <p>
As known from <code>node.js</code> one can use <code>require</code> to load javascript modules. As known from <code>node.js</code> one can use <code>require</code> to load javascript modules.
Additionally, <code>node-webkit</code> provides an API that allows to manipulate the window's menu, Additionally, <code>node-webkit</code> provides an API that allows manipulating the window's menu,
open new windows, and many more things. open new windows, and many more things.
</p> </p>

View file

@ -2020,7 +2020,7 @@ and a more descriptive one, but the two functions are otherwise equivalent:
<tr> <tr>
<td><span style="white-space: nowrap;"><tt>regex:/pattern/subst/</tt></span></td> <td><span style="white-space: nowrap;"><tt>regex:/pattern/subst/</tt></span></td>
<td>String after (Perl-like) regex substitution operation. This function <td>String after (Perl-like) regex substitution operation. This function
allows to apply arbitrary regular expressions to the identifier names. The allows applying arbitrary regular expressions to the identifier names. The
<i>pattern</i> part is a regular expression in Perl syntax (as supported <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 (PCRE)</a>) by the <a href="http://www.pcre.org/">Perl Compatible Regular Expressions (PCRE)</a>)
library and the <i>subst</i> string library and the <i>subst</i> string

View file

@ -418,6 +418,7 @@ CPP_TEST_CASES += \
struct_value \ struct_value \
swig_exception \ swig_exception \
symbol_clash \ symbol_clash \
sym \
template_arg_replace \ template_arg_replace \
template_arg_scope \ template_arg_scope \
template_arg_typename \ template_arg_typename \

View file

@ -46,7 +46,6 @@ CPP_TEST_CASES = \
java_typemaps_typewrapper \ java_typemaps_typewrapper \
nested_scope \ nested_scope \
li_std_list \ li_std_list \
li_std_map \
li_std_set \ li_std_set \
# li_boost_intrusive_ptr # li_boost_intrusive_ptr

View file

@ -32,7 +32,8 @@ char *Person_name_get(Person *p) {
} }
void Person_name_set(Person *p, char *val) { void Person_name_set(Person *p, char *val) {
strncpy(p->name,val,50); p->name[0] = '\0';
strncat(p->name, val, sizeof(p->name) - 1);
make_upper(p->name); make_upper(p->name);
} }
%} %}

View file

@ -16,11 +16,13 @@ CPP_TEST_CASES += \
li_cstring \ li_cstring \
li_cdata_carrays_cpp \ li_cdata_carrays_cpp \
li_reference \ li_reference \
memberin1 \
director_nestedmodule \ director_nestedmodule \
C_TEST_CASES += \ C_TEST_CASES += \
li_cstring \ li_cstring \
li_cdata_carrays \ li_cdata_carrays \
multivalue \
include $(srcdir)/../common.mk include $(srcdir)/../common.mk

View file

@ -0,0 +1,20 @@
use strict;
use warnings;
use Test::More tests => 8;
BEGIN { use_ok('multivalue') }
require_ok('multivalue');
my ($q, $r);
($q, $r) = multivalue::divide_l(37, 5);
is($q, 7, "Test divide_l quotient");
is($r, 2, "Test divide_l remainder");
($q, $r) = multivalue::divide_v(41, 7);
is($q, 5, "Test divide_v quotient");
is($r, 6, "Test divide_v remainder");
($q, $r) = multivalue::divide_mv(91, 13);
is($q, 7, "Test divide_mv quotient");
is($r, 0, "Test divide_mv remainder");

View file

@ -11,12 +11,20 @@ top_builddir = @top_builddir@
CPP_TEST_CASES += \ CPP_TEST_CASES += \
callback \ callback \
director_stl \
exception_partial_info \
inout \
li_cdata_carrays_cpp \
li_factory \ li_factory \
php_iterator \ php_iterator \
php_namewarn_rename \ php_namewarn_rename \
php_pragma \ php_pragma \
prefix \ prefix \
C_TEST_CASES += \
li_cdata_carrays \
multivalue \
include $(srcdir)/../common.mk include $(srcdir)/../common.mk
# Overridden variables here # Overridden variables here

View file

@ -3,8 +3,8 @@
require "tests.php"; require "tests.php";
require "director_profile.php"; require "director_profile.php";
// New functions // No new functions
check::functions(array('b_fn','b_vfi','b_fi','b_fj','b_fk','b_fl','b_get_self','b_vfs','b_fs')); check::functions(array());
// New classes // New classes
check::classes(array('A','B')); check::classes(array('A','B'));
// No new vars // No new vars

View file

@ -3,8 +3,8 @@
require "tests.php"; require "tests.php";
require "director_stl.php"; require "director_stl.php";
// New functions // No new functions
check::functions(array('foo_bar','foo_ping','foo_pong','foo_tping','foo_tpong','foo_pident','foo_vident','foo_vsecond','foo_tpident','foo_tvident','foo_tvsecond','foo_vidents','foo_tvidents')); check::functions(array());
// New classes // New classes
check::classes(array('Foo')); check::classes(array('Foo'));
// No new vars // No new vars

View file

@ -0,0 +1,25 @@
<?php
require "tests.php";
require "multivalue.php";
// New functions
check::functions(array('divide_l','divide_v','divide_mv'));
// New classes
check::classes(array('multivalue'));
// No new vars
check::globals(array());
$r = multivalue::divide_l(37, 5);
check::equal($r[0], 7, "Test divide_l quotient");
check::equal($r[1], 2, "Test divide_l remainder");
$r = multivalue::divide_v(41, 7);
check::equal($r[0], 5, "Test divide_v quotient");
check::equal($r[1], 6, "Test divide_v remainder");
$r = multivalue::divide_mv(91, 13);
check::equal($r[0], 7, "Test divide_mv quotient");
check::equal($r[1], 0, "Test divide_mv remainder");
check::done();

View file

@ -6,7 +6,7 @@ require "sym.php";
// No new functions // No new functions
check::functions(array()); check::functions(array());
// New classes // New classes
check::classes(array('flim','flam')); check::classes(array('Flim','Flam'));
// No new vars // No new vars
check::globals(array()); check::globals(array());

View file

@ -1,5 +1,5 @@
/* /*
The typemaps here allow to handle functions returning std::auto_ptr<>, The typemaps here allow handling functions returning std::auto_ptr<>,
which is the most common use of this type. If you have functions taking it which is the most common use of this type. If you have functions taking it
as parameter, these typemaps can't be used for them and you need to do as parameter, these typemaps can't be used for them and you need to do
something else (e.g. use shared_ptr<> which SWIG supports fully). something else (e.g. use shared_ptr<> which SWIG supports fully).

View file

@ -1,5 +1,5 @@
/* /*
The typemaps here allow to handle functions returning std::auto_ptr<>, The typemaps here allow handling functions returning std::auto_ptr<>,
which is the most common use of this type. If you have functions taking it which is the most common use of this type. If you have functions taking it
as parameter, these typemaps can't be used for them and you need to do as parameter, these typemaps can't be used for them and you need to do
something else (e.g. use shared_ptr<> which SWIG supports fully). something else (e.g. use shared_ptr<> which SWIG supports fully).

View file

@ -1344,14 +1344,14 @@ SWIGRUNTIME int SWIG_Lua_resolve_metamethod(lua_State *L); /*forward declaration
/* The real function that resolves a metamethod. /* The real function that resolves a metamethod.
* Function searches given class and all it's bases(recursively) for first instance of something that is * Function searches given class and all it's bases(recursively) for first instance of something that is
* not equal to SWIG_Lua_resolve_metatmethod. (Almost always this 'something' is actual metamethod implementation * not equal to SWIG_Lua_resolve_metamethod. (Almost always this 'something' is actual metamethod implementation
* and it is a SWIG-generated C function.). It returns value on the top of the L and there is no garbage below the * and it is a SWIG-generated C function.). It returns value on the top of the L and there is no garbage below the
* answer. * answer.
* Returns 1 if found, 0 otherwise. * Returns 1 if found, 0 otherwise.
* clss is class which metatable we will search for method * clss is class which metatable we will search for method
* metamethod_name_idx is index in L where metamethod name (as string) lies * metamethod_name_idx is index in L where metamethod name (as string) lies
* skip_check allows to skip searching metamethod in givel clss and immideatelly go to searching in bases. skip_check * skip_check allows skipping searching metamethod in the given class and immediately going to searching in bases. skip_check
* is not caried to subsequent recursive calls - false is always passed. It is set to true only at first call from * is not carried to subsequent recursive calls - false is always passed. It is set to true only at first call from
* SWIG_Lua_resolve_metamethod * SWIG_Lua_resolve_metamethod
* */ * */
SWIGINTERN int SWIG_Lua_do_resolve_metamethod(lua_State *L, const swig_lua_class *clss, int metamethod_name_idx, SWIGINTERN int SWIG_Lua_do_resolve_metamethod(lua_State *L, const swig_lua_class *clss, int metamethod_name_idx,
@ -1497,7 +1497,7 @@ SWIGINTERN void SWIG_Lua_add_class_user_metamethods(lua_State *L, swig_lua_class
} }
} }
lua_pop(L,1); /* remove inheritable metatmethods table */ lua_pop(L,1); /* remove inheritable metamethods table */
/* Special handling for __tostring method */ /* Special handling for __tostring method */
lua_pushstring(L, "__tostring"); lua_pushstring(L, "__tostring");

View file

@ -1,5 +1,5 @@
/* /*
The typemaps here allow to handle functions returning std::auto_ptr<>, The typemaps here allow handling functions returning std::auto_ptr<>,
which is the most common use of this type. If you have functions taking it which is the most common use of this type. If you have functions taking it
as parameter, these typemaps can't be used for them and you need to do as parameter, these typemaps can't be used for them and you need to do
something else (e.g. use shared_ptr<> which SWIG supports fully). something else (e.g. use shared_ptr<> which SWIG supports fully).

View file

@ -1,5 +1,5 @@
/* /*
The typemaps here allow to handle functions returning std::auto_ptr<>, The typemaps here allow handling functions returning std::auto_ptr<>,
which is the most common use of this type. If you have functions taking it which is the most common use of this type. If you have functions taking it
as parameter, these typemaps can't be used for them and you need to do as parameter, these typemaps can't be used for them and you need to do
something else (e.g. use shared_ptr<> which SWIG supports fully). something else (e.g. use shared_ptr<> which SWIG supports fully).

View file

@ -115,7 +115,7 @@
SWIG errors code. SWIG errors code.
Finally, if the SWIG_CASTRANK_MODE is enabled, the result code Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
allows to return the 'cast rank', for example, if you have this allows returning the 'cast rank', for example, if you have this
int food(double) int food(double)
int fooi(int); int fooi(int);

View file

@ -727,7 +727,7 @@ Node *JSEmitter::getBaseClass(Node *n) {
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* JSEmitter::emitWrapperFunction() : dispatches emitter functions. * JSEmitter::emitWrapperFunction() : dispatches emitter functions.
* *
* This allows to have small sized, dedicated emitting functions. * This allows having small sized, dedicated emitting functions.
* All state dependent branching is done here. * All state dependent branching is done here.
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */