1 /* valaccode.c generated by valac, the Vala compiler
2 * generated from valaccode.vala, do not modify */
3
4 /* valaccode.vala
5 *
6 * Copyright (C) 2017 Rico Tzschichholz
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 *
22 * Author:
23 * Rico Tzschichholz <ricotz@ubuntu.com>
24 */
25
26 #include <glib.h>
27 #include <vala.h>
28 #include "valacodegen.h"
29 #include <string.h>
30 #include <stdlib.h>
31 #include <float.h>
32 #include <math.h>
33
34 #define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL)))
35 #define _vala_attribute_cache_unref0(var) ((var == NULL) ? NULL : (var = (vala_attribute_cache_unref (var), NULL)))
36 #define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
37 #define _vala_code_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_node_unref (var), NULL)))
38 #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
39 #define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
40 #define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
41 #define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
42
43 extern gint* vala_ccode_attribute_cache_index;
44 gint* vala_ccode_attribute_cache_index = NULL;
45
46 G_GNUC_INTERNAL ValaCCodeAttribute* vala_get_ccode_attribute (ValaCodeNode* node);
47 static gint* _int_dup (gint* self);
48
49 static gint*
_int_dup(gint * self)50 _int_dup (gint* self)
51 {
52 gint* dup;
53 dup = g_new0 (gint, 1);
54 memcpy (dup, self, sizeof (gint));
55 return dup;
56 }
57
58 static gpointer
__int_dup0(gpointer self)59 __int_dup0 (gpointer self)
60 {
61 return self ? _int_dup (self) : NULL;
62 }
63
64 G_GNUC_INTERNAL ValaCCodeAttribute*
vala_get_ccode_attribute(ValaCodeNode * node)65 vala_get_ccode_attribute (ValaCodeNode* node)
66 {
67 gint* _tmp0_;
68 ValaAttributeCache* attr = NULL;
69 gint* _tmp3_;
70 ValaAttributeCache* _tmp4_;
71 ValaAttributeCache* _tmp5_;
72 ValaAttributeCache* _tmp10_;
73 ValaCCodeAttribute* result = NULL;
74 g_return_val_if_fail (node != NULL, NULL);
75 _tmp0_ = vala_ccode_attribute_cache_index;
76 if (_tmp0_ == NULL) {
77 gint _tmp1_;
78 gint* _tmp2_;
79 _tmp1_ = vala_code_node_get_attribute_cache_index ();
80 _tmp2_ = __int_dup0 (&_tmp1_);
81 _g_free0 (vala_ccode_attribute_cache_index);
82 vala_ccode_attribute_cache_index = _tmp2_;
83 }
84 _tmp3_ = vala_ccode_attribute_cache_index;
85 _tmp4_ = vala_code_node_get_attribute_cache (node, *_tmp3_);
86 attr = _tmp4_;
87 _tmp5_ = attr;
88 if (_tmp5_ == NULL) {
89 ValaCCodeAttribute* new_attr = NULL;
90 ValaCCodeAttribute* _tmp6_;
91 gint* _tmp7_;
92 ValaCCodeAttribute* _tmp8_;
93 ValaCCodeAttribute* _tmp9_;
94 _tmp6_ = vala_ccode_attribute_new (node);
95 new_attr = _tmp6_;
96 _tmp7_ = vala_ccode_attribute_cache_index;
97 _tmp8_ = new_attr;
98 vala_code_node_set_attribute_cache (node, *_tmp7_, (ValaAttributeCache*) _tmp8_);
99 _tmp9_ = new_attr;
100 attr = (ValaAttributeCache*) _tmp9_;
101 _vala_attribute_cache_unref0 (new_attr);
102 }
103 _tmp10_ = attr;
104 result = G_TYPE_CHECK_INSTANCE_CAST (_tmp10_, VALA_TYPE_CCODE_ATTRIBUTE, ValaCCodeAttribute);
105 return result;
106 }
107
108 gchar*
vala_get_ccode_name(ValaCodeNode * node)109 vala_get_ccode_name (ValaCodeNode* node)
110 {
111 ValaCCodeAttribute* _tmp0_;
112 const gchar* _tmp1_;
113 const gchar* _tmp2_;
114 gchar* _tmp3_;
115 gchar* result = NULL;
116 g_return_val_if_fail (node != NULL, NULL);
117 _tmp0_ = vala_get_ccode_attribute (node);
118 _tmp1_ = vala_ccode_attribute_get_name (_tmp0_);
119 _tmp2_ = _tmp1_;
120 _tmp3_ = g_strdup (_tmp2_);
121 result = _tmp3_;
122 return result;
123 }
124
125 gchar*
vala_get_ccode_const_name(ValaCodeNode * node)126 vala_get_ccode_const_name (ValaCodeNode* node)
127 {
128 ValaCCodeAttribute* _tmp0_;
129 const gchar* _tmp1_;
130 const gchar* _tmp2_;
131 gchar* _tmp3_;
132 gchar* result = NULL;
133 g_return_val_if_fail (node != NULL, NULL);
134 _tmp0_ = vala_get_ccode_attribute (node);
135 _tmp1_ = vala_ccode_attribute_get_const_name (_tmp0_);
136 _tmp2_ = _tmp1_;
137 _tmp3_ = g_strdup (_tmp2_);
138 result = _tmp3_;
139 return result;
140 }
141
142 gchar*
vala_get_ccode_type_name(ValaObjectTypeSymbol * sym)143 vala_get_ccode_type_name (ValaObjectTypeSymbol* sym)
144 {
145 ValaCCodeAttribute* _tmp0_;
146 const gchar* _tmp1_;
147 const gchar* _tmp2_;
148 gchar* _tmp3_;
149 gchar* result = NULL;
150 g_return_val_if_fail (sym != NULL, NULL);
151 _tmp0_ = vala_get_ccode_attribute ((ValaCodeNode*) sym);
152 _tmp1_ = vala_ccode_attribute_get_type_name (_tmp0_);
153 _tmp2_ = _tmp1_;
154 _tmp3_ = g_strdup (_tmp2_);
155 result = _tmp3_;
156 return result;
157 }
158
159 gchar*
vala_get_ccode_type_cast_function(ValaObjectTypeSymbol * sym)160 vala_get_ccode_type_cast_function (ValaObjectTypeSymbol* sym)
161 {
162 gboolean _tmp0_ = FALSE;
163 gchar* _tmp3_;
164 gchar* result = NULL;
165 g_return_val_if_fail (sym != NULL, NULL);
166 if (G_TYPE_CHECK_INSTANCE_TYPE (sym, VALA_TYPE_CLASS)) {
167 gboolean _tmp1_;
168 gboolean _tmp2_;
169 _tmp1_ = vala_class_get_is_compact (G_TYPE_CHECK_INSTANCE_CAST (sym, VALA_TYPE_CLASS, ValaClass));
170 _tmp2_ = _tmp1_;
171 _tmp0_ = _tmp2_;
172 } else {
173 _tmp0_ = FALSE;
174 }
175 _vala_assert (!_tmp0_, "!(sym is Class && ((Class) sym).is_compact)");
176 _tmp3_ = vala_get_ccode_upper_case_name ((ValaSymbol*) sym, NULL);
177 result = _tmp3_;
178 return result;
179 }
180
181 gchar*
vala_get_ccode_type_get_function(ValaObjectTypeSymbol * sym)182 vala_get_ccode_type_get_function (ValaObjectTypeSymbol* sym)
183 {
184 gchar* func_name = NULL;
185 gchar* _tmp0_;
186 const gchar* _tmp1_;
187 gchar* result = NULL;
188 g_return_val_if_fail (sym != NULL, NULL);
189 _tmp0_ = vala_code_node_get_attribute_string ((ValaCodeNode*) sym, "CCode", "type_get_function", NULL);
190 func_name = _tmp0_;
191 _tmp1_ = func_name;
192 if (_tmp1_ != NULL) {
193 result = func_name;
194 return result;
195 }
196 if (G_TYPE_CHECK_INSTANCE_TYPE (sym, VALA_TYPE_CLASS)) {
197 gboolean _tmp2_;
198 gboolean _tmp3_;
199 gchar* _tmp4_;
200 gchar* _tmp5_;
201 gchar* _tmp6_;
202 gchar* _tmp7_;
203 _tmp2_ = vala_class_get_is_compact (G_TYPE_CHECK_INSTANCE_CAST (sym, VALA_TYPE_CLASS, ValaClass));
204 _tmp3_ = _tmp2_;
205 _vala_assert (!_tmp3_, "!((Class) sym).is_compact");
206 _tmp4_ = vala_get_ccode_upper_case_name ((ValaSymbol*) sym, NULL);
207 _tmp5_ = _tmp4_;
208 _tmp6_ = g_strdup_printf ("%s_GET_CLASS", _tmp5_);
209 _tmp7_ = _tmp6_;
210 _g_free0 (_tmp5_);
211 result = _tmp7_;
212 _g_free0 (func_name);
213 return result;
214 } else {
215 if (G_TYPE_CHECK_INSTANCE_TYPE (sym, VALA_TYPE_INTERFACE)) {
216 gchar* _tmp8_;
217 gchar* _tmp9_;
218 gchar* _tmp10_;
219 gchar* _tmp11_;
220 _tmp8_ = vala_get_ccode_upper_case_name ((ValaSymbol*) sym, NULL);
221 _tmp9_ = _tmp8_;
222 _tmp10_ = g_strdup_printf ("%s_GET_INTERFACE", _tmp9_);
223 _tmp11_ = _tmp10_;
224 _g_free0 (_tmp9_);
225 result = _tmp11_;
226 _g_free0 (func_name);
227 return result;
228 } else {
229 ValaSourceReference* _tmp12_;
230 ValaSourceReference* _tmp13_;
231 gchar* _tmp14_;
232 _tmp12_ = vala_code_node_get_source_reference ((ValaCodeNode*) sym);
233 _tmp13_ = _tmp12_;
234 vala_report_error (_tmp13_, "`CCode.type_get_function' not supported");
235 _tmp14_ = g_strdup ("");
236 result = _tmp14_;
237 _g_free0 (func_name);
238 return result;
239 }
240 }
241 _g_free0 (func_name);
242 }
243
244 gchar*
vala_get_ccode_class_get_private_function(ValaClass * cl)245 vala_get_ccode_class_get_private_function (ValaClass* cl)
246 {
247 gboolean _tmp0_;
248 gboolean _tmp1_;
249 gchar* _tmp2_;
250 gchar* _tmp3_;
251 gchar* _tmp4_;
252 gchar* _tmp5_;
253 gchar* result = NULL;
254 g_return_val_if_fail (cl != NULL, NULL);
255 _tmp0_ = vala_class_get_is_compact (cl);
256 _tmp1_ = _tmp0_;
257 _vala_assert (!_tmp1_, "!cl.is_compact");
258 _tmp2_ = vala_get_ccode_upper_case_name ((ValaSymbol*) cl, NULL);
259 _tmp3_ = _tmp2_;
260 _tmp4_ = g_strdup_printf ("%s_GET_CLASS_PRIVATE", _tmp3_);
261 _tmp5_ = _tmp4_;
262 _g_free0 (_tmp3_);
263 result = _tmp5_;
264 return result;
265 }
266
267 gchar*
vala_get_ccode_class_type_function(ValaClass * cl)268 vala_get_ccode_class_type_function (ValaClass* cl)
269 {
270 gboolean _tmp0_;
271 gboolean _tmp1_;
272 gchar* _tmp2_;
273 gchar* _tmp3_;
274 gchar* _tmp4_;
275 gchar* _tmp5_;
276 gchar* result = NULL;
277 g_return_val_if_fail (cl != NULL, NULL);
278 _tmp0_ = vala_class_get_is_compact (cl);
279 _tmp1_ = _tmp0_;
280 _vala_assert (!_tmp1_, "!cl.is_compact");
281 _tmp2_ = vala_get_ccode_upper_case_name ((ValaSymbol*) cl, NULL);
282 _tmp3_ = _tmp2_;
283 _tmp4_ = g_strdup_printf ("%s_CLASS", _tmp3_);
284 _tmp5_ = _tmp4_;
285 _g_free0 (_tmp3_);
286 result = _tmp5_;
287 return result;
288 }
289
290 static gchar*
string_replace(const gchar * self,const gchar * old,const gchar * replacement)291 string_replace (const gchar* self,
292 const gchar* old,
293 const gchar* replacement)
294 {
295 gboolean _tmp0_ = FALSE;
296 gboolean _tmp1_ = FALSE;
297 GError* _inner_error0_ = NULL;
298 gchar* result = NULL;
299 g_return_val_if_fail (self != NULL, NULL);
300 g_return_val_if_fail (old != NULL, NULL);
301 g_return_val_if_fail (replacement != NULL, NULL);
302 if ((*((gchar*) self)) == '\0') {
303 _tmp1_ = TRUE;
304 } else {
305 _tmp1_ = (*((gchar*) old)) == '\0';
306 }
307 if (_tmp1_) {
308 _tmp0_ = TRUE;
309 } else {
310 _tmp0_ = g_strcmp0 (old, replacement) == 0;
311 }
312 if (_tmp0_) {
313 gchar* _tmp2_;
314 _tmp2_ = g_strdup (self);
315 result = _tmp2_;
316 return result;
317 }
318 {
319 GRegex* regex = NULL;
320 gchar* _tmp3_;
321 gchar* _tmp4_;
322 GRegex* _tmp5_;
323 GRegex* _tmp6_;
324 gchar* _tmp7_ = NULL;
325 GRegex* _tmp8_;
326 gchar* _tmp9_;
327 gchar* _tmp10_;
328 _tmp3_ = g_regex_escape_string (old, -1);
329 _tmp4_ = _tmp3_;
330 _tmp5_ = g_regex_new (_tmp4_, 0, 0, &_inner_error0_);
331 _tmp6_ = _tmp5_;
332 _g_free0 (_tmp4_);
333 regex = _tmp6_;
334 if (G_UNLIKELY (_inner_error0_ != NULL)) {
335 if (_inner_error0_->domain == G_REGEX_ERROR) {
336 goto __catch0_g_regex_error;
337 }
338 g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
339 g_clear_error (&_inner_error0_);
340 return NULL;
341 }
342 _tmp8_ = regex;
343 _tmp9_ = g_regex_replace_literal (_tmp8_, self, (gssize) -1, 0, replacement, 0, &_inner_error0_);
344 _tmp7_ = _tmp9_;
345 if (G_UNLIKELY (_inner_error0_ != NULL)) {
346 _g_regex_unref0 (regex);
347 if (_inner_error0_->domain == G_REGEX_ERROR) {
348 goto __catch0_g_regex_error;
349 }
350 g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
351 g_clear_error (&_inner_error0_);
352 return NULL;
353 }
354 _tmp10_ = _tmp7_;
355 _tmp7_ = NULL;
356 result = _tmp10_;
357 _g_free0 (_tmp7_);
358 _g_regex_unref0 (regex);
359 return result;
360 }
361 goto __finally0;
362 __catch0_g_regex_error:
363 {
364 g_clear_error (&_inner_error0_);
365 g_assert_not_reached ();
366 }
367 __finally0:
368 g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
369 g_clear_error (&_inner_error0_);
370 return NULL;
371 }
372
373 gchar*
vala_get_ccode_lower_case_name(ValaCodeNode * node,const gchar * infix)374 vala_get_ccode_lower_case_name (ValaCodeNode* node,
375 const gchar* infix)
376 {
377 ValaSymbol* sym = NULL;
378 ValaSymbol* _tmp0_;
379 gchar* result = NULL;
380 g_return_val_if_fail (node != NULL, NULL);
381 sym = G_TYPE_CHECK_INSTANCE_TYPE (node, VALA_TYPE_SYMBOL) ? ((ValaSymbol*) node) : NULL;
382 _tmp0_ = sym;
383 if (_tmp0_ != NULL) {
384 ValaSymbol* _tmp1_;
385 if (infix == NULL) {
386 infix = "";
387 }
388 _tmp1_ = sym;
389 if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp1_, VALA_TYPE_DELEGATE)) {
390 ValaSymbol* _tmp2_;
391 ValaSymbol* _tmp3_;
392 ValaSymbol* _tmp4_;
393 gchar* _tmp5_;
394 gchar* _tmp6_;
395 ValaSymbol* _tmp7_;
396 const gchar* _tmp8_;
397 const gchar* _tmp9_;
398 gchar* _tmp10_;
399 gchar* _tmp11_;
400 gchar* _tmp12_;
401 gchar* _tmp13_;
402 _tmp2_ = sym;
403 _tmp3_ = vala_symbol_get_parent_symbol (_tmp2_);
404 _tmp4_ = _tmp3_;
405 _tmp5_ = vala_get_ccode_lower_case_prefix (_tmp4_);
406 _tmp6_ = _tmp5_;
407 _tmp7_ = sym;
408 _tmp8_ = vala_symbol_get_name (_tmp7_);
409 _tmp9_ = _tmp8_;
410 _tmp10_ = vala_symbol_camel_case_to_lower_case (_tmp9_);
411 _tmp11_ = _tmp10_;
412 _tmp12_ = g_strdup_printf ("%s%s%s", _tmp6_, infix, _tmp11_);
413 _tmp13_ = _tmp12_;
414 _g_free0 (_tmp11_);
415 _g_free0 (_tmp6_);
416 result = _tmp13_;
417 return result;
418 } else {
419 ValaSymbol* _tmp14_;
420 _tmp14_ = sym;
421 if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp14_, VALA_TYPE_SIGNAL)) {
422 ValaSymbol* _tmp15_;
423 ValaCCodeAttribute* _tmp16_;
424 const gchar* _tmp17_;
425 const gchar* _tmp18_;
426 gchar* _tmp19_;
427 _tmp15_ = sym;
428 _tmp16_ = vala_get_ccode_attribute ((ValaCodeNode*) _tmp15_);
429 _tmp17_ = vala_ccode_attribute_get_name (_tmp16_);
430 _tmp18_ = _tmp17_;
431 _tmp19_ = string_replace (_tmp18_, "-", "_");
432 result = _tmp19_;
433 return result;
434 } else {
435 ValaSymbol* _tmp20_;
436 _tmp20_ = sym;
437 if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp20_, VALA_TYPE_ERROR_CODE)) {
438 ValaSymbol* _tmp21_;
439 gchar* _tmp22_;
440 gchar* _tmp23_;
441 gchar* _tmp24_;
442 gchar* _tmp25_;
443 _tmp21_ = sym;
444 _tmp22_ = vala_get_ccode_name ((ValaCodeNode*) _tmp21_);
445 _tmp23_ = _tmp22_;
446 _tmp24_ = g_ascii_strdown (_tmp23_, (gssize) -1);
447 _tmp25_ = _tmp24_;
448 _g_free0 (_tmp23_);
449 result = _tmp25_;
450 return result;
451 } else {
452 ValaSymbol* _tmp26_;
453 ValaSymbol* _tmp27_;
454 ValaSymbol* _tmp28_;
455 gchar* _tmp29_;
456 gchar* _tmp30_;
457 ValaSymbol* _tmp31_;
458 gchar* _tmp32_;
459 gchar* _tmp33_;
460 gchar* _tmp34_;
461 gchar* _tmp35_;
462 _tmp26_ = sym;
463 _tmp27_ = vala_symbol_get_parent_symbol (_tmp26_);
464 _tmp28_ = _tmp27_;
465 _tmp29_ = vala_get_ccode_lower_case_prefix (_tmp28_);
466 _tmp30_ = _tmp29_;
467 _tmp31_ = sym;
468 _tmp32_ = vala_get_ccode_lower_case_suffix (_tmp31_);
469 _tmp33_ = _tmp32_;
470 _tmp34_ = g_strdup_printf ("%s%s%s", _tmp30_, infix, _tmp33_);
471 _tmp35_ = _tmp34_;
472 _g_free0 (_tmp33_);
473 _g_free0 (_tmp30_);
474 result = _tmp35_;
475 return result;
476 }
477 }
478 }
479 } else {
480 if (G_TYPE_CHECK_INSTANCE_TYPE (node, VALA_TYPE_ERROR_TYPE)) {
481 ValaErrorType* type = NULL;
482 ValaErrorType* _tmp36_;
483 ValaErrorDomain* _tmp37_;
484 ValaErrorDomain* _tmp38_;
485 type = G_TYPE_CHECK_INSTANCE_CAST (node, VALA_TYPE_ERROR_TYPE, ValaErrorType);
486 _tmp36_ = type;
487 _tmp37_ = vala_error_type_get_error_domain (_tmp36_);
488 _tmp38_ = _tmp37_;
489 if (_tmp38_ == NULL) {
490 if (infix == NULL) {
491 gchar* _tmp39_;
492 _tmp39_ = g_strdup ("g_error");
493 result = _tmp39_;
494 return result;
495 } else {
496 gchar* _tmp40_;
497 _tmp40_ = g_strdup_printf ("g_%s_error", infix);
498 result = _tmp40_;
499 return result;
500 }
501 } else {
502 ValaErrorType* _tmp41_;
503 ValaErrorCode* _tmp42_;
504 ValaErrorCode* _tmp43_;
505 _tmp41_ = type;
506 _tmp42_ = vala_error_type_get_error_code (_tmp41_);
507 _tmp43_ = _tmp42_;
508 if (_tmp43_ == NULL) {
509 ValaErrorType* _tmp44_;
510 ValaErrorDomain* _tmp45_;
511 ValaErrorDomain* _tmp46_;
512 gchar* _tmp47_;
513 _tmp44_ = type;
514 _tmp45_ = vala_error_type_get_error_domain (_tmp44_);
515 _tmp46_ = _tmp45_;
516 _tmp47_ = vala_get_ccode_lower_case_name ((ValaCodeNode*) _tmp46_, infix);
517 result = _tmp47_;
518 return result;
519 } else {
520 ValaErrorType* _tmp48_;
521 ValaErrorCode* _tmp49_;
522 ValaErrorCode* _tmp50_;
523 gchar* _tmp51_;
524 _tmp48_ = type;
525 _tmp49_ = vala_error_type_get_error_code (_tmp48_);
526 _tmp50_ = _tmp49_;
527 _tmp51_ = vala_get_ccode_lower_case_name ((ValaCodeNode*) _tmp50_, infix);
528 result = _tmp51_;
529 return result;
530 }
531 }
532 } else {
533 if (G_TYPE_CHECK_INSTANCE_TYPE (node, VALA_TYPE_DELEGATE_TYPE)) {
534 ValaDelegateType* type = NULL;
535 ValaDelegateType* _tmp52_;
536 ValaDelegate* _tmp53_;
537 ValaDelegate* _tmp54_;
538 gchar* _tmp55_;
539 type = G_TYPE_CHECK_INSTANCE_CAST (node, VALA_TYPE_DELEGATE_TYPE, ValaDelegateType);
540 _tmp52_ = type;
541 _tmp53_ = vala_delegate_type_get_delegate_symbol (_tmp52_);
542 _tmp54_ = _tmp53_;
543 _tmp55_ = vala_get_ccode_lower_case_name ((ValaCodeNode*) _tmp54_, infix);
544 result = _tmp55_;
545 return result;
546 } else {
547 if (G_TYPE_CHECK_INSTANCE_TYPE (node, VALA_TYPE_POINTER_TYPE)) {
548 ValaPointerType* type = NULL;
549 ValaPointerType* _tmp56_;
550 ValaDataType* _tmp57_;
551 ValaDataType* _tmp58_;
552 gchar* _tmp59_;
553 type = G_TYPE_CHECK_INSTANCE_CAST (node, VALA_TYPE_POINTER_TYPE, ValaPointerType);
554 _tmp56_ = type;
555 _tmp57_ = vala_pointer_type_get_base_type (_tmp56_);
556 _tmp58_ = _tmp57_;
557 _tmp59_ = vala_get_ccode_lower_case_name ((ValaCodeNode*) _tmp58_, infix);
558 result = _tmp59_;
559 return result;
560 } else {
561 if (G_TYPE_CHECK_INSTANCE_TYPE (node, VALA_TYPE_GENERIC_TYPE)) {
562 gchar* _tmp60_;
563 _tmp60_ = g_strdup ("valageneric");
564 result = _tmp60_;
565 return result;
566 } else {
567 if (G_TYPE_CHECK_INSTANCE_TYPE (node, VALA_TYPE_VOID_TYPE)) {
568 gchar* _tmp61_;
569 _tmp61_ = g_strdup ("valavoid");
570 result = _tmp61_;
571 return result;
572 } else {
573 ValaDataType* type = NULL;
574 ValaDataType* _tmp62_;
575 ValaTypeSymbol* _tmp63_;
576 ValaTypeSymbol* _tmp64_;
577 gchar* _tmp65_;
578 type = G_TYPE_CHECK_INSTANCE_CAST (node, VALA_TYPE_DATA_TYPE, ValaDataType);
579 _tmp62_ = type;
580 _tmp63_ = vala_data_type_get_type_symbol (_tmp62_);
581 _tmp64_ = _tmp63_;
582 _tmp65_ = vala_get_ccode_lower_case_name ((ValaCodeNode*) _tmp64_, infix);
583 result = _tmp65_;
584 return result;
585 }
586 }
587 }
588 }
589 }
590 }
591 }
592
593 gchar*
vala_get_ccode_upper_case_name(ValaSymbol * sym,const gchar * infix)594 vala_get_ccode_upper_case_name (ValaSymbol* sym,
595 const gchar* infix)
596 {
597 gchar* result = NULL;
598 g_return_val_if_fail (sym != NULL, NULL);
599 if (G_TYPE_CHECK_INSTANCE_TYPE (sym, VALA_TYPE_PROPERTY)) {
600 ValaSymbol* _tmp0_;
601 ValaSymbol* _tmp1_;
602 gchar* _tmp2_;
603 gchar* _tmp3_;
604 const gchar* _tmp4_;
605 const gchar* _tmp5_;
606 gchar* _tmp6_;
607 gchar* _tmp7_;
608 gchar* _tmp8_;
609 gchar* _tmp9_;
610 gchar* _tmp10_;
611 gchar* _tmp11_;
612 _tmp0_ = vala_symbol_get_parent_symbol (sym);
613 _tmp1_ = _tmp0_;
614 _tmp2_ = vala_get_ccode_lower_case_name ((ValaCodeNode*) _tmp1_, NULL);
615 _tmp3_ = _tmp2_;
616 _tmp4_ = vala_symbol_get_name (sym);
617 _tmp5_ = _tmp4_;
618 _tmp6_ = vala_symbol_camel_case_to_lower_case (_tmp5_);
619 _tmp7_ = _tmp6_;
620 _tmp8_ = g_strdup_printf ("%s_%s", _tmp3_, _tmp7_);
621 _tmp9_ = _tmp8_;
622 _tmp10_ = g_ascii_strup (_tmp9_, (gssize) -1);
623 _tmp11_ = _tmp10_;
624 _g_free0 (_tmp9_);
625 _g_free0 (_tmp7_);
626 _g_free0 (_tmp3_);
627 result = _tmp11_;
628 return result;
629 } else {
630 gchar* _tmp12_;
631 gchar* _tmp13_;
632 gchar* _tmp14_;
633 gchar* _tmp15_;
634 _tmp12_ = vala_get_ccode_lower_case_name ((ValaCodeNode*) sym, infix);
635 _tmp13_ = _tmp12_;
636 _tmp14_ = g_ascii_strup (_tmp13_, (gssize) -1);
637 _tmp15_ = _tmp14_;
638 _g_free0 (_tmp13_);
639 result = _tmp15_;
640 return result;
641 }
642 }
643
644 gchar*
vala_get_ccode_header_filenames(ValaSymbol * sym)645 vala_get_ccode_header_filenames (ValaSymbol* sym)
646 {
647 ValaCCodeAttribute* _tmp0_;
648 const gchar* _tmp1_;
649 const gchar* _tmp2_;
650 gchar* _tmp3_;
651 gchar* result = NULL;
652 g_return_val_if_fail (sym != NULL, NULL);
653 _tmp0_ = vala_get_ccode_attribute ((ValaCodeNode*) sym);
654 _tmp1_ = vala_ccode_attribute_get_header_filenames (_tmp0_);
655 _tmp2_ = _tmp1_;
656 _tmp3_ = g_strdup (_tmp2_);
657 result = _tmp3_;
658 return result;
659 }
660
661 gchar*
vala_get_ccode_feature_test_macros(ValaSymbol * sym)662 vala_get_ccode_feature_test_macros (ValaSymbol* sym)
663 {
664 ValaCCodeAttribute* _tmp0_;
665 const gchar* _tmp1_;
666 const gchar* _tmp2_;
667 gchar* _tmp3_;
668 gchar* result = NULL;
669 g_return_val_if_fail (sym != NULL, NULL);
670 _tmp0_ = vala_get_ccode_attribute ((ValaCodeNode*) sym);
671 _tmp1_ = vala_ccode_attribute_get_feature_test_macros (_tmp0_);
672 _tmp2_ = _tmp1_;
673 _tmp3_ = g_strdup (_tmp2_);
674 result = _tmp3_;
675 return result;
676 }
677
678 gchar*
vala_get_ccode_prefix(ValaSymbol * sym)679 vala_get_ccode_prefix (ValaSymbol* sym)
680 {
681 ValaCCodeAttribute* _tmp0_;
682 const gchar* _tmp1_;
683 const gchar* _tmp2_;
684 gchar* _tmp3_;
685 gchar* result = NULL;
686 g_return_val_if_fail (sym != NULL, NULL);
687 _tmp0_ = vala_get_ccode_attribute ((ValaCodeNode*) sym);
688 _tmp1_ = vala_ccode_attribute_get_prefix (_tmp0_);
689 _tmp2_ = _tmp1_;
690 _tmp3_ = g_strdup (_tmp2_);
691 result = _tmp3_;
692 return result;
693 }
694
695 gchar*
vala_get_ccode_lower_case_prefix(ValaSymbol * sym)696 vala_get_ccode_lower_case_prefix (ValaSymbol* sym)
697 {
698 ValaCCodeAttribute* _tmp0_;
699 const gchar* _tmp1_;
700 const gchar* _tmp2_;
701 gchar* _tmp3_;
702 gchar* result = NULL;
703 g_return_val_if_fail (sym != NULL, NULL);
704 _tmp0_ = vala_get_ccode_attribute ((ValaCodeNode*) sym);
705 _tmp1_ = vala_ccode_attribute_get_lower_case_prefix (_tmp0_);
706 _tmp2_ = _tmp1_;
707 _tmp3_ = g_strdup (_tmp2_);
708 result = _tmp3_;
709 return result;
710 }
711
712 gchar*
vala_get_ccode_lower_case_suffix(ValaSymbol * sym)713 vala_get_ccode_lower_case_suffix (ValaSymbol* sym)
714 {
715 ValaCCodeAttribute* _tmp0_;
716 const gchar* _tmp1_;
717 const gchar* _tmp2_;
718 gchar* _tmp3_;
719 gchar* result = NULL;
720 g_return_val_if_fail (sym != NULL, NULL);
721 _tmp0_ = vala_get_ccode_attribute ((ValaCodeNode*) sym);
722 _tmp1_ = vala_ccode_attribute_get_lower_case_suffix (_tmp0_);
723 _tmp2_ = _tmp1_;
724 _tmp3_ = g_strdup (_tmp2_);
725 result = _tmp3_;
726 return result;
727 }
728
729 gchar*
vala_get_ccode_ref_function(ValaTypeSymbol * sym)730 vala_get_ccode_ref_function (ValaTypeSymbol* sym)
731 {
732 ValaCCodeAttribute* _tmp0_;
733 const gchar* _tmp1_;
734 const gchar* _tmp2_;
735 gchar* _tmp3_;
736 gchar* result = NULL;
737 g_return_val_if_fail (sym != NULL, NULL);
738 _tmp0_ = vala_get_ccode_attribute ((ValaCodeNode*) sym);
739 _tmp1_ = vala_ccode_attribute_get_ref_function (_tmp0_);
740 _tmp2_ = _tmp1_;
741 _tmp3_ = g_strdup (_tmp2_);
742 result = _tmp3_;
743 return result;
744 }
745
746 gchar*
vala_get_ccode_quark_name(ValaErrorDomain * edomain)747 vala_get_ccode_quark_name (ValaErrorDomain* edomain)
748 {
749 gchar* _tmp0_;
750 gchar* _tmp1_;
751 gchar* _tmp2_;
752 gchar* _tmp3_;
753 gchar* _tmp4_;
754 gchar* _tmp5_;
755 gchar* result = NULL;
756 g_return_val_if_fail (edomain != NULL, NULL);
757 _tmp0_ = vala_get_ccode_lower_case_name ((ValaCodeNode*) edomain, NULL);
758 _tmp1_ = _tmp0_;
759 _tmp2_ = string_replace (_tmp1_, "_", "-");
760 _tmp3_ = _tmp2_;
761 _tmp4_ = g_strdup_printf ("%s-quark", _tmp3_);
762 _tmp5_ = _tmp4_;
763 _g_free0 (_tmp3_);
764 _g_free0 (_tmp1_);
765 result = _tmp5_;
766 return result;
767 }
768
769 gboolean
vala_is_reference_counting(ValaTypeSymbol * sym)770 vala_is_reference_counting (ValaTypeSymbol* sym)
771 {
772 gboolean result = FALSE;
773 g_return_val_if_fail (sym != NULL, FALSE);
774 if (G_TYPE_CHECK_INSTANCE_TYPE (sym, VALA_TYPE_CLASS)) {
775 gchar* _tmp0_;
776 gchar* _tmp1_;
777 gboolean _tmp2_;
778 _tmp0_ = vala_get_ccode_ref_function (sym);
779 _tmp1_ = _tmp0_;
780 _tmp2_ = _tmp1_ != NULL;
781 _g_free0 (_tmp1_);
782 result = _tmp2_;
783 return result;
784 } else {
785 if (G_TYPE_CHECK_INSTANCE_TYPE (sym, VALA_TYPE_INTERFACE)) {
786 result = TRUE;
787 return result;
788 } else {
789 result = FALSE;
790 return result;
791 }
792 }
793 }
794
795 gboolean
vala_is_ref_function_void(ValaDataType * type)796 vala_is_ref_function_void (ValaDataType* type)
797 {
798 ValaClass* cl = NULL;
799 ValaTypeSymbol* _tmp0_;
800 ValaTypeSymbol* _tmp1_;
801 ValaClass* _tmp2_;
802 gboolean result = FALSE;
803 g_return_val_if_fail (type != NULL, FALSE);
804 _tmp0_ = vala_data_type_get_type_symbol (type);
805 _tmp1_ = _tmp0_;
806 cl = G_TYPE_CHECK_INSTANCE_TYPE (_tmp1_, VALA_TYPE_CLASS) ? ((ValaClass*) _tmp1_) : NULL;
807 _tmp2_ = cl;
808 if (_tmp2_ != NULL) {
809 ValaClass* _tmp3_;
810 _tmp3_ = cl;
811 result = vala_get_ccode_ref_function_void (_tmp3_);
812 return result;
813 } else {
814 result = FALSE;
815 return result;
816 }
817 }
818
819 gboolean
vala_is_free_function_address_of(ValaDataType * type)820 vala_is_free_function_address_of (ValaDataType* type)
821 {
822 ValaClass* cl = NULL;
823 ValaTypeSymbol* _tmp0_;
824 ValaTypeSymbol* _tmp1_;
825 ValaClass* _tmp2_;
826 gboolean result = FALSE;
827 g_return_val_if_fail (type != NULL, FALSE);
828 _tmp0_ = vala_data_type_get_type_symbol (type);
829 _tmp1_ = _tmp0_;
830 cl = G_TYPE_CHECK_INSTANCE_TYPE (_tmp1_, VALA_TYPE_CLASS) ? ((ValaClass*) _tmp1_) : NULL;
831 _tmp2_ = cl;
832 if (_tmp2_ != NULL) {
833 ValaClass* _tmp3_;
834 _tmp3_ = cl;
835 result = vala_get_ccode_free_function_address_of (_tmp3_);
836 return result;
837 } else {
838 result = FALSE;
839 return result;
840 }
841 }
842
843 gboolean
vala_get_ccode_ref_function_void(ValaClass * cl)844 vala_get_ccode_ref_function_void (ValaClass* cl)
845 {
846 ValaCCodeAttribute* _tmp0_;
847 gboolean _tmp1_;
848 gboolean _tmp2_;
849 gboolean result = FALSE;
850 g_return_val_if_fail (cl != NULL, FALSE);
851 _tmp0_ = vala_get_ccode_attribute ((ValaCodeNode*) cl);
852 _tmp1_ = vala_ccode_attribute_get_ref_function_void (_tmp0_);
853 _tmp2_ = _tmp1_;
854 result = _tmp2_;
855 return result;
856 }
857
858 gboolean
vala_get_ccode_free_function_address_of(ValaClass * cl)859 vala_get_ccode_free_function_address_of (ValaClass* cl)
860 {
861 ValaCCodeAttribute* _tmp0_;
862 gboolean _tmp1_;
863 gboolean _tmp2_;
864 gboolean result = FALSE;
865 g_return_val_if_fail (cl != NULL, FALSE);
866 _tmp0_ = vala_get_ccode_attribute ((ValaCodeNode*) cl);
867 _tmp1_ = vala_ccode_attribute_get_free_function_address_of (_tmp0_);
868 _tmp2_ = _tmp1_;
869 result = _tmp2_;
870 return result;
871 }
872
873 gchar*
vala_get_ccode_unref_function(ValaObjectTypeSymbol * sym)874 vala_get_ccode_unref_function (ValaObjectTypeSymbol* sym)
875 {
876 ValaCCodeAttribute* _tmp0_;
877 const gchar* _tmp1_;
878 const gchar* _tmp2_;
879 gchar* _tmp3_;
880 gchar* result = NULL;
881 g_return_val_if_fail (sym != NULL, NULL);
882 _tmp0_ = vala_get_ccode_attribute ((ValaCodeNode*) sym);
883 _tmp1_ = vala_ccode_attribute_get_unref_function (_tmp0_);
884 _tmp2_ = _tmp1_;
885 _tmp3_ = g_strdup (_tmp2_);
886 result = _tmp3_;
887 return result;
888 }
889
890 gchar*
vala_get_ccode_ref_sink_function(ValaObjectTypeSymbol * sym)891 vala_get_ccode_ref_sink_function (ValaObjectTypeSymbol* sym)
892 {
893 ValaCCodeAttribute* _tmp0_;
894 const gchar* _tmp1_;
895 const gchar* _tmp2_;
896 gchar* _tmp3_;
897 gchar* result = NULL;
898 g_return_val_if_fail (sym != NULL, NULL);
899 _tmp0_ = vala_get_ccode_attribute ((ValaCodeNode*) sym);
900 _tmp1_ = vala_ccode_attribute_get_ref_sink_function (_tmp0_);
901 _tmp2_ = _tmp1_;
902 _tmp3_ = g_strdup (_tmp2_);
903 result = _tmp3_;
904 return result;
905 }
906
907 gchar*
vala_get_ccode_copy_function(ValaTypeSymbol * sym)908 vala_get_ccode_copy_function (ValaTypeSymbol* sym)
909 {
910 ValaCCodeAttribute* _tmp0_;
911 const gchar* _tmp1_;
912 const gchar* _tmp2_;
913 gchar* _tmp3_;
914 gchar* result = NULL;
915 g_return_val_if_fail (sym != NULL, NULL);
916 _tmp0_ = vala_get_ccode_attribute ((ValaCodeNode*) sym);
917 _tmp1_ = vala_ccode_attribute_get_copy_function (_tmp0_);
918 _tmp2_ = _tmp1_;
919 _tmp3_ = g_strdup (_tmp2_);
920 result = _tmp3_;
921 return result;
922 }
923
924 gchar*
vala_get_ccode_destroy_function(ValaTypeSymbol * sym)925 vala_get_ccode_destroy_function (ValaTypeSymbol* sym)
926 {
927 ValaCCodeAttribute* _tmp0_;
928 const gchar* _tmp1_;
929 const gchar* _tmp2_;
930 gchar* _tmp3_;
931 gchar* result = NULL;
932 g_return_val_if_fail (sym != NULL, NULL);
933 _tmp0_ = vala_get_ccode_attribute ((ValaCodeNode*) sym);
934 _tmp1_ = vala_ccode_attribute_get_destroy_function (_tmp0_);
935 _tmp2_ = _tmp1_;
936 _tmp3_ = g_strdup (_tmp2_);
937 result = _tmp3_;
938 return result;
939 }
940
941 gchar*
vala_get_ccode_dup_function(ValaTypeSymbol * sym)942 vala_get_ccode_dup_function (ValaTypeSymbol* sym)
943 {
944 gchar* _tmp4_;
945 gchar* result = NULL;
946 g_return_val_if_fail (sym != NULL, NULL);
947 if (G_TYPE_CHECK_INSTANCE_TYPE (sym, VALA_TYPE_STRUCT)) {
948 ValaCCodeAttribute* _tmp0_;
949 const gchar* _tmp1_;
950 const gchar* _tmp2_;
951 gchar* _tmp3_;
952 _tmp0_ = vala_get_ccode_attribute ((ValaCodeNode*) sym);
953 _tmp1_ = vala_ccode_attribute_get_dup_function (_tmp0_);
954 _tmp2_ = _tmp1_;
955 _tmp3_ = g_strdup (_tmp2_);
956 result = _tmp3_;
957 return result;
958 }
959 _tmp4_ = vala_get_ccode_copy_function (sym);
960 result = _tmp4_;
961 return result;
962 }
963
964 gchar*
vala_get_ccode_free_function(ValaTypeSymbol * sym)965 vala_get_ccode_free_function (ValaTypeSymbol* sym)
966 {
967 ValaCCodeAttribute* _tmp0_;
968 const gchar* _tmp1_;
969 const gchar* _tmp2_;
970 gchar* _tmp3_;
971 gchar* result = NULL;
972 g_return_val_if_fail (sym != NULL, NULL);
973 _tmp0_ = vala_get_ccode_attribute ((ValaCodeNode*) sym);
974 _tmp1_ = vala_ccode_attribute_get_free_function (_tmp0_);
975 _tmp2_ = _tmp1_;
976 _tmp3_ = g_strdup (_tmp2_);
977 result = _tmp3_;
978 return result;
979 }
980
981 gboolean
vala_get_ccode_is_gboxed(ValaTypeSymbol * sym)982 vala_get_ccode_is_gboxed (ValaTypeSymbol* sym)
983 {
984 gchar* _tmp0_;
985 gchar* _tmp1_;
986 gboolean _tmp2_;
987 gboolean result = FALSE;
988 g_return_val_if_fail (sym != NULL, FALSE);
989 _tmp0_ = vala_get_ccode_free_function (sym);
990 _tmp1_ = _tmp0_;
991 _tmp2_ = g_strcmp0 (_tmp1_, "g_boxed_free") == 0;
992 _g_free0 (_tmp1_);
993 result = _tmp2_;
994 return result;
995 }
996
997 gboolean
vala_get_ccode_finish_instance(ValaMethod * m)998 vala_get_ccode_finish_instance (ValaMethod* m)
999 {
1000 gboolean _tmp0_;
1001 gboolean _tmp1_;
1002 ValaCCodeAttribute* _tmp2_;
1003 gboolean _tmp3_;
1004 gboolean _tmp4_;
1005 gboolean result = FALSE;
1006 g_return_val_if_fail (m != NULL, FALSE);
1007 _tmp0_ = vala_method_get_coroutine (m);
1008 _tmp1_ = _tmp0_;
1009 _vala_assert (_tmp1_, "m.coroutine");
1010 _tmp2_ = vala_get_ccode_attribute ((ValaCodeNode*) m);
1011 _tmp3_ = vala_ccode_attribute_get_finish_instance (_tmp2_);
1012 _tmp4_ = _tmp3_;
1013 result = _tmp4_;
1014 return result;
1015 }
1016
1017 gchar*
vala_get_ccode_type_id(ValaCodeNode * node)1018 vala_get_ccode_type_id (ValaCodeNode* node)
1019 {
1020 ValaCCodeAttribute* _tmp0_;
1021 const gchar* _tmp1_;
1022 const gchar* _tmp2_;
1023 gchar* _tmp3_;
1024 gchar* result = NULL;
1025 g_return_val_if_fail (node != NULL, NULL);
1026 _tmp0_ = vala_get_ccode_attribute (node);
1027 _tmp1_ = vala_ccode_attribute_get_type_id (_tmp0_);
1028 _tmp2_ = _tmp1_;
1029 _tmp3_ = g_strdup (_tmp2_);
1030 result = _tmp3_;
1031 return result;
1032 }
1033
1034 gchar*
vala_get_ccode_type_function(ValaTypeSymbol * sym)1035 vala_get_ccode_type_function (ValaTypeSymbol* sym)
1036 {
1037 gboolean _tmp0_ = FALSE;
1038 gboolean _tmp1_ = FALSE;
1039 gboolean _tmp2_ = FALSE;
1040 gboolean _tmp3_ = FALSE;
1041 gchar* _tmp6_;
1042 gchar* _tmp7_;
1043 gchar* _tmp8_;
1044 gchar* _tmp9_;
1045 gchar* result = NULL;
1046 g_return_val_if_fail (sym != NULL, NULL);
1047 if (G_TYPE_CHECK_INSTANCE_TYPE (sym, VALA_TYPE_CLASS)) {
1048 gboolean _tmp4_;
1049 gboolean _tmp5_;
1050 _tmp4_ = vala_class_get_is_compact (G_TYPE_CHECK_INSTANCE_CAST (sym, VALA_TYPE_CLASS, ValaClass));
1051 _tmp5_ = _tmp4_;
1052 _tmp3_ = _tmp5_;
1053 } else {
1054 _tmp3_ = FALSE;
1055 }
1056 if (_tmp3_) {
1057 _tmp2_ = TRUE;
1058 } else {
1059 _tmp2_ = G_TYPE_CHECK_INSTANCE_TYPE (sym, VALA_TYPE_ERROR_CODE);
1060 }
1061 if (_tmp2_) {
1062 _tmp1_ = TRUE;
1063 } else {
1064 _tmp1_ = G_TYPE_CHECK_INSTANCE_TYPE (sym, VALA_TYPE_ERROR_DOMAIN);
1065 }
1066 if (_tmp1_) {
1067 _tmp0_ = TRUE;
1068 } else {
1069 _tmp0_ = G_TYPE_CHECK_INSTANCE_TYPE (sym, VALA_TYPE_DELEGATE);
1070 }
1071 _vala_assert (!_tmp0_, "!((sym is Class && ((Class) sym).is_compact) || sym is ErrorCode || sym is ErrorDomain || sym is Delegate)");
1072 _tmp6_ = vala_get_ccode_lower_case_name ((ValaCodeNode*) sym, NULL);
1073 _tmp7_ = _tmp6_;
1074 _tmp8_ = g_strdup_printf ("%s_get_type", _tmp7_);
1075 _tmp9_ = _tmp8_;
1076 _g_free0 (_tmp7_);
1077 result = _tmp9_;
1078 return result;
1079 }
1080
1081 gchar*
vala_get_ccode_marshaller_type_name(ValaCodeNode * node)1082 vala_get_ccode_marshaller_type_name (ValaCodeNode* node)
1083 {
1084 ValaCCodeAttribute* _tmp0_;
1085 const gchar* _tmp1_;
1086 const gchar* _tmp2_;
1087 gchar* _tmp3_;
1088 gchar* result = NULL;
1089 g_return_val_if_fail (node != NULL, NULL);
1090 _tmp0_ = vala_get_ccode_attribute (node);
1091 _tmp1_ = vala_ccode_attribute_get_marshaller_type_name (_tmp0_);
1092 _tmp2_ = _tmp1_;
1093 _tmp3_ = g_strdup (_tmp2_);
1094 result = _tmp3_;
1095 return result;
1096 }
1097
1098 gchar*
vala_get_ccode_get_value_function(ValaCodeNode * sym)1099 vala_get_ccode_get_value_function (ValaCodeNode* sym)
1100 {
1101 ValaCCodeAttribute* _tmp0_;
1102 const gchar* _tmp1_;
1103 const gchar* _tmp2_;
1104 gchar* _tmp3_;
1105 gchar* result = NULL;
1106 g_return_val_if_fail (sym != NULL, NULL);
1107 _tmp0_ = vala_get_ccode_attribute (sym);
1108 _tmp1_ = vala_ccode_attribute_get_get_value_function (_tmp0_);
1109 _tmp2_ = _tmp1_;
1110 _tmp3_ = g_strdup (_tmp2_);
1111 result = _tmp3_;
1112 return result;
1113 }
1114
1115 gchar*
vala_get_ccode_set_value_function(ValaCodeNode * sym)1116 vala_get_ccode_set_value_function (ValaCodeNode* sym)
1117 {
1118 ValaCCodeAttribute* _tmp0_;
1119 const gchar* _tmp1_;
1120 const gchar* _tmp2_;
1121 gchar* _tmp3_;
1122 gchar* result = NULL;
1123 g_return_val_if_fail (sym != NULL, NULL);
1124 _tmp0_ = vala_get_ccode_attribute (sym);
1125 _tmp1_ = vala_ccode_attribute_get_set_value_function (_tmp0_);
1126 _tmp2_ = _tmp1_;
1127 _tmp3_ = g_strdup (_tmp2_);
1128 result = _tmp3_;
1129 return result;
1130 }
1131
1132 gchar*
vala_get_ccode_take_value_function(ValaCodeNode * sym)1133 vala_get_ccode_take_value_function (ValaCodeNode* sym)
1134 {
1135 ValaCCodeAttribute* _tmp0_;
1136 const gchar* _tmp1_;
1137 const gchar* _tmp2_;
1138 gchar* _tmp3_;
1139 gchar* result = NULL;
1140 g_return_val_if_fail (sym != NULL, NULL);
1141 _tmp0_ = vala_get_ccode_attribute (sym);
1142 _tmp1_ = vala_ccode_attribute_get_take_value_function (_tmp0_);
1143 _tmp2_ = _tmp1_;
1144 _tmp3_ = g_strdup (_tmp2_);
1145 result = _tmp3_;
1146 return result;
1147 }
1148
1149 gchar*
vala_get_ccode_param_spec_function(ValaCodeNode * sym)1150 vala_get_ccode_param_spec_function (ValaCodeNode* sym)
1151 {
1152 ValaCCodeAttribute* _tmp0_;
1153 const gchar* _tmp1_;
1154 const gchar* _tmp2_;
1155 gchar* _tmp3_;
1156 gchar* result = NULL;
1157 g_return_val_if_fail (sym != NULL, NULL);
1158 _tmp0_ = vala_get_ccode_attribute (sym);
1159 _tmp1_ = vala_ccode_attribute_get_param_spec_function (_tmp0_);
1160 _tmp2_ = _tmp1_;
1161 _tmp3_ = g_strdup (_tmp2_);
1162 result = _tmp3_;
1163 return result;
1164 }
1165
1166 gchar*
vala_get_ccode_type_check_function(ValaTypeSymbol * sym)1167 vala_get_ccode_type_check_function (ValaTypeSymbol* sym)
1168 {
1169 ValaClass* cl = NULL;
1170 gchar* a = NULL;
1171 gchar* _tmp0_;
1172 gboolean _tmp1_ = FALSE;
1173 ValaClass* _tmp2_;
1174 gchar* result = NULL;
1175 g_return_val_if_fail (sym != NULL, NULL);
1176 cl = G_TYPE_CHECK_INSTANCE_TYPE (sym, VALA_TYPE_CLASS) ? ((ValaClass*) sym) : NULL;
1177 _tmp0_ = vala_code_node_get_attribute_string ((ValaCodeNode*) sym, "CCode", "type_check_function", NULL);
1178 a = _tmp0_;
1179 _tmp2_ = cl;
1180 if (_tmp2_ != NULL) {
1181 const gchar* _tmp3_;
1182 _tmp3_ = a;
1183 _tmp1_ = _tmp3_ != NULL;
1184 } else {
1185 _tmp1_ = FALSE;
1186 }
1187 if (_tmp1_) {
1188 result = a;
1189 return result;
1190 } else {
1191 gboolean _tmp4_ = FALSE;
1192 gboolean _tmp5_ = FALSE;
1193 gboolean _tmp6_ = FALSE;
1194 gboolean _tmp7_ = FALSE;
1195 ValaClass* _tmp8_;
1196 _tmp8_ = cl;
1197 if (_tmp8_ != NULL) {
1198 ValaClass* _tmp9_;
1199 gboolean _tmp10_;
1200 gboolean _tmp11_;
1201 _tmp9_ = cl;
1202 _tmp10_ = vala_class_get_is_compact (_tmp9_);
1203 _tmp11_ = _tmp10_;
1204 _tmp7_ = _tmp11_;
1205 } else {
1206 _tmp7_ = FALSE;
1207 }
1208 if (_tmp7_) {
1209 _tmp6_ = TRUE;
1210 } else {
1211 _tmp6_ = G_TYPE_CHECK_INSTANCE_TYPE (sym, VALA_TYPE_STRUCT);
1212 }
1213 if (_tmp6_) {
1214 _tmp5_ = TRUE;
1215 } else {
1216 _tmp5_ = G_TYPE_CHECK_INSTANCE_TYPE (sym, VALA_TYPE_ENUM);
1217 }
1218 if (_tmp5_) {
1219 _tmp4_ = TRUE;
1220 } else {
1221 _tmp4_ = G_TYPE_CHECK_INSTANCE_TYPE (sym, VALA_TYPE_DELEGATE);
1222 }
1223 if (_tmp4_) {
1224 gchar* _tmp12_;
1225 _tmp12_ = g_strdup ("");
1226 result = _tmp12_;
1227 _g_free0 (a);
1228 return result;
1229 } else {
1230 gchar* _tmp13_;
1231 _tmp13_ = vala_get_ccode_upper_case_name ((ValaSymbol*) sym, "IS_");
1232 result = _tmp13_;
1233 _g_free0 (a);
1234 return result;
1235 }
1236 }
1237 _g_free0 (a);
1238 }
1239
1240 gchar*
vala_get_ccode_class_type_check_function(ValaClass * cl)1241 vala_get_ccode_class_type_check_function (ValaClass* cl)
1242 {
1243 gboolean _tmp0_;
1244 gboolean _tmp1_;
1245 gchar* _tmp2_;
1246 gchar* _tmp3_;
1247 gchar* _tmp4_;
1248 gchar* _tmp5_;
1249 gchar* result = NULL;
1250 g_return_val_if_fail (cl != NULL, NULL);
1251 _tmp0_ = vala_class_get_is_compact (cl);
1252 _tmp1_ = _tmp0_;
1253 _vala_assert (!_tmp1_, "!cl.is_compact");
1254 _tmp2_ = vala_get_ccode_type_check_function ((ValaTypeSymbol*) cl);
1255 _tmp3_ = _tmp2_;
1256 _tmp4_ = g_strdup_printf ("%s_CLASS", _tmp3_);
1257 _tmp5_ = _tmp4_;
1258 _g_free0 (_tmp3_);
1259 result = _tmp5_;
1260 return result;
1261 }
1262
1263 gchar*
vala_get_ccode_default_value(ValaTypeSymbol * sym)1264 vala_get_ccode_default_value (ValaTypeSymbol* sym)
1265 {
1266 ValaCCodeAttribute* _tmp0_;
1267 const gchar* _tmp1_;
1268 const gchar* _tmp2_;
1269 gchar* _tmp3_;
1270 gchar* result = NULL;
1271 g_return_val_if_fail (sym != NULL, NULL);
1272 _tmp0_ = vala_get_ccode_attribute ((ValaCodeNode*) sym);
1273 _tmp1_ = vala_ccode_attribute_get_default_value (_tmp0_);
1274 _tmp2_ = _tmp1_;
1275 _tmp3_ = g_strdup (_tmp2_);
1276 result = _tmp3_;
1277 return result;
1278 }
1279
1280 gchar*
vala_get_ccode_default_value_on_error(ValaTypeSymbol * sym)1281 vala_get_ccode_default_value_on_error (ValaTypeSymbol* sym)
1282 {
1283 ValaCCodeAttribute* _tmp0_;
1284 const gchar* _tmp1_;
1285 const gchar* _tmp2_;
1286 gchar* _tmp3_;
1287 gchar* result = NULL;
1288 g_return_val_if_fail (sym != NULL, NULL);
1289 _tmp0_ = vala_get_ccode_attribute ((ValaCodeNode*) sym);
1290 _tmp1_ = vala_ccode_attribute_get_default_value_on_error (_tmp0_);
1291 _tmp2_ = _tmp1_;
1292 _tmp3_ = g_strdup (_tmp2_);
1293 result = _tmp3_;
1294 return result;
1295 }
1296
1297 gboolean
vala_get_ccode_has_copy_function(ValaStruct * st)1298 vala_get_ccode_has_copy_function (ValaStruct* st)
1299 {
1300 gboolean result = FALSE;
1301 g_return_val_if_fail (st != NULL, FALSE);
1302 result = vala_code_node_get_attribute_bool ((ValaCodeNode*) st, "CCode", "has_copy_function", TRUE);
1303 return result;
1304 }
1305
1306 gboolean
vala_get_ccode_has_destroy_function(ValaStruct * st)1307 vala_get_ccode_has_destroy_function (ValaStruct* st)
1308 {
1309 gboolean result = FALSE;
1310 g_return_val_if_fail (st != NULL, FALSE);
1311 result = vala_code_node_get_attribute_bool ((ValaCodeNode*) st, "CCode", "has_destroy_function", TRUE);
1312 return result;
1313 }
1314
1315 gdouble
vala_get_ccode_instance_pos(ValaCodeNode * node)1316 vala_get_ccode_instance_pos (ValaCodeNode* node)
1317 {
1318 gdouble result = 0.0;
1319 g_return_val_if_fail (node != NULL, 0.0);
1320 if (G_TYPE_CHECK_INSTANCE_TYPE (node, VALA_TYPE_DELEGATE)) {
1321 result = vala_code_node_get_attribute_double (node, "CCode", "instance_pos", (gdouble) -2);
1322 return result;
1323 } else {
1324 result = vala_code_node_get_attribute_double (node, "CCode", "instance_pos", (gdouble) 0);
1325 return result;
1326 }
1327 }
1328
1329 gdouble
vala_get_ccode_error_pos(ValaCallable * c)1330 vala_get_ccode_error_pos (ValaCallable* c)
1331 {
1332 gdouble result = 0.0;
1333 g_return_val_if_fail (c != NULL, 0.0);
1334 result = vala_code_node_get_attribute_double ((ValaCodeNode*) c, "CCode", "error_pos", (gdouble) -1);
1335 return result;
1336 }
1337
1338 gboolean
vala_get_ccode_array_length(ValaCodeNode * node)1339 vala_get_ccode_array_length (ValaCodeNode* node)
1340 {
1341 ValaCCodeAttribute* _tmp0_;
1342 gboolean _tmp1_;
1343 gboolean _tmp2_;
1344 gboolean result = FALSE;
1345 g_return_val_if_fail (node != NULL, FALSE);
1346 _tmp0_ = vala_get_ccode_attribute (node);
1347 _tmp1_ = vala_ccode_attribute_get_array_length (_tmp0_);
1348 _tmp2_ = _tmp1_;
1349 result = _tmp2_;
1350 return result;
1351 }
1352
1353 gchar*
vala_get_ccode_array_length_type(ValaCodeNode * node)1354 vala_get_ccode_array_length_type (ValaCodeNode* node)
1355 {
1356 gchar* result = NULL;
1357 g_return_val_if_fail (node != NULL, NULL);
1358 if (G_TYPE_CHECK_INSTANCE_TYPE (node, VALA_TYPE_ARRAY_TYPE)) {
1359 ValaDataType* _tmp0_;
1360 ValaDataType* _tmp1_;
1361 gchar* _tmp2_;
1362 _tmp0_ = vala_array_type_get_length_type (G_TYPE_CHECK_INSTANCE_CAST (node, VALA_TYPE_ARRAY_TYPE, ValaArrayType));
1363 _tmp1_ = _tmp0_;
1364 _tmp2_ = vala_get_ccode_name ((ValaCodeNode*) _tmp1_);
1365 result = _tmp2_;
1366 return result;
1367 } else {
1368 if (G_TYPE_CHECK_INSTANCE_TYPE (node, VALA_TYPE_DATA_TYPE)) {
1369 ValaSourceReference* _tmp3_;
1370 ValaSourceReference* _tmp4_;
1371 gchar* _tmp5_;
1372 _tmp3_ = vala_code_node_get_source_reference (node);
1373 _tmp4_ = _tmp3_;
1374 vala_report_error (_tmp4_, "`CCode.array_length_type' not supported");
1375 _tmp5_ = g_strdup ("");
1376 result = _tmp5_;
1377 return result;
1378 } else {
1379 gboolean _tmp6_ = FALSE;
1380 gboolean _tmp7_ = FALSE;
1381 gboolean _tmp8_ = FALSE;
1382 gboolean _tmp9_ = FALSE;
1383 ValaCCodeAttribute* _tmp10_;
1384 const gchar* _tmp11_;
1385 const gchar* _tmp12_;
1386 gchar* _tmp13_;
1387 if (G_TYPE_CHECK_INSTANCE_TYPE (node, VALA_TYPE_METHOD)) {
1388 _tmp9_ = TRUE;
1389 } else {
1390 _tmp9_ = G_TYPE_CHECK_INSTANCE_TYPE (node, VALA_TYPE_PARAMETER);
1391 }
1392 if (_tmp9_) {
1393 _tmp8_ = TRUE;
1394 } else {
1395 _tmp8_ = G_TYPE_CHECK_INSTANCE_TYPE (node, VALA_TYPE_DELEGATE);
1396 }
1397 if (_tmp8_) {
1398 _tmp7_ = TRUE;
1399 } else {
1400 _tmp7_ = G_TYPE_CHECK_INSTANCE_TYPE (node, VALA_TYPE_PROPERTY);
1401 }
1402 if (_tmp7_) {
1403 _tmp6_ = TRUE;
1404 } else {
1405 _tmp6_ = G_TYPE_CHECK_INSTANCE_TYPE (node, VALA_TYPE_FIELD);
1406 }
1407 _vala_assert (_tmp6_, "node is Method || node is Parameter || node is Delegate || node is Property || node is Field");
1408 _tmp10_ = vala_get_ccode_attribute (node);
1409 _tmp11_ = vala_ccode_attribute_get_array_length_type (_tmp10_);
1410 _tmp12_ = _tmp11_;
1411 _tmp13_ = g_strdup (_tmp12_);
1412 result = _tmp13_;
1413 return result;
1414 }
1415 }
1416 }
1417
1418 gboolean
vala_get_ccode_array_null_terminated(ValaCodeNode * node)1419 vala_get_ccode_array_null_terminated (ValaCodeNode* node)
1420 {
1421 ValaCCodeAttribute* _tmp0_;
1422 gboolean _tmp1_;
1423 gboolean _tmp2_;
1424 gboolean result = FALSE;
1425 g_return_val_if_fail (node != NULL, FALSE);
1426 _tmp0_ = vala_get_ccode_attribute (node);
1427 _tmp1_ = vala_ccode_attribute_get_array_null_terminated (_tmp0_);
1428 _tmp2_ = _tmp1_;
1429 result = _tmp2_;
1430 return result;
1431 }
1432
1433 gchar*
vala_get_ccode_array_length_name(ValaCodeNode * node)1434 vala_get_ccode_array_length_name (ValaCodeNode* node)
1435 {
1436 ValaCCodeAttribute* _tmp0_;
1437 const gchar* _tmp1_;
1438 const gchar* _tmp2_;
1439 gchar* _tmp3_;
1440 gchar* result = NULL;
1441 g_return_val_if_fail (node != NULL, NULL);
1442 _tmp0_ = vala_get_ccode_attribute (node);
1443 _tmp1_ = vala_ccode_attribute_get_array_length_name (_tmp0_);
1444 _tmp2_ = _tmp1_;
1445 _tmp3_ = g_strdup (_tmp2_);
1446 result = _tmp3_;
1447 return result;
1448 }
1449
1450 gchar*
vala_get_ccode_array_length_expr(ValaCodeNode * node)1451 vala_get_ccode_array_length_expr (ValaCodeNode* node)
1452 {
1453 ValaCCodeAttribute* _tmp0_;
1454 const gchar* _tmp1_;
1455 const gchar* _tmp2_;
1456 gchar* _tmp3_;
1457 gchar* result = NULL;
1458 g_return_val_if_fail (node != NULL, NULL);
1459 _tmp0_ = vala_get_ccode_attribute (node);
1460 _tmp1_ = vala_ccode_attribute_get_array_length_expr (_tmp0_);
1461 _tmp2_ = _tmp1_;
1462 _tmp3_ = g_strdup (_tmp2_);
1463 result = _tmp3_;
1464 return result;
1465 }
1466
1467 static gpointer
_vala_code_node_ref0(gpointer self)1468 _vala_code_node_ref0 (gpointer self)
1469 {
1470 return self ? vala_code_node_ref (self) : NULL;
1471 }
1472
1473 gdouble
vala_get_ccode_array_length_pos(ValaCodeNode * node)1474 vala_get_ccode_array_length_pos (ValaCodeNode* node)
1475 {
1476 ValaAttribute* a = NULL;
1477 ValaAttribute* _tmp0_;
1478 ValaAttribute* _tmp1_;
1479 gboolean _tmp2_ = FALSE;
1480 ValaAttribute* _tmp3_;
1481 gdouble result = 0.0;
1482 g_return_val_if_fail (node != NULL, 0.0);
1483 _tmp0_ = vala_code_node_get_attribute (node, "CCode");
1484 _tmp1_ = _vala_code_node_ref0 (_tmp0_);
1485 a = _tmp1_;
1486 _tmp3_ = a;
1487 if (_tmp3_ != NULL) {
1488 ValaAttribute* _tmp4_;
1489 _tmp4_ = a;
1490 _tmp2_ = vala_attribute_has_argument (_tmp4_, "array_length_pos");
1491 } else {
1492 _tmp2_ = FALSE;
1493 }
1494 if (_tmp2_) {
1495 ValaAttribute* _tmp5_;
1496 _tmp5_ = a;
1497 result = vala_attribute_get_double (_tmp5_, "array_length_pos", (gdouble) 0);
1498 _vala_code_node_unref0 (a);
1499 return result;
1500 }
1501 if (G_TYPE_CHECK_INSTANCE_TYPE (node, VALA_TYPE_PARAMETER)) {
1502 ValaParameter* param = NULL;
1503 ValaParameter* _tmp6_;
1504 param = G_TYPE_CHECK_INSTANCE_CAST (node, VALA_TYPE_PARAMETER, ValaParameter);
1505 _tmp6_ = param;
1506 result = vala_get_ccode_pos (_tmp6_) + 0.1;
1507 _vala_code_node_unref0 (a);
1508 return result;
1509 } else {
1510 result = (gdouble) -3;
1511 _vala_code_node_unref0 (a);
1512 return result;
1513 }
1514 _vala_code_node_unref0 (a);
1515 }
1516
1517 gdouble
vala_get_ccode_delegate_target_pos(ValaCodeNode * node)1518 vala_get_ccode_delegate_target_pos (ValaCodeNode* node)
1519 {
1520 ValaAttribute* a = NULL;
1521 ValaAttribute* _tmp0_;
1522 ValaAttribute* _tmp1_;
1523 gboolean _tmp2_ = FALSE;
1524 ValaAttribute* _tmp3_;
1525 gdouble result = 0.0;
1526 g_return_val_if_fail (node != NULL, 0.0);
1527 _tmp0_ = vala_code_node_get_attribute (node, "CCode");
1528 _tmp1_ = _vala_code_node_ref0 (_tmp0_);
1529 a = _tmp1_;
1530 _tmp3_ = a;
1531 if (_tmp3_ != NULL) {
1532 ValaAttribute* _tmp4_;
1533 _tmp4_ = a;
1534 _tmp2_ = vala_attribute_has_argument (_tmp4_, "delegate_target_pos");
1535 } else {
1536 _tmp2_ = FALSE;
1537 }
1538 if (_tmp2_) {
1539 ValaAttribute* _tmp5_;
1540 _tmp5_ = a;
1541 result = vala_attribute_get_double (_tmp5_, "delegate_target_pos", (gdouble) 0);
1542 _vala_code_node_unref0 (a);
1543 return result;
1544 }
1545 if (G_TYPE_CHECK_INSTANCE_TYPE (node, VALA_TYPE_PARAMETER)) {
1546 ValaParameter* param = NULL;
1547 ValaParameter* _tmp6_;
1548 param = G_TYPE_CHECK_INSTANCE_CAST (node, VALA_TYPE_PARAMETER, ValaParameter);
1549 _tmp6_ = param;
1550 result = vala_get_ccode_pos (_tmp6_) + 0.1;
1551 _vala_code_node_unref0 (a);
1552 return result;
1553 } else {
1554 result = (gdouble) -3;
1555 _vala_code_node_unref0 (a);
1556 return result;
1557 }
1558 _vala_code_node_unref0 (a);
1559 }
1560
1561 gdouble
vala_get_ccode_destroy_notify_pos(ValaCodeNode * node)1562 vala_get_ccode_destroy_notify_pos (ValaCodeNode* node)
1563 {
1564 ValaAttribute* a = NULL;
1565 ValaAttribute* _tmp0_;
1566 ValaAttribute* _tmp1_;
1567 gboolean _tmp2_ = FALSE;
1568 ValaAttribute* _tmp3_;
1569 gdouble result = 0.0;
1570 g_return_val_if_fail (node != NULL, 0.0);
1571 _tmp0_ = vala_code_node_get_attribute (node, "CCode");
1572 _tmp1_ = _vala_code_node_ref0 (_tmp0_);
1573 a = _tmp1_;
1574 _tmp3_ = a;
1575 if (_tmp3_ != NULL) {
1576 ValaAttribute* _tmp4_;
1577 _tmp4_ = a;
1578 _tmp2_ = vala_attribute_has_argument (_tmp4_, "destroy_notify_pos");
1579 } else {
1580 _tmp2_ = FALSE;
1581 }
1582 if (_tmp2_) {
1583 ValaAttribute* _tmp5_;
1584 _tmp5_ = a;
1585 result = vala_attribute_get_double (_tmp5_, "destroy_notify_pos", (gdouble) 0);
1586 _vala_code_node_unref0 (a);
1587 return result;
1588 }
1589 result = vala_get_ccode_delegate_target_pos (node) + 0.01;
1590 _vala_code_node_unref0 (a);
1591 return result;
1592 }
1593
1594 gboolean
vala_get_ccode_delegate_target(ValaCodeNode * node)1595 vala_get_ccode_delegate_target (ValaCodeNode* node)
1596 {
1597 ValaCCodeAttribute* _tmp0_;
1598 gboolean _tmp1_;
1599 gboolean _tmp2_;
1600 gboolean result = FALSE;
1601 g_return_val_if_fail (node != NULL, FALSE);
1602 _tmp0_ = vala_get_ccode_attribute (node);
1603 _tmp1_ = vala_ccode_attribute_get_delegate_target (_tmp0_);
1604 _tmp2_ = _tmp1_;
1605 result = _tmp2_;
1606 return result;
1607 }
1608
1609 gchar*
vala_get_ccode_delegate_target_name(ValaVariable * variable)1610 vala_get_ccode_delegate_target_name (ValaVariable* variable)
1611 {
1612 ValaCCodeAttribute* _tmp0_;
1613 const gchar* _tmp1_;
1614 const gchar* _tmp2_;
1615 gchar* _tmp3_;
1616 gchar* result = NULL;
1617 g_return_val_if_fail (variable != NULL, NULL);
1618 _tmp0_ = vala_get_ccode_attribute ((ValaCodeNode*) variable);
1619 _tmp1_ = vala_ccode_attribute_get_delegate_target_name (_tmp0_);
1620 _tmp2_ = _tmp1_;
1621 _tmp3_ = g_strdup (_tmp2_);
1622 result = _tmp3_;
1623 return result;
1624 }
1625
1626 gchar*
vala_get_ccode_delegate_target_destroy_notify_name(ValaVariable * variable)1627 vala_get_ccode_delegate_target_destroy_notify_name (ValaVariable* variable)
1628 {
1629 ValaCCodeAttribute* _tmp0_;
1630 const gchar* _tmp1_;
1631 const gchar* _tmp2_;
1632 gchar* _tmp3_;
1633 gchar* result = NULL;
1634 g_return_val_if_fail (variable != NULL, NULL);
1635 _tmp0_ = vala_get_ccode_attribute ((ValaCodeNode*) variable);
1636 _tmp1_ = vala_ccode_attribute_get_delegate_target_destroy_notify_name (_tmp0_);
1637 _tmp2_ = _tmp1_;
1638 _tmp3_ = g_strdup (_tmp2_);
1639 result = _tmp3_;
1640 return result;
1641 }
1642
1643 gdouble
vala_get_ccode_pos(ValaParameter * param)1644 vala_get_ccode_pos (ValaParameter* param)
1645 {
1646 ValaCCodeAttribute* _tmp0_;
1647 gdouble _tmp1_;
1648 gdouble _tmp2_;
1649 gdouble result = 0.0;
1650 g_return_val_if_fail (param != NULL, 0.0);
1651 _tmp0_ = vala_get_ccode_attribute ((ValaCodeNode*) param);
1652 _tmp1_ = vala_ccode_attribute_get_pos (_tmp0_);
1653 _tmp2_ = _tmp1_;
1654 result = _tmp2_;
1655 return result;
1656 }
1657
1658 gchar*
vala_get_ccode_type(ValaCodeNode * node)1659 vala_get_ccode_type (ValaCodeNode* node)
1660 {
1661 ValaCCodeAttribute* _tmp0_;
1662 const gchar* _tmp1_;
1663 const gchar* _tmp2_;
1664 gchar* _tmp3_;
1665 gchar* result = NULL;
1666 g_return_val_if_fail (node != NULL, NULL);
1667 _tmp0_ = vala_get_ccode_attribute (node);
1668 _tmp1_ = vala_ccode_attribute_get_ctype (_tmp0_);
1669 _tmp2_ = _tmp1_;
1670 _tmp3_ = g_strdup (_tmp2_);
1671 result = _tmp3_;
1672 return result;
1673 }
1674
1675 gboolean
vala_get_ccode_simple_generics(ValaMethod * m)1676 vala_get_ccode_simple_generics (ValaMethod* m)
1677 {
1678 gboolean result = FALSE;
1679 g_return_val_if_fail (m != NULL, FALSE);
1680 result = vala_code_node_get_attribute_bool ((ValaCodeNode*) m, "CCode", "simple_generics", FALSE);
1681 return result;
1682 }
1683
1684 gchar*
vala_get_ccode_real_name(ValaSymbol * sym)1685 vala_get_ccode_real_name (ValaSymbol* sym)
1686 {
1687 ValaCCodeAttribute* _tmp0_;
1688 const gchar* _tmp1_;
1689 const gchar* _tmp2_;
1690 gchar* _tmp3_;
1691 gchar* result = NULL;
1692 g_return_val_if_fail (sym != NULL, NULL);
1693 _tmp0_ = vala_get_ccode_attribute ((ValaCodeNode*) sym);
1694 _tmp1_ = vala_ccode_attribute_get_real_name (_tmp0_);
1695 _tmp2_ = _tmp1_;
1696 _tmp3_ = g_strdup (_tmp2_);
1697 result = _tmp3_;
1698 return result;
1699 }
1700
1701 gchar*
vala_get_ccode_constructv_name(ValaCreationMethod * m)1702 vala_get_ccode_constructv_name (ValaCreationMethod* m)
1703 {
1704 static const char infix[] = "constructv";
1705 ValaClass* parent = NULL;
1706 ValaSymbol* _tmp0_;
1707 ValaSymbol* _tmp1_;
1708 const gchar* _tmp2_;
1709 const gchar* _tmp3_;
1710 gchar* result = NULL;
1711 g_return_val_if_fail (m != NULL, NULL);
1712 _tmp0_ = vala_symbol_get_parent_symbol ((ValaSymbol*) m);
1713 _tmp1_ = _tmp0_;
1714 parent = G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, VALA_TYPE_CLASS, ValaClass);
1715 _tmp2_ = vala_symbol_get_name ((ValaSymbol*) m);
1716 _tmp3_ = _tmp2_;
1717 if (g_strcmp0 (_tmp3_, ".new") == 0) {
1718 ValaClass* _tmp4_;
1719 gchar* _tmp5_;
1720 gchar* _tmp6_;
1721 gchar* _tmp7_;
1722 gchar* _tmp8_;
1723 _tmp4_ = parent;
1724 _tmp5_ = vala_get_ccode_lower_case_prefix ((ValaSymbol*) _tmp4_);
1725 _tmp6_ = _tmp5_;
1726 _tmp7_ = g_strdup_printf ("%s%s", _tmp6_, infix);
1727 _tmp8_ = _tmp7_;
1728 _g_free0 (_tmp6_);
1729 result = _tmp8_;
1730 return result;
1731 } else {
1732 ValaClass* _tmp9_;
1733 gchar* _tmp10_;
1734 gchar* _tmp11_;
1735 const gchar* _tmp12_;
1736 const gchar* _tmp13_;
1737 gchar* _tmp14_;
1738 gchar* _tmp15_;
1739 _tmp9_ = parent;
1740 _tmp10_ = vala_get_ccode_lower_case_prefix ((ValaSymbol*) _tmp9_);
1741 _tmp11_ = _tmp10_;
1742 _tmp12_ = vala_symbol_get_name ((ValaSymbol*) m);
1743 _tmp13_ = _tmp12_;
1744 _tmp14_ = g_strdup_printf ("%s%s_%s", _tmp11_, infix, _tmp13_);
1745 _tmp15_ = _tmp14_;
1746 _g_free0 (_tmp11_);
1747 result = _tmp15_;
1748 return result;
1749 }
1750 }
1751
1752 gchar*
vala_get_ccode_vfunc_name(ValaMethod * m)1753 vala_get_ccode_vfunc_name (ValaMethod* m)
1754 {
1755 ValaCCodeAttribute* _tmp0_;
1756 const gchar* _tmp1_;
1757 const gchar* _tmp2_;
1758 gchar* _tmp3_;
1759 gchar* result = NULL;
1760 g_return_val_if_fail (m != NULL, NULL);
1761 _tmp0_ = vala_get_ccode_attribute ((ValaCodeNode*) m);
1762 _tmp1_ = vala_ccode_attribute_get_vfunc_name (_tmp0_);
1763 _tmp2_ = _tmp1_;
1764 _tmp3_ = g_strdup (_tmp2_);
1765 result = _tmp3_;
1766 return result;
1767 }
1768
1769 gdouble
vala_get_ccode_async_result_pos(ValaMethod * m)1770 vala_get_ccode_async_result_pos (ValaMethod* m)
1771 {
1772 gboolean _tmp0_;
1773 gboolean _tmp1_;
1774 gdouble result = 0.0;
1775 g_return_val_if_fail (m != NULL, 0.0);
1776 _tmp0_ = vala_method_get_coroutine (m);
1777 _tmp1_ = _tmp0_;
1778 _vala_assert (_tmp1_, "m.coroutine");
1779 result = vala_code_node_get_attribute_double ((ValaCodeNode*) m, "CCode", "async_result_pos", 0.1);
1780 return result;
1781 }
1782
1783 gchar*
vala_get_ccode_finish_name(ValaMethod * m)1784 vala_get_ccode_finish_name (ValaMethod* m)
1785 {
1786 gboolean _tmp0_;
1787 gboolean _tmp1_;
1788 ValaCCodeAttribute* _tmp2_;
1789 const gchar* _tmp3_;
1790 const gchar* _tmp4_;
1791 gchar* _tmp5_;
1792 gchar* result = NULL;
1793 g_return_val_if_fail (m != NULL, NULL);
1794 _tmp0_ = vala_method_get_coroutine (m);
1795 _tmp1_ = _tmp0_;
1796 _vala_assert (_tmp1_, "m.coroutine");
1797 _tmp2_ = vala_get_ccode_attribute ((ValaCodeNode*) m);
1798 _tmp3_ = vala_ccode_attribute_get_finish_name (_tmp2_);
1799 _tmp4_ = _tmp3_;
1800 _tmp5_ = g_strdup (_tmp4_);
1801 result = _tmp5_;
1802 return result;
1803 }
1804
1805 gchar*
vala_get_ccode_finish_vfunc_name(ValaMethod * m)1806 vala_get_ccode_finish_vfunc_name (ValaMethod* m)
1807 {
1808 gboolean _tmp0_;
1809 gboolean _tmp1_;
1810 ValaCCodeAttribute* _tmp2_;
1811 const gchar* _tmp3_;
1812 const gchar* _tmp4_;
1813 gchar* _tmp5_;
1814 gchar* result = NULL;
1815 g_return_val_if_fail (m != NULL, NULL);
1816 _tmp0_ = vala_method_get_coroutine (m);
1817 _tmp1_ = _tmp0_;
1818 _vala_assert (_tmp1_, "m.coroutine");
1819 _tmp2_ = vala_get_ccode_attribute ((ValaCodeNode*) m);
1820 _tmp3_ = vala_ccode_attribute_get_finish_vfunc_name (_tmp2_);
1821 _tmp4_ = _tmp3_;
1822 _tmp5_ = g_strdup (_tmp4_);
1823 result = _tmp5_;
1824 return result;
1825 }
1826
1827 gchar*
vala_get_ccode_finish_real_name(ValaMethod * m)1828 vala_get_ccode_finish_real_name (ValaMethod* m)
1829 {
1830 gboolean _tmp0_;
1831 gboolean _tmp1_;
1832 ValaCCodeAttribute* _tmp2_;
1833 const gchar* _tmp3_;
1834 const gchar* _tmp4_;
1835 gchar* _tmp5_;
1836 gchar* result = NULL;
1837 g_return_val_if_fail (m != NULL, NULL);
1838 _tmp0_ = vala_method_get_coroutine (m);
1839 _tmp1_ = _tmp0_;
1840 _vala_assert (_tmp1_, "m.coroutine");
1841 _tmp2_ = vala_get_ccode_attribute ((ValaCodeNode*) m);
1842 _tmp3_ = vala_ccode_attribute_get_finish_real_name (_tmp2_);
1843 _tmp4_ = _tmp3_;
1844 _tmp5_ = g_strdup (_tmp4_);
1845 result = _tmp5_;
1846 return result;
1847 }
1848
1849 gboolean
vala_get_ccode_no_accessor_method(ValaProperty * p)1850 vala_get_ccode_no_accessor_method (ValaProperty* p)
1851 {
1852 ValaAttribute* _tmp0_;
1853 gboolean result = FALSE;
1854 g_return_val_if_fail (p != NULL, FALSE);
1855 _tmp0_ = vala_code_node_get_attribute ((ValaCodeNode*) p, "NoAccessorMethod");
1856 result = _tmp0_ != NULL;
1857 return result;
1858 }
1859
1860 gboolean
vala_get_ccode_concrete_accessor(ValaProperty * p)1861 vala_get_ccode_concrete_accessor (ValaProperty* p)
1862 {
1863 ValaAttribute* _tmp0_;
1864 gboolean result = FALSE;
1865 g_return_val_if_fail (p != NULL, FALSE);
1866 _tmp0_ = vala_code_node_get_attribute ((ValaCodeNode*) p, "ConcreteAccessor");
1867 result = _tmp0_ != NULL;
1868 return result;
1869 }
1870
1871 gboolean
vala_get_ccode_has_emitter(ValaSignal * sig)1872 vala_get_ccode_has_emitter (ValaSignal* sig)
1873 {
1874 ValaAttribute* _tmp0_;
1875 gboolean result = FALSE;
1876 g_return_val_if_fail (sig != NULL, FALSE);
1877 _tmp0_ = vala_code_node_get_attribute ((ValaCodeNode*) sig, "HasEmitter");
1878 result = _tmp0_ != NULL;
1879 return result;
1880 }
1881
1882 gboolean
vala_get_ccode_has_type_id(ValaTypeSymbol * sym)1883 vala_get_ccode_has_type_id (ValaTypeSymbol* sym)
1884 {
1885 gboolean result = FALSE;
1886 g_return_val_if_fail (sym != NULL, FALSE);
1887 result = vala_code_node_get_attribute_bool ((ValaCodeNode*) sym, "CCode", "has_type_id", TRUE);
1888 return result;
1889 }
1890
1891 gboolean
vala_get_ccode_has_new_function(ValaMethod * m)1892 vala_get_ccode_has_new_function (ValaMethod* m)
1893 {
1894 gboolean result = FALSE;
1895 g_return_val_if_fail (m != NULL, FALSE);
1896 result = vala_code_node_get_attribute_bool ((ValaCodeNode*) m, "CCode", "has_new_function", TRUE);
1897 return result;
1898 }
1899
1900 gboolean
vala_get_ccode_has_generic_type_parameter(ValaMethod * m)1901 vala_get_ccode_has_generic_type_parameter (ValaMethod* m)
1902 {
1903 ValaAttribute* a = NULL;
1904 ValaAttribute* _tmp0_;
1905 ValaAttribute* _tmp1_;
1906 gboolean _tmp2_ = FALSE;
1907 ValaAttribute* _tmp3_;
1908 gboolean result = FALSE;
1909 g_return_val_if_fail (m != NULL, FALSE);
1910 _tmp0_ = vala_code_node_get_attribute ((ValaCodeNode*) m, "CCode");
1911 _tmp1_ = _vala_code_node_ref0 (_tmp0_);
1912 a = _tmp1_;
1913 _tmp3_ = a;
1914 if (_tmp3_ != NULL) {
1915 ValaAttribute* _tmp4_;
1916 _tmp4_ = a;
1917 _tmp2_ = vala_attribute_has_argument (_tmp4_, "generic_type_pos");
1918 } else {
1919 _tmp2_ = FALSE;
1920 }
1921 result = _tmp2_;
1922 _vala_code_node_unref0 (a);
1923 return result;
1924 }
1925
1926 gdouble
vala_get_ccode_generic_type_pos(ValaMethod * m)1927 vala_get_ccode_generic_type_pos (ValaMethod* m)
1928 {
1929 gdouble result = 0.0;
1930 g_return_val_if_fail (m != NULL, 0.0);
1931 result = vala_code_node_get_attribute_double ((ValaCodeNode*) m, "CCode", "generic_type_pos", (gdouble) 0);
1932 return result;
1933 }
1934
1935 gboolean
vala_get_ccode_no_wrapper(ValaMethod * m)1936 vala_get_ccode_no_wrapper (ValaMethod* m)
1937 {
1938 ValaAttribute* _tmp0_;
1939 gboolean result = FALSE;
1940 g_return_val_if_fail (m != NULL, FALSE);
1941 _tmp0_ = vala_code_node_get_attribute ((ValaCodeNode*) m, "NoWrapper");
1942 result = _tmp0_ != NULL;
1943 return result;
1944 }
1945
1946 gchar*
vala_get_ccode_sentinel(ValaMethod * m)1947 vala_get_ccode_sentinel (ValaMethod* m)
1948 {
1949 ValaCCodeAttribute* _tmp0_;
1950 const gchar* _tmp1_;
1951 const gchar* _tmp2_;
1952 gchar* _tmp3_;
1953 gchar* result = NULL;
1954 g_return_val_if_fail (m != NULL, NULL);
1955 _tmp0_ = vala_get_ccode_attribute ((ValaCodeNode*) m);
1956 _tmp1_ = vala_ccode_attribute_get_sentinel (_tmp0_);
1957 _tmp2_ = _tmp1_;
1958 _tmp3_ = g_strdup (_tmp2_);
1959 result = _tmp3_;
1960 return result;
1961 }
1962
1963