Add original unix v6

This commit is contained in:
memnoth
2018-01-27 22:35:41 +09:00
commit 2c7099ee50
664 changed files with 106254 additions and 0 deletions
+164
View File
@@ -0,0 +1,164 @@
\{#
#
int fromflg 0;
\}
%term CONTIG QTEXT SPACE THIN TAB
%term UP DOWN BACK FWD
%term MATRIX LCOL CCOL RCOL COL
%term MARK LINEUP
%term SUM INT PROD UNION INTER
%term LPILE PILE CPILE RPILE ABOVE
%term DEFINE DELIM GSIZE GFONT
%right FROM TO
%left OVER SQRT
%right SUPER SUB
%right SIZE FONT ROMAN ITALIC BOLD
%left MQ MQ1
%left LEFT RIGHT
%right DOT DOTDOT HAT TILDE BAR UNDER
%%
stuff : eqn ={ putout($1); }
| error ={ error(!FATAL, "syntax error in equation %d", first); }
| ={ eqnreg = 0; }
;
eqn : box ={ if(dbg)printf(".\teqn: S%d\n",$1); }
| eqn box ={ eqnbox($1,$2); }
| eqn MARK ={ mark($1); }
| MARK ={ mark(0); }
| eqn LINEUP ={ lineup($1); }
| LINEUP ={ lineup(0); }
;
matrix : MATRIX ={ $$ = ct; } ;
collist : column
| collist column
;
column : lcol MQ list MQ1 ={ column('L',$1,$3); }
| ccol MQ list MQ1 ={ column('C',$1,$3); }
| rcol MQ list MQ1 ={ column('R',$1,$3); }
| col MQ list MQ1 ={ column('-',$1,$3); }
;
lcol : LCOL ={ $$ = ct++; } ;
ccol : CCOL ={ $$ = ct++; } ;
rcol : RCOL ={ $$ = ct++; } ;
col : COL ={ $$ = ct++; } ;
sbox : super box %prec SUPER
={ $$ = $2; }
| %prec SUB
={ $$ = 0; }
;
box : box OVER box ={ boverb($1,$3); }
| size box %prec SIZE
={ size($1,$2); }
| font box %prec FONT
={ font($1,$2); }
| SQRT box ={ sqrt($2); }
| lpile MQ list MQ1 %prec LPILE
={ lpile('L', $1, ct); ct=$1; }
| cpile MQ list MQ1 %prec CPILE
={ lpile('C', $1, ct); ct=$1; }
| rpile MQ list MQ1 %prec RPILE
={ lpile('R', $1, ct); ct=$1; }
| pile MQ list MQ1 %prec PILE
={ lpile('-', $1, ct); ct=$1; }
| box sub box sbox %prec SUB
={ if(dbg)printf(".\t sub box %d %d %d\n",$1,$3,$4);
if($4 == 0)bshiftb($1,$2,$3);
else shift2($1,$3,$4);
}
| box super box %prec SUPER
={ bshiftb($1,$2,$3); }
| left eqn right %prec LEFT
={ paren($1,$2,$3); }
| pbox
| box from box to box %prec TO
={ fromto($1,$3,$5); fromflg=0; }
| box from box %prec FROM
={ fromto($1,$3,0); fromflg=0; }
| box to box %prec TO
={ fromto($1,0,$3); }
| box diacrit ={ diacrit($1,$2); }
| fwd box ={ move(0,$1,$2); }
| up box ={ move(1,$1,$2); }
| back box ={ move(2,$1,$2); }
| down box ={ move(3,$1,$2); }
| matrix MQ collist MQ1 ={ matrix($1,$3); }
;
fwd : FWD text ={ $$ = numb($1); } ;
up : UP text ={ $$ = numb($1); } ;
back : BACK text ={ $$ = numb($1); } ;
down : DOWN text ={ $$ = numb($1); } ;
diacrit : HAT ={ $$ = 'H'; }
| BAR ={ $$ = 'B'; }
| UNDER ={ $$ = 'N'; } /* under bar */
| DOT ={ $$ = 'D'; }
| TILDE ={ $$ = 'T'; }
| DOTDOT ={ $$ = 'U'; } /* umlaut = double dot */
;
from : FROM
;
to : TO
;
left : LEFT text ={ $$ = $2->c1; }
| LEFT MQ ={ $$ = '{'; }
;
right : RIGHT text ={ $$ = $2->c1; }
| RIGHT MQ1 ={ $$ = '}'; }
| ={ $$ = 0; }
;
list : eqn ={ lp[ct++] = $1; }
| list ABOVE eqn ={ lp[ct++] = $3; }
;
lpile : LPILE ={ $$=ct; } ;
cpile : CPILE ={ $$=ct; } ;
pile : PILE ={ $$=ct; } ;
rpile : RPILE ={ $$=ct; } ;
size : SIZE text
;
font : ROMAN
| ITALIC
| BOLD
| FONT text
;
sub : SUB ={ shift(1); } ;
super : SUPER ={ shift(-1); } ;
pbox : MQ eqn MQ1 ={ $$ = $2; }
| QTEXT ={ text('q',$1); }
| CONTIG ={ text('c',$1); }
| SPACE ={ text('~', $1); }
| THIN ={ text('^', $1); }
| TAB ={ text('\t', $1); }
| SUM ={ text('c', "SIGMA"); }
| PROD ={ text('c', "PI"); }
| INT ={ text('c', "^"); }
| UNION ={ text('c' ,"U"); }
| INTER ={ text('c', "A"); }
;
text : CONTIG
| QTEXT
| SPACE ={ $$ = & "\\|\\|"; }
| THIN ={ $$ = & "\\|"; }
;
%%
+35
View File
@@ -0,0 +1,35 @@
#
int dbg;
int ct;
int lp[40];
char used[100]; /* available registers */
int ps; /* dflt init pt size */
int ft; /* dflt font */
int first;
extern int fout, fin;
int ifile;
int linect; /* line number in file */
int eqline; /* line where eqn started */
int svargc;
char **svargv;
int eht[100];
int ebase[100];
int ewid[100];
struct { char c1; char c2; };
int yyval;
int *yypv;
int yylval;
int tht[30];
int tbase[30];
int ptr;
char *nptr[50];
char *sptr[50];
int eqnreg, eqnht, eqnbase;
int lefteq, righteq;
int lastchar; /* last character read by lex */
#define FATAL 1
int ESC;
int HREV;
int HFWD;
int SI;
int SO;
+218
View File
@@ -0,0 +1,218 @@
# include "ne.h"
boverb(p1,p2) int p1,p2; {
int h,b,w,treg;
yyval = oalloc();
eht[yyval] = eht[p1] + eht[p2] ;
ebase[yyval] = eht[p2] - 1;
ewid[yyval] = w = max(ewid[p1],ewid[p2]);
if(dbg)printf(".\tb:bob: S%d <- S%d over S%d; b=%d,h=%d,w=%d\n",
yyval, p1, p2, ebase[yyval], eht[yyval], ewid[yyval]);
printf(".ds %d ", yyval);
down(eht[p2]-ebase[p2]-1);
fwd((ewid[yyval]-ewid[p2])/2);
printf("\\*(%d", p2);
back((ewid[yyval]+ewid[p2])/2);
up(eht[p2]-ebase[p2]+ebase[p1]);
fwd((ewid[yyval]-ewid[p1])/2);
printf("\\*(%d", p1);
back((ewid[yyval]+ewid[p1])/2);
down(ebase[p1]);
line(ewid[yyval]);
down(1);
putchar('\n');
ofree(p1);
ofree(p2);
}
bshiftb(p1,dir,p2) int p1,dir,p2; {
int shval, d1, h1, b1,h2,b2;
yyval = oalloc();
ewid[yyval] = ewid[p1] + ewid[p2];
h1 = eht[p1]; b1 = ebase[p1];
h2 = eht[p2]; b2 = ebase[p2];
printf(".ds %d \"\\*(%d", yyval, p1);
if( dir > 0 ){ /* subscript */
shval = h2-b2-1;
if( shval < b1 )
shval = b1;
down(shval);
printf("\\*(%d", p2);
up(shval);
ebase[yyval] = max(b1, h2-1);
eht[yyval] = h1 + max(0,h2-b1-1);
} else { /* superscript */
ebase[yyval] = b1;
shval = b2+1;
if( shval+h2 < h1-b1 )
shval = h1-b1-h2;
up(shval);
printf("\\*(%d", p2);
down(shval);
eht[yyval] = max(h1, b1+1+h2);
}
putchar('\n');
if(dbg)printf(".\tb:b shift b: S%d <- S%d vert %d S%d vert %d; b=%d,h=%d,w=%d\n",
yyval,p1,shval,p2,-shval,ebase[yyval],eht[yyval],ewid[yyval]);
ofree(p1);
ofree(p2);
}
eqnbox(p1,p2) int p1,p2; {
int b,h;
if( p1==0 ){
yyval = p2; return;
}
yyval = oalloc();
b = max(ebase[p1], ebase[p2]);
eht[yyval] = h = b + max(eht[p1]-ebase[p1],
eht[p2]-ebase[p2]);
ebase[yyval] = b;
ewid[yyval] = ewid[p1] + ewid[p2];
if(dbg)printf(".\te:eb: S%d <- S%d S%d; b=%d,h=%d,w=%d\n",
yyval,p1,p2,b,h,ewid[yyval]);
printf(".ds %d \\*(%d\\*(%d\n", yyval, p1, p2);
ofree(p1);
ofree(p2);
}
size(p1,p2) int p1,p2; {
yyval = p2;
}
numb(p1) char *p1; {
int i, n, c;
for(i=n=0; (c=p1[i++])!='\0'; )
if( c>='0' && c<='9' )
n = n*10 + c-'0';
if(dbg)printf(".\tnumb: %s %d\n",p1,n);
return( n );
}
font(p1,p2) int p1,p2; {
yyval = p2;
}
shift(p1) int p1; {
yyval = p1;
if(dbg)printf(".\tshift: %d\n",yyval);
}
sqrt(p2) int p2; {
int nps, h, i;
yyval = oalloc();
h = eht[p2];
eht[yyval] = h+1;
nps = h-1;
ebase[yyval] = ebase[p2];
ewid[yyval] = ewid[p2] + 2;
if(dbg)printf(".\tsqrt: S%d <- S%d;b=%d,h=%d,w=%d\n",
yyval,p2,ebase[yyval],eht[yyval],ewid[yyval]);
printf(".ds %d \\e|", yyval);
for( i=2; i<=nps; i++ ){
back(1);
up(1);
putchar('|');
}
up(2);
line(ewid[p2]);
back(ewid[p2]);
down(h);
printf("\\*(%d\n", p2);
ofree(p2);
}
lpile(type,p1,p2) int type,p1,p2; {
int w,bi,hi,i,gap,h,b,j, nlist, nlist2, mid;
yyval = oalloc();
gap = type == '-' ? 0 : 1;
nlist = p2 - p1;
nlist2 = (nlist+1)/2;
mid = p1 + nlist2 -1;
h = b = w = 0;
for( i=p1; i<p2; i++ ){
h =+ eht[lp[i]];
w = max(w, ewid[lp[i]]);
}
eht[yyval] = h + (nlist-1)*gap;
ewid[yyval] = w;
for( i=p2-1; i>mid; i-- )
b =+ eht[lp[i]] + gap;
ebase[yyval] = (nlist%2) ? b + ebase[lp[mid]] : b - gap -1;
if(dbg){
printf(".\tS%d <- %c pile of:", yyval, type);
for( i=p1; i<p2; i++)
printf(" S%d", lp[i]);
printf(";h=%d b=%d,w=%d\n",eht[yyval],ebase[yyval],ewid[yyval]);
}
printf(".ds %d \\\n", yyval);
down(ebase[yyval]);
if( type=='R' )
fwd(ewid[yyval]);
for(i = p2-1; i >=p1; i--){
hi = eht[lp[i]];
bi = ebase[lp[i]];
switch(type){
case 'L':
up(bi);
printf("\\*(%d", lp[i]);
back(ewid[lp[i]]);
up(hi-bi+gap);
printf("\\\n");
continue;
case 'R':
up(bi);
back(ewid[lp[i]]);
printf("\\*(%d", lp[i]);
up(hi-bi+gap);
printf("\\\n");
continue;
case 'C':
case '-':
up(bi);
fwd((ewid[yyval]-ewid[lp[i]])/2);
printf("\\*(%d", lp[i]);
back((ewid[yyval]+ewid[lp[i]])/2);
up(hi-bi+gap);
printf("\\\n");
continue;
}
}
down(eht[yyval]-ebase[yyval]+gap);
if( type!='R' )
fwd(ewid[yyval]);
putchar('\n');
for( i=p1; i<p2; i++ ) ofree(lp[i]);
}
shift2(p1,p2,p3) int p1,p2,p3;{
int h1,h2,h3,b1,b2,b3,subsh,d1,supsh;
yyval = oalloc();
h1 = eht[p1]; b1 = ebase[p1];
h2 = eht[p2]; b2 = ebase[p2];
h3 = eht[p3]; b3 = ebase[p3];
d1 = 1;
subsh = -d1+h2-b2;
if( d1+b1 > h2 )
subsh = b1-b2;
supsh = b3 + 1;
if( supsh+h3 < h1-b1 )
supsh = h1-b1-h3;
eht[yyval] = h1 + max(0,h3-1) + max(0,h2-b1-d1);
ebase[yyval] = b1+max(0,h2-b1-d1);
ewid[yyval] = ewid[p1] + max(ewid[p2], ewid[p3]);
printf(".ds %d \\*(%d", yyval, p1);
down(subsh);
printf("\\*(%d", p2);
back(ewid[p2]);
up(subsh+supsh);
printf("\\*(%d", p3);
down(supsh);
if(ewid[p3] < ewid[p2] )
fwd(ewid[p2]-ewid[p3]);
putchar('\n');
if(dbg)printf(".\tshift2 s%d <- %d %d %d",yyval,p1,p2,p3);
if(dbg)printf(" h=%d,b=%d,w=%d\n", eht[yyval],ebase[yyval],ewid[yyval]);
ofree(p1); ofree(p2); ofree(p3);
}
+154
View File
@@ -0,0 +1,154 @@
# include "ne.h"
fromto(p1,p2,p3) int p1,p2,p3; {
int w,h,b,h1,b1;
yyval = oalloc();
h1 = eht[yyval] = eht[p1];
b1 = ebase[p1];
b = 0;
w = ewid[p1];
if( p2>0 ){
w = max(w, ewid[p2]);
eht[yyval] =+ eht[p2];
b = eht[p2];
}
if( p3>0 ){
w = max(w, ewid[p3]);
eht[yyval] =+ eht[p3];
}
ewid[yyval] = w;
printf(".ds %d ", yyval); /* bottom of middle box */
if( p2>0 ){
down(eht[p2]-ebase[p2]+b1);
fwd((w-ewid[p2])/2);
printf("\\*(%d", p2);
back((w+ewid[p2])/2);
up(eht[p2]-ebase[p2]+b1);
}
fwd((w-ewid[p1])/2);
printf("\\*(%d", p1);
fwd((1+w-ewid[p1])/2);
if( p3>0 ){
up(h1-b1+ebase[p3]);
back((w+ewid[p3])/2);
printf("\\*(%d", p3);
fwd((w-ewid[p3])/2);
down(h1-b1+ebase[p3]);
}
putchar('\n');
ebase[yyval] = b + b1;
if(dbg)printf(".\tfrom to: S%d <- %d f %d t %d; h=%d b=%d,w=%d\n",
yyval,p1,p2,p3,eht[yyval], ebase[yyval], ewid[yyval]);
ofree(p1);
if( p2>0 ) ofree(p2);
if( p3>0 ) ofree(p3);
}
paren(leftc,p1,rightc) int p1, leftc, rightc; {
int n,h1,b1;
yyval = oalloc();
h1 = eht[p1]; ebase[yyval] = b1 = ebase[p1];
n = max(b1+1, h1-b1-1);
eht[yyval] = 2*n;
if( eht[yyval] > h1 )
++ebase[yyval];
printf(".ds %d ", yyval);
brack(n,'|');
printf("\\*(%d", p1);
if( rightc )
brack(n,'|');
putchar('\n');
ewid[yyval] = ewid[p1] + 1 + (rightc ? 1 : 0);
if(dbg)printf(".\tcurly: h=%d b=%d n=%d w=%d l=%c,r=%c\n",
eht[yyval],ebase[yyval],n,ewid[yyval],leftc,rightc);
ofree(p1);
}
brack(n,c) int n,c; {
int j;
down(n-1);
for( j=0; j < n; j++ ){
putchar(c);
back(1);
up(2);
}
down(n+1);
fwd(1);
}
diacrit(p1,type) int p1,type; {
int c,t;
c = oalloc();
switch(type){
case 'H':
printf(".ds %d ^\n",c);
ewid[c] = 1;
break;
case 'T':
printf(".ds %d ~\n",c);
ewid[c] = 1;
break;
case 'D':
printf(".ds %d ", c);
up(2);
putchar('.');
down(2);
putchar('\n');
ewid[c] = 1;
break;
case 'U':
printf(".ds %d ", c);
up(2);
printf("..");
down(2);
putchar('\n');
ewid[c] = 2;
break;
case 'B':
printf(".ds %d ", c);
up(eht[p1]);
line(ewid[p1]);
down(eht[p1]);
putchar('\n');
ewid[c] = ewid[p1];
break;
case 'N':
printf(".ds %d ", c);
down(ebase[p1]);
line(ewid[p1]);
up(ebase[p1]);
putchar('\n');
ewid[c] = ewid[p1];
break;
}
yyval = oalloc();
printf(".ds %d \\*(%d", yyval, p1);
back((ewid[p1]+ewid[c])/2);
printf("\\*(%d", c);
fwd(abs(ewid[p1]-ewid[c])/2);
putchar('\n');
ewid[yyval] = max(ewid[p1], ewid[c]);
ebase[yyval] = ebase[p1];
eht[yyval] = eht[p1];
if( type != 'N' )
eht[yyval]++;
if(dbg)printf(".\t%c diacrit: S%d <- %d; h=%d,b=%d,w=%d\n",
type, yyval, p1, eht[yyval], ebase[yyval], ewid[yyval]);
ofree(p1); ofree(c);
}
move(dir, amt, p) int dir, amt; char *p; {
yyval = p;
printf(".ds %d ", yyval);
if( dir==0 ) fwd(amt);
else if( dir==1 ) up(amt);
else if( dir==2 ) back(amt);
else if( dir==3 ) down(amt);
printf("\\*(%d\n", p);
if( dir==1 )
ebase[yyval] =- amt;
else if( dir==3 )
ebase[yyval] =+ amt;
if(dbg)printf(".\tmove %d dir %d amt %d; h=%d b=%d\n",
p,dir,amt,eht[yyval],ebase[yyval]);
}
+103
View File
@@ -0,0 +1,103 @@
# include "ne.h"
char *res[] {
">=", "<=", "!=",
"+-", "==", "cdot", "CDOT",
"times", "TIMES",
"SIGMA", "pi", "PI",
"alpha", "beta", "gamma", "GAMMA", "delta", "epsilon", "omega",
"DELTA", "LAMBDA", "PHI", "OMEGA",
"lambda", "mu", "nu", "theta", "rho", "sigma", "tau", "phi",
"INF", "INFINITY",
"inf", "infinity",
"partial", "PARTIAL",
"zeta", "eta", "iota", "kappa", "xi", "omicron", "upsilon",
"chi", "psi", "THETA", "XI", "UPSILON", "PSI",
"del", "DEL",
"nothing", "NOTHING",
"approx", "APPROX",
0};
char *restran[] {
">\b_", "<\b_", "/\b=",
"+\b_", "=\b_", "8.9", "8.9",
"x", "x",
"R", "J", "P",
"A", "B", "\\e", "G", "D", "S", "C",
"W", "E", "F", "Z",
"L", "M", "@", "T", "K", "Y", "I", "U",
"o", "o", "o", "o",
"]", "]",
"Q", "N", "i", "k", "X", "o", "u",
"X", "V", "O", "X", "U", "H",
"[", "[",
"", "",
"~\b=", "~\b=",
0};
int csp;
int psp;
#define CSSIZE 400
char cs[420];
text(t,p1) int t; char *p1; {
int i,j,c;
int w;
yyval = oalloc();
ebase[yyval] = 0;
eht[yyval] = 2; /* ht in 1/2 spaces */
if( t=='q' )
j = p1;
else if ( t == '~' )
j = &"~";
else if ( t == '^' )
j = &"";
else if ( t == '\t' )
j = &"\\t";
else if( (i=lookup(p1,res))>=0 )
j = restran[i];
else {
for( csp=psp=0; (c=p1[psp++])!='\0'; ){
trans(c,p1);
if( csp>CSSIZE )
error(FATAL,"converted token %.20s... too long",p1);
}
cs[csp] = '\0';
j = cs;
}
ewid[yyval] = width(j);
if(dbg)printf(".\t%ctext: S%d <- %s; b=%d,h=%d,w=%d\n",
t, yyval, j, ebase[yyval], eht[yyval], ewid[yyval]);
printf(".ds %d \"%s\n",yyval,j);
}
width(s) char *s; {
int c,w;
w = 0;
while( (c = *s++) != '\0' ){
if( c == '\b' || c == 033 )
w--;
else if ( c == '\\' && *s == '\\' );
else if ( c == '\\' && *s == 'e' );
else if ( c >= 040 )
w++;
}
return(w);
}
trans(c,p1) int c; char *p1; {
switch( c){
case '>': case '<': case '=':
if( p1[psp]=='=' ){ /* look ahead for == <= >= */
cs[csp++] = c; cs[csp++] = '\b'; cs[csp++] = '_';
psp++;
} else
cs[csp++] = c;
break;
case '\\': /* troff - pass 2 or 3 more chars */
cs[csp++] = c; cs[csp++] = c = p1[psp++]; cs[csp++] = p1[psp++];
if( c=='(' ) cs[csp++] = p1[psp++];
break;
default:
cs[csp++] = c; break;
}
}
+215
View File
@@ -0,0 +1,215 @@
# include "ne.h"
# define SIGPIPE 13 /* nroff has stopped reading */
int ESC 033;
int HREV '8';
int HFWD '9';
int SI 017;
int SO 016;
int ESCOUT 033;
int HFWDOUT '9';
int HREVOUT '8';
int BKSPOUT '\b';
int FWDOUT '~';
char in[400]; /* input buffer */
int exit();
main(argc,argv) int argc; char *argv[];{
int i, type;
flush();
first = 0;
lefteq = righteq = '\0';
signal(SIGPIPE, &exit);
setfile(argc,argv);
while( (type=getline(in)) != '\0' ){
eqline = linect;
if( in[0]=='.' && in[1]=='E' && in[2]=='Q' ){
for( i=11; i<100; used[i++]=0 );
printf(".tr ~\n");
printf("%s",in);
init();
yyparse();
if( eqnreg>0 )
printf(".ne %d\n.rs\n'sp %d\n\\*(%d\n'sp %d\n",
(eqnht+1)/2, (eqnht-eqnbase-2)/2,eqnreg,eqnbase/2);
printf(".EN");
if( lastchar == '\0' ){
putchar('\n');
break;
}
if( putchar(lastchar) != '\n' )
while( putchar(getc()) != '\n' );
flush();
} else if( type != lefteq )
printf("%s",in);
else
inline();
}
putchar('\0');
flush();
exit();
}
getline(s) char *s; {
char c;
while((*s++=c=getc())!='\n' && c!='\0' && c!=lefteq );
if( c==lefteq )
s--;
*s++ = '\0';
return(c);
}
inline() {
int i,j,ds[20],t;
i = -1;
do{
if( i>=17 ){
while((j=getline(in))!='\n' && j!='\0');
error(!FATAL,"missing right delim (?) at %.20s",in);
break;
}
ds[++i] = oalloc();
printf(".ds %d \"%s\n", ds[i], in);
init();
yyparse();
if( eqnreg > 0 )
ds[++i] = eqnreg;
} while( (t=getline(in)) == lefteq );
ds[++i] = oalloc();
printf(".ds %d \"%s", ds[i], in);
for( j=0; j<=i; j++){
printf("\\*(%d", ds[j]);
ofree(ds[j]);
}
putchar('\n');
flush();
}
putout(p1) int p1; {
if(dbg)printf(".\tanswer <- S%d\n",p1);
eqnht = eht[p1];
eqnbase = ebase[p1];
eqnreg = p1;
}
abs(v) int v; {
return( v>0 ? v : -v );
}
max(i,j) int i,j; {
return( i>j ? i : j );
}
oalloc(){
int i;
for( i=11; i<100; i++)
if( used[i]++ == 0 ) return(i);
error( FATAL, "no strings left", i);
}
ofree(n) int n; {
used[n] = 0;
}
setfile(argc, argv) int argc; char *argv[]; {
svargc = --argc;
svargv = argv;
while( svargc > 0 && svargv[1][0] == '-'){
switch( svargv[1][1] ){
case 'd': lefteq=svargv[1][2]; righteq=svargv[1][3]; break;
case 's': break;
case 'f': break;
default:
dbg = 1;
ESCOUT = 'E';
HFWDOUT = 'F';
HREVOUT = 'R';
BKSPOUT = 'B';
FWDOUT = 'S';
}
svargc--;
svargv++;
}
if( svargc == 0 )
fin = dup(0);
else if( (fin = open(svargv[1], 0)) < 0)
error( FATAL,"can't open file %s", argv[1]);
ptr = 0;
fout = dup(1);
ifile = 1;
linect = 1;
}
yyerror(){;}
int gsize 10;
int gfont 'I';
init(){
ct = 0;
first++;
}
error(fatal, s1, s2) int fatal; char *s1, *s2; {
int sfout;
printf("NEQN ERROR HERE");
flush(fout);
sfout = fout;
fout = 2;
if( fatal>0 )
printf("fatal error: ");
printf(s1,s2);
printf(" file %s, between lines %d and %d\n",
svargv[ifile], eqline, linect);
flush(2);
fout = sfout;
if( fatal > 0 )
exit(1);
}
down(n) int n; {
int c;
if( n<= 0 )
c = HREVOUT;
else
c = HFWDOUT;
n = abs(n);
while( n-- > 0 ){
putchar(ESCOUT); putchar(c);
}
}
up(n) int n; {
int c;
if( n<= 0 )
c = HFWDOUT;
else
c = HREVOUT;
n = abs(n);
while( n-- > 0 ){
putchar(ESCOUT); putchar(HREVOUT);
}
}
fwd(n) int n; {
int c,i;
c = n<0 ? BKSPOUT : FWDOUT;
n = abs(n);
while( n-- > 0 )
putchar(c);
}
back(n) int n; {
int c,i;
c = n>0 ? BKSPOUT : FWDOUT;
n = abs(n);
while( n-- > 0 )
putchar(c);
}
line(n) int n; {
while( n-- > 0 )
putchar('_');
}
+34
View File
@@ -0,0 +1,34 @@
#include "ne.h"
int markpos;
mark(n) int n; {
if( n )
markpos = ewid[n];
else {
yyval = oalloc();
printf(".ds %d \"\n", yyval);
ebase[yyval] = ewid[yyval] = markpos = 0;
eht[yyval] = 2;
}
if(dbg)printf(".\tmark %d as %d\n", n, markpos);
}
lineup(n) int n; {
if( n ) {
printf(".ds %d \"", n);
fwd(markpos-ewid[n]);
printf("\\*(%d\n", n);
ewid[n] = markpos;
}
else {
yyval = oalloc();
printf(".ds %d \"", yyval);
fwd(markpos);
printf("\n");
ebase[yyval] = 0;
eht[yyval] = 2;
ewid[yyval] = markpos;
}
if(dbg)printf(".\tlineup %d at %d\n", n, markpos);
}
+63
View File
@@ -0,0 +1,63 @@
#include "ne.h"
column(type, p1, p2) int type, p1, p2; {
int i, n;
lp[p1] = ct - p1 - 1;
if( dbg ){
printf(".\t%c column of", type);
for( i=p1+1; i<ct; i++ )
printf(" S%d", lp[i]);
printf(", rows=%d\n",lp[p1]);
}
lp[ct++] = type;
}
matrix(p1,p2) int p1, p2; {
int nrow, ncol, i, j, k, hb, b, val[100], db;
int w;
char *space;
space = "\\ \\ ";
nrow = lp[p1]; /* disaster if rows inconsistent */
ncol = 0;
for( i=p1; i<ct; i =+ lp[i]+2 ){
ncol++;
if(dbg)printf(".\tcolct=%d\n",lp[i]);
}
for( k=1; k<=nrow; k++ ) {
hb = b = 0;
j = p1 + k;
for( i=0; i<ncol; i++ ) {
hb = max(hb, eht[lp[j]]-ebase[lp[j]]);
b = max(b, ebase[lp[j]]);
j =+ nrow + 2;
}
if(dbg)printf(".\trow %d: b=%d, hb=%d\n", k, b, hb);
j = p1 + k;
for( i=0; i<ncol; i++ ) {
ebase[lp[j]] = b;
eht[lp[j]] = b + hb;
j =+ nrow + 2;
}
}
j = p1;
w = 0;
for( i=0; i<ncol; i++ ) {
lpile(lp[j+lp[j]+1], j+1, j+lp[j]+1);
val[i] = yyval;
w =+ ewid[yyval];
j =+ nrow + 2;
}
yyval = oalloc();
eht[yyval] = eht[val[0]];
ebase[yyval] = ebase[val[0]];
ewid[yyval] = w + 2 * (ncol-1); /* 2 = width(space) */
if(dbg)printf(".\tmatrix S%d: r=%d, c=%d, h=%d, b=%d, w=%d\n",
yyval,nrow,ncol,eht[yyval],ebase[yyval], ewid[yyval]);
printf(".ds %d \"", yyval);
for( i=0; i<ncol; i++ ) {
printf("\\*(%d%s", val[i], i==ncol-1 ? "" : space);
ofree(val[i]);
}
printf("\n");
ct = p1;
}
+237
View File
@@ -0,0 +1,237 @@
#
#include "ne.h"
#include "y.tab.c"
char *cntrl[] {
"sup", "super", "sub",
".EN",
"sum", "from", "to",
"hat", "dot", "dotdot", "bar", "tilde", "under",
"prod", "int", "integral", "union", "inter",
"pile", "lpile", "cpile", "rpile", "over", "sqrt",
"above", "size", "font", "roman", "italic", "bold",
"left", "right",
"delim", "DELIM",
"DEFINE","define",
".gsize", ".GSIZE", "gsize", "GSIZE", "gfont", "GFONT",
"HAT", "DOT", "DOTDOT", "BAR", "TILDE", "UNDER",
"PROD", "INT", "INTEGRAL", "UNION", "INTER",
"SUM", "FROM", "TO",
"SUP", "SUPER", "SUB", "PILE", "LPILE", "CPILE", "RPILE", "OVER", "SQRT",
"ABOVE", "SIZE", "FONT", "ROMAN", "ITALIC", "BOLD",
"LEFT", "RIGHT",
"up", "UP", "down", "DOWN", "fwd", "FWD", "back", "BACK",
"mark", "MARK", "lineup", "LINEUP",
"matrix", "lcol", "ccol", "rcol", "col",
0};
int icntrl[]{
SUPER, SUPER, SUB,
0, /* EOF */
SUM, FROM, TO,
HAT, DOT, DOTDOT, BAR, TILDE, UNDER,
PROD, INT, INT, UNION, INTER,
PILE, LPILE, CPILE, RPILE, OVER, SQRT,
ABOVE, SIZE, FONT, ROMAN, ITALIC, BOLD,
LEFT, RIGHT,
DELIM, DELIM,
DEFINE, DEFINE,
GSIZE, GSIZE, GSIZE, GSIZE, GFONT, GFONT,
HAT, DOT, DOTDOT, BAR, TILDE, UNDER,
PROD, INT, INT, UNION, INTER,
SUM, FROM, TO,
SUPER, SUPER, SUB, PILE, LPILE, CPILE, RPILE, OVER, SQRT,
ABOVE, SIZE, FONT, ROMAN, ITALIC, BOLD,
LEFT, RIGHT,
UP, UP, DOWN, DOWN, FWD, FWD, BACK, BACK,
MARK, MARK, LINEUP, LINEUP,
MATRIX, LCOL, CCOL, RCOL, COL,
0};
int peek -1;
#define SSIZE 400
char token[SSIZE];
int sp;
int speek[10];
char *swt[10];
int sw -1;
getc(){
loop:
if(sw >= 0){
lastchar = (peek<0) ? *swt[sw]++ : peek;
peek = -1;
if(lastchar != '\0')return(lastchar);
peek = speek[sw--];
return(' ');
}
lastchar = (peek<0) ? getchar() : peek;
if( lastchar=='\n' )
linect++;
peek = -1;
if( lastchar!= '\0' )
return(lastchar);
if( ++ifile > svargc ){
peek = '\0';
return('\0');
}
close(fin);
linect = 1;
if( (fin=open(svargv[ifile],0)) >= 0 )
goto loop;
error(FATAL,"can't open file %s\n", svargv[ifile]);
}
yylex(){
int c, type;
beg:
while( (c=getc())==' ' || c=='\n');
yylval=c;
switch(c){
case '\0':
return('\0');
case '~':
return(SPACE);
case '^':
return(THIN);
case '\t':
return(TAB);
case '{':
return(MQ);
case '}':
return(MQ1);
case '"':
for(sp=0; (c=getc())!='"'; ){
if(c !='\\')token[sp++]=c;
else { if((c=getc())!= '"')token[sp++]='\\';
token[sp++] = c; }
if( sp>=SSIZE )
error(FATAL,"quoted string %.20s... too long", token);
}
token[sp]='\0';
yylval= &token[0];
return(QTEXT);
}
if( c==righteq )
return('\0');
getstr(token, c);
if((type = lookup(token,nptr)) >= 0){
if(sw >= 9)
error(FATAL,"definitions nested > 9", sw);
swt[++sw] = sptr[type];
speek[sw] = peek;
peek = -1;
goto beg;
}
type = lookup(token,cntrl);
if( type < 0 )
return(CONTIG);
if( icntrl[type]==DEFINE ) {
define();
goto beg;
}
else if( icntrl[type]==DELIM ) {
delim();
goto beg;
}
else if( icntrl[type]==GSIZE ){
globsize();
goto beg;
}
else if( icntrl[type]==GFONT ) {
globfont();
goto beg;
}
else
return( icntrl[type] );
}
getstr(s,c) char *s, c; {
for (sp=0; c!=' ' && c!='\t' && c!='\n' && c!='{' && c!='}'
&& c!='"' && c!='~' && c!='^' && c!=righteq; ) {
if(c == '\\') if((c = getc()) != '"')s[sp++] = '\\';
s[sp++] = c;
if( sp>=SSIZE )
error(FATAL,"token %.20s... too long",s);
c = getc();
}
if( c=='{' || c=='}' || c=='"' || c=='~' || c=='^' || c=='\t' || c==righteq )
peek = c;
s[sp]='\0';
yylval = s;
}
lookup(str,tbl) char *str; char *tbl[]; {
register i,j, r;
for(i=0; tbl[i]!=0; i++){ /* table of tbl wds */
for( j=0; (r=tbl[i][j])==str[j] && r!='\0'; j++);
if( r == str[j] )
return(i);
}
return( -1 );
}
cstr(s,quote) char *s; int quote; {
int del,c,i;
while((del=getc()) == ' ' || del == '\t' || del == '\n');
if(quote)
for(i=0; (c=getc()) != del;)
s[i++] = c;
else {
s[0] = del;
for(i=1; (c=getc())!=' ' && c!= '\t' && c!='\n';)
s[i++]=c;
}
s[i] = '\0';
return(s);
}
define() {
char *alloc();
int i, c;
while( (c=getc())==' ' || c=='\n' );
getstr(token,c);
if((i = lookup(token,nptr)) >= 0){
yyval = i;
free(sptr[yyval]);
} else {
yyval = ptr++;
for(i=0; token[i] != '\0'; i++);
nptr[yyval] = alloc(i+1);
for(i=0; nptr[yyval][i]=token[i]; i++);
}
if(dbg)printf(".\tdefine %s\n",nptr[yyval]);
cstr(token,1);
for(i=0; token[i] != '\0'; i++);
sptr[yyval] = alloc(i+1);
for(i=0; sptr[yyval][i] = token[i]; i++);
if(dbg)printf(".\tname %s defined as %s\n",nptr[yyval],sptr[yyval]);
}
delim() {
char *s;
yyval = eqnreg = 0;
cstr(token,0);
lefteq = token[0];
righteq = token[1];
if( (lefteq == 'o' && righteq == 'f') || (lefteq == 'O' && righteq == 'F') )
lefteq = righteq = '\0';
}
globsize() {
extern int gsize;
int c;
while( (c=getc())==' ' || c=='\n' );
getstr(token,c);
gsize = numb(token);
yyval = eqnreg = 0;
}
globfont() {
extern int gfont;
while( (gfont=getc())==' ' || gfont=='\n' );
yyval = eqnreg = 0;
}
+1362
View File
File diff suppressed because it is too large Load Diff
+1239
View File
File diff suppressed because it is too large Load Diff
+1264
View File
File diff suppressed because it is too large Load Diff
+937
View File
@@ -0,0 +1,937 @@
/
/
/ nroff4
text:
inc nflush
cmp nl,$-1
bne 0f
jsr pc,newln1
rts pc
0:
clr ulstate
jsr pc,setnel
tst ce
bne nofill
tst fi
beq nofill
tst pendw
bne 7f
tst pendt
bne 8f
inc pendt
tst x
bne 0f
1:
jsr pc,getchar
bmi 1f
cmpb r0,$' /
beq 3f
cmpb r0,tabc
bne 1f
3:
inc x
br 1b
1:
tst nlflg
bne 6f
mov r0,ch
tst x
beq 2f
0:
jsr pc,rbreak
tst nc
bne 5f
tst wch
bne 5f
add x,un
clr x
jsr pc,setnel
tst trap
bne 5f
2:
tst x
bne 0b
tst nlflg
beq 2f
6:
clr nflush
clr x
clr pendt
clr ch
mov $1,r0
jsr pc,casesp1
rts pc
8:
tst x
bne 0b
2:
tst spread
bne 1f
tst pendw
bne 0f
tst wch
bne 3f
0:
7:
jsr pc,getword
br 4f
3:
jsr pc,movword
bne 2b
tst nlflg
beq 1f
clr pendt
1:
jsr pc,adjust
tst trap
beq 2b
tst nlflg
beq 5f
4:
clr pendt
tst pendw
bne 5f
dec ul
bge 5f
clr ul
5:
clr nflush
rts pc
nofill:
tst pendnf
bne 1f
clr over
jsr pc,rbreak
tst trap
bne 3f
tst nlflg
bne 6b
clr fac
clr fmq
mov $1000,nwd
1:
jsr pc,gettchar
bmi 0f
cmpb r0,$'\n
beq 1f
cmpb r0,ohc
beq 1b
cmpb r0,$005
beq 4f
0:
jsr pc,storeline
br 1b
1:
tst ce
ble 2f
dec ce
mov nel,r0
asr r0
bpl 1f
clr r0
1:
add r0,un
2:
tst nc
bne 0f
mov $037,r0
jsr pc,storeline
0:
jsr pc,rbreak
dec ul
bpl 3f
clr ul
3:
clr nflush
clr pendnf
rts pc
4:
inc pendnf
clr nflush
jsr pc,flushi
rts pc
adjust:
mov r2,-(sp)
mov r3,-(sp)
clr r2
clr r3
tst ad
beq 1f
mov nwd,r0
dec r0
ble 1f
mov nel,r3
ble 1f
dvd r0,r2
1:
mov r3,fac
mov r2,fmq
mov (sp)+,r3
mov (sp)+,r2
mov $-1,lastl
jsr pc,rbreak1
clr spread
rts pc
fill:
mov fmq,r0
1:
inc r0
dec nc
cmpb (r2)+,$'
beq 1b
dec r2
bit $1,totout
beq 2f
inc fac
cmp fac,nwd
blt 1f
inc r0
br 1f
2:
dec fac
bmi 1f
inc r0
1:
jsr pc,space
movb (r2),r0
rts pc
movword:
mov wordp,r4
tst nwd
bne 2f
1:
movb (r4)+,r0
cmp r0,$'
bne 1f
dec wch
jsr pc,width
sub r1,wne
br 1b
1:
dec r4
2:
cmp wne,nel
ble 1f
tst nwd
beq 2f
cmp nel,$4
blt 1f
cmp wch,$5 /don't do 4 char words
ble 1f
2:
bit $2,hyf
beq 0f
tst op
bne 0f
clr r0
jsr pc,findt
dec r1
ble 1f
0:
jsr pc,hyphen
1:
clr nhyph
mov wch,-(sp)
1:
movb (r4)+,r0
cmp r0,$'-
bne 2f
movb (r4),r2
jsr pc,alph2
bne 2f
bisb $200,(r4)
2:
tst r0
bpl 2f
bic $!177,r0
mov r4,r3
sub $3,r3
cmp r3,$word
blo 2f
movb (r3),r2
bic $!177,r2
jsr pc,alph2
bne 2f
3:
mov r0,-(sp)
clr r0
jsr pc,storeline
mov (sp)+,r0
inc nhyph
2:
jsr pc,width
sub r1,wne
jsr pc,storeline
dec wch
bne 1b
tst nel
blt 1f
inc nwd
tst (sp)+
clz
rts pc
1:
mov linep,r3
1:
tst nhyph
bne 2f
tst nwd
beq 3f
cmp wch,(sp)
beq 4f
2:
movb -(r3),r0
bne 2f
dec nhyph
bne 5f
tst nwd
beq 6f
5:
tst nel
ble 2f
6:
cmpb -1(r3),$'-
beq 3f
movb $'-,(r3)
dec nel
inc ne
br 3f
2:
dec nc
tstb (r3)
beq 1b
jsr pc,width
sub r1,ne
add r1,nel
inc wch
dec r4
add r1,wne
br 1b
3:
inc nwd
4:
mov r4,wordp
bicb $!177,(r4)
tst (sp)+
sez
rts pc
width:
mov r0,-(sp)
cmpb r0,$014
bne 0f
mov $1,r1
br 3f
0:
cmpb r0,$013
bne 0f
movb eschar,r0
0:
bic $!177,r0
cmp r0,ohc
beq 2f
tst r0
beq 2f
cmp r0,$0177
beq 2f
cmp r0,$010
bne 1f
mov $-1,r1
br 3f
1:
cmp $' ,r0
bgt 2f
mov $1,r1
br 3f
2:
clr r1
3:
mov (sp)+,r0
rts pc
setwd:
mov column,-(sp)
clr column
mov r2,-(sp)
clr -(sp)
jsr pc,*(r5)
mov r0,r2
1:
jsr pc,*(r5)
bmi 0f
cmpb r0,r2
beq 2f
0:
tst nlflg
bne 2f
jsr pc,width
add r1,(sp)
br 1b
2:
mov (sp)+,r0
jsr pc,setn0
mov (sp)+,r2
mov (sp)+,column
tst (r5)+
rts r5
header:
/headin:
clr nls
jsr pc,skipcont
mov $'',r2
tst op
beq 1f
jsr pc,wbfl
1:
jsr pc,alloc
bne 0f
rts pc
0:
mov nextb,r1
2:
mov r1,headp
jsr pc,getchar
bmi 3f
cmpb r0,$'\n
beq 2f
mov r0,r2
1:
jsr pc,getchar
bmi 3f
cmpb r0,$'\n
beq 2f
0:
cmpb r0,r2
bne 3f
mov $004,r0
3:
jsr pc,wbf
br 1b
2:
mov $004,r0
jsr pc,wbf
mov $004,r0
jsr pc,wbf
clr r0
jsr pc,wbt
/headout:
clr -(sp)
mov headp,r2
jsr r5,headseg; width
mov r0,-(sp)
jsr r5,headseg; width
mov r0,-(sp)
jsr r5,headseg; width
mov r0,-(sp)
tst op
bne 1f
mov po,r0
jsr pc,space
1:
mov headp,r2
jsr r5,headseg; putchar
mov llh,r0
add 6(sp),r0
sub 2(sp),r0
asr r0
sub 4(sp),r0
mov r0,-(sp)
tst 4(sp)
bne 1f
tst 2(sp)
beq 2f
1:
jsr pc,space
2:
jsr r5,headseg; putchar
mov llh,r0
sub (sp)+,r0
sub (sp)+,r0
sub (sp)+,r0
sub (sp)+,r0
add (sp)+,r0
tst -10(sp)
beq 1f
jsr pc,space
jsr r5,headseg; putchar
1:
jsr pc,newline
cmp nl,hnl
ble 0f
mov nl,hnl
0:
mov headp,r0
jsr pc,free
rts pc
headseg:
clr -(sp)
1:
mov r1,-(sp)
mov r2,r1
jsr pc,rbf0
jsr pc,incoff
mov r1,r2
mov (sp)+,r1
tst r0
beq 1f
bmi 0f
cmpb r0,$004
beq 1f
cmpb r0,$'%
beq 2f
0:
jsr pc,*(r5)
add r1,(sp)
br 1b
2:
mov $'%,r0
jsr pc,findr
mov [flist-vlist](r1),nform
mov pn,r0
clr r1
jsr pc,fnumb
add r1,(sp)
br 1b
1:
mov (sp)+,r0
tst (r5)+
rts r5
space:
jsr r5,nlines;putchar
rts pc
nlines:
mov r0,-(sp)
1:
dec (sp)
blt 1f
mov $' ,r0
jsr pc,*(r5)
br 1b
1:
cmp (r5)+,(sp)+
rts r5
decimal:
jsr pc,decml
tst (r5)+
rts r5
decml:
mov r2,-(sp)
mov r3,-(sp)
jsr pc,decml1
mov (sp)+,r3
mov (sp)+,r2
rts pc
decml1:
mov r1,-(sp)
clr r2
mov r0,r3
dvd $10.,r2
mov r3,-(sp)
mov r2,r0
beq 1f
jsr pc,decml1
mov r1,2(sp)
1:
mov (sp)+,r0
add $'0,r0
jsr pc,*(r5)
add (sp)+,r1
rts pc
roman0:
jsr pc,roman
tst (r5)+
rts r5
roman:
tst r0
beq decml
mov r2,-(sp)
mov r3,-(sp)
cmp ro,$2
bne 1f
mov $cones,onesp
mov $cfives,fivesp
br 2f
1:
mov $ones,onesp
mov $fives,fivesp
2:
jsr pc,roman1
mov (sp)+,r3
mov (sp)+,r2
rts pc
roman1:
clr r2
mov r0,r3
bne .+4
rts pc
mov r1,-(sp)
dvd $10.,r2
mov r3,-(sp)
mov r2,r0
inc onesp
inc fivesp
jsr pc,roman1
mov r1,2(sp)
dec onesp
dec fivesp
clr r2
mov (sp)+,r3
dvd $5.,r2
cmp r3,$4
bne 1f
movb *onesp,r0
jsr pc,*(r5)
add r1,(sp)
tst r2
beq 2f
inc onesp
movb *onesp,r0
dec onesp
br 3f
2:
movb *fivesp,r0
3:
jsr pc,*(r5)
add (sp)+,r1
rts pc
1:
tst r2
beq 2f
movb *fivesp,r0
jsr pc,*(r5)
add r1,(sp)
2:
dec r3
blt 1f
movb *onesp,r0
jsr pc,*(r5)
add r1,(sp)
br 2b
1:
mov (sp)+,r1
rts pc
abc0:
jsr pc,abc
tst (r5)+
rts r5
abc:
mov r2,-(sp)
mov r3,-(sp)
mov r0,r3
bne 0f
mov $'0,r0
jsr pc,*(r5)
br 1f
0:
dec r3
jsr pc,abc1
1:
mov (sp)+,r3
mov (sp)+,r2
rts pc
abc1:
clr r2
dvd $26.,r2
mov r3,-(sp)
mov r2,r3
beq 1f
dec r3
jsr pc,abc1
1:
cmp ro,$2
beq 1f
add $'a,(sp)
br 2f
1:
add $'A,(sp)
2:
mov (sp)+,r0
jsr pc,*(r5)
rts pc
fnumb0:
jsr pc,fnumb
tst (r5)+
rts r5
fnumb:
mov ro,-(sp)
mov nform,ro
bne 0f
mov (sp),ro
br 1f
0:
dec ro
1:
tst ro
bne 1f
jsr pc,decml
br 2f
1:
cmp ro,$2
bgt 1f
jsr pc,roman
br 2f
1:
sub $2,ro
jsr pc,abc
2:
mov (sp)+,ro
rts pc
/wordout:
/ tst index
/ beq 1f
/ mov wch,0f
/ beq 1f
/ mov indid,r0
/ sys write; word; 0:..
/ mov indid,r0
/ sys write; 8f; 1
/ mov indid,r0
/ jsr r5,numb; pn
/ mov indid,r0
/ sys write; 8f; 1
/ mov nl,char
/ inc char
/ mov indid,r0
/ jsr r5,numb; char
/ mov indid,r0
/ sys write; 9f; 1
/1:
/ rts pc
/8: 011 /tab
/9: <\n\0>
/ .even
/numb:
/ mov r2,-(sp)
/ mov r3,-(sp)
/ mov *(r5)+,r3
/ mov r0,r1
/ jsr pc,numb1
/ mov (sp)+,r3
/ mov (sp)+,r2
/ rts r5
/numb1:
/ clr r2
/ dvd $10.,r2
/ mov r3,-(sp)
/ mov r2,r3
/ beq 1f
/ jsr pc,numb1
/1:
/ add $'0,(sp)
/ mov (sp)+,char
/ mov r1,r0
/ sys write; char; 1
/ rts pc
setstr:
clr -(sp)
clr -(sp)
0:
jsr pc,get1
bmi 3f
bic $!177,r0
cmpb r0,$'\\
bne 1f
4:
jsr pc,get1
jsr r5,switch;esctab
cmpb r0,dolc
bne 2f
jsr pc,seta
br 0b
2:
cmpb r0,numc
bne 1f
clr r1
jsr pc,setn
br 0b
1:
tst 2(sp)
bne 5f
bic $!177,r0
cmpb r0,$'(
bne 1f
inc 2(sp)
jsr pc,get1
bic $!177,r0
cmpb r0,$'\\
beq 4b
5:
mov r0,-(sp)
jsr pc,get1
bic $!177,r0
swab r0
bis (sp)+,r0
1:
mov $contab,r1
1:
mov (r1)+,(sp)
bic $100000,(sp)
cmp r0,(sp)
beq 2f
cmp (r1)+,$-1
bne 1b
br 3f
2:
mov (r1),(sp)
tst -(r1)
bpl 3f
clr *nxf
jsr pc,pushi
mov (sp),ip
3:
cmp (sp)+,(sp)+
rts pc
copys:
inc copyf
jsr pc,skipcont
bne 2f
jsr pc,getchar
bmi 0f
cmpb r0,$'"
bne 0f
1:
jsr pc,getchar
tst nlflg
bne 2f
0:
jsr pc,wbf
br 1b
2:
clr r0
jsr pc,wbt
clr copyf
rts pc
setrpt:
inc copyf
inc raw1
jsr pc,get1
dec copyf
dec raw1
mov r0,r1
jsr pc,get1
cmpb r0,$006
beq 1f
0:
movb r0,rchar
movb r1,nspace
cmpb r1,$377
bne 1f
clr nspace
1:
rts pc
setfield:
clr npad
mov r1,-(sp)
mov r2,-(sp)
mov r3,-(sp)
mov r4,-(sp)
clr r4
clr -(sp)
jsr pc,width
sub r1,column /start
mov column,-(sp)
mov $tabtab,r0
1:
tst (r0)
beq 4f
cmp (sp),(r0)+
bge 1b
mov -(r0),2(sp)
sub (sp),2(sp) /h
mov $fbuf,r2
1:
jsr pc,getch1
bmi 0f
cmpb r0,padc
bne 2f
jsr pc,width
sub r1,column
inc npad
mov r2,-(sp)
add $2,r2
2:
cmpb r0,fc
beq 3f
cmpb r0,$'\n
bne 0f
mov $012,r4
clr nlflg
br 3f
0:
movb r0,(r2)+
cmp r2,$efbuf-6
blo 1b
3:
tst npad
bne 0f
inc npad
mov r2,-(sp)
add $3,r2
0:
movb r4,(r2)+
clrb (r2)+
jsr pc,width
sub r1,column
mov npad,r1
asl r1
add sp,r1
mov (r1),-(sp)
sub column,(r1) /-s
mov (sp)+,column
add 2(r1),(r1) /h-s
mov (r1),r1
mov r1,r2
sxt r0
div npad,r0
mov $014,r3 /unpaddable sp
tst r2
bpl 1f
neg r0
neg r1
mov $010,r3
1:
mov (sp)+,r2
movb $006,(r2)+
movb r0,(r2)+
movb r3,(r2)
tst r1
beq 0f
incb -1(r2)
dec r1
0:
tstb -(r2)
bne 0f
movb $377,(r2)
0:
dec npad
bgt 1b
mov $fbuf,cp
4:
cmp (sp)+,(sp)+
mov (sp)+,r4
mov (sp)+,r3
mov (sp)+,r2
mov (sp)+,r1
rts pc
+434
View File
@@ -0,0 +1,434 @@
/
/
/ hyp1 -- driver
hyphen:
tst hypedf
bne 3f
tst hyf
beq 3f
inc hypedf
mov wordp,r0
clr nhyph
1:
jsr pc,punct
bne 1f
inc r0
br 1b
1:
jsr pc,alph
bne 3f
mov r0,wordstart
1:
inc r0
jsr pc,alph
beq 1b
dec r0
mov r0,hstart
1:
inc r0
tstb (r0)
beq 2f
jsr pc,punct
bne 3f
br 1b
2:
mov hstart,wordend
jsr pc,exword
beq 0f
jsr r5,suffix
tst exf
bne 0f
jsr r5,digram
0:
bit $4,hyf
beq 0f
mov wordend,r0
bicb $!177,-1(r0)
0:
mov wordstart,r0
bicb $!177,1(r0)
bit $10,hyf
beq 3f
bicb $!177,2(r0)
3:
rts pc
casehw:
jsr pc,skipcont
bne 2f
mov nexth,r1
cmp r1,$ehbuf-2
bhis 3f
1:
jsr pc,getchar
bmi 1f
cmpb r0,$' /
beq 4f
cmpb r0,$012
beq 1f
movb r0,(r1)+
cmp r1,$ehbuf-2
blo 1b
br 3f
1:
clrb (r1)+
mov r1,nexth
clrb (r1)+
2:
rts pc
3:
jsr r5,string;hmess
clrb *nexth
br 2b
4:
jsr pc,1b
br casehw
hmess: <Exception word space full.\n\0>
.even
exword:
clr exf
clr -(sp)
mov r1,-(sp)
mov r2,-(sp)
mov r3,-(sp)
mov r4,-(sp)
mov $hbuf,r2
mov hstart,r0
cmpb (r0)+,(r0)+
0:
mov r2,8(sp)
mov wordstart,r1
tstb (r2)
beq 4f
1:
movb (r2)+,r4
cmpb r4,$'-
beq 1b
movb (r1)+,r3
/ tstb r3
/ bne 2f
cmp r1,r0
blo 2f
tstb r4
beq 3f
2:
tstb r4
bne 2f
/ tstb (r1)
tstb -1(r0)
bne 2f
cmpb r3,$'s
beq 3f
2:
tstb r4
beq 0b
/ tstb r3
/ beq 2f
cmp r1,r0
bhis 2f
cmpb r4,r3
beq 1b
2:
tstb (r2)+
bne 2b
br 0b
3:
mov wordstart,r1
mov 8(sp),r2
clr 8(sp)
inc exf
1:
tstb (r1)+
cmpb (r2)+,$'-
bne 0f
bisb $200,-1(r1)
tstb (r2)+
0:
tstb (r2)
bne 1b
4:
mov (sp)+,r4
mov (sp)+,r3
mov (sp)+,r2
mov (sp)+,r1
tst (sp)+
rts pc
punct:
tst old
bne 4f
cmpb (r0),$010
beq 0f
movb (r0),r2
jsr pc,alph2
beq 0f
sez
rts pc
0:
clz
rts pc
4:
mov $3f,r2
1:
cmpb (r0),(r2)+
beq 2f
tstb (r2)
bne 1b
clz
2:
rts pc
3: < .,()"\'`\0> /should be more
.even
maplow:
cmp r2,$'a
bhis 1f
add $'a-'A,r2
1:
rts pc
vowel:
cmpb r2,$'a
beq 1f
cmpb r2,$'e
beq 1f
cmpb r2,$'i
beq 1f
cmpb r2,$'o
beq 1f
cmpb r2,$'u
beq 1f
cmpb r2,$'y
beq 1f
cmpb r2,$'A
beq 1f
cmpb r2,$'E
beq 1f
cmpb r2,$'I
beq 1f
cmpb r2,$'O
beq 1f
cmpb r2,$'U
beq 1f
cmpb r2,$'Y
1:
rts pc
checkvow:
mov r0,-(sp)
1:
movb -(r0),r2
jsr pc,vowel
beq 1f
jsr pc,alph
beq 1b
mov (sp)+,r0
clz
rts r5
1:
mov (sp)+,r0
sez
rts r5
/ hyp2 -- suffix and digram
digram:
mov hstart,r0
1:
jsr pc,alph
bne 3f
jsr pc,vowel
beq 1f
dec r0
br 1b
1:
mov r0,hstart
1:
movb -(r0),r2
jsr pc,alph2
bne 3f
jsr pc,vowel
bne 1b
clr maxdig
mov r0,nhstart
1:
mov $1,r3
movb -1(r0),r2
jsr pc,alph2
beq 2f
movb (r0),r2
mov $'a,r1
jsr r5,dilook; bxh
br 4f
2:
movb -2(r0),r2
mov $xxh,0f
jsr pc,alph2
beq 2f
mov $bxxh,0f
2:
movb -1(r0),r1
movb (r0),r2
jmp 7f
.data
7:
jsr r5,dilook; 0:xxh
jmp 8f
.text
8:
4:
movb (r0)+,r1
movb (r0),r2
jsr r5,dilook; xhx
movb (r0),r1
movb 1(r0),r2
jsr r5,dilook; hxx
cmp r3,maxdig
blos 2f
mov r3,maxdig
mov r0,maxloc
2:
cmp r0,hstart
blo 1b
mov nhstart,hstart
cmp maxdig,thresh
blo digram
bisb $200,*maxloc
inc nhyph
/ mov maxdig,*octbufp
/ inc octcnt
/ add $2,octbufp
br digram
3:
rts r5
dilook:
mov r4,-(sp)
bic $!177,r2
bic $!177,r1
jsr pc,maplow
sub $'a,r2
cmp r2,$'z-'a
bhi 3f
mov r2,r4
mov r1,r2
jsr pc,maplow
sub $'a,r2
cmp r2,$'z-'a
bhi 3f
mov r3,-(sp)
mov r2,r3
mpy $13.,r3
clr r2
clc
ror r4
adc r2
add r3,r4
add (r5)+,r4
movb (r4),r4
tst r2
bne 1f
asr r4
asr r4
asr r4
asr r4
1:
bic $!17,r4
mov r4,r3
mpy (sp)+,r3
br 4f
3:
clr r3
tst (r5)+
4:
mov (sp)+,r4
rts r5
suffix:
mov hstart,r0
jsr pc,alph
bne 4f
jsr pc,maplow
sub $'a,r2
asl r2
mov suftab(r2),-(sp)
bic $!37777,(sp)
beq 3f
1:
mov hstart,r0
mov (sp),r1
jsr pc,rdsuf
movb (r1),r3
beq 3f
bic $!17,r3
add r3,(sp)
add r1,r3
2:
movb -(r3),r2
cmp r3,r1
ble 2f
bic $!177,r2
mov r2,-(sp)
movb -(r0),r2
jsr pc,maplow
cmp r2,(sp)+
bne 1b
br 2b
2:
mov hstart,r0
tst (sp)+
movb (r1),r3
bic $!17,r3
add r1,r3
bitb $200,(r1)+
bne 1f
2:
dec r0
cmp r3,r1
ble 2f
tstb -(r3)
bpl 2b
1:
mov r0,hstart
dec hstart
bitb $100,-1(r1)
bne 2b
jsr r5,checkvow
bne 4f
bisb $200,(r0)
br 2b
2:
bitb $40,-(r1)
bne 4f
jsr pc,exword
bne suffix
br 4f
/ beq suffix
/ br 4f
3:
tst (sp)+
4:
rts r5
rdsuf:
mov r0,-(sp)
mov suff,nfile
mov 4(sp),r1
jsr pc,rdsufb
mov $sufb,r2
movb r0,(r2)+
mov r0,r3
bic $!17,r3
1:
dec r3
blt 1f
inc r1
jsr pc,rdsufb
movb r0,(r2)+
br 1b
1:
mov $sufb,r1
mov (sp)+,r0
rts pc
+256
View File
@@ -0,0 +1,256 @@
/
/
/ nroff8
.data
nexth: hbuf
outid: 1
init: 1
slow: 1
nflush: 0
nev: 2
ev: 0
nextb: .=.+2
evp: elist
pto: 9999.
po: 0
po1: 0
npn: 0
pl: 66.
obufp: obuf
wbufp: wbuf
thresh: 240
suffil:
</usr/lib/suftab\0>
ones:
<ixcm>
fives:
<vld>
cones: <IXCM>
cfives: <VLD>
ttyx: </dev/tty0\0>
tmfile: <nr.out\0>
bfn:
</tmp/>
bfn1: <rtma\0>
/indf: <index\0>
.even
ttyid: 0
ttyod: 2
ilistp:
frame: stk
nxf: stk+12.
dolc: 020
tch: 024
ifp: ifl
namesiz = 88.
bname:
nextf: </usr/lib/tmac.>
nextf1: .=nextf+namesiz
ename: .=.+2
fc: 004
block: /environment block
totout: .=.+2
ls: 1
ls1: 1
ll: 65.
ll1: 65.
llh: 65.
llh1: 65.
ad: 1
nms: 1
ndf: 1
fi: 1
cc: '.
c2: ''
ohc: 200
hyf: 1
hypedf: 0
un1: -1
tabc: 014
dotc: '.
numc: 034
tabtab: 8.;16.;24.;32.;40.;48.;56.;64.;72.
80.;88.;96.;104.;112.;120.;128.;136.;144.;152.;160.
.=.+44.
.even
etabtab:
fac: .=.+2
fmq: .=.+2
ne: .=.+2
nel: .=.+2
lastl: 0
jfomod: .=.+2
wordp: .=.+2
spaceflg: .=.+2
linep: .=.+2
wordend: .=.+2
wordstart: .=.+2
wne: .=.+2
nc: .=.+2
nb: .=.+2
lnumber: .=.+2
numbmod: .=.+2
nwd: .=.+2
nn: .=.+2
ni: .=.+2
ul: .=.+2
ce: .=.+2
rchar: .=.+2
nspace: .=.+2
in: .=.+2
in1: .=.+2
un: .=.+2
wch: .=.+2
x: .=.+2
/pendb: .=.+2
pendt: .=.+2
pendw: .=.+2
spread: .=.+2
word: .=.+200.
eword: .=.+2
stbuf:
linsiz = 600.
line: .=.+linsiz
blockend: .=.+2
dummy: .=block+1024.
.bss
bss:
hnl: .=.+2
iline: .=.+2
exf: .=.+2
hbuf: .=.+128.
ehbuf:
ndone: .=.+2
ttys: .=.+4
ttym: .=.+2
nform: .=.+2
toolate: .=.+2
pipin: .=.+2
npad: .=.+2
padc: .=.+2
fbuf: .=.+252.
efbuf: .=.+4
em: .=.+2
old: .=.+2
raw: .=.+2
raw1: .=.+2
xpc: .=.+2
copyf: .=.+2
aplnk: .=.+2
apptr: .=.+2
app: .=.+2
blist: .=.+512.
eblist: .=.+2
diflg: .=.+2
ditf: .=.+2
first: .=.+2
macerr: .=.+2
numerr: .=.+2
newptr: .=.+2
oldptr: .=.+2
rbuf: .=.+256.
wbuf: .=.+256.
wbufe: .=.+2
mflg: .=.+2
iflg: .=.+2
pendnf: .=.+2
over: .=.+2
temp: .=.+2
nfo: .=.+2
ds: .=.+2
markline: .=.+2
litlev: .=.+2
lit: .=.+2
ioff: .=.+2
ifl: .=.+8.
ifle: .=.+2
offl: .=.+10.
noset: .=.+2
quote: .=.+2
x.5: .=.+2
/index: .=.+2
stdi: .=.+2
/indid: .=.+2
sv: .=.+2
tty: .=.+2
quiet: .=.+2
trap: .=.+2
nls: .=.+2
elist: .=.+18.
eliste: .=.+2
rlist: .=.+158.
rliste: .=.+2
vlist:
pn: .=.+2
nl: .=.+2
dnl: .=.+2
yr: .=.+2
mo: .=.+2
dy: .=.+2
dw: .=.+2
column: .=.+2
.=.+144.
inclist: .=.+160.
flist: .=.+160.
nlist: .=.+28.
nliste: .=.+2
mlist: .=.+28.
mliste: .=.+2
donef: .=.+2
ssp: .=.+2
stop: .=.+2
nx: .=.+2
ibf: .=.+2
ibf1: .=.+2
skp: .=.+2
ejf: .=.+2
/ejf1: .=.+2
ejl: .=.+2
ip: .=.+2
cp: .=.+2
ap: .=.+2
op: .=.+2
tflg: .=.+2
ocol: .=.+2
nlflg: .=.+2
ch: .=.+2
maxdig: .=.+2
maxloc: .=.+2
hstart: .=.+2
nhstart: .=.+2
nhyph: .=.+2
argc: .=.+2
argp: .=.+2
ibufp: .=.+2
xbufp: .=.+2
xbuf: .=.+514.
eibuf: .=.+2
xeibuf: .=.+2
ulstate: .=.+2
ulc: .=.+2
bsc: .=.+2
nsp: .=.+2
ro: .=.+2
pfrom: .=.+2
onesp: .=.+2
fivesp: .=.+2
suff: .=.+2
sufb: .=.+20.
sufbuf: .=.+128.
suftab: .=2*26.+.
ifile: .=.+2
char: .=.+2
nfile: .=.+2
headp: .=.+2
trtab: .=.+128.
blocksize: .=.+2
enda: .=.+2
ybuf:
cbuf: .=.+34.
ilist:
stk: .=.+60.
end:
+566
View File
@@ -0,0 +1,566 @@
/
/
/ roff1 -- text formatter
.globl ttyn
nop = 000240
signal = 48.
ibuf: /init code in ibuf+obuf
cmp sp,$end
bhi 1f
jsr r5,string; emes1
sys exit
1:
clr r0
jsr pc,mesg
sys signal; 1; place
sys signal; 2; place
jsr pc,makebf
sys open; suffil; 0
bes 1f
mov r0,suff
sys seek; 20; 0
bes 1f
mov suff,r0
sys read; suftab; 2*26.
1:
clr r0
mov (sp)+,argc
dec argc
bne 1f
jmp place
1:
tst (sp)+
mov (sp),r4
cmpb (r4)+,$'+
bne 2f
jsr r5,pnum; pfrom
br 3f
2:
cmpb -1(r4),$'-
bne 2f
cmpb (r4),$'s
bne 0f
inc stop
br 3f
0:
cmpb (r4),$'h
bne 0f
clr slow
br 3f
0:
jsr r5,pnum; pto
3:
dec argc
bgt 1b
2:
mov $nop,get1a
mov $ibuf,ibufp
mov $ibuf,eibuf
mov sp,argp
jsr pc,topbot
clr r0
1:
movb r0,trtab(r0)
inc r0
cmp r0,$128.
bne 1b
jsr pc,rbreak
jsr pc,istop
jmp loop
makebf:
sys stat; bfn; stbuf
bec 2f
sys creat; bfn; 400
bec 1f
2:
incb bfn+8
cmpb bfn+8,$'z
blos makebf
jmp place
1:
mov r0,ibf
sys write; sufbuf;128.
sys open; bfn;0
mov r0,ibf1
rts pc
string:
mov (r5)+,r1
mov r1,r2
mov r1,0f
1:
tstb (r1)+
bne 1b
sub r2,r1
mov r1,1f
mov $1,r0
sys write; 0:..; 1:..
rts r5
emes1: <Too many files.\n\0>
xxx:
.even
obuf=ibuf+512.
.=ibuf+1024.
loop:
clr nlflg
jsr pc,getchar
cmpb r0,cc
beq 2f
movb r0,ch
jsr pc,text
br loop
2:
jsr pc,control
jsr pc,flushi
br loop
mesg:
tst r0
bne setsame
jsr pc,ttyn
movb r0,ttyx+8.
sys stat; ttyx; stbuf
mov stbuf+4,0f
mov 0f,1f
bic $22,0f
sys chmod; ttyx; 0:..
rts pc
setsame:
sys chmod; ttyx; 1:..
rts pc
pnum:
mov r4,ibufp
mov $37777,eibuf
jsr r5,number1; 0
mov r0,*(r5)+
clr ch
rts r5
flushi:
clr ch
tst nlflg
bne 1f
jsr pc,getchar
br flushi
1:
rts pc
gettchar:
tst ul
ble getchar
tst ulstate
beq 3f
tst bsc
bgt 1f
tst ulc
bgt 2f
clr ulstate
br 3f
1:
dec bsc
mov $010,r0
rts pc
2:
dec ulc
mov $'_,r0
rts pc
3:
jsr pc,getchar
cmp r0,$'0
blt 1f
cmp r0,$'9
ble 2f
cmp r0,$'A
blt 1f
cmp r0,$'Z
ble 2f
cmp r0,$'a
blt 1f
cmp r0,$'z
ble 2f
1:
tst ulc
bgt 3f
rts pc
3:
mov $1,ulstate
mov r0,ch
br gettchar
2:
inc bsc
inc ulc
rts pc
getchar:
mov ch,r0
beq 1f
clr ch
rts pc
1:
tst nlflg
beq 1f
mov $'\n,r0
rts pc
1:
jsr pc,get1
cmp r0,$'\\
bne 2f
jsr pc,get1
jsr r5,switch; esctab
br 3f
2:
cmp r0,$033 /prefix
bne 3f
jsr pc,get1
jsr r5,switch; pfxtab
3:
cmp r0,$'\n
bne 3f
inc nlflg
clr column
3:
mov r1,-(sp)
jsr pc,width
add r1,column
mov (sp)+,r1
rts pc
esctab:
.byte 'd, 032 /hlf (down)
.byte 'u, 035 /hlr (up)
.byte 'r, 036 /flr (reverse)
.byte 'x, 016 /SO (extra chars)
.byte 'y, 017 /SI (normal characters)
.byte 'l, 0177 /delete
.byte 't, 011 /hor tab
.byte 'a, 0100 /at sign
.byte 'n, 043 /number sign
.byte '\\, 134 /backslash
.byte 0, 0
pfxtab:
.byte '7, 036 /flr
.byte '8, 035 /hlr
.byte '9, 032 /hlf
.byte '4, 030 /brs
.byte '3, 031 /rrs
.byte '1, 026 /set hor tabs
.byte '2, 027 /clr hor tabs
.byte 0,0
pfxtab1:
switch:
mov r1,-(sp)
mov (r5)+,r1
1:
cmpb (r1)+,r0
beq 1f
tstb (r1)+
bne 1b
cmp r1,$pfxtab
ble 0f
cmp r1,$pfxtab1
bgt 0f
mov $037,r0
0:
mov (sp)+,r1
rts r5
1:
movb (r1)+,r0
mov (sp)+,r1
rts r5
get1:
tst nspace
ble 1f
dec nspace
mov tabc,r0
rts pc
1:
mov r1,-(sp)
4:
tst ip
beq 5f
jsr pc,rbf
br 6f
5:
tst nx
bne 0f
mov ibufp,r1
cmp r1,eibuf
bne 3f
0:
mov ifile,r0
bne 2f
1:
jsr pc,nextfile
2:
clr nx
sys read; ibuf; 512.
bes done
tst r0
beq 1b
mov $ibuf,r1
add r1,r0
mov r0,eibuf
3:
movb (r1)+,r0
mov r1,ibufp
1:
cmp r0,$011 /tab
bne 6f
mov (sp)+,r1
mov $tabtab,r0
inc nspace
1:
tstb (r0)
beq get1
cmpb column,(r0)+
bge 1b
movb -(r0),nspace
sub column,nspace
br get1
6:
get1a: br 7f
tst r0
beq 4b
7:
mov (sp)+,r1
rts pc
nextfile:
mov ifile,r0
beq 1f
sys close
1:
tst nx
beq 2f
mov $nextf,0f
br 3f
2:
dec argc
blt done
mov *argp,0f
add $2,argp
3:
sys open; 0:..; 0
bes done
mov r0,ifile
rts pc
done:
jsr pc,rbreak
jsr pc,eject
jsr pc,flush
place:
sys signal; 2; 1
mov $1,r0
jsr pc,mesg
sys unlink; bfn
sys exit
rts pc
putchar:
cmp pn,pfrom
blt 2f
clr pfrom
bic $!177,r0
beq 2f
movb trtab(r0),r0
cmp r0,$'
bne 1f
inc nsp
2:
rts pc
1:
cmp r0,$'\n
bne 1f
clr nsp
clr ocol
br 2f
1:
tst nsp
beq 2f
tst slow
bne 4f
jsr pc,dsp
cmp nsp,r1
blt 4f
mov $011,3f+2
cmp r1,$1
bgt 8f
mov $040,3f+2
dec nsp
br 9f
8:
sub r1,nsp
9:
mov r0,-(sp)
3:
mov $011,r0
jsr pc,pchar1
mov (sp)+,r0
br 1b
4:
mov r0,-(sp)
mov $' ,r0
jsr pc,pchar1
mov (sp)+,r0
dec nsp
bne 4b
2:
cmp r0,$026
blt 2f
cmp r0,$037
beq 3f
bgt 2f
mov r0,-(sp)
jsr r5, switch; unpfx
cmp (sp)+,r0
beq 2f
mov r0,-(sp)
mov $033,r0 /prefix
jsr pc,pchar1
dec ocol
mov (sp)+,r0
2:
pchar1:
cmp r0,$011
bne 1f
jsr pc,dsp
br 2f
1:
jsr pc,width
2:
add r1,ocol
movb r0,*obufp
inc obufp
cmp obufp,$obuf+128.
beq flush
3:
rts pc
dsp:
clr r1
1:
add $8.,r1
cmp ocol,r1
bgt 1b
sub ocol,r1
bne 2f
mov $8.,r1
2:
rts pc
unpfx:
.byte 032, '9
.byte 035, '8
.byte 036, '7
.byte 031, '3
.byte 030, '4
.byte 026, '1
.byte 027, '2
.byte 0,0
flush:
mov obufp,r0
sub $obuf,r0
mov r0,0f
mov $1,r0
sys write; obuf; 0:0
mov $obuf,obufp
rts pc
control:
jsr pc,getchar
mov r0,-(sp)
jsr pc,getchar
swab r0
bis (sp),r0
mov $contab,r1
1:
mov (r1)+,(sp)
bic $100000,(sp)
cmp r0,(sp)
bne 4f
mov (r1),(sp)
tst -(r1)
bpl 3f
jsr pc,flushi
cmp ilistp,$iliste
bgt 5f
mov ip,*ilistp
add $2,ilistp
mov (sp),ip
br 5f
3:
jmp *(sp)+
4:
cmp (r1)+,$-1
bne 1b
5:
tst (sp)+
rts pc
contab:
<ad>; casead
<bp>; casebp
<br>; casebr
<cc>; casecc
<ce>; casece
<ds>; caseds
<fi>; casefi
<in>; casein
<ix>; caseix
<li>; caseli
<ll>; casell
<ls>; casels
<na>; casena
<ne>; casene
<nf>; casenf
<pa>; casepa
<bl>; casebl
<pl>; casepl
<sk>; casesk
<sp>; casesp
<ss>; casess
<ta>; caseta
<ti>; caseti
<tr>; casetr
<ul>; caseul
<un>; caseun
<he>; casehe
<hx>; casehx
<fo>; casefo
<eh>; caseeh
<oh>; caseoh
<ef>; caseef
<of>; caseof
<m1>; casem1
<m2>; casem2
<m3>; casem3
<m4>; casem4
<hc>; casehc
<hy>; casehy
<n1>; casen1
<n2>; casen2
<nn>; casenn
<ni>; caseni
<jo>; casejo
<ar>; casear
<ro>; casero
<nx>; casenx
<po>; casepo
<de>; casede
<ig>; caseig
<tc>; casetc
<mk>; casemk
bnames: .=.+100.
-1; -1
+404
View File
@@ -0,0 +1,404 @@
/
/
/ roff2 -- runoff
casead:
jsr pc,rbreak
inc ad
rts pc
rts pc
casebr:
jsr pc,rbreak
rts pc
casecc:
jsr pc,skipcont
jsr pc,getchar
cmp r0,$'\n
beq 1f
movb r0,cc
1:
mov r0,ch
rts pc
casece:
jsr pc,rbreak
jsr r5,number; 0
jsr pc,min
mov r0,ce
jsr pc,need
rts pc
caseds:
jsr pc,rbreak
mov $2,ls
rts pc
casefi:
jsr pc,rbreak
inc fi
rts pc
casein:
jsr pc,rbreak
jsr r5,number; in
jsr pc,min
mov r0,in
mov r0,un
rts pc
caseix:
jsr r5,number; in
jsr pc,min
mov r0,in
rts pc
caseli:
jsr r5,number; 0
mov r0,-(sp)
1:
dec (sp)
blt 1f
jsr pc,flushi
clr nlflg
jsr pc,text
br 1b
1:
tst (sp)+
rts pc
casell:
jsr r5,number; ll
jsr pc,min
mov r0,ll
rts pc
casels:
jsr pc,rbreak
jsr pc,skipcont
jsr pc,getchar
cmp r0,$'\n
bne 1f
mov ls1,ls
rts pc
1:
mov r0,ch
jsr r5,number1; ls
dec r0
jsr pc,min
inc r0
mov r0,ls
mov r0,ls1
rts pc
casena:
jsr pc,rbreak
clr ad
rts pc
casene:
jsr r5,number; 0
jsr pc,min
jsr pc,need
rts pc
casenf:
jsr pc,rbreak
clr fi
rts pc
casepa:
casebp:
jsr pc,rbreak
jsr pc,eject
jsr pc,skipcont
tst nlflg
bne 1f
jsr r5,number; pn
jsr pc,min
mov r0,pn
1:
rts pc
casebl:
jsr pc,rbreak
jsr r5,number; 0
jsr pc,min
mov r0,-(sp)
jsr pc,need2
1:
dec (sp)
blt 1f
mov $' ,r0
jsr pc,storeline
jsr pc,rbreak
br 1b
1:
tst (sp)+
rts pc
casepl:
jsr r5,number; pl
mov r0,pl
jsr pc,topbot
rts pc
casesk:
jsr r5,number; 0
jsr pc,min
mov r0,skip
rts pc
casesp:
jsr pc,rbreak
jsr r5,number; 0
jsr r5,nlines; nline
rts pc
casess:
jsr pc,rbreak
mov $1,ls
rts pc
casetr:
jsr pc,skipcont
1:
jsr pc,getchar
cmp r0,$'\n
beq 1f
mov r0,r1
jsr pc,getchar
cmp r0,$'\n
bne 2f
mov $' ,r0
2:
movb r0,trtab(r1)
br 1b
1:
rts pc
caseta:
mov $tabtab,r1
1:
jsr r5,number; 0
jsr pc,min
dec r0
ble 1f
movb r0,(r1)+
br 1b
1:
clrb (r1)+
rts pc
caseti:
jsr pc,rbreak
jsr r5,number; in
jsr pc,min
mov r0,un
rts pc
caseul:
jsr r5,number; 0
jsr pc,min
mov r0,ul
rts pc
caseun:
jsr r5,number; 0
sub in,r0
neg r0
jsr pc,min
mov r0,un
rts pc
casehx:
tst hx
beq 1f
clr hx
br 2f
1:
inc hx
2:
jsr pc,topbot
rts pc
casehe:
jsr r5,headin; ehead
mov ehead,ohead
rts pc
casefo:
jsr r5,headin; efoot
mov efoot,ofoot
rts pc
caseeh:
jsr r5,headin; ehead
rts pc
caseoh:
jsr r5,headin; ohead
rts pc
caseef:
jsr r5,headin; efoot
rts pc
caseof:
jsr r5,headin; ofoot
rts pc
casem1:
jsr r5,number; ma1
jsr pc,min
mov r0,ma1
br 1f
casem2:
jsr r5,number; ma2
jsr pc,min
mov r0,ma2
br 1f
casem3:
jsr r5,number; ma3
jsr pc,min
mov r0,ma3
br 1f
casem4:
jsr r5,number; ma4
jsr pc,min
mov r0,ma4
1:
jsr pc,topbot
rts pc
casehc:
jsr pc,skipcont
jsr pc,getchar
cmp r0,$'\n
bne 1f
movb $200,r0
1:
mov r0,ohc
rts pc
casetc:
jsr pc,skipcont
jsr pc,getchar
cmp r0,$'\n
bne 1f
mov $' ,r0
1:
mov r0,tabc
rts pc
casehy:
jsr r5,number; 0
mov r0,hyf
rts pc
casen1:
jsr pc,rbreak
mov $1,numbmod
br 1f
casen2:
jsr pc,rbreak
mov $2,numbmod
1:
clr nn
jsr r5,number; 0
tst r0
ble 1f
mov r0,lnumber
rts pc
1:
clr numbmod
rts pc
casenn:
jsr r5,number; 0
jsr pc,min
mov r0,nn
rts pc
caseni:
jsr r5,number; ni
jsr pc,min
mov r0,ni
rts pc
casejo:
jsr r5,number; 0
mov r0,jfomod
rts pc
casear:
clr ro
rts pc
casero:
inc ro
rts pc
casenx:
jsr pc,skipcont
jsr r5,getname; nextf
inc nx
jsr pc,nextfile
inc nlflg
clr ip
mov $ilist,ilistp
rts pc
casepo:
jsr pc,rbreak
jsr r5,number; po
jsr pc,min
mov r0,po
rts pc
casede:
tst ip
bne 5f
jsr pc,skipcont
jsr r5,getname; bname
clr skp
mov $contab,r1
clr -(sp)
1:
mov (r1)+,(sp)
beq 2f
bic $100000,(sp)
cmp bname,(sp)
bne 3f
2:
bis $100000,bname
mov nextb,(r1)
mov bname,-(r1)
br 4f
3:
cmp (r1)+,$-1
bne 1b
inc skp
4:
tst (r1)+
jsr pc,copyb
tst (sp)+
5:
rts pc
caseig:
inc skp
jsr pc,copyb
rts pc
casemk:
jsr pc,rbreak
mov $002,r0 /stx
jsr pc,putchar
rts pc
+485
View File
@@ -0,0 +1,485 @@
/
/
/roff3 -- runoff
skipcont:
jsr pc,getchar
mov r0,r2
jsr pc,alph2
beq skipcont
1:
cmp $' ,r0
bne 1f
jsr pc,getchar
br 1b
1:
mov r0,ch
rts pc
rbreak:
tst nc
ble 4f
clrb *linep
inc totout
mov ls,r0
dec r0
jsr r5,nlines; nline
tst pl
beq 4f
cmp nl,bl
bne 1f
3:
jsr pc,eject
1:
tst nl
bne 3f
mov ma1,r0
jsr r5,nlines; newline
bit $1,pn
bne 1f
jsr r5,headout; ehead
br 2f
1:
jsr r5,headout; ohead
2:
mov ma2,r0
jsr r5,nlines; newline
dec skip
bge 3b
3:
mov po,r0
jsr pc,space
jsr pc,donum
mov un,r0
jsr pc,space
jsr pc,jfo
mov $line,r2
1:
movb (r2)+,r0
cmp $' ,r0
bne 2f
jsr pc,fill
tst nc
bne 1b
br 3f
2:
jsr pc,putchar
dec nc
bgt 1b
3:
jsr pc,newline
clr nwd
clr ne
mov in,un
4:
jsr pc,setnel
rts pc
jfo:
tst jfomod
beq 1f
mov fac,r0
add fmq,r0
beq 1f
clr fac
clr fmq
mov nel,r0
cmp jfomod,$1
bne 2f
asr r0
2:
jsr pc,space
1:
rts pc
donum:
tst numbmod
beq 2f
dec nn
blt 1f
mov $5,r0
add ni,r0
jsr pc,space
rts pc
1:
clr r0
cmp lnumber,$100.
bge 1f
inc r0
cmp lnumber,$10.
bge 1f
inc r0
1:
add ni,r0
jsr pc,space
mov lnumber,r0
jsr r5,decimal; putchar
mov $2,r0
jsr pc,space
inc lnumber
2:
rts pc
newline:
mov $'\n,r0
jsr pc,putchar
inc nl
rts pc
nline:
mov nl,r0
beq 1f
cmp r0,bl
beq 1f
jsr pc,newline
1:
rts pc
number:
jsr pc,skipcont
number1:
mov r1,-(sp)
mov r3,-(sp)
clr r3
clr -(sp)
clr -(sp)
1:
jsr pc,getchar
cmp r0,$'+
beq 2f
cmp r0,$'-
beq 2f
sub $'0,r0
cmp r0,$9.
bhi 3f
inc (sp)
mpy $10.,r3
add r0,r3
br 1b
2:
mov r0,2(sp)
br 1b
3:
add $'0,r0
mov r0,ch
mov (sp)+,r0
bne 1f
mov $1,r3
mov r3,r0
1:
mov (r5)+,r0
beq 1f
mov (r0),r0
1:
mov (sp)+,r1
cmp r1,$'-
bne 1f
sub r3,r0
br 2f
1:
cmp r1,$'+
bne 1f
add r3,r0
br 2f
1:
mov r3,r0
2:
mov (sp)+,r3
mov (sp)+,r1
rts r5
eject:
tst pl
beq 1f
tst nl
beq 1f
mov pl,r0
sub nl,r0
sub ma4,r0
sub hx,r0
jsr r5,nlines; newline
bit $1,pn
bne 2f
jsr r5,headout; efoot
br 3f
2:
jsr r5,headout; ofoot
3:
cmp numbmod,$1
bne 3f
mov $1,lnumber
3:
mov ma4,r0
jsr r5,nlines; newline
clr nl
inc pn
1:
cmp pn,pto
ble 1f
jsr pc,flush
jmp place
1:
istop:
tst stop
beq 2f
cmp pn,pfrom
blo 2f
jsr pc,flush
/ mov sp,r1
/ sys signal; 2; 1f
clr r0
sys read; garb; 1
1:
/ mov r1,sp
/ sys signal; 2; place
2:
rts pc
storeline:
cmp linep,$line+linsiz
bhis 1f
movb r0,*linep
inc linep
jsr pc,width
add r1,ne
sub r1,nel
inc nc
1:
rts pc
getword:
mov $word,r2
clr wne
clr wch
clr nhyph
clr hypedf
mov $word,wordp
clr -(sp)
1:
jsr pc,gettchar
cmp r0,$'\n
beq 3f
cmp r0,ohc
bne 2f
inc hypedf
br 1b
2:
cmp $' ,r0
bne 2f
jsr pc,storeword
br 1b
2:
mov r0,-(sp)
mov $' ,r0
jsr pc,storeword
tst spaceflg
beq 2f
jsr pc,storeword
clr spaceflg
2:
mov (sp)+,r0
2:
jsr pc,storeword
bisb (sp),-1(r2) /add in hyphen
clr (sp)
jsr pc,gettchar
cmp r0,ohc
bne 1f
inc hypedf
jsr pc,gettchar
mov $200,(sp)
1:
cmp $' ,r0
beq 1f
cmp $'\n,r0
bne 2b
cmpb -1(r2),$'.
bne 1f
inc spaceflg
1:
add $2,2(sp)
1:
clrb (r2)+
3:
tst (sp)+
mov $word,wordp
tst nc
bne 1f
jsr pc,setnel
1:
rts pc
setnel:
mov $line,linep
mov ll,nel
sub un,nel
clr ne
clr fac
clr fmq
rts pc
storeword:
jsr pc,width
add r1,wne
inc wch
movb r0,(r2)+
rts pc
need:
mov r0,r3
mpy ls,r3
mov r3,r0
need2:
add nl,r0
cmp r0,bl
ble 1f
jsr pc,eject
1:
rts pc
min:
tst r0
bge 1f
clr r0
1:
rts pc
getname:
mov r1,-(sp)
mov r2,-(sp)
mov (r5)+,r1
mov $18.,r2
1:
jsr pc,getchar
cmp r0,$041
blt 2f
cmp r0,$0176
ble 4f
2:
mov r0,ch
3:
clrb (r1)+
mov (sp)+,r2
mov (sp)+,r1
rts r5
4:
movb r0,(r1)+
dec r2
beq 3b
br 1b
copyb:
mov (r1),r1
jsr pc,flushi
clr nlflg
mov $1,-(sp)
1:
jsr pc,getchar
cmp r0,$'\n
bne 2f
mov $1,(sp)
clr nlflg
br 4f
2:
cmp r0,$'.
bne 9f
cmp (sp),$1
bgt 3f
blt 9f
inc (sp)
br 4f
3:
dec r1
clr r0
inc (sp)
br 4f
9:
clr (sp)
4:
tst skp
bne 5f
jsr pc,wbf
5:
cmp (sp),$3
bne 1b
tst (sp)+
tst skp
bne 6f
mov r1,nextb
6:
rts pc
popi:
cmp ilistp,$ilist
beq 1f
sub $2,ilistp
mov *ilistp,ip
1:
rts pc
wbf:
mov r0,char
mov r1,offb
mov ibf,r0
sys seek; offb:..;0
mov ibf,r0
sys write; char;1
inc r1
cmp ibf1,ofile
bne 1f
mov $-1,ofile
1:
rts pc
rbf:
mov ip,r1
mov ibf1,nfile
jsr pc,rdsufb
tstb r0
bne 2f
jsr pc,popi
rts pc
2:
inc ip
rts pc
alph:
movb (r0),r2
alph2:
cmp r2,$'A
blo 1f
cmp r2,$'Z
blos 2f
cmp r2,$'a
blo 1f
cmp r2,$'z
bhi 1f
2:
sez
rts pc
1:
clz
rts pc
rdsufb:
mov r1,-(sp)
bic $77,r1
cmp r1,sufoff
bne 1f
cmp nfile,ofile
beq 2f
1:
mov r1,sufoff
mov nfile,ofile
mov nfile,r0
sys seek; sufoff: -1; 0
mov nfile,r0
sys read; sufbuf; 512.
2:
mov (sp),r0
bic $!77,r0
movb sufbuf(r0),r0
mov (sp)+,r1
rts pc
+516
View File
@@ -0,0 +1,516 @@
/
/
/ roff4 -- runoff
text:
/ inc tottext
clr ulstate
clr wch
clr wne
tst ce
bne nofill
tst fi
beq nofill
jsr pc,getchar
2:
mov r0,ch
cmp $' ,r0
bne 2f
jsr pc,rbreak
1:
jsr pc,getchar
cmp $' ,r0
bne 2b
inc un
br 1b
2:
cmp r0,$'\n
bne 2f
jsr pc,rbreak
clr ch
jsr pc,nline
br 4f
2:
tst wch
bne 3f
jsr pc,getword
br 4f
3:
jsr pc,movword
bne 2b
jsr pc,adjust
br 2b
4:
dec ul
bge 1f
clr ul
1:
rts pc
nofill:
jsr pc,rbreak
1:
jsr pc,gettchar
cmp r0,$'\n
beq 1f
jsr pc,width
add r1,ne
jsr pc,storeline
br 1b
1:
tst ce
ble 2f
dec ce
mov nel,r0
asr r0
bpl 1f
clr r0
1:
add r0,un
tst numbmod
beq 2f
add $2,un
2:
clr fac
clr fmq
mov $1000,nwd
mov $' ,r0
jsr pc,storeline
jsr pc,rbreak
dec ul
bpl 2f
clr ul
2:
rts pc
adjust:
mov r2,-(sp)
mov r3,-(sp)
clr r2
clr r3
tst ad
beq 1f
mov nwd,r0
dec r0
ble 1f
mov nel,r3
ble 1f
dvd r0,r2
1:
mov r3,fac
mov r2,fmq
mov (sp)+,r3
mov (sp)+,r2
jsr pc,rbreak
rts pc
fill:
mov fmq,r0
1:
inc r0
dec nc
cmpb (r2)+,$'
beq 1b
dec r2
bit $1,totout
beq 2f
inc fac
cmp fac,nwd
blt 1f
inc r0
br 1f
2:
dec fac
bmi 1f
inc r0
1:
jsr pc,space
movb (r2),r0
rts pc
movword:
mov wch,wordend
mov wordp,r4
add r4,wordend
tst nwd
bne 2f
1:
movb (r4)+,r0
cmp r0,$'
bne 1f
dec wch
jsr pc,width
sub r1,wne
br 1b
1:
dec r4
2:
cmp wne,nel
ble 1f
cmp nel,$4
ble 1f
mov ls,r0
add nl,r0
cmp r0,bl
bgt 2f
mov ls,r0
asl r0
add nl,r0
cmp r0,bl
bgt 1f
2:
jsr pc,hyphen
1:
clr nhyph
mov wch,-(sp)
1:
movb (r4)+,r0
cmp r0,$'-
bne 2f
movb (r4),r2
jsr pc,alph2
bne 2f
bisb $200,(r4)
2:
tst r0
bpl 2f
bic $!177,r0
mov r4,r3
sub $4,r3
cmp r3,$word
blo 2f
movb (r3),r2
bic $!177,r2
jsr pc,alph2
beq 3f
cmp nel,$2
ble 2f
3:
mov r0,-(sp)
clr r0
jsr pc,storeline
mov (sp)+,r0
inc nhyph
2:
jsr pc,width
sub r1,wne
jsr pc,storeline
dec wch
bne 1b
tst nel
blt 1f
inc nwd
tst (sp)+
clz
rts pc
1:
mov linep,r3
1:
tst nhyph
bne 2f
tst nwd
beq 3f
cmp wch,(sp)
beq 4f
2:
movb -(r3),r0
bne 2f
dec nhyph
bne 5f
tst nwd
beq 6f
5:
tst nel
ble 2f
6:
cmpb -1(r3),$'-
beq 3f
movb $'-,(r3)
dec nel
inc ne
br 3f
2:
dec nc
tstb (r3)
beq 1b
jsr pc,width
sub r1,ne
add r1,nel
inc wch
dec r4
add r1,wne
br 1b
3:
inc nwd
4:
mov r4,wordp
bicb $!177,(r4)
cmp r4,$word
bge 4f
4
4:
tst (sp)+
sez
rts pc
topbot:
mov pl,r0
bne 1f
clr bl
rts pc
1:
sub ma3,r0
sub ma4,r0
sub hx,r0
mov r0,bl
mov ma1,r0
add ma2,r0
add hx,r0
cmp r0,bl
blt 1f
mov $2,r0
mov r0,ma1
mov r0,ma2
mov r0,ma3
mov r0,ma4
mov $66.,pl
br topbot
1:
cmp nl,bl
ble 1f
mov bl,nl
1:
rts pc
width:
cmp r0,ohc
beq 2f
tst r0
beq 2f
cmp r0,$0177
beq 2f
cmp r0,$010
bne 1f
mov $-1,r1
rts pc
1:
cmp $' ,r0
bgt 2f
mov $1,r1
rts pc
2:
clr r1
rts pc
headin:
jsr pc,skipcont
mov nextb,r1
mov r1,*(r5)+
jsr pc,gettchar
cmp r0,$'\n
beq 2f
mov r0,r2
1:
jsr pc,gettchar
cmp r0,$'\n
beq 2f
cmp r0,r2
bne 3f
clr r0
3:
jsr pc,wbf
br 1b
2:
clr r0
jsr pc,wbf
mov r1,nextb
mov ll,llh
rts r5
headout:
tst hx
bne 0f
tst (r5)+
rts r5
0:
clr -(sp)
mov *(r5),r2
mov ibf1,nfile
jsr r5,headseg; width
mov r0,-(sp)
jsr r5,headseg; width
mov r0,-(sp)
jsr r5,headseg; width
mov r0,-(sp)
mov po,r0
jsr pc,space
tst numbmod
beq 1f
mov $5,r0
add ni,r0
mov r0,6(sp)
1:
mov *(r5)+,r2
jsr r5,headseg; putchar
mov llh,r0
add 6(sp),r0
sub 2(sp),r0
asr r0
sub 4(sp),r0
bge 1f
clr r0
1:
mov r0,-(sp)
jsr pc,space
jsr r5,headseg; putchar
mov llh,r0
sub (sp)+,r0
sub (sp)+,r0
sub (sp)+,r0
sub (sp)+,r0
add (sp)+,r0
jsr pc,space
jsr r5,headseg; putchar
jsr pc,newline
rts r5
headseg:
clr -(sp)
1:
mov r1,-(sp)
mov r2,r1
inc r2
jsr pc,rdsufb
mov (sp)+,r1
tstb r0
beq 1f
cmp r0,$'%
beq 2f
jsr pc,*(r5)
add r1,(sp)
br 1b
2:
mov pn,r0
clr r1
tst ro
beq 2f
mov $ones,onesp
mov $fives,fivesp
jsr pc,roman
add r1,(sp)
br 1b
2:
jsr pc,decml
add r1,(sp)
br 1b
1:
mov (sp)+,r0
tst (r5)+
rts r5
space:
jsr r5,nlines; putchar
rts pc
nlines:
mov r0,-(sp)
1:
dec (sp)
blt 1f
mov $' ,r0
jsr pc,*(r5)
br 1b
1:
cmp (r5)+,(sp)+
rts r5
decimal:
jsr pc,decml
tst (r5)+
rts r5
decml:
mov r2,-(sp)
mov r3,-(sp)
jsr pc,decml1
mov (sp)+,r3
mov (sp)+,r2
rts pc
decml1:
mov r1,-(sp)
clr r2
mov r0,r3
dvd $10.,r2
mov r3,-(sp)
mov r2,r0
beq 1f
jsr pc,decml
mov r1,2(sp)
1:
mov (sp)+,r0
add $'0,r0
jsr pc,*(r5)
add (sp)+,r1
rts pc
roman:
mov r2,-(sp)
mov r3,-(sp)
jsr pc,roman1
mov (sp)+,r3
mov (sp)+,r2
rts pc
roman1:
clr r2
mov r0,r3
bne .+4
rts pc
mov r1,-(sp)
dvd $10.,r2
mov r3,-(sp)
mov r2,r0
inc onesp
inc fivesp
jsr pc,roman
mov r1,2(sp)
dec onesp
dec fivesp
clr r2
mov (sp)+,r3
dvd $5.,r2
cmp r3,$4
bne 1f
movb *onesp,r0
jsr pc,*(r5)
add r1,(sp)
tst r2
beq 2f
inc onesp
movb *onesp,r0
dec onesp
br 3f
2:
movb *fivesp,r0
3:
jsr pc,*(r5)
add (sp)+,r1
rts pc
1:
tst r2
beq 2f
movb *fivesp,r0
jsr pc,*(r5)
add r1,(sp)
2:
dec r3
blt 1f
movb *onesp,r0
jsr pc,*(r5)
add r1,(sp)
br 2b
1:
mov (sp)+,r1
rts pc
+294
View File
@@ -0,0 +1,294 @@
/
/
/ hyp1 -- driver
hyphen:
tst hypedf
bne 3f
tst hyf
beq 3f
inc hypedf
mov wordp,r0
clr nhyph
1:
jsr pc,punct
bne 1f
inc r0
br 1b
1:
jsr pc,alph
bne 3f
1:
inc r0
jsr pc,alph
beq 1b
dec r0
mov r0,hstart
1:
inc r0
tstb (r0)
beq 2f
jsr pc,punct
bne 3f
br 1b
2:
jsr r5,suffix
jsr r5,digram
3:
rts pc
punct:
tst old
bne 4f
cmpb (r0),$010
beq 0f
movb (r0),r2
jsr pc,alph2
beq 0f
sez
rts pc
0:
clz
rts pc
4:
mov $3f,r2
1:
cmpb (r0),(r2)+
beq 2f
tstb (r2)
bne 1b
clz
2:
rts pc
3: < .,()"\'`\0> /should be more
.even
maplow:
cmp r2,$'a
bhis 1f
add $'a-'A,r2
1:
rts pc
vowel:
cmp r2,$'a
beq 1f
cmp r2,$'e
beq 1f
cmp r2,$'i
beq 1f
cmp r2,$'o
beq 1f
cmp r2,$'u
beq 1f
cmp r2,$'y
1:
rts pc
checkvow:
mov r0,-(sp)
1:
movb -(r0),r2
jsr pc,vowel
beq 1f
jsr pc,alph
beq 1b
mov (sp)+,r0
clz
rts r5
1:
mov (sp)+,r0
sez
rts r5
/ hyp2 -- suffix and digram
digram:
mov hstart,r0
1:
jsr pc,alph
bne 3f
jsr pc,vowel
beq 1f
dec r0
br 1b
1:
mov r0,hstart
1:
movb -(r0),r2
jsr pc,alph2
bne 3f
jsr pc,vowel
bne 1b
clr maxdig
mov r0,nhstart
1:
mov $1,r3
movb -1(r0),r2
jsr pc,alph2
beq 2f
movb (r0),r2
mov $'a,r1
jsr r5,dilook; bxh
br 4f
2:
movb -2(r0),r2
mov $xxh,0f
jsr pc,alph2
beq 2f
mov $bxxh,0f
2:
movb -1(r0),r1
movb (r0),r2
jsr r5,dilook; 0:xxh
4:
movb (r0)+,r1
movb (r0),r2
jsr r5,dilook; xhx
movb (r0),r1
movb 1(r0),r2
jsr r5,dilook; hxx
cmp r3,maxdig
blos 2f
mov r3,maxdig
mov r0,maxloc
2:
cmp r0,hstart
blo 1b
mov nhstart,hstart
cmp maxdig,thresh
blo digram
bisb $200,*maxloc
inc nhyph
/ mov maxdig,*octbufp
/ inc octcnt
/ add $2,octbufp
br digram
3:
rts r5
dilook:
mov r4,-(sp)
bic $!177,r2
bic $!177,r1
jsr pc,maplow
sub $'a,r2
cmp r2,$'z-'a
bhi 3f
mov r2,r4
mov r1,r2
jsr pc,maplow
sub $'a,r2
cmp r2,$'z-'a
bhi 3f
mov r3,-(sp)
mov r2,r3
mpy $13.,r3
clr r2
clc
ror r4
adc r2
add r3,r4
add (r5)+,r4
movb (r4),r4
tst r2
bne 1f
asr r4
asr r4
asr r4
asr r4
1:
bic $!17,r4
mov r4,r3
mpy (sp)+,r3
br 4f
3:
clr r3
tst (r5)+
4:
mov (sp)+,r4
rts r5
suffix:
mov hstart,r0
jsr pc,alph
bne 4f
jsr pc,maplow
sub $'a,r2
asl r2
mov suftab(r2),-(sp)
bic $!37777,(sp)
beq 3f
1:
mov hstart,r0
mov (sp),r1
jsr pc,rdsuf
movb (r1),r3
beq 3f
bic $!17,r3
add r3,(sp)
add r1,r3
2:
movb -(r3),r2
cmp r3,r1
ble 2f
bic $!177,r2
mov r2,-(sp)
movb -(r0),r2
jsr pc,maplow
cmp r2,(sp)+
bne 1b
br 2b
2:
mov hstart,r0
tst (sp)+
movb (r1),r3
bic $!17,r3
add r1,r3
bitb $200,(r1)+
bne 1f
2:
dec r0
cmp r3,r1
ble 2f
tstb -(r3)
bpl 2b
1:
mov r0,hstart
dec hstart
bitb $100,-1(r1)
bne 2b
jsr r5,checkvow
bne 4f
bisb $200,(r0)
br 2b
2:
bitb $40,-(r1)
beq suffix
br 4f
3:
tst (sp)+
4:
rts r5
rdsuf:
mov r0,-(sp)
mov suff,nfile
mov 4(sp),r1
jsr pc,rdsufb
mov $sufb,r2
movb r0,(r2)+
mov r0,r3
bic $!17,r3
1:
dec r3
blt 1f
inc r1
jsr pc,rdsufb
movb r0,(r2)+
br 1b
1:
mov $sufb,r1
mov (sp)+,r0
rts pc
+121
View File
@@ -0,0 +1,121 @@
/
/
/ hyp4 -- digram tables
bxh:
.byte 060,000,040,000,040,000,000,040,000,000,040,000,040
hxx:
.byte 006,042,041,123,021,024,063,042,002,043,021,001,022
.byte 140,000,200,003,260,006,000,160,007,000,140,000,320
.byte 220,000,160,005,240,010,000,100,006,000,200,000,320
.byte 240,000,120,003,140,000,000,240,010,000,220,000,160
.byte 042,023,041,040,040,022,043,041,030,064,021,000,041
.byte 100,000,140,000,220,006,000,140,003,000,200,000,000
.byte 200,000,120,002,220,010,000,160,006,000,140,000,320
.byte 020,000,020,000,020,000,000,020,000,000,020,000,000
.byte 043,163,065,044,022,043,104,042,061,146,061,000,007
.byte 100,000,140,000,040,000,000,100,000,000,120,000,000
.byte 140,000,040,011,060,004,001,120,003,000,140,000,040
.byte 200,000,100,000,140,000,000,140,000,000,140,000,240
.byte 200,000,140,000,160,000,000,220,000,000,140,000,240
.byte 200,000,140,000,160,000,000,220,000,000,060,000,240
.byte 021,043,041,121,040,023,042,003,142,042,061,001,022
.byte 120,000,140,010,140,010,000,140,002,000,120,000,120
.byte 000,000,000,000,360,000,000,000,000,000,160,000,000
.byte 100,000,040,005,120,000,000,100,000,000,060,000,140
.byte 140,040,100,001,240,041,000,242,000,002,140,000,100
.byte 240,000,120,002,200,000,000,320,007,000,240,000,340
.byte 101,021,041,020,040,005,042,121,002,021,201,000,020
.byte 160,000,100,000,140,000,000,160,006,000,220,000,140
.byte 140,000,020,001,020,000,000,100,001,000,300,000,000
.byte 000,000,000,000,000,000,000,000,000,000,000,000,000
.byte 106,041,040,147,040,000,063,041,001,102,160,002,002
.byte 300,000,040,017,140,017,000,240,000,000,140,000,120
bxxh:
.byte 005,150,153,062,062,246,152,127,146,203,310,017,206
.byte 100,000,120,000,140,000,000,100,000,000,120,000,060
.byte 100,000,040,000,060,000,000,060,000,000,220,000,040
.byte 100,000,120,000,200,000,000,100,000,000,140,000,060
.byte 043,142,046,140,062,147,210,131,046,106,246,017,111
.byte 060,000,020,000,060,000,000,040,000,000,100,000,000
.byte 060,000,040,000,040,000,000,040,000,000,100,000,040
.byte 100,000,100,000,100,000,000,040,000,000,100,000,140
.byte 066,045,145,140,000,070,377,030,130,103,003,017,006
.byte 040,000,040,000,020,000,000,040,000,000,100,000,000
.byte 200,000,020,000,140,000,000,120,000,000,120,000,040
.byte 120,000,040,000,060,000,000,060,000,000,160,000,040
.byte 120,000,040,000,120,000,000,040,000,000,160,000,040
.byte 120,000,020,000,140,000,000,120,000,000,140,000,040
.byte 051,126,150,140,060,210,146,006,006,165,003,017,244
.byte 120,000,040,000,160,000,000,140,000,000,060,000,140
.byte 000,000,000,000,000,000,000,000,000,000,000,000,000
.byte 140,000,140,000,060,000,000,100,000,000,140,000,020
.byte 120,000,020,000,060,000,000,060,000,000,060,000,040
.byte 140,000,020,000,100,000,000,140,000,000,140,000,020
.byte 070,125,051,162,120,105,126,104,006,044,000,017,052
.byte 140,000,020,000,140,000,000,060,000,000,060,000,040
.byte 020,000,000,000,020,000,000,000,000,000,000,000,060
.byte 140,000,160,000,200,000,000,140,000,000,000,000,240
.byte 065,042,060,200,000,210,222,146,006,204,220,012,003
.byte 240,000,020,000,120,000,000,200,000,000,200,000,240
xhx:
.byte 032,146,042,107,076,102,042,146,202,050,006,000,051
.byte 036,377,057,013,057,366,377,057,001,377,057,000,040
.byte 037,377,020,000,100,022,377,057,362,116,100,000,017
.byte 057,377,057,031,137,363,377,037,362,270,077,000,117
.byte 074,142,012,236,076,125,063,165,341,046,047,000,024
.byte 020,017,075,377,040,001,377,017,001,204,020,000,040
.byte 057,017,057,340,140,362,314,117,003,302,100,000,057
.byte 057,357,077,017,100,366,314,057,342,346,037,000,060
.byte 252,145,072,157,377,165,063,066,164,050,363,000,362
.byte 000,000,020,000,020,000,000,017,000,000,020,000,000
.byte 117,017,237,377,200,354,125,110,004,257,000,000,300
.byte 057,367,054,357,157,216,314,114,217,353,053,000,057
.byte 077,213,077,077,177,317,377,114,377,352,077,000,076
.byte 077,213,077,077,157,177,377,054,377,352,117,000,075
.byte 125,230,065,216,057,066,063,047,345,126,011,000,033
.byte 057,377,051,360,120,361,273,056,001,256,057,000,060
.byte 000,000,000,000,000,000,000,000,000,000,000,000,000
.byte 076,310,056,310,137,174,273,055,335,266,033,000,155
.byte 077,157,057,360,057,063,042,024,077,206,020,000,040
.byte 057,037,077,360,100,365,377,037,362,176,050,000,026
.byte 167,146,042,112,077,110,062,254,366,052,377,000,163
.byte 060,000,040,000,120,000,377,060,012,000,037,000,257
.byte 037,232,157,361,040,003,125,010,001,256,000,000,340
.byte 377,377,377,377,377,377,377,377,377,377,377,017,277
.byte 253,315,257,216,377,206,146,306,371,126,232,000,004
.byte 057,012,100,360,160,360,000,040,000,017,157,000,176
xxh:
.byte 045,150,154,162,042,246,210,147,152,103,230,017,206
.byte 100,000,040,000,140,000,000,100,000,021,120,017,060
.byte 100,000,040,002,140,320,000,060,000,001,220,017,040
.byte 100,001,120,001,241,000,000,100,000,020,140,017,060
.byte 023,162,046,142,022,207,210,131,052,106,250,017,110
.byte 060,000,042,000,160,000,000,040,000,212,100,017,000
.byte 140,000,040,002,140,000,000,120,000,040,120,017,040
.byte 100,000,100,000,140,001,021,140,000,046,100,017,140
.byte 066,045,025,201,020,130,146,030,130,103,025,017,006
.byte 100,000,040,000,020,000,000,040,000,000,200,017,000
.byte 200,000,020,001,140,000,000,140,000,000,120,017,040
.byte 120,026,042,020,140,161,042,143,000,022,162,017,040
.byte 121,042,060,020,140,200,000,123,000,021,220,017,041
.byte 121,042,060,120,140,200,000,123,000,021,160,017,041
.byte 051,126,150,141,060,210,146,066,026,165,026,017,247
.byte 120,000,040,003,160,000,000,140,000,021,100,017,140
.byte 000,000,000,000,200,000,000,000,000,000,000,017,000
.byte 141,023,122,040,160,143,042,142,000,047,143,017,020
.byte 120,000,040,006,140,060,000,141,000,026,100,017,040
.byte 140,000,020,007,100,000,000,140,000,001,140,017,020
.byte 110,125,051,162,120,125,127,104,006,104,000,017,052
.byte 140,000,040,000,160,000,000,140,000,000,060,017,000
.byte 040,005,020,000,040,313,231,030,000,140,000,017,056
.byte 140,000,160,000,200,000,000,140,000,000,000,017,240
.byte 065,042,060,040,000,206,231,146,006,224,220,017,004
.byte 240,000,020,000,140,000,000,220,000,000,200,017,141
.even
+126
View File
@@ -0,0 +1,126 @@
/
/
/ roff5 -- runoff
slow: 1
pto: 9999.
po: 0
ls: 1
ls1: 1
pn: 1
ma1: 2
ma2: 2
ma3: 1
ma4: 3
ll: 65.
llh: 65.
hx: 1
pl: 66.
ad: 1
fi: 1
cc: '.
ohc: 200
hyf: 1
hypedf: 0
obufp: obuf
thresh: 240
tabc: '
tabtab:
.byte 8.,16.,24.,32.,40.,48.,56.,64.,72.,0
suffil:
</usr/lib/suftab\0>
ones:
<ixcm>
fives:
<vld>
ttyx: </dev/tty0\0>
bfn: </tmp/rtma\0>
.even
ofile: -1
nextb: 4
ilistp: ilist
.bss
old: .=.+2
stop: .=.+2
garb: .=.+2
bname:
nextf: .=.+20.
nx: .=.+2
ibf: .=.+2
ibf1: .=.+2
skp: .=.+2
ip: .=.+2
ilist: .=.+8.
iliste: .=.+2
column: .=.+2
ocol: .=.+2
nspace: .=.+2
fac: .=.+2
fmq: .=.+2
nhl: .=.+2
nel: .=.+2
jfomod: .=.+2
wordp: .=.+2
nlflg: .=.+2
/tottext: .=.+2
/totcon: .=.+2
spaceflg: .=.+2
ch: .=.+2
linep: .=.+2
undflg: .=.+2
wordend: .=.+2
maxdig: .=.+2
maxloc: .=.+2
totout: .=.+2
hstart: .=.+2
nhstart: .=.+2
nhyph: .=.+2
argc: .=.+2
argp: .=.+2
ibufp: .=.+2
eibuf: .=.+2
wne: .=.+2
nl: .=.+2
bl: .=.+2
nc: .=.+2
ne: .=.+2
lnumber: .=.+2
numbmod: .=.+2
skip: .=.+2
nwd: .=.+2
ulstate: .=.+2
ulc: .=.+2
bsc: .=.+2
nsp: .=.+2
nn: .=.+2
ro: .=.+2
pfrom: .=.+2
ni: .=.+2
onesp: .=.+2
fivesp: .=.+2
ul: .=.+2
ce: .=.+2
in: .=.+2
un: .=.+2
wch: .=.+2
suff: .=.+2
sufb: .=.+20.
sufbuf: .=.+512.
suftab: .=.+[2*26.]
ifile: .=.+2
char: .=.+2
nfile: .=.+2
ehead: .=.+2
ohead: .=.+2
efoot: .=.+2
ofoot: .=.+2
trtab: .=.+128.
word: .=.+200.
stbuf:
linsiz = 500.
line: .=.+linsiz
end:
+21
View File
@@ -0,0 +1,21 @@
as suftab.s
strip a.out
cmp a.out /usr/lib/suftab
cp a.out /usr/lib/suftab
as roff?.s
ld -s a.out -l
cmp a.out /usr/bin/roff
cp a.out /usr/bin/roff
as nroff[1-5].s roff7.s nroff8.s
ld -s -n a.out
cmp a.out /usr/bin/nroff
cp a.out /usr/bin/nroff
yacc ne.g
cc -s -O -n ne*.c -ly
cmp a.out /usr/bin/neqn
cp a.out /usr/bin/neqn
rm y.tab.c *.o a.out
+561
View File
@@ -0,0 +1,561 @@
/ suftab - suffix table
suftab:
sufa+20
0
sufc+20
sufd+20
sufe+20
suff+20
sufg+20
sufh+20
sufi+20
0
sufk+20
sufl+20
sufm+20
sufn+20
sufo+20
sufp+20
0
sufr+20
sufs+20
suft+20
0
0
0
0
sufy+20
0
sufa:
.byte 2,200+'t /-TA
.byte 2,200+'s /-SA
.byte 3,200+'t,'r /-TRA
.byte 3,200+'d,'r /-DRA
.byte 3,200+'b,'r /-BRA
.byte 2,200+'p /-PA
.byte 2,200+'n /-NA
.byte 2,200+'m /-MA
.byte 3,200+'p,'l /-PLA
.byte 2,200+'l /-LA
.byte 2,200+'k /-KA
.byte 3,200+'t,'h /-THA
.byte 3,200+'s,'h /-SHA
.byte 2,200+'g /-GA
.byte 2,200+'d /-DA
.byte 2,200+'c /-CA
.byte 2,200+'b /-BA
.byte 0
sufc:
.byte 4,'e,'t,200+'i /ET-IC
.byte 7,'a,'l,200+'i,'s,200+'t,'i /AL-IS-TIC
.byte 4,'s,200+'t,'i /S-TIC
.byte 4,'p,200+'t,'i /P-TIC
.byte 5,200+'l,'y,'t,200+'i /-LYT-IC
.byte 4,'o,'t,200+'i /OT-IC
.byte 5,'a,'n,200+'t,'i /AN-TIC
.byte 4,'n,200+'t,'i /N-TIC
.byte 4,'c,200+'t,'i /C-TIC
.byte 4,'a,'t,200+'i /AT-IC
.byte 4,'h,200+'n,'i /H-NIC
.byte 3,'n,200+'i /N-IC
.byte 3,'m,200+'i /M-IC
.byte 4,'l,200+'l,'i /L-LIC
.byte 4,'b,200+'l,'i /B-LIC
.byte 4,200+'c,'l,'i /-CLIC
.byte 3,'l,200+'i /L-IC
.byte 3,'h,200+'i /H-IC
.byte 3,'f,200+'i /F-IC
.byte 3,'d,200+'i /D-IC
.byte 3,200+'b,'i /-BIC
.byte 3,'a,200+'i /A-IC
.byte 3,200+'m,'a /-MAC
.byte 3,'i,200+'a /I-AC
.byte 0
sufd:
.byte 4,200+'w,'o,'r /-WORD
.byte 4,200+'l,'o,'r /-LORD
.byte 4,200+'f,'o,'r /-FORD
.byte 4,200+'y,'a,'r /-YARD
.byte 4,200+'w,'a,'r /-WARD
.byte 5,200+'g,'u,'a,'r /-GUARD
.byte 4,200+'t,'a,'r /-TARD
.byte 5,200+'b,'o,'a,'r /-BOARD
.byte 4,200+'n,'a,'r /-NARD
.byte 5,200+'l,'i,'a,'r /-LIARD
.byte 4,200+'i,'a,'r /-IARD
.byte 4,200+'g,'a,'r /-GARD
.byte 4,200+'b,'a,'r /-BARD
.byte 3,200+'r,'o /-ROD
.byte 4,200+'w,'o,'o /-WOOD
.byte 4,200+'h,'o,'o /-HOOD
.byte 4,200+'m,'o,'n /-MOND
.byte 4,200+'t,'e,'n /-TEND
.byte 5,200+'s,'t,'a,'n /-STAND
.byte 4,200+'l,'a,'n /-LAND
.byte 4,200+'h,'a,'n /-HAND
.byte 4,200+'h,'o,'l /-HOLD
.byte 4,200+'f,'o,'l /-FOLD
.byte 5,200+'f,'i,'e,'l /-FIELD
.byte 3,200+'v,'i /-VID
.byte 3,200+'c,'i /-CID
.byte 4,200+'s,'a,'i /-SAID
.byte 4,200+'m,'a,'i /-MAID
.byte 4,'t,200+'t,'e /T-TED
.byte 3,'t,200+'e /T-ED
.byte 4,200+'d,'r,'e /-DRED
.byte 4,200+'c,'r,'e /-CRED
.byte 4,200+'b,'r,'e /-BRED
.byte 5,'v,200+'e,'l,'e /V-ELED
.byte 100+4,'a,'l,200+'e /AL/ED
.byte 140+3,200+'e,'e //EED
.byte 40+5,'e,'d,200+'d,'e /ED-DED
.byte 4,'d,200+'d,'e /D-DED
.byte 40+4,'e,'d,200+'e /ED-ED
.byte 3,'d,200+'e /D-ED
.byte 5,200+'d,'u,'c,'e /-DUCED
.byte 300+2,'e /E/D
.byte 5,200+'s,'t,'e,'a /-STEAD
.byte 4,200+'h,'e,'a /-HEAD
.byte 0
sufe:
.byte 5,'a,'r,200+'i,'z /AR-IZE
.byte 5,'a,'n,200+'i,'z /AN-IZE
.byte 5,'a,'l,200+'i,'z /AL-IZE
.byte 6,200+'a,'r,'d,200+'i,'z /-ARD-IZE
.byte 5,200+'s,'e,'l,'v /-SELVE
.byte 5,200+'k,'n,'i,'v /-KNIVE
.byte 5,200+'l,'i,'e,'v /-LIEVE
.byte 100+3,200+'q,'u //QUE
.byte 7,'o,'n,200+'t,'i,'n,200+'u /ON-TIN-UE
.byte 3,200+'n,'u /-NUE
.byte 3,200+'d,'u /-DUE
.byte 300+2,'u /U/E
.byte 300+5,'q,'u,'a,'t / QUAT/E
.byte 4,'u,200+'a,'t /U-ATE
.byte 5,200+'s,'t,'a,'t /-STATE
.byte 4,200+'t,'a,'t /-TATE
.byte 6,200+'t,'o,'r,200+'a,'t /-TOR-ATE
.byte 5,'e,'n,200+'a,'t /EN-ATE
.byte 4,200+'m,'a,'t /-MATE
.byte 5,200+'h,'o,'u,'s /-HOUSE
.byte 5,200+'c,'l,'o,'s /-CLOSE
.byte 4,'i,200+'o,'s /I-OSE
.byte 4,200+'w,'i,'s /-WISE
.byte 5,'a,'s,200+'u,'r /AS-URE
.byte 40+4,200+'s,'u,'r /-SURE
.byte 6,200+'f,'i,'g,200+'u,'r /-FIG-URE
.byte 40+3,200+'t,'r /-TRE
.byte 5,200+'s,'t,'o,'r /-STORE
.byte 4,200+'f,'o,'r /-FORE
.byte 5,200+'w,'h,'e,'r /-WHERE
.byte 3,200+'d,'r /-DRE
.byte 3,200+'c,'r /-CRE
.byte 3,200+'b,'r /-BRE
.byte 5,200+'s,'c,'o,'p /-SCOPE
.byte 4,'y,200+'o,'n /Y-ONE
.byte 5,200+'s,'t,'o,'n /-STONE
.byte 5,200+'p,'h,'o,'n /-PHONE
.byte 4,200+'g,'o,'n /-GONE
.byte 4,'e,200+'o,'n /E-ONE
.byte 40+4,200+'e,'n,'n /-ENNE
.byte 40+5,'a,200+'r,'i,'n /A-RINE
.byte 5,200+'c,'l,'i,'n /-CLINE
.byte 4,200+'l,'i,'n /-LINE
.byte 4,200+'s,'o,'m /-SOME
.byte 4,200+'c,'o,'m /-COME
.byte 4,200+'t,'i,'m /-TIME
.byte 3,200+'z,'l /-ZLE
.byte 3,200+'t,'l /-TLE
.byte 3,200+'s,'l /-SLE
.byte 3,200+'p,'l /-PLE
.byte 5,200+'v,'i,'l,'l /-VILLE
.byte 4,'c,'k,200+'l /CK-LE
.byte 3,200+'k,'l /-KLE
.byte 3,200+'g,'l /-GLE
.byte 3,200+'f,'l /-FLE
.byte 3,200+'d,'l /-DLE
.byte 3,200+'c,'l /-CLE
.byte 5,200+'p,'a,200+'b,'l /-PA-BLE
.byte 5,'f,'a,200+'b,'l /FA-BLE
.byte 5,200+'c,'a,200+'b,'l /-CA-BLE
.byte 6,200+'s,'t,'a,'b,'l /-STABLE
.byte 4,200+'a,'b,'l /-ABLE
.byte 3,200+'b,'l /-BLE
.byte 4,200+'d,'a,'l /-DALE
.byte 4,200+'m,'a,'l /-MALE
.byte 4,200+'s,'a,'l /-SALE
.byte 4,200+'l,'i,'k /-LIKE
.byte 340+5,'g,200+'u,'a,'g /-G/UAGE
.byte 5,200+'r,'i,'a,'g /-RIAGE
.byte 5,'e,'r,200+'a,'g /ER-AGE
.byte 4,'m,200+'a,'g /M-AGE
.byte 4,'k,200+'a,'g /K-AGE
.byte 4,'d,200+'a,'g /D-AGE
.byte 4,200+'w,'i,'f /-WIFE
.byte 5,200+'k,'n,'i,'f /-KNYFE
.byte 3,200+'s,'e /-SEE
.byte 4,200+'f,'r,'e /-FREE
.byte 340+2,'e /EE
.byte 4,200+'w,'i,'d /-WIDE
.byte 4,200+'t,'i,'d /-TIDE
.byte 4,200+'s,'i,'d /-SIDE
.byte 6,200+'q,'u,'e,'n,'c /-QUENCE
.byte 7,200+'f,'l,'u,200+'e,'n,'c /-FLU-ENCE
.byte 40+6,'e,'s,200+'e,'n,'c /ES-ENCE
.byte 6,'e,'r,200+'e,'n,'c /ER-ENCE
.byte 5,'i,200+'e,'n,'c /I-ENCE
.byte 40+5,200+'s,'a,'n,'c /-SANCE
.byte 6,'e,'r,200+'a,'n,'c /ER-ANCE
.byte 6,'a,'r,200+'a,'n,'c /AR-ANCE
.byte 5,200+'n,'a,'n,'c /-NANCE
.byte 7,200+'b,'a,'l,200+'a,'n,'c /-BAL-ANCE
.byte 5,'i,200+'a,'n,'c /I-ANCE
.byte 7,200+'j,'u,'s,200+'t,'i,'c /-JUS-TICE
.byte 5,200+'s,'t,'i,'c /-STICE
.byte 5,200+'p,'i,'e,'c /-PIECE
.byte 5,200+'p,'l,'a,'c /-PLACE
.byte 340+1 //E
.byte 0
suff:
.byte 5,200+'p,'r,'o,'o /-PROOF
.byte 4,200+'s,'e,'l /-SELF
.byte 3,200+'r,'i /-RIF
.byte 40+4,200+'l,'i,'e /-LIEF
.byte 0
sufg:
.byte 3,200+'l,'o /-LOG
.byte 4,200+'l,'o,'n /-LONG
.byte 5,'t,200+'t,'i,'n /T-TING
.byte 6,200+'s,'t,'r,'i,'n / -STRING
.byte 5,'r,200+'r,'i,'n /R-RING
.byte 5,'p,200+'p,'i,'n /P-PING
.byte 5,'n,200+'n,'i,'n /N-NING
.byte 5,'m,200+'m,'i,'n /M-MING
.byte 5,'l,200+'l,'i,'n / L-LING
.byte 5,200+'z,'l,'i,'n /-ZLING
.byte 5,200+'t,'l,'i,'n /-TLING
.byte 40+5,'s,200+'l,'i,'n /S-LING
.byte 5,'r,200+'l,'i,'n /R-LING
.byte 5,200+'p,'l,'i,'n /-PLING
.byte 6,'n,200+'k,'l,'i,'n /N-KLING
.byte 5,'k,200+'l,'i,'n /K-LING
.byte 5,200+'g,'l,'i,'n /-GLING
.byte 5,200+'f,'l,'i,'n /-FLING
.byte 5,200+'d,'l,'i,'n /-DLING
.byte 5,200+'c,'l,'i,'n /-CLING
.byte 5,200+'b,'l,'i,'n /-BLING
.byte 6,'y,200+'t,'h,'i,'n /Y-THING
.byte 7,'e,'e,'t,'h,200+'i,'n /EETH-ING
.byte 6,'e,200+'t,'h,'i,'n /E-THING
.byte 5,'g,200+'g,'i,'n /G-GING
.byte 5,'d,200+'d,'i,'n /D-DING
.byte 5,'b,200+'b,'i,'n /B-BING
.byte 3,200+'i,'n /-ING
.byte 0
sufh:
.byte 5,200+'m,'o,'u,'t /-MOUTH
.byte 5,200+'w,'o,'r,'t /-WORTH
.byte 4,200+'w,'i,'t /-WITH
.byte 5,'t,200+'t,'i,'s /T-TISH
.byte 5,'e,200+'t,'i,'s /E-TISH
.byte 5,'p,200+'p,'i,'s /P-PISH
.byte 5,'r,200+'n,'i,'s /R-NISH
.byte 5,'n,200+'n,'i,'s /N-NISH
.byte 5,200+'p,'l,'i,'s /-PLISH
.byte 5,200+'g,'u,'i,'s / -GUISH
.byte 5,200+'g,'l,'i,'s / -GLISH
.byte 5,'b,200+'l,'i,'s / B-LISH
.byte 5,'g,200+'g,'i,'s /G-GISH
.byte 5,'d,200+'d,'i,'s /D-DISH
.byte 3,200+'i,'s /-ISH
.byte 5,200+'g,'r,'a,'p /-GRAPH
.byte 7,200+'b,'o,'r,200+'o,'u,'g /-BOR-OUGH
.byte 5,200+'b,'u,'r,'g /-BURGH
.byte 4,200+'v,'i,'c /-VICH
.byte 3,200+'n,'a /-NAH
.byte 3,200+'l,'a /-LAH
.byte 4,200+'m,'i,200+'a /-MI-AH
.byte 0
sufi:
.byte 3,200+'t,'r /-TRI
.byte 3,200+'c,'h /-CHI
.byte 200+3,'i,'f /IF-I
.byte 200+3,'e,'d /ED-I
.byte 5,200+'a,'s,'c,'i /-ASCII
.byte 0
sufk:
.byte 4,200+'w,'o,'r /-WORK
.byte 4,200+'m,'a,'r /-MARK
.byte 4,200+'b,'o,'o /-BOOK
.byte 4,200+'w,'a,'l /-WALK
.byte 5,200+'c,'r,'a,'c /-CRACK
.byte 4,200+'b,'a,'c /-BACK
.byte 0
sufl:
.byte 3,200+'f,'u /-FUL
.byte 5,'s,200+'w,'e,'l /S-WELL
.byte 4,200+'t,'e,'l /-TELL
.byte 5,200+'s,'h,'e,'l /-SHELL
.byte 5,200+'s,'t,'a,'l /-STALL
.byte 4,200+'s,'t,'a /-STAL
.byte 4,200+'b,'a,'l /-BALL
.byte 3,'v,200+'e /V-EL
.byte 3,'u,200+'e /U-EL
.byte 3,'k,200+'e /K-EL
.byte 4,'t,'h,200+'e /TH-EL
.byte 5,'t,'c,'h,200+'e /TCH-EL
.byte 3,'a,200+'e /A-EL
.byte 140+4,200+'q,'u,'a //QUAL
.byte 40+3,'u,200+'a /U-AL
.byte 3,200+'t,'a /-TAL
.byte 4,'u,'r,200+'a /UR-AL
.byte 40+5,'g,200+'o,200+'n,'a /G-O-NAL
.byte 4,'o,'n,200+'a /ON-AL
.byte 3,200+'n,'a /-NAL
.byte 4,200+'t,'i,'a /-TIAL
.byte 4,200+'s,'i,'a /-SIAL
.byte 40+5,200+'t,'r,'i,200+'a /-TRI-AL
.byte 4,'r,'i,200+'a /RI-AL
.byte 4,200+'n,'i,200+'a /-NI-AL
.byte 4,200+'d,'i,200+'a /-DI-AL
.byte 4,200+'c,'i,'a /-CIAL
.byte 3,200+'g,'a /-GAL
.byte 4,200+'m,'e,'a /-MEAL
/.byte 40+4,200+'r,'e,200+'a /-RE-AL
.byte 40+4,200+'r,'e,'a /-REAL
.byte 6,'c,200+'t,'i,200+'c,'a /C-TI-CAL
.byte 5,200+'s,'i,200+'c,'a /-SI-CAL
.byte 4,200+'i,200+'c,'a /-I-CAL
.byte 3,200+'c,'a /-CAL
.byte 3,200+'b,'a /-BAL
.byte 6,200+'n,'o,200+'m,'i,200+'a /-NO-MI-AL
.byte 0
sufm:
.byte 3,200+'n,'u /-NUM
.byte 5,'o,200+'r,'i,200+'u /O-RI-UM
.byte 40+3,'i,200+'u /I-UM
.byte 40+3,'e,200+'u /E-UM
.byte 5,'i,'v,200+'i,'s /IV-ISM
.byte 4,200+'t,'i,'s /-TISM
.byte 5,'i,200+'m,'i,'s /I-MISM
.byte 5,'a,'l,200+'i,'s /AL-ISM
.byte 40+4,'e,200+'i,'s /E-ISM
.byte 40+4,'a,200+'i,'s /A-ISM
.byte 4,200+'r,'o,'o /-ROOM
.byte 3,200+'d,'o /-DOM
.byte 3,200+'h,'a /-HAM
.byte 6,200+'a,200+'r,'i,'t,'h /-A-RITHM
.byte 5,200+'r,'i,'t,'h /-RITHM
.byte 0
sufn:
.byte 4,200+'t,'o,'w /-TOWN
.byte 4,200+'d,'o,'w /-DOWN
.byte 4,200+'t,'u,'r /-TURN
.byte 5,200+'s,'p,'o,'o /-SPOON
.byte 4,200+'n,'o,'o /-NOON
.byte 4,200+'m,'o,'o /-MOON
.byte 11,'a,'l,200+'i,200+'z,'a,200+'t,'i,'o /AL-I-ZA-TION
.byte 7,200+'i,200+'z,'a,200+'t,'i,'o /-I-ZA-TION
.byte 7,'l,200+'i,200+'a,200+'t,'i,'o /L-I-A-TION
.byte 4,200+'t,'i,'o /-TION
.byte 40+5,'s,200+'s,'i,'o /S-SION
.byte 4,200+'s,'i,'o /-SION
.byte 4,'n,200+'i,'o /N-ION
.byte 4,200+'g,'i,'o /-GION
.byte 4,200+'c,'i,'o /-CION
.byte 3,200+'c,'o /-CON
.byte 3,200+'t,'o /-TON
.byte 3,200+'s,'o /-SON
.byte 3,200+'r,'i /-RIN
.byte 3,200+'p,'i /-PIN
.byte 3,200+'n,'i /-NIN
.byte 3,200+'m,'i /-MIN
.byte 3,200+'l,'i /-LIN
.byte 3,200+'k,'i /-KIN
.byte 5,200+'s,'t,'e,'i /-STEIN
.byte 4,200+'t,'a,'i /-TAIN
.byte 5,'g,'h,'t,200+'e /GHT-EN
.byte 5,200+'w,'o,'m,200+'e /-WOM-EN
.byte 3,200+'m,'e /-MEN
.byte 4,'o,200+'k,'e /O-KEN
.byte 3,'k,200+'e /K-EN
.byte 4,200+'t,'e,'e /-TEEN
.byte 4,200+'s,'e,'e /-SEEN
.byte 40+3,200+'s,'a /-SAN
.byte 5,200+'w,'o,'m,200+'a /-WOM-AN
.byte 3,200+'m,'a /-MAN
.byte 4,200+'t,'i,'a /-TIAN
.byte 4,200+'s,'i,'a /-SIAN
.byte 40+4,'e,200+'i,'a /E-IAN
.byte 4,200+'c,'i,'a /-CIAN
.byte 300+3,'i,'a /IA/N
.byte 5,200+'c,'l,'e,'a /-CLEAN
.byte 4,200+'m,'e,'a /-MEAN
.byte 40+3,'e,200+'a /E-AN
.byte 0
sufo:
.byte 5,200+'m,'a,'c,200+'r /-MAC-RO
.byte 0
sufp:
.byte 5,200+'g,'r,'o,'u /-GROUP
.byte 2,200+'u /-UP
.byte 4,200+'s,'h,'i /-SHIP
.byte 4,200+'k,'e,'e /-KEEP
.byte 0
sufr:
.byte 4,200+'z,'a,'r /-ZARR
.byte 300+2,'r /R/R
.byte 3,200+'t,'o /-TOR
.byte 40+3,200+'s,'o /-SOR
.byte 40+4,200+'r,'i,200+'o /-RI-OR
.byte 4,'i,'z,200+'e /IZ-ER
.byte 5,200+'c,'o,'v,200+'e /-COV-ER
.byte 4,'o,200+'v,'e /O-VER
.byte 4,200+'e,'v,200+'e /-EV-ER
.byte 8.,200+'c,'o,'m,200+'p,'u,'t,200+'e /-COM-PUT-ER
.byte 40+5,'u,'s,200+'t,'e /US-TER
.byte 5,'o,'s,'t,200+'e /OST-ER
.byte 40+5,200+'a,'c,200+'t,'e /-AC-TER
.byte 6,200+'w,'r,'i,'t,200+'e /-WRIT-ER
.byte 40+5,'i,'s,200+'t,'e /IS-TER
.byte 40+5,'e,'s,200+'t,'e /ES-TER
.byte 40+5,'a,'s,200+'t,'e /AS-TER
.byte 4,200+'s,'t,'e /-STER
.byte 5,'a,'r,200+'t,'e /AR-TER
.byte 4,'r,'t,200+'e /RT-ER
.byte 40+5,'m,200+'e,200+'t,'e /M-E-TER
.byte 5,200+'w,'a,200+'t,'e /-WA-TER
.byte 3,'r,200+'e /R-ER
.byte 4,'o,'p,200+'e /OP-ER
.byte 5,200+'p,'a,200+'p,'e /-PA-PER
.byte 4,'w,'n,200+'e /WN-ER
.byte 40+4,'s,200+'n,'e /S-NER
.byte 4,'o,'n,200+'e /ON-ER
.byte 4,'r,'m,200+'e /RM-ER
.byte 3,200+'m,'e /-MER
.byte 4,'l,'l,200+'e /LL-ER
.byte 5,'d,200+'d,'l,'e /D-DLER
.byte 4,200+'b,'l,'e /-BLER
.byte 3,'k,200+'e /K-ER
.byte 5,'n,200+'t,'h,'e /N-THER
.byte 6,200+'f,'a,200+'t,'h,'e /-FA-THER
.byte 6,'e,'i,200+'t,'h,'e /EI-THER
.byte 4,'t,'h,200+'e /TH-ER
.byte 4,'s,'h,200+'e /SH-ER
.byte 4,200+'p,'h,'e /-PHER
.byte 4,'c,'h,200+'e /CH-ER
.byte 4,'d,'g,200+'e /DG-ER
.byte 4,'r,'d,200+'e /RD-ER
.byte 6,'o,'u,'n,'d,200+'e /OUND-ER
.byte 4,'l,'d,200+'e /LD-ER
.byte 4,'i,'d,200+'e /ID-ER
.byte 5,200+'d,'u,'c,200+'e /-DUC-ER
.byte 4,'n,'c,200+'e /NC-ER
.byte 100+2, 200+'e / /ER
.byte 3,200+'s,'a /-SAR
.byte 40+6,'a,'c,200+'u,200+'l,'a /AC-U-LAR
.byte 40+6,'e,'c,200+'u,200+'l,'a /EC-U-LAR
.byte 40+6,'i,'c,200+'u,200+'l,'a /IC-U-LAR
.byte 40+6,'e,'g,200+'u,200+'l,'a /EG-U-LAR
.byte 0
sufs:
.byte 40+4,'u,200+'o,'u /U-OUS
.byte 5,200+'t,'i,'o,'u /-TIOUS
.byte 5,200+'g,'i,'o,'u /-GIOUS
.byte 5,200+'c,'i,'o,'u /-CIOUS
.byte 40+4,'i,200+'o,'u /I-OUS
.byte 5,200+'g,'e,'o,'u /-GEOUS
.byte 5,200+'c,'e,'o,'u /-CEOUS
.byte 4,'e,200+'o,'u /E-OUS
.byte 140+2,200+'u //US
.byte 4,200+'n,'e,'s /-NESS
.byte 4,200+'l,'e,'s /-LESS
.byte 140+2,200+'s //SS
.byte 40+5,'p,200+'o,200+'l,'i /P-O-LIS
.byte 140+2,200+'i //IS
.byte 100+3,200+'x,'e /X/ES
.byte 100+3,200+'s,'e /S/ES
.byte 100+4,'s,'h,200+'e /SH/ES
.byte 100+4,'c,'h,200+'e /CH/ES
.byte 300+1 //S
.byte 0
suft:
.byte 6,'i,'o,'n,200+'i,'s /ION-IST
.byte 5,'i,'n,200+'i,'s /IN-IST
.byte 5,'a,'l,200+'i,'s /AL-IST
.byte 6,'l,200+'o,200+'g,'i,'s /L-O-GIST
.byte 5,'h,'t,200+'e,'s /HT-EST
.byte 4,'i,200+'e,'s /I-EST
.byte 5,'g,200+'g,'e,'s /G-GEST
.byte 4,'g,200+'e,'s /G-EST
.byte 5,'d,200+'d,'e,'s /D-DEST
.byte 4,'d,200+'e,'s /D-EST
.byte 4,200+'c,'a,'s /-CAST
.byte 5,200+'h,'e,'a,'r /-HEART
.byte 4,200+'f,'o,'o /-FOOT
.byte 3,'i,200+'o /I-OT
.byte 5,200+'f,'r,'o,'n /-FRONT
.byte 5,200+'p,'r,'i,'n /-PRINT
.byte 4,200+'m,'e,'n /-MENT
.byte 5,200+'c,'i,'e,'n /-CIENT
.byte 4,'i,200+'a,'n /I-ANT
.byte 6,200+'w,'r,'i,'g,'h /-WRIGHT
.byte 6,200+'b,'r,'i,'g,'h /-BRIGHT
.byte 6,200+'f,'l,'i,'g,'h /-FLIGHT
.byte 6,200+'w,'e,'i,'g,'h /-WEIGHT
.byte 5,200+'s,'h,'i,'f /-SHIFT
.byte 5,200+'c,'r,'a,'f /-CRAFT
.byte 40+4,'d,'g,200+'e /DG-ET
.byte 4,200+'g,'o,'a /-GOAT
.byte 4,200+'c,'o,'a /-COAT
.byte 4,200+'b,'o,'a /-BOAT
.byte 4,200+'w,'h,'a /-WHAT
.byte 4,200+'c,'u,'i /-CUIT
.byte 0
sufy:
.byte 40+4,'e,'s,200+'t /ES-TY
.byte 40+5,'q,'u,'i,200+'t /QUI-TY
.byte 4,200+'t,'i,200+'t /-TI-TY
.byte 40+5,'o,'s,200+'i,200+'t /OS-I-TY
.byte 4,200+'s,'i,200+'t /-SI-TY
.byte 5,'i,'n,200+'i,200+'t /IN-I-TY
.byte 4,'n,'i,200+'t /NI-TY
.byte 40+10,'f,'a,200+'b,'i,'l,200+'i,200+'t /FA-BIL-I-TY
.byte 10,200+'c,'a,200+'b,'i,'l,200+'i,200+'t /-CA-BIL-I-TY
.byte 10,200+'p,'a,200+'b,'i,'l,200+'i,200+'t /-PA-BIL-I-TY
.byte 6,200+'b,'i,'l,200+'i,200+'t /-BIL-I-TY
.byte 3,'i,200+'t /I-TY
.byte 4,200+'b,'u,'r /-BUR-Y
.byte 4,200+'t,'o,200+'r /-TO-RY
.byte 5,200+'q,'u,'a,'r /-QUAR-Y
.byte 40+4,'u,200+'a,'r /U-ARY
.byte 7,200+'m,'e,'n,200+'t,'a,200+'r /-MEN-TA-RY
.byte 6,'i,'o,'n,200+'a,'r /ION-ARY
.byte 4,'i,200+'a,'r /I-ARY
.byte 4,'n,200+'o,200+'m /N-O-MY
.byte 3,200+'p,'l /-PLY
.byte 4,'g,200+'g,'l /G-GLY
.byte 5,200+'p,'a,200+'b,'l /-PA-BLY
.byte 5,'f,'a,200+'b,'l /FA-BLY
.byte 5,200+'c,'a,200+'b,'l /-CA-BLY
.byte 4,200+'a,'b,'l /-ABLY
.byte 3,200+'b,'l /-BLY
.byte 2,200+'l /-LY
.byte 3,200+'s,'k /-SKY
.byte 40+6,'g,200+'r,'a,200+'p,'h /G-RA-PHY
.byte 4,'l,200+'o,200+'g /L-O-GY
.byte 2,200+'f /-FY
.byte 3,200+'n,'e /-NEY
.byte 3,200+'l,'e /-LEY
.byte 4,'c,'k,200+'e /CK-EY
.byte 3,200+'k,'e /-KEY
.byte 4,200+'b,'o,'d /-BODY
.byte 5,200+'s,'t,'u,'d /-STUDY
.byte 340+4,'e,'e,'d /EEDY
.byte 2,200+'b /-BY
.byte 3,200+'w,'a /-WAY
.byte 3,200+'d,'a /-DAY
.byte 0
.even