int gensub(int p1, int p2, int swapped) { int rp = PINT; gentext(); if (cgload2() || !swapped) cgswap(); if (!inttype(p1) && !inttype(p2) && p1 != p2) error("incompatible pointer types in binary '-'", NULL); if (ptr(p1) && !ptr(p2)) { if (needscale(p1)) { if ( (p1 & STCMASK) == STCPTR || (p1 & STCMASK) == UNIPTR ) cgscale2by(objsize(deref(p1), TVARIABLE, 1)); else cgscale2(); } rp = p1; } cgsub(); if (needscale(p1) && needscale(p2)) { if ( (p1 & STCMASK) == STCPTR || (p1 & STCMASK) == UNIPTR ) cgunscaleby(objsize(deref(p1), TVARIABLE, 1)); else cgunscale(); } return rp; }
void genior(void) { gentext(); cgsynor(); }
void genxor(void) { gentext(); cgsynxor(); }
void genentry(void) { gentext(); cgentry(); }
void genlocinit(void) { int i; gentext(); for (i=0; i<Nli; i++) cginitlw(LIval[i], LIaddr[i]); }
void genand(void) { gentext(); cgsynand(); }
void genexit(void) { gentext(); cgexit(); }
void genldlab(int id) { gentext(); queue(addr_label, id, NULL); }
void genlit(int v) { gentext(); queue(literal, v, NULL); }
static void text_marker (char *txbuffer, int size, int npts, int *pvec) { while (npts--) { xold = *pvec; yold = *(pvec + 1); if (dev.txfont < NUMGENFONT) { gentext (txbuffer, /* Character path direction */ (float) size * dev.aspect_ratio, (float) 0, /* Character up vector direction */ (float) 0, (float) size); } else { dev.text (txbuffer, /* Character path direction */ (float) size * dev.aspect_ratio, (float) 0, /* Character up vector direction */ (float) 0, (float) size); } pvec += 2; } }
void genrval(int *lv) { if (NULL == lv) return; gentext(); if (!lv[LVSYM]) { genind(lv[LVPRIM]); } else if (CAUTO == Stcls[lv[LVSYM]]) { if (PCHAR == lv[LVPRIM]) queue(auto_byte, Vals[lv[LVSYM]], NULL); else queue(auto_word, Vals[lv[LVSYM]], NULL); } else if (CLSTATC == Stcls[lv[LVSYM]]) { if (PCHAR == lv[LVPRIM]) queue(static_byte, Vals[lv[LVSYM]], NULL); else queue(static_word, Vals[lv[LVSYM]], NULL); } else { if (PCHAR == lv[LVPRIM]) queue(globl_byte, 0, Names[lv[LVSYM]]); else queue(globl_word, 0, Names[lv[LVSYM]]); } }
void genstore(int *lv) { if (NULL == lv) return; gentext(); if (!lv[LVSYM]) { cgpopptr(); if (PCHAR == lv[LVPRIM]) cgstorib(); else cgstoriw(); } else if (CAUTO == Stcls[lv[LVSYM]]) { if (PCHAR == lv[LVPRIM]) cgstorlb(Vals[lv[LVSYM]]); else cgstorlw(Vals[lv[LVSYM]]); } else if (CLSTATC == Stcls[lv[LVSYM]]) { if (PCHAR == lv[LVPRIM]) cgstorsb(Vals[lv[LVSYM]]); else cgstorsw(Vals[lv[LVSYM]]); } else { if (PCHAR == lv[LVPRIM]) cgstorgb(gsym(Names[lv[LVSYM]])); else cgstorgw(gsym(Names[lv[LVSYM]])); } }
int genadd(int p1, int p2, int swapped) { int rp = PINT, t; gentext(); if (cgload2() || !swapped) { t = p1; p1 = p2; p2 = t; } if (ptr(p1)) { if (needscale(p1)) { if ( (p1 & STCMASK) == STCPTR || (p1 & STCMASK) == UNIPTR ) cgscale2by(objsize(deref(p1), TVARIABLE, 1)); else cgscale2(); } rp = p1; } else if (ptr(p2)) { if (needscale(p2)) { if ( (p2 & STCMASK) == STCPTR || (p2 & STCMASK) == UNIPTR ) cgscaleby(objsize(deref(p2), TVARIABLE, 1)); else cgscale(); } rp = p2; } cgadd(); return rp; }
void genmul(void) { gentext(); cgload(); cgmul(); }
void genpush(void) { gentext(); commit(); cgpush(); }
void genjump(int dest) { gentext(); commit(); cgjump(dest); }
void genscale2(void) { gentext(); commit(); cgscale2(); }
void genind(int p) { gentext(); commit(); if (PCHAR == p) cgindb(); else cgindw(); }
void gennot(void) { gentext(); commit(); cgnot(); }
void genneg(void) { gentext(); commit(); cgneg(); }
void genlognot(void) { gentext(); commit(); cglognot(); }
void genbool(void) { gentext(); commit(); cgbool(); }
void gencall(int y) { gentext(); commit(); cgcall(gsym(symbols[y].name)); load(); }
void gencalr(void) { gentext(); commit(); cgcalr(); load(); }
void genprelude(void) { Textseg = 0; gentext(); cgprelude(); }
void genaddr(int y) { gentext(); if (CAUTO == Stcls[y]) queue(addr_auto, Vals[y], NULL); else if (CLSTATC == Stcls[y]) queue(addr_static, Vals[y], NULL); else queue(addr_globl, 0, Names[y]); }
void genpushlit(int n) { gentext(); commit(); spill(); cgpushlit(n); }
void gendiv(int swapped) { gentext(); if (cgload() || !swapped) cgswap(); cgdiv(); }
void genshr(int swapped) { gentext(); if (cgload() || !swapped) cgswap(); cgshr(); }
void genmod(int swapped) { gentext(); if (cgload() || !swapped) cgswap(); cgmod(); }