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
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
19 * Revision 1.2 1999/03/10 16:58:05 bnv
22 * Revision 1.1 1998/07/02 17:35:50 bnv
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
50 extern unsigned _stklen
= 32000U;
53 # define EXTERN extern
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")
65 #define CLAUSE_INC 100
71 #define CT_PROCEDURE 1
73 #define CT_INTERPRET 3
74 #define CT_INTERACTIVE 4
76 /* signal on condition */
79 #define SC_NOVALUE 0x04
80 #define SC_NOTREADY 0x08
81 #define SC_SYNTAX 0x10
84 #define JMP_CONTINUE 2
98 /* ----------------- file structure --------------- */
101 Lstr filename
; /* filename */
102 char *filetype
; /* filetype in filename */
103 Lstr file
; /* actual file */
104 struct trxfile
*next
; /* prev in list */
107 /* ------------- clause structure ----------------- */
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 */
117 /* ----------------- ident info ------------------- */
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 */
127 /* ------------ argument structure ---------------- */
130 int n
; /* number of args */
131 PLstr r
; /* return data */
132 PLstr a
[MAXARGS
]; /* argument pointers */
135 /* ------------ internal rexxfunctions ------------ */
143 /* ----------- proc data structure ---------------- */
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
;
169 /* ------------- global variables ----------------- */
171 EXTERN
int __debug__
;
173 #if defined(WIN32) || defined(WCE)
174 EXTERN TCHAR
*_szRxAppKey
;
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 */
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
);