Example #1
0
void looper(){
    ident_t lab1, lab2;
    qcode_t nop;
    if(sym->type!=LPAREN){
        msg(ERR, "missing \'(\'", line);
		ERROR_STATUS = 1;
    }
    nextSym();
    lab1 = createLabel();
    nop = gen(NOP, 0, 0, 0);
    putLabel(lab1, nop);
    lab2 = condition();
    if(sym->type!=RPAREN){
        msg(ERR, "missing \')\'", line);
		ERROR_STATUS = 1;
    }
    nextSym();
    if(statement()==0){
        msg(ERR, "missing a statement", line);
		ERROR_STATUS = 1;
    }
    gen(JMP, lab1, 0, 0);
    nop = gen(NOP, 0, 0, 0);
    putLabel(lab2, nop);
}
Example #2
0
void switcher(){
    ident_t expr, exitlab;
    qcode_t nop;
    if(sym->type!=LPAREN){
        // error occur;
    }
    nextSym();
    expr = expression();
    if(sym->type!=RPAREN){
        // error occur;
    }
    nextSym();
    if(sym->type!=LBRACE){
        // error occur;
    }
    nextSym();
    exitlab = createLabel();
    jumptable(expr, exitlab);
    if(sym->type==DEFUALT){
        nextSym();
        defaultcase();
    }
    if(sym->type!=RBRACE){
        // error occur;
    }
    nextSym();

    nop = gen(NOP, 0, 0, 0);
    putLabel(exitlab, nop);
}
Example #3
0
void jumptable(ident_t expr, ident_t exitlab){
    ident_t nextlab = 0;
    qcode_t nop;
    while(sym->type==CASE){
        nextSym();
        nextlab = createLabel();
        jumpentry(expr, nextlab);
        gen(JMP, exitlab, 0, 0);
        nop = gen(NOP, 0, 0, 0);
        putLabel(nextlab, nop);
    }
}
Example #4
0
File: Dot.cpp Project: YurieCo/GO
void Dot::draw(cairo_t *cr) const {
	beginDraw(cr, x, y, rad(0));

	applyLineColor(cr);
	cairo_move_to(cr, size/fabs(zoom), 0);
	cairo_arc(cr, 0, 0, size/fabs(zoom), 0, rad(360));
	cairo_stroke_preserve(cr);

	applyFillColor(cr);
	cairo_fill(cr);
	cairo_move_to(cr, 0, 0);

	putLabel(cr);
	cairo_stroke(cr);

	endDraw(cr);
}
Example #5
0
void brancher(){
    ident_t lab;
    qcode_t nop;
    if(sym->type!=LPAREN){
        msg(ERR, "missing \'(\'", line);
		ERROR_STATUS = 1;
    }
    nextSym();
    lab = condition();
    if(sym->type!=RPAREN){
        msg(ERR, "missing \')\'", line);
		ERROR_STATUS = 1;
    }
    nextSym();
    if(statement()==0){
        msg(ERR, "missing a statement", line);
		ERROR_STATUS = 1;
    }
    nop = gen(NOP, 0, 0, 0);
    putLabel(lab, nop);
}