2 Copyright © 1995-2006, The AROS Development Team. All rights reserved.
5 Desc: Disable task switching
9 #include <proto/alib.h>
10 #include <proto/exec.h>
11 #include <proto/rexxsyslib.h>
12 #include <exec/types.h>
13 #include <exec/memory.h>
14 #include <rexx/storage.h>
15 #include <rexx/errors.h>
21 #include "rexxsupport_intern.h"
22 #include "rxfunctions.h"
24 /* If not in forbid state keep the Permit() count in a RexxVar from the script,
25 * when in forbid state use local forbid_nest variable to count the Forbid() nesting
26 * this is to avoid calling SetRexxVar when in forbid state
28 static BOOL inforbid
= FALSE
;
29 static int forbid_nest
= 0;
31 LONG
rxsupp_forbid(struct Library
*RexxSupportBase
, struct RexxMsg
*msg
, UBYTE
**argstring
)
40 if (GetRexxVar(msg
, NEST_VAR
, &s
) == RC_OK
)
41 permit_nest
= *(int *)s
;
46 snprintf(val
, 5, "%d", permit_nest
);
55 if (SetRexxVar(msg
, NEST_VAR
, (char *)&permit_nest
, sizeof(int)) != RC_OK
)
61 else /* inforbid == TRUE */
64 snprintf(val
, 5, "%d", forbid_nest
);
67 *argstring
= CreateArgstring(val
, strlen(val
));
71 LONG
rxsupp_permit(struct Library
*RexxSupportBase
, struct RexxMsg
*msg
, UBYTE
**argstring
)
80 if (GetRexxVar(msg
, NEST_VAR
, &s
) == RC_OK
)
81 permit_nest
= *(int *)s
;
86 snprintf(val
, 5, "%d", permit_nest
);
88 if (SetRexxVar(msg
, NEST_VAR
, (char *)&permit_nest
, sizeof(int)) != RC_OK
)
94 else /* inforbid == TRUE */
97 snprintf(val
, 5, "%d", forbid_nest
);
106 *argstring
= CreateArgstring(val
, strlen(val
));