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.
20 # define SLANG_SYSTEM_NAME "_VMS"
22 # if defined (__GO32__) || defined (__EMX__) || \
23 defined (msdos) || defined (__os2__)
24 # define SLANG_SYSTEM_NAME "_IBMPC"
26 # define SLANG_SYSTEM_NAME "_UNIX"
31 #define SLANG_MAX_SYMBOLS 500
33 #define SLANG_MAX_SYMBOLS 2500
35 /* maximum number of global symbols--- slang builtin, functions, global vars */
38 /* These quantities are main_types for byte-compiled code. They are used
39 * by the inner_interp routine. The ones commented out with a // are
40 * actually defined in slang.h because they are also used as the main_type in
44 /* // #define SLANG_LVARIABLE 0x01 */
45 #define SLANG_LOGICAL 0x02
46 #define SLANG_BINARY 0x03
47 /* // #define SLANG_INTRINSIC 0x06 */
48 /* // #define SLANG_FUNCTION 0x07 */
49 #define SLANG_LITERAL 0x08 /* constant objects */
50 #define SLANG_BLOCK 0x09
51 #define SLANG_EQS 0x0A
52 #define SLANG_UNARY 0x0B
53 #define SLANG_LUNARY 0x0C
55 /* // #define SLANG_GVARIABLE 0x0D */
56 /* // #define SLANG_IVARIABLE 0x0E */ /* intrinsic variables */
57 /* // #define SLANG_RVARIABLE 0x0F */ /* read only variable */
59 /* These 3 MUST be in this order too ! */
60 #define SLANG_RETURN 0x10
61 #define SLANG_BREAK 0x11
62 #define SLANG_CONTINUE 0x12
64 #define SLANG_EXCH 0x13
65 #define SLANG_LABEL 0x14
66 #define SLANG_LOBJPTR 0x15
67 #define SLANG_GOBJPTR 0x16
68 #define SLANG_X_ERROR 0x17
69 /* These must be in this order */
70 #define SLANG_X_USER0 0x18
71 #define SLANG_X_USER1 0x19
72 #define SLANG_X_USER2 0x1A
73 #define SLANG_X_USER3 0x1B
74 #define SLANG_X_USER4 0x1C
77 # define SLANG_NOOP_DIRECTIVE 0x2F
80 /* If SLANG_DATA occurs as the main_type for an object in the interpreter's
81 * byte-code, it currently refers to a STRING.
83 /* // #define SLANG_DATA 0x30 */ /* real objects which may be destroyed */
87 #define ERROR_BLOCK 0x01
88 /* gets executed if block encounters error other than stack related */
89 #define EXIT_BLOCK 0x02
90 #define USER_BLOCK0 0x03
91 #define USER_BLOCK1 0x04
92 #define USER_BLOCK2 0x05
93 #define USER_BLOCK3 0x06
94 #define USER_BLOCK4 0x07
95 /* The user blocks MUST be in the above order */
97 /* directive subtypes */
98 #define SLANG_LOOP_MASK 0x80
99 #define SLANG_LOOP 0x81
100 #define SLANG_WHILE 0x82
101 #define SLANG_FOR 0x83
102 #define SLANG_FOREVER 0x84
103 #define SLANG_CFOR 0x85
104 #define SLANG_DOWHILE 0x86
106 #define SLANG_IF_MASK 0x40
107 #define SLANG_IF 0x41
108 #define SLANG_IFNOT 0x42
109 #define SLANG_ELSE 0x43
112 /* local, global variable assignments
113 * The order here is important. See interp_variable_eqs to see how this
115 #define SLANG_EQS_MASK 0x20
116 /* local variables */
117 /* Keep these in this order!! */
118 #define SLANG_LEQS 0x21
119 #define SLANG_LPEQS 0x22
120 #define SLANG_LMEQS 0x23
121 #define SLANG_LPP 0x24
122 #define SLANG_LMM 0x25
124 /* Keep this on this order!! */
125 #define SLANG_GEQS 0x26
126 #define SLANG_GPEQS 0x27
127 #define SLANG_GMEQS 0x28
128 #define SLANG_GPP 0x29
129 #define SLANG_GMM 0x2A
130 /* intrinsic variables */
131 #define SLANG_IEQS 0x2B
132 #define SLANG_IPEQS 0x2C
133 #define SLANG_IMEQS 0x2D
134 #define SLANG_IPP 0x2E
135 #define SLANG_IMM 0x2F
138 #define SLANG_ELSE_MASK 0x10
139 #define SLANG_ANDELSE 0x11
140 #define SLANG_ORELSE 0x12
141 #define SLANG_SWITCH 0x13
143 /* LOGICAL SUBTYPES (operate on integers) */
147 #define SLANG_BAND 19
149 #define SLANG_BXOR 21
153 /* LUnary Subtypes */
155 #define SLANG_BNOT 25
157 typedef struct SLBlock_Type
159 unsigned char main_type
;
160 unsigned char sub_type
;
163 struct SLBlock_Type
*blk
;
165 SLang_Name_Type
*n_blk
;
168 float64
*f_blk
; /*literal float is a pointer */
179 unsigned char main_type
; /* block, intrinsic... */
180 unsigned char sub_type
; /* SLANG_WHILE, SLANG_DATA, ... */
186 SLuser_Object_Type
*uobj
;
187 SLang_Name_Type
*n_val
;
195 extern void SLang_free_object (SLang_Object_Type
*);
197 extern int SLang_pop_non_object (SLang_Object_Type
*);
199 extern void _SLdo_error (char *, ...);
200 extern void SLcompile(char *);
201 extern void (*SLcompile_ptr
)(char *);
205 char *name
; int type
;
208 extern void SLstupid_hash(void);
210 typedef struct SLName_Table
212 struct SLName_Table
*next
; /* next table */
213 SLang_Name_Type
*table
; /* pointer to table */
214 int n
; /* entries in this table */
215 char name
[32]; /* name of table */
216 int ofs
[256]; /* offsets into table */
219 extern SLName_Table
*SLName_Table_Root
;
221 extern SLang_Name_Type
*SLang_Name_Table
;
223 extern SLang_Name_Type SLang_Name_Table
[SLANG_MAX_SYMBOLS
];
226 extern SLang_Name2_Type SL_Binary_Ops
[];
227 extern SLang_Object_Type
*SLStack_Pointer
;
228 extern char *SLbyte_compile_name(char *);
229 extern int SLang_pop(SLang_Object_Type
*);
230 extern char *SLexpand_escaped_char(char *, char *);
231 extern void SLexpand_escaped_string (char *, char *, char *);
233 extern SLang_Object_Type
*_SLreverse_stack (int);
234 extern SLang_Name_Type
*SLang_locate_name(char *);
236 /* returns a pointer to a MALLOCED string */
237 extern char *SLstringize_object (SLang_Object_Type
*);
240 typedef struct SLArray_Type
242 unsigned char type
; /* int, float, etc... */
243 int dim
; /* # of dims (max 3) */
244 int x
, y
, z
; /* actual dims */
247 unsigned char *c_ptr
;
248 unsigned char **s_ptr
;
253 SLuser_Object_Type
**u_ptr
;
256 unsigned char flags
; /* readonly, etc... If this is non-zero,
257 * the buf pointer will NOT be freed.
258 * See SLarray_free_array.
263 /* Callback to delete array */
264 extern void SLarray_free_array (long *);
267 /* maximum size of run time stack */
269 #define SLANG_MAX_STACK_LEN 500
271 #define SLANG_MAX_STACK_LEN 2500
275 extern SLang_Object_Type
*SLRun_Stack
;
277 extern SLang_Object_Type SLRun_Stack
[SLANG_MAX_STACK_LEN
];
280 extern SLang_Object_Type
*SLStack_Pointer
;
282 extern int SLang_Trace
;
283 extern int SLstack_depth(void);
285 extern void SLang_trace_fun(char *);
286 extern void SLexecute_function(SLang_Name_Type
*);
287 extern char *SLmake_string (char *);
289 extern int _SLeqs_name(char *, SLang_Name2_Type
*);
290 extern void SLang_push(SLang_Object_Type
*);
291 extern void SLang_push_float(float64
);
292 extern void SLadd_variable(char *);
293 extern void SLang_clear_error(void);
294 extern void SLarray_info (void);
295 extern int SLPreprocess_Only
; /* preprocess instead of
299 extern void SLdo_pop (void);
300 extern unsigned int SLsys_getkey (void);
301 extern int SLsys_input_pending (int);
303 #ifdef REAL_UNIX_SYSTEM
304 extern int SLtt_tigetflag (char *, char **);
305 extern int SLtt_tigetnum (char *, char **);
306 extern char *SLtt_tigetstr (char *, char **);
307 extern char *SLtt_tigetent (char *);
311 #define MAX_INPUT_BUFFER_LEN 40
313 #define MAX_INPUT_BUFFER_LEN 1024
315 extern unsigned char SLang_Input_Buffer
[MAX_INPUT_BUFFER_LEN
];
316 extern unsigned int SLang_Input_Buffer_Len
;
318 extern int SLregister_types (void);
321 extern char *SLtt_Graphics_Char_Pairs
;
322 #endif /* NOT pc_system */
324 extern void _SLerrno_set_return_status (void);
325 extern char *_SLerrno_strerror (void);
326 extern int _SLerrno_Return_Status
;