void main(int argc, char *argv[]) { char *p; thechar = '8'; thestring = "386"; ctxt = linknew(&link386); ctxt->diag = yyerror; ctxt->bso = &bstdout; Binit(&bstdout, 1, OWRITE); listinit8(); fmtinstall('L', Lconv); // Allow GOARCH=thestring or GOARCH=thestringsuffix, // but not other values. p = getgoarch(); if(strncmp(p, thestring, strlen(thestring)) != 0) sysfatal("cannot use %cc with GOARCH=%s", thechar, p); ensuresymb(NSYMB); memset(debug, 0, sizeof(debug)); cinit(); outfile = 0; setinclude("."); flagfn1("D", "name[=value]: add #define", dodef); flagfn1("I", "dir: add dir to include path", setinclude); flagcount("S", "print assembly and machine code", &debug['S']); flagcount("m", "debug preprocessor macros", &debug['m']); flagstr("o", "file: set output file", &outfile); flagstr("trimpath", "prefix: remove prefix from recorded source file paths", &ctxt->trimpath); flagparse(&argc, &argv, usage); ctxt->debugasm = debug['S']; if(argc < 1) usage(); if(argc > 1){ print("can't assemble multiple files\n"); errorexit(); } if(assemble(argv[0])) errorexit(); Bflush(&bstdout); exits(0); }
void betypeinit(void) { widthptr = 4; widthint = 4; zprog.link = P; zprog.as = AGOK; zprog.from.type = D_NONE; zprog.from.index = D_NONE; zprog.from.scale = 0; zprog.to = zprog.from; listinit8(); }
void listinit(void) { listinit8(); }
void main(int argc, char *argv[]) { char *p; int c; thechar = '8'; thestring = "386"; ctxt = linknew(&link386); ctxt->diag = yyerror; ctxt->bso = &bstdout; Binit(&bstdout, 1, OWRITE); listinit8(); fmtinstall('L', Lconv); // Allow GOARCH=thestring or GOARCH=thestringsuffix, // but not other values. p = getgoarch(); if(strncmp(p, thestring, strlen(thestring)) != 0) sysfatal("cannot use %cc with GOARCH=%s", thechar, p); ensuresymb(NSYMB); memset(debug, 0, sizeof(debug)); cinit(); outfile = 0; setinclude("."); ARGBEGIN { default: c = ARGC(); if(c >= 0 && c < sizeof(debug)) debug[c] = 1; break; case 'o': outfile = ARGF(); break; case 'D': p = ARGF(); if(p) { if (nDlist%8 == 0) Dlist = allocn(Dlist, nDlist*sizeof(char *), 8*sizeof(char *)); Dlist[nDlist++] = p; } break; case 'I': p = ARGF(); setinclude(p); break; case 'S': ctxt->debugasm++; break; } ARGEND if(*argv == 0) { print("usage: %ca [-options] file.s\n", thechar); errorexit(); } if(argc > 1){ print("can't assemble multiple files\n"); errorexit(); } if(assemble(argv[0])) errorexit(); Bflush(&bstdout); exits(0); }