/* Copyright (c) 1979 Regents of the University of California */
static char sccsid
[] = "@(#)langpats.c 1.2 %G%";
* The hash table must be at least twice as big as the number
* of patterns, preferably bigger. It must also be a prime number
movc5 $0,(r1),$0,r0,(r3)\n\
movc5 $0,(r1),$0,r0,(r3)\n" },
movc3 r1,__disply+8,8(r0)[r1]\n\
movc3 r1,8(r0),__disply+8\n\
movc3 r1,8(r0)[r1],__disply+8\n\
movc3 r1,__disply+8,8(r0)\n\
bisl3 (r1)+,(r2)+,(r3)+\n\
bicl3 (r2)+,(r1)+,(r3)+\n\
struct pats
*htbl
[HSHSIZ
];
#define CHK(c) if (*cp++ != c) goto copy;
hash = 0; rehash = 1; ccp = cp; \
} while (*ccp && *ccp != '\n'); \
hash >>= 7; hash %= HSHSIZ; hp = &htbl[hash]; size = ccp - cp + 1; \
hp += rehash; rehash += 2; \
if (hp >= &htbl[HSHSIZ]) \
register struct pats
*pp
;
register struct pats
**hp
;
register int hash
, rehash
, size
;
freopen(argv
[1], "r", stdin
);
freopen(argv
[2], "w", stdout
);
for(pp
= ptab
; pp
< &ptab
[sizeof ptab
/sizeof ptab
[0]]; pp
++) {
* check each line and replace as appropriate
while (fgets(line
, BUFSIZ
, stdin
)) {
for (cp
= line
; *cp
&& *cp
== '\t'; )
CHK('c'); CHK('a'); CHK('l'); CHK('l'); CHK('s'); CHK('\t');
CHK('$'); if (!isdigit(*cp
++)) goto copy
; CHK(','); CHK('_');
if (RELEQ(size
, (*hp
)->name
, cp
)) {
fputs((*hp
)->replace
, stdout
);