* README: Imported slang-1.4.9.
* sldisply.c: Likewise. * slerr.c: Likewise. * slgetkey.c: Likewise. * slmisc.c: Likewise. * slsignal.c: Likewise. * slsmg.c: Likewise. * sltermin.c: Likewise. * slutty.c: Likewise. * slvideo.c: Likewise. * slw32tty.c: Likewise. * include/_slang.h: Likewise. * include/jdmacros.h: Likewise. * include/sl-feat.h: Likewise. * include/slang.h: Likewise. * include/slinclud.h: Likewise. * include/sllimits.h: Likewise. * ChangeLog: Change my e-mail to me@pavelsh.pp.ru
Этот коммит содержится в:
родитель
7febc1e97c
Коммит
5b57056d23
@ -1,3 +1,23 @@
|
||||
2004-11-01 Pavel S. Shirshov <me@pavelsh.pp.ru>
|
||||
|
||||
* README: Imported slang-1.4.9.
|
||||
* sldisply.c: Likewise.
|
||||
* slerr.c: Likewise.
|
||||
* slgetkey.c: Likewise.
|
||||
* slmisc.c: Likewise.
|
||||
* slsignal.c: Likewise.
|
||||
* slsmg.c: Likewise.
|
||||
* sltermin.c: Likewise.
|
||||
* slutty.c: Likewise.
|
||||
* slvideo.c: Likewise.
|
||||
* slw32tty.c: Likewise.
|
||||
* include/_slang.h: Likewise.
|
||||
* include/jdmacros.h: Likewise.
|
||||
* include/sl-feat.h: Likewise.
|
||||
* include/slang.h: Likewise.
|
||||
* include/slinclud.h: Likewise.
|
||||
* include/sllimits.h: Likewise.
|
||||
|
||||
2004-10-27 Nerijus Baliunas <nerijus@users.sourceforge.net>
|
||||
|
||||
* include/slang.h: Define __unix__ if _AIX is defined.
|
||||
@ -22,12 +42,12 @@
|
||||
|
||||
From patches from the OpenBSD ports collection.
|
||||
|
||||
2004-09-04 Pavel S. Shirshov <pavelsh@mail.ru>
|
||||
2004-09-04 Pavel S. Shirshov <me@pavelsh.pp.ru>
|
||||
|
||||
* sltermin.c (): Avoid strncpy, home_ti is 1K long and
|
||||
nobody really needs it whole cleared
|
||||
|
||||
2004-08-31 Pavel S. Shirshov <pavelsh@mail.ru>
|
||||
2004-08-31 Pavel S. Shirshov <me@pavelsh.pp.ru>
|
||||
|
||||
* include/slang.h: Revert last changes - it breaks compiling
|
||||
* sldisply.c: Likewise.
|
||||
@ -59,7 +79,7 @@
|
||||
|
||||
* sldisply.c: Patch to swap blue and red colors for setf/setb
|
||||
capabilities. Needed on QNX Neutrino.
|
||||
Reported by Pavel Shirshov <pavelsh@mail.ru>
|
||||
Reported by Pavel Shirshov <me@pavelsh.pp.ru>
|
||||
|
||||
2002-10-07 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
This is the S-Lang library, version 1.4.5. It has been radically
|
||||
This is the S-Lang library, version 1.4.9. It has been radically
|
||||
stripped down to remove functions that are either unused by the Midnight
|
||||
Commander or already provided by the glib library. The complete
|
||||
distribution can be downloaded from:
|
||||
|
@ -2,7 +2,7 @@
|
||||
#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
|
||||
/* Copyright (c) 1992, 1999, 2001, 2002, 2003 John E. Davis
|
||||
* This file is part of the S-Lang library.
|
||||
*
|
||||
* You may distribute under the terms of either the GNU General Public
|
||||
@ -40,6 +40,9 @@
|
||||
#define _SLANG_BC_PVARIABLE SLANG_PVARIABLE /* 0x0B */
|
||||
#define _SLANG_BC_PFUNCTION SLANG_PFUNCTION /* 0x0C */
|
||||
|
||||
#define _SLANG_BC_UNUSED_0x0D 0x0D
|
||||
#define _SLANG_BC_UNUSED_0x0E 0x0E
|
||||
#define _SLANG_BC_UNUSED_0x0F 0x0F
|
||||
#define _SLANG_BC_BINARY 0x10
|
||||
#define _SLANG_BC_LITERAL 0x11 /* constant objects */
|
||||
#define _SLANG_BC_LITERAL_INT 0x12
|
||||
@ -63,11 +66,23 @@
|
||||
#define _SLANG_BC_X_USER3 0x20
|
||||
#define _SLANG_BC_X_USER4 0x21
|
||||
|
||||
#define _SLANG_BC_LITERAL_DBL 0x22
|
||||
#define _SLANG_BC_UNUSED_0x23
|
||||
|
||||
#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_UNUSED_0x28 0x28
|
||||
#define _SLANG_BC_UNUSED_0x29 0x29
|
||||
#define _SLANG_BC_UNUSED_0x2A 0x2A
|
||||
#define _SLANG_BC_UNUSED_0x2B 0x2B
|
||||
#define _SLANG_BC_UNUSED_0x2C 0x2C
|
||||
#define _SLANG_BC_UNUSED_0x2D 0x2D
|
||||
#define _SLANG_BC_UNUSED_0x2E 0x2E
|
||||
#define _SLANG_BC_UNUSED_0x2F 0x2F
|
||||
|
||||
#define _SLANG_BC_DEREF_ASSIGN 0x30
|
||||
#define _SLANG_BC_SET_LOCAL_LVALUE 0x31
|
||||
#define _SLANG_BC_SET_GLOBAL_LVALUE 0x32
|
||||
@ -76,9 +91,53 @@
|
||||
#define _SLANG_BC_FIELD 0x35
|
||||
#define _SLANG_BC_SET_ARRAY_LVALUE 0x36
|
||||
|
||||
#define _SLANG_BC_UNUSED_0x37 0x37
|
||||
#define _SLANG_BC_UNUSED_0x38 0x38
|
||||
#define _SLANG_BC_UNUSED_0x39 0x39
|
||||
#define _SLANG_BC_UNUSED_0x3A 0x3A
|
||||
#define _SLANG_BC_UNUSED_0x3B 0x3B
|
||||
#define _SLANG_BC_UNUSED_0x3C 0x3C
|
||||
#define _SLANG_BC_UNUSED_0x3D 0x3D
|
||||
#define _SLANG_BC_UNUSED_0x3E 0x3E
|
||||
#define _SLANG_BC_UNUSED_0x3F 0x3F
|
||||
|
||||
#define _SLANG_BC_LINE_NUM 0x40
|
||||
|
||||
#define _SLANG_BC_UNUSED_0x41 0x41
|
||||
#define _SLANG_BC_UNUSED_0x42 0x42
|
||||
#define _SLANG_BC_UNUSED_0x43 0x43
|
||||
#define _SLANG_BC_UNUSED_0x44 0x44
|
||||
#define _SLANG_BC_UNUSED_0x45 0x45
|
||||
#define _SLANG_BC_UNUSED_0x46 0x46
|
||||
#define _SLANG_BC_UNUSED_0x47 0x47
|
||||
#define _SLANG_BC_UNUSED_0x48 0x48
|
||||
#define _SLANG_BC_UNUSED_0x49 0x49
|
||||
#define _SLANG_BC_UNUSED_0x4A 0x4A
|
||||
#define _SLANG_BC_UNUSED_0x4B 0x4B
|
||||
#define _SLANG_BC_UNUSED_0x4C 0x4C
|
||||
#define _SLANG_BC_UNUSED_0x4D 0x4D
|
||||
#define _SLANG_BC_UNUSED_0x4E 0x4E
|
||||
#define _SLANG_BC_UNUSED_0x4F 0x4F
|
||||
|
||||
#define _SLANG_BC_TMP 0x50
|
||||
|
||||
#define _SLANG_BC_UNUSED_0x51 0x51
|
||||
#define _SLANG_BC_UNUSED_0x52 0x52
|
||||
#define _SLANG_BC_UNUSED_0x53 0x53
|
||||
#define _SLANG_BC_UNUSED_0x54 0x54
|
||||
#define _SLANG_BC_UNUSED_0x55 0x55
|
||||
#define _SLANG_BC_UNUSED_0x56 0x56
|
||||
#define _SLANG_BC_UNUSED_0x57 0x57
|
||||
#define _SLANG_BC_UNUSED_0x58 0x58
|
||||
#define _SLANG_BC_UNUSED_0x59 0x59
|
||||
#define _SLANG_BC_UNUSED_0x5A 0x5A
|
||||
#define _SLANG_BC_UNUSED_0x5B 0x5B
|
||||
#define _SLANG_BC_UNUSED_0x5C 0x5C
|
||||
#define _SLANG_BC_UNUSED_0x5D 0x5D
|
||||
#define _SLANG_BC_UNUSED_0x5E 0x5E
|
||||
#define _SLANG_BC_UNUSED_0x5F 0x5F
|
||||
|
||||
|
||||
#define _SLANG_BC_LVARIABLE_AGET 0x60
|
||||
#define _SLANG_BC_LVARIABLE_APUT 0x61
|
||||
#define _SLANG_BC_INTEGER_PLUS 0x62
|
||||
@ -86,6 +145,35 @@
|
||||
#define _SLANG_BC_ARG_LVARIABLE 0x64
|
||||
#define _SLANG_BC_EARG_LVARIABLE 0x65
|
||||
|
||||
#define _SLANG_BC_UNUSED_0x66 0x66
|
||||
#define _SLANG_BC_UNUSED_0x67 0x67
|
||||
#define _SLANG_BC_UNUSED_0x68 0x68
|
||||
#define _SLANG_BC_UNUSED_0x69 0x69
|
||||
#define _SLANG_BC_UNUSED_0x6A 0x6A
|
||||
#define _SLANG_BC_UNUSED_0x6B 0x6B
|
||||
#define _SLANG_BC_UNUSED_0x6C 0x6C
|
||||
#define _SLANG_BC_UNUSED_0x6D 0x6D
|
||||
#define _SLANG_BC_UNUSED_0x6E 0x6E
|
||||
#define _SLANG_BC_UNUSED_0x6F 0x6F
|
||||
|
||||
#define _SLANG_BC_UNUSED_0x70 0x70
|
||||
#define _SLANG_BC_UNUSED_0x71 0x71
|
||||
#define _SLANG_BC_UNUSED_0x72 0x72
|
||||
#define _SLANG_BC_UNUSED_0x73 0x73
|
||||
#define _SLANG_BC_UNUSED_0x74 0x74
|
||||
#define _SLANG_BC_UNUSED_0x75 0x75
|
||||
#define _SLANG_BC_UNUSED_0x76 0x76
|
||||
#define _SLANG_BC_UNUSED_0x77 0x77
|
||||
#define _SLANG_BC_UNUSED_0x78 0x78
|
||||
#define _SLANG_BC_UNUSED_0x79 0x79
|
||||
#define _SLANG_BC_UNUSED_0x7A 0x7A
|
||||
#define _SLANG_BC_UNUSED_0x7B 0x7B
|
||||
#define _SLANG_BC_UNUSED_0x7C 0x7C
|
||||
#define _SLANG_BC_UNUSED_0x7D 0x7D
|
||||
#define _SLANG_BC_UNUSED_0x7E 0x7E
|
||||
#define _SLANG_BC_UNUSED_0x7F 0x7F
|
||||
|
||||
/* These are used only when compiled with USE_COMBINED_BYTECODES */
|
||||
#define _SLANG_BC_CALL_DIRECT_INTRINSIC 0x80
|
||||
#define _SLANG_BC_INTRINSIC_CALL_DIRECT 0x81
|
||||
#define _SLANG_BC_CALL_DIRECT_LSTR 0x82
|
||||
@ -95,8 +183,24 @@
|
||||
#define _SLANG_BC_CALL_DIRECT_EARG_LVAR 0x86
|
||||
#define _SLANG_BC_CALL_DIRECT_LINT 0x87
|
||||
#define _SLANG_BC_CALL_DIRECT_LVAR 0x88
|
||||
#define _SLANG_BC_LLVARIABLE_BINARY 0x89
|
||||
#define _SLANG_BC_LGVARIABLE_BINARY 0x8A
|
||||
#define _SLANG_BC_GLVARIABLE_BINARY 0x8B
|
||||
#define _SLANG_BC_GGVARIABLE_BINARY 0x8C
|
||||
#define _SLANG_BC_LIVARIABLE_BINARY 0x8D
|
||||
#define _SLANG_BC_LDVARIABLE_BINARY 0x8E
|
||||
#define _SLANG_BC_ILVARIABLE_BINARY 0x8F
|
||||
#define _SLANG_BC_DLVARIABLE_BINARY 0x90
|
||||
#define _SLANG_BC_LVARIABLE_BINARY 0x91
|
||||
#define _SLANG_BC_GVARIABLE_BINARY 0x92
|
||||
#define _SLANG_BC_LITERAL_INT_BINARY 0x93
|
||||
#define _SLANG_BC_LITERAL_DBL_BINARY 0x94
|
||||
|
||||
|
||||
#define _SLANG_BC_LVARIABLE_COMBINED 0xA0
|
||||
#define _SLANG_BC_GVARIABLE_COMBINED 0xA1
|
||||
#define _SLANG_BC_LITERAL_COMBINED 0xA2
|
||||
|
||||
/* Byte-Code Sub Types (_BCST_) */
|
||||
|
||||
/* These are sub_types of _SLANG_BC_BLOCK */
|
||||
@ -271,8 +375,9 @@ extern void _SLexpand_escaped_string (char *, char *, char *);
|
||||
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;
|
||||
extern SLang_Object_Type *_SLang_get_run_stack_pointer (void);
|
||||
extern SLang_Object_Type *_SLang_get_run_stack_base (void);
|
||||
extern int _SLang_dump_stack (void);
|
||||
|
||||
struct _SLang_NameSpace_Type
|
||||
{
|
||||
@ -290,10 +395,11 @@ 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 SLang_Array_Type *_SLns_list_namespaces (void);
|
||||
|
||||
extern int _SLang_Trace;
|
||||
extern int _SLstack_depth(void);
|
||||
extern char *_SLang_Current_Function_Name;
|
||||
extern char *_SLang_current_function_name (void);
|
||||
|
||||
extern int _SLang_trace_fun(char *);
|
||||
extern int _SLang_Compile_Line_Num_Info;
|
||||
@ -359,8 +465,6 @@ 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);
|
||||
@ -376,7 +480,13 @@ extern int (*_SLclass_get_unary_fun (int, SLang_Class_Type *, SLang_Class_Type *
|
||||
|
||||
extern int _SLarith_register_types (void);
|
||||
extern SLtype _SLarith_Arith_Types [];
|
||||
extern SLtype _SLarith_Is_Arith_Type [256];
|
||||
|
||||
extern int _SLang_is_arith_type (SLtype);
|
||||
extern void _SLang_set_arith_type (SLtype, unsigned char);
|
||||
#if _SLANG_OPTIMIZE_FOR_SPEED
|
||||
extern int _SLang_get_class_type (SLtype);
|
||||
extern void _SLang_set_class_type (SLtype, SLtype);
|
||||
#endif
|
||||
extern int _SLarith_bin_op (SLang_Object_Type *, SLang_Object_Type *, int);
|
||||
|
||||
extern int _SLarray_add_bin_op (SLtype);
|
||||
@ -421,10 +531,15 @@ extern int _SLarray_cl_foreach (SLtype, SLang_Foreach_Context_Type *);
|
||||
extern int _SLarray_matrix_multiply (void);
|
||||
extern void (*_SLang_Matrix_Multiply)(void);
|
||||
|
||||
extern int _SLarray_next_index (int *, int *, unsigned int);
|
||||
|
||||
extern int _SLarray_init_slarray (void);
|
||||
extern SLang_Array_Type *
|
||||
SLang_create_array1 (SLtype, int, VOID_STAR, int *, unsigned int, int);
|
||||
|
||||
extern int _SLassoc_aput (SLtype, unsigned int);
|
||||
extern int _SLassoc_aget (SLtype, unsigned int);
|
||||
|
||||
extern int _SLcompile_push_context (SLang_Load_Type *);
|
||||
extern int _SLcompile_pop_context (void);
|
||||
extern int _SLang_Auto_Declare_Globals;
|
||||
@ -450,6 +565,13 @@ _SLang_Token_Type;
|
||||
extern void _SLcompile (_SLang_Token_Type *);
|
||||
extern void (*_SLcompile_ptr)(_SLang_Token_Type *);
|
||||
|
||||
/* slmisc.c */
|
||||
extern char *_SLskip_whitespace (char *s);
|
||||
|
||||
/* slospath.c */
|
||||
extern char *_SLpath_find_file (char *); /* slstring returned */
|
||||
|
||||
|
||||
/* *** TOKENS *** */
|
||||
|
||||
/* Note that that tokens corresponding to ^J, ^M, and ^Z should not be used.
|
||||
@ -735,6 +857,8 @@ extern int _SLsnprintf (char *, unsigned int, char *, ...);
|
||||
#endif
|
||||
|
||||
#endif /* !MIDNIGHT_COMMANDER_CODE */
|
||||
extern int _SLsecure_issetugid (void);
|
||||
extern char *_SLsecure_getenv (char *);
|
||||
|
||||
#undef _INLINE_
|
||||
#if defined(__GNUC__) && _SLANG_USE_INLINE_CODE
|
||||
|
@ -10,7 +10,7 @@
|
||||
/* This is the old space-speed trade off. To reduce memory usage and code
|
||||
* size, set this to zero.
|
||||
*/
|
||||
/*#define _SLANG_OPTIMIZE_FOR_SPEED 2 */
|
||||
/*#define _SLANG_OPTIMIZE_FOR_SPEED 0 */
|
||||
#define _SLANG_OPTIMIZE_FOR_SPEED 2
|
||||
|
||||
#define _SLANG_USE_INLINE_CODE 1
|
||||
|
@ -1,14 +1,14 @@
|
||||
#ifndef DAVIS_SLANG_H_
|
||||
#define DAVIS_SLANG_H_
|
||||
/* -*- mode: C; mode: fold; -*- */
|
||||
/* Copyright (c) 1992, 1999, 2001, 2002 John E. Davis
|
||||
/* Copyright (c) 1992, 1999, 2001, 2002, 2003 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.
|
||||
*/
|
||||
#define SLANG_VERSION 10405
|
||||
#define SLANG_VERSION_STRING "1.4.5"
|
||||
#define SLANG_VERSION 10409
|
||||
#define SLANG_VERSION_STRING "1.4.9"
|
||||
|
||||
/*{{{ System Dependent Macros and Typedefs */
|
||||
|
||||
@ -105,10 +105,19 @@ extern "C" {
|
||||
# include <alloc.h>
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define _SLATTRIBUTE_(x) __attribute__ (x)
|
||||
#else
|
||||
# define _SLATTRIBUTE_(x)
|
||||
#endif
|
||||
#define _SLATTRIBUTE_PRINTF(a,b) _SLATTRIBUTE_((format(printf,a,b)))
|
||||
|
||||
#if defined (__cplusplus) || defined(__STDC__) || defined(IBMPC_SYSTEM)
|
||||
typedef void *VOID_STAR;
|
||||
#define SLCONST const
|
||||
#else
|
||||
typedef unsigned char *VOID_STAR;
|
||||
#define SLCONST
|
||||
#endif
|
||||
|
||||
typedef int (*FVOID_STAR)(void);
|
||||
@ -246,13 +255,22 @@ SLang_DConstant_Type;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *field_name;
|
||||
char *field_name; /* gets replaced by slstring at run-time */
|
||||
unsigned int offset;
|
||||
SLtype type;
|
||||
unsigned char read_only;
|
||||
}
|
||||
SLang_IStruct_Field_Type;
|
||||
|
||||
typedef SLCONST struct
|
||||
{
|
||||
char *field_name;
|
||||
unsigned int offset;
|
||||
SLtype type;
|
||||
unsigned char read_only;
|
||||
}
|
||||
SLang_CStruct_Field_Type;
|
||||
|
||||
extern int SLadd_intrin_fun_table (SLang_Intrin_Fun_Type *, char *);
|
||||
extern int SLadd_intrin_var_table (SLang_Intrin_Var_Type *, char *);
|
||||
extern int SLadd_app_unary_table (SLang_App_Unary_Type *, char *);
|
||||
@ -261,6 +279,7 @@ extern int SLadd_iconstant_table (SLang_IConstant_Type *, char *);
|
||||
extern int SLadd_dconstant_table (SLang_DConstant_Type *, char *);
|
||||
extern int SLadd_istruct_table (SLang_IStruct_Field_Type *, VOID_STAR, char *);
|
||||
|
||||
|
||||
typedef struct _SLang_NameSpace_Type SLang_NameSpace_Type;
|
||||
|
||||
extern int SLns_add_intrin_fun_table (SLang_NameSpace_Type *, SLang_Intrin_Fun_Type *, char *);
|
||||
@ -274,6 +293,12 @@ extern int SLns_add_istruct_table (SLang_NameSpace_Type *, SLang_IStruct_Field_T
|
||||
extern SLang_NameSpace_Type *SLns_create_namespace (char *);
|
||||
extern void SLns_delete_namespace (SLang_NameSpace_Type *);
|
||||
|
||||
extern int SLns_load_file (char *, char *);
|
||||
extern int SLns_load_string (char *, char *);
|
||||
extern int (*SLns_Load_File_Hook) (char *, char *);
|
||||
int SLang_load_file_verbose (int);
|
||||
/* if non-zero, display file loading messages */
|
||||
|
||||
typedef struct SLang_Load_Type
|
||||
{
|
||||
int type;
|
||||
@ -299,12 +324,14 @@ typedef struct SLang_Load_Type
|
||||
* the compilable unit.
|
||||
*/
|
||||
|
||||
unsigned long reserved[4];
|
||||
char *namespace_name;
|
||||
unsigned long reserved[3];
|
||||
/* For future expansion */
|
||||
} SLang_Load_Type;
|
||||
|
||||
extern SLang_Load_Type *SLallocate_load_type (char *);
|
||||
extern void SLdeallocate_load_type (SLang_Load_Type *);
|
||||
extern SLang_Load_Type *SLns_allocate_load_type (char *, char *);
|
||||
|
||||
/* Returns SLang_Error upon failure */
|
||||
extern int SLang_load_object (SLang_Load_Type *);
|
||||
@ -516,6 +543,7 @@ extern int SLclass_register_class (SLang_Class_Type *, SLtype, unsigned int, SLt
|
||||
extern int SLclass_set_string_function (SLang_Class_Type *, char *(*)(SLtype, VOID_STAR));
|
||||
extern int SLclass_set_destroy_function (SLang_Class_Type *, void (*)(SLtype, VOID_STAR));
|
||||
extern int SLclass_set_push_function (SLang_Class_Type *, int (*)(SLtype, VOID_STAR));
|
||||
extern int SLclass_set_apush_function (SLang_Class_Type *, int (*)(SLtype, VOID_STAR));
|
||||
extern int SLclass_set_pop_function (SLang_Class_Type *, int (*)(SLtype, VOID_STAR));
|
||||
|
||||
extern int SLclass_set_aget_function (SLang_Class_Type *, int (*)(SLtype, unsigned int));
|
||||
@ -640,6 +668,34 @@ extern SLang_Array_Type *SLang_duplicate_array (SLang_Array_Type *);
|
||||
extern int SLang_get_array_element (SLang_Array_Type *, int *, VOID_STAR);
|
||||
extern int SLang_set_array_element (SLang_Array_Type *, int *, VOID_STAR);
|
||||
|
||||
typedef int SLarray_Contract_Fun_Type (VOID_STAR xp, unsigned int increment, unsigned int num, VOID_STAR yp);
|
||||
typedef struct
|
||||
{
|
||||
SLtype from_type; /* if array is this type */
|
||||
SLtype typecast_to_type; /* typecast it to this */
|
||||
SLtype result_type; /* to produce this */
|
||||
SLarray_Contract_Fun_Type *f; /* via this function */
|
||||
}
|
||||
SLarray_Contract_Type;
|
||||
extern int SLarray_contract_array (SLCONST SLarray_Contract_Type *);
|
||||
|
||||
typedef int SLarray_Map_Fun_Type (SLtype xtype, VOID_STAR xp,
|
||||
unsigned int increment, unsigned int num,
|
||||
SLtype ytype, VOID_STAR yp, VOID_STAR clientdata);
|
||||
typedef struct
|
||||
{
|
||||
SLtype from_type; /* if array is this type */
|
||||
SLtype typecast_to_type; /* typecast it to this */
|
||||
SLtype result_type; /* to produce this */
|
||||
SLarray_Map_Fun_Type *f; /* via this function */
|
||||
}
|
||||
SLarray_Map_Type;
|
||||
|
||||
extern int SLarray_map_array_1 (SLCONST SLarray_Map_Type *,
|
||||
int *use_this_dim,
|
||||
VOID_STAR clientdata);
|
||||
extern int SLarray_map_array (SLCONST SLarray_Map_Type *);
|
||||
|
||||
|
||||
/*}}}*/
|
||||
|
||||
@ -690,14 +746,14 @@ extern int SLang_set_array_element (SLang_Array_Type *, int *, VOID_STAR);
|
||||
extern char *SLang_Doc_Dir;
|
||||
|
||||
extern void (*SLang_VMessage_Hook) (char *, va_list);
|
||||
extern void SLang_vmessage (char *, ...);
|
||||
extern void SLang_vmessage (char *, ...) _SLATTRIBUTE_PRINTF(1,2);
|
||||
|
||||
extern void (*SLang_Error_Hook)(char *);
|
||||
/* Pointer to application dependent error messaging routine. By default,
|
||||
messages are displayed on stderr. */
|
||||
|
||||
extern void (*SLang_Exit_Error_Hook)(char *, va_list);
|
||||
extern void SLang_exit_error (char *, ...);
|
||||
extern void SLang_exit_error (char *, ...) _SLATTRIBUTE_((format (printf, 1, 2), noreturn));
|
||||
extern void (*SLang_Dump_Routine)(char *);
|
||||
/* Called if S-Lang traceback is enabled as well as other debugging
|
||||
routines (e.g., trace). By default, these messages go to stderr. */
|
||||
@ -742,6 +798,9 @@ extern int SLang_init_slassoc (void);
|
||||
extern int SLang_init_array (void);
|
||||
/* Additional arrays functions: transpose, etc... */
|
||||
|
||||
extern int SLang_init_array_extra (void);
|
||||
/* Additional arrays functions: sum, min, max, ... */
|
||||
|
||||
/* Dynamic linking facility */
|
||||
extern int SLang_init_import (void);
|
||||
|
||||
@ -857,6 +916,12 @@ 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);
|
||||
|
||||
/* C structure interface */
|
||||
extern int SLang_push_cstruct (VOID_STAR, SLang_CStruct_Field_Type *);
|
||||
extern int SLang_pop_cstruct (VOID_STAR, SLang_CStruct_Field_Type *);
|
||||
extern void SLang_free_cstruct (VOID_STAR, SLang_CStruct_Field_Type *);
|
||||
extern int SLang_assign_cstruct_to_ref (SLang_Ref_Type *, VOID_STAR, SLang_CStruct_Field_Type *);
|
||||
|
||||
extern int SLang_is_defined(char *);
|
||||
/* Return non-zero is p1 is defined otherwise returns 0. */
|
||||
|
||||
@ -878,7 +943,7 @@ 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_verror (int, char *, ...) _SLATTRIBUTE_PRINTF(2,3);
|
||||
|
||||
extern void SLang_doerror(char *);
|
||||
/* set SLang_Error and display p1 as error message */
|
||||
@ -1331,6 +1396,8 @@ typedef struct
|
||||
unsigned char flags;
|
||||
#define SLPREP_BLANK_LINES_OK 1
|
||||
#define SLPREP_COMMENT_LINES_OK 2
|
||||
#define SLPREP_STOP_READING 4
|
||||
#define SLPREP_EMBEDDED_TEXT 8
|
||||
}
|
||||
SLPreprocess_Type;
|
||||
|
||||
@ -1359,7 +1426,8 @@ extern void SLsmg_erase_eos (void);
|
||||
extern void SLsmg_reverse_video (void);
|
||||
extern void SLsmg_set_color (int);
|
||||
extern void SLsmg_normal_video (void);
|
||||
extern void SLsmg_printf (char *, ...);
|
||||
extern void SLsmg_printf (char *, ...) _SLATTRIBUTE_PRINTF(1,2);
|
||||
/* extern void SLsmg_printf (char *, ...) _SLATTRIBUTE_PRINTF(1,2); */
|
||||
extern void SLsmg_vprintf (char *, va_list);
|
||||
extern void SLsmg_write_string (char *);
|
||||
extern void SLsmg_write_nstring (char *, unsigned int);
|
||||
@ -1658,6 +1726,8 @@ extern int SLerrno_set_errno (int);
|
||||
#define SLANG_BSTRING_TYPE 0x25
|
||||
#define SLANG_FILE_FD_TYPE 0x26
|
||||
|
||||
#define _SLANG_MIN_UNUSED_TYPE 0x27
|
||||
|
||||
/* Compatibility */
|
||||
#ifdef FLOAT_TYPE
|
||||
# undef FLOAT_TYPE
|
||||
@ -1792,6 +1862,13 @@ int SLns_add_intrinsic_function (SLang_NameSpace_Type *, char *, FVOID_STAR, uns
|
||||
# define offsetof(T,F) ((unsigned int)((char *)&((T *)0L)->F - (char *)0L))
|
||||
#endif
|
||||
#define MAKE_ISTRUCT_FIELD(s,f,n,t,r) {(n), offsetof(s,f), (t), (r)}
|
||||
#define MAKE_CSTRUCT_FIELD(s,f,n,t,r) {(n), offsetof(s,f), (t), (r)}
|
||||
#define MAKE_CSTRUCT_INT_FIELD(s,f,n,r) {(n), offsetof(s,f),\
|
||||
(sizeof(((s*)0L)->f)==sizeof(int))?(SLANG_INT_TYPE): \
|
||||
(sizeof(((s*)0L)->f)==sizeof(short))?(SLANG_SHORT_TYPE): \
|
||||
(sizeof(((s*)0L)->f)==sizeof(char))?(SLANG_CHAR_TYPE): \
|
||||
SLANG_LONG_TYPE, (r)\
|
||||
}
|
||||
|
||||
#define SLANG_END_TABLE {NULL}
|
||||
#define SLANG_END_INTRIN_FUN_TABLE MAKE_INTRINSIC_0(NULL,NULL,0)
|
||||
@ -1800,7 +1877,7 @@ int SLns_add_intrinsic_function (SLang_NameSpace_Type *, char *, FVOID_STAR, uns
|
||||
#define SLANG_END_INTRIN_VAR_TABLE MAKE_VARIABLE(NULL,NULL,0,0)
|
||||
#define SLANG_END_ICONST_TABLE MAKE_ICONSTANT(NULL,0)
|
||||
#define SLANG_END_ISTRUCT_TABLE {NULL, 0, 0, 0}
|
||||
|
||||
#define SLANG_END_CSTRUCT_TABLE {NULL, 0, 0, 0}
|
||||
|
||||
|
||||
/*}}}*/
|
||||
@ -1920,8 +1997,18 @@ extern unsigned char *SLsearch (unsigned char *, unsigned char *, SLsearch_Type
|
||||
/* These function return pointers to the original space */
|
||||
extern char *SLpath_basename (char *);
|
||||
extern char *SLpath_extname (char *);
|
||||
|
||||
extern int SLpath_is_absolute_path (char *);
|
||||
|
||||
/* Get and set the character delimiter for search paths */
|
||||
extern int SLpath_get_delimiter (void);
|
||||
extern int SLpath_set_delimiter (int);
|
||||
|
||||
/* search path for loading .sl files */
|
||||
extern int SLpath_set_load_path (char *);
|
||||
/* search path for loading .sl files --- returns slstring */
|
||||
extern char *SLpath_get_load_path (void);
|
||||
|
||||
/* These return malloced strings--- NOT slstrings */
|
||||
extern char *SLpath_dircat (char *, char *);
|
||||
extern char *SLpath_find_file_in_path (char *, char *);
|
||||
|
@ -19,7 +19,7 @@
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if !defined(STDC_HEADERS) && defined(HAVE_MALLOC_H)
|
||||
#ifdef HAVE_MALLOC_H
|
||||
# include <malloc.h>
|
||||
#endif
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 1998, 1999, 2001, 2002 John E. Davis
|
||||
/* Copyright (c) 1998, 1999, 2001, 2002, 2003 John E. Davis
|
||||
* This file is part of the S-Lang library.
|
||||
*
|
||||
* You may distribute under the terms of either the GNU General Public
|
||||
@ -26,14 +26,14 @@
|
||||
#ifdef __MSDOS_16BIT__
|
||||
# define SLANG_MAX_RECURSIVE_DEPTH 50
|
||||
#else
|
||||
# define SLANG_MAX_RECURSIVE_DEPTH 250
|
||||
# define SLANG_MAX_RECURSIVE_DEPTH 2500
|
||||
#endif
|
||||
|
||||
/* slang.c: Size of the stack used for local variables */
|
||||
#ifdef __MSDOS_16BIT__
|
||||
# define SLANG_MAX_LOCAL_STACK 200
|
||||
#else
|
||||
# define SLANG_MAX_LOCAL_STACK 1024
|
||||
# define SLANG_MAX_LOCAL_STACK 4096
|
||||
#endif
|
||||
|
||||
/* slang.c: The size of the hash table used for local and global objects.
|
||||
@ -62,3 +62,12 @@
|
||||
#else
|
||||
# define SL_MAX_FILES 256
|
||||
#endif
|
||||
|
||||
#if !defined(__MSDOS_16BIT__)
|
||||
# define SLTT_MAX_SCREEN_COLS 512
|
||||
# define SLTT_MAX_SCREEN_ROWS 512
|
||||
#else
|
||||
# define SLTT_MAX_SCREEN_ROWS 64
|
||||
# define SLTT_MAX_SCREEN_COLS 75
|
||||
#endif
|
||||
|
||||
|
150
slang/sldisply.c
150
slang/sldisply.c
@ -1,9 +1,10 @@
|
||||
/* Copyright (c) 1992, 1999, 2001, 2002 John E. Davis
|
||||
/* Copyright (c) 1992, 1999, 2001, 2002, 2003 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 "slinclud.h"
|
||||
|
||||
#include <time.h>
|
||||
@ -164,12 +165,13 @@ static Ansi_Color_Type Ansi_Color_Map[JMAX_COLORS] =
|
||||
/* 0 if least significant bit is blue, not red */
|
||||
static int Is_Fg_BGR = 0;
|
||||
static int Is_Bg_BGR = 0;
|
||||
#define COLOR_ARG(color, is_bgr) (is_bgr ? RGB_to_BGR[color] : color)
|
||||
static int const RGB_to_BGR[] =
|
||||
#define COLOR_ARG(color, is_bgr) ((is_bgr) ? RGB_to_BGR[(color)&0x7] : (color))
|
||||
static const int RGB_to_BGR[] =
|
||||
{
|
||||
0, 4, 2, 6, 1, 5, 3, 7
|
||||
};
|
||||
|
||||
|
||||
static char *Color_Fg_Str = "\033[3%dm";
|
||||
static char *Color_Bg_Str = "\033[4%dm";
|
||||
static char *Default_Color_Fg_Str = "\033[39m";
|
||||
@ -801,6 +803,9 @@ void SLtt_erase_line (void)
|
||||
tt_write ("\r", 1);
|
||||
Cursor_Set = 1; Cursor_c = 0;
|
||||
SLtt_del_eol();
|
||||
/* Put the cursor back at the beginning of the line */
|
||||
tt_write ("\r", 1);
|
||||
Cursor_Set = 1; Cursor_c = 0;
|
||||
}
|
||||
|
||||
/* It appears that the Linux console, and most likely others do not
|
||||
@ -904,20 +909,26 @@ void SLtt_beep (void)
|
||||
SLtt_flush_output ();
|
||||
}
|
||||
|
||||
static void write_string_with_care (char *);
|
||||
|
||||
static void del_eol (void)
|
||||
{
|
||||
#if 0
|
||||
int c;
|
||||
|
||||
if (Del_Eol_Str != NULL)
|
||||
#endif
|
||||
if ((Del_Eol_Str != NULL)
|
||||
&& (Can_Background_Color_Erase || ((Current_Fgbg & ~0xFF) == 0)))
|
||||
{
|
||||
tt_write_string(Del_Eol_Str);
|
||||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
c = Cursor_c;
|
||||
|
||||
/* Avoid writing to the lower right corner. If the terminal does not
|
||||
* have Del_Eol_Str, then it probably does not have what it takes to play
|
||||
* games with insert for for a space into that corner.
|
||||
* games with insert-mode to "push" the desired character into that corner.
|
||||
*/
|
||||
if (Cursor_r + 1 < SLtt_Screen_Rows)
|
||||
c++;
|
||||
@ -927,6 +938,16 @@ static void del_eol (void)
|
||||
tt_write (" ", 1);
|
||||
c++;
|
||||
}
|
||||
Cursor_c = (SLtt_Screen_Cols-1);
|
||||
#else
|
||||
while (Cursor_c < SLtt_Screen_Cols)
|
||||
{
|
||||
write_string_with_care (" ");
|
||||
Cursor_c++;
|
||||
}
|
||||
Cursor_c = SLtt_Screen_Cols - 1;
|
||||
Cursor_Set = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void SLtt_del_eol (void)
|
||||
@ -978,10 +999,10 @@ void SLtt_set_mono (int obj, char *what, SLtt_Char_Type mask)
|
||||
static char *check_color_for_digit_form (char *color)
|
||||
{
|
||||
unsigned int i, ich;
|
||||
char *s = color;
|
||||
unsigned char *s = (unsigned char *) color;
|
||||
|
||||
i = 0;
|
||||
while ((ich = (int) *s) != 0)
|
||||
while ((ich = (unsigned int) *s) != 0)
|
||||
{
|
||||
if ((ich < '0') || (ich > '9'))
|
||||
return color;
|
||||
@ -1038,7 +1059,7 @@ static int get_default_colors (char **fgp, char **bgp)
|
||||
p = bg_buf;
|
||||
pmax = p + (sizeof (bg_buf) - 1);
|
||||
|
||||
/* Mark suggested allowing for extra spplication specific stuff following
|
||||
/* Mark suggested allowing for extra application specific stuff following
|
||||
* the background color. That is what the check for the semi-colon is for.
|
||||
*/
|
||||
while ((*bg != 0) && (*bg != ';'))
|
||||
@ -1136,7 +1157,7 @@ static SLtt_Char_Type fb_to_fgbg (SLtt_Char_Type f, SLtt_Char_Type b)
|
||||
}
|
||||
|
||||
/* This looks for colors with name form 'colorN'. If color is of this
|
||||
* form, N is passed back via paramter list.
|
||||
* form, N is passed back via parameter list.
|
||||
*/
|
||||
static int parse_color_digit_name (char *color, SLtt_Char_Type *f)
|
||||
{
|
||||
@ -1153,12 +1174,20 @@ static int parse_color_digit_name (char *color, SLtt_Char_Type *f)
|
||||
i = 0;
|
||||
while (1)
|
||||
{
|
||||
unsigned int j;
|
||||
|
||||
ch = (unsigned char) *color++;
|
||||
if (ch == 0)
|
||||
break;
|
||||
if ((ch > '9') || (ch < '0'))
|
||||
return -1;
|
||||
i = 10 * i + (ch - '0');
|
||||
|
||||
if (i > 0xFFFFFFFFU / 10)
|
||||
return -1;
|
||||
j = (i *= 10);
|
||||
i += (ch - '0');
|
||||
if (i < j)
|
||||
return -1;
|
||||
}
|
||||
|
||||
*f = (SLtt_Char_Type) i;
|
||||
@ -1339,7 +1368,7 @@ static void write_attributes (SLtt_Char_Type fgbg)
|
||||
if (fg0 == SLSMG_COLOR_DEFAULT)
|
||||
tt_write_string (Default_Color_Fg_Str);
|
||||
else
|
||||
tt_printf (Color_Fg_Str, COLOR_ARG(fg0, Is_Fg_BGR), 0);
|
||||
tt_printf (Color_Fg_Str, COLOR_ARG(fg0, Is_Bg_BGR), 0);
|
||||
}
|
||||
|
||||
if (unknown_attributes
|
||||
@ -1412,12 +1441,14 @@ void SLtt_wide_width (void)
|
||||
|
||||
/* Highest bit represents the character set. */
|
||||
#define COLOR_MASK 0x7F00
|
||||
#define COLOR_OF(x) (((x)&COLOR_MASK)>>8)
|
||||
#define CHAR_OF(x) ((x)&0x80FF)
|
||||
|
||||
#if SLTT_HAS_NON_BCE_SUPPORT
|
||||
static int bce_color_eqs (unsigned int a, unsigned int b)
|
||||
{
|
||||
a = (a & COLOR_MASK) >> 8;
|
||||
b = (b & COLOR_MASK) >> 8;
|
||||
a = COLOR_OF(a);
|
||||
b = COLOR_OF(b);
|
||||
|
||||
if (a == b)
|
||||
return 1;
|
||||
@ -1437,7 +1468,6 @@ static int bce_color_eqs (unsigned int a, unsigned int b)
|
||||
}
|
||||
#define COLOR_EQS(a,b) bce_color_eqs (a,b)
|
||||
#else
|
||||
# define COLOR_OF(x) (((unsigned int)(x) & COLOR_MASK) >> 8)
|
||||
# define COLOR_EQS(a, b) \
|
||||
(SLtt_Use_Ansi_Colors \
|
||||
? (Ansi_Color_Map[COLOR_OF(a)].fgbg == Ansi_Color_Map[COLOR_OF(b)].fgbg)\
|
||||
@ -1445,8 +1475,7 @@ static int bce_color_eqs (unsigned int a, unsigned int b)
|
||||
#endif
|
||||
|
||||
#define CHAR_EQS(a, b) (((a) == (b))\
|
||||
|| ((((a) & ~COLOR_MASK) == ((b) & ~COLOR_MASK))\
|
||||
&& COLOR_EQS((a), (b))))
|
||||
|| ((CHAR_OF(a)==CHAR_OF(b)) && COLOR_EQS(a,b)))
|
||||
|
||||
/* The whole point of this routine is to prevent writing to the last column
|
||||
* and last row on terminals with automatic margins.
|
||||
@ -1476,7 +1505,7 @@ static void write_string_with_care (char *str)
|
||||
|
||||
static void send_attr_str (SLsmg_Char_Type *s)
|
||||
{
|
||||
unsigned char out[256], ch, *p;
|
||||
unsigned char out[SLTT_MAX_SCREEN_COLS], ch, *p;
|
||||
register SLtt_Char_Type attr;
|
||||
register SLsmg_Char_Type sh;
|
||||
int color, last_color = -1;
|
||||
@ -1553,9 +1582,25 @@ static void forward_cursor (unsigned int n, int row)
|
||||
{
|
||||
char buf [1024];
|
||||
|
||||
|
||||
/* if (Current_Fgbg & ~0xFF) */
|
||||
/* { */
|
||||
/* unsigned int num = 0; */
|
||||
/* while (num < n) */
|
||||
/* { */
|
||||
/* write_string_with_care (" "); */
|
||||
/* num++; */
|
||||
/* } */
|
||||
/* Cursor_c += n; */
|
||||
/* return; */
|
||||
/* } */
|
||||
|
||||
|
||||
if (n <= 4)
|
||||
{
|
||||
SLtt_normal_video ();
|
||||
if (n >= sizeof (buf))
|
||||
n = sizeof (buf) - 1;
|
||||
SLMEMSET (buf, ' ', n);
|
||||
buf[n] = 0;
|
||||
write_string_with_care (buf);
|
||||
@ -1571,10 +1616,16 @@ static void forward_cursor (unsigned int n, int row)
|
||||
}
|
||||
|
||||
|
||||
/* FIXME!! If the terminal does not support color, then this route has
|
||||
* problems of color object 0 has been assigned some monochrome attribute
|
||||
* such as reverse video. In such a case, space_char=' ' is not a simple
|
||||
* space character as is assumed below.
|
||||
*/
|
||||
|
||||
void SLtt_smart_puts(SLsmg_Char_Type *neww, SLsmg_Char_Type *oldd, int len, int row)
|
||||
{
|
||||
register SLsmg_Char_Type *p, *q, *qmax, *pmax, *buf;
|
||||
SLsmg_Char_Type buffer[256];
|
||||
SLsmg_Char_Type buffer[SLTT_MAX_SCREEN_COLS+1];
|
||||
unsigned int n_spaces;
|
||||
SLsmg_Char_Type *space_match, *last_buffered_match;
|
||||
#ifdef HP_GLITCH_CODE
|
||||
@ -1600,6 +1651,9 @@ void SLtt_smart_puts(SLsmg_Char_Type *neww, SLsmg_Char_Type *oldd, int len, int
|
||||
}
|
||||
#endif
|
||||
|
||||
if (len > SLTT_MAX_SCREEN_COLS)
|
||||
len = SLTT_MAX_SCREEN_COLS;
|
||||
|
||||
q = oldd; p = neww;
|
||||
qmax = oldd + len;
|
||||
pmax = p + len;
|
||||
@ -1662,7 +1716,7 @@ void SLtt_smart_puts(SLsmg_Char_Type *neww, SLsmg_Char_Type *oldd, int len, int
|
||||
/* Find where the last non-blank character on old/new screen is */
|
||||
|
||||
space_char = ' ';
|
||||
if ((*(pmax-1) & 0xFF) == ' ')
|
||||
if (CHAR_EQS(*(pmax-1), ' '))
|
||||
{
|
||||
/* If we get here, then we can erase to the end of the line to create
|
||||
* the final space. However, this will only work _if_ erasing will
|
||||
@ -1713,7 +1767,7 @@ void SLtt_smart_puts(SLsmg_Char_Type *neww, SLsmg_Char_Type *oldd, int len, int
|
||||
{
|
||||
#endif
|
||||
/* Try use use erase to bol if possible */
|
||||
if ((Del_Bol_Str != NULL) && ((*neww & 0xFF) == 32))
|
||||
if ((Del_Bol_Str != NULL) && (CHAR_OF(*neww) == ' '))
|
||||
{
|
||||
SLsmg_Char_Type *p1;
|
||||
SLsmg_Char_Type blank;
|
||||
@ -1724,7 +1778,7 @@ void SLtt_smart_puts(SLsmg_Char_Type *neww, SLsmg_Char_Type *oldd, int len, int
|
||||
blank = *p1;
|
||||
/* black+white attributes do not support bce */
|
||||
else
|
||||
blank = 32;
|
||||
blank = ' ';
|
||||
|
||||
while ((p1 < pmax) && (CHAR_EQS (*p1, blank)))
|
||||
p1++;
|
||||
@ -1742,7 +1796,7 @@ void SLtt_smart_puts(SLsmg_Char_Type *neww, SLsmg_Char_Type *oldd, int len, int
|
||||
q = oldd + ofs;
|
||||
p = p1;
|
||||
SLtt_goto_rc (row, ofs - 1);
|
||||
SLtt_reverse_video (blank >> 8);
|
||||
SLtt_reverse_video (COLOR_OF(blank));
|
||||
tt_write_string (Del_Bol_Str);
|
||||
tt_write (" ", 1);
|
||||
Cursor_c += 1;
|
||||
@ -1764,7 +1818,7 @@ void SLtt_smart_puts(SLsmg_Char_Type *neww, SLsmg_Char_Type *oldd, int len, int
|
||||
n_spaces = 0;
|
||||
while (p < pmax)
|
||||
{
|
||||
if (CHAR_EQS(*q, 32) && CHAR_EQS(*p, 32))
|
||||
if (CHAR_EQS(*q, ' ') && CHAR_EQS(*p, ' '))
|
||||
{
|
||||
/* If *q is not a space, we would have to overwrite it.
|
||||
* However, if *q is a space, then while *p is also one,
|
||||
@ -1773,8 +1827,8 @@ void SLtt_smart_puts(SLsmg_Char_Type *neww, SLsmg_Char_Type *oldd, int len, int
|
||||
space_match = p;
|
||||
p++; q++;
|
||||
while ((p < pmax)
|
||||
&& CHAR_EQS(*q, 32)
|
||||
&& CHAR_EQS(*p, 32))
|
||||
&& CHAR_EQS(*q, ' ')
|
||||
&& CHAR_EQS(*p, ' '))
|
||||
{
|
||||
p++;
|
||||
q++;
|
||||
@ -1835,20 +1889,22 @@ void SLtt_smart_puts(SLsmg_Char_Type *neww, SLsmg_Char_Type *oldd, int len, int
|
||||
}
|
||||
*buf = 0;
|
||||
|
||||
/* At this point, the buffer contains characters that do not match */
|
||||
if (buf != buffer) send_attr_str (buffer);
|
||||
buf = buffer;
|
||||
|
||||
if (n_spaces
|
||||
&& ((p < pmax) /* erase to eol will achieve this effect*/
|
||||
|| (space_char != 32)))/* unless space_char is not a simple space */
|
||||
|| (space_char != ' ')))/* unless space_char is not a simple space */
|
||||
{
|
||||
forward_cursor (n_spaces, row);
|
||||
}
|
||||
|
||||
/* Now we overwrote what we could and cursor is placed at position
|
||||
* of a possible match of new and old. If this is the case, skip
|
||||
* some more.
|
||||
*/
|
||||
|
||||
/* Note that from here on, the buffer will contain matched characters */
|
||||
#if !SLANG_HAS_KANJI_SUPPORT
|
||||
while ((p < pmax) && CHAR_EQS(*p, *q))
|
||||
{
|
||||
@ -1912,6 +1968,12 @@ void SLtt_smart_puts(SLsmg_Char_Type *neww, SLsmg_Char_Type *oldd, int len, int
|
||||
}
|
||||
}
|
||||
|
||||
/* At this point we have reached the end of the new string with the
|
||||
* exception of space_chars hanging off the end of it, but we may not have
|
||||
* reached the end of the old string if they did not match.
|
||||
*/
|
||||
|
||||
/* Here the buffer will consist only of characters that have matched */
|
||||
if (buf != buffer)
|
||||
{
|
||||
if (q < qmax)
|
||||
@ -1931,7 +1993,7 @@ void SLtt_smart_puts(SLsmg_Char_Type *neww, SLsmg_Char_Type *oldd, int len, int
|
||||
|
||||
if (q < qmax)
|
||||
{
|
||||
SLtt_reverse_video (space_char >> 8);
|
||||
SLtt_reverse_video (COLOR_OF(space_char));
|
||||
del_eol ();
|
||||
}
|
||||
|
||||
@ -2134,7 +2196,11 @@ int SLtt_initialize (char *term)
|
||||
if (term == NULL)
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (_SLsecure_issetugid ()
|
||||
&& ((term[0] == '.') || (NULL != strchr(term, '/'))))
|
||||
return -1;
|
||||
#endif
|
||||
Linux_Console = (!strncmp (term, "linux", 5)
|
||||
# ifdef linux
|
||||
|| !strncmp(term, "con", 3)
|
||||
@ -2241,7 +2307,7 @@ int SLtt_initialize (char *term)
|
||||
if (is_xterm && (Del_Bol_Str == NULL))
|
||||
Del_Bol_Str = "\033[1K";
|
||||
if (is_xterm && (Del_Eol_Str == NULL))
|
||||
Del_Bol_Str = "\033[K";
|
||||
Del_Eol_Str = "\033[K";
|
||||
|
||||
Rev_Vid_Str = SLtt_tgetstr("mr");
|
||||
if (Rev_Vid_Str == NULL) Rev_Vid_Str = SLtt_tgetstr("so");
|
||||
@ -2340,17 +2406,21 @@ int SLtt_initialize (char *term)
|
||||
SLtt_Has_Alt_Charset = 0;
|
||||
|
||||
Reset_Color_String = SLtt_tgetstr ("op");
|
||||
|
||||
/* Apparantly the difference between "AF" and "Sf" is that AF uses RGB,
|
||||
* but Sf uses BGR.
|
||||
*/
|
||||
Color_Fg_Str = SLtt_tgetstr ("AF"); /* ANSI setaf */
|
||||
if (Color_Fg_Str == NULL)
|
||||
{
|
||||
Color_Fg_Str = SLtt_tgetstr ("Sf"); /* setf */
|
||||
Is_Fg_BGR = (Color_Fg_Str != NULL);
|
||||
}
|
||||
Color_Bg_Str = SLtt_tgetstr ("AB"); /* ANSI setab */
|
||||
Color_Bg_Str = SLtt_tgetstr ("AB"); /* ANSI setbf */
|
||||
if (Color_Bg_Str == NULL)
|
||||
{
|
||||
Color_Bg_Str = SLtt_tgetstr ("Sb"); /* setb */
|
||||
Is_Bg_BGR = (Color_Bg_Str != NULL);
|
||||
Is_Fg_BGR = (Color_Bg_Str != NULL);
|
||||
}
|
||||
|
||||
if ((Max_Terminfo_Colors = SLtt_tgetnum ("Co")) < 0)
|
||||
@ -2416,6 +2486,12 @@ void SLtt_get_terminfo ()
|
||||
{
|
||||
int zero = 0;
|
||||
|
||||
/* Apparantly, this cannot fail according to the man pages. */
|
||||
if (SLang_TT_Write_FD == -1)
|
||||
SLang_TT_Write_FD = fileno (stdout);
|
||||
|
||||
Can_Background_Color_Erase = 0;
|
||||
|
||||
Color_Fg_Str = "\033[3%dm";
|
||||
Color_Bg_Str = "\033[4%dm";
|
||||
Max_Terminfo_Colors = 8;
|
||||
@ -2614,12 +2690,8 @@ void SLtt_get_screen_size (void)
|
||||
if (s != NULL) c = atoi (s);
|
||||
}
|
||||
|
||||
if (r <= 0) r = 24;
|
||||
if (c <= 0) c = 80;
|
||||
#if 0
|
||||
if ((r <= 0) || (r > 200)) r = 24;
|
||||
if ((c <= 0) || (c > 250)) c = 80;
|
||||
#endif
|
||||
if ((r <= 0) || (r > SLTT_MAX_SCREEN_ROWS)) r = 24;
|
||||
if ((c <= 0) || (c > SLTT_MAX_SCREEN_COLS)) c = 80;
|
||||
SLtt_Screen_Rows = r;
|
||||
SLtt_Screen_Cols = c;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* error handling common to all routines. */
|
||||
/* Copyright (c) 1992, 1999, 2001, 2002 John E. Davis
|
||||
/* Copyright (c) 1992, 1999, 2001, 2002, 2003 John E. Davis
|
||||
* This file is part of the S-Lang library.
|
||||
*
|
||||
* You may distribute under the terms of either the GNU General Public
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 1992, 1999, 2001, 2002 John E. Davis
|
||||
/* Copyright (c) 1992, 1999, 2001, 2002, 2003 John E. Davis
|
||||
* This file is part of the S-Lang library.
|
||||
*
|
||||
* You may distribute under the terms of either the GNU General Public
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 1992, 1999, 2001, 2002 John E. Davis
|
||||
/* Copyright (c) 1992, 1999, 2001, 2002, 2003 John E. Davis
|
||||
* This file is part of the S-Lang library.
|
||||
*
|
||||
* Trimmed down for use in GNU Midnight Commander.
|
||||
@ -6,6 +6,7 @@
|
||||
* You may distribute under the terms of either the GNU General Public
|
||||
* License or the Perl Artistic License.
|
||||
*/
|
||||
#define _GNU_SOURCE
|
||||
#include "slinclud.h"
|
||||
|
||||
#include "slang.h"
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 1998, 1999, 2001, 2002 John E. Davis
|
||||
/* Copyright (c) 1998, 1999, 2001, 2002, 2003 John E. Davis
|
||||
* This file is part of the S-Lang library.
|
||||
*
|
||||
* You may distribute under the terms of either the GNU General Public
|
||||
@ -21,7 +21,7 @@
|
||||
#include "_slang.h"
|
||||
|
||||
/* Do not trust these environments */
|
||||
#if defined(__CYGWIN32__) || defined(__MINGW32__) || defined(AMIGA)
|
||||
#if defined(__MINGW32__) || defined(AMIGA)
|
||||
# ifdef SLANG_POSIX_SIGNALS
|
||||
# undef SLANG_POSIX_SIGNALS
|
||||
# endif
|
||||
@ -151,7 +151,6 @@ int SLsig_unblock_signals (void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if 0
|
||||
#ifdef MSWINDOWS
|
||||
int SLsystem (char *cmd)
|
||||
{
|
||||
@ -227,7 +226,7 @@ int SLsystem (char *cmd)
|
||||
(void) sigprocmask (SIG_SETMASK, &save_mask, NULL);
|
||||
# endif
|
||||
|
||||
execl ("/bin/sh", "sh", "-c", cmd, (char *) NULL);
|
||||
execl ("/bin/sh", "sh", "-c", cmd, NULL);
|
||||
_exit (127);
|
||||
}
|
||||
else
|
||||
@ -289,6 +288,7 @@ int SLsystem (char *cmd)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#include <windows.h>
|
||||
static int msw_system (char *cmd)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* SLang Screen management routines */
|
||||
/* Copyright (c) 1992, 1999, 2001, 2002 John E. Davis
|
||||
/* Copyright (c) 1992, 1999, 2001, 2002, 2003 John E. Davis
|
||||
* This file is part of the S-Lang library.
|
||||
*
|
||||
* You may distribute under the terms of either the GNU General Public
|
||||
@ -26,13 +26,7 @@ Screen_Type;
|
||||
#define TRASHED 0x2
|
||||
static int Screen_Trashed;
|
||||
|
||||
#if !defined(__MSDOS_16BIT__)
|
||||
# define MAX_SCREEN_SIZE 256
|
||||
#else
|
||||
# define MAX_SCREEN_SIZE 75
|
||||
#endif
|
||||
|
||||
Screen_Type SL_Screen[MAX_SCREEN_SIZE];
|
||||
Screen_Type SL_Screen[SLTT_MAX_SCREEN_ROWS];
|
||||
static int Start_Col, Start_Row;
|
||||
static int Screen_Cols, Screen_Rows;
|
||||
static int This_Row, This_Col;
|
||||
@ -99,7 +93,7 @@ static void blank_line (SLsmg_Char_Type *p, int n, unsigned char ch)
|
||||
}
|
||||
}
|
||||
|
||||
static void clear_region (int row, int n)
|
||||
static void clear_region (int row, int n, unsigned char ch)
|
||||
{
|
||||
int i;
|
||||
int imax = row + n;
|
||||
@ -109,7 +103,7 @@ static void clear_region (int row, int n)
|
||||
{
|
||||
if (i >= 0)
|
||||
{
|
||||
blank_line (SL_Screen[i].neew, Screen_Cols, ' ');
|
||||
blank_line (SL_Screen[i].neew, Screen_Cols, ch);
|
||||
SL_Screen[i].flags |= TOUCHED;
|
||||
}
|
||||
}
|
||||
@ -169,7 +163,7 @@ void SLsmg_erase_eos (void)
|
||||
if (Smg_Inited == 0) return;
|
||||
|
||||
SLsmg_erase_eol ();
|
||||
clear_region (This_Row + 1, Screen_Rows);
|
||||
clear_region (This_Row + 1, Screen_Rows, ' ');
|
||||
}
|
||||
|
||||
static int This_Alt_Char;
|
||||
@ -485,7 +479,7 @@ void SLsmg_cls (void)
|
||||
|
||||
tac = This_Alt_Char; This_Alt_Char = 0;
|
||||
SLsmg_set_color (0);
|
||||
clear_region (0, Screen_Rows);
|
||||
clear_region (0, Screen_Rows, ' ');
|
||||
This_Alt_Char = tac;
|
||||
SLsmg_set_color (0);
|
||||
Cls_Flag = 1;
|
||||
@ -984,8 +978,8 @@ static void init_alt_char_set (void)
|
||||
else p = (unsigned char *) *tt_Graphics_Char_Pairs;
|
||||
if (p == NULL) return;
|
||||
}
|
||||
else p = (unsigned char *) Fake_Alt_Char_Pairs;
|
||||
pmax = p + strlen ((char *) p);
|
||||
else p = (unsigned const char *) Fake_Alt_Char_Pairs;
|
||||
pmax = p + strlen ((const char *) p);
|
||||
|
||||
/* Some systems have messed up entries for this */
|
||||
while (p < pmax)
|
||||
@ -1077,8 +1071,8 @@ static int init_smg (void)
|
||||
#endif
|
||||
|
||||
Screen_Rows = *tt_Screen_Rows;
|
||||
if (Screen_Rows > MAX_SCREEN_SIZE)
|
||||
Screen_Rows = MAX_SCREEN_SIZE;
|
||||
if (Screen_Rows > SLTT_MAX_SCREEN_ROWS)
|
||||
Screen_Rows = SLTT_MAX_SCREEN_ROWS;
|
||||
|
||||
Screen_Cols = *tt_Screen_Cols;
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
* the slang SLtt interface.
|
||||
*/
|
||||
|
||||
/* Copyright (c) 1992, 1999, 2001, 2002 John E. Davis
|
||||
/* Copyright (c) 1992, 1999, 2001, 2002, 2003 John E. Davis
|
||||
* This file is part of the S-Lang library.
|
||||
*
|
||||
* You may distribute under the terms of either the GNU General Public
|
||||
@ -248,7 +248,11 @@ SLterminfo_Type *_SLtt_tigetent (char *term)
|
||||
#endif
|
||||
)
|
||||
return NULL;
|
||||
|
||||
#if 0
|
||||
if (_SLsecure_issetugid ()
|
||||
&& ((term[0] == '.') || (NULL != strchr (term, '/'))))
|
||||
return NULL;
|
||||
#endif
|
||||
if (NULL == (ti = (SLterminfo_Type *) SLmalloc (sizeof (SLterminfo_Type))))
|
||||
{
|
||||
return NULL;
|
||||
@ -1006,6 +1010,16 @@ static int tcap_getent (char *term, SLterminfo_Type *ti)
|
||||
termcap = (unsigned char *) getenv ("TERMCAP");
|
||||
if ((termcap == NULL) || (*termcap == '/')) return -1;
|
||||
|
||||
/* SUN Solaris 7&8 have bug in tset program under tcsh,
|
||||
* eval `tset -s -A -Q` sets value of TERMCAP to ":",
|
||||
* under other shells it works fine.
|
||||
* SUN was informed, they marked it as duplicate of bug 4086585
|
||||
* but didn't care to fix it... <mikkopa@cs.tut.fi>
|
||||
*/
|
||||
if ((termcap[0] == ':') && (termcap[1] == 0))
|
||||
return -1;
|
||||
|
||||
|
||||
/* We have a termcap so lets use it provided it does not have a reference
|
||||
* to another terminal via tc=. In that case, use terminfo. The alternative
|
||||
* would be to parse the termcap file which I do not want to do right now.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* slutty.c --- Unix Low level terminal (tty) functions for S-Lang */
|
||||
/* Copyright (c) 1992, 1999, 2001, 2002 John E. Davis
|
||||
/* Copyright (c) 1992, 1999, 2001, 2002, 2003 John E. Davis
|
||||
* This file is part of the S-Lang library.
|
||||
*
|
||||
* You may distribute under the terms of either the GNU General Public
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* -*- mode: C; mode: fold -*- */
|
||||
/* Copyright (c) 1992, 1997, 2001, 2002 John E. Davis
|
||||
/* Copyright (c) 1992, 1997, 2001, 2002, 2003 John E. Davis
|
||||
* This file is part of the S-Lang library.
|
||||
*
|
||||
* You may distribute under the terms of either the GNU General Public
|
||||
@ -2190,13 +2190,6 @@ int SLtt_set_cursor_visibility (int show)
|
||||
#endif
|
||||
}
|
||||
|
||||
void SLtt_set_mono (int obj_unused, char *unused, SLtt_Char_Type c_unused)
|
||||
{
|
||||
(void) obj_unused;
|
||||
(void) unused;
|
||||
(void) c_unused;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*\
|
||||
* Function: void SLtt_reverse_video (int color);
|
||||
*
|
||||
@ -2324,3 +2317,21 @@ static void fixup_colors (void)
|
||||
SLtt_normal_video ();
|
||||
}
|
||||
|
||||
|
||||
/* FIXME!!! Add mono support.
|
||||
* The following functions have not been fully implemented.
|
||||
*/
|
||||
void SLtt_set_mono (int obj_unused, char *unused, SLtt_Char_Type c_unused)
|
||||
{
|
||||
(void) obj_unused;
|
||||
(void) unused;
|
||||
(void) c_unused;
|
||||
}
|
||||
|
||||
#if 0
|
||||
void SLtt_add_color_attribute (int obj, SLtt_Char_Type attr)
|
||||
{
|
||||
(void) obj;
|
||||
(void) attr;
|
||||
}
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 1992, 1999, 2001, 2002 John E. Davis
|
||||
/* Copyright (c) 1992, 1999, 2001, 2002, 2003 John E. Davis
|
||||
* This file is part of the S-Lang library.
|
||||
*
|
||||
* You may distribute under the terms of either the GNU General Public
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user