Reduce indentation level of big switch statement.

A style thing. I find it easier to read this way.

i.e. do:

while(1) {
  if (blah) {
    ...
    continue;
  }
  ... // big switch statement
}

instead of:

while(1) {
  if (blah) {
    ...
  } else {
    ... // big switch statement
  }
}
This commit is contained in:
Michael Munday 2016-12-02 13:50:09 -05:00
parent fc2b633532
commit 2324be897e

View File

@ -196,89 +196,90 @@ void dasm_put(Dst_DECL, int start, ...)
unsigned short action = ins; unsigned short action = ins;
if (action >= DASM__MAX) { if (action >= DASM__MAX) {
ofs += 2; ofs += 2;
} else { continue;
int *pl, n = action >= DASM_REL_PC ? va_arg(ap, int) : 0; }
switch (action) {
case DASM_STOP: int *pl, n = action >= DASM_REL_PC ? va_arg(ap, int) : 0;
goto stop; switch (action) {
case DASM_SECTION: case DASM_STOP:
n = (ins & 255); goto stop;
CK(n < D->maxsection, RANGE_SEC); case DASM_SECTION:
D->section = &D->sections[n]; n = (ins & 255);
goto stop; CK(n < D->maxsection, RANGE_SEC);
case DASM_ESC: D->section = &D->sections[n];
p++; goto stop;
ofs += 4; case DASM_ESC:
break; p++;
case DASM_REL_EXT: ofs += 4;
break; break;
case DASM_ALIGN: case DASM_REL_EXT:
ofs += (ins & 255); break;
b[pos++] = ofs; case DASM_ALIGN:
break; ofs += (ins & 255);
case DASM_REL_LG: b[pos++] = ofs;
n = (ins & 2047) - 10; break;
pl = D->lglabels + n; case DASM_REL_LG:
/* Bkwd rel or global. */ n = (ins & 2047) - 10;
if (n >= 0) { pl = D->lglabels + n;
CK(n >= 10 || *pl < 0, RANGE_LG); /* Bkwd rel or global. */
CKPL(lg, LG); if (n >= 0) {
goto putrel; CK(n >= 10 || *pl < 0, RANGE_LG);
}
pl += 10;
n = *pl;
if (n < 0)
n = 0; /* Start new chain for fwd rel if label exists. */
goto linkrel;
case DASM_REL_PC:
pl = D->pclabels + n;
CKPL(pc, PC);
putrel:
n = *pl;
if (n < 0) { /* Label exists. Get label pos and store it. */
b[pos] = -n;
} else {
linkrel:
b[pos] = n; /* Else link to rel chain, anchored at label. */
*pl = pos;
}
pos++;
break;
case DASM_LABEL_LG:
pl = D->lglabels + (ins & 2047) - 10;
CKPL(lg, LG); CKPL(lg, LG);
goto putlabel; goto putrel;
case DASM_LABEL_PC:
pl = D->pclabels + n;
CKPL(pc, PC);
putlabel:
n = *pl; /* n > 0: Collapse rel chain and replace with label pos. */
while (n > 0) {
int *pb = DASM_POS2PTR(D, n);
n = *pb;
*pb = pos;
}
*pl = -pos; /* Label exists now. */
b[pos++] = ofs; /* Store pass1 offset estimate. */
break;
case DASM_IMM16:
ofs += 2;
fprintf(stderr, "DASM_IMM16 not implemented\n");
break;
case DASM_IMM32:
ofs += 4;
CK((n >> 32) == 0, RANGE_I);
b[pos++] = n;
break;
case DASM_DISP20:
CK(-(1 << 19) <= n && n < (1 << 19), RANGE_I);
b[pos++] = n;
break;
case DASM_DISP12:
CK((n >> 12) == 0, RANGE_I);
b[pos++] = n;
break;
} }
pl += 10;
n = *pl;
if (n < 0)
n = 0; /* Start new chain for fwd rel if label exists. */
goto linkrel;
case DASM_REL_PC:
pl = D->pclabels + n;
CKPL(pc, PC);
putrel:
n = *pl;
if (n < 0) { /* Label exists. Get label pos and store it. */
b[pos] = -n;
} else {
linkrel:
b[pos] = n; /* Else link to rel chain, anchored at label. */
*pl = pos;
}
pos++;
break;
case DASM_LABEL_LG:
pl = D->lglabels + (ins & 2047) - 10;
CKPL(lg, LG);
goto putlabel;
case DASM_LABEL_PC:
pl = D->pclabels + n;
CKPL(pc, PC);
putlabel:
n = *pl; /* n > 0: Collapse rel chain and replace with label pos. */
while (n > 0) {
int *pb = DASM_POS2PTR(D, n);
n = *pb;
*pb = pos;
}
*pl = -pos; /* Label exists now. */
b[pos++] = ofs; /* Store pass1 offset estimate. */
break;
case DASM_IMM16:
ofs += 2;
fprintf(stderr, "DASM_IMM16 not implemented\n");
break;
case DASM_IMM32:
ofs += 4;
CK((n >> 32) == 0, RANGE_I);
b[pos++] = n;
break;
case DASM_DISP20:
CK(-(1 << 19) <= n && n < (1 << 19), RANGE_I);
b[pos++] = n;
break;
case DASM_DISP12:
CK((n >> 12) == 0, RANGE_I);
b[pos++] = n;
break;
} }
} }
stop: stop: