home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fish 'n' More 2
/
fishmore-publicdomainlibraryvol.ii1991xetec.iso
/
fish
/
text
/
editors
/
uedit-stuff
/
autotraffic
< prev
next >
Wrap
Text File
|
1991-01-10
|
7KB
|
138 lines
PAUL'S UEDIT-AREXX INTERFACING STUFF
What we got here is a means of being able to have save-on-idle and rexx auto-
traffic at the same time. There's also a virtual key here which can take an
incoming arexx message and interpret it as Uedit command language.
COMBINING AUTO-TRAFFIC WITH SAVE-ON-IDLE: It's kind of a kludge, but it
works. There are a couple of disadvantages relative to using either feature
by itself: You have to have a prekey (unless you want your idle save
starting too soon half the time), and if you want to change the wait
duration for idle saves you have to recompile the idle key instead of just
using a command to set the idleTime variable (or you could change it to use
an n-variable), and the actual duration you get is undependable. See, you
have to set the idleTime variable to 1 (a tenth of a second). And the idle
command counts tenths (which may actually last longer than 0.1 second; in
fact it seems to count typically six to eight per second on a 16 bit amiga)
until the number you want have gone by. And you have to reset that counter,
which is in n32 as written here, whenever there is input, so if you don't use
a prekey, you have to use this one:
<prekey: equatenum(n32, 0) >
... and if you have an existing prekey you have to add "equatenum(n32, 0)" to
it at the top.
I originally used an idle time of 10 (one second) but found that the abount
of CPU used by Uedit during idle time was not significantly decreased by
this longer wait between idle command runs.
You also have to rename your existing idle command as virtual-4. Or use a
different key if you're already using that one (change the last runkey in the
new idle command to match). The other setup steps are to set your idleTime
value permanently to 1, install a prekey with equatenum(n32, 0) in it, and
replace altctl-9 (toggle auto-traffic) with the new version below. Note that
this new altctl-9 does not use userGlobalB, and you can't use a checkmarked
menu item to control it. It simply swaps virtual-t to an unused key to turn
it off (virtual-3 as written), reporting whether auto-traffic mode is now on
or off, putting it back on virtual-t to activate it, rather than swapping
virtual-t onto idle as the old one did. You can use any version of virtual-t.
Combine idle save with auto-traffic: SET IDLE TIMER = 1.
<idle: while (runkey(virtual-t)) .. handle rexx commands
equatenum(n32, 0)
incnum(n32)
if (genum(n32, 80)) { .. count of 75 means about 10-14 secs w/ 68000
equatenum(n32, 0)
runkey(virtual-4) .. idle save
}
>
You must move your present idle command to virtual-4 if you want it to still
work with the above dual-purpose idle command. (Make sure you aren't using
anything on virtual-4 already.) The virtual-4 I use is basically just the
standard save-on-idle command with two changes: it does curFile last after
all other buffers have been checked, and it uses userLocalA to mean "do NOT
save on idle", so that save-on-idle defaults to on for new buffers. I used
to use a fancy idle save command that copied curfile to another buffer before
saving it, to avoid having it lock up when I tried to type, but I stopped
using that.
Toggle auto-traffic mode while leaving idle save intact.
<altctl-9: swapkey(virtual-t, virtual-3)
if (inuse(virtual-t))
putmsg("Now responding to ARexx commands.")
else putmsg("Ignoring ARexx commands.")
>
note that userGlobalB is not used: you simply save your config in whichever
state you like, with auto-traffic on or off, and it will remember. NOTE that
the other key you swap virtual-t with must be unused. Or it will say "Now
responding to ARexx commands" always, and might actually do something else.
=============================================================================
USE OF COMMAND LANGUAGE THROUGH REXX: To add this ability to the Zimmerman
interface, create a line in your REXXCOMM file that tells it to run virtual-
f2 when it gets the command COMPILE, by adding this line:
compile 1121+0 |
... then any rexx message that starts with the word "compile" will (if auto-
traffic is on) be compiled as Uedit command language and then executed. The
reply code to rexx will be 0 if the command returned true, 1 if the command
returned false, and 10 if the compile failed (in fact Uedit aborts). In this
case it leaves the failed compile sitting on the Uedit screen. If the
compile succeeds the Uedit screen will momentarily display the end of the CL
command and then instantly flip back to the current buffer. There's no way
to avoid this glitch in the display with the current Uedit version. The
command is compiled using a very obscure macronum: 771. It will return a
result string consisting of the invert region of curFile, if such exists when
the command completes. It will not return a result string if the compile
fails, of course.
The sequence of commands has to be sent as all one string if you want it to
be executed as a single function. And note that Uedit will receive the
command all on one line even if you break it into several lines in rexx,
unless you take the trouble to insert newlines in rexx like this:
'COMPILE a line of CL blah blah blah' || '0A'x || 'another line blah blah'
This means that you can't insert Uedit comments starting with two periods
except at the very end of the message, unless you put '0A'x after it.
I originally wrote this to act as a complete auto-traffic handler, replacing
the standard interface, before I gave in and used the Zimmerman interface.
Compile and run the command language in the Rexx In buffer
<virtual-f2: equatenum(n0, curfile)
equatenum(n96, 1) .. indicate no reply needed
insertrgn(buf61, sfile, "<771: ", all)
insertrgn(buf61, efile, "
>", all)
flipflag(buf61, changed)
movecursor(buf61, sfile)
.. I WISH there was some way to activate hideDisplay for this:
editbuf(buf61)
if (not compile) {
.. one thing I like to do at this point is to restore the old search string.
.. I put "getsearch(buf49)" near the top of virtual-y, and put
.. "setsearch(buf49)" right here, and before each "returnfalse" in virtual-y,
.. also before "label (10)" in virtual-y.
... OPTIONAL: runkey(virtual-1) .. screen to front
abort
}
editbuf(buf[n0])
freebuf(buf61)
if (runkey(771))
equatenum(n54, 0) .. okay
else equatenum(n54, 1) .. almost okay
if (gtloc(curfile, einvert, sinvert))
rexxout(curfile, invert, n54, 1, n99)
else rexxout(" ", all, n54, 1, n99)
>