simplified assertion

This commit is contained in:
ceriel 1989-01-19 13:48:09 +00:00
parent d55d4bb69f
commit 4c76583aba
4 changed files with 21 additions and 13 deletions

View file

@ -115,16 +115,19 @@ program : /* empty */
newlabel(fb_shift((int)$2)); newlabel(fb_shift((int)$2));
} }
| program CODE1 | program CODE1
{ emit1((char)$2); LISTLINE(0);} { emit1((int)$2); LISTLINE(0);}
| program CODE2 | program CODE2
{ emit2((short)$2); LISTLINE(0);} { emit2((int)$2); LISTLINE(0);}
| program CODE4 | program CODE4
{ emit4((long)$2); LISTLINE(0);} { emit4((long)$2); LISTLINE(0);}
| program operation ';' | program operation ';'
| program operation '\n' | program operation '\n'
{ lineno++; LISTLINE(1); RELODONE;} { lineno++; LISTLINE(1); RELODONE;}
| program '#' NUMBER STRING '\n' | program '#' NUMBER STRING '\n'
{ lineno++; LISTLINE(1); RELODONE;} { lineno = $3;
if (modulename) strncpy(modulename, &stringbuf[1], 63);
LISTLINE(1); RELODONE;
}
| program error '\n' | program error '\n'
{ serror("syntax error"); yyerrok; { serror("syntax error"); yyerrok;
lineno++; LISTLINE(1); RELODONE; lineno++; LISTLINE(1); RELODONE;

View file

@ -433,8 +433,14 @@ pass_23(n)
newmodule(s) newmodule(s)
char *s; char *s;
{ {
static char nmbuf[64];
switchsect(S_UND); switchsect(S_UND);
modulename = s; if (s && s != modulename) {
strncpy(nmbuf, s, 63);
modulename = nmbuf;
}
else modulename = s;
lineno = 1; lineno = 1;
#ifdef NEEDED #ifdef NEEDED
/* /*

View file

@ -89,7 +89,7 @@ register item_t *ip;
if (store(ip, (valu_t) DOTVAL) == 0) if (store(ip, (valu_t) DOTVAL) == 0)
return; return;
#ifdef THREE_PASS #ifdef THREE_PASS
assert(pass != PASS_2 || (oldval -= ip->i_valu) == DOTGAIN); assert(pass != PASS_2 || oldval - ip->i_valu == DOTGAIN);
#endif #endif
} }

View file

@ -233,7 +233,6 @@ small(fitsmall, gain)
/* ---------- output ---------- */ /* ---------- output ---------- */
emit1(arg) emit1(arg)
char arg;
{ {
#ifdef LISTING #ifdef LISTING
if (listeoln) { if (listeoln) {
@ -268,12 +267,12 @@ char arg;
} }
emit2(arg) emit2(arg)
short arg; int arg;
{ {
#ifdef BYTES_REVERSED #ifdef BYTES_REVERSED
emit1((char)(arg>>8)); emit1((char)arg); emit1((arg>>8)); emit1(arg);
#else #else
emit1((char)arg); emit1((char)(arg>>8)); emit1(arg); emit1((arg>>8));
#endif #endif
} }
@ -281,9 +280,9 @@ emit4(arg)
long arg; long arg;
{ {
#ifdef WORDS_REVERSED #ifdef WORDS_REVERSED
emit2((short)(arg>>16)); emit2((short)(arg)); emit2((arg>>16)); emit2((arg));
#else #else
emit2((short)(arg)); emit2((short)(arg>>16)); emit2((arg)); emit2((arg>>16));
#endif #endif
} }
@ -293,9 +292,9 @@ int n;
{ {
switch (n) { switch (n) {
case 1: case 1:
emit1((char)val); break; emit1((int)val); break;
case 2: case 2:
emit2((short)val); break; emit2((int)val); break;
case 4: case 4:
emit4((long)val); break; emit4((long)val); break;
default: default: