1 /* valagvaluemodule.c generated by valac, the Vala compiler
2  * generated from valagvaluemodule.vala, do not modify */
3 
4 /* valagvaluemodule.vala
5  *
6  * Copyright (C) 2019  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 "valacodegen.h"
27 #include <vala.h>
28 #include <valaccode.h>
29 #include <glib.h>
30 #include <valagee.h>
31 #include <glib-object.h>
32 
33 #define _g_free0(var) (var = (g_free (var), NULL))
34 #define _vala_ccode_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_ccode_node_unref (var), NULL)))
35 #define _vala_target_value_unref0(var) ((var == NULL) ? NULL : (var = (vala_target_value_unref (var), NULL)))
36 #define _vala_code_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_node_unref (var), NULL)))
37 
38 static gpointer vala_gvalue_module_parent_class = NULL;
39 
40 static void vala_gvalue_module_real_visit_cast_expression (ValaCodeVisitor* base,
41                                                     ValaCastExpression* expr);
42 static ValaCCodeExpression* vala_gvalue_module_real_get_value_getter_function (ValaCCodeBaseModule* base,
43                                                                         ValaDataType* type_reference);
44 static ValaCCodeExpression* vala_gvalue_module_real_get_value_setter_function (ValaCCodeBaseModule* base,
45                                                                         ValaDataType* type_reference);
46 static ValaCCodeExpression* vala_gvalue_module_real_get_value_taker_function (ValaCCodeBaseModule* base,
47                                                                        ValaDataType* type_reference);
48 static GType vala_gvalue_module_get_type_once (void);
49 
50 static gpointer
_vala_ccode_node_ref0(gpointer self)51 _vala_ccode_node_ref0 (gpointer self)
52 {
53 	return self ? vala_ccode_node_ref (self) : NULL;
54 }
55 
56 static gpointer
_vala_code_node_ref0(gpointer self)57 _vala_code_node_ref0 (gpointer self)
58 {
59 	return self ? vala_code_node_ref (self) : NULL;
60 }
61 
62 static void
vala_gvalue_module_real_visit_cast_expression(ValaCodeVisitor * base,ValaCastExpression * expr)63 vala_gvalue_module_real_visit_cast_expression (ValaCodeVisitor* base,
64                                                ValaCastExpression* expr)
65 {
66 	ValaGValueModule * self;
67 	ValaDataType* value_type = NULL;
68 	ValaExpression* _tmp0_;
69 	ValaExpression* _tmp1_;
70 	ValaDataType* _tmp2_;
71 	ValaDataType* _tmp3_;
72 	ValaDataType* target_type = NULL;
73 	ValaDataType* _tmp4_;
74 	ValaDataType* _tmp5_;
75 	gboolean _tmp6_ = FALSE;
76 	gboolean _tmp7_ = FALSE;
77 	gboolean _tmp8_ = FALSE;
78 	gboolean _tmp9_ = FALSE;
79 	gboolean _tmp10_ = FALSE;
80 	gboolean _tmp11_;
81 	gboolean _tmp12_;
82 	ValaDataType* _tmp26_;
83 	ValaDataType* _tmp27_;
84 	ValaCCodeFile* _tmp28_;
85 	ValaCCodeFunctionCall* ccall = NULL;
86 	ValaDataType* _tmp29_;
87 	ValaCCodeExpression* _tmp30_;
88 	ValaCCodeExpression* _tmp31_;
89 	ValaCCodeFunctionCall* _tmp32_;
90 	ValaCCodeFunctionCall* _tmp33_;
91 	ValaCCodeExpression* gvalue = NULL;
92 	ValaDataType* _tmp34_;
93 	gboolean _tmp35_;
94 	gboolean _tmp36_;
95 	ValaCCodeFunctionCall* _tmp45_;
96 	ValaCCodeExpression* _tmp46_;
97 	ValaDataType* _tmp47_;
98 	ValaCCodeExpression* rv = NULL;
99 	ValaCCodeFunctionCall* _tmp66_;
100 	ValaCCodeExpression* _tmp67_;
101 	gboolean _tmp68_ = FALSE;
102 	ValaCCodeExpression* _tmp128_;
103 	self = (ValaGValueModule*) base;
104 	g_return_if_fail (expr != NULL);
105 	_tmp0_ = vala_cast_expression_get_inner (expr);
106 	_tmp1_ = _tmp0_;
107 	_tmp2_ = vala_expression_get_value_type (_tmp1_);
108 	_tmp3_ = _tmp2_;
109 	value_type = _tmp3_;
110 	_tmp4_ = vala_cast_expression_get_type_reference (expr);
111 	_tmp5_ = _tmp4_;
112 	target_type = _tmp5_;
113 	_tmp11_ = vala_cast_expression_get_is_non_null_cast (expr);
114 	_tmp12_ = _tmp11_;
115 	if (_tmp12_) {
116 		_tmp10_ = TRUE;
117 	} else {
118 		ValaDataType* _tmp13_;
119 		_tmp13_ = value_type;
120 		_tmp10_ = _tmp13_ == NULL;
121 	}
122 	if (_tmp10_) {
123 		_tmp9_ = TRUE;
124 	} else {
125 		ValaStruct* _tmp14_;
126 		_tmp14_ = ((ValaCCodeBaseModule*) self)->gvalue_type;
127 		_tmp9_ = _tmp14_ == NULL;
128 	}
129 	if (_tmp9_) {
130 		_tmp8_ = TRUE;
131 	} else {
132 		ValaDataType* _tmp15_;
133 		ValaTypeSymbol* _tmp16_;
134 		ValaTypeSymbol* _tmp17_;
135 		ValaStruct* _tmp18_;
136 		_tmp15_ = value_type;
137 		_tmp16_ = vala_data_type_get_type_symbol (_tmp15_);
138 		_tmp17_ = _tmp16_;
139 		_tmp18_ = ((ValaCCodeBaseModule*) self)->gvalue_type;
140 		_tmp8_ = _tmp17_ != G_TYPE_CHECK_INSTANCE_CAST (_tmp18_, VALA_TYPE_TYPESYMBOL, ValaTypeSymbol);
141 	}
142 	if (_tmp8_) {
143 		_tmp7_ = TRUE;
144 	} else {
145 		ValaDataType* _tmp19_;
146 		ValaTypeSymbol* _tmp20_;
147 		ValaTypeSymbol* _tmp21_;
148 		ValaStruct* _tmp22_;
149 		_tmp19_ = target_type;
150 		_tmp20_ = vala_data_type_get_type_symbol (_tmp19_);
151 		_tmp21_ = _tmp20_;
152 		_tmp22_ = ((ValaCCodeBaseModule*) self)->gvalue_type;
153 		_tmp7_ = _tmp21_ == G_TYPE_CHECK_INSTANCE_CAST (_tmp22_, VALA_TYPE_TYPESYMBOL, ValaTypeSymbol);
154 	}
155 	if (_tmp7_) {
156 		_tmp6_ = TRUE;
157 	} else {
158 		ValaDataType* _tmp23_;
159 		gchar* _tmp24_;
160 		gchar* _tmp25_;
161 		_tmp23_ = target_type;
162 		_tmp24_ = vala_get_ccode_type_id ((ValaCodeNode*) _tmp23_);
163 		_tmp25_ = _tmp24_;
164 		_tmp6_ = g_strcmp0 (_tmp25_, "") == 0;
165 		_g_free0 (_tmp25_);
166 	}
167 	if (_tmp6_) {
168 		VALA_CODE_VISITOR_CLASS (vala_gvalue_module_parent_class)->visit_cast_expression ((ValaCodeVisitor*) G_TYPE_CHECK_INSTANCE_CAST (self, VALA_TYPE_GASYNC_MODULE, ValaGAsyncModule), expr);
169 		return;
170 	}
171 	_tmp26_ = vala_cast_expression_get_type_reference (expr);
172 	_tmp27_ = _tmp26_;
173 	_tmp28_ = ((ValaCCodeBaseModule*) self)->cfile;
174 	vala_ccode_base_module_generate_type_declaration ((ValaCCodeBaseModule*) self, _tmp27_, _tmp28_);
175 	_tmp29_ = target_type;
176 	_tmp30_ = vala_ccode_base_module_get_value_getter_function ((ValaCCodeBaseModule*) self, _tmp29_);
177 	_tmp31_ = _tmp30_;
178 	_tmp32_ = vala_ccode_function_call_new (_tmp31_);
179 	_tmp33_ = _tmp32_;
180 	_vala_ccode_node_unref0 (_tmp31_);
181 	ccall = _tmp33_;
182 	_tmp34_ = value_type;
183 	_tmp35_ = vala_data_type_get_nullable (_tmp34_);
184 	_tmp36_ = _tmp35_;
185 	if (_tmp36_) {
186 		ValaExpression* _tmp37_;
187 		ValaExpression* _tmp38_;
188 		ValaCCodeExpression* _tmp39_;
189 		ValaCCodeExpression* _tmp40_;
190 		_tmp37_ = vala_cast_expression_get_inner (expr);
191 		_tmp38_ = _tmp37_;
192 		_tmp39_ = vala_get_cvalue (_tmp38_);
193 		_tmp40_ = _vala_ccode_node_ref0 (_tmp39_);
194 		_vala_ccode_node_unref0 (gvalue);
195 		gvalue = _tmp40_;
196 	} else {
197 		ValaExpression* _tmp41_;
198 		ValaExpression* _tmp42_;
199 		ValaCCodeExpression* _tmp43_;
200 		ValaCCodeUnaryExpression* _tmp44_;
201 		_tmp41_ = vala_cast_expression_get_inner (expr);
202 		_tmp42_ = _tmp41_;
203 		_tmp43_ = vala_get_cvalue (_tmp42_);
204 		_tmp44_ = vala_ccode_unary_expression_new (VALA_CCODE_UNARY_OPERATOR_ADDRESS_OF, _tmp43_);
205 		_vala_ccode_node_unref0 (gvalue);
206 		gvalue = (ValaCCodeExpression*) _tmp44_;
207 	}
208 	_tmp45_ = ccall;
209 	_tmp46_ = gvalue;
210 	vala_ccode_function_call_add_argument (_tmp45_, _tmp46_);
211 	_tmp47_ = value_type;
212 	if (vala_data_type_is_disposable (_tmp47_)) {
213 		ValaLocalVariable* temp_var = NULL;
214 		ValaDataType* _tmp48_;
215 		ValaLocalVariable* _tmp49_;
216 		ValaLocalVariable* _tmp50_;
217 		ValaCCodeExpression* temp_ref = NULL;
218 		ValaLocalVariable* _tmp51_;
219 		const gchar* _tmp52_;
220 		const gchar* _tmp53_;
221 		ValaCCodeExpression* _tmp54_;
222 		ValaCCodeFunction* _tmp55_;
223 		ValaCCodeFunction* _tmp56_;
224 		ValaCCodeExpression* _tmp57_;
225 		ValaExpression* _tmp58_;
226 		ValaExpression* _tmp59_;
227 		ValaCCodeExpression* _tmp60_;
228 		ValaArrayList* _tmp61_;
229 		ValaArrayList* _tmp62_;
230 		ValaLocalVariable* _tmp63_;
231 		ValaTargetValue* _tmp64_;
232 		ValaTargetValue* _tmp65_;
233 		_tmp48_ = value_type;
234 		_tmp49_ = vala_ccode_base_module_get_temp_variable ((ValaCCodeBaseModule*) self, _tmp48_, TRUE, (ValaCodeNode*) expr, FALSE);
235 		temp_var = _tmp49_;
236 		_tmp50_ = temp_var;
237 		vala_ccode_base_module_emit_temp_var ((ValaCCodeBaseModule*) self, _tmp50_, FALSE);
238 		_tmp51_ = temp_var;
239 		_tmp52_ = vala_symbol_get_name ((ValaSymbol*) _tmp51_);
240 		_tmp53_ = _tmp52_;
241 		_tmp54_ = vala_ccode_base_module_get_variable_cexpression ((ValaCCodeBaseModule*) self, _tmp53_);
242 		temp_ref = _tmp54_;
243 		_tmp55_ = vala_ccode_base_module_get_ccode ((ValaCCodeBaseModule*) self);
244 		_tmp56_ = _tmp55_;
245 		_tmp57_ = temp_ref;
246 		_tmp58_ = vala_cast_expression_get_inner (expr);
247 		_tmp59_ = _tmp58_;
248 		_tmp60_ = vala_get_cvalue (_tmp59_);
249 		vala_ccode_function_add_assignment (_tmp56_, _tmp57_, _tmp60_);
250 		_tmp61_ = vala_ccode_base_module_get_temp_ref_values ((ValaCCodeBaseModule*) self);
251 		_tmp62_ = _tmp61_;
252 		_tmp63_ = temp_var;
253 		_tmp64_ = vala_ccode_base_module_get_local_cvalue ((ValaCCodeBaseModule*) self, _tmp63_);
254 		_tmp65_ = _tmp64_;
255 		vala_list_insert ((ValaList*) _tmp62_, 0, _tmp65_);
256 		_vala_target_value_unref0 (_tmp65_);
257 		_vala_ccode_node_unref0 (temp_ref);
258 		_vala_code_node_unref0 (temp_var);
259 	}
260 	_tmp66_ = ccall;
261 	_tmp67_ = _vala_ccode_node_ref0 ((ValaCCodeExpression*) _tmp66_);
262 	rv = _tmp67_;
263 	if (expr != NULL) {
264 		ValaDataType* _tmp69_;
265 		_tmp69_ = target_type;
266 		_tmp68_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp69_, VALA_TYPE_ARRAY_TYPE);
267 	} else {
268 		_tmp68_ = FALSE;
269 	}
270 	if (_tmp68_) {
271 		ValaCCodeFunctionCall* len_call = NULL;
272 		ValaCCodeIdentifier* _tmp70_;
273 		ValaCCodeIdentifier* _tmp71_;
274 		ValaCCodeFunctionCall* _tmp72_;
275 		ValaCCodeFunctionCall* _tmp73_;
276 		ValaCCodeFunctionCall* _tmp74_;
277 		ValaCCodeExpression* _tmp75_;
278 		ValaCCodeFunctionCall* _tmp76_;
279 		_tmp70_ = vala_ccode_identifier_new ("g_strv_length");
280 		_tmp71_ = _tmp70_;
281 		_tmp72_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp71_);
282 		_tmp73_ = _tmp72_;
283 		_vala_ccode_node_unref0 (_tmp71_);
284 		len_call = _tmp73_;
285 		_tmp74_ = len_call;
286 		_tmp75_ = rv;
287 		vala_ccode_function_call_add_argument (_tmp74_, _tmp75_);
288 		_tmp76_ = len_call;
289 		vala_append_array_length ((ValaExpression*) expr, (ValaCCodeExpression*) _tmp76_);
290 		_vala_ccode_node_unref0 (len_call);
291 	} else {
292 		ValaDataType* _tmp77_;
293 		_tmp77_ = target_type;
294 		if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp77_, VALA_TYPE_STRUCT_VALUE_TYPE)) {
295 			ValaCodeNode* _tmp78_ = NULL;
296 			ValaCodeNode* node = NULL;
297 			ValaCodeNode* _tmp80_;
298 			ValaTargetValue* temp_value = NULL;
299 			ValaDataType* _tmp81_;
300 			ValaCodeNode* _tmp82_;
301 			gboolean _tmp83_;
302 			ValaTargetValue* _tmp84_;
303 			ValaCCodeExpression* ctemp = NULL;
304 			ValaTargetValue* _tmp85_;
305 			ValaCCodeExpression* _tmp86_;
306 			ValaCCodeExpression* _tmp87_;
307 			ValaCCodeExpression* _tmp88_;
308 			ValaDataType* _tmp89_;
309 			ValaPointerType* _tmp90_;
310 			ValaPointerType* _tmp91_;
311 			gchar* _tmp92_;
312 			gchar* _tmp93_;
313 			ValaCCodeCastExpression* _tmp94_;
314 			ValaCCodeCastExpression* _tmp95_;
315 			ValaCCodeUnaryExpression* _tmp96_;
316 			ValaCCodeFunctionCall* holds = NULL;
317 			ValaCCodeIdentifier* _tmp97_;
318 			ValaCCodeIdentifier* _tmp98_;
319 			ValaCCodeFunctionCall* _tmp99_;
320 			ValaCCodeFunctionCall* _tmp100_;
321 			ValaCCodeFunctionCall* _tmp101_;
322 			ValaCCodeExpression* _tmp102_;
323 			ValaCCodeFunctionCall* _tmp103_;
324 			ValaDataType* _tmp104_;
325 			gchar* _tmp105_;
326 			gchar* _tmp106_;
327 			ValaCCodeIdentifier* _tmp107_;
328 			ValaCCodeIdentifier* _tmp108_;
329 			ValaCCodeBinaryExpression* cond = NULL;
330 			ValaCCodeFunctionCall* _tmp109_;
331 			ValaCCodeFunctionCall* _tmp110_;
332 			ValaCCodeBinaryExpression* _tmp111_;
333 			ValaCCodeFunctionCall* warn = NULL;
334 			ValaCCodeIdentifier* _tmp112_;
335 			ValaCCodeIdentifier* _tmp113_;
336 			ValaCCodeFunctionCall* _tmp114_;
337 			ValaCCodeFunctionCall* _tmp115_;
338 			ValaCCodeFunctionCall* _tmp116_;
339 			ValaCCodeConstant* _tmp117_;
340 			ValaCCodeConstant* _tmp118_;
341 			ValaCCodeCommaExpression* fail = NULL;
342 			ValaCCodeCommaExpression* _tmp119_;
343 			ValaCCodeCommaExpression* _tmp120_;
344 			ValaCCodeFunctionCall* _tmp121_;
345 			ValaCCodeCommaExpression* _tmp122_;
346 			ValaCCodeExpression* _tmp123_;
347 			ValaCCodeBinaryExpression* _tmp124_;
348 			ValaCCodeExpression* _tmp125_;
349 			ValaCCodeCommaExpression* _tmp126_;
350 			ValaCCodeConditionalExpression* _tmp127_;
351 			if (expr != NULL) {
352 				_tmp78_ = G_TYPE_CHECK_INSTANCE_CAST (expr, VALA_TYPE_CODE_NODE, ValaCodeNode);
353 			} else {
354 				ValaDataType* _tmp79_;
355 				_tmp79_ = target_type;
356 				_tmp78_ = (ValaCodeNode*) _tmp79_;
357 			}
358 			_tmp80_ = _vala_code_node_ref0 (_tmp78_);
359 			node = _tmp80_;
360 			_tmp81_ = target_type;
361 			_tmp82_ = node;
362 			_tmp83_ = TRUE;
363 			_tmp84_ = vala_ccode_base_module_create_temp_value ((ValaCCodeBaseModule*) self, _tmp81_, TRUE, _tmp82_, &_tmp83_);
364 			temp_value = _tmp84_;
365 			_tmp85_ = temp_value;
366 			_tmp86_ = vala_get_cvalue_ (_tmp85_);
367 			_tmp87_ = _vala_ccode_node_ref0 (_tmp86_);
368 			ctemp = _tmp87_;
369 			_tmp88_ = rv;
370 			_tmp89_ = target_type;
371 			_tmp90_ = vala_pointer_type_new (_tmp89_, NULL);
372 			_tmp91_ = _tmp90_;
373 			_tmp92_ = vala_get_ccode_name ((ValaCodeNode*) _tmp91_);
374 			_tmp93_ = _tmp92_;
375 			_tmp94_ = vala_ccode_cast_expression_new (_tmp88_, _tmp93_);
376 			_tmp95_ = _tmp94_;
377 			_tmp96_ = vala_ccode_unary_expression_new (VALA_CCODE_UNARY_OPERATOR_POINTER_INDIRECTION, (ValaCCodeExpression*) _tmp95_);
378 			_vala_ccode_node_unref0 (rv);
379 			rv = (ValaCCodeExpression*) _tmp96_;
380 			_vala_ccode_node_unref0 (_tmp95_);
381 			_g_free0 (_tmp93_);
382 			_vala_code_node_unref0 (_tmp91_);
383 			_tmp97_ = vala_ccode_identifier_new ("G_VALUE_HOLDS");
384 			_tmp98_ = _tmp97_;
385 			_tmp99_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp98_);
386 			_tmp100_ = _tmp99_;
387 			_vala_ccode_node_unref0 (_tmp98_);
388 			holds = _tmp100_;
389 			_tmp101_ = holds;
390 			_tmp102_ = gvalue;
391 			vala_ccode_function_call_add_argument (_tmp101_, _tmp102_);
392 			_tmp103_ = holds;
393 			_tmp104_ = target_type;
394 			_tmp105_ = vala_get_ccode_type_id ((ValaCodeNode*) _tmp104_);
395 			_tmp106_ = _tmp105_;
396 			_tmp107_ = vala_ccode_identifier_new (_tmp106_);
397 			_tmp108_ = _tmp107_;
398 			vala_ccode_function_call_add_argument (_tmp103_, (ValaCCodeExpression*) _tmp108_);
399 			_vala_ccode_node_unref0 (_tmp108_);
400 			_g_free0 (_tmp106_);
401 			_tmp109_ = holds;
402 			_tmp110_ = ccall;
403 			_tmp111_ = vala_ccode_binary_expression_new (VALA_CCODE_BINARY_OPERATOR_AND, (ValaCCodeExpression*) _tmp109_, (ValaCCodeExpression*) _tmp110_);
404 			cond = _tmp111_;
405 			_tmp112_ = vala_ccode_identifier_new ("g_warning");
406 			_tmp113_ = _tmp112_;
407 			_tmp114_ = vala_ccode_function_call_new ((ValaCCodeExpression*) _tmp113_);
408 			_tmp115_ = _tmp114_;
409 			_vala_ccode_node_unref0 (_tmp113_);
410 			warn = _tmp115_;
411 			_tmp116_ = warn;
412 			_tmp117_ = vala_ccode_constant_new ("\"Invalid GValue unboxing (wrong type or NULL)\"");
413 			_tmp118_ = _tmp117_;
414 			vala_ccode_function_call_add_argument (_tmp116_, (ValaCCodeExpression*) _tmp118_);
415 			_vala_ccode_node_unref0 (_tmp118_);
416 			_tmp119_ = vala_ccode_comma_expression_new ();
417 			fail = _tmp119_;
418 			_tmp120_ = fail;
419 			_tmp121_ = warn;
420 			vala_ccode_comma_expression_append_expression (_tmp120_, (ValaCCodeExpression*) _tmp121_);
421 			_tmp122_ = fail;
422 			_tmp123_ = ctemp;
423 			vala_ccode_comma_expression_append_expression (_tmp122_, _tmp123_);
424 			_tmp124_ = cond;
425 			_tmp125_ = rv;
426 			_tmp126_ = fail;
427 			_tmp127_ = vala_ccode_conditional_expression_new ((ValaCCodeExpression*) _tmp124_, _tmp125_, (ValaCCodeExpression*) _tmp126_);
428 			_vala_ccode_node_unref0 (rv);
429 			rv = (ValaCCodeExpression*) _tmp127_;
430 			_vala_ccode_node_unref0 (fail);
431 			_vala_ccode_node_unref0 (warn);
432 			_vala_ccode_node_unref0 (cond);
433 			_vala_ccode_node_unref0 (holds);
434 			_vala_ccode_node_unref0 (ctemp);
435 			_vala_target_value_unref0 (temp_value);
436 			_vala_code_node_unref0 (node);
437 		}
438 	}
439 	_tmp128_ = rv;
440 	vala_set_cvalue ((ValaExpression*) expr, _tmp128_);
441 	_vala_ccode_node_unref0 (rv);
442 	_vala_ccode_node_unref0 (gvalue);
443 	_vala_ccode_node_unref0 (ccall);
444 }
445 
446 static ValaCCodeExpression*
vala_gvalue_module_real_get_value_getter_function(ValaCCodeBaseModule * base,ValaDataType * type_reference)447 vala_gvalue_module_real_get_value_getter_function (ValaCCodeBaseModule* base,
448                                                    ValaDataType* type_reference)
449 {
450 	ValaGValueModule * self;
451 	ValaArrayType* array_type = NULL;
452 	ValaArrayType* _tmp0_;
453 	ValaTypeSymbol* _tmp1_;
454 	ValaTypeSymbol* _tmp2_;
455 	ValaCCodeExpression* result = NULL;
456 	self = (ValaGValueModule*) base;
457 	g_return_val_if_fail (type_reference != NULL, NULL);
458 	_tmp0_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (type_reference, VALA_TYPE_ARRAY_TYPE) ? ((ValaArrayType*) type_reference) : NULL);
459 	array_type = _tmp0_;
460 	_tmp1_ = vala_data_type_get_type_symbol (type_reference);
461 	_tmp2_ = _tmp1_;
462 	if (_tmp2_ != NULL) {
463 		ValaTypeSymbol* _tmp3_;
464 		ValaTypeSymbol* _tmp4_;
465 		gchar* _tmp5_;
466 		gchar* _tmp6_;
467 		ValaCCodeIdentifier* _tmp7_;
468 		ValaCCodeExpression* _tmp8_;
469 		_tmp3_ = vala_data_type_get_type_symbol (type_reference);
470 		_tmp4_ = _tmp3_;
471 		_tmp5_ = vala_get_ccode_get_value_function ((ValaCodeNode*) _tmp4_);
472 		_tmp6_ = _tmp5_;
473 		_tmp7_ = vala_ccode_identifier_new (_tmp6_);
474 		_tmp8_ = (ValaCCodeExpression*) _tmp7_;
475 		_g_free0 (_tmp6_);
476 		result = _tmp8_;
477 		_vala_code_node_unref0 (array_type);
478 		return result;
479 	} else {
480 		gboolean _tmp9_ = FALSE;
481 		ValaArrayType* _tmp10_;
482 		_tmp10_ = array_type;
483 		if (_tmp10_ != NULL) {
484 			ValaArrayType* _tmp11_;
485 			ValaDataType* _tmp12_;
486 			ValaDataType* _tmp13_;
487 			ValaTypeSymbol* _tmp14_;
488 			ValaTypeSymbol* _tmp15_;
489 			ValaDataType* _tmp16_;
490 			ValaTypeSymbol* _tmp17_;
491 			ValaTypeSymbol* _tmp18_;
492 			_tmp11_ = array_type;
493 			_tmp12_ = vala_array_type_get_element_type (_tmp11_);
494 			_tmp13_ = _tmp12_;
495 			_tmp14_ = vala_data_type_get_type_symbol (_tmp13_);
496 			_tmp15_ = _tmp14_;
497 			_tmp16_ = ((ValaCCodeBaseModule*) self)->string_type;
498 			_tmp17_ = vala_data_type_get_type_symbol (_tmp16_);
499 			_tmp18_ = _tmp17_;
500 			_tmp9_ = _tmp15_ == _tmp18_;
501 		} else {
502 			_tmp9_ = FALSE;
503 		}
504 		if (_tmp9_) {
505 			ValaCCodeIdentifier* _tmp19_;
506 			_tmp19_ = vala_ccode_identifier_new ("g_value_get_boxed");
507 			result = (ValaCCodeExpression*) _tmp19_;
508 			_vala_code_node_unref0 (array_type);
509 			return result;
510 		} else {
511 			ValaCCodeIdentifier* _tmp20_;
512 			_tmp20_ = vala_ccode_identifier_new ("g_value_get_pointer");
513 			result = (ValaCCodeExpression*) _tmp20_;
514 			_vala_code_node_unref0 (array_type);
515 			return result;
516 		}
517 	}
518 	_vala_code_node_unref0 (array_type);
519 }
520 
521 static ValaCCodeExpression*
vala_gvalue_module_real_get_value_setter_function(ValaCCodeBaseModule * base,ValaDataType * type_reference)522 vala_gvalue_module_real_get_value_setter_function (ValaCCodeBaseModule* base,
523                                                    ValaDataType* type_reference)
524 {
525 	ValaGValueModule * self;
526 	ValaArrayType* array_type = NULL;
527 	ValaArrayType* _tmp0_;
528 	ValaTypeSymbol* _tmp1_;
529 	ValaTypeSymbol* _tmp2_;
530 	ValaCCodeExpression* result = NULL;
531 	self = (ValaGValueModule*) base;
532 	g_return_val_if_fail (type_reference != NULL, NULL);
533 	_tmp0_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (type_reference, VALA_TYPE_ARRAY_TYPE) ? ((ValaArrayType*) type_reference) : NULL);
534 	array_type = _tmp0_;
535 	_tmp1_ = vala_data_type_get_type_symbol (type_reference);
536 	_tmp2_ = _tmp1_;
537 	if (_tmp2_ != NULL) {
538 		ValaTypeSymbol* _tmp3_;
539 		ValaTypeSymbol* _tmp4_;
540 		gchar* _tmp5_;
541 		gchar* _tmp6_;
542 		ValaCCodeIdentifier* _tmp7_;
543 		ValaCCodeExpression* _tmp8_;
544 		_tmp3_ = vala_data_type_get_type_symbol (type_reference);
545 		_tmp4_ = _tmp3_;
546 		_tmp5_ = vala_get_ccode_set_value_function ((ValaCodeNode*) _tmp4_);
547 		_tmp6_ = _tmp5_;
548 		_tmp7_ = vala_ccode_identifier_new (_tmp6_);
549 		_tmp8_ = (ValaCCodeExpression*) _tmp7_;
550 		_g_free0 (_tmp6_);
551 		result = _tmp8_;
552 		_vala_code_node_unref0 (array_type);
553 		return result;
554 	} else {
555 		gboolean _tmp9_ = FALSE;
556 		ValaArrayType* _tmp10_;
557 		_tmp10_ = array_type;
558 		if (_tmp10_ != NULL) {
559 			ValaArrayType* _tmp11_;
560 			ValaDataType* _tmp12_;
561 			ValaDataType* _tmp13_;
562 			ValaTypeSymbol* _tmp14_;
563 			ValaTypeSymbol* _tmp15_;
564 			ValaDataType* _tmp16_;
565 			ValaTypeSymbol* _tmp17_;
566 			ValaTypeSymbol* _tmp18_;
567 			_tmp11_ = array_type;
568 			_tmp12_ = vala_array_type_get_element_type (_tmp11_);
569 			_tmp13_ = _tmp12_;
570 			_tmp14_ = vala_data_type_get_type_symbol (_tmp13_);
571 			_tmp15_ = _tmp14_;
572 			_tmp16_ = ((ValaCCodeBaseModule*) self)->string_type;
573 			_tmp17_ = vala_data_type_get_type_symbol (_tmp16_);
574 			_tmp18_ = _tmp17_;
575 			_tmp9_ = _tmp15_ == _tmp18_;
576 		} else {
577 			_tmp9_ = FALSE;
578 		}
579 		if (_tmp9_) {
580 			ValaCCodeIdentifier* _tmp19_;
581 			_tmp19_ = vala_ccode_identifier_new ("g_value_set_boxed");
582 			result = (ValaCCodeExpression*) _tmp19_;
583 			_vala_code_node_unref0 (array_type);
584 			return result;
585 		} else {
586 			ValaCCodeIdentifier* _tmp20_;
587 			_tmp20_ = vala_ccode_identifier_new ("g_value_set_pointer");
588 			result = (ValaCCodeExpression*) _tmp20_;
589 			_vala_code_node_unref0 (array_type);
590 			return result;
591 		}
592 	}
593 	_vala_code_node_unref0 (array_type);
594 }
595 
596 static ValaCCodeExpression*
vala_gvalue_module_real_get_value_taker_function(ValaCCodeBaseModule * base,ValaDataType * type_reference)597 vala_gvalue_module_real_get_value_taker_function (ValaCCodeBaseModule* base,
598                                                   ValaDataType* type_reference)
599 {
600 	ValaGValueModule * self;
601 	ValaArrayType* array_type = NULL;
602 	ValaArrayType* _tmp0_;
603 	ValaTypeSymbol* _tmp1_;
604 	ValaTypeSymbol* _tmp2_;
605 	ValaCCodeExpression* result = NULL;
606 	self = (ValaGValueModule*) base;
607 	g_return_val_if_fail (type_reference != NULL, NULL);
608 	_tmp0_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (type_reference, VALA_TYPE_ARRAY_TYPE) ? ((ValaArrayType*) type_reference) : NULL);
609 	array_type = _tmp0_;
610 	_tmp1_ = vala_data_type_get_type_symbol (type_reference);
611 	_tmp2_ = _tmp1_;
612 	if (_tmp2_ != NULL) {
613 		ValaTypeSymbol* _tmp3_;
614 		ValaTypeSymbol* _tmp4_;
615 		gchar* _tmp5_;
616 		gchar* _tmp6_;
617 		ValaCCodeIdentifier* _tmp7_;
618 		ValaCCodeExpression* _tmp8_;
619 		_tmp3_ = vala_data_type_get_type_symbol (type_reference);
620 		_tmp4_ = _tmp3_;
621 		_tmp5_ = vala_get_ccode_take_value_function ((ValaCodeNode*) _tmp4_);
622 		_tmp6_ = _tmp5_;
623 		_tmp7_ = vala_ccode_identifier_new (_tmp6_);
624 		_tmp8_ = (ValaCCodeExpression*) _tmp7_;
625 		_g_free0 (_tmp6_);
626 		result = _tmp8_;
627 		_vala_code_node_unref0 (array_type);
628 		return result;
629 	} else {
630 		gboolean _tmp9_ = FALSE;
631 		ValaArrayType* _tmp10_;
632 		_tmp10_ = array_type;
633 		if (_tmp10_ != NULL) {
634 			ValaArrayType* _tmp11_;
635 			ValaDataType* _tmp12_;
636 			ValaDataType* _tmp13_;
637 			ValaTypeSymbol* _tmp14_;
638 			ValaTypeSymbol* _tmp15_;
639 			ValaDataType* _tmp16_;
640 			ValaTypeSymbol* _tmp17_;
641 			ValaTypeSymbol* _tmp18_;
642 			_tmp11_ = array_type;
643 			_tmp12_ = vala_array_type_get_element_type (_tmp11_);
644 			_tmp13_ = _tmp12_;
645 			_tmp14_ = vala_data_type_get_type_symbol (_tmp13_);
646 			_tmp15_ = _tmp14_;
647 			_tmp16_ = ((ValaCCodeBaseModule*) self)->string_type;
648 			_tmp17_ = vala_data_type_get_type_symbol (_tmp16_);
649 			_tmp18_ = _tmp17_;
650 			_tmp9_ = _tmp15_ == _tmp18_;
651 		} else {
652 			_tmp9_ = FALSE;
653 		}
654 		if (_tmp9_) {
655 			ValaCCodeIdentifier* _tmp19_;
656 			_tmp19_ = vala_ccode_identifier_new ("g_value_take_boxed");
657 			result = (ValaCCodeExpression*) _tmp19_;
658 			_vala_code_node_unref0 (array_type);
659 			return result;
660 		} else {
661 			ValaCCodeIdentifier* _tmp20_;
662 			_tmp20_ = vala_ccode_identifier_new ("g_value_set_pointer");
663 			result = (ValaCCodeExpression*) _tmp20_;
664 			_vala_code_node_unref0 (array_type);
665 			return result;
666 		}
667 	}
668 	_vala_code_node_unref0 (array_type);
669 }
670 
671 ValaGValueModule*
vala_gvalue_module_construct(GType object_type)672 vala_gvalue_module_construct (GType object_type)
673 {
674 	ValaGValueModule* self = NULL;
675 	self = (ValaGValueModule*) vala_gasync_module_construct (object_type);
676 	return self;
677 }
678 
679 ValaGValueModule*
vala_gvalue_module_new(void)680 vala_gvalue_module_new (void)
681 {
682 	return vala_gvalue_module_construct (VALA_TYPE_GVALUE_MODULE);
683 }
684 
685 static void
vala_gvalue_module_class_init(ValaGValueModuleClass * klass,gpointer klass_data)686 vala_gvalue_module_class_init (ValaGValueModuleClass * klass,
687                                gpointer klass_data)
688 {
689 	vala_gvalue_module_parent_class = g_type_class_peek_parent (klass);
690 	((ValaCodeVisitorClass *) klass)->visit_cast_expression = (void (*) (ValaCodeVisitor*, ValaCastExpression*)) vala_gvalue_module_real_visit_cast_expression;
691 	((ValaCCodeBaseModuleClass *) klass)->get_value_getter_function = (ValaCCodeExpression* (*) (ValaCCodeBaseModule*, ValaDataType*)) vala_gvalue_module_real_get_value_getter_function;
692 	((ValaCCodeBaseModuleClass *) klass)->get_value_setter_function = (ValaCCodeExpression* (*) (ValaCCodeBaseModule*, ValaDataType*)) vala_gvalue_module_real_get_value_setter_function;
693 	((ValaCCodeBaseModuleClass *) klass)->get_value_taker_function = (ValaCCodeExpression* (*) (ValaCCodeBaseModule*, ValaDataType*)) vala_gvalue_module_real_get_value_taker_function;
694 }
695 
696 static void
vala_gvalue_module_instance_init(ValaGValueModule * self,gpointer klass)697 vala_gvalue_module_instance_init (ValaGValueModule * self,
698                                   gpointer klass)
699 {
700 }
701 
702 static GType
vala_gvalue_module_get_type_once(void)703 vala_gvalue_module_get_type_once (void)
704 {
705 	static const GTypeInfo g_define_type_info = { sizeof (ValaGValueModuleClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_gvalue_module_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaGValueModule), 0, (GInstanceInitFunc) vala_gvalue_module_instance_init, NULL };
706 	GType vala_gvalue_module_type_id;
707 	vala_gvalue_module_type_id = g_type_register_static (VALA_TYPE_GASYNC_MODULE, "ValaGValueModule", &g_define_type_info, 0);
708 	return vala_gvalue_module_type_id;
709 }
710 
711 GType
vala_gvalue_module_get_type(void)712 vala_gvalue_module_get_type (void)
713 {
714 	static volatile gsize vala_gvalue_module_type_id__volatile = 0;
715 	if (g_once_init_enter (&vala_gvalue_module_type_id__volatile)) {
716 		GType vala_gvalue_module_type_id;
717 		vala_gvalue_module_type_id = vala_gvalue_module_get_type_once ();
718 		g_once_init_leave (&vala_gvalue_module_type_id__volatile, vala_gvalue_module_type_id);
719 	}
720 	return vala_gvalue_module_type_id__volatile;
721 }
722 
723