1 /* Testcase for the Java array typemaps which are not used by default. */
2 %module java_lib_arrays
4 %include "enumtypeunsafe.swg"
6 /* Use the Java library typemaps */
7 %include "arrays_java.i"
9 JAVA_ARRAYSOFCLASSES(SimpleStruct)
10 %apply ARRAYSOFENUMS[ANY] { finger[ANY] }
14 // This will test the %typemap(javacode) in the JAVA_ARRAYSOFCLASSES works with C structs amongst other things
15 JAVA_ARRAYSOFCLASSES(struct AnotherStruct)
17 struct AnotherStruct {
20 double extract(struct AnotherStruct as[], int index) {
21 return as[index].simple.double_field;
23 double extract2(struct AnotherStruct as[5], int index) {
24 return as[index].simple.double_field;
28 // Test %apply to pointers
29 JAVA_ARRAYSOFCLASSES(struct YetAnotherStruct)
30 %apply struct YetAnotherStruct[] { struct YetAnotherStruct *yas }
31 //%apply struct YetAnotherStruct[] { struct YetAnotherStruct * } // Note: Does not work unless this is put after the YetAnotherStruct definition
33 struct YetAnotherStruct {
36 double extract_ptr(struct YetAnotherStruct *yas, int index) {
37 return yas[index].simple.double_field;
39 void modifyYAS(struct YetAnotherStruct yas[], int size) {
41 for (i=0; i<size; ++i) {
43 ss.double_field = yas[i].simple.double_field * 10.0;
49 %apply ARRAYSOFENUMS[ANY] { toe[ANY] }
50 %apply ARRAYSOFENUMS[] { toe[] }
51 %apply ARRAYSOFENUMS[] { toe* }
53 typedef enum { Big, Little } toe;
54 void toestest(toe *t, toe tt[], toe ttt[2]) {}