github.com/thommil/tge-mobile@v0.0.0-20190308225214-66a08abd51aa/bind/testdata/java.go.golden (about) 1 // File is generated by gobind. Do not edit. 2 3 package Float 4 5 import "Java" 6 7 const _ = Java.Dummy 8 9 const ( 10 MAX_VALUE = 3.4028235E38 11 MIN_NORMAL = 1.17549435E-38 12 MIN_VALUE = 1.4E-45 13 MAX_EXPONENT = 127 14 MIN_EXPONENT = -126 15 SIZE = 32 16 BYTES = 4 17 ) 18 19 var ( 20 // Cast takes a proxy for a Java object and converts it to a java.lang.Float proxy. 21 // Cast panics if the argument is not a proxy or if the underlying object does 22 // not extend or implement java.lang.Float. 23 Cast func(v interface{}) Java.Java_lang_Float 24 ) 25 26 // File is generated by gobind. Do not edit. 27 28 package lang 29 30 import "Java" 31 32 const _ = Java.Dummy 33 34 type Float Java.Java_lang_Float 35 type Long Java.Java_lang_Long 36 type Object Java.Java_lang_Object 37 type Runnable Java.Java_lang_Runnable 38 // File is generated by gobind. Do not edit. 39 40 package Long 41 42 import "Java" 43 44 const _ = Java.Dummy 45 46 const ( 47 MIN_VALUE = -9223372036854775808 48 MAX_VALUE = 9223372036854775807 49 SIZE = 64 50 BYTES = 8 51 ) 52 53 var ( 54 // Cast takes a proxy for a Java object and converts it to a java.lang.Long proxy. 55 // Cast panics if the argument is not a proxy or if the underlying object does 56 // not extend or implement java.lang.Long. 57 Cast func(v interface{}) Java.Java_lang_Long 58 ) 59 60 // File is generated by gobind. Do not edit. 61 62 package Object 63 64 import "Java" 65 66 const _ = Java.Dummy 67 68 const ( 69 ) 70 71 var ( 72 // Cast takes a proxy for a Java object and converts it to a java.lang.Object proxy. 73 // Cast panics if the argument is not a proxy or if the underlying object does 74 // not extend or implement java.lang.Object. 75 Cast func(v interface{}) Java.Java_lang_Object 76 ) 77 78 // File is generated by gobind. Do not edit. 79 80 package Runnable 81 82 import "Java" 83 84 const _ = Java.Dummy 85 86 const ( 87 ) 88 89 var ( 90 // Cast takes a proxy for a Java object and converts it to a java.lang.Runnable proxy. 91 // Cast panics if the argument is not a proxy or if the underlying object does 92 // not extend or implement java.lang.Runnable. 93 Cast func(v interface{}) Java.Java_lang_Runnable 94 ) 95 96 // File is generated by gobind. Do not edit. 97 98 package Java 99 100 // Used to silence this package not used errors 101 const Dummy = 0 102 103 type Java_lang_Float interface { 104 ToString() string 105 } 106 107 type Java_lang_Long interface { 108 ToString() string 109 } 110 111 type Java_lang_Object interface { 112 ToString() string 113 } 114 115 type Java_lang_Runnable interface { 116 } 117 118 // File is generated by gobind. Do not edit. 119 120 package main 121 122 /* 123 #include <stdlib.h> // for free() 124 #include <jni.h> 125 #include "seq.h" 126 #include "classes.h" 127 */ 128 import "C" 129 130 import ( 131 "Java" 132 _seq "github.com/thommil/tge-mobile/bind/seq" 133 ) 134 135 import "Java/java/lang/Float" 136 import "Java/java/lang/Long" 137 import "Java/java/lang/Object" 138 import "Java/java/lang/Runnable" 139 import "unsafe" 140 141 import "reflect" 142 143 import "fmt" 144 145 type proxy interface { Bind_proxy_refnum__() int32 } 146 147 // Suppress unused package error 148 149 var _ = _seq.FromRefNum 150 const _ = Java.Dummy 151 152 //export initClasses 153 func initClasses() { 154 C.init_proxies() 155 init_java_lang_Float() 156 init_java_lang_Long() 157 init_java_lang_Object() 158 init_java_lang_Runnable() 159 } 160 161 var class_java_lang_Float C.jclass 162 163 func init_java_lang_Float() { 164 cls := C.CString("java/lang/Float") 165 clazz := C.go_seq_find_class(cls) 166 C.free(unsafe.Pointer(cls)) 167 if uintptr(clazz) == 0 { 168 return 169 } 170 class_java_lang_Float = clazz 171 Float.Cast = func(v interface{}) Java.Java_lang_Float { 172 t := reflect.TypeOf((*proxy_class_java_lang_Float)(nil)) 173 cv := reflect.ValueOf(v).Convert(t).Interface().(*proxy_class_java_lang_Float) 174 ref := C.jint(_seq.ToRefNum(cv)) 175 if C.go_seq_isinstanceof(ref, class_java_lang_Float) != 1 { 176 panic(fmt.Errorf("%T is not an instance of %s", v, "java.lang.Float")) 177 } 178 return cv 179 } 180 } 181 182 type proxy_class_java_lang_Float _seq.Ref 183 184 func (p *proxy_class_java_lang_Float) Bind_proxy_refnum__() int32 { return (*_seq.Ref)(p).Bind_IncNum() } 185 186 func (p *proxy_class_java_lang_Float) ToString() string { 187 res := C.cproxy_java_lang_Float_toString(C.jint(p.Bind_proxy_refnum__())) 188 _res := decodeString(res.res) 189 var _exc error 190 _exc_ref := _seq.FromRefNum(int32(res.exc)) 191 if _exc_ref != nil { 192 if res.exc < 0 { // go object 193 _exc = _exc_ref.Get().(error) 194 } else { // foreign object 195 _exc = (*proxy_error)(_exc_ref) 196 } 197 } 198 if (_exc != nil) { panic(_exc) } 199 return _res 200 } 201 202 var class_java_lang_Long C.jclass 203 204 func init_java_lang_Long() { 205 cls := C.CString("java/lang/Long") 206 clazz := C.go_seq_find_class(cls) 207 C.free(unsafe.Pointer(cls)) 208 if uintptr(clazz) == 0 { 209 return 210 } 211 class_java_lang_Long = clazz 212 Long.Cast = func(v interface{}) Java.Java_lang_Long { 213 t := reflect.TypeOf((*proxy_class_java_lang_Long)(nil)) 214 cv := reflect.ValueOf(v).Convert(t).Interface().(*proxy_class_java_lang_Long) 215 ref := C.jint(_seq.ToRefNum(cv)) 216 if C.go_seq_isinstanceof(ref, class_java_lang_Long) != 1 { 217 panic(fmt.Errorf("%T is not an instance of %s", v, "java.lang.Long")) 218 } 219 return cv 220 } 221 } 222 223 type proxy_class_java_lang_Long _seq.Ref 224 225 func (p *proxy_class_java_lang_Long) Bind_proxy_refnum__() int32 { return (*_seq.Ref)(p).Bind_IncNum() } 226 227 func (p *proxy_class_java_lang_Long) ToString() string { 228 res := C.cproxy_java_lang_Long_toString(C.jint(p.Bind_proxy_refnum__())) 229 _res := decodeString(res.res) 230 var _exc error 231 _exc_ref := _seq.FromRefNum(int32(res.exc)) 232 if _exc_ref != nil { 233 if res.exc < 0 { // go object 234 _exc = _exc_ref.Get().(error) 235 } else { // foreign object 236 _exc = (*proxy_error)(_exc_ref) 237 } 238 } 239 if (_exc != nil) { panic(_exc) } 240 return _res 241 } 242 243 var class_java_lang_Object C.jclass 244 245 func init_java_lang_Object() { 246 cls := C.CString("java/lang/Object") 247 clazz := C.go_seq_find_class(cls) 248 C.free(unsafe.Pointer(cls)) 249 if uintptr(clazz) == 0 { 250 return 251 } 252 class_java_lang_Object = clazz 253 Object.Cast = func(v interface{}) Java.Java_lang_Object { 254 t := reflect.TypeOf((*proxy_class_java_lang_Object)(nil)) 255 cv := reflect.ValueOf(v).Convert(t).Interface().(*proxy_class_java_lang_Object) 256 ref := C.jint(_seq.ToRefNum(cv)) 257 if C.go_seq_isinstanceof(ref, class_java_lang_Object) != 1 { 258 panic(fmt.Errorf("%T is not an instance of %s", v, "java.lang.Object")) 259 } 260 return cv 261 } 262 } 263 264 type proxy_class_java_lang_Object _seq.Ref 265 266 func (p *proxy_class_java_lang_Object) Bind_proxy_refnum__() int32 { return (*_seq.Ref)(p).Bind_IncNum() } 267 268 func (p *proxy_class_java_lang_Object) ToString() string { 269 res := C.cproxy_java_lang_Object_toString(C.jint(p.Bind_proxy_refnum__())) 270 _res := decodeString(res.res) 271 var _exc error 272 _exc_ref := _seq.FromRefNum(int32(res.exc)) 273 if _exc_ref != nil { 274 if res.exc < 0 { // go object 275 _exc = _exc_ref.Get().(error) 276 } else { // foreign object 277 _exc = (*proxy_error)(_exc_ref) 278 } 279 } 280 if (_exc != nil) { panic(_exc) } 281 return _res 282 } 283 284 var class_java_lang_Runnable C.jclass 285 286 func init_java_lang_Runnable() { 287 cls := C.CString("java/lang/Runnable") 288 clazz := C.go_seq_find_class(cls) 289 C.free(unsafe.Pointer(cls)) 290 if uintptr(clazz) == 0 { 291 return 292 } 293 class_java_lang_Runnable = clazz 294 Runnable.Cast = func(v interface{}) Java.Java_lang_Runnable { 295 t := reflect.TypeOf((*proxy_class_java_lang_Runnable)(nil)) 296 cv := reflect.ValueOf(v).Convert(t).Interface().(*proxy_class_java_lang_Runnable) 297 ref := C.jint(_seq.ToRefNum(cv)) 298 if C.go_seq_isinstanceof(ref, class_java_lang_Runnable) != 1 { 299 panic(fmt.Errorf("%T is not an instance of %s", v, "java.lang.Runnable")) 300 } 301 return cv 302 } 303 } 304 305 type proxy_class_java_lang_Runnable _seq.Ref 306 307 func (p *proxy_class_java_lang_Runnable) Bind_proxy_refnum__() int32 { return (*_seq.Ref)(p).Bind_IncNum() } 308 309 // Package main is an autogenerated binder stub for package java. 310 // gobind -lang=go java 311 // 312 // File is generated by gobind. Do not edit. 313 package main 314 315 /* 316 #include <stdlib.h> 317 #include <stdint.h> 318 #include "seq.h" 319 #include "java.h" 320 321 */ 322 import "C" 323 324 import ( 325 _seq "github.com/thommil/tge-mobile/bind/seq" 326 "java" 327 ) 328 329 // suppress the error if seq ends up unused 330 var _ = _seq.FromRefNum 331 332 //export proxyjava_F_ToString 333 func proxyjava_F_ToString(refnum C.int32_t) C.nstring { 334 ref := _seq.FromRefNum(int32(refnum)) 335 v := ref.Get().(java.F) 336 res_0 := v.ToString() 337 _res_0 := encodeString(res_0) 338 return _res_0 339 } 340 341 type proxyjava_F _seq.Ref 342 343 func (p *proxyjava_F) Bind_proxy_refnum__() int32 { return (*_seq.Ref)(p).Bind_IncNum() } 344 345 func (p *proxyjava_F) ToString() string { 346 res := C.cproxyjava_F_ToString(C.int32_t(p.Bind_proxy_refnum__())) 347 _res := decodeString(res) 348 return _res 349 } 350 351 //export proxyjava_L_ToString 352 func proxyjava_L_ToString(refnum C.int32_t) C.nstring { 353 ref := _seq.FromRefNum(int32(refnum)) 354 v := ref.Get().(java.L) 355 res_0 := v.ToString() 356 _res_0 := encodeString(res_0) 357 return _res_0 358 } 359 360 type proxyjava_L _seq.Ref 361 362 func (p *proxyjava_L) Bind_proxy_refnum__() int32 { return (*_seq.Ref)(p).Bind_IncNum() } 363 364 func (p *proxyjava_L) ToString() string { 365 res := C.cproxyjava_L_ToString(C.int32_t(p.Bind_proxy_refnum__())) 366 _res := decodeString(res) 367 return _res 368 } 369 370 //export proxyjava_O_ToString 371 func proxyjava_O_ToString(refnum C.int32_t) C.nstring { 372 ref := _seq.FromRefNum(int32(refnum)) 373 v := ref.Get().(java.O) 374 res_0 := v.ToString() 375 _res_0 := encodeString(res_0) 376 return _res_0 377 } 378 379 type proxyjava_O _seq.Ref 380 381 func (p *proxyjava_O) Bind_proxy_refnum__() int32 { return (*_seq.Ref)(p).Bind_IncNum() } 382 383 func (p *proxyjava_O) ToString() string { 384 res := C.cproxyjava_O_ToString(C.int32_t(p.Bind_proxy_refnum__())) 385 _res := decodeString(res) 386 return _res 387 } 388 389 type proxyjava_R _seq.Ref 390 391 func (p *proxyjava_R) Bind_proxy_refnum__() int32 { return (*_seq.Ref)(p).Bind_IncNum() }