#Basic -> ARexx
Joe –
Just a few comments (that probably are superfluous :).
First, I'm sure that you are aware that ARexx (and REXX) functions always
return a value — for writech it is the number of characters written (of course
:). However, it is NOT always obvious that if you don't explicitly assign that
result to a variable:
nchars = writech(test, 'FF'X) /* for example */
or explicitly ignore the returned value by using the call statement:
call writech test, 'FF'X /* for another example */
then the returned value (in this case '1' — the number of characters written)
will be passed to the current host (use 'say address()' if you're curious what
it is) for processing. Unless that value ('1' in this case) has a meaning to
the current host (which is not likely), it will produce an (obsure, perhaps)
error message.
Second, if I remember Basic (haven't used any variety for quite a while),
a non-continued print statement (as shown) appends a NEWLINE (appropriate to
the environment – LF, CRLF, or whatever). Consequently, the same effect in
ARexx would be achieved by:
call writeln test, 'FF'X /* letting writeln append the NEWLINE */
or
call writech test, 'FF0A'X /* adding NEWLINE yourself */
Finally, although I've not had an occasion to use it myself, you might
want to look into Joseph M. Stivaletta's 'rexxserdev.library' which can be
found in the AmigaTech Forum libraries and is supposed to facilitate using the
serial device from ARexx.
> [72155,516] Joe Stivaletta Lib:13
> RXSER5.LHA
> Bin, Bytes: 7521, Count: 302, 28-Dec-92(26-Mar-93)
>
> Title : Rexxserdev.library Version 5.02
> Keywords: AREXX SERIAL DEVICE FUNCTION LIBRARY
>
> ARexx Serial Device Function Library Version 5.02. Corrects a very
> subtle bug. Requires AOS 2.04 or greater.
——