github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/mobile/bind/objc/testpkg/objc_testpkg/GoTestpkg.m (about) 1 // Objective-C API for talking to golang.org/x/mobile/bind/objc/testpkg Go package. 2 // gobind -lang=objc golang.org/x/mobile/bind/objc/testpkg 3 // 4 // File is generated by gobind. Do not edit. 5 6 #include "GoTestpkg.h" 7 #include <Foundation/Foundation.h> 8 #include "seq.h" 9 10 static NSString* errDomain = @"go.golang.org/x/mobile/bind/objc/testpkg"; 11 12 @protocol goSeqRefInterface 13 -(GoSeqRef*) _ref; 14 @end 15 16 #define _DESCRIPTOR_ "testpkg" 17 18 @class GoTestpkgI; 19 20 @class GoTestpkgZ; 21 22 @interface GoTestpkgI : NSObject <GoTestpkgI> { 23 } 24 @property(strong, readonly) id _ref; 25 26 - (id)initWithRef:(id)ref; 27 - (BOOL)error:(BOOL)triggerError error:(NSError**)error; 28 - (BOOL)stringError:(NSString*)s ret0_:(NSString**)ret0_ error:(NSError**)error; 29 - (int64_t)times:(int32_t)v; 30 @end 31 32 @interface GoTestpkgZ : NSObject <GoTestpkgZ> { 33 } 34 @property(strong, readonly) id _ref; 35 36 - (id)initWithRef:(id)ref; 37 @end 38 39 #define _GO_testpkg_Node_DESCRIPTOR_ "go.testpkg.Node" 40 #define _GO_testpkg_Node_FIELD_V_GET_ (0x00f) 41 #define _GO_testpkg_Node_FIELD_V_SET_ (0x01f) 42 #define _GO_testpkg_Node_FIELD_Err_GET_ (0x10f) 43 #define _GO_testpkg_Node_FIELD_Err_SET_ (0x11f) 44 45 @implementation GoTestpkgNode { 46 } 47 48 - (id)initWithRef:(id)ref { 49 self = [super init]; 50 if (self) { __ref = ref; } 51 return self; 52 } 53 54 - (NSString*)v { 55 GoSeq in_ = {}; 56 GoSeq out_ = {}; 57 go_seq_writeRef(&in_, self._ref); 58 go_seq_send(_GO_testpkg_Node_DESCRIPTOR_, _GO_testpkg_Node_FIELD_V_GET_, &in_, &out_); 59 NSString* ret_ = go_seq_readUTF8(&out_); 60 go_seq_free(&in_); 61 go_seq_free(&out_); 62 return ret_; 63 } 64 65 - (void)setV:(NSString*)v { 66 GoSeq in_ = {}; 67 GoSeq out_ = {}; 68 go_seq_writeRef(&in_, self._ref); 69 go_seq_writeUTF8(&in_, v); 70 go_seq_send(_GO_testpkg_Node_DESCRIPTOR_, _GO_testpkg_Node_FIELD_V_SET_, &in_, &out_); 71 go_seq_free(&in_); 72 go_seq_free(&out_); 73 } 74 75 - (NSString*)err { 76 GoSeq in_ = {}; 77 GoSeq out_ = {}; 78 go_seq_writeRef(&in_, self._ref); 79 go_seq_send(_GO_testpkg_Node_DESCRIPTOR_, _GO_testpkg_Node_FIELD_Err_GET_, &in_, &out_); 80 NSString* ret_ = go_seq_readUTF8(&out_); 81 go_seq_free(&in_); 82 go_seq_free(&out_); 83 return ret_; 84 } 85 86 - (void)setErr:(NSString*)v { 87 GoSeq in_ = {}; 88 GoSeq out_ = {}; 89 go_seq_writeRef(&in_, self._ref); 90 go_seq_writeUTF8(&in_, v); 91 go_seq_send(_GO_testpkg_Node_DESCRIPTOR_, _GO_testpkg_Node_FIELD_Err_SET_, &in_, &out_); 92 go_seq_free(&in_); 93 go_seq_free(&out_); 94 } 95 96 @end 97 98 #define _GO_testpkg_S_DESCRIPTOR_ "go.testpkg.S" 99 #define _GO_testpkg_S_FIELD_X_GET_ (0x00f) 100 #define _GO_testpkg_S_FIELD_X_SET_ (0x01f) 101 #define _GO_testpkg_S_FIELD_Y_GET_ (0x10f) 102 #define _GO_testpkg_S_FIELD_Y_SET_ (0x11f) 103 #define _GO_testpkg_S_Sum_ (0x00c) 104 #define _GO_testpkg_S_TryTwoStrings_ (0x10c) 105 106 @implementation GoTestpkgS { 107 } 108 109 - (id)initWithRef:(id)ref { 110 self = [super init]; 111 if (self) { __ref = ref; } 112 return self; 113 } 114 115 - (double)x { 116 GoSeq in_ = {}; 117 GoSeq out_ = {}; 118 go_seq_writeRef(&in_, self._ref); 119 go_seq_send(_GO_testpkg_S_DESCRIPTOR_, _GO_testpkg_S_FIELD_X_GET_, &in_, &out_); 120 double ret_ = go_seq_readFloat64(&out_); 121 go_seq_free(&in_); 122 go_seq_free(&out_); 123 return ret_; 124 } 125 126 - (void)setX:(double)v { 127 GoSeq in_ = {}; 128 GoSeq out_ = {}; 129 go_seq_writeRef(&in_, self._ref); 130 go_seq_writeFloat64(&in_, v); 131 go_seq_send(_GO_testpkg_S_DESCRIPTOR_, _GO_testpkg_S_FIELD_X_SET_, &in_, &out_); 132 go_seq_free(&in_); 133 go_seq_free(&out_); 134 } 135 136 - (double)y { 137 GoSeq in_ = {}; 138 GoSeq out_ = {}; 139 go_seq_writeRef(&in_, self._ref); 140 go_seq_send(_GO_testpkg_S_DESCRIPTOR_, _GO_testpkg_S_FIELD_Y_GET_, &in_, &out_); 141 double ret_ = go_seq_readFloat64(&out_); 142 go_seq_free(&in_); 143 go_seq_free(&out_); 144 return ret_; 145 } 146 147 - (void)setY:(double)v { 148 GoSeq in_ = {}; 149 GoSeq out_ = {}; 150 go_seq_writeRef(&in_, self._ref); 151 go_seq_writeFloat64(&in_, v); 152 go_seq_send(_GO_testpkg_S_DESCRIPTOR_, _GO_testpkg_S_FIELD_Y_SET_, &in_, &out_); 153 go_seq_free(&in_); 154 go_seq_free(&out_); 155 } 156 157 - (double)sum { 158 GoSeq in_ = {}; 159 GoSeq out_ = {}; 160 go_seq_writeRef(&in_, self._ref); 161 go_seq_send(_GO_testpkg_S_DESCRIPTOR_, _GO_testpkg_S_Sum_, &in_, &out_); 162 double ret0_ = go_seq_readFloat64(&out_); 163 go_seq_free(&in_); 164 go_seq_free(&out_); 165 return ret0_; 166 } 167 168 - (NSString*)tryTwoStrings:(NSString*)first second:(NSString*)second { 169 GoSeq in_ = {}; 170 GoSeq out_ = {}; 171 go_seq_writeRef(&in_, self._ref); 172 go_seq_writeUTF8(&in_, first); 173 go_seq_writeUTF8(&in_, second); 174 go_seq_send(_GO_testpkg_S_DESCRIPTOR_, _GO_testpkg_S_TryTwoStrings_, &in_, &out_); 175 NSString* ret0_ = go_seq_readUTF8(&out_); 176 go_seq_free(&in_); 177 go_seq_free(&out_); 178 return ret0_; 179 } 180 181 @end 182 183 #define _GO_testpkg_StructThatStartsWithLetterBeforeZ_DESCRIPTOR_ "go.testpkg.StructThatStartsWithLetterBeforeZ" 184 #define _GO_testpkg_StructThatStartsWithLetterBeforeZ_FIELD_Value_GET_ (0x00f) 185 #define _GO_testpkg_StructThatStartsWithLetterBeforeZ_FIELD_Value_SET_ (0x01f) 186 187 @implementation GoTestpkgStructThatStartsWithLetterBeforeZ { 188 } 189 190 - (id)initWithRef:(id)ref { 191 self = [super init]; 192 if (self) { __ref = ref; } 193 return self; 194 } 195 196 - (id<GoTestpkgZ>)value { 197 GoSeq in_ = {}; 198 GoSeq out_ = {}; 199 go_seq_writeRef(&in_, self._ref); 200 go_seq_send(_GO_testpkg_StructThatStartsWithLetterBeforeZ_DESCRIPTOR_, _GO_testpkg_StructThatStartsWithLetterBeforeZ_FIELD_Value_GET_, &in_, &out_); 201 GoSeqRef* ret__ref = go_seq_readRef(&out_); 202 id<GoTestpkgZ> ret_ = ret__ref.obj; 203 if (ret_ == NULL) { 204 ret_ = [[GoTestpkgZ alloc] initWithRef:ret__ref]; 205 } 206 go_seq_free(&in_); 207 go_seq_free(&out_); 208 return ret_; 209 } 210 211 - (void)setValue:(id<GoTestpkgZ>)v { 212 GoSeq in_ = {}; 213 GoSeq out_ = {}; 214 go_seq_writeRef(&in_, self._ref); 215 if ([(id<NSObject>)(v) isKindOfClass:[GoTestpkgZ class]]) { 216 id<goSeqRefInterface> v_proxy = (id<goSeqRefInterface>)(v); 217 go_seq_writeRef(&in_, v_proxy._ref); 218 } else { 219 go_seq_writeObjcRef(&in_, v); 220 } 221 go_seq_send(_GO_testpkg_StructThatStartsWithLetterBeforeZ_DESCRIPTOR_, _GO_testpkg_StructThatStartsWithLetterBeforeZ_FIELD_Value_SET_, &in_, &out_); 222 go_seq_free(&in_); 223 go_seq_free(&out_); 224 } 225 226 @end 227 228 #define _GO_testpkg_I_DESCRIPTOR_ "go.testpkg.I" 229 #define _GO_testpkg_I_Error_ (0x10a) 230 #define _GO_testpkg_I_StringError_ (0x20a) 231 #define _GO_testpkg_I_Times_ (0x30a) 232 233 @implementation GoTestpkgI { 234 } 235 236 - (id)initWithRef:(id)ref { 237 self = [super init]; 238 if (self) { __ref = ref; } 239 return self; 240 } 241 242 - (BOOL)error:(BOOL)triggerError error:(NSError**)error { 243 GoSeq in_ = {}; 244 GoSeq out_ = {}; 245 go_seq_writeRef(&in_, self._ref); 246 go_seq_writeBool(&in_, triggerError); 247 go_seq_send(_GO_testpkg_I_DESCRIPTOR_, _GO_testpkg_I_Error_, &in_, &out_); 248 NSString* _error = go_seq_readUTF8(&out_); 249 if ([_error length] != 0 && error != nil) { 250 NSMutableDictionary* details = [NSMutableDictionary dictionary]; 251 [details setValue:_error forKey:NSLocalizedDescriptionKey]; 252 *error = [NSError errorWithDomain:errDomain code:1 userInfo:details]; 253 } 254 go_seq_free(&in_); 255 go_seq_free(&out_); 256 return ([_error length] == 0); 257 } 258 259 - (BOOL)stringError:(NSString*)s ret0_:(NSString**)ret0_ error:(NSError**)error { 260 GoSeq in_ = {}; 261 GoSeq out_ = {}; 262 go_seq_writeRef(&in_, self._ref); 263 go_seq_writeUTF8(&in_, s); 264 go_seq_send(_GO_testpkg_I_DESCRIPTOR_, _GO_testpkg_I_StringError_, &in_, &out_); 265 NSString* ret0__val = go_seq_readUTF8(&out_); 266 if (ret0_ != NULL) { 267 *ret0_ = ret0__val; 268 } 269 NSString* _error = go_seq_readUTF8(&out_); 270 if ([_error length] != 0 && error != nil) { 271 NSMutableDictionary* details = [NSMutableDictionary dictionary]; 272 [details setValue:_error forKey:NSLocalizedDescriptionKey]; 273 *error = [NSError errorWithDomain:errDomain code:1 userInfo:details]; 274 } 275 go_seq_free(&in_); 276 go_seq_free(&out_); 277 return ([_error length] == 0); 278 } 279 280 - (int64_t)times:(int32_t)v { 281 GoSeq in_ = {}; 282 GoSeq out_ = {}; 283 go_seq_writeRef(&in_, self._ref); 284 go_seq_writeInt32(&in_, v); 285 go_seq_send(_GO_testpkg_I_DESCRIPTOR_, _GO_testpkg_I_Times_, &in_, &out_); 286 int64_t ret0_ = go_seq_readInt64(&out_); 287 go_seq_free(&in_); 288 go_seq_free(&out_); 289 return ret0_; 290 } 291 292 @end 293 294 static void proxyGoTestpkgI(id obj, int code, GoSeq* in, GoSeq* out) { 295 switch (code) { 296 case _GO_testpkg_I_Error_: { 297 id<GoTestpkgI> o = (id<GoTestpkgI>)(obj); 298 BOOL triggerError = go_seq_readBool(in); 299 NSError* error = NULL; 300 BOOL returnVal = [o error:triggerError error:&error]; 301 if (returnVal) { 302 go_seq_writeUTF8(out, NULL); 303 } else { 304 NSString* errorDesc = [error localizedDescription]; 305 if (errorDesc == NULL || errorDesc.length == 0) { 306 errorDesc = @"gobind: unknown error"; 307 } 308 go_seq_writeUTF8(out, errorDesc); 309 } 310 } break; 311 case _GO_testpkg_I_StringError_: { 312 id<GoTestpkgI> o = (id<GoTestpkgI>)(obj); 313 NSString* s = go_seq_readUTF8(in); 314 NSString* ret0_; 315 NSError* error = NULL; 316 BOOL returnVal = [o stringError:s ret0_:&ret0_ error:&error]; 317 go_seq_writeUTF8(out, ret0_); 318 if (returnVal) { 319 go_seq_writeUTF8(out, NULL); 320 } else { 321 NSString* errorDesc = [error localizedDescription]; 322 if (errorDesc == NULL || errorDesc.length == 0) { 323 errorDesc = @"gobind: unknown error"; 324 } 325 go_seq_writeUTF8(out, errorDesc); 326 } 327 } break; 328 case _GO_testpkg_I_Times_: { 329 id<GoTestpkgI> o = (id<GoTestpkgI>)(obj); 330 int32_t v = go_seq_readInt32(in); 331 int64_t returnVal = [o times:v]; 332 go_seq_writeInt64(out, returnVal); 333 } break; 334 default: 335 NSLog(@"unknown code %x for _GO_testpkg_I_DESCRIPTOR_", code); 336 } 337 } 338 339 #define _GO_testpkg_Z_DESCRIPTOR_ "go.testpkg.Z" 340 341 @implementation GoTestpkgZ { 342 } 343 344 - (id)initWithRef:(id)ref { 345 self = [super init]; 346 if (self) { __ref = ref; } 347 return self; 348 } 349 350 @end 351 352 static void proxyGoTestpkgZ(id obj, int code, GoSeq* in, GoSeq* out) { 353 switch (code) { 354 default: 355 NSLog(@"unknown code %x for _GO_testpkg_Z_DESCRIPTOR_", code); 356 } 357 } 358 359 const BOOL GoTestpkgABool = YES; 360 const double GoTestpkgAFloat = 0.12345; 361 NSString* const GoTestpkgAString = @"a string"; 362 const int64_t GoTestpkgAnInt = 7LL; 363 const double GoTestpkgLog2E = 1.4426950408889634; 364 const float GoTestpkgMaxFloat32 = 3.4028234663852886e+38; 365 const double GoTestpkgMaxFloat64 = 1.7976931348623157e+308; 366 const int32_t GoTestpkgMaxInt32 = 2147483647; 367 const int64_t GoTestpkgMaxInt64 = 9223372036854775807LL; 368 const int32_t GoTestpkgMinInt32 = -2147483648; 369 const int64_t GoTestpkgMinInt64 = -9223372036854775807LL-1; 370 const float GoTestpkgSmallestNonzeroFloat32 = 0; 371 const double GoTestpkgSmallestNonzeroFloat64 = 5e-324; 372 373 @implementation GoTestpkg 374 + (void) setIntVar:(int)v { 375 GoSeq in_ = {}; 376 GoSeq out_ = {}; 377 go_seq_writeInt(&in_, v); 378 go_seq_send("testpkg.IntVar", 1, &in_, &out_); 379 go_seq_free(&in_); 380 go_seq_free(&out_); 381 } 382 383 + (int) intVar { 384 GoSeq in_ = {}; 385 GoSeq out_ = {}; 386 go_seq_send("testpkg.IntVar", 2, &in_, &out_); 387 int ret = go_seq_readInt(&out_); 388 go_seq_free(&in_); 389 go_seq_free(&out_); 390 return ret; 391 } 392 393 + (void) setInterfaceVar:(id<GoTestpkgI>)v { 394 GoSeq in_ = {}; 395 GoSeq out_ = {}; 396 if ([(id<NSObject>)(v) isKindOfClass:[GoTestpkgI class]]) { 397 id<goSeqRefInterface> v_proxy = (id<goSeqRefInterface>)(v); 398 go_seq_writeRef(&in_, v_proxy._ref); 399 } else { 400 go_seq_writeObjcRef(&in_, v); 401 } 402 go_seq_send("testpkg.InterfaceVar", 1, &in_, &out_); 403 go_seq_free(&in_); 404 go_seq_free(&out_); 405 } 406 407 + (id<GoTestpkgI>) interfaceVar { 408 GoSeq in_ = {}; 409 GoSeq out_ = {}; 410 go_seq_send("testpkg.InterfaceVar", 2, &in_, &out_); 411 GoSeqRef* ret_ref = go_seq_readRef(&out_); 412 id<GoTestpkgI> ret = ret_ref.obj; 413 if (ret == NULL) { 414 ret = [[GoTestpkgI alloc] initWithRef:ret_ref]; 415 } 416 go_seq_free(&in_); 417 go_seq_free(&out_); 418 return ret; 419 } 420 421 + (void) setStringVar:(NSString*)v { 422 GoSeq in_ = {}; 423 GoSeq out_ = {}; 424 go_seq_writeUTF8(&in_, v); 425 go_seq_send("testpkg.StringVar", 1, &in_, &out_); 426 go_seq_free(&in_); 427 go_seq_free(&out_); 428 } 429 430 + (NSString*) stringVar { 431 GoSeq in_ = {}; 432 GoSeq out_ = {}; 433 go_seq_send("testpkg.StringVar", 2, &in_, &out_); 434 NSString* ret = go_seq_readUTF8(&out_); 435 go_seq_free(&in_); 436 go_seq_free(&out_); 437 return ret; 438 } 439 440 + (void) setStructVar:(GoTestpkgNode*)v { 441 GoSeq in_ = {}; 442 GoSeq out_ = {}; 443 if ([(id<NSObject>)(v) isKindOfClass:[GoTestpkgNode class]]) { 444 id<goSeqRefInterface> v_proxy = (id<goSeqRefInterface>)(v); 445 go_seq_writeRef(&in_, v_proxy._ref); 446 } else { 447 go_seq_writeObjcRef(&in_, v); 448 } 449 go_seq_send("testpkg.StructVar", 1, &in_, &out_); 450 go_seq_free(&in_); 451 go_seq_free(&out_); 452 } 453 454 + (GoTestpkgNode*) structVar { 455 GoSeq in_ = {}; 456 GoSeq out_ = {}; 457 go_seq_send("testpkg.StructVar", 2, &in_, &out_); 458 GoSeqRef* ret_ref = go_seq_readRef(&out_); 459 GoTestpkgNode* ret = ret_ref.obj; 460 if (ret == NULL) { 461 ret = [[GoTestpkgNode alloc] initWithRef:ret_ref]; 462 } 463 go_seq_free(&in_); 464 go_seq_free(&out_); 465 return ret; 466 } 467 468 @end 469 470 #define _CALL_BytesAppend_ 1 471 #define _CALL_CallIError_ 2 472 #define _CALL_CallIStringError_ 3 473 #define _CALL_CallSSum_ 4 474 #define _CALL_CollectS_ 5 475 #define _CALL_Echo_ 6 476 #define _CALL_GC_ 7 477 #define _CALL_Hello_ 8 478 #define _CALL_Hi_ 9 479 #define _CALL_Int_ 10 480 #define _CALL_Multiply_ 11 481 #define _CALL_NewI_ 12 482 #define _CALL_NewNode_ 13 483 #define _CALL_NewS_ 14 484 #define _CALL_RegisterI_ 15 485 #define _CALL_ReturnsError_ 16 486 #define _CALL_Sum_ 17 487 #define _CALL_UnregisterI_ 18 488 489 NSData* GoTestpkgBytesAppend(NSData* a, NSData* b) { 490 GoSeq in_ = {}; 491 GoSeq out_ = {}; 492 go_seq_writeByteArray(&in_, a); 493 go_seq_writeByteArray(&in_, b); 494 go_seq_send(_DESCRIPTOR_, _CALL_BytesAppend_, &in_, &out_); 495 NSData* ret0_ = go_seq_readByteArray(&out_); 496 go_seq_free(&in_); 497 go_seq_free(&out_); 498 return ret0_; 499 } 500 501 BOOL GoTestpkgCallIError(id<GoTestpkgI> i, BOOL triggerError, NSError** error) { 502 GoSeq in_ = {}; 503 GoSeq out_ = {}; 504 if ([(id<NSObject>)(i) isKindOfClass:[GoTestpkgI class]]) { 505 id<goSeqRefInterface> i_proxy = (id<goSeqRefInterface>)(i); 506 go_seq_writeRef(&in_, i_proxy._ref); 507 } else { 508 go_seq_writeObjcRef(&in_, i); 509 } 510 go_seq_writeBool(&in_, triggerError); 511 go_seq_send(_DESCRIPTOR_, _CALL_CallIError_, &in_, &out_); 512 NSString* _error = go_seq_readUTF8(&out_); 513 if ([_error length] != 0 && error != nil) { 514 NSMutableDictionary* details = [NSMutableDictionary dictionary]; 515 [details setValue:_error forKey:NSLocalizedDescriptionKey]; 516 *error = [NSError errorWithDomain:errDomain code:1 userInfo:details]; 517 } 518 go_seq_free(&in_); 519 go_seq_free(&out_); 520 return ([_error length] == 0); 521 } 522 523 BOOL GoTestpkgCallIStringError(id<GoTestpkgI> i, NSString* s, NSString** ret0_, NSError** error) { 524 GoSeq in_ = {}; 525 GoSeq out_ = {}; 526 if ([(id<NSObject>)(i) isKindOfClass:[GoTestpkgI class]]) { 527 id<goSeqRefInterface> i_proxy = (id<goSeqRefInterface>)(i); 528 go_seq_writeRef(&in_, i_proxy._ref); 529 } else { 530 go_seq_writeObjcRef(&in_, i); 531 } 532 go_seq_writeUTF8(&in_, s); 533 go_seq_send(_DESCRIPTOR_, _CALL_CallIStringError_, &in_, &out_); 534 NSString* ret0__val = go_seq_readUTF8(&out_); 535 if (ret0_ != NULL) { 536 *ret0_ = ret0__val; 537 } 538 NSString* _error = go_seq_readUTF8(&out_); 539 if ([_error length] != 0 && error != nil) { 540 NSMutableDictionary* details = [NSMutableDictionary dictionary]; 541 [details setValue:_error forKey:NSLocalizedDescriptionKey]; 542 *error = [NSError errorWithDomain:errDomain code:1 userInfo:details]; 543 } 544 go_seq_free(&in_); 545 go_seq_free(&out_); 546 return ([_error length] == 0); 547 } 548 549 double GoTestpkgCallSSum(GoTestpkgS* s) { 550 GoSeq in_ = {}; 551 GoSeq out_ = {}; 552 if ([(id<NSObject>)(s) isKindOfClass:[GoTestpkgS class]]) { 553 id<goSeqRefInterface> s_proxy = (id<goSeqRefInterface>)(s); 554 go_seq_writeRef(&in_, s_proxy._ref); 555 } else { 556 go_seq_writeObjcRef(&in_, s); 557 } 558 go_seq_send(_DESCRIPTOR_, _CALL_CallSSum_, &in_, &out_); 559 double ret0_ = go_seq_readFloat64(&out_); 560 go_seq_free(&in_); 561 go_seq_free(&out_); 562 return ret0_; 563 } 564 565 int GoTestpkgCollectS(int want, int timeoutSec) { 566 GoSeq in_ = {}; 567 GoSeq out_ = {}; 568 go_seq_writeInt(&in_, want); 569 go_seq_writeInt(&in_, timeoutSec); 570 go_seq_send(_DESCRIPTOR_, _CALL_CollectS_, &in_, &out_); 571 int ret0_ = go_seq_readInt(&out_); 572 go_seq_free(&in_); 573 go_seq_free(&out_); 574 return ret0_; 575 } 576 577 NSString* GoTestpkgEcho(NSString* s) { 578 GoSeq in_ = {}; 579 GoSeq out_ = {}; 580 go_seq_writeUTF8(&in_, s); 581 go_seq_send(_DESCRIPTOR_, _CALL_Echo_, &in_, &out_); 582 NSString* ret0_ = go_seq_readUTF8(&out_); 583 go_seq_free(&in_); 584 go_seq_free(&out_); 585 return ret0_; 586 } 587 588 void GoTestpkgGC() { 589 GoSeq in_ = {}; 590 GoSeq out_ = {}; 591 go_seq_send(_DESCRIPTOR_, _CALL_GC_, &in_, &out_); 592 go_seq_free(&in_); 593 go_seq_free(&out_); 594 } 595 596 NSString* GoTestpkgHello(NSString* s) { 597 GoSeq in_ = {}; 598 GoSeq out_ = {}; 599 go_seq_writeUTF8(&in_, s); 600 go_seq_send(_DESCRIPTOR_, _CALL_Hello_, &in_, &out_); 601 NSString* ret0_ = go_seq_readUTF8(&out_); 602 go_seq_free(&in_); 603 go_seq_free(&out_); 604 return ret0_; 605 } 606 607 void GoTestpkgHi() { 608 GoSeq in_ = {}; 609 GoSeq out_ = {}; 610 go_seq_send(_DESCRIPTOR_, _CALL_Hi_, &in_, &out_); 611 go_seq_free(&in_); 612 go_seq_free(&out_); 613 } 614 615 void GoTestpkgInt(int32_t x) { 616 GoSeq in_ = {}; 617 GoSeq out_ = {}; 618 go_seq_writeInt32(&in_, x); 619 go_seq_send(_DESCRIPTOR_, _CALL_Int_, &in_, &out_); 620 go_seq_free(&in_); 621 go_seq_free(&out_); 622 } 623 624 int64_t GoTestpkgMultiply(int32_t idx, int32_t val) { 625 GoSeq in_ = {}; 626 GoSeq out_ = {}; 627 go_seq_writeInt32(&in_, idx); 628 go_seq_writeInt32(&in_, val); 629 go_seq_send(_DESCRIPTOR_, _CALL_Multiply_, &in_, &out_); 630 int64_t ret0_ = go_seq_readInt64(&out_); 631 go_seq_free(&in_); 632 go_seq_free(&out_); 633 return ret0_; 634 } 635 636 id<GoTestpkgI> GoTestpkgNewI() { 637 GoSeq in_ = {}; 638 GoSeq out_ = {}; 639 go_seq_send(_DESCRIPTOR_, _CALL_NewI_, &in_, &out_); 640 GoSeqRef* ret0__ref = go_seq_readRef(&out_); 641 id<GoTestpkgI> ret0_ = ret0__ref.obj; 642 if (ret0_ == NULL) { 643 ret0_ = [[GoTestpkgI alloc] initWithRef:ret0__ref]; 644 } 645 go_seq_free(&in_); 646 go_seq_free(&out_); 647 return ret0_; 648 } 649 650 GoTestpkgNode* GoTestpkgNewNode(NSString* name) { 651 GoSeq in_ = {}; 652 GoSeq out_ = {}; 653 go_seq_writeUTF8(&in_, name); 654 go_seq_send(_DESCRIPTOR_, _CALL_NewNode_, &in_, &out_); 655 GoSeqRef* ret0__ref = go_seq_readRef(&out_); 656 GoTestpkgNode* ret0_ = ret0__ref.obj; 657 if (ret0_ == NULL) { 658 ret0_ = [[GoTestpkgNode alloc] initWithRef:ret0__ref]; 659 } 660 go_seq_free(&in_); 661 go_seq_free(&out_); 662 return ret0_; 663 } 664 665 GoTestpkgS* GoTestpkgNewS(double x, double y) { 666 GoSeq in_ = {}; 667 GoSeq out_ = {}; 668 go_seq_writeFloat64(&in_, x); 669 go_seq_writeFloat64(&in_, y); 670 go_seq_send(_DESCRIPTOR_, _CALL_NewS_, &in_, &out_); 671 GoSeqRef* ret0__ref = go_seq_readRef(&out_); 672 GoTestpkgS* ret0_ = ret0__ref.obj; 673 if (ret0_ == NULL) { 674 ret0_ = [[GoTestpkgS alloc] initWithRef:ret0__ref]; 675 } 676 go_seq_free(&in_); 677 go_seq_free(&out_); 678 return ret0_; 679 } 680 681 void GoTestpkgRegisterI(int32_t idx, id<GoTestpkgI> i) { 682 GoSeq in_ = {}; 683 GoSeq out_ = {}; 684 go_seq_writeInt32(&in_, idx); 685 if ([(id<NSObject>)(i) isKindOfClass:[GoTestpkgI class]]) { 686 id<goSeqRefInterface> i_proxy = (id<goSeqRefInterface>)(i); 687 go_seq_writeRef(&in_, i_proxy._ref); 688 } else { 689 go_seq_writeObjcRef(&in_, i); 690 } 691 go_seq_send(_DESCRIPTOR_, _CALL_RegisterI_, &in_, &out_); 692 go_seq_free(&in_); 693 go_seq_free(&out_); 694 } 695 696 BOOL GoTestpkgReturnsError(BOOL b, NSString** ret0_, NSError** error) { 697 GoSeq in_ = {}; 698 GoSeq out_ = {}; 699 go_seq_writeBool(&in_, b); 700 go_seq_send(_DESCRIPTOR_, _CALL_ReturnsError_, &in_, &out_); 701 NSString* ret0__val = go_seq_readUTF8(&out_); 702 if (ret0_ != NULL) { 703 *ret0_ = ret0__val; 704 } 705 NSString* _error = go_seq_readUTF8(&out_); 706 if ([_error length] != 0 && error != nil) { 707 NSMutableDictionary* details = [NSMutableDictionary dictionary]; 708 [details setValue:_error forKey:NSLocalizedDescriptionKey]; 709 *error = [NSError errorWithDomain:errDomain code:1 userInfo:details]; 710 } 711 go_seq_free(&in_); 712 go_seq_free(&out_); 713 return ([_error length] == 0); 714 } 715 716 int64_t GoTestpkgSum(int64_t x, int64_t y) { 717 GoSeq in_ = {}; 718 GoSeq out_ = {}; 719 go_seq_writeInt64(&in_, x); 720 go_seq_writeInt64(&in_, y); 721 go_seq_send(_DESCRIPTOR_, _CALL_Sum_, &in_, &out_); 722 int64_t ret0_ = go_seq_readInt64(&out_); 723 go_seq_free(&in_); 724 go_seq_free(&out_); 725 return ret0_; 726 } 727 728 void GoTestpkgUnregisterI(int32_t idx) { 729 GoSeq in_ = {}; 730 GoSeq out_ = {}; 731 go_seq_writeInt32(&in_, idx); 732 go_seq_send(_DESCRIPTOR_, _CALL_UnregisterI_, &in_, &out_); 733 go_seq_free(&in_); 734 go_seq_free(&out_); 735 } 736 737 __attribute__((constructor)) static void init() { 738 go_seq_register_proxy("go.testpkg.I", proxyGoTestpkgI); 739 go_seq_register_proxy("go.testpkg.Z", proxyGoTestpkgZ); 740 }