Appendix 10: JED Sourcecode and Manual

@create jed
@lock jed=*Jim
@Desc jed=%rOh Boy! Handy Instructions:%r%r"jap.............add paragraph.%r"jip <n>.........insert paragraph at position n.%r"jdp <n>.........delete paragraph n.%r"jcp <s> <d>.....copy paragraph s to positon d.%r"jed <n>.........edit paragraph n.%r"jlt.............list complete text%r"jlp.............list text with paragraph numbers.%r"jswitch <v>.....switch jed on or off.
&LISTENER jed=#*:&data[get(me/%n)] me = [v(0)];&lock[get(me/%n)] me= ;&%n me=
&RESET1 jed=^*"jreset":@tr me/resetloop;&lookup me =;&%n me =;&para_counter me=
&RESETLOOP jed=@switch gte([get(me/data_counter)],1)=1,{&data[get(me/data_counter)] me = ;&lock[get(me/data_counter)] me =; &data_counter me =[sub([get(me/data_counter)],1)];@tr me/resetloop},:is reset.
&DATA_COUNTER jed=0
&SWITCH jed=^*"jswitch *":@switch v(1)=on,{@edit me/listener={#*},{$*};@pemit %n=tfsced},off,{@edit me/listener={$*},{#*};@pemit %n=tfscno}
&ADD_PARA jed=^*"jap":&data_counter me = [add(get(me/data_counter),1)];&para_counter me=[add(get(me/para_counter),1)];&lookup me = [get(me/lookup)] [get(me/data_counter)] ;&[v(n)] me = [get(me/data_counter)];&lock[get(me/data_counter)] me = locked
&MAINC jed=1
&TXT_READ jed=^*"jlt":&mainc me=0;@tr me/txtrd_loop=%n
&TXTRD_LOOP jed=&mainc me=[add(get(me/mainc),1)];@pemit %0 = [get(me/data[extract(get(me/lookup),get(me/mainc),1)])];@switch lt(get(me/mainc),get(me/para_counter))=1,@tr me/txtrd_loop=%0
&LIST_PARA jed=^*"jlp":&mainc me=0;@tr me/lpara_loop=%n
&LPARA_LOOP jed=&mainc me=[add(get(me/mainc),1)];@pemit %0 =[get(me/mainc)] [get(me/data[extract(get(me/lookup),get(me/mainc),1)])];@switch lt(get(me/mainc),get(me/para_counter))=1,@tr me/lpara_loop=%0
&INSERT jed=^*"jip *":@switch get(me/lock[extract(get(me/lookup),%1,1)])=locked,{@pemit %n=Sorry, this paragraph is currently controlled by someone else.},{&data_counter me=[add(get(me/data_counter),1)];&para_counter me=[add(get(me/para_counter),1)];&lookup me=[insert(get(me/lookup),%1,get(me/data_counter))];&lock[extract(get(me/lookup),%1,1)] me=locked;&%n me=[extract(get(me/lookup),%1,1)]}
&EDIT jed=^*"jed *":@switch get(me/lock[extract(get(me/lookup),%1,1)])=locked,{@pemit %n=I'm sorry, this paragraph is currently controlled by someone else.},{&lock[extract(get(me/lookup),%1,1)] me=locked;&%n me=[extract(get(me/lookup),%1,1)];@pemit %n=Fugueedit > [get(me/data[extract(get(me/lookup),%1,1)])]}
&COPY jed=^*"jcp * *":&mainc me=[extract(get(me/lookup),%1,1)];@switch get(me/lock[get(me/mainc)])=locked,{@pemit %n=Sorry, paragraph %1 is currently controlled by someone else.},{@switch get(me/lock[extract(get(me/lookup),%2,1)])=locked,{@pemit %n=Sorry, paragraph %2 is currently controlled by someone else.},{&lock[get(me/mainc)] me=locked;&data_counter me=[add(get(me/data_counter),1)];&para_counter me=[add(get(me/para_counter),1)];&lookup me=[insert(get(me/lookup),%2,get(me/data_counter))];&lock[get(me/data_counter)] me=locked;@pemit %n=FugueEdit > [get(me/data[get(me/mainc)])];&lock[get(me/mainc)] me=;&%n me=[get(me/data_counter)]}}
&DELETE jed=^*"jdp *":&mainc me=[extract(get(me/lookup),%1,1)];@switch get(me/lock[get(me/mainc)]) = locked,{@pemit %n=Sorry, that paragraph is currently controlled by someone else.},{&lock[get(me/mainc)] me=locked;&para_counter me=[sub(get(me/para_counter),1)];&lookup me=[remove(get(me/lookup),get(me/mainc))];&data[get(me/mainc)] me=;&lock[get(me/mainc)] me=}
&DATA jed=jlt
@set jed=MONITOR
@set jed=VISUAL

Instructions for JED, by popular request.

Jed is a small, rudimentary word processor written in MUSH code for this
project. It considers the text being constructed as a series of
paragraphs, each stored separately inside Jed's data system. These
paragraphs are assigned a number when they are created, and can be
modified, moved, copied, or deleted based on that number.

Jed listens for spoken commands. When, for example, you want to list
the existing text, uninterrupted by paragraph numbers, type

"jlt

the game will respond

you say "jlt".

after which Jed will list the paragraphs it contains, in order, without numbers assigned.

When adding a paragraph, you will say the command "jap", and nothing
will appear to happen. Jed is waiting for you to type the paragraph.
Simply type it, and press return when the entire paragraph is complete.
Jed will then add that paragraph to its memory. Some things to note
about paragraphs: First, if you want to begin a paragraph with
punctuation, particularly with quotes, be sure to put a space before the
punctuation. eg

"Friends, Romans, countrymen: lend me your ears!" This was followed
instantly by two dozen otherwise respectable Romans tossing corn at poor
Mark Anthony.

note the space preceding the quote marks beginning Mark Anthony's line.
This prevents the MUSH from interpreting the quote marks as the command
to say the text aloud, which Jed would ignore.

When you are editing, moving, or copying a paragraph, Jed will extract
the paragraph from its memory and place it in the lower window of your
screen, where you can move the cursor over it and change things. When
you are finished making changes, press return, and Jed will return the
paragraph to its memory. Note that it doesn't matter where the cursor
is when you press return.

This is Jed's description, when you look at it.
Oh Boy! Handy Instructions:

"jap.............add paragraph.
"jip <n>.........insert paragraph at position n.
"jdp <n>.........delete paragraph n.
"jcp <s> <d>.....copy paragraph s to positon d.
"jed <n>.........edit paragraph n.
"jlt.............list complete text
"jlp.............list text with paragraph numbers.
"jswitch <v>.....switch jed on or off.

What this is is a short summary of Jed's commands. More detailed
explanation follows.

jap This command, far from being an ethnic slur, stands for Jed,
add paragraph. once you say this command, Jed will create a number for
your new paragraph, and wait for you to type the new paragraph in and
press return. Note that the actions and commands of others will not
effect your paragraph until you press return.

jip This command inserts a paragraph. To use it, first, figure out
what paragraph number your new paragraph should be. Use the jlp command
to do this, it lists the paragraphs and their numbers. Then, say jip
followed by the paragraph number you want your new paragraph to occupy.
For example, if I wish to put a new first paragraph on the work being
created, I would type

"jip 1

to which the system would reply

you said "jip 1".

Jed would then politely wait for me to type in the new paragraph, and
when it is complete, the paragraph would be inserted into Jed's memory
as paragraph one, pushing all the other paragraphs down.

jdp This command deletes a paragraph. Once a paragraph is gone,
it's GONE, so use it gently. To use this command, first, figure out
which paragraph you want to delete (use the jlp command for this), and
say jip followed by the number of that paragraph. For example, if I
want to delete the existing first paragraph of a document, I would type

"jdp 1

to which the system would reply

you said "jdp 1".

and the paragraph would be lost forever.

jcp This command copies a paragraph from one location to another
one. To use it, figure out which paragraph you want to copy, and what
number you want the copy to occupy (use jlp to figure this out), then
say jip followed by the number of the origional paragraph, followed by
the number you want the copy to occupy. for example, if I think
paragraph 2 should be repeated after paragraph 15, I would type

"jcp 2 15

to which the system would respond

you said "jcp 2 15".

You will be given the opportunity to edit the paragraph before the new
copy is made. (I think.) Jed will pull the paragraph into the lower
window of your screen and allow you to modify it. Press return when you
are finished.

jed In addition to being the acronym which serves as Jed's name (for
Jim's EDitor), jed is the command to edit a paragraph. To use it,
figure out which paragraph you want to edit (use jlp to figure this out)
. Then say jed followed by the number of the paragraph you want to
modify. Jed will extract the paragraph from its memory and place it in
the lower window of your screen, where you can modify it using your
cursor control arrows, backspace, and so on. When you have completed
your modifications, press return, and Jed will return the paragraph to
its memory. eg

"jed 4

to which the system responds

you said "jed 4".

after which paragraph 4 will appear in the lower window of my screen.
jlt Jlt is the command that lets you read what you and your
compatriots have written. Simply say the word jlt (for Jed, list text),
and Jed will list each paragraph it knows, in order.

jlp Jlp, like jlt, lets you read what you and your compatriots have
written. The difference is, jlp show each paragraph's number in
addition to listing the paragraph. To use it, just say jlp.

jswitch Jswitch enables and disables Jed. To turn Jed on, say "jswitch
on". To turn it off, say "Jswitch off".

jreset Jreset clears Jed's memory. To activate this command, say
"jreset". Please please please don't use this command, as it was
mainly for debugging Jed.

Thanks for your participation.

Jim Strickland