2 Copyright © 1995-2018, 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 /* maximum size of a string that represents a signed decimal integer */
32 #define REXXVAR_MAXSTR 11
34 LONG
rxsupp_forbid(struct Library
*RexxSupportBase
, struct RexxMsg
*msg
, UBYTE
**argstring
)
36 char val
[REXXVAR_MAXSTR
+ 1];
43 if (GetRexxVar(msg
, NEST_VAR
, &s
) == RC_OK
)
44 permit_nest
= *(int *)s
;
49 sprintf(val
, "%d", permit_nest
);
58 if (SetRexxVar(msg
, NEST_VAR
, (char *)&permit_nest
, sizeof(int)) != RC_OK
)
64 else /* inforbid == TRUE */
67 sprintf(val
, "%d", forbid_nest
);
70 *argstring
= CreateArgstring(val
, strlen(val
));
74 LONG
rxsupp_permit(struct Library
*RexxSupportBase
, struct RexxMsg
*msg
, UBYTE
**argstring
)
76 char val
[REXXVAR_MAXSTR
+ 1];
83 if (GetRexxVar(msg
, NEST_VAR
, &s
) == RC_OK
)
84 permit_nest
= *(int *)s
;
89 sprintf(val
, "%d", permit_nest
);
91 if (SetRexxVar(msg
, NEST_VAR
, (char *)&permit_nest
, sizeof(int)) != RC_OK
)
97 else /* inforbid == TRUE */
100 sprintf(val
, "%d", forbid_nest
);
109 *argstring
= CreateArgstring(val
, strlen(val
));