static void vala_ccode_switch_statement_real_write (ValaCCodeNode* base, ValaCCodeWriter* writer) {
	ValaCCodeSwitchStatement * self;
	ValaCCodeWriter* _tmp0_;
	ValaCCodeLineDirective* _tmp1_;
	ValaCCodeLineDirective* _tmp2_;
	ValaCCodeWriter* _tmp3_;
	ValaCCodeExpression* _tmp4_;
	ValaCCodeWriter* _tmp5_;
	ValaCCodeWriter* _tmp6_;
	ValaCCodeWriter* _tmp7_;
	self = (ValaCCodeSwitchStatement*) base;
	g_return_if_fail (writer != NULL);
	_tmp0_ = writer;
	_tmp1_ = vala_ccode_node_get_line ((ValaCCodeNode*) self);
	_tmp2_ = _tmp1_;
	vala_ccode_writer_write_indent (_tmp0_, _tmp2_);
	_tmp3_ = writer;
	vala_ccode_writer_write_string (_tmp3_, "switch (");
	_tmp4_ = self->priv->_expression;
	_tmp5_ = writer;
	vala_ccode_node_write ((ValaCCodeNode*) _tmp4_, _tmp5_);
	_tmp6_ = writer;
	vala_ccode_writer_write_string (_tmp6_, ")");
	_tmp7_ = writer;
	VALA_CCODE_NODE_CLASS (vala_ccode_switch_statement_parent_class)->write ((ValaCCodeNode*) VALA_CCODE_BLOCK (self), _tmp7_);
}
static void vala_ccode_return_statement_real_write (ValaCCodeNode* base, ValaCCodeWriter* writer) {
	ValaCCodeReturnStatement * self;
	ValaCCodeWriter* _tmp0_;
	ValaCCodeLineDirective* _tmp1_;
	ValaCCodeLineDirective* _tmp2_;
	ValaCCodeWriter* _tmp3_;
	ValaCCodeExpression* _tmp4_;
	ValaCCodeWriter* _tmp8_;
	ValaCCodeWriter* _tmp9_;
	self = (ValaCCodeReturnStatement*) base;
	g_return_if_fail (writer != NULL);
	_tmp0_ = writer;
	_tmp1_ = vala_ccode_node_get_line ((ValaCCodeNode*) self);
	_tmp2_ = _tmp1_;
	vala_ccode_writer_write_indent (_tmp0_, _tmp2_);
	_tmp3_ = writer;
	vala_ccode_writer_write_string (_tmp3_, "return");
	_tmp4_ = self->priv->_return_expression;
	if (_tmp4_ != NULL) {
		ValaCCodeWriter* _tmp5_;
		ValaCCodeExpression* _tmp6_;
		ValaCCodeWriter* _tmp7_;
		_tmp5_ = writer;
		vala_ccode_writer_write_string (_tmp5_, " ");
		_tmp6_ = self->priv->_return_expression;
		_tmp7_ = writer;
		vala_ccode_node_write ((ValaCCodeNode*) _tmp6_, _tmp7_);
	}
	_tmp8_ = writer;
	vala_ccode_writer_write_string (_tmp8_, ";");
	_tmp9_ = writer;
	vala_ccode_writer_write_newline (_tmp9_);
}
static void vala_ccode_do_statement_real_write (ValaCCodeNode* base, ValaCCodeWriter* writer) {
	ValaCCodeDoStatement * self;
	ValaCCodeWriter* _tmp0_;
	ValaCCodeLineDirective* _tmp1_;
	ValaCCodeLineDirective* _tmp2_;
	ValaCCodeWriter* _tmp3_;
	ValaCCodeStatement* _tmp4_;
	ValaCCodeStatement* _tmp8_;
	ValaCCodeWriter* _tmp9_;
	ValaCCodeWriter* _tmp10_;
	ValaCCodeExpression* _tmp11_;
	ValaCCodeWriter* _tmp12_;
	ValaCCodeWriter* _tmp13_;
	self = (ValaCCodeDoStatement*) base;
	g_return_if_fail (writer != NULL);
	_tmp0_ = writer;
	_tmp1_ = vala_ccode_node_get_line ((ValaCCodeNode*) self);
	_tmp2_ = _tmp1_;
	vala_ccode_writer_write_indent (_tmp0_, _tmp2_);
	_tmp3_ = writer;
	vala_ccode_writer_write_string (_tmp3_, "do");
	_tmp4_ = self->priv->_body;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp4_, VALA_TYPE_CCODE_BLOCK)) {
		ValaCCodeStatement* _tmp5_;
		ValaCCodeBlock* _tmp6_;
		ValaCCodeBlock* cblock;
		ValaCCodeBlock* _tmp7_;
		_tmp5_ = self->priv->_body;
		_tmp6_ = _vala_ccode_node_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp5_, VALA_TYPE_CCODE_BLOCK, ValaCCodeBlock));
		cblock = _tmp6_;
		_tmp7_ = cblock;
		vala_ccode_block_set_suppress_newline (_tmp7_, TRUE);
		_vala_ccode_node_unref0 (cblock);
	}
	_tmp8_ = self->priv->_body;
	_tmp9_ = writer;
	vala_ccode_node_write ((ValaCCodeNode*) _tmp8_, _tmp9_);
	_tmp10_ = writer;
	vala_ccode_writer_write_string (_tmp10_, " while (");
	_tmp11_ = self->priv->_condition;
	_tmp12_ = writer;
	vala_ccode_node_write ((ValaCCodeNode*) _tmp11_, _tmp12_);
	_tmp13_ = writer;
	vala_ccode_writer_write_string (_tmp13_, ");");
}
Esempio n. 4
0
/**
 * Writes declaration and implementation combined for this code node and
 * all children with the specified C code writer.
 *
 * @param writer a C code writer
 */
static void vala_ccode_node_real_write_combined (ValaCCodeNode* self, ValaCCodeWriter* writer) {
	ValaCCodeWriter* _tmp0_;
	ValaCCodeWriter* _tmp1_;
	g_return_if_fail (writer != NULL);
	_tmp0_ = writer;
	vala_ccode_node_write_declaration (self, _tmp0_);
	_tmp1_ = writer;
	vala_ccode_node_write (self, _tmp1_);
}
static void vala_ccode_assignment_real_write_inner (ValaCCodeExpression* base, ValaCCodeWriter* writer) {
	ValaCCodeAssignment * self;
	ValaCCodeWriter* _tmp0_;
	ValaCCodeWriter* _tmp1_;
	ValaCCodeWriter* _tmp2_;
	self = (ValaCCodeAssignment*) base;
	g_return_if_fail (writer != NULL);
	_tmp0_ = writer;
	vala_ccode_writer_write_string (_tmp0_, "(");
	_tmp1_ = writer;
	vala_ccode_node_write ((ValaCCodeNode*) self, _tmp1_);
	_tmp2_ = writer;
	vala_ccode_writer_write_string (_tmp2_, ")");
}
static void vala_ccode_enum_value_real_write (ValaCCodeNode* base, ValaCCodeWriter* writer) {
	ValaCCodeEnumValue * self;
	ValaCCodeWriter* _tmp0_;
	const gchar* _tmp1_;
	ValaCCodeExpression* _tmp2_;
	self = (ValaCCodeEnumValue*) base;
	g_return_if_fail (writer != NULL);
	_tmp0_ = writer;
	_tmp1_ = self->priv->_name;
	vala_ccode_writer_write_string (_tmp0_, _tmp1_);
	_tmp2_ = self->priv->_value;
	if (_tmp2_ != NULL) {
		ValaCCodeWriter* _tmp3_;
		ValaCCodeExpression* _tmp4_;
		ValaCCodeWriter* _tmp5_;
		_tmp3_ = writer;
		vala_ccode_writer_write_string (_tmp3_, " = ");
		_tmp4_ = self->priv->_value;
		_tmp5_ = writer;
		vala_ccode_node_write ((ValaCCodeNode*) _tmp4_, _tmp5_);
	}
}
static void vala_ccode_assignment_real_write (ValaCCodeNode* base, ValaCCodeWriter* writer) {
	ValaCCodeAssignment * self;
	ValaCCodeExpression* _tmp0_;
	ValaCCodeWriter* _tmp1_;
	ValaCCodeWriter* _tmp2_;
	ValaCCodeAssignmentOperator _tmp3_;
	ValaCCodeWriter* _tmp23_;
	ValaCCodeExpression* _tmp24_;
	ValaCCodeWriter* _tmp25_;
	self = (ValaCCodeAssignment*) base;
	g_return_if_fail (writer != NULL);
	_tmp0_ = self->priv->_left;
	_tmp1_ = writer;
	vala_ccode_node_write ((ValaCCodeNode*) _tmp0_, _tmp1_);
	_tmp2_ = writer;
	vala_ccode_writer_write_string (_tmp2_, " ");
	_tmp3_ = self->priv->_operator;
	if (_tmp3_ == VALA_CCODE_ASSIGNMENT_OPERATOR_BITWISE_OR) {
		ValaCCodeWriter* _tmp4_;
		_tmp4_ = writer;
		vala_ccode_writer_write_string (_tmp4_, "|");
	} else {
		ValaCCodeAssignmentOperator _tmp5_;
		_tmp5_ = self->priv->_operator;
		if (_tmp5_ == VALA_CCODE_ASSIGNMENT_OPERATOR_BITWISE_AND) {
			ValaCCodeWriter* _tmp6_;
			_tmp6_ = writer;
			vala_ccode_writer_write_string (_tmp6_, "&");
		} else {
			ValaCCodeAssignmentOperator _tmp7_;
			_tmp7_ = self->priv->_operator;
			if (_tmp7_ == VALA_CCODE_ASSIGNMENT_OPERATOR_BITWISE_XOR) {
				ValaCCodeWriter* _tmp8_;
				_tmp8_ = writer;
				vala_ccode_writer_write_string (_tmp8_, "^");
			} else {
				ValaCCodeAssignmentOperator _tmp9_;
				_tmp9_ = self->priv->_operator;
				if (_tmp9_ == VALA_CCODE_ASSIGNMENT_OPERATOR_ADD) {
					ValaCCodeWriter* _tmp10_;
					_tmp10_ = writer;
					vala_ccode_writer_write_string (_tmp10_, "+");
				} else {
					ValaCCodeAssignmentOperator _tmp11_;
					_tmp11_ = self->priv->_operator;
					if (_tmp11_ == VALA_CCODE_ASSIGNMENT_OPERATOR_SUB) {
						ValaCCodeWriter* _tmp12_;
						_tmp12_ = writer;
						vala_ccode_writer_write_string (_tmp12_, "-");
					} else {
						ValaCCodeAssignmentOperator _tmp13_;
						_tmp13_ = self->priv->_operator;
						if (_tmp13_ == VALA_CCODE_ASSIGNMENT_OPERATOR_MUL) {
							ValaCCodeWriter* _tmp14_;
							_tmp14_ = writer;
							vala_ccode_writer_write_string (_tmp14_, "*");
						} else {
							ValaCCodeAssignmentOperator _tmp15_;
							_tmp15_ = self->priv->_operator;
							if (_tmp15_ == VALA_CCODE_ASSIGNMENT_OPERATOR_DIV) {
								ValaCCodeWriter* _tmp16_;
								_tmp16_ = writer;
								vala_ccode_writer_write_string (_tmp16_, "/");
							} else {
								ValaCCodeAssignmentOperator _tmp17_;
								_tmp17_ = self->priv->_operator;
								if (_tmp17_ == VALA_CCODE_ASSIGNMENT_OPERATOR_PERCENT) {
									ValaCCodeWriter* _tmp18_;
									_tmp18_ = writer;
									vala_ccode_writer_write_string (_tmp18_, "%");
								} else {
									ValaCCodeAssignmentOperator _tmp19_;
									_tmp19_ = self->priv->_operator;
									if (_tmp19_ == VALA_CCODE_ASSIGNMENT_OPERATOR_SHIFT_LEFT) {
										ValaCCodeWriter* _tmp20_;
										_tmp20_ = writer;
										vala_ccode_writer_write_string (_tmp20_, "<<");
									} else {
										ValaCCodeAssignmentOperator _tmp21_;
										_tmp21_ = self->priv->_operator;
										if (_tmp21_ == VALA_CCODE_ASSIGNMENT_OPERATOR_SHIFT_RIGHT) {
											ValaCCodeWriter* _tmp22_;
											_tmp22_ = writer;
											vala_ccode_writer_write_string (_tmp22_, ">>");
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}
	_tmp23_ = writer;
	vala_ccode_writer_write_string (_tmp23_, "= ");
	_tmp24_ = self->priv->_right;
	_tmp25_ = writer;
	vala_ccode_node_write ((ValaCCodeNode*) _tmp24_, _tmp25_);
}
gboolean vala_ccode_file_store (ValaCCodeFile* self, const gchar* filename, const gchar* source_filename, gboolean write_version, gboolean line_directives, const gchar* begin_decls, const gchar* end_decls) {
	gboolean result = FALSE;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	ValaCCodeWriter* _tmp2_;
	ValaCCodeWriter* writer;
	ValaCCodeWriter* _tmp3_;
	gboolean _tmp4_;
	gboolean _tmp5_ = FALSE;
	gboolean _tmp6_;
	ValaCCodeWriter* _tmp93_;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (filename != NULL, FALSE);
	_tmp0_ = filename;
	_tmp1_ = source_filename;
	_tmp2_ = vala_ccode_writer_new (_tmp0_, _tmp1_);
	writer = _tmp2_;
	_tmp3_ = writer;
	_tmp4_ = write_version;
	_tmp5_ = vala_ccode_writer_open (_tmp3_, _tmp4_);
	if (!_tmp5_) {
		result = FALSE;
		_vala_ccode_writer_unref0 (writer);
		return result;
	}
	_tmp6_ = self->priv->_is_header;
	if (!_tmp6_) {
		ValaCCodeWriter* _tmp7_;
		gboolean _tmp8_;
		ValaCCodeFragment* _tmp9_;
		ValaCCodeWriter* _tmp10_;
		ValaCCodeWriter* _tmp11_;
		ValaCCodeFragment* _tmp12_;
		ValaCCodeWriter* _tmp13_;
		ValaCCodeWriter* _tmp14_;
		ValaCCodeFragment* _tmp15_;
		ValaCCodeWriter* _tmp16_;
		ValaCCodeWriter* _tmp17_;
		ValaCCodeFragment* _tmp18_;
		ValaCCodeWriter* _tmp19_;
		ValaCCodeWriter* _tmp20_;
		ValaCCodeFragment* _tmp21_;
		ValaCCodeWriter* _tmp22_;
		ValaCCodeWriter* _tmp23_;
		ValaCCodeFragment* _tmp24_;
		ValaCCodeWriter* _tmp25_;
		ValaCCodeWriter* _tmp26_;
		ValaCCodeFragment* _tmp27_;
		ValaCCodeWriter* _tmp28_;
		ValaCCodeWriter* _tmp29_;
		ValaCCodeFragment* _tmp30_;
		ValaCCodeWriter* _tmp31_;
		ValaCCodeWriter* _tmp32_;
		_tmp7_ = writer;
		_tmp8_ = line_directives;
		vala_ccode_writer_set_line_directives (_tmp7_, _tmp8_);
		_tmp9_ = self->priv->comments;
		_tmp10_ = writer;
		vala_ccode_node_write ((ValaCCodeNode*) _tmp9_, _tmp10_);
		_tmp11_ = writer;
		vala_ccode_writer_write_newline (_tmp11_);
		_tmp12_ = self->priv->include_directives;
		_tmp13_ = writer;
		vala_ccode_node_write ((ValaCCodeNode*) _tmp12_, _tmp13_);
		_tmp14_ = writer;
		vala_ccode_writer_write_newline (_tmp14_);
		_tmp15_ = self->priv->type_declaration;
		_tmp16_ = writer;
		vala_ccode_node_write_combined ((ValaCCodeNode*) _tmp15_, _tmp16_);
		_tmp17_ = writer;
		vala_ccode_writer_write_newline (_tmp17_);
		_tmp18_ = self->priv->type_definition;
		_tmp19_ = writer;
		vala_ccode_node_write_combined ((ValaCCodeNode*) _tmp18_, _tmp19_);
		_tmp20_ = writer;
		vala_ccode_writer_write_newline (_tmp20_);
		_tmp21_ = self->priv->type_member_declaration;
		_tmp22_ = writer;
		vala_ccode_node_write_declaration ((ValaCCodeNode*) _tmp21_, _tmp22_);
		_tmp23_ = writer;
		vala_ccode_writer_write_newline (_tmp23_);
		_tmp24_ = self->priv->type_member_declaration;
		_tmp25_ = writer;
		vala_ccode_node_write ((ValaCCodeNode*) _tmp24_, _tmp25_);
		_tmp26_ = writer;
		vala_ccode_writer_write_newline (_tmp26_);
		_tmp27_ = self->priv->constant_declaration;
		_tmp28_ = writer;
		vala_ccode_node_write_combined ((ValaCCodeNode*) _tmp27_, _tmp28_);
		_tmp29_ = writer;
		vala_ccode_writer_write_newline (_tmp29_);
		_tmp30_ = self->priv->type_member_definition;
		_tmp31_ = writer;
		vala_ccode_node_write ((ValaCCodeNode*) _tmp30_, _tmp31_);
		_tmp32_ = writer;
		vala_ccode_writer_write_newline (_tmp32_);
	} else {
		ValaCCodeWriter* _tmp33_;
		ValaCCodeWriter* _tmp34_;
		const gchar* _tmp35_;
		const gchar* _tmp36_;
		gchar* _tmp37_ = NULL;
		gchar* _tmp38_;
		ValaCCodeOnceSection* _tmp39_;
		ValaCCodeOnceSection* _tmp40_;
		ValaCCodeOnceSection* once;
		ValaCCodeOnceSection* _tmp41_;
		ValaCCodeNewline* _tmp42_;
		ValaCCodeNewline* _tmp43_;
		ValaCCodeOnceSection* _tmp44_;
		ValaCCodeFragment* _tmp45_;
		ValaCCodeOnceSection* _tmp46_;
		ValaCCodeNewline* _tmp47_;
		ValaCCodeNewline* _tmp48_;
		const gchar* _tmp49_;
		ValaCCodeOnceSection* _tmp57_;
		ValaCCodeNewline* _tmp58_;
		ValaCCodeNewline* _tmp59_;
		ValaCCodeOnceSection* _tmp60_;
		ValaCCodeFragment* _tmp61_;
		ValaCCodeOnceSection* _tmp62_;
		ValaCCodeNewline* _tmp63_;
		ValaCCodeNewline* _tmp64_;
		ValaCCodeOnceSection* _tmp65_;
		ValaCCodeFragment* _tmp66_;
		ValaCCodeOnceSection* _tmp67_;
		ValaCCodeNewline* _tmp68_;
		ValaCCodeNewline* _tmp69_;
		ValaCCodeOnceSection* _tmp70_;
		ValaCCodeFragment* _tmp71_;
		ValaCCodeOnceSection* _tmp72_;
		ValaCCodeNewline* _tmp73_;
		ValaCCodeNewline* _tmp74_;
		ValaCCodeOnceSection* _tmp75_;
		ValaCCodeFragment* _tmp76_;
		ValaCCodeOnceSection* _tmp77_;
		ValaCCodeNewline* _tmp78_;
		ValaCCodeNewline* _tmp79_;
		const gchar* _tmp80_;
		ValaCCodeOnceSection* _tmp88_;
		ValaCCodeNewline* _tmp89_;
		ValaCCodeNewline* _tmp90_;
		ValaCCodeOnceSection* _tmp91_;
		ValaCCodeWriter* _tmp92_;
		_tmp33_ = writer;
		vala_ccode_writer_write_newline (_tmp33_);
		_tmp34_ = writer;
		_tmp35_ = vala_ccode_writer_get_filename (_tmp34_);
		_tmp36_ = _tmp35_;
		_tmp37_ = vala_ccode_file_get_define_for_filename (_tmp36_);
		_tmp38_ = _tmp37_;
		_tmp39_ = vala_ccode_once_section_new (_tmp38_);
		_tmp40_ = _tmp39_;
		_g_free0 (_tmp38_);
		once = _tmp40_;
		_tmp41_ = once;
		_tmp42_ = vala_ccode_newline_new ();
		_tmp43_ = _tmp42_;
		vala_ccode_fragment_append ((ValaCCodeFragment*) _tmp41_, (ValaCCodeNode*) _tmp43_);
		_vala_ccode_node_unref0 (_tmp43_);
		_tmp44_ = once;
		_tmp45_ = self->priv->include_directives;
		vala_ccode_fragment_append ((ValaCCodeFragment*) _tmp44_, (ValaCCodeNode*) _tmp45_);
		_tmp46_ = once;
		_tmp47_ = vala_ccode_newline_new ();
		_tmp48_ = _tmp47_;
		vala_ccode_fragment_append ((ValaCCodeFragment*) _tmp46_, (ValaCCodeNode*) _tmp48_);
		_vala_ccode_node_unref0 (_tmp48_);
		_tmp49_ = begin_decls;
		if (_tmp49_ != NULL) {
			ValaCCodeOnceSection* _tmp50_;
			const gchar* _tmp51_;
			ValaCCodeIdentifier* _tmp52_;
			ValaCCodeIdentifier* _tmp53_;
			ValaCCodeOnceSection* _tmp54_;
			ValaCCodeNewline* _tmp55_;
			ValaCCodeNewline* _tmp56_;
			_tmp50_ = once;
			_tmp51_ = begin_decls;
			_tmp52_ = vala_ccode_identifier_new (_tmp51_);
			_tmp53_ = _tmp52_;
			vala_ccode_fragment_append ((ValaCCodeFragment*) _tmp50_, (ValaCCodeNode*) _tmp53_);
			_vala_ccode_node_unref0 (_tmp53_);
			_tmp54_ = once;
			_tmp55_ = vala_ccode_newline_new ();
			_tmp56_ = _tmp55_;
			vala_ccode_fragment_append ((ValaCCodeFragment*) _tmp54_, (ValaCCodeNode*) _tmp56_);
			_vala_ccode_node_unref0 (_tmp56_);
		}
		_tmp57_ = once;
		_tmp58_ = vala_ccode_newline_new ();
		_tmp59_ = _tmp58_;
		vala_ccode_fragment_append ((ValaCCodeFragment*) _tmp57_, (ValaCCodeNode*) _tmp59_);
		_vala_ccode_node_unref0 (_tmp59_);
		_tmp60_ = once;
		_tmp61_ = self->priv->type_declaration;
		vala_ccode_fragment_append ((ValaCCodeFragment*) _tmp60_, (ValaCCodeNode*) _tmp61_);
		_tmp62_ = once;
		_tmp63_ = vala_ccode_newline_new ();
		_tmp64_ = _tmp63_;
		vala_ccode_fragment_append ((ValaCCodeFragment*) _tmp62_, (ValaCCodeNode*) _tmp64_);
		_vala_ccode_node_unref0 (_tmp64_);
		_tmp65_ = once;
		_tmp66_ = self->priv->type_definition;
		vala_ccode_fragment_append ((ValaCCodeFragment*) _tmp65_, (ValaCCodeNode*) _tmp66_);
		_tmp67_ = once;
		_tmp68_ = vala_ccode_newline_new ();
		_tmp69_ = _tmp68_;
		vala_ccode_fragment_append ((ValaCCodeFragment*) _tmp67_, (ValaCCodeNode*) _tmp69_);
		_vala_ccode_node_unref0 (_tmp69_);
		_tmp70_ = once;
		_tmp71_ = self->priv->type_member_declaration;
		vala_ccode_fragment_append ((ValaCCodeFragment*) _tmp70_, (ValaCCodeNode*) _tmp71_);
		_tmp72_ = once;
		_tmp73_ = vala_ccode_newline_new ();
		_tmp74_ = _tmp73_;
		vala_ccode_fragment_append ((ValaCCodeFragment*) _tmp72_, (ValaCCodeNode*) _tmp74_);
		_vala_ccode_node_unref0 (_tmp74_);
		_tmp75_ = once;
		_tmp76_ = self->priv->constant_declaration;
		vala_ccode_fragment_append ((ValaCCodeFragment*) _tmp75_, (ValaCCodeNode*) _tmp76_);
		_tmp77_ = once;
		_tmp78_ = vala_ccode_newline_new ();
		_tmp79_ = _tmp78_;
		vala_ccode_fragment_append ((ValaCCodeFragment*) _tmp77_, (ValaCCodeNode*) _tmp79_);
		_vala_ccode_node_unref0 (_tmp79_);
		_tmp80_ = begin_decls;
		if (_tmp80_ != NULL) {
			ValaCCodeOnceSection* _tmp81_;
			const gchar* _tmp82_;
			ValaCCodeIdentifier* _tmp83_;
			ValaCCodeIdentifier* _tmp84_;
			ValaCCodeOnceSection* _tmp85_;
			ValaCCodeNewline* _tmp86_;
			ValaCCodeNewline* _tmp87_;
			_tmp81_ = once;
			_tmp82_ = end_decls;
			_tmp83_ = vala_ccode_identifier_new (_tmp82_);
			_tmp84_ = _tmp83_;
			vala_ccode_fragment_append ((ValaCCodeFragment*) _tmp81_, (ValaCCodeNode*) _tmp84_);
			_vala_ccode_node_unref0 (_tmp84_);
			_tmp85_ = once;
			_tmp86_ = vala_ccode_newline_new ();
			_tmp87_ = _tmp86_;
			vala_ccode_fragment_append ((ValaCCodeFragment*) _tmp85_, (ValaCCodeNode*) _tmp87_);
			_vala_ccode_node_unref0 (_tmp87_);
		}
		_tmp88_ = once;
		_tmp89_ = vala_ccode_newline_new ();
		_tmp90_ = _tmp89_;
		vala_ccode_fragment_append ((ValaCCodeFragment*) _tmp88_, (ValaCCodeNode*) _tmp90_);
		_vala_ccode_node_unref0 (_tmp90_);
		_tmp91_ = once;
		_tmp92_ = writer;
		vala_ccode_node_write ((ValaCCodeNode*) _tmp91_, _tmp92_);
		_vala_ccode_node_unref0 (once);
	}
	_tmp93_ = writer;
	vala_ccode_writer_close (_tmp93_);
	result = TRUE;
	_vala_ccode_writer_unref0 (writer);
	return result;
}
Esempio n. 9
0
static void vala_ccode_block_real_write (ValaCCodeNode* base, ValaCCodeWriter* writer) {
	ValaCCodeBlock * self;
	ValaCCodeNode* last_statement;
	ValaCCodeWriter* _tmp0_;
	ValaCCodeWriter* _tmp45_;
	gboolean _tmp46_;
	self = (ValaCCodeBlock*) base;
	g_return_if_fail (writer != NULL);
	last_statement = NULL;
	_tmp0_ = writer;
	vala_ccode_writer_write_begin_block (_tmp0_);
	{
		ValaList* _tmp1_;
		ValaList* _tmp2_;
		ValaList* _statement_list;
		ValaList* _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		gint _statement_size;
		gint _statement_index;
		_tmp1_ = self->priv->statements;
		_tmp2_ = _vala_iterable_ref0 (_tmp1_);
		_statement_list = _tmp2_;
		_tmp3_ = _statement_list;
		_tmp4_ = vala_collection_get_size ((ValaCollection*) _tmp3_);
		_tmp5_ = _tmp4_;
		_statement_size = _tmp5_;
		_statement_index = -1;
		while (TRUE) {
			gint _tmp6_;
			gint _tmp7_;
			gint _tmp8_;
			ValaList* _tmp9_;
			gint _tmp10_;
			gpointer _tmp11_ = NULL;
			ValaCCodeNode* statement;
			ValaCCodeNode* _tmp12_;
			ValaCCodeWriter* _tmp13_;
			gboolean _tmp14_ = FALSE;
			ValaCCodeNode* _tmp15_;
			gboolean _tmp17_;
			_tmp6_ = _statement_index;
			_statement_index = _tmp6_ + 1;
			_tmp7_ = _statement_index;
			_tmp8_ = _statement_size;
			if (!(_tmp7_ < _tmp8_)) {
				break;
			}
			_tmp9_ = _statement_list;
			_tmp10_ = _statement_index;
			_tmp11_ = vala_list_get (_tmp9_, _tmp10_);
			statement = (ValaCCodeNode*) _tmp11_;
			_tmp12_ = statement;
			_tmp13_ = writer;
			vala_ccode_node_write_declaration (_tmp12_, _tmp13_);
			_tmp15_ = statement;
			if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp15_, VALA_TYPE_CCODE_LABEL)) {
				_tmp14_ = TRUE;
			} else {
				ValaCCodeNode* _tmp16_;
				_tmp16_ = statement;
				_tmp14_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp16_, VALA_TYPE_CCODE_CASE_STATEMENT);
			}
			_tmp17_ = _tmp14_;
			if (_tmp17_) {
				_vala_ccode_node_unref0 (last_statement);
				last_statement = NULL;
			} else {
				gboolean _tmp18_ = FALSE;
				gboolean _tmp19_ = FALSE;
				gboolean _tmp20_ = FALSE;
				ValaCCodeNode* _tmp21_;
				gboolean _tmp23_;
				gboolean _tmp25_;
				gboolean _tmp27_;
				_tmp21_ = statement;
				if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp21_, VALA_TYPE_CCODE_RETURN_STATEMENT)) {
					_tmp20_ = TRUE;
				} else {
					ValaCCodeNode* _tmp22_;
					_tmp22_ = statement;
					_tmp20_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp22_, VALA_TYPE_CCODE_GOTO_STATEMENT);
				}
				_tmp23_ = _tmp20_;
				if (_tmp23_) {
					_tmp19_ = TRUE;
				} else {
					ValaCCodeNode* _tmp24_;
					_tmp24_ = statement;
					_tmp19_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp24_, VALA_TYPE_CCODE_CONTINUE_STATEMENT);
				}
				_tmp25_ = _tmp19_;
				if (_tmp25_) {
					_tmp18_ = TRUE;
				} else {
					ValaCCodeNode* _tmp26_;
					_tmp26_ = statement;
					_tmp18_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp26_, VALA_TYPE_CCODE_BREAK_STATEMENT);
				}
				_tmp27_ = _tmp18_;
				if (_tmp27_) {
					ValaCCodeNode* _tmp28_;
					ValaCCodeNode* _tmp29_;
					_tmp28_ = statement;
					_tmp29_ = _vala_ccode_node_ref0 (_tmp28_);
					_vala_ccode_node_unref0 (last_statement);
					last_statement = _tmp29_;
				}
			}
			_vala_ccode_node_unref0 (statement);
		}
		_vala_iterable_unref0 (_statement_list);
	}
	{
		ValaList* _tmp30_;
		ValaList* _tmp31_;
		ValaList* _statement_list;
		ValaList* _tmp32_;
		gint _tmp33_;
		gint _tmp34_;
		gint _statement_size;
		gint _statement_index;
		_tmp30_ = self->priv->statements;
		_tmp31_ = _vala_iterable_ref0 (_tmp30_);
		_statement_list = _tmp31_;
		_tmp32_ = _statement_list;
		_tmp33_ = vala_collection_get_size ((ValaCollection*) _tmp32_);
		_tmp34_ = _tmp33_;
		_statement_size = _tmp34_;
		_statement_index = -1;
		while (TRUE) {
			gint _tmp35_;
			gint _tmp36_;
			gint _tmp37_;
			ValaList* _tmp38_;
			gint _tmp39_;
			gpointer _tmp40_ = NULL;
			ValaCCodeNode* statement;
			ValaCCodeNode* _tmp41_;
			ValaCCodeWriter* _tmp42_;
			ValaCCodeNode* _tmp43_;
			ValaCCodeNode* _tmp44_;
			_tmp35_ = _statement_index;
			_statement_index = _tmp35_ + 1;
			_tmp36_ = _statement_index;
			_tmp37_ = _statement_size;
			if (!(_tmp36_ < _tmp37_)) {
				break;
			}
			_tmp38_ = _statement_list;
			_tmp39_ = _statement_index;
			_tmp40_ = vala_list_get (_tmp38_, _tmp39_);
			statement = (ValaCCodeNode*) _tmp40_;
			_tmp41_ = statement;
			_tmp42_ = writer;
			vala_ccode_node_write (_tmp41_, _tmp42_);
			_tmp43_ = statement;
			_tmp44_ = last_statement;
			if (_tmp43_ == _tmp44_) {
				_vala_ccode_node_unref0 (statement);
				break;
			}
			_vala_ccode_node_unref0 (statement);
		}
		_vala_iterable_unref0 (_statement_list);
	}
	_tmp45_ = writer;
	vala_ccode_writer_write_end_block (_tmp45_);
	_tmp46_ = self->priv->_suppress_newline;
	if (!_tmp46_) {
		ValaCCodeWriter* _tmp47_;
		_tmp47_ = writer;
		vala_ccode_writer_write_newline (_tmp47_);
	}
	_vala_ccode_node_unref0 (last_statement);
}
static void vala_ccode_if_statement_real_write (ValaCCodeNode* base, ValaCCodeWriter* writer) {
	ValaCCodeIfStatement * self;
	gboolean _tmp0_;
	ValaCCodeWriter* _tmp5_;
	ValaCCodeExpression* _tmp6_;
	ValaCCodeWriter* _tmp9_;
	gboolean _tmp10_ = FALSE;
	ValaCCodeStatement* _tmp11_;
	gboolean _tmp13_;
	ValaCCodeStatement* _tmp17_;
	ValaCCodeWriter* _tmp18_;
	ValaCCodeStatement* _tmp19_;
	self = (ValaCCodeIfStatement*) base;
	g_return_if_fail (writer != NULL);
	_tmp0_ = self->priv->_else_if;
	if (!_tmp0_) {
		ValaCCodeWriter* _tmp1_;
		ValaCCodeLineDirective* _tmp2_;
		ValaCCodeLineDirective* _tmp3_;
		_tmp1_ = writer;
		_tmp2_ = vala_ccode_node_get_line ((ValaCCodeNode*) self);
		_tmp3_ = _tmp2_;
		vala_ccode_writer_write_indent (_tmp1_, _tmp3_);
	} else {
		ValaCCodeWriter* _tmp4_;
		_tmp4_ = writer;
		vala_ccode_writer_write_string (_tmp4_, " ");
	}
	_tmp5_ = writer;
	vala_ccode_writer_write_string (_tmp5_, "if (");
	_tmp6_ = self->priv->_condition;
	if (_tmp6_ != NULL) {
		ValaCCodeExpression* _tmp7_;
		ValaCCodeWriter* _tmp8_;
		_tmp7_ = self->priv->_condition;
		_tmp8_ = writer;
		vala_ccode_node_write ((ValaCCodeNode*) _tmp7_, _tmp8_);
	}
	_tmp9_ = writer;
	vala_ccode_writer_write_string (_tmp9_, ")");
	_tmp11_ = self->priv->_false_statement;
	if (_tmp11_ != NULL) {
		ValaCCodeStatement* _tmp12_;
		_tmp12_ = self->priv->_true_statement;
		_tmp10_ = VALA_IS_CCODE_BLOCK (_tmp12_);
	} else {
		_tmp10_ = FALSE;
	}
	_tmp13_ = _tmp10_;
	if (_tmp13_) {
		ValaCCodeStatement* _tmp14_;
		ValaCCodeBlock* _tmp15_;
		ValaCCodeBlock* cblock;
		ValaCCodeBlock* _tmp16_;
		_tmp14_ = self->priv->_true_statement;
		_tmp15_ = _vala_ccode_node_ref0 (VALA_CCODE_BLOCK (_tmp14_));
		cblock = _tmp15_;
		_tmp16_ = cblock;
		vala_ccode_block_set_suppress_newline (_tmp16_, TRUE);
		_vala_ccode_node_unref0 (cblock);
	}
	_tmp17_ = self->priv->_true_statement;
	_tmp18_ = writer;
	vala_ccode_node_write ((ValaCCodeNode*) _tmp17_, _tmp18_);
	_tmp19_ = self->priv->_false_statement;
	if (_tmp19_ != NULL) {
		ValaCCodeWriter* _tmp20_;
		gboolean _tmp21_;
		gboolean _tmp22_;
		ValaCCodeStatement* _tmp26_;
		ValaCCodeStatement* _tmp30_;
		ValaCCodeWriter* _tmp31_;
		_tmp20_ = writer;
		_tmp21_ = vala_ccode_writer_get_bol (_tmp20_);
		_tmp22_ = _tmp21_;
		if (_tmp22_) {
			ValaCCodeWriter* _tmp23_;
			ValaCCodeWriter* _tmp24_;
			_tmp23_ = writer;
			vala_ccode_writer_write_indent (_tmp23_, NULL);
			_tmp24_ = writer;
			vala_ccode_writer_write_string (_tmp24_, "else");
		} else {
			ValaCCodeWriter* _tmp25_;
			_tmp25_ = writer;
			vala_ccode_writer_write_string (_tmp25_, " else");
		}
		_tmp26_ = self->priv->_false_statement;
		if (VALA_IS_CCODE_IF_STATEMENT (_tmp26_)) {
			ValaCCodeStatement* _tmp27_;
			ValaCCodeIfStatement* _tmp28_;
			ValaCCodeIfStatement* cif;
			ValaCCodeIfStatement* _tmp29_;
			_tmp27_ = self->priv->_false_statement;
			_tmp28_ = _vala_ccode_node_ref0 (VALA_CCODE_IF_STATEMENT (_tmp27_));
			cif = _tmp28_;
			_tmp29_ = cif;
			vala_ccode_if_statement_set_else_if (_tmp29_, TRUE);
			_vala_ccode_node_unref0 (cif);
		}
		_tmp30_ = self->priv->_false_statement;
		_tmp31_ = writer;
		vala_ccode_node_write ((ValaCCodeNode*) _tmp30_, _tmp31_);
	}
}