Page 3 of 3
Re: Better application.library support in system components
Posted: Wed Mar 19, 2014 6:25 pm
by salass00
trixie wrote:@salass00
if you want to save on signals you can use the same signal for both message ports (look up IExec->AllocSysObject() and ASOT_PORT).
Can I really do that with a rexx port? Looking at documentation, it appears I need to allocate the ARexx message host port using CreateRexxHostPort() from rexxsyslib.library, which does not allow me to set the signal myself like AllocSysObject() would.
Of course, CreateRexxHostPort() returns pointer to a standard Exec struct MsgPort. But would it be legal at all to tinker with the initialized port and set its mp_SigBit to the signal bit the other port uses? (Not mentioning the fact that this won't spare me a signal because CreateRexxHostPort() will already have allocated one.)
You could create the ARexx port first and then reuse its signal. Just make sure to delete the message ports in the right order on OM_DISPOSE of your class.
BTW I don't think you need to use CreateRexxHostPort() to create a message port for use with ARexx. A regular public message port created with AllocSysObjectTags(ASOT_PORT, ASOPORT_Name, hostname, TAG_END) should be fine.
Re: Better application.library support in system components
Posted: Wed Mar 19, 2014 6:37 pm
by trixie
@salass00
With arexx.class you can pass on OM_NEW a message port that you have created yourself using the AREXX_MsgPort tag.
I see it now, but that's pretty much the same as doing my own
Code: Select all
IExec->AllocSysObjectTags(ASOT_PORT, ASOPORT_Size, sizeof(struct RexxMsgPort), ... );
and thus replacing IRexxSys->CreateRexxHostPort(). I'm guessing that ARexx Class doesn't use this function either, as CreateRexxHostPort() always appends the slot number to the port name, whereas ARexx Class allows leaving the name without the slot number.
BTW I don't think you need to use CreateRexxHostPort() to create a message port for use with ARexx. A regular public message port created with AllocSysObjectTags(ASOT_PORT, ASOPORT_Name, hostname, TAG_END) should be fine.
It is, apparently - i've just rewritten my code to use AllocSysObject() instead, and it works all right. Including the signal sharing.
Re: Better application.library support in system components
Posted: Wed Mar 19, 2014 6:42 pm
by salass00
trixie wrote:
I'm guessing that ARexx Class doesn't use this function either, as CreateRexxHostPort() always appends the slot number to the port name, whereas ARexx Class allows leaving the name without the slot number.
It doesn't, it just uses AllocSysObjectTags() more or less as I posted above. You don't need to override the message port size either.
Re: Better application.library support in system components
Posted: Wed Mar 19, 2014 7:29 pm
by trixie
@ salass00
You don't need to override the message port size either.
I hope you're sure about that

What's
struct RexxMsgPort for, then? Is it just for rexxsyslib.library's own purposes?
Re: Better application.library support in system components
Posted: Wed Mar 19, 2014 7:52 pm
by joerg
trixie wrote:@ salass00
You don't need to override the message port size either.
I hope you're sure about that

He is correct, but you may get a problem with it since something seems to be missing in the autodoc: arexx.class frees the port, no matter if it's a port it created it itself (when AREXX_HostName is used) or the one you supplied with AREXX_MsgPort, with IExec->FreeSysObject(ASOT_Port, port) in OM_DISPOSE.
Since you are using this port for other things as well make sure to dispose arexx.class after everything else using this port, and don't free the port yourself.
Re: Better application.library support in system components
Posted: Wed Mar 19, 2014 8:08 pm
by trixie
@whoever still finds it interesting
Automatic ARexx port creation now works in Application Class, and without any dependencies (ARexx Class or rexxsyslib.library). If the programmer requests an ARexx port for his application, he simply passes APPLICATION_UseARexx, TRUE. The class will then create a unique port name constructed from APPLICATION_BaseName and upper-cased. Multiple instances get a slot number suffix added to the port name, so with an application named TestApp, the first instance's port is TESTAPP, the second instance becomes TESTAPP.1 and so on (up to 99). You can then OM_GET the resulting unique port name from APPLICATION_ARexxPortName to display in your GUI or for whatever purpose you may use it.
Now on to properly implement the event handling method
