aboutsummaryrefslogtreecommitdiff
path: root/unix/boot/spp/rpp/ratlibr/mntoc.r
diff options
context:
space:
mode:
Diffstat (limited to 'unix/boot/spp/rpp/ratlibr/mntoc.r')
-rw-r--r--unix/boot/spp/rpp/ratlibr/mntoc.r74
1 files changed, 74 insertions, 0 deletions
diff --git a/unix/boot/spp/rpp/ratlibr/mntoc.r b/unix/boot/spp/rpp/ratlibr/mntoc.r
new file mode 100644
index 00000000..55d3fedd
--- /dev/null
+++ b/unix/boot/spp/rpp/ratlibr/mntoc.r
@@ -0,0 +1,74 @@
+include defs
+
+# mntoc --- translate ASCII mnemonic into a character
+
+ character function mntoc (buf, p, defalt)
+ character buf (ARB), defalt
+ integer p
+
+ integer i, tp
+ integer equal
+
+ character c, tmp (MAXLINE)
+
+ character text (170)
+ data text / _
+ ACK, LETA, LETC, LETK, EOS,
+ BEL, LETB, LETE, LETL, EOS,
+ BS, LETB, LETS, EOS, EOS,
+ CAN, LETC, LETA, LETN, EOS,
+ CR, LETC, LETR, EOS, EOS,
+ DC1, LETD, LETC, DIG1, EOS,
+ DC2, LETD, LETC, DIG2, EOS,
+ DC3, LETD, LETC, DIG3, EOS,
+ DC4, LETD, LETC, DIG4, EOS,
+ DEL, LETD, LETE, LETL, EOS,
+ DLE, LETD, LETL, LETE, EOS,
+ EM, LETE, LETM, EOS, EOS,
+ ENQ, LETE, LETN, LETQ, EOS,
+ EOT, LETE, LETO, LETT, EOS,
+ ESC, LETE, LETS, LETC, EOS,
+ ETB, LETE, LETT, LETB, EOS,
+ ETX, LETE, LETT, LETX, EOS,
+ FF, LETF, LETF, EOS, EOS,
+ FS, LETF, LETS, EOS, EOS,
+ GS, LETG, LETS, EOS, EOS,
+ HT, LETH, LETT, EOS, EOS,
+ LF, LETL, LETF, EOS, EOS,
+ NAK, LETN, LETA, LETK, EOS,
+ NUL, LETN, LETU, LETL, EOS,
+ RS, LETR, LETS, EOS, EOS,
+ SI, LETS, LETI, EOS, EOS,
+ SO, LETS, LETO, EOS, EOS,
+ SOH, LETS, LETO, LETH, EOS,
+ SP, LETS, LETP, EOS, EOS,
+ STX, LETS, LETT, LETX, EOS,
+ SUB, LETS, LETU, LETB, EOS,
+ SYN, LETS, LETY, LETN, EOS,
+ US, LETU, LETS, EOS, EOS,
+ VT, LETV, LETT, EOS, EOS/
+
+ tp = 1
+ repeat {
+ tmp (tp) = buf (p)
+ tp = tp + 1
+ p = p + 1
+ } until (! (IS_LETTER(buf (p)) | IS_DIGIT(buf (p)))
+ | tp >= MAXLINE)
+ tmp (tp) = EOS
+
+ if (tp == 2)
+ c = tmp (1)
+ else {
+ call lower (tmp)
+ for (i = 1; i < 170; i = i + 5) # should use binary search here
+ if (equal (tmp, text (i + 1)) == YES)
+ break
+ if (i < 170)
+ c = text (i)
+ else
+ c = defalt
+ }
+
+ return (c)
+ end