// Objective-C API for talking to basictypes Go package.
//   gobind -lang=objc basictypes
//
// File is generated by gobind. Do not edit.

#include <Foundation/Foundation.h>
#include "seq.h"
#include "_cgo_export.h"
#include "Basictypes.objc.h"

const BOOL BasictypesABool = YES;
const double BasictypesAFloat = 0.2015;
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";
const int32_t BasictypesARune = 32;
NSString* const BasictypesAString = @"a string";
const int64_t BasictypesAnInt = 7LL;
const int64_t BasictypesAnInt2 = 9223372036854775807LL;


BOOL BasictypesBool(BOOL p0) {
	char _p0 = (char)p0;
	char r0 = proxybasictypes__Bool(_p0);
	BOOL _ret0_ = r0 ? YES : NO;
	return _ret0_;
}

NSData* _Nullable BasictypesByteArrays(NSData* _Nullable x) {
	nbyteslice _x = go_seq_from_objc_bytearray(x, 0);
	nbyteslice r0 = proxybasictypes__ByteArrays(_x);
	if (![x isKindOfClass:[NSMutableData class]]) {
	  free(_x.ptr);
	}
	NSData *_ret0_ = go_seq_to_objc_bytearray(r0, 1);
	return _ret0_;
}

BOOL BasictypesError(NSError* _Nullable* _Nullable error) {
	int32_t r0 = proxybasictypes__Error();
	Universeerror* _error = nil;
	GoSeqRef* _error_ref = go_seq_from_refnum(r0);
	if (_error_ref != NULL) {
		_error = _error_ref.obj;
		if (_error == nil) {
			_error = [[Universeerror alloc] initWithRef:_error_ref];
		}
	}
	if (_error != nil && error != nil) {
		*error = _error;
	}
	return (_error == nil);
}

BOOL BasictypesErrorPair(long* _Nullable ret0_, NSError* _Nullable* _Nullable error) {
	struct proxybasictypes__ErrorPair_return res = proxybasictypes__ErrorPair();
	long _ret0_ = (long)res.r0;
	Universeerror* _error = nil;
	GoSeqRef* _error_ref = go_seq_from_refnum(res.r1);
	if (_error_ref != NULL) {
		_error = _error_ref.obj;
		if (_error == nil) {
			_error = [[Universeerror alloc] initWithRef:_error_ref];
		}
	}
	*ret0_ = _ret0_;
	if (_error != nil && error != nil) {
		*error = _error;
	}
	return (_error == nil);
}

void BasictypesInts(int8_t x, int16_t y, int32_t z, int64_t t, long u) {
	int8_t _x = (int8_t)x;
	int16_t _y = (int16_t)y;
	int32_t _z = (int32_t)z;
	int64_t _t = (int64_t)t;
	nint _u = (nint)u;
	proxybasictypes__Ints(_x, _y, _z, _t, _u);
}

__attribute__((constructor)) static void init() {
	init_seq();
}
