Пример #1
0
GtkMateThemeSetting* gtk_mate_theme_setting_create_from_plist (PListDict* dict) {
	GtkMateThemeSetting* tsetting;
	PListNode* nm;
	PListNode* _tmp2;
	GeeHashMap* _tmp5;
	PListDict* pd;
	GtkMateThemeSetting* _tmp9;
	g_return_val_if_fail (dict != NULL, NULL);
	tsetting = g_object_ref_sink (gtk_mate_theme_setting_new ());
	nm = plist_dict_get (dict, "name");
	if (nm != NULL) {
		char* _tmp1;
		const char* _tmp0;
		_tmp1 = NULL;
		_tmp0 = NULL;
		tsetting->name = (_tmp1 = (_tmp0 = PLIST_STRING (nm)->str, (_tmp0 == NULL) ? NULL : g_strdup (_tmp0)), tsetting->name = (g_free (tsetting->name), NULL), _tmp1);
	}
	_tmp2 = NULL;
	nm = (_tmp2 = plist_dict_get (dict, "scope"), (nm == NULL) ? NULL : (nm = (g_object_unref (nm), NULL)), _tmp2);
	if (nm != NULL) {
		char* _tmp4;
		const char* _tmp3;
		_tmp4 = NULL;
		_tmp3 = NULL;
		tsetting->selector = (_tmp4 = (_tmp3 = PLIST_STRING (nm)->str, (_tmp3 == NULL) ? NULL : g_strdup (_tmp3)), tsetting->selector = (g_free (tsetting->selector), NULL), _tmp4);
	}
	_tmp5 = NULL;
	tsetting->settings = (_tmp5 = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, g_str_hash, g_str_equal, g_direct_equal), (tsetting->settings == NULL) ? NULL : (tsetting->settings = (g_object_unref (tsetting->settings), NULL)), _tmp5);
	pd = PLIST_DICT (plist_dict_get (dict, "settings"));
	{
		GeeSet* _tmp6;
		GeeIterator* _tmp7;
		GeeIterator* _key_it;
		_tmp6 = NULL;
		_tmp7 = NULL;
		_key_it = (_tmp7 = gee_iterable_iterator ((GeeIterable*) (_tmp6 = gee_map_get_keys ((GeeMap*) pd->map))), (_tmp6 == NULL) ? NULL : (_tmp6 = (g_object_unref (_tmp6), NULL)), _tmp7);
		while (gee_iterator_next (_key_it)) {
			char* key;
			PListString* _tmp8;
			key = (char*) gee_iterator_get (_key_it);
			_tmp8 = NULL;
			gee_map_set ((GeeMap*) tsetting->settings, key, (_tmp8 = PLIST_STRING ((PListNode*) gee_map_get ((GeeMap*) pd->map, key)))->str);
			(_tmp8 == NULL) ? NULL : (_tmp8 = (g_object_unref (_tmp8), NULL));
			key = (g_free (key), NULL);
		}
		(_key_it == NULL) ? NULL : (_key_it = (g_object_unref (_key_it), NULL));
	}
	_tmp9 = NULL;
	return (_tmp9 = tsetting, (nm == NULL) ? NULL : (nm = (g_object_unref (nm), NULL)), (pd == NULL) ? NULL : (pd = (g_object_unref (pd), NULL)), _tmp9);
}
Пример #2
0
GtkMateIncludePattern* gtk_mate_include_pattern_create_from_plist (PListDict* pd) {
	PListString* ns;
	GtkMateIncludePattern* pattern;
	PListString* _tmp0;
	char* _tmp2;
	const char* _tmp1;
	GtkMateIncludePattern* _tmp3;
	g_return_val_if_fail (pd != NULL, NULL);
	ns = NULL;
	pattern = g_object_ref_sink (gtk_mate_include_pattern_new ());
	_tmp0 = NULL;
	ns = (_tmp0 = PLIST_STRING (plist_dict_get (pd, "include")), (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), _tmp0);
	_tmp2 = NULL;
	_tmp1 = NULL;
	((GtkMatePattern*) pattern)->name = (_tmp2 = (_tmp1 = ns->str, (_tmp1 == NULL) ? NULL : g_strdup (_tmp1)), ((GtkMatePattern*) pattern)->name = (g_free (((GtkMatePattern*) pattern)->name), NULL), _tmp2);
	/* stdout.printf("ip: %s\n", ns.str);*/
	_tmp3 = NULL;
	return (_tmp3 = pattern, (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), _tmp3);
}
Пример #3
0
GeeHashMap* gtk_mate_pattern_make_captures_from_plist (PListDict* pd) {
	PListDict* pcd;
	PListString* ns;
	GeeHashMap* captures;
	GeeHashMap* _tmp5;
	if (pd == NULL) {
		return gee_hash_map_new (G_TYPE_INT, NULL, NULL, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, g_direct_hash, g_direct_equal, g_direct_equal);
	}
	pcd = NULL;
	ns = NULL;
	captures = gee_hash_map_new (G_TYPE_INT, NULL, NULL, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, g_direct_hash, g_direct_equal, g_direct_equal);
	{
		gint _tmp1;
		char** s_capnum_collection;
		int s_capnum_collection_length1;
		int s_capnum_it;
		s_capnum_collection = plist_dict_keys (pd, &_tmp1);
		s_capnum_collection_length1 = _tmp1;
		for (s_capnum_it = 0; s_capnum_it < _tmp1; s_capnum_it = s_capnum_it + 1) {
			const char* _tmp4;
			char* s_capnum;
			_tmp4 = NULL;
			s_capnum = (_tmp4 = s_capnum_collection[s_capnum_it], (_tmp4 == NULL) ? NULL : g_strdup (_tmp4));
			{
				gint capnum;
				PListDict* _tmp2;
				PListString* _tmp3;
				capnum = atoi (s_capnum);
				_tmp2 = NULL;
				pcd = (_tmp2 = PLIST_DICT (plist_dict_get (pd, s_capnum)), (pcd == NULL) ? NULL : (pcd = (g_object_unref (pcd), NULL)), _tmp2);
				_tmp3 = NULL;
				ns = (_tmp3 = PLIST_STRING (plist_dict_get (pcd, "name")), (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), _tmp3);
				/* stdout.printf("capture: %d, %s\n", capnum, ns.str);*/
				gee_map_set ((GeeMap*) captures, GINT_TO_POINTER (capnum), ns->str);
				s_capnum = (g_free (s_capnum), NULL);
			}
		}
		s_capnum_collection = (_vala_array_free (s_capnum_collection, s_capnum_collection_length1, (GDestroyNotify) g_free), NULL);
	}
	_tmp5 = NULL;
	return (_tmp5 = captures, (pcd == NULL) ? NULL : (pcd = (g_object_unref (pcd), NULL)), (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), _tmp5);
}
Пример #4
0
GtkMateTheme* gtk_mate_theme_create_from_plist (PListDict* dict) {
	GtkMateTheme* theme;
	PListNode* nm;
	PListNode* _tmp2;
	GeeHashMap* _tmp5;
	GeeArrayList* _tmp6;
	PListArray* na;
	GtkMateTheme* _tmp14;
	g_return_val_if_fail (dict != NULL, NULL);
	theme = g_object_ref_sink (gtk_mate_theme_new ());
	theme->is_initialized = FALSE;
	nm = plist_dict_get (dict, "name");
	if (nm != NULL) {
		char* _tmp1;
		const char* _tmp0;
		_tmp1 = NULL;
		_tmp0 = NULL;
		theme->name = (_tmp1 = (_tmp0 = PLIST_STRING (nm)->str, (_tmp0 == NULL) ? NULL : g_strdup (_tmp0)), theme->name = (g_free (theme->name), NULL), _tmp1);
	}
	_tmp2 = NULL;
	nm = (_tmp2 = plist_dict_get (dict, "author"), (nm == NULL) ? NULL : (nm = (g_object_unref (nm), NULL)), _tmp2);
	if (nm != NULL) {
		char* _tmp4;
		const char* _tmp3;
		_tmp4 = NULL;
		_tmp3 = NULL;
		theme->author = (_tmp4 = (_tmp3 = PLIST_STRING (nm)->str, (_tmp3 == NULL) ? NULL : g_strdup (_tmp3)), theme->author = (g_free (theme->author), NULL), _tmp4);
	}
	_tmp5 = NULL;
	theme->global_settings = (_tmp5 = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, g_str_hash, g_str_equal, g_direct_equal), (theme->global_settings == NULL) ? NULL : (theme->global_settings = (g_object_unref (theme->global_settings), NULL)), _tmp5);
	_tmp6 = NULL;
	theme->settings = (_tmp6 = gee_array_list_new (GTK_MATE_TYPE_THEME_SETTING, (GBoxedCopyFunc) g_object_ref, g_object_unref, g_direct_equal), (theme->settings == NULL) ? NULL : (theme->settings = (g_object_unref (theme->settings), NULL)), _tmp6);
	na = PLIST_ARRAY (plist_dict_get (dict, "settings"));
	{
		GeeIterator* _nn_it;
		_nn_it = gee_iterable_iterator ((GeeIterable*) na->array);
		while (gee_iterator_next (_nn_it)) {
			PListNode* nn;
			PListDict* _tmp7;
			PListDict* nd;
			PListNode* _tmp8;
			gboolean _tmp9;
			nn = (PListNode*) gee_iterator_get (_nn_it);
			_tmp7 = NULL;
			nd = (_tmp7 = PLIST_DICT (nn), (_tmp7 == NULL) ? NULL : g_object_ref (_tmp7));
			_tmp8 = NULL;
			if ((_tmp9 = (_tmp8 = plist_dict_get (nd, "scope")) == NULL, (_tmp8 == NULL) ? NULL : (_tmp8 = (g_object_unref (_tmp8), NULL)), _tmp9)) {
				PListDict* gsd;
				gsd = PLIST_DICT (plist_dict_get (nd, "settings"));
				{
					gint _tmp10;
					char** key_collection;
					int key_collection_length1;
					int key_it;
					key_collection = plist_dict_keys (gsd, &_tmp10);
					key_collection_length1 = _tmp10;
					for (key_it = 0; key_it < _tmp10; key_it = key_it + 1) {
						const char* _tmp12;
						char* key;
						_tmp12 = NULL;
						key = (_tmp12 = key_collection[key_it], (_tmp12 == NULL) ? NULL : g_strdup (_tmp12));
						{
							PListString* _tmp11;
							_tmp11 = NULL;
							gee_map_set ((GeeMap*) theme->global_settings, key, (_tmp11 = PLIST_STRING (plist_dict_get (gsd, key)))->str);
							(_tmp11 == NULL) ? NULL : (_tmp11 = (g_object_unref (_tmp11), NULL));
							key = (g_free (key), NULL);
						}
					}
					key_collection = (_vala_array_free (key_collection, key_collection_length1, (GDestroyNotify) g_free), NULL);
				}
				(gsd == NULL) ? NULL : (gsd = (g_object_unref (gsd), NULL));
			} else {
				GtkMateThemeSetting* _tmp13;
				_tmp13 = NULL;
				gee_collection_add ((GeeCollection*) theme->settings, _tmp13 = gtk_mate_theme_setting_create_from_plist (nd));
				(_tmp13 == NULL) ? NULL : (_tmp13 = (g_object_unref (_tmp13), NULL));
			}
			(nn == NULL) ? NULL : (nn = (g_object_unref (nn), NULL));
			(nd == NULL) ? NULL : (nd = (g_object_unref (nd), NULL));
		}
		(_nn_it == NULL) ? NULL : (_nn_it = (g_object_unref (_nn_it), NULL));
	}
	_tmp14 = NULL;
	return (_tmp14 = theme, (nm == NULL) ? NULL : (nm = (g_object_unref (nm), NULL)), (na == NULL) ? NULL : (na = (g_object_unref (na), NULL)), _tmp14);
}
Пример #5
0
GtkMateDoublePattern* gtk_mate_double_pattern_create_from_plist (GeeArrayList* all_patterns, PListDict* pd) {
	PListString* ns;
	GtkMateDoublePattern* pattern;
	PListString* _tmp0;
	PListString* _tmp3;
	char* _tmp5;
	const char* _tmp4;
	OnigRx* _tmp6;
	PListString* _tmp7;
	char* _tmp9;
	const char* _tmp8;
	PListString* _tmp10;
	PListNode* n;
	PListNode* _tmp14;
	PListNode* _tmp16;
	GeeHashMap* _tmp17;
	GeeArrayList* _tmp18;
	PListNode* ps;
	GtkMatePattern* subpattern;
	PListNode* _tmp20;
	gboolean _tmp21;
	gboolean _tmp22;
	GtkMateDoublePattern* _tmp25;
	g_return_val_if_fail (all_patterns != NULL, NULL);
	g_return_val_if_fail (pd != NULL, NULL);
	ns = NULL;
	pattern = g_object_ref_sink (gtk_mate_double_pattern_new ());
	_tmp0 = NULL;
	ns = (_tmp0 = PLIST_STRING (plist_dict_get (pd, "name")), (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), _tmp0);
	if (ns != NULL) {
		char* _tmp2;
		const char* _tmp1;
		_tmp2 = NULL;
		_tmp1 = NULL;
		((GtkMatePattern*) pattern)->name = (_tmp2 = (_tmp1 = ns->str, (_tmp1 == NULL) ? NULL : g_strdup (_tmp1)), ((GtkMatePattern*) pattern)->name = (g_free (((GtkMatePattern*) pattern)->name), NULL), _tmp2);
	}
	_tmp3 = NULL;
	ns = (_tmp3 = PLIST_STRING (plist_dict_get (pd, "begin")), (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), _tmp3);
	_tmp5 = NULL;
	_tmp4 = NULL;
	pattern->begin_string = (_tmp5 = (_tmp4 = ns->str, (_tmp4 == NULL) ? NULL : g_strdup (_tmp4)), pattern->begin_string = (g_free (pattern->begin_string), NULL), _tmp5);
	_tmp6 = NULL;
	pattern->begin = (_tmp6 = onig_rx_make1 (ns->str), (pattern->begin == NULL) ? NULL : (pattern->begin = (g_object_unref (pattern->begin), NULL)), _tmp6);
	_tmp7 = NULL;
	ns = (_tmp7 = PLIST_STRING (plist_dict_get (pd, "end")), (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), _tmp7);
	_tmp9 = NULL;
	_tmp8 = NULL;
	pattern->end_string = (_tmp9 = (_tmp8 = ns->str, (_tmp8 == NULL) ? NULL : g_strdup (_tmp8)), pattern->end_string = (g_free (pattern->end_string), NULL), _tmp9);
	_tmp10 = NULL;
	ns = (_tmp10 = PLIST_STRING (plist_dict_get (pd, "contentName")), (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), _tmp10);
	if (ns != NULL) {
		char* _tmp12;
		const char* _tmp11;
		_tmp12 = NULL;
		_tmp11 = NULL;
		pattern->content_name = (_tmp12 = (_tmp11 = ns->str, (_tmp11 == NULL) ? NULL : g_strdup (_tmp11)), pattern->content_name = (g_free (pattern->content_name), NULL), _tmp12);
	}
	n = plist_dict_get (pd, "beginCaptures");
	if (n != NULL) {
		GeeHashMap* _tmp13;
		_tmp13 = NULL;
		pattern->begin_captures = (_tmp13 = gtk_mate_pattern_make_captures_from_plist (PLIST_DICT (n)), (pattern->begin_captures == NULL) ? NULL : (pattern->begin_captures = (g_object_unref (pattern->begin_captures), NULL)), _tmp13);
	}
	_tmp14 = NULL;
	n = (_tmp14 = plist_dict_get (pd, "captures"), (n == NULL) ? NULL : (n = (g_object_unref (n), NULL)), _tmp14);
	if (n != NULL) {
		GeeHashMap* _tmp15;
		_tmp15 = NULL;
		pattern->both_captures = (_tmp15 = gtk_mate_pattern_make_captures_from_plist (PLIST_DICT (n)), (pattern->both_captures == NULL) ? NULL : (pattern->both_captures = (g_object_unref (pattern->both_captures), NULL)), _tmp15);
	}
	_tmp16 = NULL;
	n = (_tmp16 = plist_dict_get (pd, "endCaptures"), (n == NULL) ? NULL : (n = (g_object_unref (n), NULL)), _tmp16);
	_tmp17 = NULL;
	pattern->end_captures = (_tmp17 = gtk_mate_pattern_make_captures_from_plist (PLIST_DICT (n)), (pattern->end_captures == NULL) ? NULL : (pattern->end_captures = (g_object_unref (pattern->end_captures), NULL)), _tmp17);
	_tmp18 = NULL;
	pattern->patterns = (_tmp18 = gee_array_list_new (GTK_MATE_TYPE_PATTERN, (GBoxedCopyFunc) g_object_ref, g_object_unref, g_direct_equal), (pattern->patterns == NULL) ? NULL : (pattern->patterns = (g_object_unref (pattern->patterns), NULL)), _tmp18);
	ps = plist_dict_get (pd, "patterns");
	subpattern = NULL;
	if (ps != NULL) {
		{
			GeeIterator* _p_it;
			_p_it = gee_iterable_iterator ((GeeIterable*) PLIST_ARRAY (ps)->array);
			while (gee_iterator_next (_p_it)) {
				PListNode* p;
				GtkMatePattern* _tmp19;
				p = (PListNode*) gee_iterator_get (_p_it);
				_tmp19 = NULL;
				subpattern = (_tmp19 = gtk_mate_pattern_create_from_plist (all_patterns, PLIST_DICT (p)), (subpattern == NULL) ? NULL : (subpattern = (g_object_unref (subpattern), NULL)), _tmp19);
				if (subpattern != NULL) {
					gee_collection_add ((GeeCollection*) pattern->patterns, subpattern);
				}
				(p == NULL) ? NULL : (p = (g_object_unref (p), NULL));
			}
			(_p_it == NULL) ? NULL : (_p_it = (g_object_unref (_p_it), NULL));
		}
	}
	_tmp20 = NULL;
	n = (_tmp20 = plist_dict_get (pd, "disabled"), (n == NULL) ? NULL : (n = (g_object_unref (n), NULL)), _tmp20);
	_tmp21 = FALSE;
	_tmp22 = FALSE;
	if (n != NULL) {
		_tmp22 = PLIST_IS_INTEGER (n);
	} else {
		_tmp22 = FALSE;
	}
	if (_tmp22) {
		_tmp21 = PLIST_INTEGER (n)->value == 1;
	} else {
		_tmp21 = FALSE;
	}
	if (_tmp21) {
		((GtkMatePattern*) pattern)->disabled = TRUE;
	} else {
		gboolean _tmp23;
		gboolean _tmp24;
		_tmp23 = FALSE;
		_tmp24 = FALSE;
		if (n != NULL) {
			_tmp24 = PLIST_IS_STRING (n);
		} else {
			_tmp24 = FALSE;
		}
		if (_tmp24) {
			_tmp23 = _vala_strcmp0 (PLIST_STRING (n)->str, "1") == 0;
		} else {
			_tmp23 = FALSE;
		}
		if (_tmp23) {
			((GtkMatePattern*) pattern)->disabled = TRUE;
		} else {
			((GtkMatePattern*) pattern)->disabled = FALSE;
		}
	}
	gee_collection_add ((GeeCollection*) all_patterns, (GtkMatePattern*) pattern);
	_tmp25 = NULL;
	return (_tmp25 = pattern, (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), (n == NULL) ? NULL : (n = (g_object_unref (n), NULL)), (ps == NULL) ? NULL : (ps = (g_object_unref (ps), NULL)), (subpattern == NULL) ? NULL : (subpattern = (g_object_unref (subpattern), NULL)), _tmp25);
}
Пример #6
0
GtkMateSinglePattern* gtk_mate_single_pattern_create_from_plist (GeeArrayList* all_patterns, PListDict* pd) {
	PListString* ns;
	GtkMateSinglePattern* pattern;
	PListString* _tmp0;
	PListString* _tmp3;
	OnigRx* _tmp4;
	PListNode* n;
	GeeHashMap* _tmp5;
	PListNode* _tmp6;
	gboolean _tmp7;
	gboolean _tmp8;
	GtkMateSinglePattern* _tmp11;
	g_return_val_if_fail (all_patterns != NULL, NULL);
	g_return_val_if_fail (pd != NULL, NULL);
	ns = NULL;
	pattern = g_object_ref_sink (gtk_mate_single_pattern_new ());
	_tmp0 = NULL;
	ns = (_tmp0 = PLIST_STRING (plist_dict_get (pd, "name")), (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), _tmp0);
	if (ns != NULL) {
		char* _tmp2;
		const char* _tmp1;
		_tmp2 = NULL;
		_tmp1 = NULL;
		((GtkMatePattern*) pattern)->name = (_tmp2 = (_tmp1 = ns->str, (_tmp1 == NULL) ? NULL : g_strdup (_tmp1)), ((GtkMatePattern*) pattern)->name = (g_free (((GtkMatePattern*) pattern)->name), NULL), _tmp2);
	}
	/*stdout.printf("sp: %s\n", ((PList.String) pd.get("name")).str);
	else
	stdout.printf("sp: no name\n");*/
	_tmp3 = NULL;
	ns = (_tmp3 = PLIST_STRING (plist_dict_get (pd, "match")), (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), _tmp3);
	_tmp4 = NULL;
	pattern->match = (_tmp4 = onig_rx_make1 (ns->str), (pattern->match == NULL) ? NULL : (pattern->match = (g_object_unref (pattern->match), NULL)), _tmp4);
	n = plist_dict_get (pd, "captures");
	_tmp5 = NULL;
	pattern->captures = (_tmp5 = gtk_mate_pattern_make_captures_from_plist (PLIST_DICT (n)), (pattern->captures == NULL) ? NULL : (pattern->captures = (g_object_unref (pattern->captures), NULL)), _tmp5);
	_tmp6 = NULL;
	n = (_tmp6 = plist_dict_get (pd, "disabled"), (n == NULL) ? NULL : (n = (g_object_unref (n), NULL)), _tmp6);
	_tmp7 = FALSE;
	_tmp8 = FALSE;
	if (n != NULL) {
		_tmp8 = PLIST_IS_INTEGER (n);
	} else {
		_tmp8 = FALSE;
	}
	if (_tmp8) {
		_tmp7 = PLIST_INTEGER (n)->value == 1;
	} else {
		_tmp7 = FALSE;
	}
	if (_tmp7) {
		((GtkMatePattern*) pattern)->disabled = TRUE;
	} else {
		gboolean _tmp9;
		gboolean _tmp10;
		_tmp9 = FALSE;
		_tmp10 = FALSE;
		if (n != NULL) {
			_tmp10 = PLIST_IS_STRING (n);
		} else {
			_tmp10 = FALSE;
		}
		if (_tmp10) {
			_tmp9 = _vala_strcmp0 (PLIST_STRING (n)->str, "1") == 0;
		} else {
			_tmp9 = FALSE;
		}
		if (_tmp9) {
			((GtkMatePattern*) pattern)->disabled = TRUE;
		} else {
			((GtkMatePattern*) pattern)->disabled = FALSE;
		}
	}
	gee_collection_add ((GeeCollection*) all_patterns, (GtkMatePattern*) pattern);
	_tmp11 = NULL;
	return (_tmp11 = pattern, (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), (n == NULL) ? NULL : (n = (g_object_unref (n), NULL)), _tmp11);
}
Пример #7
0
GtkMateDoublePattern* gtk_mate_double_pattern_create_from_plist (GeeArrayList* all_patterns, PListDict* pd) {
	PListString* ns;
	GtkMateDoublePattern* pattern;
	PListString* _tmp0_;
	PListString* _tmp3_;
	char* _tmp5_;
	const char* _tmp4_;
	OnigRx* _tmp6_;
	PListString* _tmp7_;
	char* _tmp9_;
	const char* _tmp8_;
	PListString* _tmp10_;
	PListNode* n;
	PListNode* _tmp14_;
	PListNode* _tmp16_;
	GeeHashMap* _tmp17_;
	GeeArrayList* _tmp18_;
	PListNode* ps;
	GtkMatePattern* subpattern;
	PListNode* _tmp20_;
	gboolean _tmp21_;
	gboolean _tmp22_;
	GtkMateDoublePattern* _tmp25_;
	g_return_val_if_fail (all_patterns != NULL, NULL);
	g_return_val_if_fail (pd != NULL, NULL);
	ns = NULL;
	pattern = g_object_ref_sink (gtk_mate_double_pattern_new ());
	_tmp0_ = NULL;
	ns = (_tmp0_ = PLIST_STRING (plist_dict_get (pd, "name")), (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), _tmp0_);
	if (ns != NULL) {
		char* _tmp2_;
		const char* _tmp1_;
		_tmp2_ = NULL;
		_tmp1_ = NULL;
		((GtkMatePattern*) pattern)->name = (_tmp2_ = (_tmp1_ = ns->str, (_tmp1_ == NULL) ? NULL : g_strdup (_tmp1_)), ((GtkMatePattern*) pattern)->name = (g_free (((GtkMatePattern*) pattern)->name), NULL), _tmp2_);
	}
	_tmp3_ = NULL;
	ns = (_tmp3_ = PLIST_STRING (plist_dict_get (pd, "begin")), (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), _tmp3_);
	_tmp5_ = NULL;
	_tmp4_ = NULL;
	pattern->begin_string = (_tmp5_ = (_tmp4_ = ns->str, (_tmp4_ == NULL) ? NULL : g_strdup (_tmp4_)), pattern->begin_string = (g_free (pattern->begin_string), NULL), _tmp5_);
	_tmp6_ = NULL;
	pattern->begin = (_tmp6_ = onig_rx_make1 (ns->str), (pattern->begin == NULL) ? NULL : (pattern->begin = (g_object_unref (pattern->begin), NULL)), _tmp6_);
	_tmp7_ = NULL;
	ns = (_tmp7_ = PLIST_STRING (plist_dict_get (pd, "end")), (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), _tmp7_);
	_tmp9_ = NULL;
	_tmp8_ = NULL;
	pattern->end_string = (_tmp9_ = (_tmp8_ = ns->str, (_tmp8_ == NULL) ? NULL : g_strdup (_tmp8_)), pattern->end_string = (g_free (pattern->end_string), NULL), _tmp9_);
	_tmp10_ = NULL;
	ns = (_tmp10_ = PLIST_STRING (plist_dict_get (pd, "contentName")), (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), _tmp10_);
	if (ns != NULL) {
		char* _tmp12_;
		const char* _tmp11_;
		_tmp12_ = NULL;
		_tmp11_ = NULL;
		pattern->content_name = (_tmp12_ = (_tmp11_ = ns->str, (_tmp11_ == NULL) ? NULL : g_strdup (_tmp11_)), pattern->content_name = (g_free (pattern->content_name), NULL), _tmp12_);
	}
	n = plist_dict_get (pd, "beginCaptures");
	if (n != NULL) {
		GeeHashMap* _tmp13_;
		_tmp13_ = NULL;
		pattern->begin_captures = (_tmp13_ = gtk_mate_pattern_make_captures_from_plist (PLIST_DICT (n)), (pattern->begin_captures == NULL) ? NULL : (pattern->begin_captures = (g_object_unref (pattern->begin_captures), NULL)), _tmp13_);
	}
	_tmp14_ = NULL;
	n = (_tmp14_ = plist_dict_get (pd, "captures"), (n == NULL) ? NULL : (n = (g_object_unref (n), NULL)), _tmp14_);
	if (n != NULL) {
		GeeHashMap* _tmp15_;
		_tmp15_ = NULL;
		pattern->both_captures = (_tmp15_ = gtk_mate_pattern_make_captures_from_plist (PLIST_DICT (n)), (pattern->both_captures == NULL) ? NULL : (pattern->both_captures = (g_object_unref (pattern->both_captures), NULL)), _tmp15_);
	}
	_tmp16_ = NULL;
	n = (_tmp16_ = plist_dict_get (pd, "endCaptures"), (n == NULL) ? NULL : (n = (g_object_unref (n), NULL)), _tmp16_);
	_tmp17_ = NULL;
	pattern->end_captures = (_tmp17_ = gtk_mate_pattern_make_captures_from_plist (PLIST_DICT (n)), (pattern->end_captures == NULL) ? NULL : (pattern->end_captures = (g_object_unref (pattern->end_captures), NULL)), _tmp17_);
	_tmp18_ = NULL;
	pattern->patterns = (_tmp18_ = gee_array_list_new (GTK_MATE_TYPE_PATTERN, (GBoxedCopyFunc) g_object_ref, g_object_unref, g_direct_equal), (pattern->patterns == NULL) ? NULL : (pattern->patterns = (g_object_unref (pattern->patterns), NULL)), _tmp18_);
	ps = plist_dict_get (pd, "patterns");
	subpattern = NULL;
	if (ps != NULL) {
		{
			GeeIterator* _p_it;
			_p_it = gee_iterable_iterator ((GeeIterable*) PLIST_ARRAY (ps)->array);
			while (gee_iterator_next (_p_it)) {
				PListNode* p;
				GtkMatePattern* _tmp19_;
				p = (PListNode*) gee_iterator_get (_p_it);
				_tmp19_ = NULL;
				subpattern = (_tmp19_ = gtk_mate_pattern_create_from_plist (all_patterns, PLIST_DICT (p)), (subpattern == NULL) ? NULL : (subpattern = (g_object_unref (subpattern), NULL)), _tmp19_);
				if (subpattern != NULL) {
					gee_collection_add ((GeeCollection*) pattern->patterns, subpattern);
				}
				(p == NULL) ? NULL : (p = (g_object_unref (p), NULL));
			}
			(_p_it == NULL) ? NULL : (_p_it = (g_object_unref (_p_it), NULL));
		}
	}
	_tmp20_ = NULL;
	n = (_tmp20_ = plist_dict_get (pd, "disabled"), (n == NULL) ? NULL : (n = (g_object_unref (n), NULL)), _tmp20_);
	_tmp21_ = FALSE;
	_tmp22_ = FALSE;
	if (n != NULL) {
		_tmp22_ = PLIST_IS_INTEGER (n);
	} else {
		_tmp22_ = FALSE;
	}
	if (_tmp22_) {
		_tmp21_ = PLIST_INTEGER (n)->value == 1;
	} else {
		_tmp21_ = FALSE;
	}
	if (_tmp21_) {
		((GtkMatePattern*) pattern)->disabled = TRUE;
	} else {
		gboolean _tmp23_;
		gboolean _tmp24_;
		_tmp23_ = FALSE;
		_tmp24_ = FALSE;
		if (n != NULL) {
			_tmp24_ = PLIST_IS_STRING (n);
		} else {
			_tmp24_ = FALSE;
		}
		if (_tmp24_) {
			_tmp23_ = _vala_strcmp0 (PLIST_STRING (n)->str, "1") == 0;
		} else {
			_tmp23_ = FALSE;
		}
		if (_tmp23_) {
			((GtkMatePattern*) pattern)->disabled = TRUE;
		} else {
			((GtkMatePattern*) pattern)->disabled = FALSE;
		}
	}
	gee_collection_add ((GeeCollection*) all_patterns, (GtkMatePattern*) pattern);
	_tmp25_ = NULL;
	return (_tmp25_ = pattern, (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), (n == NULL) ? NULL : (n = (g_object_unref (n), NULL)), (ps == NULL) ? NULL : (ps = (g_object_unref (ps), NULL)), (subpattern == NULL) ? NULL : (subpattern = (g_object_unref (subpattern), NULL)), _tmp25_);
}
Пример #8
0
/* Loads the properties that are needed whether or not 
 the grammar ever used.*/
void gtk_mate_grammar_init_for_reference (GtkMateGrammar* self) {
	PListNode* nm;
	PListNode* flm;
	PListNode* ke;
	PListNode* sn;
	PListNode* cm;
	PListNode* filetypes;
	g_return_if_fail (self != NULL);
	nm = plist_dict_get (self->priv->_plist, "name");
	if (nm != NULL) {
		gtk_mate_grammar_set_name (self, PLIST_STRING (nm)->str);
	}
	flm = plist_dict_get (self->priv->_plist, "firstLineMatch");
	if (flm != NULL) {
		OnigRx* _tmp0;
		_tmp0 = NULL;
		self->first_line_match = (_tmp0 = onig_rx_make1 (PLIST_STRING (flm)->str), (self->first_line_match == NULL) ? NULL : (self->first_line_match = (g_object_unref (self->first_line_match), NULL)), _tmp0);
	}
	ke = plist_dict_get (self->priv->_plist, "keyEquivalent");
	if (ke != NULL) {
		char* _tmp2;
		const char* _tmp1;
		_tmp2 = NULL;
		_tmp1 = NULL;
		self->key_equivalent = (_tmp2 = (_tmp1 = PLIST_STRING (ke)->str, (_tmp1 == NULL) ? NULL : g_strdup (_tmp1)), self->key_equivalent = (g_free (self->key_equivalent), NULL), _tmp2);
	}
	sn = plist_dict_get (self->priv->_plist, "scopeName");
	if (sn != NULL) {
		char* _tmp4;
		const char* _tmp3;
		_tmp4 = NULL;
		_tmp3 = NULL;
		self->scope_name = (_tmp4 = (_tmp3 = PLIST_STRING (sn)->str, (_tmp3 == NULL) ? NULL : g_strdup (_tmp3)), self->scope_name = (g_free (self->scope_name), NULL), _tmp4);
	}
	cm = plist_dict_get (self->priv->_plist, "comment");
	if (cm != NULL) {
		char* _tmp6;
		const char* _tmp5;
		_tmp6 = NULL;
		_tmp5 = NULL;
		self->comment = (_tmp6 = (_tmp5 = PLIST_STRING (cm)->str, (_tmp5 == NULL) ? NULL : g_strdup (_tmp5)), self->comment = (g_free (self->comment), NULL), _tmp6);
	}
	filetypes = plist_dict_get (self->priv->_plist, "fileTypes");
	if (filetypes != NULL) {
		PListArray* _tmp7;
		PListArray* fts;
		char** _tmp9;
		gint _tmp8;
		gint i;
		_tmp7 = NULL;
		fts = (_tmp7 = PLIST_ARRAY (filetypes), (_tmp7 == NULL) ? NULL : g_object_ref (_tmp7));
		_tmp9 = NULL;
		self->file_types = (_tmp9 = g_new0 (char*, (_tmp8 = gee_collection_get_size ((GeeCollection*) fts->array)) + 1), self->file_types = (_vala_array_free (self->file_types, self->file_types_length1, (GDestroyNotify) g_free), NULL), self->file_types_length1 = _tmp8, _tmp9);
		i = 0;
		{
			GeeIterator* _n_it;
			_n_it = gee_iterable_iterator ((GeeIterable*) fts->array);
			while (gee_iterator_next (_n_it)) {
				PListNode* n;
				gint _tmp12;
				char* _tmp11;
				const char* _tmp10;
				n = (PListNode*) gee_iterator_get (_n_it);
				_tmp11 = NULL;
				_tmp10 = NULL;
				_tmp12 = i++;
				self->file_types[_tmp12] = (_tmp11 = (_tmp10 = PLIST_STRING (n)->str, (_tmp10 == NULL) ? NULL : g_strdup (_tmp10)), self->file_types[_tmp12] = (g_free (self->file_types[_tmp12]), NULL), _tmp11);
				(n == NULL) ? NULL : (n = (g_object_unref (n), NULL));
			}
			(_n_it == NULL) ? NULL : (_n_it = (g_object_unref (_n_it), NULL));
		}
		(fts == NULL) ? NULL : (fts = (g_object_unref (fts), NULL));
	}
Пример #9
0
/* Loads the properties of the grammar that are required
 for parsing. Loads patterns into memory, and sets
 up possible patterns.*/
void gtk_mate_grammar_init_for_use (GtkMateGrammar* self) {
	PListNode* fsm;
	PListNode* ftm;
	GeeArrayList* _tmp2;
	GeeArrayList* _tmp3;
	PListNode* ps;
	GtkMatePattern* pattern;
	GeeHashMap* _tmp5;
	PListDict* pd;
	PListDict* pd1;
	PListNode* pa1;
	g_return_if_fail (self != NULL);
	if (self->loaded) {
		return;
	}
	self->loaded = TRUE;
	/*stdout.printf("initializing grammar for use: %s\n", name);*/
	fsm = plist_dict_get (self->priv->_plist, "foldingStartMarker");
	if (fsm != NULL) {
		OnigRx* _tmp0;
		_tmp0 = NULL;
		self->folding_start_marker = (_tmp0 = onig_rx_make1 (PLIST_STRING (fsm)->str), (self->folding_start_marker == NULL) ? NULL : (self->folding_start_marker = (g_object_unref (self->folding_start_marker), NULL)), _tmp0);
	}
	ftm = plist_dict_get (self->priv->_plist, "foldingStopMarker");
	if (ftm != NULL) {
		OnigRx* _tmp1;
		_tmp1 = NULL;
		self->folding_stop_marker = (_tmp1 = onig_rx_make1 (PLIST_STRING (ftm)->str), (self->folding_stop_marker == NULL) ? NULL : (self->folding_stop_marker = (g_object_unref (self->folding_stop_marker), NULL)), _tmp1);
	}
	_tmp2 = NULL;
	self->all_patterns = (_tmp2 = gee_array_list_new (GTK_MATE_TYPE_PATTERN, (GBoxedCopyFunc) g_object_ref, g_object_unref, g_direct_equal), (self->all_patterns == NULL) ? NULL : (self->all_patterns = (g_object_unref (self->all_patterns), NULL)), _tmp2);
	/* stdout.printf("getting patterns\n");*/
	_tmp3 = NULL;
	self->patterns = (_tmp3 = gee_array_list_new (GTK_MATE_TYPE_PATTERN, (GBoxedCopyFunc) g_object_ref, g_object_unref, g_direct_equal), (self->patterns == NULL) ? NULL : (self->patterns = (g_object_unref (self->patterns), NULL)), _tmp3);
	ps = plist_dict_get (self->priv->_plist, "patterns");
	pattern = NULL;
	if (ps != NULL) {
		{
			GeeIterator* _p_it;
			_p_it = gee_iterable_iterator ((GeeIterable*) PLIST_ARRAY (ps)->array);
			while (gee_iterator_next (_p_it)) {
				PListNode* p;
				GtkMatePattern* _tmp4;
				p = (PListNode*) gee_iterator_get (_p_it);
				_tmp4 = NULL;
				pattern = (_tmp4 = gtk_mate_pattern_create_from_plist (self->all_patterns, PLIST_DICT (p)), (pattern == NULL) ? NULL : (pattern = (g_object_unref (pattern), NULL)), _tmp4);
				gtk_mate_pattern_set_grammar (pattern, self);
				if (pattern != NULL) {
					gee_collection_add ((GeeCollection*) self->patterns, pattern);
				}
				(p == NULL) ? NULL : (p = (g_object_unref (p), NULL));
			}
			(_p_it == NULL) ? NULL : (_p_it = (g_object_unref (_p_it), NULL));
		}
	}
	/* stdout.printf("getting repository\n");*/
	_tmp5 = NULL;
	self->repository = (_tmp5 = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, GEE_TYPE_ARRAY_LIST, (GBoxedCopyFunc) g_object_ref, g_object_unref, g_str_hash, g_str_equal, g_direct_equal), (self->repository == NULL) ? NULL : (self->repository = (g_object_unref (self->repository), NULL)), _tmp5);
	pd = PLIST_DICT (plist_dict_get (self->priv->_plist, "repository"));
	pd1 = NULL;
	pa1 = NULL;
	if (pd != NULL) {
		{
			GeeSet* _tmp6;
			GeeIterator* _tmp7;
			GeeIterator* _key_it;
			_tmp6 = NULL;
			_tmp7 = NULL;
			_key_it = (_tmp7 = gee_iterable_iterator ((GeeIterable*) (_tmp6 = gee_map_get_keys ((GeeMap*) pd->map))), (_tmp6 == NULL) ? NULL : (_tmp6 = (g_object_unref (_tmp6), NULL)), _tmp7);
			while (gee_iterator_next (_key_it)) {
				char* key;
				GeeArrayList* repo_array;
				PListDict* _tmp8;
				gboolean _tmp9;
				PListNode* _tmp10;
				gboolean _tmp11;
				key = (char*) gee_iterator_get (_key_it);
				/* stdout.printf("convert repo name: %s\n", key);*/
				repo_array = gee_array_list_new (GTK_MATE_TYPE_PATTERN, (GBoxedCopyFunc) g_object_ref, g_object_unref, g_direct_equal);
				_tmp8 = NULL;
				pd1 = (_tmp8 = PLIST_DICT (plist_dict_get (pd, key)), (pd1 == NULL) ? NULL : (pd1 = (g_object_unref (pd1), NULL)), _tmp8);
				_tmp9 = FALSE;
				_tmp10 = NULL;
				if ((_tmp11 = (_tmp10 = plist_dict_get (pd1, "begin")) != NULL, (_tmp10 == NULL) ? NULL : (_tmp10 = (g_object_unref (_tmp10), NULL)), _tmp11)) {
					_tmp9 = TRUE;
				} else {
					PListNode* _tmp12;
					_tmp12 = NULL;
					_tmp9 = (_tmp12 = plist_dict_get (pd1, "match")) != NULL;
					(_tmp12 == NULL) ? NULL : (_tmp12 = (g_object_unref (_tmp12), NULL));
				}
				/* repository name can go straight to a pattern*/
				if (_tmp9) {
					GtkMatePattern* _tmp13;
					_tmp13 = NULL;
					pattern = (_tmp13 = gtk_mate_pattern_create_from_plist (self->all_patterns, PLIST_DICT (pd1)), (pattern == NULL) ? NULL : (pattern = (g_object_unref (pattern), NULL)), _tmp13);
					gtk_mate_pattern_set_grammar (pattern, self);
					if (pattern != NULL) {
						gee_collection_add ((GeeCollection*) repo_array, pattern);
					}
				} else {
					PListNode* _tmp14;
					_tmp14 = NULL;
					if ((pa1 = (_tmp14 = plist_dict_get (pd1, "patterns"), (pa1 == NULL) ? NULL : (pa1 = (g_object_unref (pa1), NULL)), _tmp14)) != NULL) {
						{
							GeeIterator* _ps1_it;
							_ps1_it = gee_iterable_iterator ((GeeIterable*) PLIST_ARRAY (pa1)->array);
							while (gee_iterator_next (_ps1_it)) {
								PListNode* ps1;
								GtkMatePattern* _tmp15;
								ps1 = (PListNode*) gee_iterator_get (_ps1_it);
								_tmp15 = NULL;
								pattern = (_tmp15 = gtk_mate_pattern_create_from_plist (self->all_patterns, PLIST_DICT (ps1)), (pattern == NULL) ? NULL : (pattern = (g_object_unref (pattern), NULL)), _tmp15);
								gtk_mate_pattern_set_grammar (pattern, self);
								if (pattern != NULL) {
									gee_collection_add ((GeeCollection*) repo_array, pattern);
								}
								(ps1 == NULL) ? NULL : (ps1 = (g_object_unref (ps1), NULL));
							}
							(_ps1_it == NULL) ? NULL : (_ps1_it = (g_object_unref (_ps1_it), NULL));
						}
					}
				}
				gee_map_set ((GeeMap*) self->repository, key, repo_array);
				key = (g_free (key), NULL);
				(repo_array == NULL) ? NULL : (repo_array = (g_object_unref (repo_array), NULL));
			}
			(_key_it == NULL) ? NULL : (_key_it = (g_object_unref (_key_it), NULL));
		}
	}
	/* stdout.printf("all_patterns: %d\n", all_patterns.size);*/
	{
		GeeIterator* _p_it;
		/* stdout.printf("all_patterns: %d\n", all_patterns.size);*/
		_p_it = gee_iterable_iterator ((GeeIterable*) self->all_patterns);
		/* stdout.printf("all_patterns: %d\n", all_patterns.size);*/
		while (gee_iterator_next (_p_it)) {
			GtkMatePattern* p;
			/* stdout.printf("all_patterns: %d\n", all_patterns.size);*/
			p = (GtkMatePattern*) gee_iterator_get (_p_it);
			if (GTK_MATE_IS_DOUBLE_PATTERN (p)) {
				gtk_mate_pattern_replace_include_patterns (GTK_MATE_DOUBLE_PATTERN (p)->patterns, self);
			}
			(p == NULL) ? NULL : (p = (g_object_unref (p), NULL));
		}
		(_p_it == NULL) ? NULL : (_p_it = (g_object_unref (_p_it), NULL));
	}
	gtk_mate_pattern_replace_include_patterns (self->patterns, self);
	(fsm == NULL) ? NULL : (fsm = (g_object_unref (fsm), NULL));
	(ftm == NULL) ? NULL : (ftm = (g_object_unref (ftm), NULL));
	(ps == NULL) ? NULL : (ps = (g_object_unref (ps), NULL));
	(pattern == NULL) ? NULL : (pattern = (g_object_unref (pattern), NULL));
	(pd == NULL) ? NULL : (pd = (g_object_unref (pd), NULL));
	(pd1 == NULL) ? NULL : (pd1 = (g_object_unref (pd1), NULL));
	(pa1 == NULL) ? NULL : (pa1 = (g_object_unref (pa1), NULL));
}