📄 _slang.h
字号:
#ifndef _PRIVATE_SLANG_H_#define _PRIVATE_SLANG_H_/* header file for S-Lang internal structures that users do not (should not) need. Use slang.h for that purpose. *//* Copyright (c) 1992, 1999, 2001, 2002 John E. Davis * This file is part of the S-Lang library. * * You may distribute under the terms of either the GNU General Public * License or the Perl Artistic License. *//* #include "config.h" */#include "jdmacros.h"#include "sllimits.h"#ifdef VMS# define SLANG_SYSTEM_NAME "_VMS"#else# if defined (IBMPC_SYSTEM)# define SLANG_SYSTEM_NAME "_IBMPC"# else# define SLANG_SYSTEM_NAME "_UNIX"# endif#endif /* VMS *//* These quantities are main_types for byte-compiled code. They are used * by the inner_interp routine. The _BC_ means byte-code. */#define _SLANG_BC_LVARIABLE SLANG_LVARIABLE /* 0x01 */#define _SLANG_BC_GVARIABLE SLANG_GVARIABLE /* 0x02 */#define _SLANG_BC_IVARIABLE SLANG_IVARIABLE /* 0x03 */#define _SLANG_BC_RVARIABLE SLANG_RVARIABLE /* 0x04 */#define _SLANG_BC_INTRINSIC SLANG_INTRINSIC /* 0x05 */#define _SLANG_BC_FUNCTION SLANG_FUNCTION /* 0x06 */#define _SLANG_BC_MATH_UNARY SLANG_MATH_UNARY /* 0x07 */#define _SLANG_BC_APP_UNARY SLANG_APP_UNARY /* 0x08 */#define _SLANG_BC_ICONST SLANG_ICONSTANT /* 0x09 */#define _SLANG_BC_DCONST SLANG_DCONSTANT /* 0x0A */#define _SLANG_BC_PVARIABLE SLANG_PVARIABLE /* 0x0B */#define _SLANG_BC_PFUNCTION SLANG_PFUNCTION /* 0x0C */#define _SLANG_BC_BINARY 0x10#define _SLANG_BC_LITERAL 0x11 /* constant objects */#define _SLANG_BC_LITERAL_INT 0x12#define _SLANG_BC_LITERAL_STR 0x13#define _SLANG_BC_BLOCK 0x14/* These 3 MUST be in this order too ! */#define _SLANG_BC_RETURN 0x15#define _SLANG_BC_BREAK 0x16#define _SLANG_BC_CONTINUE 0x17#define _SLANG_BC_EXCH 0x18#define _SLANG_BC_LABEL 0x19#define _SLANG_BC_LOBJPTR 0x1A#define _SLANG_BC_GOBJPTR 0x1B#define _SLANG_BC_X_ERROR 0x1C/* These must be in this order */#define _SLANG_BC_X_USER0 0x1D#define _SLANG_BC_X_USER1 0x1E#define _SLANG_BC_X_USER2 0x1F#define _SLANG_BC_X_USER3 0x20#define _SLANG_BC_X_USER4 0x21#define _SLANG_BC_CALL_DIRECT 0x24#define _SLANG_BC_CALL_DIRECT_FRAME 0x25#define _SLANG_BC_UNARY 0x26#define _SLANG_BC_UNARY_FUNC 0x27#define _SLANG_BC_DEREF_ASSIGN 0x30#define _SLANG_BC_SET_LOCAL_LVALUE 0x31#define _SLANG_BC_SET_GLOBAL_LVALUE 0x32#define _SLANG_BC_SET_INTRIN_LVALUE 0x33#define _SLANG_BC_SET_STRUCT_LVALUE 0x34#define _SLANG_BC_FIELD 0x35#define _SLANG_BC_SET_ARRAY_LVALUE 0x36#define _SLANG_BC_LINE_NUM 0x40#define _SLANG_BC_TMP 0x50#define _SLANG_BC_LVARIABLE_AGET 0x60#define _SLANG_BC_LVARIABLE_APUT 0x61#define _SLANG_BC_INTEGER_PLUS 0x62#define _SLANG_BC_INTEGER_MINUS 0x63#define _SLANG_BC_ARG_LVARIABLE 0x64#define _SLANG_BC_EARG_LVARIABLE 0x65#define _SLANG_BC_CALL_DIRECT_INTRINSIC 0x80#define _SLANG_BC_INTRINSIC_CALL_DIRECT 0x81#define _SLANG_BC_CALL_DIRECT_LSTR 0x82#define _SLANG_BC_CALL_DIRECT_SLFUN 0x83#define _SLANG_BC_CALL_DIRECT_INTRSTOP 0x84#define _SLANG_BC_INTRINSIC_STOP 0x85#define _SLANG_BC_CALL_DIRECT_EARG_LVAR 0x86#define _SLANG_BC_CALL_DIRECT_LINT 0x87#define _SLANG_BC_CALL_DIRECT_LVAR 0x88/* Byte-Code Sub Types (_BCST_) *//* These are sub_types of _SLANG_BC_BLOCK */#define _SLANG_BCST_ERROR_BLOCK 0x01#define _SLANG_BCST_EXIT_BLOCK 0x02#define _SLANG_BCST_USER_BLOCK0 0x03#define _SLANG_BCST_USER_BLOCK1 0x04#define _SLANG_BCST_USER_BLOCK2 0x05#define _SLANG_BCST_USER_BLOCK3 0x06#define _SLANG_BCST_USER_BLOCK4 0x07/* The user blocks MUST be in the above order */#define _SLANG_BCST_LOOP 0x10#define _SLANG_BCST_WHILE 0x11#define _SLANG_BCST_FOR 0x12#define _SLANG_BCST_FOREVER 0x13#define _SLANG_BCST_CFOR 0x14#define _SLANG_BCST_DOWHILE 0x15#define _SLANG_BCST_FOREACH 0x16#define _SLANG_BCST_IF 0x20#define _SLANG_BCST_IFNOT 0x21#define _SLANG_BCST_ELSE 0x22#define _SLANG_BCST_ANDELSE 0x23#define _SLANG_BCST_ORELSE 0x24#define _SLANG_BCST_SWITCH 0x25#define _SLANG_BCST_NOTELSE 0x26/* assignment (_SLANG_BC_SET_*_LVALUE) subtypes. The order MUST correspond * to the assignment token order with the ASSIGN_TOKEN as the first! */#define _SLANG_BCST_ASSIGN 0x01#define _SLANG_BCST_PLUSEQS 0x02#define _SLANG_BCST_MINUSEQS 0x03#define _SLANG_BCST_TIMESEQS 0x04#define _SLANG_BCST_DIVEQS 0x05#define _SLANG_BCST_BOREQS 0x06#define _SLANG_BCST_BANDEQS 0x07#define _SLANG_BCST_PLUSPLUS 0x08#define _SLANG_BCST_POST_PLUSPLUS 0x09#define _SLANG_BCST_MINUSMINUS 0x0A#define _SLANG_BCST_POST_MINUSMINUS 0x0B/* These use SLANG_PLUS, SLANG_MINUS, SLANG_PLUSPLUS, etc... */typedef union{#if SLANG_HAS_FLOAT double double_val; float float_val;#endif long long_val; unsigned long ulong_val; VOID_STAR ptr_val; char *s_val; int int_val; unsigned int uint_val; SLang_MMT_Type *ref; SLang_Name_Type *n_val; struct _SLang_Struct_Type *struct_val; struct _SLang_Array_Type *array_val; short short_val; unsigned short ushort_val; char char_val; unsigned char uchar_val;}_SL_Object_Union_Type;typedef struct _SLang_Object_Type{ SLtype data_type; /* SLANG_INT_TYPE, ... */ _SL_Object_Union_Type v;}SLang_Object_Type;struct _SLang_MMT_Type{ SLtype data_type; /* int, string, etc... */ VOID_STAR user_data; /* address of user structure */ unsigned int count; /* number of references */};extern int _SLang_pop_object_of_type (SLtype, SLang_Object_Type *, int);typedef struct{ char *name; /* slstring */ SLang_Object_Type obj;}_SLstruct_Field_Type;typedef struct _SLang_Struct_Type{ _SLstruct_Field_Type *fields; unsigned int nfields; /* number used */ unsigned int num_refs;}_SLang_Struct_Type;extern void _SLstruct_delete_struct (_SLang_Struct_Type *);extern int _SLang_push_struct (_SLang_Struct_Type *);extern int _SLang_pop_struct (_SLang_Struct_Type **);extern int _SLstruct_init (void);/* extern int _SLstruct_get_field (char *); */extern int _SLstruct_define_struct (void);extern int _SLstruct_define_typedef (void);struct _SLang_Ref_Type{ int is_global; union { SLang_Name_Type *nt; SLang_Object_Type *local_obj; } v;};extern int _SLang_dereference_ref (SLang_Ref_Type *);extern int _SLang_deref_assign (SLang_Ref_Type *);extern int _SLang_push_ref (int, VOID_STAR);extern int _SL_increment_frame_pointer (void);extern int _SL_decrement_frame_pointer (void);extern int SLang_pop(SLang_Object_Type *);extern void SLang_free_object (SLang_Object_Type *);extern int _SLanytype_typecast (SLtype, VOID_STAR, unsigned int, SLtype, VOID_STAR);extern void _SLstring_intrinsic (void);/* These functions are used to create slstrings of a fixed length. Be * very careful how they are used. In particular, if len bytes are allocated, * then the string must be len characters long, no more and no less. */extern char *_SLallocate_slstring (unsigned int);extern char *_SLcreate_via_alloced_slstring (char *, unsigned int);extern void _SLunallocate_slstring (char *, unsigned int);extern int _SLpush_alloced_slstring (char *, unsigned int); typedef struct { char **buf; unsigned int max_num; unsigned int num; unsigned int delta_num;}_SLString_List_Type;extern int _SLstring_list_append (_SLString_List_Type *, char *);extern int _SLstring_list_init (_SLString_List_Type *, unsigned int, unsigned int);extern void _SLstring_list_delete (_SLString_List_Type *);extern int _SLstring_list_push (_SLString_List_Type *);/* This function assumes that s is an slstring. */extern char *_SLstring_dup_slstring (char *);extern int _SLang_dup_and_push_slstring (char *);extern int _SLang_init_import (void);/* This function checks to see if the referenced object is initialized */extern int _SLang_is_ref_initialized (SLang_Ref_Type *);extern int _SLcheck_identifier_syntax (char *);extern int _SLang_uninitialize_ref (SLang_Ref_Type *);extern int _SLpush_slang_obj (SLang_Object_Type *);extern char *_SLexpand_escaped_char(char *, char *);extern void _SLexpand_escaped_string (char *, char *, char *);/* returns a pointer to an SLstring string-- use SLang_free_slstring */extern char *_SLstringize_object (SLang_Object_Type *);extern int _SLdump_objects (char *, SLang_Object_Type *, unsigned int, int);extern SLang_Object_Type *_SLRun_Stack;extern SLang_Object_Type *_SLStack_Pointer;struct _SLang_NameSpace_Type{ struct _SLang_NameSpace_Type *next; char *name; /* this is the load_type name */ char *namespace_name; /* this name is assigned by implements */ unsigned int table_size; SLang_Name_Type **table;};extern SLang_NameSpace_Type *_SLns_allocate_namespace (char *, unsigned int);extern SLang_NameSpace_Type *_SLns_find_namespace (char *);extern int _SLns_set_namespace_name (SLang_NameSpace_Type *, char *);extern SLang_Array_Type *_SLnspace_apropos (SLang_NameSpace_Type *, char *, unsigned int);extern void _SLang_use_namespace_intrinsic (char *name);extern char *_SLang_cur_namespace_intrinsic (void);extern SLang_Array_Type *_SLang_apropos (char *, char *, unsigned int);extern void _SLang_implements_intrinsic (char *);extern int _SLang_Trace;extern int _SLstack_depth(void);extern char *_SLang_Current_Function_Name;extern int _SLang_trace_fun(char *);extern int _SLang_Compile_Line_Num_Info;extern char *_SLstring_dup_hashed_string (char *, unsigned long);extern unsigned long _SLcompute_string_hash (char *);extern char *_SLstring_make_hashed_string (char *, unsigned int, unsigned long *);extern void _SLfree_hashed_string (char *, unsigned int, unsigned long);unsigned long _SLstring_hash (unsigned char *, unsigned char *);extern int _SLinit_slcomplex (void);extern int _SLang_init_slstrops (void);extern int _SLstrops_do_sprintf_n (int);extern int _SLang_sscanf (void);extern double _SLang_atof (char *);extern int _SLang_init_bstring (void);extern int _SLang_init_sltime (void);extern void _SLpack (void);extern void _SLunpack (char *, SLang_BString_Type *);extern void _SLpack_pad_format (char *);extern unsigned int _SLpack_compute_size (char *);extern int _SLusleep (unsigned long);/* frees upon error. NULL __NOT__ ok. */extern int _SLang_push_slstring (char *);extern SLtype _SLarith_promote_type (SLtype);extern int _SLarith_get_precedence (SLtype);extern int _SLarith_typecast (SLtype, VOID_STAR, unsigned int, SLtype, VOID_STAR);extern int SLang_push(SLang_Object_Type *);extern int SLadd_global_variable (char *);extern void _SLang_clear_error (void);extern int _SLdo_pop (void);extern unsigned int _SLsys_getkey (void);extern int _SLsys_input_pending (int);#ifdef IBMPC_SYSTEMextern unsigned int _SLpc_convert_scancode (unsigned int, unsigned int, int);#define _SLTT_KEY_SHIFT 1#define _SLTT_KEY_CTRL 2#define _SLTT_KEY_ALT 4#endiftypedef struct _SLterminfo_Type SLterminfo_Type;extern SLterminfo_Type *_SLtt_tigetent (char *);extern char *_SLtt_tigetstr (SLterminfo_Type *, char *);extern int _SLtt_tigetnum (SLterminfo_Type *, char *);extern int _SLtt_tigetflag (SLterminfo_Type *, char *);#if SLTT_HAS_NON_BCE_SUPPORTextern int _SLtt_get_bce_color_offset (void);#endifextern void (*_SLtt_color_changed_hook)(void);extern unsigned char SLang_Input_Buffer [SL_MAX_INPUT_BUFFER_LEN];extern int _SLregister_types (void);extern SLang_Class_Type *_SLclass_get_class (SLtype);extern VOID_STAR _SLclass_get_ptr_to_value (SLang_Class_Type *, SLang_Object_Type *);extern void _SLclass_type_mismatch_error (SLtype, SLtype);extern int _SLclass_init (void);extern int _SLclass_copy_class (SLtype, SLtype);extern SLtype _SLclass_Class_Type [256];extern int (*_SLclass_get_typecast (SLtype, SLtype, int))(SLtype, VOID_STAR, unsigned int, SLtype, VOID_STAR);extern int (*_SLclass_get_binary_fun (int, SLang_Class_Type *, SLang_Class_Type *, SLang_Class_Type **, int))(int, SLtype, VOID_STAR, unsigned int, SLtype, VOID_STAR, unsigned int, VOID_STAR);extern int (*_SLclass_get_unary_fun (int, SLang_Class_Type *, SLang_Class_Type **, int))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -