⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 slang.h

📁 MC Linux/Unix 终端下文件管理器
💻 H
📖 第 1 页 / 共 5 页
字号:
extern int SLang_pop_integer(int *);extern int SLang_pop_uinteger(unsigned int *);   /* pops integer *p0 from the stack.  Returns 0 upon success and non-zero    * if the stack is empty or a type mismatch occurs, setting SLang_Error.    */extern int SLang_pop_char (char *);extern int SLang_pop_uchar (SLtype *);extern int SLang_pop_short(short *);extern int SLang_pop_ushort(unsigned short *);extern int SLang_pop_long(long *);extern int SLang_pop_ulong(unsigned long *);extern int SLang_pop_float(float *);extern int SLang_pop_double(double *, int *, int *);   /* Pops double *p1 from stack.  If *p3 is non-zero, *p1 was derived      from the integer *p2. Returns zero upon success. */   extern int SLang_pop_complex (double *, double *);   extern int SLpop_string (char **);   extern int SLang_pop_string(char **, int *);   /* pops string *p0 from stack.  If *p1 is non-zero, the string must be    * freed after its use.  DO NOT FREE p0 if *p1 IS ZERO! Returns 0 upon    * success */   extern int SLang_push_complex (double, double);   extern int SLang_push_char (char);   extern int SLang_push_uchar (SLtype);   extern int SLang_push_integer(int);   extern int SLang_push_uinteger(unsigned int);   /* push integer p1 on stack */   extern int SLang_push_short(short);   extern int SLang_push_ushort(unsigned short);   extern int SLang_push_long(long);   extern int SLang_push_ulong(unsigned long);   extern int SLang_push_float(float);   extern int SLang_push_double(double);   /* Push double onto stack */   extern int SLang_push_string(char *);   /* Push string p1 onto stack */   extern int SLang_push_malloced_string(char *);   /* The normal SLang_push_string pushes an slstring.  This one converts    * a normally malloced string to an slstring, and then frees the     * malloced string.  So, do NOT use the malloced string after calling    * this routine because it will be freed!  The routine returns -1 upon     * error, but the string will be freed.    */extern int SLang_push_null (void);extern int SLang_pop_null (void);extern int SLang_push_value (SLtype type, VOID_STAR);extern int SLang_pop_value (SLtype type, VOID_STAR);extern void SLang_free_value (SLtype type, VOID_STAR);typedef struct _SLang_Object_Type SLang_Any_Type;extern int SLang_pop_anytype (SLang_Any_Type **);extern int SLang_push_anytype (SLang_Any_Type *);extern void SLang_free_anytype (SLang_Any_Type *);#ifdef _SLANG_SOURCE_typedef struct _SLang_Ref_Type SLang_Ref_Type;#elsetypedef int SLang_Ref_Type;#endifextern int SLang_pop_ref (SLang_Ref_Type **);extern void SLang_free_ref (SLang_Ref_Type *);extern int SLang_assign_to_ref (SLang_Ref_Type *, SLtype, VOID_STAR);extern SLang_Name_Type *SLang_pop_function (void);extern SLang_Name_Type *SLang_get_fun_from_ref (SLang_Ref_Type *);extern void SLang_free_function (SLang_Name_Type *f);   extern int SLang_is_defined(char *);   /* Return non-zero is p1 is defined otherwise returns 0. */   extern int SLang_run_hooks(char *, unsigned int, ...);   /* calls S-Lang function p1 pushing p2 strings in the variable argument    * list onto the stack first.    * Returns -1 upon error, 1 if hooks exists and it ran,    * or 0 if hook does not exist.  Thus it returns non-zero is hook was called.    *//* These functions return 1 if the indicated function exists and the function * runs without error.  If the function does not exist, the function returns * 0.  Otherwise -1 is returned with SLang_Error set appropriately. */extern int SLexecute_function (SLang_Name_Type *);extern int SLang_execute_function(char *);extern int SLang_end_arg_list (void);extern int SLang_start_arg_list (void);extern void SLang_verror (int, char *, ...);extern void SLang_doerror(char *);   /* set SLang_Error and display p1 as error message */extern int SLang_add_intrinsic_array (char *,   /* name */				      SLtype,   /* type */				      int,   /* readonly */				      VOID_STAR,   /* data */				      unsigned int, ...);   /* num dims */extern int SLextract_list_element (char *, unsigned int, char,				   char *, unsigned int);extern void SLexpand_escaped_string (register char *, register char *,				     register char *);extern SLang_Name_Type *SLang_get_function (char *);extern void SLang_release_function (SLang_Name_Type *);extern int SLreverse_stack (int);extern int 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 int SLdup_n (int n);/* Duplicate top n elements of stack */extern int SLang_peek_at_stack1 (void);extern int SLang_peek_at_stack (void);/* Returns type of next object on stack-- -1 upon stack underflow. */extern void SLmake_lut (unsigned char *, unsigned char *, unsigned char);   extern int SLang_guess_type (char *);extern int SLstruct_create_struct (unsigned int,				   char **,				   SLtype *,				   VOID_STAR *);/*}}}*//*{{{ Misc Functions *//* This is an interface to atexit */extern int SLang_add_cleanup_function (void (*)(void));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. *//* The string created by this routine must be freed by SLang_free_slstring * and nothing else!!  Also these strings must not be modified.  Use * SLmake_string if you intend to modify them!! */extern char *SLang_create_nslstring (char *, unsigned int);extern char *SLang_create_slstring (char *);extern void SLang_free_slstring (char *);    /* handles NULL */extern int SLang_pop_slstring (char **);   /* free with SLang_free_slstring */extern char *SLang_concat_slstrings (char *a, char *b);extern char *SLang_create_static_slstring (char *);   /* adds a string that will not get deleted */extern void SLstring_dump_stats (void);/* Binary strings *//* The binary string is an opaque type.  Use the SLbstring_get_pointer function * to get a pointer and length. */typedef struct _SLang_BString_Type SLang_BString_Type;extern unsigned char *SLbstring_get_pointer (SLang_BString_Type *, unsigned int *);extern SLang_BString_Type *SLbstring_dup (SLang_BString_Type *);extern SLang_BString_Type *SLbstring_create (unsigned char *, unsigned int);/* The create_malloced function used the first argument which is assumed * to be a pointer to a len + 1 malloced string.  The extra byte is for * \0 termination. */extern SLang_BString_Type *SLbstring_create_malloced (unsigned char *, unsigned int, int);/* Create a bstring from an slstring */extern SLang_BString_Type *SLbstring_create_slstring (char *);extern void SLbstring_free (SLang_BString_Type *);extern int SLang_pop_bstring (SLang_BString_Type **);extern int SLang_push_bstring (SLang_BString_Type *);extern char *SLmalloc (unsigned int);extern char *SLcalloc (unsigned int, unsigned int);extern void SLfree(char *);	       /* This function handles NULL */extern char *SLrealloc (char *, unsigned int);extern char *SLcurrent_time_string (void);extern int SLatoi(unsigned char *);extern long SLatol (unsigned char *);extern unsigned long SLatoul (unsigned char *);extern int SLang_pop_fileptr (SLang_MMT_Type **, FILE **);extern char *SLang_get_name_from_fileptr (SLang_MMT_Type *);typedef struct _SLFile_FD_Type SLFile_FD_Type;extern SLFile_FD_Type *SLfile_create_fd (char *, int);extern void SLfile_free_fd (SLFile_FD_Type *);extern int SLfile_push_fd (SLFile_FD_Type *);extern int SLfile_pop_fd (SLFile_FD_Type **);extern int SLfile_get_fd (SLFile_FD_Type *, int *);extern SLFile_FD_Type *SLfile_dup_fd (SLFile_FD_Type *f0);extern int SLang_init_posix_io (void);typedef double (*SLang_To_Double_Fun_Type)(VOID_STAR);extern SLang_To_Double_Fun_Type SLarith_get_to_double_fun (SLtype, unsigned int *);extern int SLang_set_argc_argv (int, char **);/*}}}*//*{{{ SLang getkey interface Functions */#ifdef REAL_UNIX_SYSTEMextern int SLang_TT_Baud_Rate;extern int SLang_TT_Read_FD;#endifextern 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_SYSTEMextern 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 0xFFFFextern unsigned int SLang_getkey (void);/* reads a single key from the tty.  If the read fails,  0xFFFF is returned. */#ifdef IBMPC_SYSTEMextern int SLgetkey_map_to_ansi (int);#endifextern int SLang_ungetkey_string (unsigned char *, unsigned int);extern int SLang_buffer_keystring (unsigned char *, unsigned int);extern int 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 int 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 unsigned int SLang_Input_Buffer_Len;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;#define SLANG_MAX_KEYMAP_KEY_SEQ	14typedef struct SLang_Key_Type{   struct SLang_Key_Type *next;   union     {	char *s;	FVOID_STAR f;	unsigned int keysym;     }     f;   unsigned char type;	       /* type of function */#define SLKEY_F_INTERPRET	0x01#define SLKEY_F_INTRINSIC	0x02#define SLKEY_F_KEYSYM		0x03   unsigned char str[SLANG_MAX_KEYMAP_KEY_SEQ + 1];/* key sequence */}SLang_Key_Type;typedef struct SLKeyMap_List_Type{   char *name;			       /* hashed string */   SLang_Key_Type *keymap;   SLKeymap_Function_Type *functions;  /* intrinsic functions */}SLKeyMap_List_Type;/* This is arbitrary but I have got to start somewhere */#define SLANG_MAX_KEYMAPS 30extern SLKeyMap_List_Type SLKeyMap_List[SLANG_MAX_KEYMAPS];extern char *SLang_process_keystring(char *);extern int SLkm_define_key (char *, FVOID_STAR, SLKeyMap_List_Type *);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. */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     FVOID_STAR     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 256typedef 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 */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -