1 /* header file for S-Lang internal structures that users do not (should not)
2 need. Use slang.h for that purpose. */
3 /* Copyright (c) 1992, 1995 John E. Davis
6 * You may distribute under the terms of either the GNU General Public
7 * License or the Perl Artistic License.
19 # define SLANG_SYSTEM_NAME "_VMS"
21 # if defined (__GO32__) || defined (__EMX__) || \
22 defined (msdos) || defined (__os2__)
23 # define SLANG_SYSTEM_NAME "_IBMPC"
25 # define SLANG_SYSTEM_NAME "_UNIX"
30 #define SLANG_MAX_SYMBOLS 500
32 #define SLANG_MAX_SYMBOLS 2500
34 /* maximum number of global symbols--- slang builtin, functions, global vars */
37 /* These quantities are main_types for byte-compiled code. They are used
38 * by the inner_interp routine. The ones commented out with a // are
39 * actually defined in slang.h because they are also used as the main_type in
43 /* // #define SLANG_LVARIABLE 0x01 */
44 #define SLANG_LOGICAL 0x02
45 #define SLANG_BINARY 0x03
46 /* // #define SLANG_INTRINSIC 0x06 */
47 /* // #define SLANG_FUNCTION 0x07 */
48 #define SLANG_LITERAL 0x08 /* constant objects */
49 #define SLANG_BLOCK 0x09
50 #define SLANG_EQS 0x0A
51 #define SLANG_UNARY 0x0B
52 #define SLANG_LUNARY 0x0C
54 /* // #define SLANG_GVARIABLE 0x0D */
55 /* // #define SLANG_IVARIABLE 0x0E */ /* intrinsic variables */
56 /* // #define SLANG_RVARIABLE 0x0F */ /* read only variable */
58 /* These 3 MUST be in this order too ! */
59 #define SLANG_RETURN 0x10
60 #define SLANG_BREAK 0x11
61 #define SLANG_CONTINUE 0x12
63 #define SLANG_EXCH 0x13
64 #define SLANG_LABEL 0x14
65 #define SLANG_LOBJPTR 0x15
66 #define SLANG_GOBJPTR 0x16
67 #define SLANG_X_ERROR 0x17
68 /* These must be in this order */
69 #define SLANG_X_USER0 0x18
70 #define SLANG_X_USER1 0x19
71 #define SLANG_X_USER2 0x1A
72 #define SLANG_X_USER3 0x1B
73 #define SLANG_X_USER4 0x1C
76 # define SLANG_NOOP_DIRECTIVE 0x2F
79 /* If SLANG_DATA occurs as the main_type for an object in the interpreter's
80 * byte-code, it currently refers to a STRING.
82 /* // #define SLANG_DATA 0x30 */ /* real objects which may be destroyed */
86 #define ERROR_BLOCK 0x01
87 /* gets executed if block encounters error other than stack related */
88 #define EXIT_BLOCK 0x02
89 #define USER_BLOCK0 0x03
90 #define USER_BLOCK1 0x04
91 #define USER_BLOCK2 0x05
92 #define USER_BLOCK3 0x06
93 #define USER_BLOCK4 0x07
94 /* The user blocks MUST be in the above order */
96 /* directive subtypes */
97 #define SLANG_LOOP_MASK 0x80
98 #define SLANG_LOOP 0x81
99 #define SLANG_WHILE 0x82
100 #define SLANG_FOR 0x83
101 #define SLANG_FOREVER 0x84
102 #define SLANG_CFOR 0x85
103 #define SLANG_DOWHILE 0x86
105 #define SLANG_IF_MASK 0x40
106 #define SLANG_IF 0x41
107 #define SLANG_IFNOT 0x42
108 #define SLANG_ELSE 0x43
111 /* local, global variable assignments
112 * The order here is important. See interp_variable_eqs to see how this
114 #define SLANG_EQS_MASK 0x20
115 /* local variables */
116 /* Keep these in this order!! */
117 #define SLANG_LEQS 0x21
118 #define SLANG_LPEQS 0x22
119 #define SLANG_LMEQS 0x23
120 #define SLANG_LPP 0x24
121 #define SLANG_LMM 0x25
123 /* Keep this on this order!! */
124 #define SLANG_GEQS 0x26
125 #define SLANG_GPEQS 0x27
126 #define SLANG_GMEQS 0x28
127 #define SLANG_GPP 0x29
128 #define SLANG_GMM 0x2A
129 /* intrinsic variables */
130 #define SLANG_IEQS 0x2B
131 #define SLANG_IPEQS 0x2C
132 #define SLANG_IMEQS 0x2D
133 #define SLANG_IPP 0x2E
134 #define SLANG_IMM 0x2F
137 #define SLANG_ELSE_MASK 0x10
138 #define SLANG_ANDELSE 0x11
139 #define SLANG_ORELSE 0x12
140 #define SLANG_SWITCH 0x13
142 /* LOGICAL SUBTYPES (operate on integers) */
146 #define SLANG_BAND 19
148 #define SLANG_BXOR 21
152 /* LUnary Subtypes */
154 #define SLANG_BNOT 25
156 typedef struct SLBlock_Type
158 unsigned char main_type
;
159 unsigned char sub_type
;
162 struct SLBlock_Type
*blk
;
164 SLang_Name_Type
*n_blk
;
167 float64
*f_blk
; /*literal float is a pointer */
178 unsigned char main_type
; /* block, intrinsic... */
179 unsigned char sub_type
; /* SLANG_WHILE, SLANG_DATA, ... */
185 SLuser_Object_Type
*uobj
;
186 SLang_Name_Type
*n_val
;
194 extern void SLang_free_object (SLang_Object_Type
*);
196 extern int SLang_pop_non_object (SLang_Object_Type
*);
198 extern void _SLdo_error (char *, ...);
199 extern void SLcompile(char *);
200 extern void (*SLcompile_ptr
)(char *);
204 char *name
; int type
;
207 extern void SLstupid_hash(void);
209 typedef struct SLName_Table
211 struct SLName_Table
*next
; /* next table */
212 SLang_Name_Type
*table
; /* pointer to table */
213 int n
; /* entries in this table */
214 char name
[32]; /* name of table */
215 int ofs
[256]; /* offsets into table */
218 extern SLName_Table
*SLName_Table_Root
;
220 extern SLang_Name_Type
*SLang_Name_Table
;
222 extern SLang_Name_Type SLang_Name_Table
[SLANG_MAX_SYMBOLS
];
225 extern SLang_Name2_Type SL_Binary_Ops
[];
226 extern SLang_Object_Type
*SLStack_Pointer
;
227 extern char *SLbyte_compile_name(char *);
228 extern int SLang_pop(SLang_Object_Type
*);
229 extern char *SLexpand_escaped_char(char *, char *);
230 extern void SLexpand_escaped_string (char *, char *, char *);
232 extern SLang_Object_Type
*_SLreverse_stack (int);
233 extern SLang_Name_Type
*SLang_locate_name(char *);
235 /* returns a pointer to a MALLOCED string */
236 extern char *SLstringize_object (SLang_Object_Type
*);
239 typedef struct SLArray_Type
241 unsigned char type
; /* int, float, etc... */
242 int dim
; /* # of dims (max 3) */
243 int x
, y
, z
; /* actual dims */
246 unsigned char *c_ptr
;
247 unsigned char **s_ptr
;
252 SLuser_Object_Type
**u_ptr
;
255 unsigned char flags
; /* readonly, etc... If this is non-zero,
256 * the buf pointer will NOT be freed.
257 * See SLarray_free_array.
262 /* Callback to delete array */
263 extern void SLarray_free_array (long *);
266 /* maximum size of run time stack */
268 #define SLANG_MAX_STACK_LEN 500
270 #define SLANG_MAX_STACK_LEN 2500
274 extern SLang_Object_Type
*SLRun_Stack
;
276 extern SLang_Object_Type SLRun_Stack
[SLANG_MAX_STACK_LEN
];
279 extern SLang_Object_Type
*SLStack_Pointer
;
281 extern int SLang_Trace
;
282 extern int SLstack_depth(void);
284 extern void SLang_trace_fun(char *);
285 extern void SLexecute_function(SLang_Name_Type
*);
286 extern char *SLmake_string (char *);
288 extern int _SLeqs_name(char *, SLang_Name2_Type
*);
289 extern void SLang_push(SLang_Object_Type
*);
290 extern void SLang_push_float(float64
);
291 extern void SLadd_variable(char *);
292 extern void SLang_clear_error(void);
293 extern void SLarray_info (void);
294 extern int SLPreprocess_Only
; /* preprocess instead of
298 extern void SLdo_pop (void);
299 extern unsigned int SLsys_getkey (void);
300 extern int SLsys_input_pending (int);
302 #ifdef REAL_UNIX_SYSTEM
303 extern int SLtt_tigetflag (char *, char **);
304 extern int SLtt_tigetnum (char *, char **);
305 extern char *SLtt_tigetstr (char *, char **);
306 extern char *SLtt_tigetent (char *);
310 #define MAX_INPUT_BUFFER_LEN 40
312 #define MAX_INPUT_BUFFER_LEN 1024
314 extern unsigned char SLang_Input_Buffer
[MAX_INPUT_BUFFER_LEN
];
315 extern unsigned int SLang_Input_Buffer_Len
;
317 extern int SLregister_types (void);
320 extern char *SLtt_Graphics_Char_Pairs
;
321 #endif /* NOT pc_system */
323 extern void _SLerrno_set_return_status (void);
324 extern char *_SLerrno_strerror (void);
325 extern int _SLerrno_Return_Status
;