873
873
* @param is_source true to force adding the file as .vala or .gs
874
874
* @return false if the file is not recognized or the file does not exist
876
static gchar* string_substring (const gchar* self, glong offset, glong len) {
877
gchar* result = NULL;
880
gchar* _tmp1_ = NULL;
881
g_return_val_if_fail (self != NULL, NULL);
882
_tmp0_ = strlen (self);
883
string_length = (glong) _tmp0_;
885
offset = string_length + offset;
886
g_return_val_if_fail (offset >= 0, NULL);
888
g_return_val_if_fail (offset <= string_length, NULL);
891
len = string_length - offset;
893
g_return_val_if_fail ((offset + len) <= string_length, NULL);
894
_tmp1_ = g_strndup (((gchar*) self) + offset, (gsize) len);
876
900
gboolean vala_code_context_add_source_filename (ValaCodeContext* self, const gchar* filename, gboolean is_source) {
877
901
gboolean result = FALSE;
995
1019
vala_code_context_add_source_file (self, source_file);
996
1020
_tmp28_ = strlen (filename);
997
1021
_tmp29_ = strlen (".vapi");
998
_tmp30_ = g_strndup (filename, (gsize) (_tmp28_ - _tmp29_));
1022
_tmp30_ = string_substring (filename, (glong) 0, (glong) (_tmp28_ - _tmp29_));
999
1023
_tmp31_ = _tmp30_;
1000
1024
_tmp32_ = g_strdup_printf ("%s.deps", _tmp31_);
1001
1025
deps_filename = (_tmp33_ = _tmp32_, _g_free0 (_tmp31_), _tmp33_);
1329
static const gchar* string_offset (const gchar* self, glong offset) {
1330
const gchar* result = NULL;
1331
g_return_val_if_fail (self != NULL, NULL);
1332
result = (const gchar*) (((gchar*) self) + offset);
1337
static gunichar string_get_char (const gchar* self, gint index) {
1353
static gunichar string_get_char (const gchar* self, glong index) {
1338
1354
gunichar result = 0U;
1339
1355
gunichar _tmp0_;
1340
1356
g_return_val_if_fail (self != NULL, 0U);
1347
1363
static gboolean vala_code_context_ends_with_dir_separator (const gchar* s) {
1348
1364
gboolean result = FALSE;
1350
const gchar* _tmp1_ = NULL;
1353
1368
g_return_val_if_fail (s != NULL, FALSE);
1354
1369
_tmp0_ = strlen (s);
1355
_tmp1_ = string_offset (s, (glong) (_tmp0_ - 1));
1356
_tmp2_ = string_get_char (_tmp1_, 0);
1357
_tmp3_ = G_IS_DIR_SEPARATOR (_tmp2_);
1363
static gchar* string_substring (const gchar* self, glong offset, glong len) {
1364
gchar* result = NULL;
1366
glong string_length;
1367
const gchar* _tmp1_ = NULL;
1369
const gchar* _tmp2_ = NULL;
1370
gchar* _tmp3_ = NULL;
1371
g_return_val_if_fail (self != NULL, NULL);
1372
_tmp0_ = strlen (self);
1373
string_length = (glong) _tmp0_;
1375
offset = string_length + offset;
1376
g_return_val_if_fail (offset >= 0, NULL);
1378
g_return_val_if_fail (offset <= string_length, NULL);
1381
len = string_length - offset;
1383
g_return_val_if_fail ((offset + len) <= string_length, NULL);
1384
_tmp1_ = string_offset (self, offset);
1386
_tmp2_ = string_offset (start, len);
1387
_tmp3_ = g_strndup (start, ((gchar*) _tmp2_) - ((gchar*) start));
1393
static glong string_pointer_to_offset (const gchar* self, const gchar* pos) {
1395
g_return_val_if_fail (self != NULL, 0L);
1396
g_return_val_if_fail (pos != NULL, 0L);
1397
result = (glong) (((gchar*) pos) - ((gchar*) self));
1370
_tmp1_ = string_get_char (s, (glong) (_tmp0_ - 1));
1371
_tmp2_ = G_IS_DIR_SEPARATOR (_tmp1_);
1428
1402
const gchar* _tmp3_ = NULL;
1430
gchar* _tmp5_ = NULL;
1403
gchar* _tmp4_ = NULL;
1432
1405
_tmp3_ = g_path_skip_root (name);
1435
_tmp4_ = string_pointer_to_offset (name, start);
1436
_tmp5_ = string_substring (name, (glong) 0, _tmp4_);
1408
_tmp4_ = string_substring (name, (glong) 0, (glong) ((gint) (((gchar*) start) - ((gchar*) name))));
1438
1410
_g_free0 (rpath);
1441
_tmp7_ = g_path_skip_root (rpath);
1442
_tmp8_ = string_pointer_to_offset (rpath, _tmp7_);
1413
_tmp6_ = g_path_skip_root (rpath);
1414
root_len = (glong) (((gchar*) _tmp6_) - ((gchar*) rpath));
1454
_tmp10_ = string_get_char (start, 0);
1455
if (!(_tmp10_ != 0)) {
1425
_tmp8_ = string_get_char (start, (glong) 0);
1426
if (!(_tmp8_ != 0)) {
1461
const gchar* _tmp13_ = NULL;
1462
_tmp11_ = string_get_char (start, 0);
1463
_tmp12_ = G_IS_DIR_SEPARATOR (_tmp11_);
1432
const gchar* _tmp11_ = NULL;
1433
_tmp9_ = string_get_char (start, (glong) 0);
1434
_tmp10_ = G_IS_DIR_SEPARATOR (_tmp9_);
1467
_tmp13_ = g_utf8_next_char (start);
1438
_tmp11_ = g_utf8_next_char (start);
1470
1441
len = (glong) 0;
1476
gboolean _tmp16_ = FALSE;
1447
gboolean _tmp14_ = FALSE;
1450
const gchar* _tmp13_ = NULL;
1451
_tmp13_ = g_utf8_next_char (end);
1455
_tmp15_ = string_get_char (end, (glong) 0);
1459
_tmp16_ = string_get_char (end, (glong) 0);
1460
_tmp17_ = G_IS_DIR_SEPARATOR (_tmp16_);
1478
1465
if (!_tmp14_) {
1479
const gchar* _tmp15_ = NULL;
1480
_tmp15_ = g_utf8_next_char (end);
1484
_tmp17_ = string_get_char (end, 0);
1488
_tmp18_ = string_get_char (end, 0);
1489
_tmp19_ = G_IS_DIR_SEPARATOR (_tmp18_);
1500
1471
if (len == 0) {
1503
gboolean _tmp20_ = FALSE;
1474
gboolean _tmp18_ = FALSE;
1504
1475
if (len == 1) {
1506
_tmp21_ = string_get_char (start, 0);
1507
_tmp20_ = _tmp21_ == '.';
1477
_tmp19_ = string_get_char (start, (glong) 0);
1478
_tmp18_ = _tmp19_ == '.';
1513
gboolean _tmp22_ = FALSE;
1484
gboolean _tmp20_ = FALSE;
1514
1485
if (len == 2) {
1516
_tmp23_ = g_str_has_prefix (start, "..");
1487
_tmp21_ = g_str_has_prefix (start, "..");
1523
_tmp24_ = strlen (rpath);
1524
if (_tmp24_ > root_len) {
1494
_tmp22_ = strlen (rpath);
1495
if (_tmp22_ > root_len) {
1530
gchar* _tmp28_ = NULL;
1534
_tmp26_ = vala_code_context_ends_with_dir_separator (rpath);
1501
gchar* _tmp26_ = NULL;
1505
_tmp24_ = vala_code_context_ends_with_dir_separator (rpath);
1540
_tmp27_ = strlen (rpath);
1541
_tmp28_ = string_substring (rpath, (glong) 0, (glong) (_tmp27_ - 1));
1511
_tmp25_ = strlen (rpath);
1512
_tmp26_ = string_substring (rpath, (glong) 0, (glong) (_tmp25_ - 1));
1543
1514
_g_free0 (rpath);
1550
gchar* _tmp32_ = NULL;
1553
_tmp30_ = vala_code_context_ends_with_dir_separator (rpath);
1556
_tmp31_ = g_strconcat (rpath, G_DIR_SEPARATOR_S, NULL);
1521
gchar* _tmp30_ = NULL;
1524
_tmp28_ = vala_code_context_ends_with_dir_separator (rpath);
1527
_tmp29_ = g_strconcat (rpath, G_DIR_SEPARATOR_S, NULL);
1557
1528
_g_free0 (rpath);
1560
_tmp32_ = string_substring (start, (glong) 0, len);
1562
_tmp34_ = g_strconcat (rpath, _tmp33_, NULL);
1531
_tmp30_ = string_substring (start, (glong) 0, len);
1533
_tmp32_ = g_strconcat (rpath, _tmp31_, NULL);
1563
1534
_g_free0 (rpath);
1571
_tmp36_ = strlen (rpath);
1572
if (_tmp36_ > root_len) {
1574
_tmp37_ = vala_code_context_ends_with_dir_separator (rpath);
1542
_tmp34_ = strlen (rpath);
1543
if (_tmp34_ > root_len) {
1545
_tmp35_ = vala_code_context_ends_with_dir_separator (rpath);
1581
gchar* _tmp39_ = NULL;
1583
_tmp38_ = strlen (rpath);
1584
_tmp39_ = string_substring (rpath, (glong) 0, (glong) (_tmp38_ - 1));
1552
gchar* _tmp37_ = NULL;
1554
_tmp36_ = strlen (rpath);
1555
_tmp37_ = string_substring (rpath, (glong) 0, (glong) (_tmp36_ - 1));
1586
1557
_g_free0 (rpath);
1589
1560
if (G_DIR_SEPARATOR != '/') {
1591
gchar** _tmp42_ = NULL;
1562
gchar** _tmp40_ = NULL;
1592
1563
gint components_length1;
1593
1564
gint _components_size_;
1595
1566
gchar** components;
1596
gchar* _tmp44_ = NULL;
1598
_tmp42_ = _tmp41_ = g_strsplit (rpath, "\\", 0);
1567
gchar* _tmp42_ = NULL;
1569
_tmp40_ = _tmp39_ = g_strsplit (rpath, "\\", 0);
1571
components_length1 = _vala_array_length (_tmp39_);
1572
_components_size_ = components_length1;
1573
components = _tmp41_;
1574
_tmp42_ = g_strjoinv ("/", components);
1599
1575
_tmp43_ = _tmp42_;
1600
components_length1 = _vala_array_length (_tmp41_);
1601
_components_size_ = components_length1;
1602
components = _tmp43_;
1603
_tmp44_ = g_strjoinv ("/", components);
1605
1576
_g_free0 (rpath);
1607
1578
components = (_vala_array_free (components, components_length1, (GDestroyNotify) g_free), NULL);
1609
1580
result = rpath;