[comp.sys.amiga] ARexx rexxarplib Getfile

sdl@linus.UUCP (Steven D. Litvintchouk) (04/11/89)

> 1> rx "say getfile(100,100)"
> +++ Error 15 in line 1: Function not found
> Command returned 10/15: Function not found

This looks like ARexx can't find the function in its library list.

1.  Did you make sure that Arexx has added the rexxsupport.library and
rexxarplib.library to its library list?  If not, you need to first use the
addlib() function to add these libraries.  I forget the exact syntax;
it's something like 
	addlib("rexxsupport.library")
Check your Arexx manual.  Also, in the rexxarplib.library
distribution, there is a three-line Arexx program that you can run to
add these libraries.  I forget the name; it's something like
addrexxlib.rexx.  (Sorry, my Amiga is at home, and I'm at work right now.)

2.  It's not clear what ARexx should do with illegal arguments passed
to library functions.   
    rx "say getfile(100,100)"
would result in a file requester being partly off the screen (which is
illegal in Intuition).  No error code will be returned, and doing this
a few times will cause a guru crash.  Here are legal values:
    rx "say getfile(10,10)"

3.  If you get past this point, the next confusing thing you will
encounter is the use of the CreateHost function.  (And this is really
confusing!) 

    a) Invoke Createhost *asynchronously*.  (I do it by 
	     address command "run rx rexx:createhost.rexx"
       where the rexx:createhost.rexx program first makes sure
       that the libraries are loaded, and then invokes the CreateHost
       function.)
    b) CreateHost uses two ports.  It creates the ControlPort, which
	you use to send messages to CreateHost.  
    c) While this is asynchronously running, you do a 
	c:WaitForPort <ControlPort name>, to wait until it's ready.
	(You can 'address command' this from your Arexx program.)
    d) You can control CreateHost by sending messages to the
	ControlPort, as documented in the RexxArpLib documentation.
	You can tell CreateHost to open a window, write stuff into it, etc.
    e)  You open a NotifyPort.  When an IDCMP event (e.g. CloseWindow)
	is received by CreateHost, messages are sent to the
	NotifyPort.  You can wait for a message with WaitPkt.
	As each becomes available, read it and reply to it.
    f) When you receive the message at the NotifyPort indicating
	that CreateHost has fielded a CloseWindow IDCMP event, call
	the rexxarplib CloseWindow function to send the right message
	to the ControlPort, and the window will close.
    g) Remember: the asynchronous program that runs CreateHost
	shouldn't explicitly open any ports. (CreateHost automatically
	opens the ControlPort, and will simply not send anything
	to the NotifyPort if none exists.)
       The Arexx program you write to communicate with the CreateHost
	function must explicitly open the NotifyPort to receive
	messages from CreateHost.  Do that just after the WaitForPort
	returns, indicating that CreateHost is ready to run.


Hope this helps.....


Steven Litvintchouk
MITRE Corporation
Burlington Road
Bedford, MA  01730
(617)271-7753

ARPA:  sdl@mbunix.mitre.org
UUCP:  ...{att,decvax,genrad,ll-xn,philabs,utzoo}!linus!sdl

	"Ada came at the peak of confidence in computing.  We believe
	   the tide is now moving the other way." -- Bernard Carre,
	   University of Southampton and Program Validation, Ltd.