~ubuntu-branches/ubuntu/maverick/vala/maverick

« back to all changes in this revision

Viewing changes to codegen/valaccodecompiler.c

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-04-02 10:10:55 UTC
  • mfrom: (1.4.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20100402101055-qbx3okzv0tnp3wpp
Tags: 0.8.0-0ubuntu1
* New upstream release:
  - Infer type arguments when calling generic methods.
  - Support `in' operator for arrays.
  - Add experimental support for regular expression literals.
  - Add experimental support for chained relational expressions.
  - Add va_list support.
  - Add clutter-gtk-0.10 bindings (Gordon Allott).
  - Add gdl-1.0 bindings (Nicolas Joseph).
  - Add gstreamer-app-0.10 bindings (Sebastian Dröge).
  - Add gstreamer-cdda-0.10 bindings (Sebastian Dröge).
  - Add gudev-1.0 bindings (Jim Nelson).
  - Add libgda-report-4.0 bindings (Shawn Ferris).
  - Add libgvc (graphviz) bindings (Martin Olsson).
  - Add purple bindings (Adrien Bustany).
  - Many bug fixes and binding updates.
* debian/patches/99_ltmain_as-needed.patch: refreshed

Show diffs side-by-side

added added

removed removed

Lines of Context:
72
72
void vala_ccode_compiler_unref (gpointer instance);
73
73
GParamSpec* vala_param_spec_ccode_compiler (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
74
74
void vala_value_set_ccode_compiler (GValue* value, gpointer v_object);
 
75
void vala_value_take_ccode_compiler (GValue* value, gpointer v_object);
75
76
gpointer vala_value_get_ccode_compiler (const GValue* value);
76
77
GType vala_ccode_compiler_get_type (void);
77
78
enum  {
99
100
 
100
101
 
101
102
static gboolean vala_ccode_compiler_package_exists (const char* package_name) {
102
 
        gboolean result;
 
103
        gboolean result = FALSE;
103
104
        GError * _inner_error_;
104
105
        char* pc;
105
106
        gint exit_status = 0;
136
137
                }
137
138
        }
138
139
        __finally0:
139
 
        if (_inner_error_ != NULL) {
 
140
        {
140
141
                _g_free0 (pc);
141
142
                g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
142
143
                g_clear_error (&_inner_error_);
147
148
 
148
149
 
149
150
static char* string_strip (const char* self) {
150
 
        char* result;
 
151
        char* result = NULL;
151
152
        char* _result_;
152
153
        g_return_val_if_fail (self != NULL, NULL);
153
154
        _result_ = g_strdup (self);
165
166
        char* cmdline;
166
167
        ValaList* source_files;
167
168
        ValaList* c_source_files;
168
 
        char* _tmp28_;
169
169
        char* _tmp27_;
170
170
        char* _tmp26_;
 
171
        char* _tmp25_;
171
172
        g_return_if_fail (self != NULL);
172
173
        g_return_if_fail (context != NULL);
173
174
        _inner_error_ = NULL;
212
213
        if (use_pkgconfig) {
213
214
                {
214
215
                        gint exit_status = 0;
215
 
                        char* _tmp9_;
216
 
                        gboolean _tmp8_;
 
216
                        char* _tmp8_;
217
217
                        char* _tmp7_ = NULL;
218
 
                        _tmp8_ = g_spawn_command_line_sync (pc, &_tmp7_, NULL, &exit_status, &_inner_error_);
219
 
                        pkgflags = (_tmp9_ = _tmp7_, _g_free0 (pkgflags), _tmp9_);
220
 
                        _tmp8_;
 
218
                        g_spawn_command_line_sync (pc, &_tmp7_, NULL, &exit_status, &_inner_error_);
 
219
                        pkgflags = (_tmp8_ = _tmp7_, _g_free0 (pkgflags), _tmp8_);
221
220
                        if (_inner_error_ != NULL) {
222
221
                                if (_inner_error_->domain == G_SPAWN_ERROR) {
223
222
                                        goto __catch1_g_spawn_error;
229
228
                                return;
230
229
                        }
231
230
                        if (exit_status != 0) {
232
 
                                char* _tmp10_;
233
 
                                vala_report_error (NULL, _tmp10_ = g_strdup_printf ("pkg-config exited with status %d", exit_status));
234
 
                                _g_free0 (_tmp10_);
 
231
                                char* _tmp9_;
 
232
                                vala_report_error (NULL, _tmp9_ = g_strdup_printf ("pkg-config exited with status %d", exit_status));
 
233
                                _g_free0 (_tmp9_);
235
234
                                _g_free0 (pc);
236
235
                                _g_free0 (pkgflags);
237
236
                                return;
265
264
        }
266
265
        cmdline = g_strdup (cc_command);
267
266
        if (vala_code_context_get_debug (context)) {
 
267
                char* _tmp10_;
 
268
                cmdline = (_tmp10_ = g_strconcat (cmdline, " -g", NULL), _g_free0 (cmdline), _tmp10_);
 
269
        }
 
270
        if (vala_code_context_get_compile_only (context)) {
268
271
                char* _tmp11_;
269
 
                cmdline = (_tmp11_ = g_strconcat (cmdline, " -g", NULL), _g_free0 (cmdline), _tmp11_);
270
 
        }
271
 
        if (vala_code_context_get_compile_only (context)) {
272
 
                char* _tmp12_;
273
 
                cmdline = (_tmp12_ = g_strconcat (cmdline, " -c", NULL), _g_free0 (cmdline), _tmp12_);
 
272
                cmdline = (_tmp11_ = g_strconcat (cmdline, " -c", NULL), _g_free0 (cmdline), _tmp11_);
274
273
        } else {
275
274
                if (vala_code_context_get_output (context) != NULL) {
276
275
                        char* output;
 
276
                        gboolean _tmp12_ = FALSE;
277
277
                        gboolean _tmp13_ = FALSE;
278
 
                        gboolean _tmp14_ = FALSE;
279
 
                        char* _tmp18_;
280
278
                        char* _tmp17_;
281
279
                        char* _tmp16_;
 
280
                        char* _tmp15_;
282
281
                        output = g_strdup (vala_code_context_get_output (context));
283
282
                        if (vala_code_context_get_directory (context) != NULL) {
284
 
                                _tmp14_ = _vala_strcmp0 (vala_code_context_get_directory (context), "") != 0;
285
 
                        } else {
286
 
                                _tmp14_ = FALSE;
287
 
                        }
288
 
                        if (_tmp14_) {
289
 
                                _tmp13_ = !g_path_is_absolute (vala_code_context_get_output (context));
 
283
                                _tmp13_ = _vala_strcmp0 (vala_code_context_get_directory (context), "") != 0;
290
284
                        } else {
291
285
                                _tmp13_ = FALSE;
292
286
                        }
293
287
                        if (_tmp13_) {
294
 
                                char* _tmp15_;
295
 
                                output = (_tmp15_ = g_strdup_printf ("%s%c%s", vala_code_context_get_directory (context), (gint) G_DIR_SEPARATOR, vala_code_context_get_output (context)), _g_free0 (output), _tmp15_);
296
 
                        }
297
 
                        cmdline = (_tmp18_ = g_strconcat (cmdline, _tmp17_ = g_strconcat (" -o ", _tmp16_ = g_shell_quote (output), NULL), NULL), _g_free0 (cmdline), _tmp18_);
298
 
                        _g_free0 (_tmp17_);
 
288
                                _tmp12_ = !g_path_is_absolute (vala_code_context_get_output (context));
 
289
                        } else {
 
290
                                _tmp12_ = FALSE;
 
291
                        }
 
292
                        if (_tmp12_) {
 
293
                                char* _tmp14_;
 
294
                                output = (_tmp14_ = g_strdup_printf ("%s%c%s", vala_code_context_get_directory (context), (gint) G_DIR_SEPARATOR, vala_code_context_get_output (context)), _g_free0 (output), _tmp14_);
 
295
                        }
 
296
                        cmdline = (_tmp17_ = g_strconcat (cmdline, _tmp16_ = g_strconcat (" -o ", _tmp15_ = g_shell_quote (output), NULL), NULL), _g_free0 (cmdline), _tmp17_);
299
297
                        _g_free0 (_tmp16_);
 
298
                        _g_free0 (_tmp15_);
300
299
                        _g_free0 (output);
301
300
                }
302
301
        }
311
310
                        }
312
311
                        file = (ValaSourceFile*) vala_iterator_get (_file_it);
313
312
                        if (!vala_source_file_get_external_package (file)) {
314
 
                                char* _tmp22_;
315
313
                                char* _tmp21_;
316
314
                                char* _tmp20_;
317
315
                                char* _tmp19_;
318
 
                                cmdline = (_tmp22_ = g_strconcat (cmdline, _tmp21_ = g_strconcat (" ", _tmp20_ = g_shell_quote (_tmp19_ = vala_source_file_get_csource_filename (file)), NULL), NULL), _g_free0 (cmdline), _tmp22_);
319
 
                                _g_free0 (_tmp21_);
 
316
                                char* _tmp18_;
 
317
                                cmdline = (_tmp21_ = g_strconcat (cmdline, _tmp20_ = g_strconcat (" ", _tmp19_ = g_shell_quote (_tmp18_ = vala_source_file_get_csource_filename (file)), NULL), NULL), _g_free0 (cmdline), _tmp21_);
320
318
                                _g_free0 (_tmp20_);
321
319
                                _g_free0 (_tmp19_);
 
320
                                _g_free0 (_tmp18_);
322
321
                        }
323
322
                        _vala_source_file_unref0 (file);
324
323
                }
330
329
                _file_it = vala_iterable_iterator ((ValaIterable*) c_source_files);
331
330
                while (TRUE) {
332
331
                        char* file;
333
 
                        char* _tmp25_;
334
332
                        char* _tmp24_;
335
333
                        char* _tmp23_;
 
334
                        char* _tmp22_;
336
335
                        if (!vala_iterator_next (_file_it)) {
337
336
                                break;
338
337
                        }
339
338
                        file = (char*) vala_iterator_get (_file_it);
340
 
                        cmdline = (_tmp25_ = g_strconcat (cmdline, _tmp24_ = g_strconcat (" ", _tmp23_ = g_shell_quote (file), NULL), NULL), _g_free0 (cmdline), _tmp25_);
341
 
                        _g_free0 (_tmp24_);
 
339
                        cmdline = (_tmp24_ = g_strconcat (cmdline, _tmp23_ = g_strconcat (" ", _tmp22_ = g_shell_quote (file), NULL), NULL), _g_free0 (cmdline), _tmp24_);
342
340
                        _g_free0 (_tmp23_);
 
341
                        _g_free0 (_tmp22_);
343
342
                        _g_free0 (file);
344
343
                }
345
344
                _vala_collection_object_unref0 (_file_it);
346
345
        }
347
 
        cmdline = (_tmp28_ = g_strconcat (cmdline, _tmp27_ = g_strconcat (" ", _tmp26_ = string_strip (pkgflags), NULL), NULL), _g_free0 (cmdline), _tmp28_);
348
 
        _g_free0 (_tmp27_);
 
346
        cmdline = (_tmp27_ = g_strconcat (cmdline, _tmp26_ = g_strconcat (" ", _tmp25_ = string_strip (pkgflags), NULL), NULL), _g_free0 (cmdline), _tmp27_);
349
347
        _g_free0 (_tmp26_);
 
348
        _g_free0 (_tmp25_);
350
349
        {
351
350
                char** cc_option_collection;
352
351
                int cc_option_collection_length1;
357
356
                        char* cc_option;
358
357
                        cc_option = g_strdup (cc_option_collection[cc_option_it]);
359
358
                        {
360
 
                                char* _tmp31_;
361
359
                                char* _tmp30_;
362
360
                                char* _tmp29_;
363
 
                                cmdline = (_tmp31_ = g_strconcat (cmdline, _tmp30_ = g_strconcat (" ", _tmp29_ = g_shell_quote (cc_option), NULL), NULL), _g_free0 (cmdline), _tmp31_);
364
 
                                _g_free0 (_tmp30_);
 
361
                                char* _tmp28_;
 
362
                                cmdline = (_tmp30_ = g_strconcat (cmdline, _tmp29_ = g_strconcat (" ", _tmp28_ = g_shell_quote (cc_option), NULL), NULL), _g_free0 (cmdline), _tmp30_);
365
363
                                _g_free0 (_tmp29_);
 
364
                                _g_free0 (_tmp28_);
366
365
                                _g_free0 (cc_option);
367
366
                        }
368
367
                }
387
386
                        return;
388
387
                }
389
388
                if (exit_status != 0) {
390
 
                        char* _tmp32_;
391
 
                        vala_report_error (NULL, _tmp32_ = g_strdup_printf ("cc exited with status %d", exit_status));
392
 
                        _g_free0 (_tmp32_);
 
389
                        char* _tmp31_;
 
390
                        vala_report_error (NULL, _tmp31_ = g_strdup_printf ("cc exited with status %d", exit_status));
 
391
                        _g_free0 (_tmp31_);
393
392
                }
394
393
        }
395
394
        goto __finally2;
425
424
                        file = (ValaSourceFile*) vala_iterator_get (_file_it);
426
425
                        if (!vala_source_file_get_external_package (file)) {
427
426
                                if (!vala_code_context_get_save_csources (context)) {
428
 
                                        char* _tmp33_;
429
 
                                        g_unlink (_tmp33_ = vala_source_file_get_csource_filename (file));
430
 
                                        _g_free0 (_tmp33_);
 
427
                                        char* _tmp32_;
 
428
                                        g_unlink (_tmp32_ = vala_source_file_get_csource_filename (file));
 
429
                                        _g_free0 (_tmp32_);
431
430
                                }
432
431
                        }
433
432
                        _vala_source_file_unref0 (file);
535
534
}
536
535
 
537
536
 
 
537
void vala_value_take_ccode_compiler (GValue* value, gpointer v_object) {
 
538
        ValaCCodeCompiler* old;
 
539
        g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, VALA_TYPE_CCODE_COMPILER));
 
540
        old = value->data[0].v_pointer;
 
541
        if (v_object) {
 
542
                g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, VALA_TYPE_CCODE_COMPILER));
 
543
                g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
 
544
                value->data[0].v_pointer = v_object;
 
545
        } else {
 
546
                value->data[0].v_pointer = NULL;
 
547
        }
 
548
        if (old) {
 
549
                vala_ccode_compiler_unref (old);
 
550
        }
 
551
}
 
552
 
 
553
 
538
554
static void vala_ccode_compiler_class_init (ValaCCodeCompilerClass * klass) {
539
555
        vala_ccode_compiler_parent_class = g_type_class_peek_parent (klass);
540
556
        VALA_CCODE_COMPILER_CLASS (klass)->finalize = vala_ccode_compiler_finalize;
553
569
 
554
570
 
555
571
GType vala_ccode_compiler_get_type (void) {
556
 
        static GType vala_ccode_compiler_type_id = 0;
557
 
        if (vala_ccode_compiler_type_id == 0) {
 
572
        static volatile gsize vala_ccode_compiler_type_id__volatile = 0;
 
573
        if (g_once_init_enter (&vala_ccode_compiler_type_id__volatile)) {
558
574
                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 };
559
575
                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 };
560
576
                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) };
 
577
                GType vala_ccode_compiler_type_id;
561
578
                vala_ccode_compiler_type_id = g_type_register_fundamental (g_type_fundamental_next (), "ValaCCodeCompiler", &g_define_type_info, &g_define_type_fundamental_info, 0);
 
579
                g_once_init_leave (&vala_ccode_compiler_type_id__volatile, vala_ccode_compiler_type_id);
562
580
        }
563
 
        return vala_ccode_compiler_type_id;
 
581
        return vala_ccode_compiler_type_id__volatile;
564
582
}
565
583
 
566
584