719
719
if (path == NULL) {
720
720
gchar* _tmp2_ = NULL;
722
721
_tmp2_ = vala_code_context_get_gir_path (self, pkg);
727
725
if (path == NULL) {
728
gchar* _tmp4_ = NULL;
730
_tmp4_ = g_strdup_printf ("Package `%s' not found in specified Vala API directories or GObject-In" \
726
gchar* _tmp3_ = NULL;
728
_tmp3_ = g_strdup_printf ("Package `%s' not found in specified Vala API directories or GObject-In" \
731
729
"trospection GIR directories", pkg);
733
vala_report_error (NULL, _tmp5_);
731
vala_report_error (NULL, _tmp4_);
739
737
vala_code_context_add_package (self, pkg);
740
_tmp6_ = vala_source_file_new (self, VALA_SOURCE_FILE_TYPE_PACKAGE, path, NULL);
742
vala_code_context_add_source_file (self, _tmp7_);
743
_vala_source_file_unref0 (_tmp7_);
744
_tmp8_ = g_path_get_dirname (path);
746
_tmp10_ = g_strdup_printf ("%s.deps", pkg);
748
_tmp12_ = g_build_filename (_tmp9_, _tmp11_, NULL);
749
deps_filename = (_tmp13_ = _tmp12_, _g_free0 (_tmp11_), _g_free0 (_tmp9_), _tmp13_);
750
_tmp14_ = vala_code_context_add_packages_from_file (self, deps_filename);
738
_tmp5_ = vala_source_file_new (self, VALA_SOURCE_FILE_TYPE_PACKAGE, path, NULL);
740
vala_code_context_add_source_file (self, _tmp6_);
741
_vala_source_file_unref0 (_tmp6_);
742
_tmp7_ = g_path_get_dirname (path);
744
_tmp9_ = g_strdup_printf ("%s.deps", pkg);
746
_tmp11_ = g_build_filename (_tmp8_, _tmp10_, NULL);
750
deps_filename = _tmp12_;
751
_tmp13_ = vala_code_context_add_packages_from_file (self, deps_filename);
753
754
_g_free0 (deps_filename);
872
871
* @param is_source true to force adding the file as .vala or .gs
873
872
* @return false if the file is not recognized or the file does not exist
874
static glong string_strnlen (gchar* str, glong maxlen) {
876
gchar* _tmp0_ = NULL;
878
_tmp0_ = memchr (str, 0, (gsize) maxlen);
884
result = (glong) (end - str);
875
890
static gchar* string_substring (const gchar* self, glong offset, glong len) {
876
891
gchar* result = NULL;
877
892
glong string_length = 0L;
960
975
_tmp9_ = vala_unresolved_symbol_new (NULL, "Posix", NULL);
961
976
_tmp10_ = _tmp9_;
962
977
_tmp11_ = vala_using_directive_new ((ValaSymbol*) _tmp10_, NULL);
963
ns_ref = (_tmp12_ = _tmp11_, _vala_code_node_unref0 (_tmp10_), _tmp12_);
979
_vala_code_node_unref0 (_tmp10_);
964
981
vala_source_file_add_using_directive (source_file, ns_ref);
965
982
_tmp13_ = vala_code_context_get_root (self);
966
983
vala_namespace_add_using_directive (_tmp13_, ns_ref);
976
993
_tmp14_ = vala_unresolved_symbol_new (NULL, "GLib", NULL);
977
994
_tmp15_ = _tmp14_;
978
995
_tmp16_ = vala_using_directive_new ((ValaSymbol*) _tmp15_, NULL);
979
ns_ref = (_tmp17_ = _tmp16_, _vala_code_node_unref0 (_tmp15_), _tmp17_);
997
_vala_code_node_unref0 (_tmp15_);
980
999
vala_source_file_add_using_directive (source_file, ns_ref);
981
1000
_tmp18_ = vala_code_context_get_root (self);
982
1001
vala_namespace_add_using_directive (_tmp18_, ns_ref);
992
1011
_tmp19_ = vala_unresolved_symbol_new (NULL, "Dova", NULL);
993
1012
_tmp20_ = _tmp19_;
994
1013
_tmp21_ = vala_using_directive_new ((ValaSymbol*) _tmp20_, NULL);
995
ns_ref = (_tmp22_ = _tmp21_, _vala_code_node_unref0 (_tmp20_), _tmp22_);
1015
_vala_code_node_unref0 (_tmp20_);
996
1017
vala_source_file_add_using_directive (source_file, ns_ref);
997
1018
_tmp23_ = vala_code_context_get_root (self);
998
1019
vala_namespace_add_using_directive (_tmp23_, ns_ref);
1142
1165
gchar* vala_code_context_get_vapi_path (ValaCodeContext* self, const gchar* pkg) {
1143
1166
gchar* result = NULL;
1145
gchar* _tmp1_ = NULL;
1169
gchar* _tmp2_ = NULL;
1148
1172
g_return_val_if_fail (self != NULL, NULL);
1149
1173
g_return_val_if_fail (pkg != NULL, NULL);
1150
1174
_tmp0_ = g_strconcat (pkg, ".vapi", NULL);
1151
_tmp1_ = vala_code_context_get_file_path (self, _tmp0_, "vala" PACKAGE_SUFFIX "/vapi", "vala/vapi", self->vapi_directories, self->vapi_directories_length1);
1152
path = (_tmp2_ = _tmp1_, _g_free0 (_tmp0_), _tmp2_);
1176
_tmp2_ = vala_code_context_get_file_path (self, _tmp1_, "vala" PACKAGE_SUFFIX "/vapi", "vala/vapi", self->vapi_directories, self->vapi_directories_length1);
1153
1180
if (path == NULL) {
1155
gchar* _tmp4_ = NULL;
1183
gchar* _tmp6_ = NULL;
1157
1185
gchar* filename;
1159
_tmp3_ = g_strconcat (pkg, ".vapi", NULL);
1160
_tmp4_ = g_build_filename (PACKAGE_DATADIR, "vapi", _tmp3_, NULL);
1161
filename = (_tmp5_ = _tmp4_, _g_free0 (_tmp3_), _tmp5_);
1162
_tmp6_ = g_file_test (filename, G_FILE_TEST_EXISTS);
1166
_tmp7_ = g_strdup (filename);
1187
_tmp4_ = g_strconcat (pkg, ".vapi", NULL);
1189
_tmp6_ = g_build_filename (PACKAGE_DATADIR, "vapi", _tmp5_, NULL);
1193
_tmp8_ = g_file_test (filename, G_FILE_TEST_EXISTS);
1196
_tmp9_ = g_strdup (filename);
1168
1197
_g_free0 (path);
1171
1200
_g_free0 (filename);
1178
1207
gchar* vala_code_context_get_gir_path (ValaCodeContext* self, const gchar* gir) {
1179
1208
gchar* result = NULL;
1181
gchar* _tmp1_ = NULL;
1211
gchar* _tmp2_ = NULL;
1183
1213
g_return_val_if_fail (self != NULL, NULL);
1184
1214
g_return_val_if_fail (gir != NULL, NULL);
1185
1215
_tmp0_ = g_strconcat (gir, ".gir", NULL);
1186
_tmp1_ = vala_code_context_get_file_path (self, _tmp0_, "gir-1.0", NULL, self->gir_directories, self->gir_directories_length1);
1187
result = (_tmp2_ = _tmp1_, _g_free0 (_tmp0_), _tmp2_);
1217
_tmp2_ = vala_code_context_get_file_path (self, _tmp1_, "gir-1.0", NULL, self->gir_directories, self->gir_directories_length1);
1232
_tmp5_ = _tmp4_ = g_get_system_data_dirs ();
1263
_tmp4_ = _tmp3_ = g_get_system_data_dirs ();
1234
1265
gchar** dir_collection;
1235
1266
int dir_collection_length1;
1237
dir_collection = _tmp5_;
1238
dir_collection_length1 = _vala_array_length (_tmp4_);
1239
for (dir_it = 0; dir_it < _vala_array_length (_tmp4_); dir_it = dir_it + 1) {
1268
dir_collection = _tmp4_;
1269
dir_collection_length1 = _vala_array_length (_tmp3_);
1270
for (dir_it = 0; dir_it < _vala_array_length (_tmp3_); dir_it = dir_it + 1) {
1242
_tmp6_ = g_strdup (dir_collection[dir_it]);
1273
_tmp5_ = g_strdup (dir_collection[dir_it]);
1245
gchar* _tmp7_ = NULL;
1248
_tmp7_ = g_build_filename (dir, versioned_data_dir, basename, NULL);
1276
gchar* _tmp6_ = NULL;
1278
_tmp6_ = g_build_filename (dir, versioned_data_dir, basename, NULL);
1250
1279
_g_free0 (filename);
1252
_tmp9_ = g_file_test (filename, G_FILE_TEST_EXISTS);
1281
_tmp7_ = g_file_test (filename, G_FILE_TEST_EXISTS);
1254
1283
result = filename;
1255
1284
_g_free0 (dir);
1262
1291
if (data_dir != NULL) {
1264
gchar** _tmp11_ = NULL;
1265
_tmp11_ = _tmp10_ = g_get_system_data_dirs ();
1293
gchar** _tmp9_ = NULL;
1294
_tmp9_ = _tmp8_ = g_get_system_data_dirs ();
1267
1296
gchar** dir_collection;
1268
1297
int dir_collection_length1;
1270
dir_collection = _tmp11_;
1271
dir_collection_length1 = _vala_array_length (_tmp10_);
1272
for (dir_it = 0; dir_it < _vala_array_length (_tmp10_); dir_it = dir_it + 1) {
1299
dir_collection = _tmp9_;
1300
dir_collection_length1 = _vala_array_length (_tmp8_);
1301
for (dir_it = 0; dir_it < _vala_array_length (_tmp8_); dir_it = dir_it + 1) {
1275
_tmp12_ = g_strdup (dir_collection[dir_it]);
1304
_tmp10_ = g_strdup (dir_collection[dir_it]);
1278
gchar* _tmp13_ = NULL;
1281
_tmp13_ = g_build_filename (dir, data_dir, basename, NULL);
1307
gchar* _tmp11_ = NULL;
1309
_tmp11_ = g_build_filename (dir, data_dir, basename, NULL);
1283
1310
_g_free0 (filename);
1285
_tmp15_ = g_file_test (filename, G_FILE_TEST_EXISTS);
1312
_tmp12_ = g_file_test (filename, G_FILE_TEST_EXISTS);
1287
1314
result = filename;
1288
1315
_g_free0 (dir);
1391
1418
const gchar* start = NULL;
1392
1419
const gchar* end = NULL;
1393
1420
gboolean _tmp0_;
1394
const gchar* _tmp6_ = NULL;
1421
const gchar* _tmp4_ = NULL;
1395
1422
glong root_len;
1396
gboolean _tmp33_ = FALSE;
1423
gboolean _tmp30_ = FALSE;
1398
1425
g_return_val_if_fail (name != NULL, NULL);
1399
1426
_tmp0_ = g_path_is_absolute (name);
1401
1428
gchar* _tmp1_ = NULL;
1403
1429
_tmp1_ = g_get_current_dir ();
1405
1430
_g_free0 (rpath);
1410
const gchar* _tmp3_ = NULL;
1411
gchar* _tmp4_ = NULL;
1413
_tmp3_ = g_path_skip_root (name);
1435
const gchar* _tmp2_ = NULL;
1436
gchar* _tmp3_ = NULL;
1437
_tmp2_ = g_path_skip_root (name);
1416
_tmp4_ = string_substring (name, (glong) 0, (glong) ((gint) (((gchar*) start) - ((gchar*) name))));
1440
_tmp3_ = string_substring (name, (glong) 0, (glong) ((gint) (((gchar*) start) - ((gchar*) name))));
1418
1441
_g_free0 (rpath);
1421
_tmp6_ = g_path_skip_root (rpath);
1422
root_len = (glong) (((gchar*) _tmp6_) - ((gchar*) rpath));
1444
_tmp4_ = g_path_skip_root (rpath);
1445
root_len = (glong) (((gchar*) _tmp4_) - ((gchar*) rpath));
1433
_tmp8_ = string_get_char (start, (glong) 0);
1434
if (!(_tmp8_ != 0)) {
1456
_tmp6_ = string_get_char (start, (glong) 0);
1457
if (!(_tmp6_ != 0)) {
1440
const gchar* _tmp11_ = NULL;
1441
_tmp9_ = string_get_char (start, (glong) 0);
1442
_tmp10_ = G_IS_DIR_SEPARATOR (_tmp9_);
1463
const gchar* _tmp9_ = NULL;
1464
_tmp7_ = string_get_char (start, (glong) 0);
1465
_tmp8_ = G_IS_DIR_SEPARATOR (_tmp7_);
1446
_tmp11_ = g_utf8_next_char (start);
1469
_tmp9_ = g_utf8_next_char (start);
1449
1472
len = (glong) 0;
1455
gboolean _tmp14_ = FALSE;
1478
gboolean _tmp12_ = FALSE;
1481
const gchar* _tmp11_ = NULL;
1482
_tmp11_ = g_utf8_next_char (end);
1486
_tmp13_ = string_get_char (end, (glong) 0);
1490
_tmp14_ = string_get_char (end, (glong) 0);
1491
_tmp15_ = G_IS_DIR_SEPARATOR (_tmp14_);
1457
1496
if (!_tmp12_) {
1458
const gchar* _tmp13_ = NULL;
1459
_tmp13_ = g_utf8_next_char (end);
1463
_tmp15_ = string_get_char (end, (glong) 0);
1467
_tmp16_ = string_get_char (end, (glong) 0);
1468
_tmp17_ = G_IS_DIR_SEPARATOR (_tmp16_);
1479
1502
if (len == 0) {
1482
gboolean _tmp18_ = FALSE;
1505
gboolean _tmp16_ = FALSE;
1483
1506
if (len == 1) {
1485
_tmp19_ = string_get_char (start, (glong) 0);
1486
_tmp18_ = _tmp19_ == '.';
1508
_tmp17_ = string_get_char (start, (glong) 0);
1509
_tmp16_ = _tmp17_ == '.';
1492
gboolean _tmp20_ = FALSE;
1515
gboolean _tmp18_ = FALSE;
1493
1516
if (len == 2) {
1495
_tmp21_ = g_str_has_prefix (start, "..");
1518
_tmp19_ = g_str_has_prefix (start, "..");
1502
_tmp22_ = strlen (rpath);
1503
if (_tmp22_ > root_len) {
1525
_tmp20_ = strlen (rpath);
1526
if (_tmp20_ > root_len) {
1509
gchar* _tmp26_ = NULL;
1513
_tmp24_ = vala_code_context_ends_with_dir_separator (rpath);
1532
gchar* _tmp24_ = NULL;
1535
_tmp22_ = vala_code_context_ends_with_dir_separator (rpath);
1519
_tmp25_ = strlen (rpath);
1520
_tmp26_ = string_substring (rpath, (glong) 0, (glong) (_tmp25_ - 1));
1541
_tmp23_ = strlen (rpath);
1542
_tmp24_ = string_substring (rpath, (glong) 0, (glong) (_tmp23_ - 1));
1522
1543
_g_free0 (rpath);
1529
gchar* _tmp30_ = NULL;
1532
_tmp28_ = vala_code_context_ends_with_dir_separator (rpath);
1535
_tmp29_ = g_strconcat (rpath, G_DIR_SEPARATOR_S, NULL);
1550
gchar* _tmp27_ = NULL;
1553
_tmp25_ = vala_code_context_ends_with_dir_separator (rpath);
1556
_tmp26_ = g_strconcat (rpath, G_DIR_SEPARATOR_S, NULL);
1536
1557
_g_free0 (rpath);
1539
_tmp30_ = string_substring (start, (glong) 0, len);
1541
_tmp32_ = g_strconcat (rpath, _tmp31_, NULL);
1560
_tmp27_ = string_substring (start, (glong) 0, len);
1562
_tmp29_ = g_strconcat (rpath, _tmp28_, NULL);
1542
1563
_g_free0 (rpath);
1550
_tmp34_ = strlen (rpath);
1551
if (_tmp34_ > root_len) {
1553
_tmp35_ = vala_code_context_ends_with_dir_separator (rpath);
1571
_tmp31_ = strlen (rpath);
1572
if (_tmp31_ > root_len) {
1574
_tmp32_ = vala_code_context_ends_with_dir_separator (rpath);
1560
gchar* _tmp37_ = NULL;
1562
_tmp36_ = strlen (rpath);
1563
_tmp37_ = string_substring (rpath, (glong) 0, (glong) (_tmp36_ - 1));
1581
gchar* _tmp34_ = NULL;
1582
_tmp33_ = strlen (rpath);
1583
_tmp34_ = string_substring (rpath, (glong) 0, (glong) (_tmp33_ - 1));
1565
1584
_g_free0 (rpath);
1568
1587
if (G_DIR_SEPARATOR != '/') {
1570
gchar** _tmp40_ = NULL;
1589
gchar** _tmp36_ = NULL;
1571
1590
gchar** components;
1572
1591
gint components_length1;
1573
1592
gint _components_size_;
1574
gchar* _tmp41_ = NULL;
1576
_tmp40_ = _tmp39_ = g_strsplit (rpath, "\\", 0);
1577
components = _tmp40_;
1578
components_length1 = _vala_array_length (_tmp39_);
1579
_components_size_ = _vala_array_length (_tmp39_);
1580
_tmp41_ = g_strjoinv ("/", components);
1593
gchar* _tmp37_ = NULL;
1594
_tmp36_ = _tmp35_ = g_strsplit (rpath, "\\", 0);
1595
components = _tmp36_;
1596
components_length1 = _vala_array_length (_tmp35_);
1597
_components_size_ = _vala_array_length (_tmp35_);
1598
_tmp37_ = g_strjoinv ("/", components);
1582
1599
_g_free0 (rpath);
1584
1601
components = (_vala_array_free (components, components_length1, (GDestroyNotify) g_free), NULL);
1586
1603
result = rpath;