forked from adesutherland/CMS-370-BREXX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmsfunc.c
136 lines (119 loc) · 3.19 KB
/
cmsfunc.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/*
These routines provide the CMS specific interfcaes for REXX
Dave Wade - 15-Jan-2006
Released into the Public Domain
*/
#include "lstring.h"
#include "lerror.h"
#include <cmssys.h>
/* following are C equivalents of flags in the NUCON macro */
/* CMS OPtions Byte */
#define CMSOPT 0x5e0
#define NOABBREV 0x10
#define NOIMPEX 0x80
#define NOIMPCP 0x40
#define NOSTDSYN 0x20
#define NOPAGREL 0x08
#define NOVMREAD 0x04
/* MISC Flags */
#define MISFLAGS 0x5e1
#define KXSWITCH 0x80
#define KOSWITCH 0x40
#define RELPAGES 0x20
#define GRAFDEV 0x10
#define QSWITCH 0x08
#define NODDISC 0x04
#define NEGITS 0x02
#define ATTNHIT 0x01
/* Message Flags */
#define MSGFLAGS 0x5e2
#define NOTYPOUT 0x80
#define NOTYPING 0x40
#define NORDYMSG 0x20
#define NORDYTIM 0x10
#define REDERRID 0x08
#define NOERRMSG 0x04
#define NOERRTXT 0x02
#define SPECCLF 0x01
/* EXECTRAC */
#define EXECFLAGS 0x5e6
#define EXECTRAC 0x80
/* CMS Protection flags */
#define PROTFLAGS 0x5e7
#define PRFPOFF 0x80
/* SUBSET Flags */
#define SUBFLAGS 0x5e9
#define SUBACT 0x01
/* DOS Flags */
#define DOSFLAGS 0x4d8
#define DOSMODE 0x80
/*
* Process the CMS Flag function
*
* Peek into the Nucleus
*/
/* ------------------ cmsflag ---------------- */
void __CDECL
CMSFLAG(const PLstr value, const PLstr flag) {
int optval;
unsigned char *optptr, opbyte, misbyte, msgbyte, execbyte;
unsigned char dosbyte, subbyte, protbyte;
char *sflag;
optptr = (unsigned char *) CMSOPT;
opbyte = optptr[0];
misbyte = optptr[1];
msgbyte = optptr[2];
execbyte = optptr[6];
protbyte = optptr[7];
subbyte = optptr[9];
optptr = (unsigned char *) DOSFLAGS;
dosbyte = optptr[0];
Context *context = (Context *) CMSGetPG();
L2STR(flag);
Lupper(flag);
sflag = LSTR(*flag);
if (!strcmp(sflag, "ABBREV")) {
optval = ((opbyte & NOABBREV) == 0);
} else if (!strcmp(sflag, "AUTOREAD")) {
optval = ((opbyte & NOVMREAD) == 0);
} else if (!strcmp(sflag, "CMSTYPE")) {
optval = ((msgbyte & NOTYPING) == 0);
} else if (!strcmp(sflag, "DOS")) {
optval = ((dosbyte & DOSMODE) != 0);
} else if (!strcmp(sflag, "EXECTRAC")) {
optval = ((execbyte & EXECTRAC) != 0);
} else if (!strcmp(sflag, "IMPCP")) {
optval = ((opbyte & NOIMPCP) == 0);
} else if (!strcmp(sflag, "IMPEX")) {
optval = ((opbyte & NOIMPEX) == 0);
} else if (!strcmp(sflag, "PROTECT")) {
optval = ((protbyte & PRFPOFF) == 0);
} else if (!strcmp(sflag, "RELPAGE")) {
optval = ((opbyte & NOPAGREL) == 0);
} else if (!strcmp(sflag, "SUBSET")) {
optval = 1 - ((subbyte & SUBACT) == 0);
} else {
/* fprintf(stderr,"Illegal CMS sflag %s\n",sflag); */
(context->lstring_Lerror)(ERR_INCORRECT_CALL, 0);
}
Licpy(value, optval);
} /* CMSFLAG */
/*
return the CMS line Length
*/
CMSLINE(const PLstr value) {
int optval;
optval = diag24();
Licpy(value, optval);
} /* CMS Line */
CMSUSER(const PLstr value) {
char userid[9];
getusr(userid);
userid[8] = 0x00;
Lscpy(value, userid);
} /* CMSUESER */
CMSSTORE(const PLstr value) {
int store;
store = diag60();
Licpy(value, store);
} /* CMSSTORE */