X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/f2ff982324aabe6537d47e5098156db45d4f29ea..acd69f829eb787e980cd770e037afa18220c319a:/usr/src/old/as.vax/asparse.c diff --git a/usr/src/old/as.vax/asparse.c b/usr/src/old/as.vax/asparse.c index 36c0cce7aa..95ec161e94 100644 --- a/usr/src/old/as.vax/asparse.c +++ b/usr/src/old/as.vax/asparse.c @@ -1,5 +1,5 @@ /* Copyright (c) 1980 Regents of the University of California */ -static char sccsid[] = "@(#)asparse.c 4.3 %G%"; +static char sccsid[] = "@(#)asparse.c 4.7 %G%"; #include #include "as.h" #include "asexpr.h" @@ -71,11 +71,14 @@ int yyparse() int seg_type; /*the kind of segment: data or text*/ int seg_number; /*the segment number*/ int space_value; /*how much .space needs*/ + int fill_rep; /*how many reps for .fill */ + int fill_size; /*how many bytes for .fill */ int field_width; /*how wide a field is to be*/ int field_value; /*the value to stuff in a field*/ char *stabname; /*name of stab dealing with*/ ptrall stabstart; /*where the stab starts in the buffer*/ + int reloc_how; /* how to relocate expressions */ xp = explist; ap = arglist; @@ -362,18 +365,15 @@ restlab: if ((locxp->e_xtype&XTYPE)!=XABS) { if (bitoff) yyerror("Illegal relocation in field"); - field_width=LEN1; - if (curlen==NBPW) - field_width = LEN4; - if (curlen==NBPW/2) - field_width = LEN2; + switch(curlen){ + case NBPW/4: reloc_how = TYPB; break; + case NBPW/2: reloc_how = TYPW; break; + case NBPW: reloc_how = TYPL; break; + } if (passno == 1){ - dotp->e_xvalue += reflen[field_width]; + dotp->e_xvalue += ty_nbyte[reloc_how]; } else { - outrel(&locxp->e_xvalue, - field_width, - locxp->e_xtype, - locxp->e_xname); + outrel(locxp, reloc_how); } } else { field_value = locxp->e_xvalue & ( (1L << field_width)-1); @@ -422,20 +422,35 @@ restlab: break; #ifdef UNIX - case IFILL: /* .fill count, value */ - /* fill count bytes with value */ + /* + * .fill rep, size, value + * repeat rep times: fill size bytes with (truncated) value + * size must be between 1 and 8 + */ + case IFILL: shift; expr(locxp, val); if (locxp->e_xtype != XABS) yyerror("Fill repetition count not absolute"); - space_value = locxp->e_xvalue; + fill_rep = locxp->e_xvalue; shiftover(CM); expr(locxp, val); if (locxp->e_xtype != XABS) - yyerror("Fill value not absolute"); + yyerror("Fill size not absolute"); + fill_size = locxp->e_xvalue; + if (fill_size <= 0 || fill_size > 8) + yyerror("Fill count not in in 1..8"); + shiftover(CM); + expr(locxp, val); + if (passno == 2 && locxp->e_xtype != XABS) + yyerror("Fill value not absolute"); flushfield(NBPW/4); - while(space_value-- > 0) - outb(locxp->e_xvalue & 0xFF); + if (passno == 1) { + locxp->e_xvalue += fill_rep * fill_size; + } else { + while(fill_rep-- > 0) + bwrite(&locxp->e_xvalue, fill_size, txtfil); + } break; #endif UNIX @@ -531,7 +546,7 @@ restlab: * final expression is taken to be the current * location counter, and is patched by the 2nd pass * - * .stab{,}*8,, , , + * .stab{,}*NCPS,, , , * .stabn , , , * .stabs STRING, , , , * .stabd , , # . @@ -550,7 +565,7 @@ restlab: (char *)stabstart -= sizeof(struct symtab *); (char *)stabstart -= sizeof(toktype); shift; - for (argcnt = 0; argcnt < 8; argcnt++){ + for (argcnt = 0; argcnt < NCPS; argcnt++){ expr(locxp, val); stpt->s_name[argcnt] = locxp->e_xvalue; xp = explist; @@ -1018,13 +1033,8 @@ int funnyreg(val, regnoback) /*what the read head will sit on*/ yyerror(s, a1, a2,a3,a4,a5) char *s; { - FILE *sink; -#ifdef DEBUG - sink = stdout; -#else not DEBUG - sink = stderr; -#endif DEBUG +#define sink stdout if (anyerrs == 0 && ! silent) fprintf(sink, "Assembler:\n"); @@ -1035,3 +1045,19 @@ yyerror(s, a1, a2,a3,a4,a5) fprintf(sink, s, a1, a2,a3,a4,a5); fprintf(sink, "\n"); } + +/*VARARGS1*/ +yywarning(s, a1, a2,a3,a4,a5) + char *s; +{ + +#define sink stdout + + if (anyerrs == 0 && ! silent) + fprintf(sink, "Assembler:\n"); + if (silent) return; + + fprintf(sink, "\"%s\", line %d: WARNING: ", dotsname, lineno); + fprintf(sink, s, a1, a2,a3,a4,a5); + fprintf(sink, "\n"); +}