1 /* valaccodecompiler.c generated by valac, the Vala compiler
2  * generated from valaccodecompiler.vala, do not modify */
3 
4 /* valaccodecompiler.vala
5  *
6  * Copyright (C) 2007-2009  Jürg Billeter
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  * 	Jürg Billeter <j@bitron.ch>
24  */
25 
26 #include "valacodegen.h"
27 #include <vala.h>
28 #include <stdlib.h>
29 #include <string.h>
30 #include <glib.h>
31 #include <valagee.h>
32 #include <glib-object.h>
33 #include <stdio.h>
34 #include <glib/gstdio.h>
35 #include <gobject/gvaluecollector.h>
36 
37 #define _g_free0(var) (var = (g_free (var), NULL))
38 #define _vala_iterable_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterable_unref (var), NULL)))
39 #define _vala_source_file_unref0(var) ((var == NULL) ? NULL : (var = (vala_source_file_unref (var), NULL)))
40 #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
41 typedef struct _ValaParamSpecCCodeCompiler ValaParamSpecCCodeCompiler;
42 
43 struct _ValaParamSpecCCodeCompiler {
44 	GParamSpec parent_instance;
45 };
46 
47 static gpointer vala_ccode_compiler_parent_class = NULL;
48 
49 static void vala_ccode_compiler_finalize (ValaCCodeCompiler * obj);
50 static GType vala_ccode_compiler_get_type_once (void);
51 
52 ValaCCodeCompiler*
vala_ccode_compiler_construct(GType object_type)53 vala_ccode_compiler_construct (GType object_type)
54 {
55 	ValaCCodeCompiler* self = NULL;
56 	self = (ValaCCodeCompiler*) g_type_create_instance (object_type);
57 	return self;
58 }
59 
60 ValaCCodeCompiler*
vala_ccode_compiler_new(void)61 vala_ccode_compiler_new (void)
62 {
63 	return vala_ccode_compiler_construct (VALA_TYPE_CCODE_COMPILER);
64 }
65 
66 /**
67  * Compile generated C code to object code and optionally link object
68  * files.
69  *
70  * @param context a code context
71  */
72 static gpointer
_vala_iterable_ref0(gpointer self)73 _vala_iterable_ref0 (gpointer self)
74 {
75 	return self ? vala_iterable_ref (self) : NULL;
76 }
77 
78 static gchar*
string_strip(const gchar * self)79 string_strip (const gchar* self)
80 {
81 	gchar* _result_ = NULL;
82 	gchar* _tmp0_;
83 	gchar* result = NULL;
84 	g_return_val_if_fail (self != NULL, NULL);
85 	_tmp0_ = g_strdup (self);
86 	_result_ = _tmp0_;
87 	g_strstrip (_result_);
88 	result = _result_;
89 	return result;
90 }
91 
92 void
vala_ccode_compiler_compile(ValaCCodeCompiler * self,ValaCodeContext * context,const gchar * cc_command,gchar ** cc_options,gint cc_options_length1)93 vala_ccode_compiler_compile (ValaCCodeCompiler* self,
94                              ValaCodeContext* context,
95                              const gchar* cc_command,
96                              gchar** cc_options,
97                              gint cc_options_length1)
98 {
99 	gchar* pc = NULL;
100 	gchar* _tmp0_;
101 	ValaProfile _tmp1_;
102 	ValaProfile _tmp2_;
103 	gchar* pkgflags = NULL;
104 	const gchar* _tmp20_;
105 	gint _tmp21_;
106 	gint _tmp22_;
107 	gchar* cmdline = NULL;
108 	gchar* _tmp27_;
109 	gboolean _tmp28_;
110 	gboolean _tmp29_;
111 	gboolean _tmp32_;
112 	gboolean _tmp33_;
113 	ValaList* source_files = NULL;
114 	ValaList* _tmp61_;
115 	ValaList* _tmp62_;
116 	ValaList* c_source_files = NULL;
117 	ValaList* _tmp84_;
118 	ValaList* _tmp85_;
119 	const gchar* _tmp102_;
120 	const gchar* _tmp103_;
121 	gchar* _tmp104_;
122 	gchar* _tmp105_;
123 	gchar* _tmp106_;
124 	gchar* _tmp107_;
125 	gchar* _tmp108_;
126 	gboolean _tmp117_;
127 	gboolean _tmp118_;
128 	gboolean _tmp127_;
129 	gboolean _tmp128_;
130 	GError* _inner_error0_ = NULL;
131 	g_return_if_fail (self != NULL);
132 	g_return_if_fail (context != NULL);
133 	_tmp0_ = g_strdup ("");
134 	pc = _tmp0_;
135 	_tmp1_ = vala_code_context_get_profile (context);
136 	_tmp2_ = _tmp1_;
137 	if (_tmp2_ == VALA_PROFILE_GOBJECT) {
138 		const gchar* _tmp3_;
139 		gchar* _tmp4_;
140 		_tmp3_ = pc;
141 		_tmp4_ = g_strconcat (_tmp3_, " gobject-2.0", NULL);
142 		_g_free0 (pc);
143 		pc = _tmp4_;
144 	}
145 	{
146 		ValaList* _pkg_list = NULL;
147 		ValaList* _tmp5_;
148 		ValaList* _tmp6_;
149 		gint _pkg_size = 0;
150 		ValaList* _tmp7_;
151 		gint _tmp8_;
152 		gint _tmp9_;
153 		gint _pkg_index = 0;
154 		_tmp5_ = vala_code_context_get_packages (context);
155 		_tmp6_ = _vala_iterable_ref0 (_tmp5_);
156 		_pkg_list = _tmp6_;
157 		_tmp7_ = _pkg_list;
158 		_tmp8_ = vala_collection_get_size ((ValaCollection*) _tmp7_);
159 		_tmp9_ = _tmp8_;
160 		_pkg_size = _tmp9_;
161 		_pkg_index = -1;
162 		while (TRUE) {
163 			gint _tmp10_;
164 			gint _tmp11_;
165 			gchar* pkg = NULL;
166 			ValaList* _tmp12_;
167 			gpointer _tmp13_;
168 			const gchar* _tmp14_;
169 			_pkg_index = _pkg_index + 1;
170 			_tmp10_ = _pkg_index;
171 			_tmp11_ = _pkg_size;
172 			if (!(_tmp10_ < _tmp11_)) {
173 				break;
174 			}
175 			_tmp12_ = _pkg_list;
176 			_tmp13_ = vala_list_get (_tmp12_, _pkg_index);
177 			pkg = (gchar*) _tmp13_;
178 			_tmp14_ = pkg;
179 			if (vala_code_context_pkg_config_exists (context, _tmp14_)) {
180 				const gchar* _tmp15_;
181 				const gchar* _tmp16_;
182 				gchar* _tmp17_;
183 				gchar* _tmp18_;
184 				gchar* _tmp19_;
185 				_tmp15_ = pc;
186 				_tmp16_ = pkg;
187 				_tmp17_ = g_strconcat (" ", _tmp16_, NULL);
188 				_tmp18_ = _tmp17_;
189 				_tmp19_ = g_strconcat (_tmp15_, _tmp18_, NULL);
190 				_g_free0 (pc);
191 				pc = _tmp19_;
192 				_g_free0 (_tmp18_);
193 			}
194 			_g_free0 (pkg);
195 		}
196 		_vala_iterable_unref0 (_pkg_list);
197 	}
198 	_tmp20_ = pc;
199 	_tmp21_ = strlen (_tmp20_);
200 	_tmp22_ = _tmp21_;
201 	if (_tmp22_ > 0) {
202 		const gchar* _tmp23_;
203 		gchar* _tmp24_;
204 		const gchar* _tmp25_;
205 		_tmp23_ = pc;
206 		_tmp24_ = vala_code_context_pkg_config_compile_flags (context, _tmp23_);
207 		_g_free0 (pkgflags);
208 		pkgflags = _tmp24_;
209 		_tmp25_ = pkgflags;
210 		if (_tmp25_ == NULL) {
211 			_g_free0 (pkgflags);
212 			_g_free0 (pc);
213 			return;
214 		}
215 	} else {
216 		gchar* _tmp26_;
217 		_tmp26_ = g_strdup ("");
218 		_g_free0 (pkgflags);
219 		pkgflags = _tmp26_;
220 	}
221 	if (cc_command == NULL) {
222 		cc_command = "cc";
223 	}
224 	_tmp27_ = g_strdup (cc_command);
225 	cmdline = _tmp27_;
226 	_tmp28_ = vala_code_context_get_debug (context);
227 	_tmp29_ = _tmp28_;
228 	if (_tmp29_) {
229 		const gchar* _tmp30_;
230 		gchar* _tmp31_;
231 		_tmp30_ = cmdline;
232 		_tmp31_ = g_strconcat (_tmp30_, " -g", NULL);
233 		_g_free0 (cmdline);
234 		cmdline = _tmp31_;
235 	}
236 	_tmp32_ = vala_code_context_get_compile_only (context);
237 	_tmp33_ = _tmp32_;
238 	if (_tmp33_) {
239 		const gchar* _tmp34_;
240 		gchar* _tmp35_;
241 		_tmp34_ = cmdline;
242 		_tmp35_ = g_strconcat (_tmp34_, " -c", NULL);
243 		_g_free0 (cmdline);
244 		cmdline = _tmp35_;
245 	} else {
246 		const gchar* _tmp36_;
247 		const gchar* _tmp37_;
248 		_tmp36_ = vala_code_context_get_output (context);
249 		_tmp37_ = _tmp36_;
250 		if (_tmp37_ != NULL) {
251 			gchar* output = NULL;
252 			const gchar* _tmp38_;
253 			const gchar* _tmp39_;
254 			gchar* _tmp40_;
255 			gboolean _tmp41_ = FALSE;
256 			gboolean _tmp42_ = FALSE;
257 			const gchar* _tmp43_;
258 			const gchar* _tmp44_;
259 			const gchar* _tmp54_;
260 			const gchar* _tmp55_;
261 			gchar* _tmp56_;
262 			gchar* _tmp57_;
263 			gchar* _tmp58_;
264 			gchar* _tmp59_;
265 			gchar* _tmp60_;
266 			_tmp38_ = vala_code_context_get_output (context);
267 			_tmp39_ = _tmp38_;
268 			_tmp40_ = g_strdup (_tmp39_);
269 			output = _tmp40_;
270 			_tmp43_ = vala_code_context_get_directory (context);
271 			_tmp44_ = _tmp43_;
272 			if (_tmp44_ != NULL) {
273 				const gchar* _tmp45_;
274 				const gchar* _tmp46_;
275 				_tmp45_ = vala_code_context_get_directory (context);
276 				_tmp46_ = _tmp45_;
277 				_tmp42_ = g_strcmp0 (_tmp46_, "") != 0;
278 			} else {
279 				_tmp42_ = FALSE;
280 			}
281 			if (_tmp42_) {
282 				const gchar* _tmp47_;
283 				const gchar* _tmp48_;
284 				_tmp47_ = vala_code_context_get_output (context);
285 				_tmp48_ = _tmp47_;
286 				_tmp41_ = !g_path_is_absolute (_tmp48_);
287 			} else {
288 				_tmp41_ = FALSE;
289 			}
290 			if (_tmp41_) {
291 				const gchar* _tmp49_;
292 				const gchar* _tmp50_;
293 				const gchar* _tmp51_;
294 				const gchar* _tmp52_;
295 				gchar* _tmp53_;
296 				_tmp49_ = vala_code_context_get_directory (context);
297 				_tmp50_ = _tmp49_;
298 				_tmp51_ = vala_code_context_get_output (context);
299 				_tmp52_ = _tmp51_;
300 				_tmp53_ = g_strdup_printf ("%s%c%s", _tmp50_, (gint) G_DIR_SEPARATOR, _tmp52_);
301 				_g_free0 (output);
302 				output = _tmp53_;
303 			}
304 			_tmp54_ = cmdline;
305 			_tmp55_ = output;
306 			_tmp56_ = g_shell_quote (_tmp55_);
307 			_tmp57_ = _tmp56_;
308 			_tmp58_ = g_strconcat (" -o ", _tmp57_, NULL);
309 			_tmp59_ = _tmp58_;
310 			_tmp60_ = g_strconcat (_tmp54_, _tmp59_, NULL);
311 			_g_free0 (cmdline);
312 			cmdline = _tmp60_;
313 			_g_free0 (_tmp59_);
314 			_g_free0 (_tmp57_);
315 			_g_free0 (output);
316 		}
317 	}
318 	_tmp61_ = vala_code_context_get_source_files (context);
319 	_tmp62_ = _vala_iterable_ref0 (_tmp61_);
320 	source_files = _tmp62_;
321 	{
322 		ValaList* _file_list = NULL;
323 		ValaList* _tmp63_;
324 		ValaList* _tmp64_;
325 		gint _file_size = 0;
326 		ValaList* _tmp65_;
327 		gint _tmp66_;
328 		gint _tmp67_;
329 		gint _file_index = 0;
330 		_tmp63_ = source_files;
331 		_tmp64_ = _vala_iterable_ref0 (_tmp63_);
332 		_file_list = _tmp64_;
333 		_tmp65_ = _file_list;
334 		_tmp66_ = vala_collection_get_size ((ValaCollection*) _tmp65_);
335 		_tmp67_ = _tmp66_;
336 		_file_size = _tmp67_;
337 		_file_index = -1;
338 		while (TRUE) {
339 			gint _tmp68_;
340 			gint _tmp69_;
341 			ValaSourceFile* file = NULL;
342 			ValaList* _tmp70_;
343 			gpointer _tmp71_;
344 			ValaSourceFile* _tmp72_;
345 			ValaSourceFileType _tmp73_;
346 			ValaSourceFileType _tmp74_;
347 			_file_index = _file_index + 1;
348 			_tmp68_ = _file_index;
349 			_tmp69_ = _file_size;
350 			if (!(_tmp68_ < _tmp69_)) {
351 				break;
352 			}
353 			_tmp70_ = _file_list;
354 			_tmp71_ = vala_list_get (_tmp70_, _file_index);
355 			file = (ValaSourceFile*) _tmp71_;
356 			_tmp72_ = file;
357 			_tmp73_ = vala_source_file_get_file_type (_tmp72_);
358 			_tmp74_ = _tmp73_;
359 			if (_tmp74_ == VALA_SOURCE_FILE_TYPE_SOURCE) {
360 				const gchar* _tmp75_;
361 				ValaSourceFile* _tmp76_;
362 				gchar* _tmp77_;
363 				gchar* _tmp78_;
364 				gchar* _tmp79_;
365 				gchar* _tmp80_;
366 				gchar* _tmp81_;
367 				gchar* _tmp82_;
368 				gchar* _tmp83_;
369 				_tmp75_ = cmdline;
370 				_tmp76_ = file;
371 				_tmp77_ = vala_source_file_get_csource_filename (_tmp76_);
372 				_tmp78_ = _tmp77_;
373 				_tmp79_ = g_shell_quote (_tmp78_);
374 				_tmp80_ = _tmp79_;
375 				_tmp81_ = g_strconcat (" ", _tmp80_, NULL);
376 				_tmp82_ = _tmp81_;
377 				_tmp83_ = g_strconcat (_tmp75_, _tmp82_, NULL);
378 				_g_free0 (cmdline);
379 				cmdline = _tmp83_;
380 				_g_free0 (_tmp82_);
381 				_g_free0 (_tmp80_);
382 				_g_free0 (_tmp78_);
383 			}
384 			_vala_source_file_unref0 (file);
385 		}
386 		_vala_iterable_unref0 (_file_list);
387 	}
388 	_tmp84_ = vala_code_context_get_c_source_files (context);
389 	_tmp85_ = _vala_iterable_ref0 (_tmp84_);
390 	c_source_files = _tmp85_;
391 	{
392 		ValaList* _file_list = NULL;
393 		ValaList* _tmp86_;
394 		ValaList* _tmp87_;
395 		gint _file_size = 0;
396 		ValaList* _tmp88_;
397 		gint _tmp89_;
398 		gint _tmp90_;
399 		gint _file_index = 0;
400 		_tmp86_ = c_source_files;
401 		_tmp87_ = _vala_iterable_ref0 (_tmp86_);
402 		_file_list = _tmp87_;
403 		_tmp88_ = _file_list;
404 		_tmp89_ = vala_collection_get_size ((ValaCollection*) _tmp88_);
405 		_tmp90_ = _tmp89_;
406 		_file_size = _tmp90_;
407 		_file_index = -1;
408 		while (TRUE) {
409 			gint _tmp91_;
410 			gint _tmp92_;
411 			gchar* file = NULL;
412 			ValaList* _tmp93_;
413 			gpointer _tmp94_;
414 			const gchar* _tmp95_;
415 			const gchar* _tmp96_;
416 			gchar* _tmp97_;
417 			gchar* _tmp98_;
418 			gchar* _tmp99_;
419 			gchar* _tmp100_;
420 			gchar* _tmp101_;
421 			_file_index = _file_index + 1;
422 			_tmp91_ = _file_index;
423 			_tmp92_ = _file_size;
424 			if (!(_tmp91_ < _tmp92_)) {
425 				break;
426 			}
427 			_tmp93_ = _file_list;
428 			_tmp94_ = vala_list_get (_tmp93_, _file_index);
429 			file = (gchar*) _tmp94_;
430 			_tmp95_ = cmdline;
431 			_tmp96_ = file;
432 			_tmp97_ = g_shell_quote (_tmp96_);
433 			_tmp98_ = _tmp97_;
434 			_tmp99_ = g_strconcat (" ", _tmp98_, NULL);
435 			_tmp100_ = _tmp99_;
436 			_tmp101_ = g_strconcat (_tmp95_, _tmp100_, NULL);
437 			_g_free0 (cmdline);
438 			cmdline = _tmp101_;
439 			_g_free0 (_tmp100_);
440 			_g_free0 (_tmp98_);
441 			_g_free0 (file);
442 		}
443 		_vala_iterable_unref0 (_file_list);
444 	}
445 	_tmp102_ = cmdline;
446 	_tmp103_ = pkgflags;
447 	_tmp104_ = string_strip (_tmp103_);
448 	_tmp105_ = _tmp104_;
449 	_tmp106_ = g_strconcat (" ", _tmp105_, NULL);
450 	_tmp107_ = _tmp106_;
451 	_tmp108_ = g_strconcat (_tmp102_, _tmp107_, NULL);
452 	_g_free0 (cmdline);
453 	cmdline = _tmp108_;
454 	_g_free0 (_tmp107_);
455 	_g_free0 (_tmp105_);
456 	{
457 		gchar** cc_option_collection = NULL;
458 		gint cc_option_collection_length1 = 0;
459 		gint _cc_option_collection_size_ = 0;
460 		gint cc_option_it = 0;
461 		cc_option_collection = cc_options;
462 		cc_option_collection_length1 = cc_options_length1;
463 		for (cc_option_it = 0; cc_option_it < cc_option_collection_length1; cc_option_it = cc_option_it + 1) {
464 			gchar* _tmp109_;
465 			gchar* cc_option = NULL;
466 			_tmp109_ = g_strdup (cc_option_collection[cc_option_it]);
467 			cc_option = _tmp109_;
468 			{
469 				const gchar* _tmp110_;
470 				const gchar* _tmp111_;
471 				gchar* _tmp112_;
472 				gchar* _tmp113_;
473 				gchar* _tmp114_;
474 				gchar* _tmp115_;
475 				gchar* _tmp116_;
476 				_tmp110_ = cmdline;
477 				_tmp111_ = cc_option;
478 				_tmp112_ = g_shell_quote (_tmp111_);
479 				_tmp113_ = _tmp112_;
480 				_tmp114_ = g_strconcat (" ", _tmp113_, NULL);
481 				_tmp115_ = _tmp114_;
482 				_tmp116_ = g_strconcat (_tmp110_, _tmp115_, NULL);
483 				_g_free0 (cmdline);
484 				cmdline = _tmp116_;
485 				_g_free0 (_tmp115_);
486 				_g_free0 (_tmp113_);
487 				_g_free0 (cc_option);
488 			}
489 		}
490 	}
491 	_tmp117_ = vala_code_context_get_verbose_mode (context);
492 	_tmp118_ = _tmp117_;
493 	if (_tmp118_) {
494 		FILE* _tmp119_;
495 		const gchar* _tmp120_;
496 		_tmp119_ = stdout;
497 		_tmp120_ = cmdline;
498 		fprintf (_tmp119_, "%s\n", _tmp120_);
499 	}
500 	{
501 		gint exit_status = 0;
502 		const gchar* _tmp121_;
503 		gint _tmp122_ = 0;
504 		_tmp121_ = cmdline;
505 		g_spawn_command_line_sync (_tmp121_, NULL, NULL, &_tmp122_, &_inner_error0_);
506 		exit_status = _tmp122_;
507 		if (G_UNLIKELY (_inner_error0_ != NULL)) {
508 			if (_inner_error0_->domain == G_SPAWN_ERROR) {
509 				goto __catch0_g_spawn_error;
510 			}
511 			_vala_iterable_unref0 (c_source_files);
512 			_vala_iterable_unref0 (source_files);
513 			_g_free0 (cmdline);
514 			_g_free0 (pkgflags);
515 			_g_free0 (pc);
516 			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);
517 			g_clear_error (&_inner_error0_);
518 			return;
519 		}
520 		if (exit_status != 0) {
521 			gchar* _tmp123_;
522 			gchar* _tmp124_;
523 			_tmp123_ = g_strdup_printf ("cc exited with status %d", exit_status);
524 			_tmp124_ = _tmp123_;
525 			vala_report_error (NULL, _tmp124_);
526 			_g_free0 (_tmp124_);
527 		}
528 	}
529 	goto __finally0;
530 	__catch0_g_spawn_error:
531 	{
532 		GError* e = NULL;
533 		GError* _tmp125_;
534 		const gchar* _tmp126_;
535 		e = _inner_error0_;
536 		_inner_error0_ = NULL;
537 		_tmp125_ = e;
538 		_tmp126_ = _tmp125_->message;
539 		vala_report_error (NULL, _tmp126_);
540 		_g_error_free0 (e);
541 	}
542 	__finally0:
543 	if (G_UNLIKELY (_inner_error0_ != NULL)) {
544 		_vala_iterable_unref0 (c_source_files);
545 		_vala_iterable_unref0 (source_files);
546 		_g_free0 (cmdline);
547 		_g_free0 (pkgflags);
548 		_g_free0 (pc);
549 		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);
550 		g_clear_error (&_inner_error0_);
551 		return;
552 	}
553 	_tmp127_ = vala_code_context_get_save_csources (context);
554 	_tmp128_ = _tmp127_;
555 	if (!_tmp128_) {
556 		{
557 			ValaList* _file_list = NULL;
558 			ValaList* _tmp129_;
559 			ValaList* _tmp130_;
560 			gint _file_size = 0;
561 			ValaList* _tmp131_;
562 			gint _tmp132_;
563 			gint _tmp133_;
564 			gint _file_index = 0;
565 			_tmp129_ = source_files;
566 			_tmp130_ = _vala_iterable_ref0 (_tmp129_);
567 			_file_list = _tmp130_;
568 			_tmp131_ = _file_list;
569 			_tmp132_ = vala_collection_get_size ((ValaCollection*) _tmp131_);
570 			_tmp133_ = _tmp132_;
571 			_file_size = _tmp133_;
572 			_file_index = -1;
573 			while (TRUE) {
574 				gint _tmp134_;
575 				gint _tmp135_;
576 				ValaSourceFile* file = NULL;
577 				ValaList* _tmp136_;
578 				gpointer _tmp137_;
579 				ValaSourceFile* _tmp138_;
580 				ValaSourceFileType _tmp139_;
581 				ValaSourceFileType _tmp140_;
582 				_file_index = _file_index + 1;
583 				_tmp134_ = _file_index;
584 				_tmp135_ = _file_size;
585 				if (!(_tmp134_ < _tmp135_)) {
586 					break;
587 				}
588 				_tmp136_ = _file_list;
589 				_tmp137_ = vala_list_get (_tmp136_, _file_index);
590 				file = (ValaSourceFile*) _tmp137_;
591 				_tmp138_ = file;
592 				_tmp139_ = vala_source_file_get_file_type (_tmp138_);
593 				_tmp140_ = _tmp139_;
594 				if (_tmp140_ == VALA_SOURCE_FILE_TYPE_SOURCE) {
595 					ValaSourceFile* _tmp141_;
596 					gchar* _tmp142_;
597 					gchar* _tmp143_;
598 					_tmp141_ = file;
599 					_tmp142_ = vala_source_file_get_csource_filename (_tmp141_);
600 					_tmp143_ = _tmp142_;
601 					g_unlink (_tmp143_);
602 					_g_free0 (_tmp143_);
603 				}
604 				_vala_source_file_unref0 (file);
605 			}
606 			_vala_iterable_unref0 (_file_list);
607 		}
608 	}
609 	_vala_iterable_unref0 (c_source_files);
610 	_vala_iterable_unref0 (source_files);
611 	_g_free0 (cmdline);
612 	_g_free0 (pkgflags);
613 	_g_free0 (pc);
614 }
615 
616 static void
vala_value_ccode_compiler_init(GValue * value)617 vala_value_ccode_compiler_init (GValue* value)
618 {
619 	value->data[0].v_pointer = NULL;
620 }
621 
622 static void
vala_value_ccode_compiler_free_value(GValue * value)623 vala_value_ccode_compiler_free_value (GValue* value)
624 {
625 	if (value->data[0].v_pointer) {
626 		vala_ccode_compiler_unref (value->data[0].v_pointer);
627 	}
628 }
629 
630 static void
vala_value_ccode_compiler_copy_value(const GValue * src_value,GValue * dest_value)631 vala_value_ccode_compiler_copy_value (const GValue* src_value,
632                                       GValue* dest_value)
633 {
634 	if (src_value->data[0].v_pointer) {
635 		dest_value->data[0].v_pointer = vala_ccode_compiler_ref (src_value->data[0].v_pointer);
636 	} else {
637 		dest_value->data[0].v_pointer = NULL;
638 	}
639 }
640 
641 static gpointer
vala_value_ccode_compiler_peek_pointer(const GValue * value)642 vala_value_ccode_compiler_peek_pointer (const GValue* value)
643 {
644 	return value->data[0].v_pointer;
645 }
646 
647 static gchar*
vala_value_ccode_compiler_collect_value(GValue * value,guint n_collect_values,GTypeCValue * collect_values,guint collect_flags)648 vala_value_ccode_compiler_collect_value (GValue* value,
649                                          guint n_collect_values,
650                                          GTypeCValue* collect_values,
651                                          guint collect_flags)
652 {
653 	if (collect_values[0].v_pointer) {
654 		ValaCCodeCompiler * object;
655 		object = collect_values[0].v_pointer;
656 		if (object->parent_instance.g_class == NULL) {
657 			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
658 		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
659 			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
660 		}
661 		value->data[0].v_pointer = vala_ccode_compiler_ref (object);
662 	} else {
663 		value->data[0].v_pointer = NULL;
664 	}
665 	return NULL;
666 }
667 
668 static gchar*
vala_value_ccode_compiler_lcopy_value(const GValue * value,guint n_collect_values,GTypeCValue * collect_values,guint collect_flags)669 vala_value_ccode_compiler_lcopy_value (const GValue* value,
670                                        guint n_collect_values,
671                                        GTypeCValue* collect_values,
672                                        guint collect_flags)
673 {
674 	ValaCCodeCompiler ** object_p;
675 	object_p = collect_values[0].v_pointer;
676 	if (!object_p) {
677 		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
678 	}
679 	if (!value->data[0].v_pointer) {
680 		*object_p = NULL;
681 	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
682 		*object_p = value->data[0].v_pointer;
683 	} else {
684 		*object_p = vala_ccode_compiler_ref (value->data[0].v_pointer);
685 	}
686 	return NULL;
687 }
688 
689 GParamSpec*
vala_param_spec_ccode_compiler(const gchar * name,const gchar * nick,const gchar * blurb,GType object_type,GParamFlags flags)690 vala_param_spec_ccode_compiler (const gchar* name,
691                                 const gchar* nick,
692                                 const gchar* blurb,
693                                 GType object_type,
694                                 GParamFlags flags)
695 {
696 	ValaParamSpecCCodeCompiler* spec;
697 	g_return_val_if_fail (g_type_is_a (object_type, VALA_TYPE_CCODE_COMPILER), NULL);
698 	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
699 	G_PARAM_SPEC (spec)->value_type = object_type;
700 	return G_PARAM_SPEC (spec);
701 }
702 
703 gpointer
vala_value_get_ccode_compiler(const GValue * value)704 vala_value_get_ccode_compiler (const GValue* value)
705 {
706 	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, VALA_TYPE_CCODE_COMPILER), NULL);
707 	return value->data[0].v_pointer;
708 }
709 
710 void
vala_value_set_ccode_compiler(GValue * value,gpointer v_object)711 vala_value_set_ccode_compiler (GValue* value,
712                                gpointer v_object)
713 {
714 	ValaCCodeCompiler * old;
715 	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, VALA_TYPE_CCODE_COMPILER));
716 	old = value->data[0].v_pointer;
717 	if (v_object) {
718 		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, VALA_TYPE_CCODE_COMPILER));
719 		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
720 		value->data[0].v_pointer = v_object;
721 		vala_ccode_compiler_ref (value->data[0].v_pointer);
722 	} else {
723 		value->data[0].v_pointer = NULL;
724 	}
725 	if (old) {
726 		vala_ccode_compiler_unref (old);
727 	}
728 }
729 
730 void
vala_value_take_ccode_compiler(GValue * value,gpointer v_object)731 vala_value_take_ccode_compiler (GValue* value,
732                                 gpointer v_object)
733 {
734 	ValaCCodeCompiler * old;
735 	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, VALA_TYPE_CCODE_COMPILER));
736 	old = value->data[0].v_pointer;
737 	if (v_object) {
738 		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, VALA_TYPE_CCODE_COMPILER));
739 		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
740 		value->data[0].v_pointer = v_object;
741 	} else {
742 		value->data[0].v_pointer = NULL;
743 	}
744 	if (old) {
745 		vala_ccode_compiler_unref (old);
746 	}
747 }
748 
749 static void
vala_ccode_compiler_class_init(ValaCCodeCompilerClass * klass,gpointer klass_data)750 vala_ccode_compiler_class_init (ValaCCodeCompilerClass * klass,
751                                 gpointer klass_data)
752 {
753 	vala_ccode_compiler_parent_class = g_type_class_peek_parent (klass);
754 	((ValaCCodeCompilerClass *) klass)->finalize = vala_ccode_compiler_finalize;
755 }
756 
757 static void
vala_ccode_compiler_instance_init(ValaCCodeCompiler * self,gpointer klass)758 vala_ccode_compiler_instance_init (ValaCCodeCompiler * self,
759                                    gpointer klass)
760 {
761 	self->ref_count = 1;
762 }
763 
764 static void
vala_ccode_compiler_finalize(ValaCCodeCompiler * obj)765 vala_ccode_compiler_finalize (ValaCCodeCompiler * obj)
766 {
767 	ValaCCodeCompiler * self;
768 	self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALA_TYPE_CCODE_COMPILER, ValaCCodeCompiler);
769 	g_signal_handlers_destroy (self);
770 }
771 
772 /**
773  * Interface to the C compiler.
774  */
775 static GType
vala_ccode_compiler_get_type_once(void)776 vala_ccode_compiler_get_type_once (void)
777 {
778 	static const GTypeValueTable g_define_type_value_table = { vala_value_ccode_compiler_init, vala_value_ccode_compiler_free_value, vala_value_ccode_compiler_copy_value, vala_value_ccode_compiler_peek_pointer, "p", vala_value_ccode_compiler_collect_value, "p", vala_value_ccode_compiler_lcopy_value };
779 	static const GTypeInfo g_define_type_info = { sizeof (ValaCCodeCompilerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_ccode_compiler_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaCCodeCompiler), 0, (GInstanceInitFunc) vala_ccode_compiler_instance_init, &g_define_type_value_table };
780 	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
781 	GType vala_ccode_compiler_type_id;
782 	vala_ccode_compiler_type_id = g_type_register_fundamental (g_type_fundamental_next (), "ValaCCodeCompiler", &g_define_type_info, &g_define_type_fundamental_info, 0);
783 	return vala_ccode_compiler_type_id;
784 }
785 
786 GType
vala_ccode_compiler_get_type(void)787 vala_ccode_compiler_get_type (void)
788 {
789 	static volatile gsize vala_ccode_compiler_type_id__volatile = 0;
790 	if (g_once_init_enter (&vala_ccode_compiler_type_id__volatile)) {
791 		GType vala_ccode_compiler_type_id;
792 		vala_ccode_compiler_type_id = vala_ccode_compiler_get_type_once ();
793 		g_once_init_leave (&vala_ccode_compiler_type_id__volatile, vala_ccode_compiler_type_id);
794 	}
795 	return vala_ccode_compiler_type_id__volatile;
796 }
797 
798 gpointer
vala_ccode_compiler_ref(gpointer instance)799 vala_ccode_compiler_ref (gpointer instance)
800 {
801 	ValaCCodeCompiler * self;
802 	self = instance;
803 	g_atomic_int_inc (&self->ref_count);
804 	return instance;
805 }
806 
807 void
vala_ccode_compiler_unref(gpointer instance)808 vala_ccode_compiler_unref (gpointer instance)
809 {
810 	ValaCCodeCompiler * self;
811 	self = instance;
812 	if (g_atomic_int_dec_and_test (&self->ref_count)) {
813 		VALA_CCODE_COMPILER_GET_CLASS (self)->finalize (self);
814 		g_type_free_instance ((GTypeInstance *) self);
815 	}
816 }
817 
818