Ejemplo n.º 1
0
const out_val *gen_expr_style_stmt(const expr *e, out_ctx *octx)
{
	stylef("({\n");
	gen_stmt(e->code, octx);
	stylef("\n})");
	return NULL;
}
Ejemplo n.º 2
0
const out_val *gen_expr_style_addr(const expr *e, out_ctx *octx)
{
	const out_val *r;
	stylef("&(");
	r = gen_expr(e->lhs, octx);
	stylef(")");
	return r;
}
Ejemplo n.º 3
0
void style_stmt_if(const stmt *s, out_ctx *octx)
{
	stylef("if(");
	IGNORE_PRINTGEN(gen_expr(s->expr, octx));
	stylef(")\n");
	gen_stmt(s->lhs, octx);

	if(s->rhs){
		stylef("else\n");
		gen_stmt(s->rhs, octx);
	}
}
Ejemplo n.º 4
0
void style_stmt_goto(const stmt *s, out_ctx *octx)
{
	stylef("goto ");

	if(s->expr){
		stylef("*");
		IGNORE_PRINTGEN(gen_expr(s->expr, octx));
	}else{
		stylef("%s", s->bits.lbl.spel);
	}

	stylef(";");
}
Ejemplo n.º 5
0
const out_val *gen_expr_style_assign_compound(const expr *e, out_ctx *octx)
{
	IGNORE_PRINTGEN(gen_expr(e->lhs->lhs, octx));
	stylef(" %s= ", op_to_str(e->bits.compoundop.op));
	IGNORE_PRINTGEN(gen_expr(e->rhs, octx));
	return NULL;
}
Ejemplo n.º 6
0
void style_stmt_case_range(stmt *s)
{
	stylef("\ncase %ld ... %ld: ",
			(long)const_fold_val_i(s->expr),
			(long)const_fold_val_i(s->expr2));

	gen_stmt(s->lhs);
}
Ejemplo n.º 7
0
const out_val *gen_expr_style_funcall(const expr *e, out_ctx *octx)
{
	stylef("(");
	IGNORE_PRINTGEN(gen_expr(e->expr, octx));
	stylef(")(");
	if(e->funcargs){
		expr **i;
		for(i = e->funcargs; i && *i; i++){
			IGNORE_PRINTGEN(gen_expr(*i, octx));
			if(i[1])
				stylef(", ");
		}
	}
	stylef(")");

	return NULL;
}
Ejemplo n.º 8
0
void style_stmt_for(const stmt *s, out_ctx *octx)
{
	stylef("for(");
	if(s->flow->for_init)
		IGNORE_PRINTGEN(gen_expr(s->flow->for_init, octx));

	stylef("; ");
	if(s->flow->for_while)
		IGNORE_PRINTGEN(gen_expr(s->flow->for_while, octx));

	stylef("; ");
	if(s->flow->for_inc)
		IGNORE_PRINTGEN(gen_expr(s->flow->for_inc, octx));

	stylef(")\n");

	gen_stmt(s->lhs, octx);
}
Ejemplo n.º 9
0
const out_val *gen_expr_style_assign(const expr *e, out_ctx *octx)
{
	IGNORE_PRINTGEN(gen_expr(e->lhs, octx));
	stylef(" = ");
	return gen_expr(e->rhs, octx);
}
Ejemplo n.º 10
0
void style_stmt_label(const stmt *s, out_ctx *octx)
{
	stylef("\n%s: ", s->bits.lbl.spel);
	gen_stmt(s->lhs, octx);
}
Ejemplo n.º 11
0
void style_stmt_default(stmt *s)
{
	stylef("\ndefault: ");
	gen_stmt(s->lhs);
}
Ejemplo n.º 12
0
void gen_expr_style_assign_compound(expr *e)
{
	gen_expr(e->lhs->lhs);
	stylef(" %s= ", op_to_str(e->op));
	gen_expr(e->rhs);
}
Ejemplo n.º 13
0
const out_val *gen_expr_style_compound_lit(const expr *e, out_ctx *octx)
{
	stylef("(%s)", type_to_str(e->bits.complit.decl->ref));
	gen_style_dinit(e->bits.complit.decl->bits.var.init.dinit);
	UNUSED_OCTX();
}