Exemple #1
0
/* this method is mainly for testing in the Ruby specs*/
char* gtk_mate_matcher_test_rank (const char* selector_a, const char* selector_b, const char* scope_string) {
	OnigMatch* m1;
	OnigMatch* m2;
	OnigMatch* _tmp2;
	gboolean _tmp1;
	OnigMatch* _tmp0;
	OnigMatch* _tmp5;
	gboolean _tmp4;
	OnigMatch* _tmp3;
	gint r;
	g_return_val_if_fail (selector_a != NULL, NULL);
	g_return_val_if_fail (selector_b != NULL, NULL);
	g_return_val_if_fail (scope_string != NULL, NULL);
	m1 = NULL;
	m2 = NULL;
	_tmp2 = NULL;
	_tmp0 = NULL;
	_tmp1 = gtk_mate_matcher_match (selector_a, scope_string, &_tmp0);
	m1 = (_tmp2 = _tmp0, (m1 == NULL) ? NULL : (m1 = (g_object_unref (m1), NULL)), _tmp2);
	_tmp1;
	_tmp5 = NULL;
	_tmp3 = NULL;
	_tmp4 = gtk_mate_matcher_match (selector_b, scope_string, &_tmp3);
	m2 = (_tmp5 = _tmp3, (m2 == NULL) ? NULL : (m2 = (g_object_unref (m2), NULL)), _tmp5);
	_tmp4;
	r = gtk_mate_matcher_compare_match (scope_string, m1, m2);
	if (r > 0) {
		const char* _tmp6;
		char* _tmp7;
		_tmp6 = NULL;
		_tmp7 = NULL;
		return (_tmp7 = (_tmp6 = selector_a, (_tmp6 == NULL) ? NULL : g_strdup (_tmp6)), (m1 == NULL) ? NULL : (m1 = (g_object_unref (m1), NULL)), (m2 == NULL) ? NULL : (m2 = (g_object_unref (m2), NULL)), _tmp7);
	} else {
		if (r == 0) {
			char* _tmp8;
			char* _tmp9;
			char* _tmp10;
			_tmp8 = NULL;
			_tmp9 = NULL;
			_tmp10 = NULL;
			return (_tmp10 = (_tmp9 = g_strconcat (_tmp8 = g_strconcat (selector_a, " == ", NULL), selector_b, NULL), _tmp8 = (g_free (_tmp8), NULL), _tmp9), (m1 == NULL) ? NULL : (m1 = (g_object_unref (m1), NULL)), (m2 == NULL) ? NULL : (m2 = (g_object_unref (m2), NULL)), _tmp10);
		} else {
			const char* _tmp11;
			char* _tmp12;
			_tmp11 = NULL;
			_tmp12 = NULL;
			return (_tmp12 = (_tmp11 = selector_b, (_tmp11 == NULL) ? NULL : g_strdup (_tmp11)), (m1 == NULL) ? NULL : (m1 = (g_object_unref (m1), NULL)), (m2 == NULL) ? NULL : (m2 = (g_object_unref (m2), NULL)), _tmp12);
		}
	}
	(m1 == NULL) ? NULL : (m1 = (g_object_unref (m1), NULL));
	(m2 == NULL) ? NULL : (m2 = (g_object_unref (m2), NULL));
}
Exemple #2
0
/* this method is mainly for testing in the Ruby specs*/
char* gtk_mate_matcher_test_rank (const char* selector_a, const char* selector_b, const char* scope_string) {
	OnigMatch* m1;
	OnigMatch* m2;
	OnigMatch* _tmp2_;
	gboolean _tmp1_;
	OnigMatch* _tmp0_;
	OnigMatch* _tmp5_;
	gboolean _tmp4_;
	OnigMatch* _tmp3_;
	gint r;
	g_return_val_if_fail (selector_a != NULL, NULL);
	g_return_val_if_fail (selector_b != NULL, NULL);
	g_return_val_if_fail (scope_string != NULL, NULL);
	m1 = NULL;
	m2 = NULL;
	_tmp2_ = NULL;
	_tmp0_ = NULL;
	_tmp1_ = gtk_mate_matcher_match (selector_a, scope_string, &_tmp0_);
	m1 = (_tmp2_ = _tmp0_, (m1 == NULL) ? NULL : (m1 = (g_object_unref (m1), NULL)), _tmp2_);
	_tmp1_;
	_tmp5_ = NULL;
	_tmp3_ = NULL;
	_tmp4_ = gtk_mate_matcher_match (selector_b, scope_string, &_tmp3_);
	m2 = (_tmp5_ = _tmp3_, (m2 == NULL) ? NULL : (m2 = (g_object_unref (m2), NULL)), _tmp5_);
	_tmp4_;
	r = gtk_mate_matcher_compare_match (scope_string, m1, m2);
	if (r > 0) {
		const char* _tmp6_;
		char* _tmp7_;
		_tmp6_ = NULL;
		_tmp7_ = NULL;
		return (_tmp7_ = (_tmp6_ = selector_a, (_tmp6_ == NULL) ? NULL : g_strdup (_tmp6_)), (m1 == NULL) ? NULL : (m1 = (g_object_unref (m1), NULL)), (m2 == NULL) ? NULL : (m2 = (g_object_unref (m2), NULL)), _tmp7_);
	} else {
		if (r == 0) {
			char* _tmp8_;
			char* _tmp9_;
			char* _tmp10_;
			_tmp8_ = NULL;
			_tmp9_ = NULL;
			_tmp10_ = NULL;
			return (_tmp10_ = (_tmp9_ = g_strconcat (_tmp8_ = g_strconcat (selector_a, " == ", NULL), selector_b, NULL), _tmp8_ = (g_free (_tmp8_), NULL), _tmp9_), (m1 == NULL) ? NULL : (m1 = (g_object_unref (m1), NULL)), (m2 == NULL) ? NULL : (m2 = (g_object_unref (m2), NULL)), _tmp10_);
		} else {
			const char* _tmp11_;
			char* _tmp12_;
			_tmp11_ = NULL;
			_tmp12_ = NULL;
			return (_tmp12_ = (_tmp11_ = selector_b, (_tmp11_ == NULL) ? NULL : g_strdup (_tmp11_)), (m1 == NULL) ? NULL : (m1 = (g_object_unref (m1), NULL)), (m2 == NULL) ? NULL : (m2 = (g_object_unref (m2), NULL)), _tmp12_);
		}
	}
	(m1 == NULL) ? NULL : (m1 = (g_object_unref (m1), NULL));
	(m2 == NULL) ? NULL : (m2 = (g_object_unref (m2), NULL));
}
Exemple #3
0
/* TODO make this return multiple themes if they are identical
 (see 13.5 of Textmate manual)*/
GtkMateThemeSetting* gtk_mate_theme_settings_for_scope (GtkMateTheme* self, GtkMateScope* scope, gboolean inner, GtkMateThemeSetting* exclude_setting) {
	char* scope_name;
	GtkMateThemeSetting* cached;
	OnigMatch* current_m;
	OnigMatch* m;
	GtkMateThemeSetting* current;
	GtkMateThemeSetting* _tmp14;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (scope != NULL, NULL);
	scope_name = gtk_mate_scope_hierarchy_names (scope, inner);
	/*stdout.printf("  finding settings for '%s'\n", scope_name);*/
	cached = NULL;
	if (gee_map_contains ((GeeMap*) self->cached_setting_for_scopes, scope_name)) {
		GtkMateThemeSetting* _tmp0;
		GtkMateThemeSetting* _tmp1;
		_tmp0 = NULL;
		cached = (_tmp0 = (GtkMateThemeSetting*) gee_map_get ((GeeMap*) self->cached_setting_for_scopes, scope_name), (cached == NULL) ? NULL : (cached = (g_object_unref (cached), NULL)), _tmp0);
		_tmp1 = NULL;
		return (_tmp1 = cached, scope_name = (g_free (scope_name), NULL), _tmp1);
	}
	current_m = NULL;
	m = NULL;
	current = NULL;
	{
		GeeIterator* _setting_it;
		_setting_it = gee_iterable_iterator ((GeeIterable*) self->settings);
		while (gee_iterator_next (_setting_it)) {
			GtkMateThemeSetting* setting;
			gboolean _tmp2;
			setting = (GtkMateThemeSetting*) gee_iterator_get (_setting_it);
			_tmp2 = FALSE;
			if (setting == exclude_setting) {
				_tmp2 = exclude_setting != NULL;
			} else {
				_tmp2 = FALSE;
			}
			if (_tmp2) {
			} else {
				OnigMatch* _tmp5;
				gboolean _tmp4;
				OnigMatch* _tmp3;
				/*stdout.printf("    setting '%s' excluded due to parent\n", exclude_setting.name);*/
				_tmp5 = NULL;
				_tmp3 = NULL;
				if ((_tmp4 = gtk_mate_theme_setting_match (setting, scope_name, &_tmp3), m = (_tmp5 = _tmp3, (m == NULL) ? NULL : (m = (g_object_unref (m), NULL)), _tmp5), _tmp4)) {
					/*stdout.printf("    setting '%s' matches selector '%s'\n", setting.name, setting.selector); */
					if (current == NULL) {
						GtkMateThemeSetting* _tmp7;
						GtkMateThemeSetting* _tmp6;
						OnigMatch* _tmp9;
						OnigMatch* _tmp8;
						_tmp7 = NULL;
						_tmp6 = NULL;
						current = (_tmp7 = (_tmp6 = setting, (_tmp6 == NULL) ? NULL : g_object_ref (_tmp6)), (current == NULL) ? NULL : (current = (g_object_unref (current), NULL)), _tmp7);
						_tmp9 = NULL;
						_tmp8 = NULL;
						current_m = (_tmp9 = (_tmp8 = m, (_tmp8 == NULL) ? NULL : g_object_ref (_tmp8)), (current_m == NULL) ? NULL : (current_m = (g_object_unref (current_m), NULL)), _tmp9);
					} else {
						if (gtk_mate_matcher_compare_match (scope_name, current_m, m) < 0) {
							GtkMateThemeSetting* _tmp11;
							GtkMateThemeSetting* _tmp10;
							OnigMatch* _tmp13;
							OnigMatch* _tmp12;
							_tmp11 = NULL;
							_tmp10 = NULL;
							current = (_tmp11 = (_tmp10 = setting, (_tmp10 == NULL) ? NULL : g_object_ref (_tmp10)), (current == NULL) ? NULL : (current = (g_object_unref (current), NULL)), _tmp11);
							_tmp13 = NULL;
							_tmp12 = NULL;
							current_m = (_tmp13 = (_tmp12 = m, (_tmp12 == NULL) ? NULL : g_object_ref (_tmp12)), (current_m == NULL) ? NULL : (current_m = (g_object_unref (current_m), NULL)), _tmp13);
						}
					}
				}
			}
			(setting == NULL) ? NULL : (setting = (g_object_unref (setting), NULL));
		}
		(_setting_it == NULL) ? NULL : (_setting_it = (g_object_unref (_setting_it), NULL));
	}
	/*if (current == null) {
	stdout.printf("none match\n");
	}
	else {
	stdout.printf("    best: '%s'\n", current.name);
	}*/
	gee_map_set ((GeeMap*) self->cached_setting_for_scopes, scope_name, current);
	_tmp14 = NULL;
	return (_tmp14 = current, scope_name = (g_free (scope_name), NULL), (cached == NULL) ? NULL : (cached = (g_object_unref (cached), NULL)), (current_m == NULL) ? NULL : (current_m = (g_object_unref (current_m), NULL)), (m == NULL) ? NULL : (m = (g_object_unref (m), NULL)), _tmp14);
}