home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Fish 1
/
GoldFishApril1994_CD2.img
/
d4xx
/
d429
/
uedit-stuff
/
bbsing
< prev
next >
Wrap
Text File
|
1991-01-10
|
17KB
|
381 lines
We have here some Uedit commands useful for BBSing. We've got things do
quote text with a marker at the start of each line, like this:
PK> Well blah blah blah blah blah, and blah
PK> blah blah blah...
and we've got functions for using Uedit to edit messages online and send text
back and forth with Rexx. The versions given here work with BaudBandit 1.00
and 1.50, and VLT 4.824, and it shouldn't be hard to get them to work with
other Rexx-compatible terminals.
The way mine is set up is, there's a function key in BaudBandit which saves
the review buffer in ram disk and then runs a Rexx file called "Cap2Uedit",
which makes Uedit (if auto-traffic is on) load in that capture file and show
the last page of it. That script also sends characters out the modem every
few seconds to keep the bbs on the other end from hanging up on you. You
then compose your message in Uedit, using the quoting commands mentioned
above, and then press rAmiga-7, which saves the current buffer, pads its
empty lines with spaces, and causes BaudBandit to ascii-send it. The general
procedure is to give the bbs commands to reply and wait until it is actually
waiting for you to type in the message before you press the Cap2Uedit
function key. That key is defined with the string "\av\mCap2Uedit" in
BaudBandit. Then you compose your reply and press rAmiga-7 to send it.
While you are composing it, Cap2Uedit is sending space-backspace out the
modem every ten seconds.
After five minutes it will make a noise (using the Play8SVX program - remove
these lines if you don't have it or don't want to use it) to remind you that
you're still on the phone. It will stop sending space-backspaces if you
press another function key defined as "\mShutup-Cap2Uedit". NOTE that
BaudBandit cannot exit if any rexx script it started is still running. If
you tell it to quit and it doesn't, try using the Shutup-Cap2Uedit macro and
see if it quits then. Or you could use amiga-B "Stop ARexx" but it might
respond sluggishly.
Files named Cap2Uedit.baud, Cap2Uedit.vlt, and Shutup-Cap2Uedit.baud should
be included with this file. The VLT version of Shutup-Cap2Uedit is identical
to the BaudBandit version (just rename it with the ending .vlt); the
Cap2Uedit program differs slightly between the two. There should also be a
file called MessageSend.vlt, which is needed to use rAmiga-7 with VLT.
BaudBandit does not need a MessageSend program. All of these .baud or .vlt
files, whichever set is appropriate for the terminal you are using, should go
in your REXX: directory. The Cap2Uedit scripts also require a RunBack
program if you want them to be able to start Uedit if it is not already
running when you use them.
In order for this to work with the Zimmerman auto-traffic interface, you have
to create an auto-traffic command in your REXXCOMM file called LOADCAPTURE
that runs the key virtual-f7 (macronum 1126) given below. You should also
have a FRONTSCREEN command that runs virtual-1 (macronum 1041) given below,
but that can be left out if you remove the line that uses it from the
Cap2Uedit file. See the notes below on virtual-1, because it won't work very
well unless your system is set up properly. Some of the advice for virtual-1
will benefit many other programs as well.
My version of Cap2Uedit is also set up to tell Uedit to use an IBM font,
using the SETFONT rexx command. Naturally this only works with Uedit 2.6a or
newer. If you use SETFONT you don't actually need FRONTSCREEN because
SETFONT reopens Uedit's screen anyway. An appropriate IBM font (one with the
first four characters missing because of a problem in Uedit) is included.
Put this in REXXCOMM:
loadcapture 1126+0 |
frontscreen 1041+0 |
setfont 995+0 |
I have just tested the stuff with BaudBandit 1.50, and it works fine except
that whenever you send the review buffer to Uedit it writes "RAM:Capture
Written" (or whatever filename you use) on the screen. This "feature" was
not present in BB 1.00. To shut it up, you'll have to do what I did: Find
the word at byte offset 10830 (hex 2A4E) in the BaudBandit file. It should
be hex 4878. Change it to 6010. Then move to offset 10876 (hex 2A7C). It
should be 41FA. Change it to 6006. If the two existing values are not 4878
and 41FA, then you may have a slightly different version; DO NOT change the
values unless both of the old ones are as described.
One other hint for using BaudBandit with IBM character sets in color: use
FED to change the IBM font you're using so that it is marked as boldface.
Save the "8b" font and delete the regular "8" non-boldface one. Otherwise
half the text you get from a color bbs will be boldfaced, which if you had a
16 color screen would be activating the other 8 colors.
======================
So here are some BBSing functions:
Remove all ANSI escape sequences and backspaces from buffer
<alt-7: putmsg("crunch...")
equatenum(n54, searchCaps)
equatenum(searchCaps, 1)
movecursor(curfile, sfile)
insertchar(curfile, eline)
movecursor(curfile, schar)
setgrep("/\[[0-9;]*[A-FHL]/ /")
.. the above matches ANSI commands that move the cursor, and replaces
.. them with a space so words separated by them don't run together
while (grep(curfile, invert, 2)) nothing
movecursor(curfile, sfile)
setgrep("/\[[0-9;]*:a//")
.. the above matches any ANSI escape sequence
while (grep(curfile, invert, 2)) nothing
movecursor(curfile, sfile)
setgrep("/.:b//")
while (grep(curfile, invert, 2)) movecursor(curfile, schar)
.. with that we remove each backspace and the character before it
movecursor(curfile, sfile)
clearchar(curfile)
putmsg(" ")
equatenum(searchCaps, n54)
>
Turn off trueTabs in curfile with no side effects
<virtual-f5: push(buf99, buf50) .. 2.6 version
push(n99, n50) .. 2.6 version
.... push(buf50) .. PRE-2.6 VERSION
.... push(n50) .. PRE-2.6 VERSION
insertchar(buf50, "-") .. make it exist
equatenum(n50, 0)
if (getflag(buf50, truetabs)) equatenum(n50, 1)
if (getflag(curfile, truetabs)) {
flipflag(curfile, truetabs)
if (eqnum(n50, 1)) {
flipflag(buf50, truetabs) .. upflag no work
flipflag(buf50, truetabs)
}
}
freebuf(buf50)
pop(n99, n50) .. 2.6 version
pop(buf99, buf50) .. 2.6 version
pop(n50) .. PRE-2.6 VERSION
pop(buf50) .. PRE-2.6 VERSION
>
Turn off trueTabs in curfile with no side effects
*** UEK VERSION (more efficient) ....... <virtual-f5:
push(n99, n0) .. 2.6 version
push(n99, n1) .. 2.6 version
.... push(n0) .. PRE-2.6 VERSION
.... push(n1) .. PRE-2.6 VERSION
getaddress(37, n0) .. &curBuf
peek(n0, n0, 4) .. curBuf
add(n0, n0, 168) .. &curBuf->Flags
peek(n0, n1, 2) .. Flags value
and(n1, n1, 0xfffe) .. mask off trueTabs
poke(n0, n1, 2)
pop(n99, n1) .. 2.6 version
pop(n99, n0) .. 2.6 version
.... pop(n1) .. PRE-2.6 VERSION
.... pop(n0) .. PRE-2.6 VERSION
>
The idea of this here command is to paste in a block of text as a bbs quote,
with XX> (initials or whatever) at the beginning of each line. After you cut
or copy hilite from somewhere, it inserts that text at the cursor. It
reformats all paragraphs in the freshly pasted hilite region, and (for the
present) keeps the right margin down to 71 at the most including the string
it adds to the beginning of each line, which it asks for each time (default
is "> ").
Someday I want to make this so that any line shorter than about rightmargin
minus 20 does not get reformatted.
We also someday want a command to strip the existing leading whatever and
then do something like this. We also want a function to reformat paragraphs
where each line begins with a comment indicator such as "; ", for programming
use. These could all use common routines?
THIS USES N48 as a flag to tell it whether to reformat paragraphs inside the
quote. By default it does. It is here set up to clear n48 whenever it's
run, so that the command which sets n48 (rAmiga-6) has to be used before each
unformatted quoting. To change, just search for n48 ... it's in L-q and R-6.
Warning: some of the spell-checking functions (at least the last versions
I've seen) randomly trash n48 and n49.
Paste hilite as bbs-style quote; XX> before each line
<lamiga-q: if (isempty(buf47)) {
putmsg("Cut or copy a hilite region first.")
returnfalse
}
runkey(virtual-kpdot)
freebuf(buf54)
insertrgn(buf54, efile, "> ", all)
movecursor(buf54, sfile)
putmsg(
"What should I put at the beginning of each line? (keep it short)")
inputstring(buf54)
filesize(buf54, n54)
if (getflag(curfile, truetabs))
runkey(virtual-f5)
getlocal(curfile, n50, linelength)
equatenum(n51, n50)
if (gtnum(n51, 71)) equatenum(n51, 71)
sub(n51, n51, n54)
if (gtnum(20, n51)) { .. 20 is arbitrary
alertuser("Leading string too long. Get real.")
returnfalse
}
runkey(normal-kpenter)
.. shft-kpenter for me because I use normal-kpenter for a normal newline key
setlocal(curfile, linelength, n51)
movecursor(curfile, ehilite)
if (not is(curfile, eline)) insertchar(curfile, eline)
insertchar(curfile, eline)
movecursor(curfile, shilite)
if (not is(curfile, sline)) {
insertchar(curfile, eline)
incloc(curfile, shilite)
}
insertchar(curfile, eline)
if (eqnum(n48, 0)) {
while (gtloc(curfile, ehilite, atcursor))
runkey(ctl-3)
} else
equatenum(n48, 0)
movecursor(curfile, shilite)
movecursor(curfile, echar)
while (gtloc(curfile, ehilite, atcursor)) {
insertrgn(curfile, atcursor, buf54, all)
movecursor(curfile, downline)
if (not is(curfile, sline))
movecursor(curfile, sline)
}
movecursor(curfile, shilite)
clearchar(curfile)
movecursor(curfile, ehilite)
clearchar(curfile)
setlocal(curfile, linelength, n50)
... setlocal(curfile, linelength, 71) .. my own preference
>
Cause next bbs-style quote to not reformat paragraphs
<ramiga-6: equatenum(n48, 1)
putmsg("Next BBS-style quote will be unformatted.") >
Drag mouse to make bbs-style quote in file "t:reply"
<ramiga-buttondown: runkey(shftaltctl-buttondown)
runkey(normal-kpdot)
freebuf(buf50)
insertrgn(buf50, efile, "t:Reply", all)
if (not runkey(virtual-f6)) {
if (not newfile) returnfalse
setfilename(curfile, buf50)
}
runkey(lamiga-q)
> ... just a package for convenience
Find a file buffer by name (supply name in buf50)
<virtual-f6: getmaxfiles(n54)
decnum(n54)
do (n53, 0, n54) {
if (getfilename(buf54, buf[n53])
& stringcomp(n50, buf54, buf50, 1)) {
editbuf(buf[n53])
returnTrue
}
}
returnFalse
>
Rexx: load in a named capture file and show last page
<virtual-f7: freebuf(buf50)
insertrgn(buf50, sfile, buf61, all)
if (runkey(virtual-f6)) freebuf(curfile) .. flush old copy
loadfile(buf50)
movecursor(curfile, efile)
vscroll(atcursor) .. BUG WORKAROUND
movecursor(curfile, spage)
vscroll(atcursor)
.. vscroll(2) .. fine tuning
.... if (isempty(buf0) & !eqnum(curfile, 0))
.... freebuf(buf0) $ .. something I like to add
equatenum(n51, curfile)
freebuf(buf50)
insertrgn(buf50, efile, "t:reply", all)
if (runkey(virtual-f6)) { .. flush old copy
freebuf(curfile)
editbuf(buf[n51])
}
>
Pad all empty lines with one space
<alt-6: putmsg("padding empty lines")
equateloc(curfile, mouseloc, atcursor)
movecursor(curfile, sfile)
while (not is(curfile, efile)) {
if (is(curfile, eline))
insertchar(curfile, " ")
else movecursor(curfile, eline)
movecursor(curfile, echar)
}
putmsg(" ")
>
Send Uedit's screen to the front
<virtual-1: execute(" ", "endif") >
for the above to work at all efficiently, you must make C:Run resident and
be using SetPatch from AmigaDOS 1.3.2 or newer. Otherwise it will load the
Run program from disk every time you call it. You should do so anyway,
because otherwise ANY program that uses the AmigaDOS Execute() function to
run other programs will be very inefficient. Also you should either make
C:Endif resident and use AmigaShell (make L:Shell-Seg resident), or copy
the endif program into ramdisk and change the command above to "ram:endif".
Or you could call it "ram:DoNothing" or something because the endif program
literally does nothing at all. Otherwise it will load c:Endif from disk.
With everything resident virtual-1 will run in about a tenth of a second,
moving Uedit's screen to the back and then back to the front. REMEMBER,
EVEN IF YOU NEVER MAKE ANYTHING ELSE RESIDENT, DO make C:Run resident, and
use SetPatch 1.3.2 or newer.
Cause BaudBandit to ascii-send current buffer, fix empty lines
<ramiga-7: runkey(alt-6) .. pad empty lines
.. the runkey(alt-6) is necessary with BaudBandit but not VLT.
if (getflag(curfile, changed)) {
putmsg("saving")
if (not savefile(curfile)) {
putmsg("CANNOT SAVE BUFFER")
returnfalse
}
getstacksize(n0, n0, n50)
while (gtnum(n50, 0)) { .. wait for save to complete
delay(1)
getstacksize(n0, n0, n50)
}
if (getflag(curfile, changed)) {
putmsg("FILE SAVE FAILED")
returnfalse
}
}
putmsg("sending")
freebuf(buf62)
.... THE NEXT FEW LINES ARE FOR USE WITH BAUDBANDIT:
insertrgn(buf62, efile, "\"address BAUD send '\\u\\as-", all)
getfilename(buf54, curfile)
insertrgn(buf62, efile, buf54, all)
insertrgn(buf62, efile, "'
if show('P', 'Cap2Uedit-signal') then
address 'Cap2Uedit-signal' foo\"", all)
.... USE THESE NEXT THREE COMMENTED OUT LINES FOR VLT:
... insertrgn(buf62, efile, "messagesend.vlt ", all)
... getfilename(buf54, curfile)
... insertrgn(buf62, efile, buf54, all)
.... setfont("topaz", 8) .. undo usage of IBM font
.... toggle(totiny) .. if you use such a thing
if (runkey(altctl-3)) {
while (not rexxin(buf61,sFile,n97,n98,n99)
& eqnum(n99, -4)) delay(1)
runkey(virtual-r)
}
>
Set Uedit's font (arg string is fontname, space, size; e.g. "topaz 8")
<995: movecursor(buf61, sfile)
movecursor(buf61, eword)
while (is(buf61, whitespace)) clearchar(buf61)
tonumber(n54, buf61)
equateloc(buf61, locA, atcursor)
equateloc(buf61, locB, efile)
clearrgn(buf61, loc)
movecursor(buf61, sfile)
tolower(buf61)
while (movecursor(buf61, echar))
tolower(buf61)
if (!setfont(buf61, n54))
putmsg("Could not set font") ... SHOULD HANDLE ERROR BETTER
else {
toggle(totiny) .. reopen screen
toggle(totiny)
}
>