Welcome, Guest. Please login or register.

Author Topic: AREXX class  (Read 2961 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline SteadyTopic starter

AREXX class
« 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.
 

Offline cygnusEd

  • Newbie
  • *
  • Join Date: Mar 2003
  • Posts: 10
    • Show only replies by cygnusEd
    • http://www.schwan-clan.de
Re: AREXX class
« Reply #1 on: March 05, 2003, 07:03:29 PM »
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
 

Offline SteadyTopic starter

Re: AREXX class
« Reply #2 on: March 05, 2003, 08:06:24 PM »
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.
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: AREXX class
« Reply #3 on: March 06, 2003, 11:50:12 AM »
Wow, I heard that CygnusEd came with good online help, but that's incredible :-)
int p; // A
 

Offline cygnusEd

  • Newbie
  • *
  • Join Date: Mar 2003
  • Posts: 10
    • Show only replies by cygnusEd
    • http://www.schwan-clan.de
Re: AREXX class
« Reply #4 on: March 06, 2003, 03:19:09 PM »
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
 

Offline SteadyTopic starter

Re: AREXX class
« Reply #5 on: March 06, 2003, 05:07:35 PM »
@ 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