Better application.library support in system components

AmigaOS users can make feature requests in this forum.

Re: Better application.library support in system components

Postby salass00 » Wed Mar 19, 2014 7:25 pm

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
salass00
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 506
Joined: Sat Jun 18, 2011 4:12 pm
Location: Finland

Re: Better application.library support in system components

Postby trixie » Wed Mar 19, 2014 7:37 pm

@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.
Smoke me a kipper, I'll be back for breakfast!

AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon R5 230 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
User avatar
trixie
 
Posts: 377
Joined: Thu Jun 30, 2011 3:54 pm
Location: Czech Republic

Re: Better application.library support in system components

Postby salass00 » Wed Mar 19, 2014 7:42 pm

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
salass00
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 506
Joined: Sat Jun 18, 2011 4:12 pm
Location: Finland

Re: Better application.library support in system components

Postby trixie » Wed Mar 19, 2014 8:29 pm

@ 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?
Smoke me a kipper, I'll be back for breakfast!

AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon R5 230 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
User avatar
trixie
 
Posts: 377
Joined: Thu Jun 30, 2011 3:54 pm
Location: Czech Republic

Re: Better application.library support in system components

Postby joerg » Wed Mar 19, 2014 8:52 pm

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.
joerg
 
Posts: 371
Joined: Sat Mar 01, 2014 6:42 am

Re: Better application.library support in system components

Postby trixie » Wed Mar 19, 2014 9:08 pm

@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
Smoke me a kipper, I'll be back for breakfast!

AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon R5 230 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
User avatar
trixie
 
Posts: 377
Joined: Thu Jun 30, 2011 3:54 pm
Location: Czech Republic

Previous

Return to AmigaOS Feature Requests

Who is online

Users browsing this forum: No registered users and 6 guests