< prev index next >

test/jdk/com/sun/tools/jextract/simple.java

Print this page


   1 package com.acme;
   2 
   3 import java.nicl.metadata.Offset;
   4 import java.nicl.metadata.NativeHeader;


   5 import java.nicl.metadata.NativeType;
   6 import java.nicl.metadata.CallingConvention;
   7 import java.nicl.metadata.C;
   8 import java.math.BigDecimal;
   9 import java.nicl.types.Pointer;
  10 import java.nicl.types.Struct;
  11 
  12 /**
  13  * This test is platform dependent, as the C type size may vary on platform.
  14  * Current value is based on x64 with __LP64__.
  15  */
  16 @NativeHeader(headerPath="simple.h")
  17 public interface simple {
  18     @C(file="simple.h", line=1, column=5, USR="")
  19     @NativeType(name="global", layout="i", ctype="int", size=4)
  20     public int global$get();
  21     public void global$set(int arg);
  22     public Pointer<Integer> global$ptr();
  23 
  24     @C(file="simple.h", line=7, column=8, USR="")
  25     @NativeType(isRecordType=true, layout="[cosilqFDE]", ctype = "struct anonymous", size = 64)

  26     public static interface anonymous extends Struct<anonymous> {
  27         @C(file="simple.h", line=8, column=10, USR="")
  28         @NativeType(name="ch", layout="c", ctype="char", size=1)
  29         @Offset(offset=0)
  30         public byte ch$get();
  31         public void ch$set(byte arg);
  32         public Pointer<Byte> ch$ptr();
  33 
  34         @C(file="simple.h", line=9, column=17, USR="")
  35         @NativeType(name="sch", layout="o", ctype="signed char", size=1)
  36         @Offset(offset=8)
  37         public byte sch$get();
  38         public void sch$set(byte arg);
  39         public Pointer<Byte> sch$ptr();
  40 
  41         @C(file="simple.h", line=10, column=11, USR="")
  42         @NativeType(name="s", layout="s", ctype="short", size=2)
  43         @Offset(offset=16)
  44         public short s$get();
  45         public void s$set(short arg);
  46         public Pointer<Short> s$ptr();
  47 
  48         @C(file="simple.h", line=11, column=9, USR="")
  49         @NativeType(name="n", layout="i", ctype="int", size=4)
  50         @Offset(offset=32)
  51         public int n$get();
  52         public void n$set(int arg);
  53         public Pointer<Integer> n$ptr();
  54 
  55         @C(file="simple.h", line=12, column=10, USR="")
  56         @NativeType(name="l", layout="l", ctype="long", size=8)
  57         @Offset(offset=64)
  58         public long l$get();
  59         public void l$set(long arg);
  60         public Pointer<Long> l$ptr();
  61 
  62         @C(file="simple.h", line=13, column=15, USR="")
  63         @NativeType(name="ll", layout="q", ctype="long long", size=8)
  64         @Offset(offset=128)
  65         public long ll$get();
  66         public void ll$set(long arg);
  67         public Pointer<Long> ll$ptr();
  68 
  69         @C(file="simple.h", line=14, column=11, USR="")
  70         @NativeType(name="f", layout="F", ctype="float", size=4)
  71         @Offset(offset=192)
  72         public float f$get();
  73         public void f$set(float arg);
  74         public Pointer<Float> f$ptr();
  75 
  76         @C(file="simple.h", line=15, column=12, USR="")
  77         @NativeType(name="d", layout="D", ctype="double", size=8)
  78         @Offset(offset=256)
  79         public double d$get();
  80         public void d$set(double arg);
  81         public Pointer<Double> d$ptr();
  82 
  83         @C(file="simple.h", line=16, column=17, USR="")
  84         @NativeType(name="ld", layout="E", ctype="long double", size=16)
  85         @Offset(offset=384)
  86         public BigDecimal ld$get();
  87         public void ld$set(BigDecimal arg);
  88         public Pointer<BigDecimal> ld$ptr();
  89     }
  90 
  91     @C(file="simple.h", line=17, column=3, USR="")
  92     @NativeType(name="basics", layout="[cosilqFDE]", ctype="struct anonymous", size=64)
  93     public anonymous basics$get();
  94     public void basics$set(anonymous arg);
  95     public Pointer<anonymous> basics$ptr();
  96 
  97     @C(file = "simple.h", line = 20, column = 8, USR = "c:@S@_unsigned")
  98     @NativeType(isRecordType=true, layout="[BOSILQ]", ctype = "struct _unsigned", size = 24)

  99     public static interface _unsigned extends Struct<_unsigned> {
 100         @C(file="simple.h", line=21, column=11, USR="")
 101         @NativeType(name="b", layout="B", ctype = "_Bool", size = 1)
 102         @Offset(offset = 0)
 103         public boolean b$get();
 104         public void b$set(boolean arg);
 105         public Pointer<Boolean> b$ptr();
 106 
 107         @C(file="simple.h", line=22, column=19, USR="")
 108         @NativeType(name="ch", layout="O", ctype = "unsigned char", size = 1)
 109         @Offset(offset = 8)
 110         public byte ch$get();
 111         public void ch$set(byte c);
 112         public Pointer<Byte> ch$ptr();
 113 
 114         @C(file="simple.h", line=23, column=20, USR="")
 115         @NativeType(name="s", layout="S", ctype = "unsigned short", size = 2)
 116         @Offset(offset = 16)
 117         public short s$get();
 118         public void s$set(short s);
 119         public Pointer<Short> s$ptr();
 120 
 121         @C(file="simple.h", line=24, column=18, USR="")
 122         @NativeType(name="n", layout="I", ctype = "unsigned int", size = 4)
 123         @Offset(offset = 32)
 124         public int n$get();
 125         public void n$set(int i);
 126         public Pointer<Integer> n$ptr();
 127 
 128         @C(file="simple.h", line=25, column=19, USR="")
 129         @NativeType(name="l", layout="L", ctype = "unsigned long", size = 8)
 130         @Offset(offset = 64)
 131         public long l$get();
 132         public void l$set(long l);
 133         public Pointer<Long> l$ptr();
 134 
 135         @C(file="simple.h", line=26, column=24, USR="")
 136         @NativeType(name="ll", layout="Q", ctype = "unsigned long long", size = 8)
 137         @Offset(offset = 128)
 138         public long ll$get();
 139         public void ll$set(long l);
 140         public Pointer<Long> ll$ptr();
 141     }
 142 
 143     @C(file="simple.h", line=27, column=4, USR="")
 144     @NativeType(name="unsigned_int", layout="p:[BOSILQ]", ctype="struct _unsigned *", size=8)
 145     public Pointer<_unsigned> unsigned_int$get();
 146     public void unsigned_int$set(Pointer<_unsigned> arg);
 147     public Pointer<Pointer<_unsigned>> unsigned_int$ptr();
 148 
 149     @C(file = "simple.h", line = 29, column = 6, USR = "c:@F@func")
 150     @NativeType(name="func", layout="([cosilqFDE]p:c)V", ctype = "void (struct anonymous, char *)", size = 1)
 151     @CallingConvention(1)
 152     public void func(anonymous s, Pointer<Byte> str);
 153 }
   1 package com.acme;
   2 
   3 import java.nicl.metadata.Offset;
   4 import java.nicl.metadata.NativeHeader;
   5 import java.nicl.metadata.NativeLocation;
   6 import java.nicl.metadata.NativeStruct;
   7 import java.nicl.metadata.NativeType;


   8 import java.math.BigDecimal;
   9 import java.nicl.types.Pointer;
  10 import java.nicl.types.Struct;
  11 
  12 /**
  13  * This test is platform dependent, as the C type size may vary on platform.
  14  * Current value is based on x64 with __LP64__.
  15  */
  16 @NativeHeader(path="simple.h")
  17 public interface simple {
  18     @NativeLocation(file="simple.h", line=1, column=5, USR="")
  19     @NativeType(name="global", layout="i", ctype="int")
  20     public int global$get();
  21     public void global$set(int arg);
  22     public Pointer<Integer> global$ptr();
  23 
  24     @NativeLocation(file="simple.h", line=7, column=8, USR="")
  25     @NativeStruct("[cosilqFDE]")
  26     @NativeType(layout="[cosilqFDE]", ctype = "struct anonymous")
  27     public static interface anonymous extends Struct<anonymous> {
  28         @NativeLocation(file="simple.h", line=8, column=10, USR="")
  29         @NativeType(name="ch", layout="c", ctype="char")
  30         @Offset(offset=0)
  31         public byte ch$get();
  32         public void ch$set(byte arg);
  33         public Pointer<Byte> ch$ptr();
  34 
  35         @NativeLocation(file="simple.h", line=9, column=17, USR="")
  36         @NativeType(name="sch", layout="o", ctype="signed char")
  37         @Offset(offset=8)
  38         public byte sch$get();
  39         public void sch$set(byte arg);
  40         public Pointer<Byte> sch$ptr();
  41 
  42         @NativeLocation(file="simple.h", line=10, column=11, USR="")
  43         @NativeType(name="s", layout="s", ctype="short")
  44         @Offset(offset=16)
  45         public short s$get();
  46         public void s$set(short arg);
  47         public Pointer<Short> s$ptr();
  48 
  49         @NativeLocation(file="simple.h", line=11, column=9, USR="")
  50         @NativeType(name="n", layout="i", ctype="int")
  51         @Offset(offset=32)
  52         public int n$get();
  53         public void n$set(int arg);
  54         public Pointer<Integer> n$ptr();
  55 
  56         @NativeLocation(file="simple.h", line=12, column=10, USR="")
  57         @NativeType(name="l", layout="l", ctype="long")
  58         @Offset(offset=64)
  59         public long l$get();
  60         public void l$set(long arg);
  61         public Pointer<Long> l$ptr();
  62 
  63         @NativeLocation(file="simple.h", line=13, column=15, USR="")
  64         @NativeType(name="ll", layout="q", ctype="long long")
  65         @Offset(offset=128)
  66         public long ll$get();
  67         public void ll$set(long arg);
  68         public Pointer<Long> ll$ptr();
  69 
  70         @NativeLocation(file="simple.h", line=14, column=11, USR="")
  71         @NativeType(name="f", layout="F", ctype="float")
  72         @Offset(offset=192)
  73         public float f$get();
  74         public void f$set(float arg);
  75         public Pointer<Float> f$ptr();
  76 
  77         @NativeLocation(file="simple.h", line=15, column=12, USR="")
  78         @NativeType(name="d", layout="D", ctype="double")
  79         @Offset(offset=256)
  80         public double d$get();
  81         public void d$set(double arg);
  82         public Pointer<Double> d$ptr();
  83 
  84         @NativeLocation(file="simple.h", line=16, column=17, USR="")
  85         @NativeType(name="ld", layout="E", ctype="long double")
  86         @Offset(offset=384)
  87         public BigDecimal ld$get();
  88         public void ld$set(BigDecimal arg);
  89         public Pointer<BigDecimal> ld$ptr();
  90     }
  91 
  92     @NativeLocation(file="simple.h", line=17, column=3, USR="")
  93     @NativeType(name="basics", layout="[cosilqFDE]", ctype="struct anonymous")
  94     public anonymous basics$get();
  95     public void basics$set(anonymous arg);
  96     public Pointer<anonymous> basics$ptr();
  97 
  98     @NativeLocation(file = "simple.h", line = 20, column = 8, USR = "c:@S@_unsigned")
  99     @NativeStruct("[BOSILQ]")
 100     @NativeType(layout="[BOSILQ]", ctype = "struct _unsigned")
 101     public static interface _unsigned extends Struct<_unsigned> {
 102         @NativeLocation(file="simple.h", line=21, column=11, USR="")
 103         @NativeType(name="b", layout="B", ctype = "_Bool")
 104         @Offset(offset = 0)
 105         public boolean b$get();
 106         public void b$set(boolean arg);
 107         public Pointer<Boolean> b$ptr();
 108 
 109         @NativeLocation(file="simple.h", line=22, column=19, USR="")
 110         @NativeType(name="ch", layout="O", ctype = "unsigned char")
 111         @Offset(offset = 8)
 112         public byte ch$get();
 113         public void ch$set(byte c);
 114         public Pointer<Byte> ch$ptr();
 115 
 116         @NativeLocation(file="simple.h", line=23, column=20, USR="")
 117         @NativeType(name="s", layout="S", ctype = "unsigned short")
 118         @Offset(offset = 16)
 119         public short s$get();
 120         public void s$set(short s);
 121         public Pointer<Short> s$ptr();
 122 
 123         @NativeLocation(file="simple.h", line=24, column=18, USR="")
 124         @NativeType(name="n", layout="I", ctype = "unsigned int")
 125         @Offset(offset = 32)
 126         public int n$get();
 127         public void n$set(int i);
 128         public Pointer<Integer> n$ptr();
 129 
 130         @NativeLocation(file="simple.h", line=25, column=19, USR="")
 131         @NativeType(name="l", layout="L", ctype = "unsigned long")
 132         @Offset(offset = 64)
 133         public long l$get();
 134         public void l$set(long l);
 135         public Pointer<Long> l$ptr();
 136 
 137         @NativeLocation(file="simple.h", line=26, column=24, USR="")
 138         @NativeType(name="ll", layout="Q", ctype = "unsigned long long")
 139         @Offset(offset = 128)
 140         public long ll$get();
 141         public void ll$set(long l);
 142         public Pointer<Long> ll$ptr();
 143     }
 144 
 145     @NativeLocation(file="simple.h", line=27, column=4, USR="")
 146     @NativeType(name="unsigned_int", layout="p:[BOSILQ]", ctype="struct _unsigned *")
 147     public Pointer<_unsigned> unsigned_int$get();
 148     public void unsigned_int$set(Pointer<_unsigned> arg);
 149     public Pointer<Pointer<_unsigned>> unsigned_int$ptr();
 150 
 151     @NativeLocation(file = "simple.h", line = 29, column = 6, USR = "c:@F@func")
 152     @NativeType(name="func", layout="([cosilqFDE]p:c)V", ctype = "void (struct anonymous, char *)")

 153     public void func(anonymous s, Pointer<Byte> str);
 154 }
< prev index next >