static void progbeg(int argc, char *argv[]) { int i; { union { char c; int i; } u; u.i = 0; u.c = 1; swap = ((int) (u.i == 1)) != IR->little_endian; } parseflags(argc, argv); //put both ints and floats into IREG set reg[RGA] = mkreg("A", RGA, 1, IREG); reg[RGB] = mkreg("B", RGB, 1, IREG); reg[RGC] = mkreg("C", RGC, 1, IREG); reg[RGX] = mkreg("X", RGX, 1, IREG); reg[RGY] = mkreg("Y", RGY, 1, IREG); reg[RGZ] = mkreg("Z", RGZ, 1, IREG); reg[RGI] = mkreg("I", RGI, 1, IREG); regw = mkwildcard(reg); tmask[IREG] = TMP_REG; vmask[IREG] = VAR_REG; tmask[FREG] = 0; vmask[FREG] = 0; print(";\n;DCPU-16 ASM Generated by LCC 4.2 (dcpu16-lcc v0.2)\n;\n"); print("JSR _global_main\n"); }
int main (int argc, char **argv) { FILE *ft=0, *fr=0, *fp=0; int nt = 0, nr = 0, i; for (i = 1; i < argc; i++) if (!strcmp(argv[i], "-d")) debugp = 1; else if (!strcmp(argv[i], "-t")) { if (++i >= argc || nt++) error(usage); if ((ft = fopen(argv[i], "w")) == NULL) error(stringf("Can't write to file '%s'", argv[i])); } else if (!strcmp(argv[i], "-r")) { if (++i >= argc || nr++) error(usage); if ((fr = fopen(argv[i], "w")) == NULL) error(stringf("Can't write to file '%s'", argv[i])); } else { if (!nr || !nt) error(usage); if ((fp = fopen(argv[i], "r")) == NULL) error(stringf("Can't read file '%s'", argv[i])); wildcard = mkwildcard(); convert(fp, fr, ft); fclose(fp); } if (!nr || !nt) error(usage); fclose(fr); fclose(ft); return 0; }