Better application.library support in system components

AmigaOS users can make feature requests in this forum.
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 530
Joined: Sat Jun 18, 2011 3:12 pm
Location: Finland
Contact:

Re: Better application.library support in system components

Post 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.
User avatar
trixie
Posts: 409
Joined: Thu Jun 30, 2011 2:54 pm
Location: Czech Republic

Re: Better application.library support in system components

Post 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.
The Rear Window blog

AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 530
Joined: Sat Jun 18, 2011 3:12 pm
Location: Finland
Contact:

Re: Better application.library support in system components

Post 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.
User avatar
trixie
Posts: 409
Joined: Thu Jun 30, 2011 2:54 pm
Location: Czech Republic

Re: Better application.library support in system components

Post 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?
The Rear Window blog

AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
joerg
Posts: 371
Joined: Sat Mar 01, 2014 5:42 am

Re: Better application.library support in system components

Post 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.
User avatar
trixie
Posts: 409
Joined: Thu Jun 30, 2011 2:54 pm
Location: Czech Republic

Re: Better application.library support in system components

Post 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 :-D
The Rear Window blog

AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
Post Reply