-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrexx.h
232 lines (193 loc) · 5.34 KB
/
rexx.h
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
/* Modified for VM/370 CMS and GCC by Robert O'Hara, July 2010. */
/*
* $Id: rexx.h,v 2.3 2008/07/15 07:40:07 bnv Exp $
* $Log: rexx.h,v $
* Revision 2.3 2008/07/15 07:40:07 bnv
* MVS, CMS support
*
* Revision 2.2 2004/08/16 15:33:00 bnv
* Changed: name of mnemonic operands from xxx_mn to O_XXX
*
* Revision 2.1 2003/02/26 16:33:09 bnv
* Version 2.1
*
* Revision 1.11 2003/02/12 16:39:17 bnv
* 2.0.8
*
* Revision 1.10 2002/08/19 15:39:09 bnv
* Corrected: Version string
*
* Revision 1.9 2002/07/03 13:14:17 bnv
* Changed: Version string
*
* Revision 1.8 2002/06/11 12:37:56 bnv
* Added: CDECL
*
* Revision 1.7 2002/06/06 08:23:11 bnv
* New Version
*
* Revision 1.6 2001/06/25 18:52:04 bnv
* Header -> Id
*
* Revision 1.5 2000/04/07 07:17:10 bnv
* Release 2.0.3
*
* Revision 1.4 1999/11/29 14:58:00 bnv
* Changed: Some defines
*
* Revision 1.3 1999/05/14 13:08:00 bnv
* Release 2.0.1
*
* Revision 1.2 1999/03/10 16:58:05 bnv
* New release 2.0
*
* Revision 1.1 1998/07/02 17:35:50 bnv
* Initial revision
*
*/
/*
* Defined symbols in makefile
* __DEBUG__ enable debuging
* MSDOS MSDOS compilation routines
* __BORLANDC__ to enable PORT,INTR,STORAGE()
* ALIGN to enable DWORD align instead of byte
* INLINE to inline some functions
*/
#include "lerror.h"
#include "lstring.h"
#include "dqueue.h"
#include "bintree.h"
#include "variable.h"
#ifndef __REXX_H_
#define __REXX_H_
#include <setjmp.h>
/* ------------ some defines ------------------ */
#define VERSIONSTR PACKAGE_STRING" "__DATE__
#define AUTHOR "[email protected]"
#define REGAPPKEY TEXT("Software\\Marmita\\BRexx")
#define SCIENTIFIC 0
#define ENGINEERING 1
#define MAXARGS 15
#define PROC_INC 10
#define CLAUSE_INC 100
#define CODE_INC 256
#define STCK_SIZE 255
/* call types */
#define CT_PROGRAM 0
#define CT_PROCEDURE 1
#define CT_FUNCTION 2
#define CT_INTERPRET 3
#define CT_INTERACTIVE 4
/* signal on condition */
#define SC_ERROR 0x01
#define SC_HALT 0x02
#define SC_NOVALUE 0x04
#define SC_NOTREADY 0x08
#define SC_SYNTAX 0x10
#define SC_FAILURE 0x20
/* long jmp values */
#define JMP_CONTINUE 2
#define JMP_ERROR 98
#define JMP_EXIT 99
/* rexx variables */
#define RCVAR 0
#define SIGLVAR 1
#ifdef ALIGN
# define CTYPE dword
#else
# define CTYPE word
#endif
/* ----------------- file structure --------------- */
typedef
struct trxfile {
Lstr name; /* complete file path */
char *filename; /* filename in name */
char *filetype; /* filetype in name */
void *libHandle; /* Shared library handle*/
Lstr file; /* actual file */
struct trxfile *next; /* prev in list */
} RxFile;
/* ------------- clause structure ----------------- */
typedef
struct tclause {
size_t code; /* code start position */
size_t line; /* line number in file */
int nesting; /* nesting level */
char *ptr; /* pointer in file */
RxFile *fptr; /* RxFile pointer */
} Clause;
/* ----------------- ident info ------------------- */
typedef
struct tidentinfo {
int id; /* the last prg that set leaf value */
int stem; /* if it is a stem */
PBinLeaf leaf[1]; /* Variable array of leafs */
/* Variable value if stem=0 OR */
/* pointers to litterals */
} IdentInfo;
/* ------------ argument structure ---------------- */
typedef
struct targs {
int n; /* number of args */
PLstr r; /* return data */
PLstr a[MAXARGS]; /* argument pointers */
} Args;
/* ------------ internal rexxfunctions ------------ */
typedef
struct tbltfunc {
char *name;
void (__CDECL *func)(int);
int opt;
} TBltFunc;
/* ----------- proc data structure ---------------- */
typedef
struct trxproc {
int id; /* procedure id */
int calltype; /* call type... */
size_t ip; /* instruction pointer */
size_t stack; /* stack position */
size_t stacktop; /* stack after args */
Scope scope; /* Variables */
Args arg; /* stck pos of args */
PLstr env; /* environment */
int digits; /* numeric digits */
int fuzz; /* numeric fuzz */
int form; /* numeric form */
int condition; /* signal on condition */
PLstr lbl_error; /* labels */
PLstr lbl_failure; /* */
PLstr lbl_halt; /* */
PLstr lbl_novalue; /* */
PLstr lbl_notready; /* */
PLstr lbl_syntax; /* */
int codelen; /* used in OP_INTERPRET */
int clauselen; /* used in OP_INTERPRET */
int trace; /* trace type */
bool interactive_trace;
} RxProc;
/* ------------- global variables ----------------- */
#include "context.h"
/* ============= function prototypes ============== */
#ifdef __cplusplus
extern "C" {
#endif
void __CDECL RxInitialize(char *program_name);
void __CDECL RxFinalize(void);
RxFile *__CDECL RxFileAlloc(char *fname);
void __CDECL RxFileFree(RxFile *rxf);
void __CDECL RxFileType(RxFile *rxf);
int __CDECL RxFileLoad(RxFile *rxf);
int __CDECL RxLoadLibrary(PLstr libname);
int __CDECL RxRun(char *filename, PLstr programstr,
PLstr arguments, PLstr tracestr, char *environment);
int __CDECL RxRegFunction(char *name, void (__CDECL *func)(int), int opt);
void __CDECL RxHaltTrap(int);
void __CDECL RxSignalCondition(int);
#if !defined (__CMS__) && !defined(__MVS__)
int __CDECL RxRedirectCmd(PLstr cmd, int in, int out, PLstr resultstr);
#endif
int __CDECL RxExecuteCmd(PLstr cmd, PLstr env);
#ifdef __cplusplus
}
#endif
#endif