Skip to content

Commit

Permalink
nroff: Support for \[char<n>] (if .g=1)
Browse files Browse the repository at this point in the history
man: groff's an-ext.tmac added for macros
    SY, YS, OP, UR, UE, MT, ME, TQ, EX, EE
  • Loading branch information
n-t-roff committed Dec 18, 2015
1 parent 35863ae commit 5e4181a
Show file tree
Hide file tree
Showing 15 changed files with 172 additions and 62 deletions.
3 changes: 3 additions & 0 deletions .gitignore
@@ -1,2 +1,5 @@
.DS_STORE
*.swp
*.o
Makefile
y.tab.*
4 changes: 1 addition & 3 deletions troff/ext.h
Expand Up @@ -391,9 +391,7 @@ extern int roman(int, int (*)(tchar));
extern int roman0(int, int (*)(tchar), char *, char *);
extern int abc(int, int (*)(tchar));
extern int abc0(int, int (*)(tchar));
#undef atoi
#define atoi xxatoi
extern int atoi(void);
extern int hatoi(void);
#undef atof
#define atof xxatof
extern float atof(void);
Expand Down
12 changes: 6 additions & 6 deletions troff/n1.c
Expand Up @@ -2036,7 +2036,7 @@ caself(void) /* set line number and file */

if (skip(1))
return;
n = atoi();
n = hatoi();
cfline[ifi] = numtab[CD].val = n - 2;
if (skip(0))
return;
Expand Down Expand Up @@ -2169,7 +2169,7 @@ casedb(void)
if (skip(1))
return;
noscale++;
debug = max(atoi(), 0);
debug = max(hatoi(), 0);
noscale = 0;
#endif /* DEBUG */
}
Expand All @@ -2188,7 +2188,7 @@ casexflag(void)
gemu = 0;
skip(1);
noscale++;
i = atoi();
i = hatoi();
noscale--;
if (!nonumb)
_xflag = xflag = i & 3;
Expand All @@ -2204,7 +2204,7 @@ casecp(void)
#endif
gflag = 1;
noscale++;
if (skip(1) || (atoi() && !nonumb))
if (skip(1) || (hatoi() && !nonumb))
xflag = 1;
else
xflag = 3;
Expand All @@ -2222,9 +2222,9 @@ caserecursionlimit(void)
{
skip(1);
noscale++;
max_recursion_depth = atoi();
max_recursion_depth = hatoi();
skip(0);
max_tail_depth = atoi();
max_tail_depth = hatoi();
noscale--;
}

Expand Down
8 changes: 4 additions & 4 deletions troff/n3.c
Expand Up @@ -1262,7 +1262,7 @@ caseshift(void)
i = 1;
else {
noscale++;
i = atoi();
i = hatoi();
noscale--;
if (nonumb)
return;
Expand Down Expand Up @@ -1511,7 +1511,7 @@ casewatchlength(void)

if (!skip(1)) {
noscale++;
i = atoi();
i = hatoi();
noscale--;
if (!nonumb)
watchlength = i;
Expand Down Expand Up @@ -1765,9 +1765,9 @@ casesubstring(void)
if (skip(1))
return;
noscale++;
n1 = atoi();
n1 = hatoi();
if (skip(0) == 0)
n2 = atoi();
n2 = hatoi();
noscale--;
savip = ip;
ip = (filep)contp->mx;
Expand Down
2 changes: 1 addition & 1 deletion troff/n4.c
Expand Up @@ -865,7 +865,7 @@ agetch(void)
}

int
atoi(void)
hatoi(void)
{
struct acc a;

Expand Down
26 changes: 13 additions & 13 deletions troff/n5.c
Expand Up @@ -153,7 +153,7 @@ casepadj(void)
if (skip(0))
padj = 1;
else {
n = atoi();
n = hatoi();
if (!nonumb)
padj = n;
}
Expand Down Expand Up @@ -245,7 +245,7 @@ casehy(void)
if (skip(0))
return;
noscale++;
i = atoi();
i = hatoi();
noscale = 0;
if (nonumb)
return;
Expand All @@ -267,7 +267,7 @@ casehlm(void)

if (!skip(0)) {
noscale++;
i = atoi();
i = hatoi();
noscale = 0;
if (!nonumb)
hlm = i;
Expand Down Expand Up @@ -315,7 +315,7 @@ casehylen(void)
if (skip(0))
hylen = 5;
else {
n = atoi();
n = hatoi();
if (!nonumb)
hylen = n;
}
Expand Down Expand Up @@ -444,7 +444,7 @@ cerj(int dorj)

noscale++;
skip(0);
i = max(atoi(), 0);
i = max(hatoi(), 0);
if (nonumb)
i = 1;
tbreak();
Expand Down Expand Up @@ -483,7 +483,7 @@ _brnl(int p)
if (skip(0))
n = INT_MAX;
else {
n = atoi();
n = hatoi();
if (nonumb || n < 0)
n = p ? brpnl : brpnl;
}
Expand Down Expand Up @@ -737,7 +737,7 @@ casevpt(void)
{
if (skip(1))
return;
vpt = atoi() != 0;
vpt = hatoi() != 0;
}


Expand Down Expand Up @@ -1200,7 +1200,7 @@ getev(int *nxevp, char **namep)
c = cbits(ch);
if (xflag == 0 || isdigit(c) || c == '(') {
noscale++;
nxev = atoi();
nxev = hatoi();
noscale = 0;
if (nonumb) {
flushi();
Expand Down Expand Up @@ -1790,7 +1790,7 @@ casecontinue(int _break)
struct s *s;

noscale++;
if (skip(0) || (i = atoi()) <= 0 || nonumb)
if (skip(0) || (i = hatoi()) <= 0 || nonumb)
i = 1;
noscale--;
j = 0;
Expand Down Expand Up @@ -2078,7 +2078,7 @@ caseta(void)
for (j = 0; j < NTAB - 1 && !nonumb; j++) {
if (skip(0))
break;
T[j] = atoi() & TABMASK;
T[j] = hatoi() & TABMASK;
if (!nonumb)
switch (cbits(ch)) {
case 'C':
Expand Down Expand Up @@ -2183,7 +2183,7 @@ caseul(void)
if (skip(0))
i = 1;
else
i = atoi();
i = hatoi();
if (ul && (i == 0)) {
font = sfont;
ul = cu = 0;
Expand Down Expand Up @@ -2226,7 +2226,7 @@ caseit(int cflag)
it = itc = itmac = 0;
noscale++;
skip(0);
i = atoi();
i = hatoi();
skip(0);
if (!nonumb && (itmac = getrq(1))) {
it = i;
Expand Down Expand Up @@ -2405,7 +2405,7 @@ casenn(void)
{
noscale++;
skip(0);
nn = max(atoi(), 1);
nn = max(hatoi(), 1);
noscale = 0;
}

Expand Down
2 changes: 1 addition & 1 deletion troff/n7.c
Expand Up @@ -1422,7 +1422,7 @@ getword(int x)
} else
g1: nexti = GETCH();
j = cbits(i = nexti);
if (gemu && j == FILLER)
if (gemu && (j == FILLER || j == UNPAD))
inword = 0;
else
if (!ismot(i) && j != ohc)
Expand Down
2 changes: 1 addition & 1 deletion troff/n8.c
Expand Up @@ -226,7 +226,7 @@ caseht(void)
if (skip(0))
return;
noscale++;
thresh = atoi();
thresh = hatoi();
noscale = 0;
}

Expand Down
8 changes: 4 additions & 4 deletions troff/n9.c
Expand Up @@ -126,7 +126,7 @@ setline(void)
delim = c;
vflag = 0;
dfact = EM;
length = quant(atoi(), HOR);
length = quant(hatoi(), HOR);
dfact = 1;
if (!length) {
eat(delim);
Expand Down Expand Up @@ -288,7 +288,7 @@ setvline(void)
delim = c;
dfact = lss;
vflag++;
i = quant(atoi(), VERT);
i = quant(hatoi(), VERT);
dfact = 1;
if (!i) {
eat(delim);
Expand Down Expand Up @@ -379,7 +379,7 @@ setdraw (void) /* generate internal cookies for a drawing function */
ch = c;
vflag = 0;
dfact = type == DRAWTHICKNESS ? 1 : EM;
dx[i] = quant(atoi(), HOR);
dx[i] = quant(hatoi(), HOR);
if (dx[i] > MAXMOT)
dx[i] = MAXMOT;
else if (dx[i] < -MAXMOT)
Expand All @@ -390,7 +390,7 @@ setdraw (void) /* generate internal cookies for a drawing function */
}
vflag = 1;
dfact = lss;
dy[i] = quant(atoi(), VERT);
dy[i] = quant(hatoi(), VERT);
if (type == DRAWTHICKNESS)
dy[i] = 0;
else if (dy[i] > MAXMOT)
Expand Down
17 changes: 13 additions & 4 deletions troff/nroff.d/n6.c
Expand Up @@ -51,6 +51,7 @@
*/

#include <stdio.h>
#include <string.h>
#ifdef EUC
#include <limits.h>
#include <stdlib.h>
Expand Down Expand Up @@ -158,9 +159,17 @@ setch(int delim)
if (s - temp == 1)
return temp[0];
else if (s - temp != 2) {
size_t l;
*s = '\0';
l = strlen(temp);
if (j != ']')
nodelim(']');
else if (gemu && (l == 6 || (l == 7
&& temp[6] >= '0' && temp[6] <= '9'))
&& temp[5] >= '0' && temp[5] <= '9'
&& temp[4] >= '0' && temp[4] <= '9'
&& !strncmp(temp, "char", 4))
return atoi(temp + 4) + nchtab + _SPECCHAR_ST;
else if ((j = findch(temp)) > 0)
return j | chbits;
else if (warn & WARN_CHAR)
Expand Down Expand Up @@ -272,7 +281,7 @@ setps(void)
} else if (xflag) { /* \s+[dd], */
k = j == '[' ? ']' : j; /* \s-'dd' */
setcbits(c, k);
atoi();
hatoi();
if (nonumb)
return;
if (!issame(getch(), c))
Expand Down Expand Up @@ -439,7 +448,7 @@ mot(void)

j = HOR;
delim = getch(); /*eat delim*/
if ((n = atoi())) {
if ((n = hatoi())) {
if (vflag)
j = VERT;
i = makem(quant(n, j));
Expand Down Expand Up @@ -557,7 +566,7 @@ casebd(void)
bd1:
skip(0);
noscale++;
bdtab[j] = atoi();
bdtab[j] = hatoi();
noscale = 0;
}

Expand Down Expand Up @@ -608,7 +617,7 @@ xlss(void)

getch();
dfact = lss;
i = quant(atoi(), VERT);
i = quant(hatoi(), VERT);
dfact = 1;
getch();
if (i >= 0)
Expand Down

0 comments on commit 5e4181a

Please sign in to comment.