slang.h
来自「ReactOS是一些高手根据Windows XP的内核编写出的类XP。内核实现机」· C头文件 代码 · 共 1,285 行 · 第 1/3 页
H
1,285 行
*/
extern char *SLang_find_name(char *);
/* Return a pointer to p1 in table if it is defined. Returns NULL
* otherwise. This is useful when one wants to avoid redundant strings.
*/
extern char *SLang_rpn_interpret(char *);
/* Interpret string as reverse polish notation */
extern void SLang_doerror(char *);
/* set SLang_Error and display p1 as error message */
extern SLuser_Object_Type *SLang_add_array(char *, long *,
int, int, int, int,
unsigned char, unsigned char);
/* This function has not been tested thoroughly yet. Its purpose is to
* allow a S-Lang procedure to access a C array. For example, suppose that
* you have an array of 100 ints defined as:
*
* int c_array[100];
*
* By calling something like:
*
* SLang_add_array ("array_name", (long *) c_array, 1, 100, 0, 0,
* 'i', SLANG_IVARIABLE);
*
* the array can be accessed by the name 'array_name'. This function
* returns -1 upon failure. The 3rd argument specifies the dimension
* of the array, the 4th, and 5th arguments specify how many elements
* there are in the x,y, and z directions. The last argument must
* be one of:
*
* SLANG_IVARIABLE: indicates array is writable
* SLANG_RVARIABLE: indicates array is read only
*
* Returns NULL upon failure.
*/
extern int SLang_free_array_handle (int);
/* This routine may be called by application to free array handle created by
* the application. Returns 0 upon success, -1 if the handle is invalid and
* -2 if the handle is not associated with a C array.
*/
extern char *SLang_extract_list_element(char *, int *, int*);
extern void SLexpand_escaped_string (register char *, register char *,
register char *);
extern SLang_Name_Type *SLang_get_function (char *);
/* The parameter is the name of a user defined S-Lang function. This
* routine returns NULL if the function does not exist or it returns the
* a pointer to it in an internal S-Lang table. This pointer can be used
* by 'SLexecute_function' to call the function directly from C.
*/
extern void SLexecute_function(SLang_Name_Type *);
/* This function allows an application to call a S-Lang function from within
* the C program. The parameter must be non-NULL and must have been
* previously obtained by a call to 'SLang_get_function'.
*/
extern void SLroll_stack (int *);
/* If argument *p is positive, the top |*p| objects on the stack are rolled
* up. If negative, the stack is rolled down.
*/
extern void SLmake_lut (unsigned char *, unsigned char *, unsigned char);
extern int SLang_guess_type (char *);
/*}}}*/
/*{{{ Misc Functions */
extern char *SLmake_string (char *);
extern char *SLmake_nstring (char *, unsigned int);
/* Returns a null terminated string made from the first n characters of the
* string.
*/
extern char *SLcurrent_time_string (void);
extern int SLatoi(unsigned char *);
extern int SLang_extract_token(char **, char *, int);
/* returns 0 upon failure and non-zero upon success. The first parameter
* is a pointer to the input stream which this function will bump along.
* The second parameter is the buffer where the token is placed. The third
* parameter is used internally by the S-Lang library and should be 0 for
* user applications.
*/
/*}}}*/
/*{{{ SLang getkey interface Functions */
#ifdef REAL_UNIX_SYSTEM
extern int SLang_TT_Baud_Rate;
extern int SLang_TT_Read_FD;
#endif
extern int SLang_init_tty (int, int, int);
/* Initializes the tty for single character input. If the first parameter *p1
* is in the range 0-255, it will be used for the abort character;
* otherwise, (unix only) if it is -1, the abort character will be the one
* used by the terminal. If the second parameter p2 is non-zero, flow
* control is enabled. If the last parmeter p3 is zero, output processing
* is NOT turned on. A value of zero is required for the screen management
* routines. Returns 0 upon success. In addition, if SLang_TT_Baud_Rate ==
* 0 when this function is called, SLang will attempt to determine the
* terminals baud rate. As far as the SLang library is concerned, if
* SLang_TT_Baud_Rate is less than or equal to zero, the baud rate is
* effectively infinite.
*/
extern void SLang_reset_tty (void);
/* Resets tty to what it was prior to a call to SLang_init_tty */
#ifdef REAL_UNIX_SYSTEM
extern void SLtty_set_suspend_state (int);
/* If non-zero argument, terminal driver will be told to react to the
* suspend character. If 0, it will not.
*/
extern int (*SLang_getkey_intr_hook) (void);
#endif
#define SLANG_GETKEY_ERROR 0xFFFF
extern unsigned int SLang_getkey (void);
/* reads a single key from the tty. If the read fails, 0xFFFF is returned. */
extern void SLang_ungetkey_string (unsigned char *, unsigned int);
extern void SLang_buffer_keystring (unsigned char *, unsigned int);
extern void SLang_ungetkey (unsigned char);
extern void SLang_flush_input (void);
extern int SLang_input_pending (int);
extern int SLang_Abort_Char;
/* The value of the character (0-255) used to trigger SIGINT */
extern int SLang_Ignore_User_Abort;
/* If non-zero, pressing the abort character will not result in USER_BREAK
* SLang_Error. */
extern void SLang_set_abort_signal (void (*)(int));
/* If SIGINT is generated, the function p1 will be called. If p1 is NULL
* the SLang_default signal handler is called. This sets SLang_Error to
* USER_BREAK. I suspect most users will simply want to pass NULL.
*/
extern volatile int SLKeyBoard_Quit;
#ifdef VMS
/* If this function returns -1, ^Y will be added to input buffer. */
extern int (*SLtty_VMS_Ctrl_Y_Hook) (void);
#endif
/*}}}*/
/*{{{ SLang Keymap routines */
typedef struct SLKeymap_Function_Type
{
char *name;
int (*f)(void);
}
SLKeymap_Function_Type;
typedef struct SLang_Key_Type
{
unsigned char str[13]; /* key sequence */
#define SLKEY_F_INTERPRET 0x01
#define SLKEY_F_INTRINSIC 0x02
#define SLKEY_F_KEYSYM 0x03
unsigned char type; /* type of function */
#ifdef SLKEYMAP_OBSOLETE
VOID_STAR f; /* function to invoke */
#else
union
{
char *s;
FVOID_STAR f;
unsigned int keysym;
}
f;
#endif
struct SLang_Key_Type *next; /* */
}
SLang_Key_Type;
#define MAX_KEYMAP_NAME_LEN 8
typedef struct SLKeyMap_List_Type
{
char name[MAX_KEYMAP_NAME_LEN + 1];
SLang_Key_Type *keymap;
SLKeymap_Function_Type *functions; /* intrinsic functions */
}
SLKeyMap_List_Type;
/* This is arbitrary but I have got to start somewhere */
#ifdef msdos
#define SLANG_MAX_KEYMAPS 10
#else
#define SLANG_MAX_KEYMAPS 30
#endif
extern SLKeyMap_List_Type SLKeyMap_List[SLANG_MAX_KEYMAPS]; /* these better be inited to 0! */
extern char *SLang_process_keystring(char *);
#ifdef SLKEYMAP_OBSOLETE
extern int SLang_define_key1(char *, VOID_STAR, unsigned int, SLKeyMap_List_Type *);
/* define key p1 in keymap p4 to invoke function p2. If type p3 is given by
* SLKEY_F_INTRINSIC, p2 is an intrinsic function, else it is a string to be
* passed to the interpreter for evaluation. The return value is important.
* It returns 0 upon success, -1 upon malloc error, and -2 if the key is
* inconsistent. SLang_Error is set upon error. */
#else
extern int SLkm_define_key (char *, FVOID_STAR, SLKeyMap_List_Type *);
#endif
extern int SLang_define_key(char *, char *, SLKeyMap_List_Type *);
/* Like define_key1 except that p2 is a string that is to be associated with
* a function in the functions field of p3. This routine calls define_key1.
*/
extern int SLkm_define_keysym (char *, unsigned int, SLKeyMap_List_Type *);
extern void SLang_undefine_key(char *, SLKeyMap_List_Type *);
extern SLKeyMap_List_Type *SLang_create_keymap(char *, SLKeyMap_List_Type *);
/* create and returns a pointer to a new keymap named p1 created by copying
* keymap p2. If p2 is NULL, it is up to the calling routine to initialize
* the keymap.
*/
extern char *SLang_make_keystring(unsigned char *);
extern SLang_Key_Type *SLang_do_key(SLKeyMap_List_Type *, int (*)(void));
/* read a key using keymap p1 with getkey function p2 */
extern
#ifdef SLKEYMAP_OBSOLETE
VOID_STAR
#else
FVOID_STAR
#endif
SLang_find_key_function(char *, SLKeyMap_List_Type *);
extern SLKeyMap_List_Type *SLang_find_keymap(char *);
extern int SLang_Last_Key_Char;
extern int SLang_Key_TimeOut_Flag;
/*}}}*/
/*{{{ SLang Readline Interface */
typedef struct SLang_Read_Line_Type
{
struct SLang_Read_Line_Type *prev, *next;
unsigned char *buf;
int buf_len; /* number of chars in the buffer */
int num; /* num and misc are application specific*/
int misc;
} SLang_Read_Line_Type;
/* Maximum size of display */
#define SLRL_DISPLAY_BUFFER_SIZE 256
typedef struct
{
SLang_Read_Line_Type *root, *tail, *last;
unsigned char *buf; /* edit buffer */
int buf_len; /* sizeof buffer */
int point; /* current editing point */
int tab; /* tab width */
int len; /* current line size */
/* display variables */
int edit_width; /* length of display field */
int curs_pos; /* current column */
int start_column; /* column offset of display */
int dhscroll; /* amount to use for horiz scroll */
char *prompt;
FVOID_STAR last_fun; /* last function executed by rl */
/* These two contain an image of what is on the display */
unsigned char upd_buf1[SLRL_DISPLAY_BUFFER_SIZE];
unsigned char upd_buf2[SLRL_DISPLAY_BUFFER_SIZE];
unsigned char *old_upd, *new_upd; /* pointers to previous two buffers */
int new_upd_len, old_upd_len; /* length of output buffers */
SLKeyMap_List_Type *keymap;
/* tty variables */
unsigned int flags; /* */
#define SL_RLINE_NO_ECHO 1
#define SL_RLINE_USE_ANSI 2
unsigned int (*getkey)(void); /* getkey function -- required */
void (*tt_goto_column)(int);
void (*tt_insert)(char);
void (*update_hook)(unsigned char *, int, int);
/* The update hook is called with a pointer to a buffer p1 that contains
* an image of what the update hook is suppoed to produce. The length
* of the buffer is p2 and after the update, the cursor is to be placed
* in column p3.
*/
} SLang_RLine_Info_Type;
extern int SLang_RL_EOF_Char;
extern SLang_Read_Line_Type * SLang_rline_save_line (SLang_RLine_Info_Type *);
extern int SLang_init_readline (SLang_RLine_Info_Type *);
extern int SLang_read_line (SLang_RLine_Info_Type *);
extern int SLang_rline_insert (char *);
extern void SLrline_redraw (SLang_RLine_Info_Type *);
extern int SLang_Rline_Quit;
/*}}}*/
/*{{{ Low Level Screen Output Interface */
extern unsigned long SLtt_Num_Chars_Output;
extern int SLtt_Baud_Rate;
typedef unsigned long SLtt_Char_Type;
#define SLTT_BOLD_MASK 0x01000000
#define SLTT_BLINK_MASK 0x02000000
#define SLTT_ULINE_MASK 0x04000000
#define SLTT_REV_MASK 0x08000000
#define SLTT_ALTC_MASK 0x10000000
extern int SLtt_Screen_Rows;
extern int SLtt_Screen_Cols;
extern int SLtt_Term_Cannot_Insert;
extern int SLtt_Term_Cannot_Scroll;
extern int SLtt_Use_Ansi_Colors;
extern int SLtt_Ignore_Beep;
#if defined(REAL_UNIX_SYSTEM)
extern int SLtt_Force_Keypad_Init;
#endif
#ifndef __GO32__
#if defined(VMS) || defined(REAL_UNIX_SYSTEM)
extern int SLtt_Blink_Mode;
extern int SLtt_Use_Blink_For_ACS;
extern int SLtt_Newline_Ok;
extern int SLtt_Has_Alt_Charset;
extern int SLtt_Has_Status_Line; /* if 0, NO. If > 0, YES, IF -1, ?? */
# ifndef VMS
extern int SLtt_Try_Termcap;
# endif
#endif
#endif
#ifdef msdos
extern int SLtt_Msdos_Cheap_Video;
#endif
extern int SLtt_flush_output (void);
extern void SLtt_set_scroll_region(int, int);
extern void SLtt_reset_scroll_region(void);
extern void SLtt_reverse_video (int);
extern void SLtt_bold_video (void);
extern void SLtt_begin_insert(void);
extern void SLtt_end_insert(void);
extern void SLtt_del_eol(void);
extern void SLtt_goto_rc (int, int);
extern void SLtt_delete_nlines(int);
extern void SLtt_delete_char(void);
extern void SLtt_erase_line(void);
extern void SLtt_normal_video(void);
extern void SLtt_cls(void);
extern void SLtt_beep(void);
extern void SLtt_reverse_index(int);
extern void SLtt_smart_puts(unsigned short *, unsigned short *, int, int);
extern void SLtt_write_string (char *);
extern void SLtt_putchar(char);
extern void SLtt_init_video (void);
extern void SLtt_reset_video (void);
extern void SLtt_get_terminfo(void);
extern void SLtt_get_screen_size (void);
extern int SLtt_set_cursor_visibility (int);
#if defined(VMS) || defined(REAL_UNIX_SYSTEM)
extern void SLtt_enable_cursor_keys(void);
extern void SLtt_set_term_vtxxx(int *);
extern void SLtt_set_color_esc (int, char *);
extern void SLtt_wide_width(void);
extern void SLtt_narrow_width(void);
extern int SLtt_set_mouse_mode (int, int);
extern void SLtt_set_alt_char_set (int);
extern int SLtt_write_to_status_line (char *, int);
extern void SLtt_disable_status_line (void);
# ifdef REAL_UNIX_SYSTEM
extern char *SLtt_tgetstr (char *);
extern int SLtt_tgetnum (char *);
extern int SLtt_tgetflag (char *);
extern char *SLtt_tigetent (char *);
extern char *SLtt_tigetstr (char *, char **);
extern int SLtt_tigetnum (char *, char **);
# endif
#endif
extern SLtt_Char_Type SLtt_get_color_object (int);
extern void SLtt_set_color_object (int, SLtt_Char_Type);
extern void SLtt_set_color (int, char *, char *, char *);
extern void SLtt_set_mono (int, char *, SLtt_Char_Type);
extern void SLtt_add_color_attribute (int, SLtt_Char_Type);
extern void SLtt_set_color_fgbg (int, SLtt_Char_Type, SLtt_Char_Type);
/*}}}*/
/*{{{ SLang Preprocessor Interface */
typedef struct
{
int this_level;
int exec_level;
int prev_exec_level;
char preprocess_char;
char comment_char;
unsigned char flags;
#define SLPREP_BLANK_LINES_OK 1
#define SLPREP_COMMENT_LINES_OK 2
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?