X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/31cef89cb428866f787983e68246030321893df4..4b9ccde74dc34e450ed96bcd3d044f78cf393d8d:/usr/src/cmd/pc0/case.c diff --git a/usr/src/cmd/pc0/case.c b/usr/src/cmd/pc0/case.c index 76b947a95d..5b4e7bbc8c 100644 --- a/usr/src/cmd/pc0/case.c +++ b/usr/src/cmd/pc0/case.c @@ -1,6 +1,6 @@ /* Copyright (c) 1979 Regents of the University of California */ -static char sccsid[] = "@(#)case.c 1.1 8/27/80"; +static char sccsid[] = "@(#)case.c 1.3 3/8/81"; #include "whoami.h" #include "0.h" @@ -34,7 +34,8 @@ caseop(r) char *brtab0; char *csend; int w, i, j, m, n; - int nr, goc; + int goc; + bool nr; goc = gocnt; /* @@ -81,7 +82,7 @@ caseop(r) * Allocate case table space */ ctab = i = malloc(n * sizeof *ctab); - if (i == -1) { + if (i == 0) { error("Ran out of memory (case)"); pexit(DIED); } @@ -137,7 +138,10 @@ caseop(r) putspace(n * 2); put(1, O_CASEBEG); for (i=0; i> 1), ctab[i].clong); + if (w <= 2) + put(2 ,O_CASE1 + (w >> 1), (int)ctab[i].clong); + else + put(2 ,O_CASE4, ctab[i].clong); put(1, O_CASEEND); } csend = getlab(); @@ -155,21 +159,21 @@ caseop(r) * statement with a branch back * to the TRA above. */ - nr = 1; + nr = TRUE; for (cl = r[3]; cl != NIL; cl = cl[2]) { cs = cl[1]; if (cs == NIL) continue; if (p != NIL) for (cs = cs[2]; cs != NIL; cs = cs[2]) { - patchfil(brtab - 1, lc - brtab0, 1); + patchfil(brtab - 1, (long)(lc - brtab0), 1); brtab++; } cs = cl[1]; putcnt(); level++; statement(cs[3]); - nr &= noreach; + nr = (noreach && nr); noreach = 0; put(2, O_TRA, csend); level--;