-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathchr.mud
43 lines (39 loc) · 1.11 KB
/
chr.mud
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<SETG LENTAB <IVECTOR 4 0>>
<SETG TBL <IVECTOR 26 0>>
<SETG LINE <ISTRING 100>>
<DEFINE CNTLIN (C "AUX" STR L)
<PROG ()
<READSTRING ,LINE .C <STRING <ASCII 13>> '<RETURN <>>>
<READCHR .C>
<READCHR .C>
<SET L <REST <MEMQ !\, ,LINE>>>
<SET STR <PARSE .L>>
<MAPF <>
<FUNCTION (CHR "AUX" OFF)
<SET OFF <- <ASCII .CHR> 96>>
<PUT ,TBL .OFF <+ <NTH ,TBL .OFF> 1>>>
.STR>>>
<DEFINE WRDLIN (C "AUX" STR L)
<PROG ()
<READSTRING ,LINE .C <STRING <ASCII 13>> '<RETURN <>>>
<READCHR .C>
<READCHR .C>
<SET L <REST <MEMQ !\, ,LINE>>>
<SET STR <PARSE .L>>
<SET LEN </ <+ 4
<MAPF ,+
<FUNCTION (CHR)
<COND (<MEMQ .CHR ,BAD> 2)
(T 1)>>
.STR>> 4>>
<PUT ,LENTAB .LEN <+ <NTH ,LENTAB .LEN> 1>>>>
<DEFINE WRDFILE (NAM "AUX" C)
<COND (<SET C <OPEN "READ" .NAM>>
<REPEAT ()
<COND (<NOT <WRDLIN .C>> <RETURN>)>>
<CLOSE .C>)>>
<DEFINE CNTFILE (NAM "AUX" C)
<COND (<SET C <OPEN "READ" .NAM>>
<REPEAT ()
<COND (<NOT <CNTLIN .C>> <RETURN>)>>
<CLOSE .C>)>>