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.
18 # define SLANG_SYSTEM_NAME "_VMS"
20 # if defined (__GO32__) || defined (__EMX__) || \
21 defined (msdos) || defined (__os2__)
22 # define SLANG_SYSTEM_NAME "_IBMPC"
24 # define SLANG_SYSTEM_NAME "_UNIX"
29 #define SLANG_MAX_SYMBOLS 500
31 #define SLANG_MAX_SYMBOLS 2500
33 /* maximum number of global symbols--- slang builtin, functions, global vars */
36 /* These quantities are main_types for byte-compiled code. They are used
37 * by the inner_interp routine. The ones commented out with a // are
38 * actually defined in slang.h because they are also used as the main_type in
42 /* // #define SLANG_LVARIABLE 0x01 */
43 #define SLANG_LOGICAL 0x02
44 #define SLANG_BINARY 0x03
45 /* // #define SLANG_INTRINSIC 0x06 */
46 /* // #define SLANG_FUNCTION 0x07 */
47 #define SLANG_LITERAL 0x08 /* constant objects */
48 #define SLANG_BLOCK 0x09
49 #define SLANG_EQS 0x0A
50 #define SLANG_UNARY 0x0B
51 #define SLANG_LUNARY 0x0C
53 /* // #define SLANG_GVARIABLE 0x0D */
54 /* // #define SLANG_IVARIABLE 0x0E */ /* intrinsic variables */
55 /* // #define SLANG_RVARIABLE 0x0F */ /* read only variable */
57 /* These 3 MUST be in this order too ! */
58 #define SLANG_RETURN 0x10
59 #define SLANG_BREAK 0x11
60 #define SLANG_CONTINUE 0x12
62 #define SLANG_EXCH 0x13
63 #define SLANG_LABEL 0x14
64 #define SLANG_LOBJPTR 0x15
65 #define SLANG_GOBJPTR 0x16
66 #define SLANG_X_ERROR 0x17
67 /* These must be in this order */
68 #define SLANG_X_USER0 0x18
69 #define SLANG_X_USER1 0x19
70 #define SLANG_X_USER2 0x1A
71 #define SLANG_X_USER3 0x1B
72 #define SLANG_X_USER4 0x1C
75 # define SLANG_NOOP_DIRECTIVE 0x2F
78 /* If SLANG_DATA occurs as the main_type for an object in the interpreter's
79 * byte-code, it currently refers to a STRING.
81 /* // #define SLANG_DATA 0x30 */ /* real objects which may be destroyed */
85 #define ERROR_BLOCK 0x01
86 /* gets executed if block encounters error other than stack related */
87 #define EXIT_BLOCK 0x02
88 #define USER_BLOCK0 0x03
89 #define USER_BLOCK1 0x04
90 #define USER_BLOCK2 0x05
91 #define USER_BLOCK3 0x06
92 #define USER_BLOCK4 0x07
93 /* The user blocks MUST be in the above order */
95 /* directive subtypes */
96 #define SLANG_LOOP_MASK 0x80
97 #define SLANG_LOOP 0x81
98 #define SLANG_WHILE 0x82
99 #define SLANG_FOR 0x83
100 #define SLANG_FOREVER 0x84
101 #define SLANG_CFOR 0x85
102 #define SLANG_DOWHILE 0x86
104 #define SLANG_IF_MASK 0x40
105 #define SLANG_IF 0x41
106 #define SLANG_IFNOT 0x42
107 #define SLANG_ELSE 0x43
110 /* local, global variable assignments
111 * The order here is important. See interp_variable_eqs to see how this
113 #define SLANG_EQS_MASK 0x20
114 /* local variables */
115 /* Keep these in this order!! */
116 #define SLANG_LEQS 0x21
117 #define SLANG_LPEQS 0x22
118 #define SLANG_LMEQS 0x23
119 #define SLANG_LPP 0x24
120 #define SLANG_LMM 0x25
122 /* Keep this on this order!! */
123 #define SLANG_GEQS 0x26
124 #define SLANG_GPEQS 0x27
125 #define SLANG_GMEQS 0x28
126 #define SLANG_GPP 0x29
127 #define SLANG_GMM 0x2A
128 /* intrinsic variables */
129 #define SLANG_IEQS 0x2B
130 #define SLANG_IPEQS 0x2C
131 #define SLANG_IMEQS 0x2D
132 #define SLANG_IPP 0x2E
133 #define SLANG_IMM 0x2F
136 #define SLANG_ELSE_MASK 0x10
137 #define SLANG_ANDELSE 0x11
138 #define SLANG_ORELSE 0x12
139 #define SLANG_SWITCH 0x13
141 /* LOGICAL SUBTYPES (operate on integers) */
145 #define SLANG_BAND 19
147 #define SLANG_BXOR 21
151 /* LUnary Subtypes */
153 #define SLANG_BNOT 25
155 typedef struct SLBlock_Type
157 unsigned char main_type
;
158 unsigned char sub_type
;
161 struct SLBlock_Type
*blk
;
163 SLang_Name_Type
*n_blk
;
166 float64
*f_blk
; /*literal float is a pointer */
177 unsigned char main_type
; /* block, intrinsic... */
178 unsigned char sub_type
; /* SLANG_WHILE, SLANG_DATA, ... */
184 SLuser_Object_Type
*uobj
;
185 SLang_Name_Type
*n_val
;
193 extern void SLang_free_object (SLang_Object_Type
*);
195 extern int SLang_pop_non_object (SLang_Object_Type
*);
197 extern void _SLdo_error (char *, ...);
198 extern void SLcompile(char *);
199 extern void (*SLcompile_ptr
)(char *);
203 char *name
; int type
;
206 extern void SLstupid_hash(void);
208 typedef struct SLName_Table
210 struct SLName_Table
*next
; /* next table */
211 SLang_Name_Type
*table
; /* pointer to table */
212 int n
; /* entries in this table */
213 char name
[32]; /* name of table */
214 int ofs
[256]; /* offsets into table */
217 extern SLName_Table
*SLName_Table_Root
;
219 extern SLang_Name_Type
*SLang_Name_Table
;
221 extern SLang_Name_Type SLang_Name_Table
[SLANG_MAX_SYMBOLS
];
224 extern SLang_Name2_Type SL_Binary_Ops
[];
225 extern SLang_Object_Type
*SLStack_Pointer
;
226 extern char *SLbyte_compile_name(char *);
227 extern int SLang_pop(SLang_Object_Type
*);
228 extern char *SLexpand_escaped_char(char *, char *);
229 extern void SLexpand_escaped_string (char *, char *, char *);
231 extern SLang_Object_Type
*_SLreverse_stack (int);
232 extern SLang_Name_Type
*SLang_locate_name(char *);
234 /* returns a pointer to a MALLOCED string */
235 extern char *SLstringize_object (SLang_Object_Type
*);
238 typedef struct SLArray_Type
240 unsigned char type
; /* int, float, etc... */
241 int dim
; /* # of dims (max 3) */
242 int x
, y
, z
; /* actual dims */
245 unsigned char *c_ptr
;
246 unsigned char **s_ptr
;
251 SLuser_Object_Type
**u_ptr
;
254 unsigned char flags
; /* readonly, etc... If this is non-zero,
255 * the buf pointer will NOT be freed.
256 * See SLarray_free_array.
261 /* Callback to delete array */
262 extern void SLarray_free_array (long *);
265 /* maximum size of run time stack */
267 #define SLANG_MAX_STACK_LEN 500
269 #define SLANG_MAX_STACK_LEN 2500
273 extern SLang_Object_Type
*SLRun_Stack
;
275 extern SLang_Object_Type SLRun_Stack
[SLANG_MAX_STACK_LEN
];
278 extern SLang_Object_Type
*SLStack_Pointer
;
280 extern int SLang_Trace
;
281 extern int SLstack_depth(void);
283 extern void SLang_trace_fun(char *);
284 extern void SLexecute_function(SLang_Name_Type
*);
285 extern char *SLmake_string (char *);
287 extern int _SLeqs_name(char *, SLang_Name2_Type
*);
288 extern void SLang_push(SLang_Object_Type
*);
289 extern void SLang_push_float(float64
);
290 extern void SLadd_variable(char *);
291 extern void SLang_clear_error(void);
292 extern void SLarray_info (void);
293 extern int SLPreprocess_Only
; /* preprocess instead of
297 extern void SLdo_pop (void);
298 extern unsigned int SLsys_getkey (void);
299 extern int SLsys_input_pending (int);
301 #ifdef REAL_UNIX_SYSTEM
302 extern int SLtt_tigetflag (char *, char **);
303 extern int SLtt_tigetnum (char *, char **);
304 extern char *SLtt_tigetstr (char *, char **);
305 extern char *SLtt_tigetent (char *);
309 #define MAX_INPUT_BUFFER_LEN 40
311 #define MAX_INPUT_BUFFER_LEN 1024
313 extern unsigned char SLang_Input_Buffer
[MAX_INPUT_BUFFER_LEN
];
314 extern unsigned int SLang_Input_Buffer_Len
;
316 extern int SLregister_types (void);
319 extern char *SLtt_Graphics_Char_Pairs
;
320 #endif /* NOT pc_system */
322 extern void _SLerrno_set_return_status (void);
323 extern char *_SLerrno_strerror (void);
324 extern int _SLerrno_Return_Status
;