interfaces.objc.m.golden 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. // Objective-C API for talking to interfaces Go package.
  2. // gobind -lang=objc interfaces
  3. //
  4. // File is generated by gobind. Do not edit.
  5. #include <Foundation/Foundation.h>
  6. #include "seq.h"
  7. #include "_cgo_export.h"
  8. #include "Interfaces.objc.h"
  9. @implementation InterfacesError {
  10. }
  11. - (nonnull instancetype)initWithRef:(id)ref {
  12. self = [super init];
  13. if (self) { __ref = ref; }
  14. return self;
  15. }
  16. - (BOOL)err:(NSError* _Nullable* _Nullable)error {
  17. int32_t refnum = go_seq_go_to_refnum(self._ref);
  18. int32_t r0 = proxyinterfaces_Error_Err(refnum);
  19. Universeerror* _error = nil;
  20. GoSeqRef* _error_ref = go_seq_from_refnum(r0);
  21. if (_error_ref != NULL) {
  22. _error = _error_ref.obj;
  23. if (_error == nil) {
  24. _error = [[Universeerror alloc] initWithRef:_error_ref];
  25. }
  26. }
  27. if (_error != nil && error != nil) {
  28. *error = _error;
  29. }
  30. return (_error == nil);
  31. }
  32. @end
  33. @implementation InterfacesI {
  34. }
  35. - (nonnull instancetype)initWithRef:(id)ref {
  36. self = [super init];
  37. if (self) { __ref = ref; }
  38. return self;
  39. }
  40. - (int32_t)rand {
  41. int32_t refnum = go_seq_go_to_refnum(self._ref);
  42. int32_t r0 = proxyinterfaces_I_Rand(refnum);
  43. int32_t _ret0_ = (int32_t)r0;
  44. return _ret0_;
  45. }
  46. @end
  47. @implementation InterfacesI1 {
  48. }
  49. - (nonnull instancetype)initWithRef:(id)ref {
  50. self = [super init];
  51. if (self) { __ref = ref; }
  52. return self;
  53. }
  54. - (void)j {
  55. int32_t refnum = go_seq_go_to_refnum(self._ref);
  56. proxyinterfaces_I1_J(refnum);
  57. }
  58. @end
  59. @implementation InterfacesI2 {
  60. }
  61. - (nonnull instancetype)initWithRef:(id)ref {
  62. self = [super init];
  63. if (self) { __ref = ref; }
  64. return self;
  65. }
  66. - (void)g {
  67. int32_t refnum = go_seq_go_to_refnum(self._ref);
  68. proxyinterfaces_I2_G(refnum);
  69. }
  70. @end
  71. @implementation InterfacesI3 {
  72. }
  73. - (nonnull instancetype)initWithRef:(id)ref {
  74. self = [super init];
  75. if (self) { __ref = ref; }
  76. return self;
  77. }
  78. - (InterfacesI1* _Nullable)f {
  79. int32_t refnum = go_seq_go_to_refnum(self._ref);
  80. int32_t r0 = proxyinterfaces_I3_F(refnum);
  81. InterfacesI1* _ret0_ = nil;
  82. GoSeqRef* _ret0__ref = go_seq_from_refnum(r0);
  83. if (_ret0__ref != NULL) {
  84. _ret0_ = _ret0__ref.obj;
  85. if (_ret0_ == nil) {
  86. _ret0_ = [[InterfacesI1 alloc] initWithRef:_ret0__ref];
  87. }
  88. }
  89. return _ret0_;
  90. }
  91. @end
  92. @implementation InterfacesInterfaces {
  93. }
  94. - (nonnull instancetype)initWithRef:(id)ref {
  95. self = [super init];
  96. if (self) { __ref = ref; }
  97. return self;
  98. }
  99. - (void)someMethod {
  100. int32_t refnum = go_seq_go_to_refnum(self._ref);
  101. proxyinterfaces_Interfaces_SomeMethod(refnum);
  102. }
  103. @end
  104. @implementation InterfacesLargerI {
  105. }
  106. - (nonnull instancetype)initWithRef:(id)ref {
  107. self = [super init];
  108. if (self) { __ref = ref; }
  109. return self;
  110. }
  111. - (void)anotherFunc {
  112. int32_t refnum = go_seq_go_to_refnum(self._ref);
  113. proxyinterfaces_LargerI_AnotherFunc(refnum);
  114. }
  115. - (int32_t)rand {
  116. int32_t refnum = go_seq_go_to_refnum(self._ref);
  117. int32_t r0 = proxyinterfaces_LargerI_Rand(refnum);
  118. int32_t _ret0_ = (int32_t)r0;
  119. return _ret0_;
  120. }
  121. @end
  122. @implementation InterfacesSameI {
  123. }
  124. - (nonnull instancetype)initWithRef:(id)ref {
  125. self = [super init];
  126. if (self) { __ref = ref; }
  127. return self;
  128. }
  129. - (int32_t)rand {
  130. int32_t refnum = go_seq_go_to_refnum(self._ref);
  131. int32_t r0 = proxyinterfaces_SameI_Rand(refnum);
  132. int32_t _ret0_ = (int32_t)r0;
  133. return _ret0_;
  134. }
  135. @end
  136. @implementation InterfacesWithParam {
  137. }
  138. - (nonnull instancetype)initWithRef:(id)ref {
  139. self = [super init];
  140. if (self) { __ref = ref; }
  141. return self;
  142. }
  143. - (void)hasParam:(BOOL)p0 {
  144. int32_t refnum = go_seq_go_to_refnum(self._ref);
  145. char _p0 = (char)p0;
  146. proxyinterfaces_WithParam_HasParam(refnum, _p0);
  147. }
  148. @end
  149. int32_t InterfacesAdd3(id<InterfacesI> _Nullable r) {
  150. int32_t _r;
  151. if ([r conformsToProtocol:@protocol(goSeqRefInterface)]) {
  152. id<goSeqRefInterface> r_proxy = (id<goSeqRefInterface>)(r);
  153. _r = go_seq_go_to_refnum(r_proxy._ref);
  154. } else {
  155. _r = go_seq_to_refnum(r);
  156. }
  157. int32_t r0 = proxyinterfaces__Add3(_r);
  158. int32_t _ret0_ = (int32_t)r0;
  159. return _ret0_;
  160. }
  161. BOOL InterfacesCallErr(id<InterfacesError> _Nullable e, NSError* _Nullable* _Nullable error) {
  162. int32_t _e;
  163. if ([e conformsToProtocol:@protocol(goSeqRefInterface)]) {
  164. id<goSeqRefInterface> e_proxy = (id<goSeqRefInterface>)(e);
  165. _e = go_seq_go_to_refnum(e_proxy._ref);
  166. } else {
  167. _e = go_seq_to_refnum(e);
  168. }
  169. int32_t r0 = proxyinterfaces__CallErr(_e);
  170. Universeerror* _error = nil;
  171. GoSeqRef* _error_ref = go_seq_from_refnum(r0);
  172. if (_error_ref != NULL) {
  173. _error = _error_ref.obj;
  174. if (_error == nil) {
  175. _error = [[Universeerror alloc] initWithRef:_error_ref];
  176. }
  177. }
  178. if (_error != nil && error != nil) {
  179. *error = _error;
  180. }
  181. return (_error == nil);
  182. }
  183. id<InterfacesI> _Nullable InterfacesSeven(void) {
  184. int32_t r0 = proxyinterfaces__Seven();
  185. InterfacesI* _ret0_ = nil;
  186. GoSeqRef* _ret0__ref = go_seq_from_refnum(r0);
  187. if (_ret0__ref != NULL) {
  188. _ret0_ = _ret0__ref.obj;
  189. if (_ret0_ == nil) {
  190. _ret0_ = [[InterfacesI alloc] initWithRef:_ret0__ref];
  191. }
  192. }
  193. return _ret0_;
  194. }
  195. int32_t cproxyinterfaces_Error_Err(int32_t refnum) {
  196. @autoreleasepool {
  197. InterfacesError* o = go_seq_objc_from_refnum(refnum);
  198. NSError* error = nil;
  199. BOOL returnVal = [o err:&error];
  200. NSError *_error = nil;
  201. if (!returnVal) {
  202. _error = error;
  203. }
  204. int32_t __error;
  205. if ([_error conformsToProtocol:@protocol(goSeqRefInterface)]) {
  206. id<goSeqRefInterface> _error_proxy = (id<goSeqRefInterface>)(_error);
  207. __error = go_seq_go_to_refnum(_error_proxy._ref);
  208. } else {
  209. __error = go_seq_to_refnum(_error);
  210. }
  211. return __error;
  212. }
  213. }
  214. int32_t cproxyinterfaces_I_Rand(int32_t refnum) {
  215. @autoreleasepool {
  216. InterfacesI* o = go_seq_objc_from_refnum(refnum);
  217. int32_t ret0_;
  218. ret0_ = [o rand];
  219. int32_t _ret0_ = (int32_t)ret0_;
  220. return _ret0_;
  221. }
  222. }
  223. void cproxyinterfaces_I1_J(int32_t refnum) {
  224. @autoreleasepool {
  225. InterfacesI1* o = go_seq_objc_from_refnum(refnum);
  226. [o j];
  227. }
  228. }
  229. void cproxyinterfaces_I2_G(int32_t refnum) {
  230. @autoreleasepool {
  231. InterfacesI2* o = go_seq_objc_from_refnum(refnum);
  232. [o g];
  233. }
  234. }
  235. int32_t cproxyinterfaces_I3_F(int32_t refnum) {
  236. @autoreleasepool {
  237. InterfacesI3* o = go_seq_objc_from_refnum(refnum);
  238. InterfacesI1* _Nullable ret0_;
  239. ret0_ = [o f];
  240. int32_t _ret0_;
  241. if ([ret0_ conformsToProtocol:@protocol(goSeqRefInterface)]) {
  242. id<goSeqRefInterface> ret0__proxy = (id<goSeqRefInterface>)(ret0_);
  243. _ret0_ = go_seq_go_to_refnum(ret0__proxy._ref);
  244. } else {
  245. _ret0_ = go_seq_to_refnum(ret0_);
  246. }
  247. return _ret0_;
  248. }
  249. }
  250. void cproxyinterfaces_Interfaces_SomeMethod(int32_t refnum) {
  251. @autoreleasepool {
  252. InterfacesInterfaces* o = go_seq_objc_from_refnum(refnum);
  253. [o someMethod];
  254. }
  255. }
  256. void cproxyinterfaces_LargerI_AnotherFunc(int32_t refnum) {
  257. @autoreleasepool {
  258. InterfacesLargerI* o = go_seq_objc_from_refnum(refnum);
  259. [o anotherFunc];
  260. }
  261. }
  262. int32_t cproxyinterfaces_LargerI_Rand(int32_t refnum) {
  263. @autoreleasepool {
  264. InterfacesLargerI* o = go_seq_objc_from_refnum(refnum);
  265. int32_t ret0_;
  266. ret0_ = [o rand];
  267. int32_t _ret0_ = (int32_t)ret0_;
  268. return _ret0_;
  269. }
  270. }
  271. int32_t cproxyinterfaces_SameI_Rand(int32_t refnum) {
  272. @autoreleasepool {
  273. InterfacesSameI* o = go_seq_objc_from_refnum(refnum);
  274. int32_t ret0_;
  275. ret0_ = [o rand];
  276. int32_t _ret0_ = (int32_t)ret0_;
  277. return _ret0_;
  278. }
  279. }
  280. void cproxyinterfaces_WithParam_HasParam(int32_t refnum, char p0) {
  281. @autoreleasepool {
  282. InterfacesWithParam* o = go_seq_objc_from_refnum(refnum);
  283. BOOL _p0 = p0 ? YES : NO;
  284. [o hasParam:_p0];
  285. }
  286. }
  287. __attribute__((constructor)) static void init() {
  288. init_seq();
  289. }