Debian Codegraph @

bind/testdata/interfaces.objc.m.golden

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