static char sccsid
[] = "@(#)langpats.c 1.4 (Berkeley) %G%";
* In-line assembly code expander for
* the kernel. This code is based on
* pc2 and the old asm.sed script.
* The hash table must be at least twice as big as the number
* of patterns, preferably bigger. It must also be a prime number
" movc3 8(sp),*(sp),*4(sp)\n\
" movc3 8(sp),*(sp),*4(sp)\n\
" movc5 $0,(r0),$0,4(sp),*(sp)\n\
" cmpc3 8(sp),*(sp),*4(sp)\n\
movc5 $0,(r3),$0,r0,(r3)\n\
movc5 $0,(r3),$0,r0,(r3)\n" },
scanc r0,(r1),(r2),r3\n" },
" insque *(sp)+,*(sp)+\n" },
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
, **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 (strncmp(cp
, CALLS
, sizeof (CALLS
) - 1) != 0) {
for (cp
+= sizeof (CALLS
) - 1; *cp
&& *cp
!= ','; cp
++)
if (strncmp((*hp
)->name
, cp
, size
) == NULL
) {
fputs((*hp
)->replace
, stdout
);