/* Copyright (c) 1979 Regents of the University of California */
static char sccsid
[] = "@(#)langpats.c 1.13 %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
#define CALLTEMPLATE "calls\t$"
#define CALLTEMPLATE "jbsr\t"
* VAX special instructions
movc5 $0,(r3),$0,r0,(r3)\n\
movc5 $0,(r3),$0,r0,(r3)\n" },
* General Pascal library routines
movc3 4(r0),__disply+8,*(sp)+\n\
movc3 4(r0),8(r0),__disply+8\n" },
movc3 4(r0),*(sp)+,__disply+8\n" },
movc3 4(r0),__disply+8,8(r0)\n\
* Pascal relational comparisons
bisl3 (r1)+,(r2)+,(r3)+\n\
bicl3 (r2)+,(r1)+,(r3)+\n\
emul __seed,$1103515245,$0,r0\n\
ediv $0x7fffffff,r0,r1,r0\n\
divd2 $0d2.147483647e+09,r0\n" },
* General Pascal library routines
struct pats
*htbl
[HSHSIZ
];
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 char *cp
, *ccp
, *lp
;
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
= (lp
!= NULL
) ? ++lp
: line
; *cp
== '\t'; )
if (strcmpn(cp
, CALLTEMPLATE
, TEMPLATESIZE
) != 0) {
if (strcmpn((*hp
)->name
, cp
, size
)==NULL
) {
fputs((*hp
)->replace
, stdout
);