Amiga.org
Operating System Specific Discussions => Amiga OS => Amiga OS -- Development => Topic started by: Steady on March 05, 2003, 01:46:47 PM
-
Hello,
I am trying to write an ARexx interface using Reaction's arexx.class under AmigaOS 3.9. Due to an extreme lack of examples, I am unable to
compare what I have done to something working. My code compiles OK, but whenever I run it, the ARexx port is not set up because it claims that I have not set the commandlist up properly. Code snippit below:
-----SNIP--------------------------------------
struct ARexxCmd arexxCmdList[] =
{
{"QUIT", AREXX_QUIT, (void(*)())arexxQuit,
"",
NULL, NULL, NULL, NULL, NULL},
{NULL}
};
void setupArexx(void)
{
ULONG retVal;
struct EasyStruct es;
sim.obj[OBJ_AREXX] = ARexxObject,
AREXX_HostName, AREXX_HOSTNAME,
AREXX_NoSlot, TRUE,
AREXX_Commands, arexxCmdList,
AREXX_ErrorCode, &retVal,
ARexxEnd;
if(retVal)
{
es.es_StructSize = sizeof(struct EasyStruct);
es.es_Flags = 0;
es.es_Title = SIM_TITLE;
es.es_TextFormat = AREXX_FAIL;
es.es_GadgetFormat = "Oh... OK";
(void)EasyRequest(NULL, &es, NULL, arexxFailMsg[retVal]);
}
else
(void)GetAttr(AREXX_SigMask, sim.obj[OBJ_AREXX],
&(sim.arexxSignal));
return;
}
void killArexx(void)
{
if(sim.obj[OBJ_AREXX])
DisposeObject(sim.obj[OBJ_AREXX]);
return;
}
void arexxQuit(struct ARexxCmd *cmd, struct RexxMsg *msg)
{
/* Not yet written, obviously, but I will set cmd & msg params to be
registers as mentioned in arexx_cl.doc */
return;
}
-----SNIP---------------------------------
Can someone tell me where I am going wrong when setting up my
AREXX_Commands pointer/structure array, or if the class is just dodgy and I
should revert to the traditional method?
Any help would be great. I would like to use the newer methods if possible.
-
Hi Steady,
I've tried to compile your code - and it works fine.
But I'm afraid there is a bug when you check the errorcode.
When the object is created, the code in retVal is invalid.
So you must write
if (sim.obj[OBJ_AREXX])
instead of
if (retVal)
I used StormC 4 for this :)
greetings from germany
cygnusEd
-
Hey, thanks a lot cygnusEd. I think you hit the nail on the head. I suspected it would be a simple error on my behalf, but sometimes you just can't see it when you look.
Cheers,
Jason.
-
Wow, I heard that CygnusEd came with good online help, but that's incredible :-)
-
Hi Jason,
Great - I'm happy about this.
Maybe you are interested in some example-code. I'm a co-author
of the fractal-renderer FlashMandelWOS. I've implemented an
arexx-port using the arexx-class and the gui-creator Reactor.
The sources are totally free.
If you like, you can download it under:
http://www.schwan-clan.de/amiga/FlashMandel_GB.shtml
CU
cygnusEd
-
@ cygnusEd
Thanks for the sample code. I will have a look. Also found some in the ClassAct demo lha. Pretty obvious now I think about it. I tried the fix out last night and now have some working ARexx - yippee! My little toy is nearly finished now. Just need to do docs, install script and examples and the bulk is done. I also notice it was your first post, so welcome to amiga.org (although like me you probably lurked for ages).
Thanks again.
@ Karlos
:-D