-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathcmd-lsedit.muf
101 lines (95 loc) · 2.49 KB
/
cmd-lsedit.muf
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
@program cmd-lsedit
1 99999 d
1 i
$version 1.4
$include $lib/editor
$include $lib/lmgr
$def LMGRgetcount lmgr-getcount
$def LMGRgetrange lmgr-getrange
$def LMGRputrange lmgr-putrange
$def LMGRdeleterange lmgr-deleterange
: LMGRdeletelist
over over LMGRgetcount
1 4 rotate 4 rotate LMGRdeleterange
;
: LMGRgetlist
over over LMGRgetcount
rot rot 1 rot rot
LMGRgetrange
;
: lsedit-loop ( listname dbref {rng} mask currline cmdstr -- )
EDITORloop
dup "save" stringcmp not if
pop pop pop pop
3 pick 3 + -1 * rotate
over 3 + -1 * rotate
dup 5 + pick over 5 + pick
over over LMGRdeletelist
1 rot rot LMGRputrange
4 pick 4 pick LMGRgetlist
dup 3 + rotate over 3 + rotate
"< List saved. >" tell
"" lsedit-loop exit
then
dup "abort" stringcmp not if
"< list not saved. >" tell
pop pop pop pop pop pop pop pop pop exit
then
dup "end" stringcmp not if
pop pop pop pop pop pop
dup 3 + rotate over 3 + rotate
over over LMGRdeletelist
1 rot rot LMGRputrange
"< list saved. >" tell exit
then
;
: cmd-lsedit
"me" match me !
"=" split strip
dup not if
"You must specify a listname. Syntax: lsedit <obj>=<list>" tell
pop pop exit
then
"/" swap strcat
begin dup "//" instr while "/" "//" subst repeat
dup "/@" instr
over "/~" instr or
me @ "wizard" flag? not and if
"Permission denied." tell
pop pop exit
then
swap strip
dup not if
"You must specify an object. Syntax: lsedit <obj>=<list>" tell
pop pop exit
then
match dup not if pop
"I don't know what object you mean. Syntax: lsedit <obj>=<list>" tell
pop exit
else dup #-2 dbcmp if pop
"I don't know which one you mean. Syntax: lsedit <obj>=<list>" tell
pop exit
then then
me @ over owner dbcmp not
me @ "w" flag? not and if
pop pop "Permission denied." tell exit
then
"< Welcome to the list editor. You can get help by entering '.h' >"
tell
"< '.end' will exit and save the list. '.abort' will abort any changes. >"
tell
"< To save changes to the list, and continue editing, use '.save' >"
tell
read_wants_blanks
over over LMGRgetlist
"save" 1 ".i $" lsedit-loop
;
.
c
q
@register #me cmd-lsedit=tmp/prog1
@set $tmp/prog1=3
@set $tmp/prog1=V
@action lsedit;lsedi;lsed;lse=#0=tmp/exit1
@link $tmp/exit1=$tmp/prog1
@register #me =tmp