github.com/F4RD1N/gomobile@v1.0.1/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 <Foundation/Foundation.h>
     7  #include "seq.h"
     8  #include "_cgo_export.h"
     9  #include "Basictypes.objc.h"
    10  
    11  const BOOL BasictypesABool = YES;
    12  const double BasictypesAFloat = 0.2015;
    13  NSString* const BasictypesALongString = @"LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString,LongString";
    14  const int32_t BasictypesARune = 32;
    15  NSString* const BasictypesAString = @"a string";
    16  const int64_t BasictypesAnInt = 7LL;
    17  const int64_t BasictypesAnInt2 = 9223372036854775807LL;
    18  
    19  
    20  BOOL BasictypesBool(BOOL p0) {
    21  	char _p0 = (char)p0;
    22  	char r0 = proxybasictypes__Bool(_p0);
    23  	BOOL _ret0_ = r0 ? YES : NO;
    24  	return _ret0_;
    25  }
    26  
    27  NSData* _Nullable BasictypesByteArrays(NSData* _Nullable x) {
    28  	nbyteslice _x = go_seq_from_objc_bytearray(x, 0);
    29  	nbyteslice r0 = proxybasictypes__ByteArrays(_x);
    30  	if (![x isKindOfClass:[NSMutableData class]]) {
    31  	  free(_x.ptr);
    32  	}
    33  	NSData *_ret0_ = go_seq_to_objc_bytearray(r0, 1);
    34  	return _ret0_;
    35  }
    36  
    37  BOOL BasictypesError(NSError* _Nullable* _Nullable error) {
    38  	int32_t r0 = proxybasictypes__Error();
    39  	Universeerror* _error = nil;
    40  	GoSeqRef* _error_ref = go_seq_from_refnum(r0);
    41  	if (_error_ref != NULL) {
    42  		_error = _error_ref.obj;
    43  		if (_error == nil) {
    44  			_error = [[Universeerror alloc] initWithRef:_error_ref];
    45  		}
    46  	}
    47  	if (_error != nil && error != nil) {
    48  		*error = _error;
    49  	}
    50  	return (_error == nil);
    51  }
    52  
    53  BOOL BasictypesErrorPair(long* _Nullable ret0_, NSError* _Nullable* _Nullable error) {
    54  	struct proxybasictypes__ErrorPair_return res = proxybasictypes__ErrorPair();
    55  	long _ret0_ = (long)res.r0;
    56  	Universeerror* _error = nil;
    57  	GoSeqRef* _error_ref = go_seq_from_refnum(res.r1);
    58  	if (_error_ref != NULL) {
    59  		_error = _error_ref.obj;
    60  		if (_error == nil) {
    61  			_error = [[Universeerror alloc] initWithRef:_error_ref];
    62  		}
    63  	}
    64  	*ret0_ = _ret0_;
    65  	if (_error != nil && error != nil) {
    66  		*error = _error;
    67  	}
    68  	return (_error == nil);
    69  }
    70  
    71  void BasictypesInts(int8_t x, int16_t y, int32_t z, int64_t t, long u) {
    72  	int8_t _x = (int8_t)x;
    73  	int16_t _y = (int16_t)y;
    74  	int32_t _z = (int32_t)z;
    75  	int64_t _t = (int64_t)t;
    76  	nint _u = (nint)u;
    77  	proxybasictypes__Ints(_x, _y, _z, _t, _u);
    78  }
    79  
    80  __attribute__((constructor)) static void init() {
    81  	init_seq();
    82  }