~ubuntu-branches/ubuntu/quantal/vala/quantal

« back to all changes in this revision

Viewing changes to ccode/valaccodefile.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Terry
  • Date: 2011-01-18 09:51:15 UTC
  • mfrom: (1.5.14 upstream)
  • Revision ID: james.westby@ubuntu.com-20110118095115-r2jr7c63lr0jzj0y
Tags: 0.11.4-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 
4
4
/* valaccodefile.vala
5
5
 *
6
 
 * Copyright (C) 2009-2010  Jürg Billeter
 
6
 * Copyright (C) 2009-2011  Jürg Billeter
7
7
 *
8
8
 * This library is free software; you can redistribute it and/or
9
9
 * modify it under the terms of the GNU Lesser General Public
219
219
void vala_ccode_function_set_is_declaration (ValaCCodeFunction* self, gboolean value);
220
220
void vala_ccode_file_add_function (ValaCCodeFile* self, ValaCCodeFunction* func);
221
221
ValaList* vala_ccode_file_get_symbols (ValaCCodeFile* self);
 
222
static void vala_ccode_file_get_symbols_from_fragment (ValaCCodeFile* self, ValaList* symbols, ValaCCodeFragment* fragment);
222
223
ValaList* vala_ccode_fragment_get_children (ValaCCodeFragment* self);
223
224
const gchar* vala_ccode_function_get_name (ValaCCodeFunction* self);
224
225
static gchar* vala_ccode_file_get_define_for_filename (const gchar* filename);
352
353
}
353
354
 
354
355
 
355
 
static gpointer _vala_ccode_node_ref0 (gpointer self) {
356
 
        return self ? vala_ccode_node_ref (self) : NULL;
357
 
}
358
 
 
359
 
 
360
356
ValaList* vala_ccode_file_get_symbols (ValaCCodeFile* self) {
361
357
        ValaList* result = NULL;
362
358
        ValaArrayList* _tmp0_ = NULL;
364
360
        g_return_val_if_fail (self != NULL, NULL);
365
361
        _tmp0_ = vala_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, g_direct_equal);
366
362
        symbols = _tmp0_;
 
363
        vala_ccode_file_get_symbols_from_fragment (self, (ValaList*) symbols, self->priv->type_member_declaration);
 
364
        result = (ValaList*) symbols;
 
365
        return result;
 
366
}
 
367
 
 
368
 
 
369
static gpointer _vala_ccode_node_ref0 (gpointer self) {
 
370
        return self ? vala_ccode_node_ref (self) : NULL;
 
371
}
 
372
 
 
373
 
 
374
static void vala_ccode_file_get_symbols_from_fragment (ValaCCodeFile* self, ValaList* symbols, ValaCCodeFragment* fragment) {
 
375
        g_return_if_fail (self != NULL);
 
376
        g_return_if_fail (symbols != NULL);
 
377
        g_return_if_fail (fragment != NULL);
367
378
        {
368
 
                ValaList* _tmp1_ = NULL;
 
379
                ValaList* _tmp0_ = NULL;
369
380
                ValaList* _node_list;
370
 
                gint _tmp2_;
 
381
                gint _tmp1_;
371
382
                gint _node_size;
372
383
                gint _node_index;
373
 
                _tmp1_ = vala_ccode_fragment_get_children (self->priv->type_member_declaration);
374
 
                _node_list = _tmp1_;
375
 
                _tmp2_ = vala_collection_get_size ((ValaCollection*) _node_list);
376
 
                _node_size = _tmp2_;
 
384
                _tmp0_ = vala_ccode_fragment_get_children (fragment);
 
385
                _node_list = _tmp0_;
 
386
                _tmp1_ = vala_collection_get_size ((ValaCollection*) _node_list);
 
387
                _node_size = _tmp1_;
377
388
                _node_index = -1;
378
389
                while (TRUE) {
379
 
                        gpointer _tmp3_ = NULL;
 
390
                        gpointer _tmp2_ = NULL;
380
391
                        ValaCCodeNode* node;
381
 
                        ValaCCodeNode* _tmp4_;
382
 
                        ValaCCodeFunction* _tmp5_;
383
 
                        ValaCCodeFunction* func;
384
392
                        _node_index = _node_index + 1;
385
393
                        if (!(_node_index < _node_size)) {
386
394
                                break;
387
395
                        }
388
 
                        _tmp3_ = vala_list_get (_node_list, _node_index);
389
 
                        node = (ValaCCodeNode*) _tmp3_;
390
 
                        _tmp5_ = _vala_ccode_node_ref0 ((_tmp4_ = node, VALA_IS_CCODE_FUNCTION (_tmp4_) ? ((ValaCCodeFunction*) _tmp4_) : NULL));
391
 
                        func = _tmp5_;
392
 
                        if (func != NULL) {
393
 
                                const gchar* _tmp6_ = NULL;
394
 
                                _tmp6_ = vala_ccode_function_get_name (func);
395
 
                                vala_collection_add ((ValaCollection*) symbols, _tmp6_);
 
396
                        _tmp2_ = vala_list_get (_node_list, _node_index);
 
397
                        node = (ValaCCodeNode*) _tmp2_;
 
398
                        if (VALA_IS_CCODE_FRAGMENT (node)) {
 
399
                                vala_ccode_file_get_symbols_from_fragment (self, symbols, VALA_CCODE_FRAGMENT (node));
 
400
                        } else {
 
401
                                ValaCCodeNode* _tmp3_;
 
402
                                ValaCCodeFunction* _tmp4_;
 
403
                                ValaCCodeFunction* func;
 
404
                                _tmp4_ = _vala_ccode_node_ref0 ((_tmp3_ = node, VALA_IS_CCODE_FUNCTION (_tmp3_) ? ((ValaCCodeFunction*) _tmp3_) : NULL));
 
405
                                func = _tmp4_;
 
406
                                if (func != NULL) {
 
407
                                        const gchar* _tmp5_ = NULL;
 
408
                                        _tmp5_ = vala_ccode_function_get_name (func);
 
409
                                        vala_collection_add ((ValaCollection*) symbols, _tmp5_);
 
410
                                }
 
411
                                _vala_ccode_node_unref0 (func);
396
412
                        }
397
 
                        _vala_ccode_node_unref0 (func);
398
413
                        _vala_ccode_node_unref0 (node);
399
414
                }
400
415
                _vala_iterable_unref0 (_node_list);
401
416
        }
402
 
        result = (ValaList*) symbols;
403
 
        return result;
404
417
}
405
418
 
406
419
 
407
 
static gunichar string_get_char (const gchar* self, gint index) {
 
420
static gunichar string_get_char (const gchar* self, glong index) {
408
421
        gunichar result = 0U;
409
422
        gunichar _tmp0_;
410
423
        g_return_val_if_fail (self != NULL, 0U);
439
452
                if (!(_tmp2_ > 0)) {
440
453
                        break;
441
454
                }
442
 
                _tmp3_ = string_get_char (i, 0);
 
455
                _tmp3_ = string_get_char (i, (glong) 0);
443
456
                c = _tmp3_;
444
457
                _tmp5_ = g_unichar_isalnum (c);
445
458
                if (_tmp5_) {