Another merge with master.

Updated Doxygen error numbers yet again, as Python errors got added in the
meanwhile, pushing the Doxygen ones further off.

And re-merged PEP8/whitespace-related conflicts in autodoc_runme.py once again
(if anybody is looking for a motivating example about why significant
whitespace is bad, here is a great use case).
This commit is contained in:
Vadim Zeitlin 2015-07-20 00:40:32 +02:00
commit 302955a152
448 changed files with 8836 additions and 5079 deletions

View file

@ -23,7 +23,7 @@ public class cpp11_constexpr_runme {
check(cpp11_constexpr.CCC(), 30);
check(cpp11_constexpr.DDD(), 40);
ConstExpressions ce = new ConstExpressions();
ConstExpressions ce = new ConstExpressions(0);
check(ce.JJJ, 100);
check(ce.KKK, 200);
check(ce.LLL, 300);

View file

@ -0,0 +1,20 @@
import cpp11_type_aliasing.*;
public class cpp11_type_aliasing_runme {
static {
try {
System.loadLibrary("cpp11_type_aliasing");
} 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[]) {
Halide_Target ht = new GeneratorBase().getTarget();
Target x = ht.getValue();
if (x.getBits() != 32)
throw new RuntimeException("Incorrect bits");
}
}

View file

@ -20,13 +20,5 @@ public class default_constructor_runme {
throw new RuntimeException("Protected destructor exception should have been thrown");
} catch (UnsupportedOperationException e) {
}
// calling private destructor test
try {
FFF f = new FFF();
f.delete();
throw new RuntimeException("Private destructor exception should have been thrown");
} catch (UnsupportedOperationException e) {
}
}
}

View file

@ -17,11 +17,15 @@ public class director_binary_string_runme {
Callback callback = new DirectorBinaryStringCallback();
caller.setCallback(callback);
int sum = caller.call();
int sumData = caller.callWriteData();
caller.delCallback();
if (sum != 9*2*8 + 13*3*5)
throw new RuntimeException("Unexpected sum: " + sum);
if (sumData != 9*2*8)
throw new RuntimeException("Unexpected sum: " + sum);
new Callback().run(null, null);
callback = new DirectorBinaryStringCallback();
caller.setCallback(callback);
@ -45,5 +49,13 @@ class DirectorBinaryStringCallback extends Callback {
for (int i = 0; i < dataBufferBB.length; i++)
dataBufferBB[i] = (byte)(dataBufferBB[i] * 3);
}
@Override
public void writeData(byte[] dataBufferAA)
{
if (dataBufferAA != null)
for (int i = 0; i < dataBufferAA.length; i++)
dataBufferAA[i] = (byte)(dataBufferAA[i] * 2);
}
}

View file

@ -0,0 +1,71 @@
import director_ref.*;
public class director_ref_runme {
static {
try {
System.loadLibrary("director_ref");
} 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[]) {
director_ref_MyFoo a = new director_ref_MyFoo();
if (a.GetRefCount() != 1) {
throw new RuntimeException ( "Refcount test 1 failed." );
}
// Make sure director logic still works.
if (!a.GetMsg().equals("director_ref_MyFoo-default")) {
throw new RuntimeException ( "Test 1 failed" );
}
if (!a.GetMsg("boo").equals("director_ref_MyFoo-boo")) {
throw new RuntimeException ( "Test 2 failed" );
}
a.delete(); // should delete the object.
if (a.cppDeleted != true) {
throw new RuntimeException ( "Unref test 1 failed." );
}
a = new director_ref_MyFoo();
FooPtr p = new FooPtr(a);
if (a.GetRefCount() != 2) {
throw new RuntimeException ( "Refcount test 2 failed." );
}
a.delete(); // Shouldn't actually delete the underlying object
if (a.cppDeleted) {
throw new RuntimeException ( "Unref test 2 failed." );
}
if (p.GetOwnedRefCount() != 1) {
throw new RuntimeException ( "Unref test 3 failed." );
}
p.Reset(); // Now it should be deleted on the cpp side.
// We can't check cppDeleted because the director will stop
// working after a delete() call.
if (p.GetOwnedRefCount() != 0) {
throw new RuntimeException ( "Unref test 4 failed." );
}
}
}
class director_ref_MyFoo extends Foo {
public director_ref_MyFoo() {
super();
}
public director_ref_MyFoo(int i) {
super(i);
}
public String Msg(String msg) {
return "director_ref_MyFoo-" + msg;
}
public void OnDelete() {
cppDeleted = true;
}
public boolean cppDeleted = false;
}

View file

@ -0,0 +1,28 @@
import friends_template.*;
public class friends_template_runme {
static {
try {
System.loadLibrary("friends_template");
} 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[]) {
friends_template.OperatorOutputDouble(1.1, new MyClassDouble());
friends_template.OperatorInputDouble(1.1, new MyClassDouble());
friends_template.funk_hidden(1.1, new MyClassDouble());
friends_template.funk_seen(1.1, new MyClassDouble());
friends_template.TemplateFriendHiddenInt(0);
friends_template.TemplateFriendSeenInt(0, 0);
SWIGTYPE_p_MyClassT_int_t myClassInt = friends_template.makeMyClassInt();
friends_template.OperatorInputInt(1, myClassInt);
friends_template.OperatorFunkSeenInt(1.1, myClassInt);
}
}

View file

@ -23,5 +23,12 @@ public class li_boost_shared_ptr_bits_runme {
HiddenDestructor hidden = HiddenDestructor.create();
hidden.delete();
HiddenPrivateDestructor hiddenPrivate = HiddenPrivateDestructor.create();
if (HiddenPrivateDestructor.getDeleteCount() != 0)
throw new RuntimeException("Count should be zero");
hiddenPrivate.delete();
if (HiddenPrivateDestructor.getDeleteCount() != 1)
throw new RuntimeException("Count should be one");
}
}

View file

@ -31,7 +31,7 @@ public class li_carrays_runme {
{
// global array variable
int length = 5;
int length = 3;
XY xyArrayPointer = li_carrays.getGlobalXYArray();
XYArray xyArray = XYArray.frompointer(xyArrayPointer);
for (int i=0; i<length; i++) {