-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRexx.c
90 lines (73 loc) · 2.99 KB
/
Rexx.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/****************************************************************************
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
/ / \ \ \ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
/ / INCLUDES / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
\ \ \ \ \ \ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
****************************************************************************/
#include "Public.h"
#include "Rexx.h"
/****************************************************************************
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
/ / \ \ \ \ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
/ / FUNCTIONS / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
\ \ \ \ \ \ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
****************************************************************************/
BOOL InitRexxPort()
{
BOOL return_val = TRUE;
struct MsgPort *test_port;
if ( _norexx == TRUE )
return( TRUE ); // go away because we don't need this shit
EpigramsRxPort = CreateMsgPort();
if ( ! EpigramsRxPort ) {
EpigramsRxPort = NULL;
DoErrors( WARNING,
"I can't prepare Rexx Port",
"bad name specified (slap coder)|REXXMast not loaded?",
"Continue without Rexx Port|Quit" );
return( FALSE );
}
EpigramsRxPort->mp_Node.ln_Name = PORT_NAME;
EpigramsRxPort->mp_Node.ln_Pri = 0;
AddPort( EpigramsRxPort );
return( TRUE );
}
/***************************************************************************/
void CleanUpRexxPort()
{
if ( EpigramsRxPort ) {
struct RexxMsg *msg;
Forbid();
RemPort( EpigramsRxPort );
while ((msg = (struct RexxMsg *)GetMsg(EpigramsRxPort)) != NULL) {
msg->rm_Result1 = RC_FATAL;
msg->rm_Result2 = NULL;
ReplyMsg(msg);
}
Permit();
DeleteMsgPort(EpigramsRxPort);
EpigramsRxPort = NULL;
}
}
/***************************************************************************/
void HandleRexxMsgs( BOOL * quit_prog )
{
struct RexxMsg * msg;
while ( (msg = (struct RexxMsg *)GetMsg(EpigramsRxPort)) != NULL ) {
msg->rm_Result1 = RC_OK;
msg->rm_Result2 = NULL;
if ( (msg->rm_Action & RXCODEMASK) == RXCOMM ) {
// CAN'T SWITCH FOR STRINGS :(
if ( strcmp( ARG0(msg), "POPUP" ) == 0 )
MainGUISequence();
else if ( strcmp( ARG0(msg), "POPOFF" ) == 0 )
interface = FALSE;
else if ( strcmp( ARG0(msg), "QUIT" ) == 0 )
* quit_prog = TRUE;
}
ReplyMsg( msg );
}
}
/***************************************************************************/