< prev index next >

test/jdk/java/nicl/Upcall/StructUpcall.java

Print this page

        

*** 29,41 **** import java.lang.invoke.MethodHandles; import java.nicl.Libraries; import java.nicl.NativeTypes; import java.nicl.Scope; ! import java.nicl.metadata.C; ! import java.nicl.metadata.CallingConvention; import java.nicl.metadata.NativeHeader; import java.nicl.metadata.NativeType; import java.nicl.metadata.Offset; import java.nicl.types.LayoutType; import java.nicl.types.Pointer; import java.nicl.types.Struct; --- 29,42 ---- import java.lang.invoke.MethodHandles; import java.nicl.Libraries; import java.nicl.NativeTypes; import java.nicl.Scope; ! import java.nicl.metadata.NativeCallback; import java.nicl.metadata.NativeHeader; + import java.nicl.metadata.NativeLocation; + import java.nicl.metadata.NativeStruct; import java.nicl.metadata.NativeType; import java.nicl.metadata.Offset; import java.nicl.types.LayoutType; import java.nicl.types.Pointer; import java.nicl.types.Struct;
*** 43,103 **** public class StructUpcall { private static final boolean DEBUG = false; @NativeHeader public static interface Index { ! @NativeType(layout="[iiippp]", ctype="dummy", size=40, isRecordType=true) ! @C(file="dummy", line=47, column=11, USR="C:@S@MyStruct") static interface MyStruct extends Struct<MyStruct> { @Offset(offset=0l) ! @C(file="dummy", line=47, column=11, USR="c:@SA@MyStruct@FI@field1") ! @NativeType(layout="i", ctype="enum MyStructField1", size=4l) int field1$get(); void field1$set(int i); @Offset(offset=32l) ! @C(file="dummy", line=47, column=11, USR="c:@SA@MyStruct@FI@field2") ! @NativeType(layout="i", ctype="int", size=4l) int field2$get(); void field2$set(int i); @Offset(offset=64l) ! @C(file="dummy", line=47, column=11, USR="c:@SA@MyStruct@FI@field3") ! @NativeType(layout="i", ctype="int", size=4l) int field3$get(); void field3$set(int i); @Offset(offset=128l) ! @C(file="dummy", line=47, column=11, USR="c:@SA@MyStruct@FI@field4") ! @NativeType(layout="p", ctype="const void *", size=8l) Pointer<Void> field4$get(); void field4$set(Pointer<?> p); @Offset(offset=192l) ! @C(file="dummy", line=47, column=11, USR="c:@SA@MyStruct@FI@field5") ! @NativeType(layout="p", ctype="const void *", size=8l) Pointer<Void> field5$get(); void field5$set(Pointer<?> p); @Offset(offset=256l) ! @C(file="dummy", line=47, column=11, USR="c:@SA@MyStruct@FI@field6") ! @NativeType(layout="p", ctype="const void *", size=8l) Pointer<Void> field6$get(); void field6$set(Pointer<?> p); } @FunctionalInterface static interface MyStructVisitor { ! @C(file="dummy", line=47, column=11, USR="c:@F@slowsort") ! @NativeType(layout="([iiippp])V", ctype="void (dummy)", size=4l) ! @CallingConvention(value=1) public void fn(MyStruct s); } ! @C(file="dummy", line=47, column=11, USR="c:@F@struct_upcall") ! @NativeType(layout="(p:([iiip:Vp:Vp:V])V[iiip:Vp:Vp:V])V", ctype="void (struct_upcall_cb, struct MyStruct)", name="struct_upcall", size=1) ! @CallingConvention(value=1) public abstract void struct_upcall(MyStructVisitor v, MyStruct s); } public static class MyStructVisitorImpl implements Index.MyStructVisitor { --- 44,102 ---- public class StructUpcall { private static final boolean DEBUG = false; @NativeHeader public static interface Index { ! @NativeLocation(file="dummy", line=47, column=11, USR="C:@S@MyStruct") ! @NativeStruct("[iiippp]") static interface MyStruct extends Struct<MyStruct> { @Offset(offset=0l) ! @NativeLocation(file="dummy", line=47, column=11, USR="c:@SA@MyStruct@FI@field1") ! @NativeType(layout="i", ctype="enum MyStructField1") int field1$get(); void field1$set(int i); @Offset(offset=32l) ! @NativeLocation(file="dummy", line=47, column=11, USR="c:@SA@MyStruct@FI@field2") ! @NativeType(layout="i", ctype="int") int field2$get(); void field2$set(int i); @Offset(offset=64l) ! @NativeLocation(file="dummy", line=47, column=11, USR="c:@SA@MyStruct@FI@field3") ! @NativeType(layout="i", ctype="int") int field3$get(); void field3$set(int i); @Offset(offset=128l) ! @NativeLocation(file="dummy", line=47, column=11, USR="c:@SA@MyStruct@FI@field4") ! @NativeType(layout="p", ctype="const void *") Pointer<Void> field4$get(); void field4$set(Pointer<?> p); @Offset(offset=192l) ! @NativeLocation(file="dummy", line=47, column=11, USR="c:@SA@MyStruct@FI@field5") ! @NativeType(layout="p", ctype="const void *") Pointer<Void> field5$get(); void field5$set(Pointer<?> p); @Offset(offset=256l) ! @NativeLocation(file="dummy", line=47, column=11, USR="c:@SA@MyStruct@FI@field6") ! @NativeType(layout="p", ctype="const void *") Pointer<Void> field6$get(); void field6$set(Pointer<?> p); } + @NativeCallback("([iiippp])V") @FunctionalInterface static interface MyStructVisitor { ! @NativeLocation(file="dummy", line=47, column=11, USR="c:@F@slowsort") public void fn(MyStruct s); } ! @NativeLocation(file="dummy", line=47, column=11, USR="c:@F@struct_upcall") ! @NativeType(layout="(p:([iiip:Vp:Vp:V])V[iiip:Vp:Vp:V])V", ctype="void (struct_upcall_cb, struct MyStruct)", name="struct_upcall") public abstract void struct_upcall(MyStructVisitor v, MyStruct s); } public static class MyStructVisitorImpl implements Index.MyStructVisitor {
< prev index next >