github.com/c-darwin/mobile@v0.0.0-20160313183840-ff625c46f7c9/bind/testdata/basictypes.objc.m.golden (about)

     1  // Objective-C API for talking to basictypes Go package.
     2  //   gobind -lang=objc basictypes
     3  //
     4  // File is generated by gobind. Do not edit.
     5  
     6  #include "GoBasictypes.h"
     7  #include <Foundation/Foundation.h>
     8  #include "seq.h"
     9  
    10  static NSString* errDomain = @"go.basictypes";
    11  
    12  @protocol goSeqRefInterface
    13  -(GoSeqRef*) ref;
    14  @end
    15  
    16  #define _DESCRIPTOR_ "basictypes"
    17  
    18  #define _CALL_Bool_ 1
    19  #define _CALL_ByteArrays_ 2
    20  #define _CALL_Error_ 3
    21  #define _CALL_ErrorPair_ 4
    22  #define _CALL_Ints_ 5
    23  
    24  BOOL GoBasictypesBool(BOOL p0) {
    25  	GoSeq in_ = {};
    26  	GoSeq out_ = {};
    27  	go_seq_writeBool(&in_, p0);
    28  	go_seq_send(_DESCRIPTOR_, _CALL_Bool_, &in_, &out_);
    29  	BOOL ret0_ = go_seq_readBool(&out_);
    30  	go_seq_free(&in_);
    31  	go_seq_free(&out_);
    32  	return ret0_;
    33  }
    34  
    35  NSData* GoBasictypesByteArrays(NSData* x) {
    36  	GoSeq in_ = {};
    37  	GoSeq out_ = {};
    38  	go_seq_writeByteArray(&in_, x);
    39  	go_seq_send(_DESCRIPTOR_, _CALL_ByteArrays_, &in_, &out_);
    40  	NSData* ret0_ = go_seq_readByteArray(&out_);
    41  	go_seq_free(&in_);
    42  	go_seq_free(&out_);
    43  	return ret0_;
    44  }
    45  
    46  BOOL GoBasictypesError(NSError** error) {
    47  	GoSeq in_ = {};
    48  	GoSeq out_ = {};
    49  	go_seq_send(_DESCRIPTOR_, _CALL_Error_, &in_, &out_);
    50  	NSString* _error = go_seq_readUTF8(&out_);
    51  	if ([_error length] != 0 && error != nil) {
    52  		NSMutableDictionary* details = [NSMutableDictionary dictionary];
    53  		[details setValue:_error forKey:NSLocalizedDescriptionKey];
    54  		*error = [NSError errorWithDomain:errDomain code:1 userInfo:details];
    55  	}
    56  	go_seq_free(&in_);
    57  	go_seq_free(&out_);
    58  	return ([_error length] == 0);
    59  }
    60  
    61  BOOL GoBasictypesErrorPair(int* ret0_, NSError** error) {
    62  	GoSeq in_ = {};
    63  	GoSeq out_ = {};
    64  	go_seq_send(_DESCRIPTOR_, _CALL_ErrorPair_, &in_, &out_);
    65  	int ret0__val = go_seq_readInt(&out_);
    66  	if (ret0_ != NULL) {
    67  		*ret0_ = ret0__val;
    68  	}
    69  	NSString* _error = go_seq_readUTF8(&out_);
    70  	if ([_error length] != 0 && error != nil) {
    71  		NSMutableDictionary* details = [NSMutableDictionary dictionary];
    72  		[details setValue:_error forKey:NSLocalizedDescriptionKey];
    73  		*error = [NSError errorWithDomain:errDomain code:1 userInfo:details];
    74  	}
    75  	go_seq_free(&in_);
    76  	go_seq_free(&out_);
    77  	return ([_error length] == 0);
    78  }
    79  
    80  void GoBasictypesInts(int8_t x, int16_t y, int32_t z, int64_t t, int u) {
    81  	GoSeq in_ = {};
    82  	GoSeq out_ = {};
    83  	go_seq_writeInt8(&in_, x);
    84  	go_seq_writeInt16(&in_, y);
    85  	go_seq_writeInt32(&in_, z);
    86  	go_seq_writeInt64(&in_, t);
    87  	go_seq_writeInt(&in_, u);
    88  	go_seq_send(_DESCRIPTOR_, _CALL_Ints_, &in_, &out_);
    89  	go_seq_free(&in_);
    90  	go_seq_free(&out_);
    91  }
    92