bringing SDL 1.2.14 from vendor into the main branch
[AROS-Contrib.git] / rexx / inc / rexx.h
blob9f396bcb6b0c2df7c9582f46313d3e324ae7ceab
1 /*
2 * $Header$
3 * $Log$
4 * Revision 1.2 2001/08/27 18:05:53 falemagn
5 * removed ## from the definition of VERSION because it's unneeded and would make gcc-3.0 fail the compilation
7 * Revision 1.1 2001/04/04 05:43:37 wang
8 * First commit: compiles on Linux, Amiga, Windows, Windows CE, generic gcc
10 * Revision 1.5 2000/04/07 07:17:10 bnv
11 * Release 2.0.3
13 * Revision 1.4 1999/11/29 14:58:00 bnv
14 * Changed: Some defines
16 * Revision 1.3 1999/05/14 13:08:00 bnv
17 * Release 2.0.1
19 * Revision 1.2 1999/03/10 16:58:05 bnv
20 * New release 2.0
22 * Revision 1.1 1998/07/02 17:35:50 bnv
23 * Initial revision
28 * Defined symbols in makefile
29 * __DEBUG__ enable debuging
30 * MSDOS MSDOS compilation routines
31 * __BORLANDC__ to enable PORT,INTR,STORAGE()
32 * ALIGN to enable DWORD align instead of byte
33 * INLINE to inline some functions
35 #ifndef __REXX_H_
36 #define __REXX_H_
38 #include <setjmp.h>
40 #include <lerror.h>
41 #include <lstring.h>
43 #include <dqueue.h>
44 #include <bintree.h>
45 #include <variable.h>
47 #ifdef __REXX_C__
48 # define EXTERN
49 # ifdef __BORLANDC__
50 extern unsigned _stklen = 32000U;
51 # endif
52 #else
53 # define EXTERN extern
54 #endif
56 /* ------------ some defines ------------------ */
57 #define VERSION "ARexx V0.5.0 " __DATE__
58 #define AUTHOR "Mario Cassani, from BRexx 2.0.3 by Vassilis N. Vlachoudis"
59 #define REGAPPKEY TEXT("Software\\Marmita\\BRexx")
60 #define SCIENTIFIC 0
61 #define ENGINEERING 1
63 #define MAXARGS 15
64 #define PROC_INC 10
65 #define CLAUSE_INC 100
66 #define CODE_INC 256
67 #define STCK_SIZE 255
69 /* call types */
70 #define CT_PROGRAM 0
71 #define CT_PROCEDURE 1
72 #define CT_FUNCTION 2
73 #define CT_INTERPRET 3
74 #define CT_INTERACTIVE 4
76 /* signal on condition */
77 #define SC_ERROR 0x01
78 #define SC_HALT 0x02
79 #define SC_NOVALUE 0x04
80 #define SC_NOTREADY 0x08
81 #define SC_SYNTAX 0x10
83 /* long jmp values */
84 #define JMP_CONTINUE 2
85 #define JMP_ERROR 98
86 #define JMP_EXIT 99
88 /* rexx variables */
89 #define RCVAR 0
90 #define SIGLVAR 1
92 #ifdef ALIGN
93 # define CTYPE dword
94 #else
95 # define CTYPE word
96 #endif
98 /* ----------------- file structure --------------- */
99 typedef
100 struct trxfile {
101 Lstr filename; /* filename */
102 char *filetype; /* filetype in filename */
103 Lstr file; /* actual file */
104 struct trxfile *next; /* prev in list */
105 } RxFile;
107 /* ------------- clause structure ----------------- */
108 typedef
109 struct tclause {
110 size_t code; /* code start position */
111 size_t line; /* line number in file */
112 int nesting; /* nesting level */
113 char *ptr; /* pointer in file */
114 RxFile *fptr; /* RxFile pointer */
115 } Clause;
117 /* ----------------- ident info ------------------- */
118 typedef
119 struct tidentinfo {
120 int id; /* the last prg that set leaf value */
121 int stem; /* if it is a stem */
122 PBinLeaf leaf[1]; /* Variable array of leafs */
123 /* Variable value if stem=0 OR */
124 /* pointers to litterals */
125 } IdentInfo;
127 /* ------------ argument structure ---------------- */
128 typedef
129 struct targs {
130 int n; /* number of args */
131 PLstr r; /* return data */
132 PLstr a[MAXARGS]; /* argument pointers */
133 } Args;
135 /* ------------ internal rexxfunctions ------------ */
136 typedef
137 struct tbltfunc {
138 char *name;
139 void (*func)(int);
140 int opt;
141 } TBltFunc;
143 /* ----------- proc data structure ---------------- */
144 typedef
145 struct trxproc {
146 int id; /* procedure id */
147 int calltype; /* call type... */
148 size_t ip; /* instruction pointer */
149 size_t stack; /* stack position */
150 size_t stacktop; /* stack after args */
151 Scope scope; /* Variables */
152 Args arg; /* stck pos of args */
153 PLstr env; /* environment */
154 int digits; /* numeric digits */
155 int fuzz; /* numeric fuzz */
156 int form; /* numeric form */
157 int condition; /* signal on condition */
158 PLstr lbl_error; /* labels */
159 PLstr lbl_halt; /* */
160 PLstr lbl_novalue; /* */
161 PLstr lbl_notready; /* */
162 PLstr lbl_syntax; /* */
163 int codelen; /* used in interpret_mn */
164 int clauselen; /* used in interpret_mn */
165 int trace; /* trace type */
166 bool interactive_trace;
167 } RxProc;
169 /* ------------- global variables ----------------- */
170 #ifdef __DEBUG__
171 EXTERN int __debug__;
172 #endif
173 #if defined(WIN32) || defined(WCE)
174 EXTERN TCHAR *_szRxAppKey;
175 #endif
176 EXTERN char *_prgname; /* point to argv[0] */
177 EXTERN jmp_buf _error_trap; /* error trap for compile */
178 EXTERN jmp_buf _exit_trap; /* exit from prg */
180 EXTERN DQueue StackList; /* dble queue of dble queues */
182 EXTERN RxFile *rxfile; /* rexx file list */
183 EXTERN int RxReturnCode; /* Global return code */
185 EXTERN int _procidcnt; /* procedure id counter */
186 EXTERN RxProc *_Proc; /* procedure & function array */
187 EXTERN int _nesting; /* cur nesting set by TraceCurline */
188 EXTERN int _rx_proc; /* current procedure id */
189 EXTERN int _Proc_size; /* number of items in proc list */
191 EXTERN PLstr _code; /* code of program */
192 EXTERN BinTree _labels; /* Labels */
194 EXTERN Args Rxarg; /* global arguments for internal routines */
196 EXTERN BinTree Litterals; /* Litterals */
197 EXTERN BinLeaf *NullStr, /* basic leaf Lstrings */
198 *ZeroStr,
199 *OneStr,
200 *ResultStr,
201 *SiglStr,
202 *RCStr,
203 *ErrorStr,
204 *HaltStr,
205 *SyntaxStr,
206 *SystemStr,
207 *NoValueStr,
208 *NotReadyStr;
210 /* ============= function prototypes ============== */
211 void RxInitialize( char *program_name );
212 void RxFinalize( void );
213 int RxRun( char *filename, PLstr programstr,
214 PLstr arguments, PLstr tracestr, char *environment );
216 int RxRegFunction( char *name, void (*func)(int), int opt );
218 void RxHaltTrap( int );
219 void RxSignalCondition( int );
221 int RxRedirectCmd(PLstr cmd, int in, int out, PLstr resultstr);
222 int RxExecuteCmd( PLstr cmd, PLstr env );
224 #undef EXTERN
225 #endif