[comp.sys.amiga.tech] Adding ARexx support to a Comm Program

papa@pollux.usc.edu (Marco Papa) (10/11/88)

I was just noticing that Tony Sumrall is going to be adding ARexx support
to VT100.  Since he is not done yet,  and I have done such a job for
a commercial product (A-Talk III), it seems appropriate to share my 
experiences. Hopefully other communication programs will be able to use these 
ideas, too.  Note that I have to acknowledge the helpful discussions I had
with Willy Langeveld of SLAC [which had the first ARexx comm implementation
for his terminal program VLT], and of course the several phone calls I had with
Bill Hawes, author of ARexx.

Adding ARExx support to a terminal program that ALREADY has a script language
is much easier than adding it to another program that does not have such a
built-in feature.  The author of MicroFiche Filer Plus found this out pretty 
soon. As a result of this, adding "full" ARexx suppport to a program with a 
script language will take about 5K of object code and 1 week of work.  Adding
ARexx support to a program missing the script language takes the above time
PLUS the time to build the script language itself, which can be a big effort in
itself.

Now back to the terminal program script language.  Most terminal script 
commands should be executable from ARexx.  A few do not make real sense:
GOTO, EXIT for example should be skipped, since there is no "current" script
being executed and no labels to GOTO.  DELAY and WAIT should be supported,
though.  Willy's VLT does not support them, but Willy's idea on how to 
support them worked: delay the reply of the message until the DELAY time 
has passed, the WAIT has succedeed or a TIMEOUT has expired.  This worked just
fine in A-Talk III.

VLT provided 1-way communications between ARexx and the VLT: ARexx port:
VLT accepts messages that tells it to execute commands and always replies a
"success" message.  First of all, return codes should be used to report
whether the command was successful or not.  Error codes should be reported for
such things as DIAL not successful, CAPTURE OPEN failed, Download failed 
an such.

But moreover there should be a way to return information from the host 
computer.  This will give you full two-way communication.  One way to implement
this is to allow storing of strings [or entire lines] in a buffer and add
a command, available only when invoked from ARexx, to return the string as
an ARexx ArgString.  The primary return code would be 0 and the
secondary return code would be the string obtained from the host.

The entire program would look like this considering an example of two-way
communication between a terminal program and a database manager:

OPTIONS RESULTS		       ask for ArgStrings
'REPLY "hello"^M"'             send a string to the host
'GETLINE'                      get the reply from the host computer
'STRING'                       this is the command that returns the line
                               gotten from the previous command as an ArgString
IF RC=0 THEN SAY "returned" RESULT

Note that ARexx stores the returned ArgString in the variable called RESULTS.

If the whole thing has been started by a database program, the database program
could get some notion of what happend on the "host" computer, one level further
down from the terminal program it was talking to.

The entire loop looks like this:

    send command
        V
DBMS --------> AREXX -----> TERM pgm -----> host comnputer +
							   |
							   |
DBMS <-------- AREXX <------ TERM pgm <--------------------+
          ^
          |
    get result of command
       on host computer

As we have found out from early uses of this technique from our beta testers,
you can implement quite complex and powerful Arexx scripts with it.

I hope that this was useful to some, and at least explained what extra power
one can get by adding such a simple and cheap interface (in terms of coding 
involved).

Enjoy.

-- Marco Papa 'Doc'
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
uucp:...!pollux!papa       BIX:papa       ARPAnet:pollux!papa@oberon.usc.edu
 "There's Alpha, Beta, Gamma and Diga!" -- Leo Schwab [quoting Rick Unland]
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

peter@sugar.uu.net (Peter da Silva) (10/12/88)

Good article.

Any ideas on adding AREXX support to Browser? I'm thinking of allowing such
things as:

	OPEN directory
	SET options
	RESET options
	MENU label command
	RENAME file1 file2
	COPY file1 file2
	DELETE file [all]
	MAKEDIR dirname
	STACK stack
	LAUNCH workbenchprogram files
	RUN cliprogram arguments
	REQUEST label

These should mostly be obvious: STACK sets the default stack for workbench
programs. REQUEST puts a menu item up. When it's selected Browser will
return the message and ghost the item. One file name will be returned.
RUN may not be implemented: the CLI environment basically sucks. I'm on the
verge of giving up and ripping it out.
-- 
		Peter da Silva  `-_-'  peter@sugar.uu.net
		 Have you hugged  U  your wolf today?

acs@amdahl.uts.amdahl.com (Tony Sumrall) (10/18/88)

In article <12718@oberon.USC.EDU> papa@pollux.usc.edu (Marco Papa) shares
his experience and the insights gained from  implementing an ARexx port in
a COMMERCIAL comm pgm.  While there was really  nothing earth-shaking in
his revelations I am still impressed with the spirit of the posting.

Thanks, Marco!
-- 
Tony Sumrall acs@amdahl.uts.amdahl.com <=> amdahl!acs

[ Opinions expressed herein are the author's and should not be construed
  to reflect the views of Amdahl Corp. ]

papa@pollux.usc.edu (Marco Papa) (10/18/88)

In article <c3Of5ec4=m1010DUfsg@amdahl.uts.amdahl.com| acs@amdahl.uts.amdahl.com (Tony Sumrall) writes:
|In article <12718@oberon.USC.EDU| papa@pollux.usc.edu (Marco Papa) shares
|his experience and the insights gained from  implementing an ARexx port in
|a COMMERCIAL comm pgm.  While there was really  nothing earth-shaking in
|his revelations I am still impressed with the spirit of the posting.
|Thanks, Marco!

You are welcome!  My "academic" background comes up now and then and tells me
to write tutorials :-) Nothing earth-shaking, but hopefully useful for saving
somebody else an extra inch of effort.

-- Marco Papa 'Doc'
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
uucp:...!pollux!papa       BIX:papa       ARPAnet:pollux!papa@oberon.usc.edu
 "There's Alpha, Beta, Gamma and Diga!" -- Leo Schwab [quoting Rick Unland]
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

aleks@well.UUCP (Brian J. Witt) (10/23/88)

Great, some one strapped AREXX onto a comm program.  What verbs did you
implement?  Could you post a list so we might arrive at a sort-of
standard?  Do you seperate out Xmodem (ZModem?) and Kermit from the
main hull sothat I could have a xmodem protocol run over the serial
line without having to invoke the whole program.  Orshould I
invoke the wholoe program sothat everythin is there?
  I cracked open the AREXX manaual friday; looks pretty neat.

--- until the next DTR
--- brian

???  What if, in the media, women weren't exploited?  ???

papa@pollux.usc.edu (Marco Papa) (10/24/88)

In article <7444@well.UUCP> aleks@well.UUCP (Brian Witt) writes:
|Great, some one strapped AREXX onto a comm program.  What verbs did you
|implement?  Could you post a list so we might arrive at a sort-of
|standard? 

All commands available from menus are also implemented from the script
language.  On the thing the people that will do it for Vt100 have to change
is to throw away the distinction between "init" and "general" commands.
All commands should be "general". Otherwise, for example, you cannot build
a database of phone numbers with associated comm params, etc...  and then be
able at any time during a session to switch back and forth between hosts.
The only AREXX-relative commands are the one listed in the tutorial, and
that are used to return replies from the host as ArgStrings.

| Do you seperate out Xmodem (ZModem?) and Kermit from the
|main hull sothat I could have a xmodem protocol run over the serial
|line without having to invoke the whole program.  Orshould I
|invoke the wholoe program sothat everythin is there?

No, you invoke the whole program.

-- Marco Papa 'Doc'
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
uucp:...!pollux!papa       BIX:papa       ARPAnet:pollux!papa@oberon.usc.edu
 "There's Alpha, Beta, Gamma and Diga!" -- Leo Schwab [quoting Rick Unland]
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=