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

This commit is contained in:
Olly Betts 2021-03-31 04:53:40 +13:00
commit 904f5a65d8
10 changed files with 100 additions and 47 deletions

View file

@ -21,10 +21,5 @@ 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);
%apply int *OUTPUT { int *r };
extern int divide(int n, int d, int *r);

View file

@ -14,7 +14,7 @@
print " b = $b\n";
print " c = $c\n";
# Call the add() function wuth some pointers
# Call the add() function with some pointers
add($a,$b,$c);
print " $a + $b = $c\n";
@ -28,6 +28,8 @@
print " 37 - 42 = $r\n";
# Now try the version with multiple return values
# print "Testing multiple return values\n";
# ($q,$r) = divide(42,37);
# print " 42/37 = $q remainder $r\n";
print "Testing multiple return values\n";
$a = divide(42,37);
$q = $a[0];
$r = $a[1];
print " 42/37 = $q remainder $r\n";

View file

@ -56,7 +56,7 @@ auto lambda4 = [](int x, int y) { return x+y; };
auto lambda5 = []() { return thing; };
#endif
void fn() {
void fn1() {
int stuff = 0;
auto lambdaxxxx = [=,&stuff]() { return thing; };
}

View file

@ -25,7 +25,7 @@ public class rname_runme {
bar.foo_u((long)10);
RenamedBase base = new RenamedBase();
base.fn(base, base, base);
base.fn1(base, base, base);
if (!base.newname(10.0).equals("Base"))
throw new RuntimeException("base.newname");

View file

@ -1,4 +1,3 @@
<?php
require "tests.php";

View file

@ -22,7 +22,7 @@
%rename (newname) Space::Base::oldname(double d) const;
/* Rename derived class method only */
%rename (Xfunc) Space::Derived::fn(Base baseValue, Base* basePtr, Base& baseRef);
%rename (Xfunc) Space::Derived::fn1(Base baseValue, Base* basePtr, Base& baseRef);
%inline %{
class Bar {
@ -43,14 +43,14 @@ class Base {
public:
Base(){};
virtual ~Base(){};
void fn(Base baseValue, Base* basePtr, Base& baseRef){}
void fn1(Base baseValue, Base* basePtr, Base& baseRef){}
virtual const char * oldname(double d) const { return "Base"; }
};
class Derived : public Base {
public:
Derived(){}
~Derived(){}
void fn(Base baseValue, Base* basePtr, Base& baseRef){}
void fn1(Base baseValue, Base* basePtr, Base& baseRef){}
virtual const char * oldname(double d) const { return "Derived"; }
};
}