*** empty log message ***
[midnight-commander.git] / slang / slang-mc.h
blob9bcee4e92ee969926ddee4f9a6308971ea6824c4
1 #ifndef DAVIS_SLANG_H_
2 #define DAVIS_SLANG_H_
3 /* -*- mode: C; mode: fold; -*- */
4 /* Copyright (c) 1992, 1995 John E. Davis
5 * All rights reserved.
6 *
7 * You may distribute under the terms of either the GNU General Public
8 * License or the Perl Artistic License.
9 */
10 #define SLANG_VERSION 9938
12 #ifdef HAVE_SYSTEM_SLANG
13 #error "This file must not be used with system installed S-Lang library"
14 #endif
16 /*{{{ System Dependent Macros and Typedefs */
18 #if defined(__WATCOMC__) && !defined(__QNX__)
19 # ifndef msdos
20 # define msdos
21 # endif
22 # ifndef DOS386
23 # define DOS386
24 # endif
25 # ifndef FLOAT_TYPE
26 # define FLOAT_TYPE
27 # endif
28 # ifndef pc_system
29 # define pc_system
30 # endif
31 #endif /* __watcomc__ */
33 #ifdef unix
34 # ifndef __unix__
35 # define __unix__ 1
36 # endif
37 #endif
39 #ifndef __GO32__
40 # ifdef __unix__
41 # define REAL_UNIX_SYSTEM
42 # endif
43 #endif
45 /* Set of the various defines for pc systems. This includes OS/2 */
46 #ifdef __MSDOS__
47 # ifndef msdos
48 # define msdos
49 # endif
50 # ifndef pc_system
51 # define pc_system
52 # endif
53 #endif
55 #ifdef __GO32__
56 # ifndef pc_system
57 # define pc_system
58 # endif
59 # ifdef REAL_UNIX_SYSTEM
60 # undef REAL_UNIX_SYSTEM
61 # endif
62 #endif
64 #if defined(__EMX__) && defined(OS2)
65 # ifndef pc_system
66 # define pc_system
67 # endif
68 # ifndef __os2__
69 # define __os2__
70 # define NEEDS_LOCAL_DIRENT_H
71 # endif
72 #endif
74 #ifdef __cplusplus
75 extern "C" {
76 #endif
77 #if 0
79 #endif
80 /* ---------------------------- Generic Macros ----------------------------- */
82 /* __SC__ is defined for Symantec C++
83 DOS386 is defined for -mx memory model, 32 bit DOS extender. */
85 #ifdef VOID
86 # undef VOID
87 #endif
89 #if defined(msdos) && !defined(DOS386) & !defined(__WIN32__) && !defined(__GO32__)
90 # ifdef __SC__
91 # include <dos.h>
92 # endif
93 typedef void *VOID_STAR;
94 # define VOID void
95 # include <alloc.h>
96 #else
97 # if defined (__cplusplus) || defined(__STDC__)
98 typedef void *VOID_STAR;
99 # define VOID void
100 # else
101 typedef unsigned char *VOID_STAR;
102 # define VOID unsigned char
103 # endif
104 #endif
106 #if 1
107 typedef int (*FVOID_STAR)(void);
108 #else
109 # define FVOID_STAR VOID_STAR
110 #endif
112 #if defined(msdos) && !defined(DOS386) && !defined(__GO32__) && !defined(__WIN32__)
113 # define SLFREE(buf) farfree((void far *)(buf))
114 # define SLMALLOC(x) farmalloc((unsigned long) (x))
115 # define SLREALLOC(buf, n) farrealloc((void far *) (buf), (unsigned long) (n))
116 # define SLCALLOC(n, m) farcalloc((unsigned long) (n), (unsigned long) (m))
117 #else
118 # if defined(VMS) && !defined(__DECC)
119 # define SLFREE VAXC$FREE_OPT
120 # define SLMALLOC VAXC$MALLOC_OPT
121 # define SLREALLOC VAXC$REALLOC_OPT
122 # define SLCALLOC VAXC$CALLOC_OPT
123 # else
124 # define SLFREE(x) free((char *)(x))
125 # define SLMALLOC malloc
126 # if defined(__cplusplus) && !defined(__BEOS__)
127 # define SLREALLOC(p,n) realloc((malloc_t) (p), (n))
128 # else
129 # define SLREALLOC realloc
130 # endif
131 # define SLCALLOC calloc
132 # endif
133 #endif
135 #ifdef SL_MALLOC_DEBUG
136 # undef SLMALLOC
137 # undef SLCALLOC
138 # undef SLREALLOC
139 # undef SLFREE
140 # define SLMALLOC(x) SLdebug_malloc((unsigned long) (x))
141 # define SLFREE(x) SLdebug_free((unsigned char *)(x))
142 # define SLCALLOC(n, m) SLdebug_calloc((unsigned long) (n), (unsigned long)(m))
143 # define SLREALLOC(p, x) SLdebug_realloc((unsigned char *)(p), (unsigned long)(x))
144 #endif /* SL_MALLOC_DEBUG */
146 extern unsigned char *SLdebug_malloc (unsigned long);
147 extern unsigned char *SLdebug_calloc (unsigned long, unsigned long);
148 extern unsigned char *SLdebug_realloc (unsigned char *, unsigned long);
149 extern void SLdebug_free (unsigned char *);
150 extern void SLmalloc_dump_statistics (void);
151 extern char *SLstrcpy(register char *, register char *);
152 extern int SLstrcmp(register char *, register char *);
153 extern char *SLstrncpy(char *, register char *, register int);
155 extern void SLmemset (char *, char, int);
156 extern char *SLmemchr (register char *, register char, register int);
157 extern char *SLmemcpy (char *, char *, int);
158 extern int SLmemcmp (char *, char *, int);
160 #ifdef float64
161 # undef float64
162 #endif
164 #ifndef FLOAT64_TYPEDEFED
165 # define FLOAT64_TYPEDEFED
166 typedef double float64;
167 #endif
170 /*}}}*/
172 /*{{{ Interpreter Typedefs */
174 #define SLANG_MAX_NAME_LEN 30
175 /* maximum length of an identifier */
176 /* first char in identifiers is the hash */
178 /* Note that long is used for addresses instead of void *. The reason for
179 * this is that I have a gut feeling that sizeof (long) > sizeof(void *)
180 * on some machines. This is certainly the case for MSDOS where addresses
181 * can be 16 bit.
183 typedef struct SLang_Name_Type
185 #ifdef SLANG_STATS
186 int n; /* number of times referenced */
187 #endif
188 char name[SLANG_MAX_NAME_LEN + 2]; /* [0] is hash */
190 unsigned char sub_type;
192 /* Values for main_type may be as follows. The particlular values are
193 * for compatability.
195 #define SLANG_LVARIABLE 0x01
196 #define SLANG_INTRINSIC 0x06
197 #define SLANG_FUNCTION 0x07
198 #define SLANG_GVARIABLE 0x0D
199 #define SLANG_IVARIABLE 0x0E /* intrinsic variables */
200 /* Note!!! For Macro MAKE_VARIABLE below to work, SLANG_IVARIABLE Must
201 be 1 less than SLANG_RVARIABLE!!! */
202 #define SLANG_RVARIABLE 0x0F /* read only variable */
203 unsigned char main_type;
204 long addr;
206 SLang_Name_Type;
209 typedef struct SLang_Load_Type
211 long name; /* file name, string address, ... */
212 long handle; /* FILE *, string address, etc... */
214 char *ptr; /* input pointer to next line in object
215 * to be read.
217 /* Things below here are used by S-Lang. */
218 int type; /* 'F' = file, 'S' = String, etc.. */
219 char *buf; /* buffer for file, etc... */
220 char *(*read)(struct SLang_Load_Type *); /* function to call to read obj */
221 int n; /* line number, etc... */
222 char token[256]; /* token to be parsed */
223 int ofs; /* offset from buf where last read
224 * took place
226 int top_level; /* 1 if at top level of parsing */
227 } SLang_Load_Type;
229 #if defined(ultrix) && !defined(__GNUC__)
230 # ifndef NO_PROTOTYPES
231 # define NO_PROTOTYPES
232 # endif
233 #endif
235 #ifndef NO_PROTOTYPES
236 # define _PROTO(x) x
237 #else
238 # define _PROTO(x) ()
239 #endif
241 typedef struct SL_OOBinary_Type
243 unsigned char sub_type; /* partner type for binary op */
245 /* The function take the binary op as first argument, the operand types
246 * form the second and third parameters and the last two parameters are
247 * pointers to the objects themselves. It is up to the function to push
248 * the result on the stack. It must return 1 if it handled the operation
249 * return zero if the operation is not defined.
251 int (*binary_function)_PROTO((int, unsigned char, unsigned char,
252 VOID_STAR, VOID_STAR));
254 struct SL_OOBinary_Type *next;
256 SL_OOBinary_Type;
258 typedef struct
260 /* Methods */
261 void (*destroy)_PROTO((VOID_STAR));
262 /* called to delete/free the object */
263 char *(*string)_PROTO((VOID_STAR));
264 /* returns a string representation of the object */
265 int (*unary_function)_PROTO((int, unsigned char, VOID_STAR));
266 /* unary operation function */
267 SL_OOBinary_Type *binary_ops;
269 int (*copy_function)_PROTO((unsigned char, VOID_STAR));
270 /* This function is called do make a copy of the object */
271 } SLang_Class_Type;
273 extern SLang_Class_Type *SLang_Registered_Types[256];
275 typedef struct
277 unsigned char main_type; /* SLANG_RVARIABLE, etc.. */
278 unsigned char sub_type; /* int, string, etc... */
279 long *obj; /* address of user structure */
281 /* Everything below is considered private */
282 unsigned int count; /* number of references */
284 SLuser_Object_Type;
287 /*}}}*/
288 /*{{{ Interpreter Function Prototypes */
290 extern volatile int SLang_Error;
291 /* Non zero if error occurs. Must be reset to zero to continue. */
293 extern int SLang_Traceback;
294 /* If non-zero, dump an S-Lang traceback upon error. Available as
295 _traceback in S-Lang. */
297 extern char *SLang_User_Prompt;
298 /* Prompt to use when reading from stdin */
299 extern int SLang_Version;
301 extern void (*SLang_Error_Routine)(char *);
302 /* Pointer to application dependent error messaging routine. By default,
303 messages are displayed on stderr. */
305 extern void (*SLang_Exit_Error_Hook)(char *);
306 extern void SLang_exit_error (char *);
307 extern void (*SLang_Dump_Routine)(char *);
308 /* Called if S-Lang traceback is enabled as well as other debugging
309 routines (e.g., trace). By default, these messages go to stderr. */
311 extern void (*SLang_Interrupt)(void);
312 /* function to call whenever inner interpreter is entered. This is
313 a good place to set SLang_Error to USER_BREAK. */
315 extern void (*SLang_User_Clear_Error)(void);
316 /* function that gets called when '_clear_error' is called. */
317 extern int (*SLang_User_Open_Slang_Object)(SLang_Load_Type *);
318 extern int (*SLang_User_Close_Slang_Object)(SLang_Load_Type *);
319 /* user defined loading routines. */
322 /* If non null, these call C functions before and after a slang function. */
323 extern void (*SLang_Enter_Function)(char *);
324 extern void (*SLang_Exit_Function)(char *);
327 /* Functions: */
329 extern int init_SLang(void);
330 /* This function is mandatory and must be called by all applications */
331 extern int init_SLfiles(void);
332 /* called if fputs, fgets, etc are need in S-Lang */
333 extern int init_SLmath(void);
334 /* called if math functions sin, cos, etc... are needed. */
336 extern int init_SLunix(void);
337 /* unix system functions chmod, stat, etc... */
339 extern int init_SLmatrix(void);
341 extern int SLang_add_table(SLang_Name_Type *, char *);
342 /* add application dependent function table p1 to S-Lang. A name p2 less
343 * than 32 characters must also be supplied.
344 * Returns 0 upon failure or 1 upon success. */
346 extern int SLang_add_global_variable (char *);
347 extern int SLang_load_object(SLang_Load_Type *);
348 extern int SLang_load_file(char *);
349 /* Load a file of S-Lang code for interpreting. If the parameter is
350 NULL, input comes from stdin. */
352 extern void SLang_restart(int);
353 /* should be called if an error occurs. If the passed integer is
354 * non-zero, items are popped off the stack; otherwise, the stack is
355 * left intact. Any time the stack is believed to be trashed, this routine
356 * should be called with a non-zero argument (e.g., if setjmp/longjmp is
357 * called). */
359 extern void SLang_byte_compile_file(char *, int *);
360 /* takes a file of S-Lang code and ``byte-compiles'' it for faster
361 * loading. The new filename is equivalent to the old except that a `c' is
362 * appended to the name. (e.g., init.sl --> init.slc). If the second
363 * parameter is non-zero, preprocess the file only.
366 extern void SLang_autoload(char *, char *);
367 /* Automatically load S-Lang function p1 from file p2. This function
368 is also available via S-Lang */
370 extern char *SLang_load_string(char *);
371 /* Like SLang_load_file except input is from a null terminated string. */
373 extern void SLang_do_pop(void);
374 /* pops item off stack and frees any memory associated with it */
376 extern int SLang_pop_integer(int *);
377 /* pops integer *p0 from the stack. Returns 0 upon success and non-zero
378 * if the stack is empty or a type mismatch occurs, setting SLang_Error.
381 extern int SLpop_string (char **);
382 extern int SLang_pop_string(char **, int *);
383 /* pops string *p0 from stack. If *p1 is non-zero, the string must be
384 * freed after its use. DO NOT FREE p0 if *p1 IS ZERO! Returns 0 upon
385 * success */
387 extern int SLang_pop_float(float64 *, int *, int *);
388 /* Pops float *p1 from stack. If *p3 is non-zero, *p1 was derived
389 from the integer *p2. Returns zero upon success. */
391 extern SLuser_Object_Type *SLang_pop_user_object (unsigned char);
392 extern void SLang_free_user_object (SLuser_Object_Type *);
393 extern void SLang_free_intrinsic_user_object (SLuser_Object_Type *);
394 /* This is like SLang_free_user_object but is meant to free those
395 * that have been declared as intrinsic variables by the application.
396 * Normally an application would never need to call this.
399 extern void SLang_push_user_object (SLuser_Object_Type *);
400 extern SLuser_Object_Type *SLang_create_user_object (unsigned char);
402 extern int SLang_add_unary_op (unsigned char, FVOID_STAR);
403 extern int SLang_add_binary_op (unsigned char, unsigned char, FVOID_STAR);
404 extern int SLang_register_class (unsigned char, FVOID_STAR, FVOID_STAR);
405 extern int SLang_add_copy_operation (unsigned char, FVOID_STAR);
407 extern long *SLang_pop_pointer(unsigned char *, unsigned char *, int *);
408 /* Returns a pointer to object of type *p1,*p2 on top of stack.
409 If *p3 is non-zero, the Object must be freed after use. */
412 extern void SLang_push_float(float64);
413 /* Push Float onto stack */
415 extern void SLang_push_string(char *);
416 /* Push string p1 onto stack */
418 extern void SLang_push_integer(int);
419 /* push integer p1 on stack */
421 extern void SLang_push_malloced_string(char *);
422 /* The normal SLang_push_string mallocs space for the string. This one
423 does not. DO NOT FREE IT IF YOU USE THIS ROUTINE */
425 extern int SLang_is_defined(char *);
426 /* Return non-zero is p1 is defined otherwise returns 0. */
428 extern int SLang_run_hooks(char *, char *, char *);
429 /* calls S-Lang function p1 pushing strings p2 and p3 onto the stack
430 * first. If either string is NULL, it is not pushed. If p1 is not
431 * defined, 0 is returned. */
433 extern int SLang_execute_function(char *);
434 /* Call S-Lang function p1. Returns 0 if the function is not defined
435 * and 1 if it is.
438 extern char *SLang_find_name(char *);
439 /* Return a pointer to p1 in table if it is defined. Returns NULL
440 * otherwise. This is useful when one wants to avoid redundant strings.
443 extern char *SLang_rpn_interpret(char *);
444 /* Interpret string as reverse polish notation */
446 extern void SLang_doerror(char *);
447 /* set SLang_Error and display p1 as error message */
449 extern SLuser_Object_Type *SLang_add_array(char *, long *,
450 int, int, int, int,
451 unsigned char, unsigned char);
452 /* This function has not been tested thoroughly yet. Its purpose is to
453 * allow a S-Lang procedure to access a C array. For example, suppose that
454 * you have an array of 100 ints defined as:
456 * int c_array[100];
458 * By calling something like:
460 * SLang_add_array ("array_name", (long *) c_array, 1, 100, 0, 0,
461 * 'i', SLANG_IVARIABLE);
463 * the array can be accessed by the name 'array_name'. This function
464 * returns -1 upon failure. The 3rd argument specifies the dimension
465 * of the array, the 4th, and 5th arguments specify how many elements
466 * there are in the x,y, and z directions. The last argument must
467 * be one of:
469 * SLANG_IVARIABLE: indicates array is writable
470 * SLANG_RVARIABLE: indicates array is read only
472 * Returns NULL upon failure.
476 extern int SLang_free_array_handle (int);
477 /* This routine may be called by application to free array handle created by
478 * the application. Returns 0 upon success, -1 if the handle is invalid and
479 * -2 if the handle is not associated with a C array.
482 extern char *SLang_extract_list_element(char *, int *, int*);
483 extern void SLexpand_escaped_string (register char *, register char *,
484 register char *);
486 extern SLang_Name_Type *SLang_get_function (char *);
487 /* The parameter is the name of a user defined S-Lang function. This
488 * routine returns NULL if the function does not exist or it returns the
489 * a pointer to it in an internal S-Lang table. This pointer can be used
490 * by 'SLexecute_function' to call the function directly from C.
493 extern void SLexecute_function(SLang_Name_Type *);
494 /* This function allows an application to call a S-Lang function from within
495 * the C program. The parameter must be non-NULL and must have been
496 * previously obtained by a call to 'SLang_get_function'.
498 extern void SLroll_stack (int *);
499 /* If argument *p is positive, the top |*p| objects on the stack are rolled
500 * up. If negative, the stack is rolled down.
503 extern void SLmake_lut (unsigned char *, unsigned char *, unsigned char);
505 extern int SLang_guess_type (char *);
508 /*}}}*/
510 /*{{{ Misc Functions */
512 extern char *SLmake_string (char *);
513 extern char *SLmake_nstring (char *, unsigned int);
514 /* Returns a null terminated string made from the first n characters of the
515 * string.
518 extern char *SLcurrent_time_string (void);
520 extern int SLatoi(unsigned char *);
522 extern int SLang_extract_token(char **, char *, int);
523 /* returns 0 upon failure and non-zero upon success. The first parameter
524 * is a pointer to the input stream which this function will bump along.
525 * The second parameter is the buffer where the token is placed. The third
526 * parameter is used internally by the S-Lang library and should be 0 for
527 * user applications.
530 /*}}}*/
532 /*{{{ SLang getkey interface Functions */
534 #ifdef REAL_UNIX_SYSTEM
535 extern int SLang_TT_Baud_Rate;
536 extern int SLang_TT_Read_FD;
537 #endif
539 extern int SLang_init_tty (int, int, int);
540 /* Initializes the tty for single character input. If the first parameter *p1
541 * is in the range 0-255, it will be used for the abort character;
542 * otherwise, (unix only) if it is -1, the abort character will be the one
543 * used by the terminal. If the second parameter p2 is non-zero, flow
544 * control is enabled. If the last parmeter p3 is zero, output processing
545 * is NOT turned on. A value of zero is required for the screen management
546 * routines. Returns 0 upon success. In addition, if SLang_TT_Baud_Rate ==
547 * 0 when this function is called, SLang will attempt to determine the
548 * terminals baud rate. As far as the SLang library is concerned, if
549 * SLang_TT_Baud_Rate is less than or equal to zero, the baud rate is
550 * effectively infinite.
553 extern void SLang_reset_tty (void);
554 /* Resets tty to what it was prior to a call to SLang_init_tty */
555 #ifdef REAL_UNIX_SYSTEM
556 extern void SLtty_set_suspend_state (int);
557 /* If non-zero argument, terminal driver will be told to react to the
558 * suspend character. If 0, it will not.
560 extern int (*SLang_getkey_intr_hook) (void);
561 #endif
563 #define SLANG_GETKEY_ERROR 0xFFFF
564 extern unsigned int SLang_getkey (void);
565 /* reads a single key from the tty. If the read fails, 0xFFFF is returned. */
567 extern void SLang_ungetkey_string (unsigned char *, unsigned int);
568 extern void SLang_buffer_keystring (unsigned char *, unsigned int);
569 extern void SLang_ungetkey (unsigned char);
570 extern void SLang_flush_input (void);
571 extern int SLang_input_pending (int);
572 extern int SLang_Abort_Char;
573 /* The value of the character (0-255) used to trigger SIGINT */
574 extern int SLang_Ignore_User_Abort;
575 /* If non-zero, pressing the abort character will not result in USER_BREAK
576 * SLang_Error. */
578 extern void SLang_set_abort_signal (void (*)(int));
579 /* If SIGINT is generated, the function p1 will be called. If p1 is NULL
580 * the SLang_default signal handler is called. This sets SLang_Error to
581 * USER_BREAK. I suspect most users will simply want to pass NULL.
584 extern volatile int SLKeyBoard_Quit;
586 #ifdef VMS
587 /* If this function returns -1, ^Y will be added to input buffer. */
588 extern int (*SLtty_VMS_Ctrl_Y_Hook) (void);
589 #endif
590 /*}}}*/
592 /*{{{ SLang Keymap routines */
594 typedef struct SLKeymap_Function_Type
596 char *name;
597 int (*f)(void);
599 SLKeymap_Function_Type;
601 typedef struct SLang_Key_Type
603 unsigned char str[13]; /* key sequence */
604 #define SLKEY_F_INTERPRET 0x01
605 #define SLKEY_F_INTRINSIC 0x02
606 #define SLKEY_F_KEYSYM 0x03
607 unsigned char type; /* type of function */
608 #ifdef SLKEYMAP_OBSOLETE
609 VOID_STAR f; /* function to invoke */
610 #else
611 union
613 char *s;
614 FVOID_STAR f;
615 unsigned int keysym;
618 #endif
619 struct SLang_Key_Type *next; /* */
621 SLang_Key_Type;
623 #define MAX_KEYMAP_NAME_LEN 8
624 typedef struct SLKeyMap_List_Type
626 char name[MAX_KEYMAP_NAME_LEN + 1];
627 SLang_Key_Type *keymap;
628 SLKeymap_Function_Type *functions; /* intrinsic functions */
630 SLKeyMap_List_Type;
632 /* This is arbitrary but I have got to start somewhere */
633 #ifdef msdos
634 #define SLANG_MAX_KEYMAPS 10
635 #else
636 #define SLANG_MAX_KEYMAPS 30
637 #endif
639 extern SLKeyMap_List_Type SLKeyMap_List[SLANG_MAX_KEYMAPS]; /* these better be inited to 0! */
642 extern char *SLang_process_keystring(char *);
644 #ifdef SLKEYMAP_OBSOLETE
645 extern int SLang_define_key1(char *, VOID_STAR, unsigned int, SLKeyMap_List_Type *);
646 /* define key p1 in keymap p4 to invoke function p2. If type p3 is given by
647 * SLKEY_F_INTRINSIC, p2 is an intrinsic function, else it is a string to be
648 * passed to the interpreter for evaluation. The return value is important.
649 * It returns 0 upon success, -1 upon malloc error, and -2 if the key is
650 * inconsistent. SLang_Error is set upon error. */
651 #else
652 extern int SLkm_define_key (char *, FVOID_STAR, SLKeyMap_List_Type *);
653 #endif
655 extern int SLang_define_key(char *, char *, SLKeyMap_List_Type *);
656 /* Like define_key1 except that p2 is a string that is to be associated with
657 * a function in the functions field of p3. This routine calls define_key1.
660 extern int SLkm_define_keysym (char *, unsigned int, SLKeyMap_List_Type *);
662 extern void SLang_undefine_key(char *, SLKeyMap_List_Type *);
664 extern SLKeyMap_List_Type *SLang_create_keymap(char *, SLKeyMap_List_Type *);
665 /* create and returns a pointer to a new keymap named p1 created by copying
666 * keymap p2. If p2 is NULL, it is up to the calling routine to initialize
667 * the keymap.
670 extern char *SLang_make_keystring(unsigned char *);
672 extern SLang_Key_Type *SLang_do_key(SLKeyMap_List_Type *, int (*)(void));
673 /* read a key using keymap p1 with getkey function p2 */
675 extern
676 #ifdef SLKEYMAP_OBSOLETE
677 VOID_STAR
678 #else
679 FVOID_STAR
680 #endif
681 SLang_find_key_function(char *, SLKeyMap_List_Type *);
683 extern SLKeyMap_List_Type *SLang_find_keymap(char *);
685 extern int SLang_Last_Key_Char;
686 extern int SLang_Key_TimeOut_Flag;
689 /*}}}*/
691 /*{{{ SLang Readline Interface */
693 typedef struct SLang_Read_Line_Type
695 struct SLang_Read_Line_Type *prev, *next;
696 unsigned char *buf;
697 int buf_len; /* number of chars in the buffer */
698 int num; /* num and misc are application specific*/
699 int misc;
700 } SLang_Read_Line_Type;
702 /* Maximum size of display */
703 #define SLRL_DISPLAY_BUFFER_SIZE 256
705 typedef struct
707 SLang_Read_Line_Type *root, *tail, *last;
708 unsigned char *buf; /* edit buffer */
709 int buf_len; /* sizeof buffer */
710 int point; /* current editing point */
711 int tab; /* tab width */
712 int len; /* current line size */
714 /* display variables */
715 int edit_width; /* length of display field */
716 int curs_pos; /* current column */
717 int start_column; /* column offset of display */
718 int dhscroll; /* amount to use for horiz scroll */
719 char *prompt;
721 FVOID_STAR last_fun; /* last function executed by rl */
723 /* These two contain an image of what is on the display */
724 unsigned char upd_buf1[SLRL_DISPLAY_BUFFER_SIZE];
725 unsigned char upd_buf2[SLRL_DISPLAY_BUFFER_SIZE];
726 unsigned char *old_upd, *new_upd; /* pointers to previous two buffers */
727 int new_upd_len, old_upd_len; /* length of output buffers */
729 SLKeyMap_List_Type *keymap;
731 /* tty variables */
732 unsigned int flags; /* */
733 #define SL_RLINE_NO_ECHO 1
734 #define SL_RLINE_USE_ANSI 2
735 unsigned int (*getkey)(void); /* getkey function -- required */
736 void (*tt_goto_column)(int);
737 void (*tt_insert)(char);
738 void (*update_hook)(unsigned char *, int, int);
739 /* The update hook is called with a pointer to a buffer p1 that contains
740 * an image of what the update hook is suppoed to produce. The length
741 * of the buffer is p2 and after the update, the cursor is to be placed
742 * in column p3.
744 } SLang_RLine_Info_Type;
746 extern int SLang_RL_EOF_Char;
748 extern SLang_Read_Line_Type * SLang_rline_save_line (SLang_RLine_Info_Type *);
749 extern int SLang_init_readline (SLang_RLine_Info_Type *);
750 extern int SLang_read_line (SLang_RLine_Info_Type *);
751 extern int SLang_rline_insert (char *);
752 extern void SLrline_redraw (SLang_RLine_Info_Type *);
753 extern int SLang_Rline_Quit;
755 /*}}}*/
757 /*{{{ Low Level Screen Output Interface */
759 extern unsigned long SLtt_Num_Chars_Output;
760 extern int SLtt_Baud_Rate;
762 typedef unsigned long SLtt_Char_Type;
764 #define SLTT_BOLD_MASK 0x01000000
765 #define SLTT_BLINK_MASK 0x02000000
766 #define SLTT_ULINE_MASK 0x04000000
767 #define SLTT_REV_MASK 0x08000000
768 #define SLTT_ALTC_MASK 0x10000000
770 extern int SLtt_Screen_Rows;
771 extern int SLtt_Screen_Cols;
772 extern int SLtt_Term_Cannot_Insert;
773 extern int SLtt_Term_Cannot_Scroll;
774 extern int SLtt_Use_Ansi_Colors;
775 extern int SLtt_Ignore_Beep;
776 #if defined(REAL_UNIX_SYSTEM)
777 extern int SLtt_Force_Keypad_Init;
778 #endif
780 #ifndef __GO32__
781 #if defined(VMS) || defined(REAL_UNIX_SYSTEM)
782 extern int SLtt_Blink_Mode;
783 extern int SLtt_Use_Blink_For_ACS;
784 extern int SLtt_Newline_Ok;
785 extern int SLtt_Has_Alt_Charset;
786 extern int SLtt_Has_Status_Line; /* if 0, NO. If > 0, YES, IF -1, ?? */
787 # ifndef VMS
788 extern int SLtt_Try_Termcap;
789 # endif
790 #endif
791 #endif
793 #ifdef msdos
794 extern int SLtt_Msdos_Cheap_Video;
795 #endif
798 extern int SLtt_flush_output (void);
799 extern void SLtt_set_scroll_region(int, int);
800 extern void SLtt_reset_scroll_region(void);
801 extern void SLtt_reverse_video (int);
802 extern void SLtt_bold_video (void);
803 extern void SLtt_begin_insert(void);
804 extern void SLtt_end_insert(void);
805 extern void SLtt_del_eol(void);
806 extern void SLtt_goto_rc (int, int);
807 extern void SLtt_delete_nlines(int);
808 extern void SLtt_delete_char(void);
809 extern void SLtt_erase_line(void);
810 extern void SLtt_normal_video(void);
811 extern void SLtt_cls(void);
812 extern void SLtt_beep(void);
813 extern void SLtt_reverse_index(int);
814 extern void SLtt_smart_puts(unsigned short *, unsigned short *, int, int);
815 extern void SLtt_write_string (char *);
816 extern void SLtt_putchar(char);
817 extern void SLtt_init_video (void);
818 extern void SLtt_reset_video (void);
819 extern void SLtt_get_terminfo(void);
820 extern void SLtt_get_screen_size (void);
821 extern int SLtt_set_cursor_visibility (int);
823 #if defined(VMS) || defined(REAL_UNIX_SYSTEM)
824 extern void SLtt_enable_cursor_keys(void);
825 extern void SLtt_set_term_vtxxx(int *);
826 extern void SLtt_set_color_esc (int, char *);
827 extern void SLtt_wide_width(void);
828 extern void SLtt_narrow_width(void);
829 extern int SLtt_set_mouse_mode (int, int);
830 extern void SLtt_set_alt_char_set (int);
831 extern int SLtt_write_to_status_line (char *, int);
832 extern void SLtt_disable_status_line (void);
833 # ifdef REAL_UNIX_SYSTEM
834 extern char *SLtt_tgetstr (char *);
835 extern int SLtt_tgetnum (char *);
836 extern int SLtt_tgetflag (char *);
837 extern char *SLtt_tigetent (char *);
838 extern char *SLtt_tigetstr (char *, char **);
839 extern int SLtt_tigetnum (char *, char **);
840 # endif
841 #endif
843 extern SLtt_Char_Type SLtt_get_color_object (int);
844 extern void SLtt_set_color_object (int, SLtt_Char_Type);
845 extern void SLtt_set_color (int, char *, char *, char *);
846 extern void SLtt_set_mono (int, char *, SLtt_Char_Type);
847 extern void SLtt_add_color_attribute (int, SLtt_Char_Type);
848 extern void SLtt_set_color_fgbg (int, SLtt_Char_Type, SLtt_Char_Type);
850 /*}}}*/
852 /*{{{ SLang Preprocessor Interface */
854 typedef struct
856 int this_level;
857 int exec_level;
858 int prev_exec_level;
859 char preprocess_char;
860 char comment_char;
861 unsigned char flags;
862 #define SLPREP_BLANK_LINES_OK 1
863 #define SLPREP_COMMENT_LINES_OK 2
865 SLPreprocess_Type;
867 extern int SLprep_open_prep (SLPreprocess_Type *);
868 extern void SLprep_close_prep (SLPreprocess_Type *);
869 extern int SLprep_line_ok (char *, SLPreprocess_Type *);
870 extern int SLdefine_for_ifdef (char *);
871 /* Adds a string to the SLang #ifdef preparsing defines. SLang already
872 defines MSDOS, UNIX, and VMS on the appropriate system. */
873 extern int (*SLprep_exists_hook) (char *, char);
876 /*}}}*/
878 /*{{{ SLsmg Screen Management Functions */
880 #include <stdarg.h>
881 extern void SLsmg_fill_region (int, int, int, int, unsigned char);
882 #ifndef pc_system
883 extern void SLsmg_set_char_set (int);
884 extern int SLsmg_Scroll_Hash_Border;
885 #endif
886 extern void SLsmg_suspend_smg (void);
887 extern void SLsmg_resume_smg (void);
888 extern void SLsmg_erase_eol (void);
889 extern void SLsmg_gotorc (int, int);
890 extern void SLsmg_erase_eos (void);
891 extern void SLsmg_reverse_video (void);
892 extern void SLsmg_set_color (int);
893 extern void SLsmg_normal_video (void);
894 extern void SLsmg_printf (char *, ...);
895 extern void SLsmg_vprintf (char *, va_list);
896 extern void SLsmg_write_string (char *);
897 extern void SLsmg_write_nstring (char *, int);
898 extern void SLsmg_write_char (char);
899 extern void SLsmg_write_nchars (char *, int);
900 extern void SLsmg_write_wrapped_string (char *, int, int, int, int, int);
901 extern void SLsmg_cls (void);
902 extern void SLsmg_refresh (void);
903 extern void SLsmg_touch_lines (int, int);
904 extern int SLsmg_init_smg (void);
905 extern void SLsmg_reset_smg (void);
906 extern unsigned short SLsmg_char_at(void);
907 extern void SLsmg_set_screen_start (int *, int *);
908 extern void SLsmg_draw_hline (int);
909 extern void SLsmg_draw_vline (int);
910 extern void SLsmg_draw_object (int, int, unsigned char);
911 extern void SLsmg_draw_box (int, int, int, int);
912 extern int SLsmg_get_column(void);
913 extern int SLsmg_get_row(void);
914 extern void SLsmg_forward (int);
915 extern void SLsmg_write_color_chars (unsigned short *, unsigned int);
916 extern unsigned int SLsmg_read_raw (unsigned short *, unsigned int);
917 extern unsigned int SLsmg_write_raw (unsigned short *, unsigned int);
919 extern int SLsmg_Display_Eight_Bit;
920 extern int SLsmg_Tab_Width;
921 extern int SLsmg_Newline_Moves;
922 extern int SLsmg_Backspace_Moves;
924 #ifdef pc_system
925 # define SLSMG_HLINE_CHAR 0xC4
926 # define SLSMG_VLINE_CHAR 0xB3
927 # define SLSMG_ULCORN_CHAR 0xDA
928 # define SLSMG_URCORN_CHAR 0xBF
929 # define SLSMG_LLCORN_CHAR 0xC0
930 # define SLSMG_LRCORN_CHAR 0xD9
931 # define SLSMG_RTEE_CHAR 0xB4
932 # define SLSMG_LTEE_CHAR 0xC3
933 # define SLSMG_UTEE_CHAR 0xC2
934 # define SLSMG_DTEE_CHAR 0xC1
935 # define SLSMG_PLUS_CHAR 0xC5
936 /* There are several to choose from: 0xB0, 0xB1, and 0xB2 */
937 # define SLSMG_CKBRD_CHAR 0xB0
938 #else
939 # define SLSMG_HLINE_CHAR 'q'
940 # define SLSMG_VLINE_CHAR 'x'
941 # define SLSMG_ULCORN_CHAR 'l'
942 # define SLSMG_URCORN_CHAR 'k'
943 # define SLSMG_LLCORN_CHAR 'm'
944 # define SLSMG_LRCORN_CHAR 'j'
945 # define SLSMG_CKBRD_CHAR 'a'
946 # define SLSMG_RTEE_CHAR 'u'
947 # define SLSMG_LTEE_CHAR 't'
948 # define SLSMG_UTEE_CHAR 'w'
949 # define SLSMG_DTEE_CHAR 'v'
950 # define SLSMG_PLUS_CHAR 'n'
951 #endif
953 #ifndef pc_system
954 # define SLSMG_COLOR_BLACK 0x000000
955 # define SLSMG_COLOR_RED 0x000001
956 # define SLSMG_COLOR_GREEN 0x000002
957 # define SLSMG_COLOR_BROWN 0x000003
958 # define SLSMG_COLOR_BLUE 0x000004
959 # define SLSMG_COLOR_MAGENTA 0x000005
960 # define SLSMG_COLOR_CYAN 0x000006
961 # define SLSMG_COLOR_LGRAY 0x000007
962 # define SLSMG_COLOR_GRAY 0x000008
963 # define SLSMG_COLOR_BRIGHT_RED 0x000009
964 # define SLSMG_COLOR_BRIGHT_GREEN 0x00000A
965 # define SLSMG_COLOR_BRIGHT_BROWN 0x00000B
966 # define SLSMG_COLOR_BRIGHT_BLUE 0x00000C
967 # define SLSMG_COLOR_BRIGHT_CYAN 0x00000D
968 # define SLSMG_COLOR_BRIGHT_MAGENTA 0x00000E
969 # define SLSMG_COLOR_BRIGHT_WHITE 0x00000F
970 #endif
972 /*}}}*/
974 /*{{{ SLang Keypad Interface */
976 #define SL_KEY_ERR 0xFFFF
978 #define SL_KEY_UP 0x101
979 #define SL_KEY_DOWN 0x102
980 #define SL_KEY_LEFT 0x103
981 #define SL_KEY_RIGHT 0x104
982 #define SL_KEY_PPAGE 0x105
983 #define SL_KEY_NPAGE 0x106
984 #define SL_KEY_HOME 0x107
985 #define SL_KEY_END 0x108
986 #define SL_KEY_A1 0x109
987 #define SL_KEY_A3 0x10A
988 #define SL_KEY_B2 0x10B
989 #define SL_KEY_C1 0x10C
990 #define SL_KEY_C3 0x10D
991 #define SL_KEY_REDO 0x10E
992 #define SL_KEY_UNDO 0x10F
993 #define SL_KEY_BACKSPACE 0x110
994 #define SL_KEY_ENTER 0x111
995 #define SL_KEY_IC 0x112
996 #define SL_KEY_DELETE 0x113
998 #define SL_KEY_F0 0x200
999 #define SL_KEY_F(X) (SL_KEY_F0 + X)
1001 /* I do not intend to use keysymps > 0x1000. Applications can use those. */
1002 /* Returns 0 upon success or -1 upon error. */
1003 int SLkp_define_keysym (char *, unsigned int);
1005 /* This function must be called AFTER SLtt_get_terminfo and not before. */
1006 extern int SLkp_init (void);
1008 /* This function uses SLang_getkey and assumes that what ever initialization
1009 * is required for SLang_getkey has been performed.
1011 extern int SLkp_getkey (void);
1013 /*}}}*/
1015 /*{{{ SLang Scroll Interface */
1017 typedef struct _SLscroll_Type
1019 struct _SLscroll_Type *next;
1020 struct _SLscroll_Type *prev;
1021 unsigned int flags;
1023 SLscroll_Type;
1025 typedef struct
1027 unsigned int flags;
1028 SLscroll_Type *top_window_line; /* list element at top of window */
1029 SLscroll_Type *bot_window_line; /* list element at bottom of window */
1030 SLscroll_Type *current_line; /* current list element */
1031 SLscroll_Type *lines; /* first list element */
1032 unsigned int nrows; /* number of rows in window */
1033 unsigned int hidden_mask; /* applied to flags in SLscroll_Type */
1034 unsigned int line_num; /* current line number (visible) */
1035 unsigned int num_lines; /* total number of lines (visible) */
1036 unsigned int window_row; /* row of current_line in window */
1037 unsigned int border; /* number of rows that form scroll border */
1038 int cannot_scroll; /* should window scroll or recenter */
1040 SLscroll_Window_Type;
1042 extern int SLscroll_find_top (SLscroll_Window_Type *);
1043 extern int SLscroll_find_line_num (SLscroll_Window_Type *);
1044 extern unsigned int SLscroll_next_n (SLscroll_Window_Type *, unsigned int);
1045 extern unsigned int SLscroll_prev_n (SLscroll_Window_Type *, unsigned int);
1046 extern int SLscroll_pageup (SLscroll_Window_Type *);
1047 extern int SLscroll_pagedown (SLscroll_Window_Type *);
1049 /*}}}*/
1051 /*{{{ Signal Routines */
1053 typedef void SLSig_Fun_Type (int);
1054 extern SLSig_Fun_Type *SLsignal (int, SLSig_Fun_Type *);
1055 extern SLSig_Fun_Type *SLsignal_intr (int, SLSig_Fun_Type *);
1056 #ifndef pc_system
1057 extern int SLsig_block_signals (void);
1058 extern int SLsig_unblock_signals (void);
1059 #endif
1060 /*}}}*/
1062 /*{{{ Interpreter Macro Definitions */
1064 /* This value is a main_type just like the other main_types defined
1065 * near the definition of SLang_Name_Type. Applications should avoid using
1066 * this so if you do not understands its role, do not use it.
1068 #define SLANG_DATA 0x30 /* real objects which may be destroyed */
1070 /* Subtypes */
1072 /* The definitions here are for objects that may be on the run-time stack.
1073 * They are actually sub_types of literal and data main_types.
1075 #define VOID_TYPE 1
1076 #define INT_TYPE 2
1077 #ifdef FLOAT_TYPE
1078 # undef FLOAT_TYPE
1079 # define FLOAT_TYPE 3
1080 #endif
1081 #define CHAR_TYPE 4
1082 #define INTP_TYPE 5
1083 /* An object of INTP_TYPE should never really occur on the stack. Rather,
1084 * the integer to which it refers will be there instead. It is defined here
1085 * because it is a valid type for MAKE_VARIABLE.
1088 #define SLANG_OBJ_TYPE 6
1089 /* SLANG_OBJ_TYPE refers to an object on the stack that is a pointer to
1090 * some other object.
1093 #if 0
1094 /* This is not ready yet. */
1095 # define SLANG_NOOP 9
1096 #endif
1098 /* Everything above string should correspond to a pointer in the object
1099 * structure. See do_binary (slang.c) for exploitation of this fact.
1101 #define STRING_TYPE 10
1102 /* Array type MUST be the smallest number for SLuser_Object_Type structs */
1103 #define ARRAY_TYPE 20
1104 /* I am reserving values greater than or equal to user applications. The
1105 * first 99 are used for S-Lang.
1109 /* Binary and Unary Subtypes */
1110 /* Since the application can define new types and can overload the binary
1111 * and unary operators, these definitions must be present in this file.
1113 #define SLANG_PLUS 1
1114 #define SLANG_MINUS 2
1115 #define SLANG_TIMES 3
1116 #define SLANG_DIVIDE 4
1117 #define SLANG_EQ 5
1118 #define SLANG_NE 6
1119 #define SLANG_GT 7
1120 #define SLANG_GE 8
1121 #define SLANG_LT 9
1122 #define SLANG_LE 10
1124 /* UNARY subtypes (may be overloaded) */
1125 #define SLANG_ABS 11
1126 #define SLANG_SIGN 12
1127 #define SLANG_SQR 13
1128 #define SLANG_MUL2 14
1129 #define SLANG_CHS 15
1131 /* error codes, severe errors are less than 0 */
1132 #define SL_INVALID_PARM -6
1133 #define SL_MALLOC_ERROR -5
1134 #define INTERNAL_ERROR -4
1135 #define UNKNOWN_ERROR -3
1136 #define STACK_OVERFLOW -1
1137 #define STACK_UNDERFLOW -2
1138 #define INTRINSIC_ERROR 1
1139 /* Intrinsic error is an error generated by intrinsic functions */
1140 #define USER_BREAK 2
1141 #define UNDEFINED_NAME 3
1142 #define SYNTAX_ERROR 4
1143 #define DUPLICATE_DEFINITION 5
1144 #define TYPE_MISMATCH 6
1145 #define READONLY_ERROR 7
1146 #define DIVIDE_ERROR 8
1147 /* object could not be opened */
1148 #define SL_OBJ_NOPEN 9
1149 /* unknown object */
1150 #define SL_OBJ_UNKNOWN 10
1152 extern char *SLang_Error_Message;
1154 extern void SLadd_name(char *, long, unsigned char, unsigned char);
1155 extern void SLadd_at_handler (long *, char *);
1157 #define SLANG_MAKE_ARGS(out, in) ((unsigned char)(out) | ((unsigned short) (in) << 4))
1159 #ifdef SLANG_STATS
1161 #define MAKE_INTRINSIC(n, f, out, in) \
1162 {0, n, (out | (in << 4)), SLANG_INTRINSIC, (long) f}
1164 #define MAKE_VARIABLE(n, v, t, r) \
1165 {0, n, t, (SLANG_IVARIABLE + r), (long) v}
1167 #else
1168 #define MAKE_INTRINSIC(n, f, out, in) \
1169 {n, (out | (in << 4)), SLANG_INTRINSIC, (long) f}
1171 #define MAKE_VARIABLE(n, v, t, r) \
1172 {n, t, (SLANG_IVARIABLE + r), (long) v}
1173 #endif
1175 #define SLANG_END_TABLE MAKE_INTRINSIC("", 0, 0, 0)
1178 /*}}}*/
1180 /*{{{ Upper/Lowercase Functions */
1182 extern void SLang_define_case(int *, int *);
1183 extern void SLang_init_case_tables (void);
1185 extern unsigned char Chg_UCase_Lut[256];
1186 extern unsigned char Chg_LCase_Lut[256];
1187 #define UPPER_CASE(x) (Chg_UCase_Lut[(unsigned char) (x)])
1188 #define LOWER_CASE(x) (Chg_LCase_Lut[(unsigned char) (x)])
1189 #define CHANGE_CASE(x) (((x) == Chg_LCase_Lut[(unsigned char) (x)]) ?\
1190 Chg_UCase_Lut[(unsigned char) (x)] : Chg_LCase_Lut[(unsigned char) (x)])
1193 /*}}}*/
1195 /*{{{ Regular Expression Interface */
1197 typedef struct
1199 unsigned char *pat; /* regular expression pattern */
1200 unsigned char *buf; /* buffer for compiled regexp */
1201 unsigned int buf_len; /* length of buffer */
1202 int case_sensitive; /* 1 if match is case sensitive */
1203 int must_match; /* 1 if line must contain substring */
1204 int must_match_bol; /* true if it must match beginning of line */
1205 unsigned char must_match_str[16]; /* 15 char null term substring */
1206 int osearch; /* 1 if ordinary search suffices */
1207 unsigned int min_length; /* minimum length the match must be */
1208 int beg_matches[10]; /* offset of start of \( */
1209 unsigned int end_matches[10]; /* length of nth submatch
1210 * Note that the entire match corresponds
1211 * to \0
1213 int offset; /* offset to be added to beg_matches */
1214 } SLRegexp_Type;
1216 extern unsigned char *SLang_regexp_match(unsigned char *,
1217 unsigned int,
1218 SLRegexp_Type *);
1219 extern int SLang_regexp_compile (SLRegexp_Type *);
1220 extern char *SLregexp_quote_string (char *, char *, unsigned int);
1223 /*}}}*/
1225 /*{{{ SLang Command Interface */
1227 #define SLCMD_MAX_ARGS 10
1228 struct _SLcmd_Cmd_Type; /* Pre-declaration is needed below */
1229 typedef struct
1231 struct _SLcmd_Cmd_Type *table;
1232 int argc;
1233 char *string_args[SLCMD_MAX_ARGS];
1234 int int_args[SLCMD_MAX_ARGS];
1235 float64 float_args[SLCMD_MAX_ARGS];
1236 unsigned char arg_type[SLCMD_MAX_ARGS];
1237 } SLcmd_Cmd_Table_Type;
1240 typedef struct _SLcmd_Cmd_Type
1242 int (*cmdfun)(int, SLcmd_Cmd_Table_Type *);
1243 char cmd[32];
1244 char arg_type[SLCMD_MAX_ARGS];
1245 } SLcmd_Cmd_Type;
1247 extern int SLcmd_execute_string (char *, SLcmd_Cmd_Table_Type *);
1249 /*}}}*/
1251 /*{{{ SLang Search Interface */
1253 typedef struct
1255 int cs; /* case sensitive */
1256 unsigned char key[256];
1257 int ind[256];
1258 int key_len;
1259 int dir;
1260 } SLsearch_Type;
1262 extern int SLsearch_init (char *, int, int, SLsearch_Type *);
1263 /* This routine must first be called before any search can take place.
1264 * The second parameter specifies the direction of the search: greater than
1265 * zero for a forwrd search and less than zero for a backward search. The
1266 * third parameter specifies whether the search is case sensitive or not.
1267 * The last parameter is a pointer to a structure that is filled by this
1268 * function and it is this structure that must be passed to SLsearch.
1271 unsigned char *SLsearch (unsigned char *, unsigned char *, SLsearch_Type *);
1272 /* To use this routine, you must first call 'SLsearch_init'. Then the first
1273 * two parameters p1 and p2 serve to define the region over which the search
1274 * is to take place. The third parameter is the structure that was previously
1275 * initialized by SLsearch_init.
1277 * The routine returns a pointer to the match if found otherwise it returns
1278 * NULL.
1281 /*}}}*/
1283 #if 0
1285 #endif
1286 #ifdef __cplusplus
1288 #endif
1290 #endif /* _DAVIS_SLANG_H_ */