diff options
Diffstat (limited to 'do/trans')
-rw-r--r-- | do/trans | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/do/trans b/do/trans deleted file mode 100644 index f4c5503b43..0000000000 --- a/do/trans +++ /dev/null @@ -1,58 +0,0 @@ -int -do_trans(TARG,arg) -STR *TARG; -ARG *arg; -{ - register short *tbl; - register char *s; - register int matches = 0; - register int ch; - register char *send; - register char *d; - register int squash = arg[2].arg_len & 1; - - tbl = (short*) arg[2].arg_ptr.arg_cval; - s = str_get(TARG); - send = s + TARG->str_cur; - if (!tbl || !s) - fatal("panic: do_trans"); -#ifdef DEBUGGING - if (debug & 8) { - deb("2.TBL\n"); - } -#endif - if (!arg[2].arg_len) { - while (s < send) { - if ((ch = tbl[*s & 0377]) >= 0) { - matches++; - *s = ch; - } - s++; - } - } - else { - d = s; - while (s < send) { - if ((ch = tbl[*s & 0377]) >= 0) { - *d = ch; - if (matches++ && squash) { - if (d[-1] == *d) - matches--; - else - d++; - } - else - d++; - } - else if (ch == -1) /* -1 is unmapped character */ - *d++ = *s; /* -2 is delete character */ - s++; - } - matches += send - d; /* account for disappeared chars */ - *d = '\0'; - TARG->str_cur = d - TARG->str_ptr; - } - STABSET(TARG); - return matches; -} - |