2 Copyright © 1995-2015, The AROS Development Team. All rights reserved.
8 #include <proto/alib.h>
9 #include <proto/exec.h>
10 #include <proto/rexxsyslib.h>
11 #include <rexx/storage.h>
12 #include <rexx/errors.h>
14 /*****************************************************************************
24 Check to see if provided message was generated by the rexx interpreter
27 msg - The message to check
30 Whether this message is OK.
39 SetRexxVar(), GetRexxVar()
42 This function creates a rexx message that is sent to the AREXX
43 port with a RXCHECKMSG command.
46 *****************************************************************************/
48 struct Library
*RexxSysBase
= NULL
;
49 struct RexxMsg
*msg2
= NULL
, *msg3
;
50 struct MsgPort
*port
= NULL
, *rexxport
;
53 RexxSysBase
= OpenLibrary("rexxsyslib.library", 0);
54 if (RexxSysBase
== NULL
) goto cleanup
;
56 if (!IsRexxMsg(msg
)) goto cleanup
;
57 rexxport
= FindPort("REXX");
58 if (rexxport
==NULL
) goto cleanup
;
60 port
= CreateMsgPort();
61 if (port
== NULL
) goto cleanup
;
62 msg2
= CreateRexxMsg(port
, NULL
, NULL
);
63 if (msg2
==NULL
) goto cleanup
;
64 msg2
->rm_Private1
= msg
->rm_Private1
;
65 msg2
->rm_Private2
= msg
->rm_Private2
;
66 msg2
->rm_Action
= RXCHECKMSG
;
68 PutMsg(rexxport
, (struct Message
*)msg2
);
73 msg3
= (struct RexxMsg
*)GetMsg(port
);
74 if (msg3
!=msg2
) ReplyMsg((struct Message
*)msg3
);
77 retval
= msg3
->rm_Result1
==RC_OK
;
80 if (msg2
!=NULL
) DeleteRexxMsg(msg2
);
81 if (port
!=NULL
) DeletePort(port
);
82 if (RexxSysBase
!=NULL
) CloseLibrary(RexxSysBase
);