64-bit safe

This commit is contained in:
rsc 2006-04-20 21:00:21 +00:00
parent 71e936d716
commit a5f3a00bcd
5 changed files with 62 additions and 50 deletions

View file

@ -9,8 +9,8 @@
void
maktab(void) /* define the tab stops of the table */
{
int icol, ilin, tsep, k, ik, vforml, il, text;
char *s;
int icol, ilin, tsep, k, ik, vforml, il, s, text;
char *ss;
for (icol = 0; icol < ncol; icol++) {
doubled[icol] = acase[icol] = 0;
@ -34,14 +34,15 @@ maktab(void) /* define the tab stops of the table */
switch (ctype(vforml, icol)) {
case 'a':
acase[icol] = 1;
s = table[ilin][icol].col;
if ((int)s > 0 && (int)s < 128 && text) {
ss = table[ilin][icol].col;
s = (int)(uintptr)ss;
if (s > 0 && s < 128 && text) {
if (doubled[icol] == 0)
Bprint(&tabout, ".nr %d 0\n.nr %d 0\n",
S1, S2);
doubled[icol] = 1;
Bprint(&tabout, ".if \\n(%c->\\n(%d .nr %d \\n(%c-\n",
(int)s, S2, S2, (int)s);
s, S2, S2, s);
}
case 'n':
if (table[ilin][icol].rcol != 0) {
@ -49,18 +50,19 @@ maktab(void) /* define the tab stops of the table */
Bprint(&tabout, ".nr %d 0\n.nr %d 0\n",
S1, S2);
doubled[icol] = 1;
if (real(s = table[ilin][icol].col) && !vspen(s)) {
if (tx((int)s) != text)
if (real(ss = table[ilin][icol].col) && !vspen(ss)) {
s = (int)(uintptr)ss;
if (tx(s) != text)
continue;
Bprint(&tabout, ".nr %d ", TMP);
wide(s, FN(vforml, icol), SZ(vforml, icol));
wide(ss, FN(vforml, icol), SZ(vforml, icol));
Bprint(&tabout, "\n");
Bprint(&tabout, ".if \\n(%d<\\n(%d .nr %d \\n(%d\n",
S1, TMP, S1, TMP);
}
if (text == 0 && real(s = table[ilin][icol].rcol) && !vspen(s) && !barent(s)) {
if (text == 0 && real(ss = table[ilin][icol].rcol) && !vspen(ss) && !barent(ss)) {
Bprint(&tabout, ".nr %d \\w%c%s%c\n",
TMP, F1, s, F1);
TMP, F1, ss, F1);
Bprint(&tabout, ".if \\n(%d<\\n(%d .nr %d \\n(%d\n", S2, TMP, S2,
TMP);
}
@ -69,11 +71,12 @@ maktab(void) /* define the tab stops of the table */
case 'r':
case 'c':
case 'l':
if (real(s = table[ilin][icol].col) && !vspen(s)) {
if (tx((int)s) != text)
if (real(ss = table[ilin][icol].col) && !vspen(ss)) {
s = (int)(uintptr)ss;
if (tx(s) != text)
continue;
Bprint(&tabout, ".nr %d ", TMP);
wide(s, FN(vforml, icol), SZ(vforml, icol));
wide(ss, FN(vforml, icol), SZ(vforml, icol));
Bprint(&tabout, "\n");
Bprint(&tabout, ".if \\n(%2s<\\n(%d .nr %2s \\n(%d\n",
reg(icol, CRIGHT), TMP, reg(icol, CRIGHT), TMP);
@ -100,8 +103,8 @@ maktab(void) /* define the tab stops of the table */
}
for (ilin = 0; ilin < nlin; ilin++)
if (k = lspan(ilin, icol)) {
s = table[ilin][icol-k].col;
if (!real(s) || barent(s) || vspen(s) )
ss = table[ilin][icol-k].col;
if (!real(ss) || barent(ss) || vspen(ss) )
continue;
Bprint(&tabout, ".nr %d ", TMP);
wide(table[ilin][icol-k].col, FN(ilin, icol - k), SZ(ilin, icol - k));
@ -210,7 +213,7 @@ wide(char *s, char *fn, char *size)
putsize("0");
Bprint(&tabout, "%c", F1);
} else
Bprint(&tabout, "\\n(%c-", (int)s);
Bprint(&tabout, "\\n(%c-", (int)(uintptr)s);
}