コード例 #1
0
static void vala_dova_control_flow_module_real_visit_loop (ValaCodeVisitor* base, ValaLoop* stmt) {
	ValaDovaControlFlowModule * self;
	ValaCCodeFunction* _tmp0_;
	ValaCCodeFunction* _tmp1_;
	ValaCCodeConstant* _tmp2_;
	ValaCCodeConstant* _tmp3_;
	ValaLoop* _tmp4_;
	ValaBlock* _tmp5_;
	ValaBlock* _tmp6_;
	ValaCCodeFunction* _tmp7_;
	ValaCCodeFunction* _tmp8_;
	self = (ValaDovaControlFlowModule*) base;
	g_return_if_fail (stmt != NULL);
	_tmp0_ = vala_dova_base_module_get_ccode ((ValaDovaBaseModule*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = vala_ccode_constant_new ("true");
	_tmp3_ = _tmp2_;
	vala_ccode_function_open_while (_tmp1_, (ValaCCodeExpression*) _tmp3_);
	_vala_ccode_node_unref0 (_tmp3_);
	_tmp4_ = stmt;
	_tmp5_ = vala_loop_get_body (_tmp4_);
	_tmp6_ = _tmp5_;
	vala_code_node_emit ((ValaCodeNode*) _tmp6_, (ValaCodeGenerator*) self);
	_tmp7_ = vala_dova_base_module_get_ccode ((ValaDovaBaseModule*) self);
	_tmp8_ = _tmp7_;
	vala_ccode_function_close (_tmp8_);
}
コード例 #2
0
static ValaCCodeFragment* vala_class_register_function_real_get_type_interface_init_declaration (ValaTypeRegisterFunction* base) {
	ValaClassRegisterFunction * self;
	ValaCCodeFragment* result = NULL;
	ValaCCodeFragment* _tmp0_;
	ValaCCodeFragment* frag;
	self = (ValaClassRegisterFunction*) base;
	_tmp0_ = vala_ccode_fragment_new ();
	frag = _tmp0_;
	{
		ValaClass* _tmp1_;
		ValaList* _tmp2_ = NULL;
		ValaList* _base_type_list;
		ValaList* _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		gint _base_type_size;
		gint _base_type_index;
		_tmp1_ = self->priv->_class_reference;
		_tmp2_ = vala_class_get_base_types (_tmp1_);
		_base_type_list = _tmp2_;
		_tmp3_ = _base_type_list;
		_tmp4_ = vala_collection_get_size ((ValaCollection*) _tmp3_);
		_tmp5_ = _tmp4_;
		_base_type_size = _tmp5_;
		_base_type_index = -1;
		while (TRUE) {
			gint _tmp6_;
			gint _tmp7_;
			gint _tmp8_;
			ValaList* _tmp9_;
			gint _tmp10_;
			gpointer _tmp11_ = NULL;
			ValaDataType* base_type;
			ValaDataType* _tmp12_;
			ValaTypeSymbol* _tmp13_;
			ValaTypeSymbol* _tmp14_;
			ValaDataType* _tmp15_;
			ValaTypeSymbol* _tmp16_;
			ValaTypeSymbol* _tmp17_;
			ValaInterface* _tmp18_;
			ValaInterface* iface;
			ValaInterface* _tmp19_;
			gchar* _tmp20_ = NULL;
			gchar* _tmp21_;
			gchar* _tmp22_ = NULL;
			gchar* _tmp23_;
			gchar* iface_info_name;
			ValaCCodeDeclaration* _tmp24_;
			ValaCCodeDeclaration* ctypedecl;
			ValaCCodeDeclaration* _tmp25_;
			ValaCCodeDeclaration* _tmp26_;
			const gchar* _tmp27_;
			ValaClass* _tmp28_;
			gchar* _tmp29_ = NULL;
			gchar* _tmp30_;
			ValaInterface* _tmp31_;
			gchar* _tmp32_ = NULL;
			gchar* _tmp33_;
			gchar* _tmp34_ = NULL;
			gchar* _tmp35_;
			ValaCCodeConstant* _tmp36_;
			ValaCCodeConstant* _tmp37_;
			ValaCCodeVariableDeclarator* _tmp38_;
			ValaCCodeVariableDeclarator* _tmp39_;
			ValaCCodeFragment* _tmp40_;
			ValaCCodeDeclaration* _tmp41_;
			_tmp6_ = _base_type_index;
			_base_type_index = _tmp6_ + 1;
			_tmp7_ = _base_type_index;
			_tmp8_ = _base_type_size;
			if (!(_tmp7_ < _tmp8_)) {
				break;
			}
			_tmp9_ = _base_type_list;
			_tmp10_ = _base_type_index;
			_tmp11_ = vala_list_get (_tmp9_, _tmp10_);
			base_type = (ValaDataType*) _tmp11_;
			_tmp12_ = base_type;
			_tmp13_ = vala_data_type_get_data_type (_tmp12_);
			_tmp14_ = _tmp13_;
			if (!G_TYPE_CHECK_INSTANCE_TYPE (_tmp14_, VALA_TYPE_INTERFACE)) {
				_vala_code_node_unref0 (base_type);
				continue;
			}
			_tmp15_ = base_type;
			_tmp16_ = vala_data_type_get_data_type (_tmp15_);
			_tmp17_ = _tmp16_;
			_tmp18_ = _vala_code_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp17_, VALA_TYPE_INTERFACE, ValaInterface));
			iface = _tmp18_;
			_tmp19_ = iface;
			_tmp20_ = vala_ccode_base_module_get_ccode_lower_case_name ((ValaCodeNode*) _tmp19_, NULL);
			_tmp21_ = _tmp20_;
			_tmp22_ = g_strdup_printf ("%s_info", _tmp21_);
			_tmp23_ = _tmp22_;
			_g_free0 (_tmp21_);
			iface_info_name = _tmp23_;
			_tmp24_ = vala_ccode_declaration_new ("const GInterfaceInfo");
			ctypedecl = _tmp24_;
			_tmp25_ = ctypedecl;
			vala_ccode_declaration_set_modifiers (_tmp25_, VALA_CCODE_MODIFIERS_STATIC);
			_tmp26_ = ctypedecl;
			_tmp27_ = iface_info_name;
			_tmp28_ = self->priv->_class_reference;
			_tmp29_ = vala_ccode_base_module_get_ccode_lower_case_name ((ValaCodeNode*) _tmp28_, NULL);
			_tmp30_ = _tmp29_;
			_tmp31_ = iface;
			_tmp32_ = vala_ccode_base_module_get_ccode_lower_case_name ((ValaCodeNode*) _tmp31_, NULL);
			_tmp33_ = _tmp32_;
			_tmp34_ = g_strdup_printf ("{ (GInterfaceInitFunc) %s_%s_interface_init, (GInterfaceFinalizeFunc) " \
"NULL, NULL}", _tmp30_, _tmp33_);
			_tmp35_ = _tmp34_;
			_tmp36_ = vala_ccode_constant_new (_tmp35_);
			_tmp37_ = _tmp36_;
			_tmp38_ = vala_ccode_variable_declarator_new (_tmp27_, (ValaCCodeExpression*) _tmp37_, NULL);
			_tmp39_ = _tmp38_;
			vala_ccode_declaration_add_declarator (_tmp26_, (ValaCCodeDeclarator*) _tmp39_);
			_vala_ccode_node_unref0 (_tmp39_);
			_vala_ccode_node_unref0 (_tmp37_);
			_g_free0 (_tmp35_);
			_g_free0 (_tmp33_);
			_g_free0 (_tmp30_);
			_tmp40_ = frag;
			_tmp41_ = ctypedecl;
			vala_ccode_fragment_append (_tmp40_, (ValaCCodeNode*) _tmp41_);
			_vala_ccode_node_unref0 (ctypedecl);
			_g_free0 (iface_info_name);
			_vala_code_node_unref0 (iface);
			_vala_code_node_unref0 (base_type);
		}
		_vala_iterable_unref0 (_base_type_list);
	}
	result = frag;
	return result;
}
コード例 #3
0
static void vala_dova_array_module_append_initializer_list (ValaDovaArrayModule* self, ValaCCodeExpression* name_cnode, ValaInitializerList* initializer_list, gint* i) {
	g_return_if_fail (self != NULL);
	g_return_if_fail (name_cnode != NULL);
	g_return_if_fail (initializer_list != NULL);
	{
		ValaInitializerList* _tmp0_;
		ValaList* _tmp1_ = NULL;
		ValaList* _e_list;
		ValaList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _e_size;
		gint _e_index;
		_tmp0_ = initializer_list;
		_tmp1_ = vala_initializer_list_get_initializers (_tmp0_);
		_e_list = _tmp1_;
		_tmp2_ = _e_list;
		_tmp3_ = vala_collection_get_size ((ValaCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_e_size = _tmp4_;
		_e_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			gint _tmp7_;
			ValaList* _tmp8_;
			gint _tmp9_;
			gpointer _tmp10_ = NULL;
			ValaExpression* e;
			ValaCCodeFunction* _tmp11_;
			ValaCCodeFunction* _tmp12_;
			ValaCCodeExpression* _tmp13_;
			gint _tmp14_;
			gchar* _tmp15_ = NULL;
			gchar* _tmp16_;
			ValaCCodeConstant* _tmp17_;
			ValaCCodeConstant* _tmp18_;
			ValaCCodeElementAccess* _tmp19_;
			ValaCCodeElementAccess* _tmp20_;
			ValaExpression* _tmp21_;
			ValaCCodeExpression* _tmp22_ = NULL;
			ValaCCodeExpression* _tmp23_;
			gint _tmp24_;
			_tmp5_ = _e_index;
			_e_index = _tmp5_ + 1;
			_tmp6_ = _e_index;
			_tmp7_ = _e_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _e_list;
			_tmp9_ = _e_index;
			_tmp10_ = vala_list_get (_tmp8_, _tmp9_);
			e = (ValaExpression*) _tmp10_;
			_tmp11_ = vala_dova_base_module_get_ccode ((ValaDovaBaseModule*) self);
			_tmp12_ = _tmp11_;
			_tmp13_ = name_cnode;
			_tmp14_ = *i;
			_tmp15_ = g_strdup_printf ("%i", _tmp14_);
			_tmp16_ = _tmp15_;
			_tmp17_ = vala_ccode_constant_new (_tmp16_);
			_tmp18_ = _tmp17_;
			_tmp19_ = vala_ccode_element_access_new (_tmp13_, (ValaCCodeExpression*) _tmp18_);
			_tmp20_ = _tmp19_;
			_tmp21_ = e;
			_tmp22_ = vala_dova_base_module_get_cvalue ((ValaDovaBaseModule*) self, _tmp21_);
			_tmp23_ = _tmp22_;
			vala_ccode_function_add_assignment (_tmp12_, (ValaCCodeExpression*) _tmp20_, _tmp23_);
			_vala_ccode_node_unref0 (_tmp23_);
			_vala_ccode_node_unref0 (_tmp20_);
			_vala_ccode_node_unref0 (_tmp18_);
			_g_free0 (_tmp16_);
			_tmp24_ = *i;
			*i = _tmp24_ + 1;
			_vala_code_node_unref0 (e);
		}
		_vala_iterable_unref0 (_e_list);
	}
}