Exemple #1
0
Fichier : gen.c Projet : minux/subc
void geninc(int *lv, int inc, int pre) {
	int	y, b;

	gentext();
	y = lv[LVSYM];
	if (needscale(lv[LVPRIM])) {
		genincptr(lv, inc, pre);
		return;
	}
	b = PCHAR == lv[LVPRIM];
	/* will duplicate move to aux register in (*char)++ */
	commit();
	if (!y && !pre) cgldinc();
	if (!pre) {
		genrval(lv);
		commit();
	}
	if (!y) {
		if (pre)
			if (inc)
				b? cginc1ib(): cginc1iw();
			else
				b? cgdec1ib(): cgdec1iw();
		else
			if (inc)
				b? cginc2ib(): cginc2iw();
			else
				b? cgdec2ib(): cgdec2iw();
	}
	else if (CAUTO == Stcls[y]) {
		if (inc)
			b? cginclb(Vals[y]): cginclw(Vals[y]);
		else
			b? cgdeclb(Vals[y]): cgdeclw(Vals[y]);
	}
	else if (CLSTATC == Stcls[y]) {
		if (inc)
			b? cgincsb(Vals[y]): cgincsw(Vals[y]);
		else
			b? cgdecsb(Vals[y]): cgdecsw(Vals[y]);
	}
	else {
		if (inc)
			b? cgincgb(gsym(Names[y])):
			   cgincgw(gsym(Names[y]));
		else
			b? cgdecgb(gsym(Names[y])):
			   cgdecgw(gsym(Names[y]));
	}
	if (pre) genrval(lv);
}
Exemple #2
0
void geninc(int *lv, int inc, int pre)
{

    int y, b;

    gentext();

    y = lv[LVSYM];

    if (needscale(lv[LVPRIM]))
    {

        genincptr(lv, inc, pre);

        return;

    }

    b = PCHAR == lv[LVPRIM];

    commit();

    if (!y && !pre)
        cgldinc();

    if (!pre)
    {

        rvalue(lv);
        commit();

    }

    if (!y)
    {

        if (pre)
        {

            if (inc)
                b ? cginc1ib() : cginc1iw();
            else
                b ? cgdec1ib() : cgdec1iw();
        }

        else
        {

            if (inc)
                b ? cginc2ib() : cginc2iw();
            else
                b ? cgdec2ib() : cgdec2iw();

        }

    }

    else if (CAUTO == symbols[y].stcl)
    {

        if (inc)
            b ? cginclb(symbols[y].value) : cginclw(symbols[y].value);
        else
            b ? cgdeclb(symbols[y].value) : cgdeclw(symbols[y].value);

    }

    else if (CLSTATC == symbols[y].stcl)
    {

        if (inc)
            b ? cgincsb(symbols[y].value) : cgincsw(symbols[y].value);
        else
            b ? cgdecsb(symbols[y].value) : cgdecsw(symbols[y].value);

    }

    else
    {

        if (inc)
            b ? cgincgb(gsym(symbols[y].name)) : cgincgw(gsym(symbols[y].name));
        else
            b ? cgdecgb(gsym(symbols[y].name)) : cgdecgw(gsym(symbols[y].name));

    }

    if (pre)
        rvalue(lv);

}