forwarding a patch that uses the fetch macros to pull in acpica and build it (NicJA).
[AROS.git] / compiler / alib / checkrexxmsg.c
blob0885d7e9ff1e2d851474f118c5e19d974511662b
1 /*
2 Copyright © 1995-2015, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
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 /*****************************************************************************
16 NAME */
18 BOOL CheckRexxMsg(
20 /* SYNOPSIS */
21 struct RexxMsg * msg)
23 /* FUNCTION
24 Check to see if provided message was generated by the rexx interpreter
26 INPUTS
27 msg - The message to check
29 RESULT
30 Whether this message is OK.
32 NOTES
34 EXAMPLE
36 BUGS
38 SEE ALSO
39 SetRexxVar(), GetRexxVar()
41 INTERNALS
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;
51 BOOL retval = FALSE;
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);
69 msg3 = NULL;
70 while (msg3!=msg2)
72 WaitPort(port);
73 msg3 = (struct RexxMsg *)GetMsg(port);
74 if (msg3!=msg2) ReplyMsg((struct Message *)msg3);
77 retval = msg3->rm_Result1==RC_OK;
79 cleanup:
80 if (msg2!=NULL) DeleteRexxMsg(msg2);
81 if (port!=NULL) DeletePort(port);
82 if (RexxSysBase!=NULL) CloseLibrary(RexxSysBase);
83 return retval;
84 } /* CheckRexxMsg */