/usr/share/tf5/tf-lib/tr.tf is in tf5 5.0beta8-5+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ;;;; Character translation
;;; usage: /tr <domain> <range> <string>
;;; <domain> and <range> are lists of charcters. Each character in <string>
;;; that appears in <domain> will be translated to the corresponding
;;; character in <range>.
;;; Example:
;;; command: /def biff = /tr OIS. 01Z! $[toupper({*})]
;;; command: /biff TinyFugue is cool wares, dude.
;;; output: T1NYFUGUE 1Z C00L WAREZ, DUDE!
/loaded __TFLIB__/tr.tf
/def -i tr = \
/let _old=%;\
/let _new=%;\
/let _tail=%;\
/test _old:={1}%;\
/test _new:={2}%;\
/test _tail:={-2}%;\
/let _dest=%;\
/while /let _i=$[strchr(_tail, _old)]%; /@test _i >= 0%; /do \
/let _j=$[strchr(_old, substr(_tail, _i, 1))]%;\
/test _dest:=strcat(_dest, substr(_tail,0,_i), substr(_new, _j, 1))%;\
/test _tail:=substr(_tail,_i+1)%;\
/done%;\
/result strcat(_dest, _tail)
|