slang.h | slang.h | |||
---|---|---|---|---|
#ifndef DAVIS_SLANG_H_ | #ifndef DAVIS_SLANG_H_ | |||
#define DAVIS_SLANG_H_ | #define DAVIS_SLANG_H_ | |||
/* -*- mode: C; mode: fold; -*- */ | /* -*- mode: C; mode: fold; -*- */ | |||
/* | /* | |||
Copyright (C) 2004-2007 John E. Davis | Copyright (C) 2004-2008 John E. Davis | |||
This file is part of the S-Lang Library. | This file is part of the S-Lang Library. | |||
The S-Lang Library is free software; you can redistribute it and/or | The S-Lang Library is free software; you can redistribute it and/or | |||
modify it under the terms of the GNU General Public License as | modify it under the terms of the GNU General Public License as | |||
published by the Free Software Foundation; either version 2 of the | published by the Free Software Foundation; either version 2 of the | |||
License, or (at your option) any later version. | License, or (at your option) any later version. | |||
The S-Lang Library is distributed in the hope that it will be useful, | The S-Lang Library is distributed in the hope that it will be useful, | |||
but WITHOUT ANY WARRANTY; without even the implied warranty of | but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
General Public License for more details. | General Public License for more details. | |||
You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License | |||
along with this library; if not, write to the Free Software | along with this library; if not, write to the Free Software | |||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |||
USA. | USA. | |||
*/ | */ | |||
#define SLANG_VERSION 20103 | #define SLANG_VERSION 20104 | |||
#define SLANG_VERSION_STRING "2.1.3" | #define SLANG_VERSION_STRING "2.1.4" | |||
/* #ifdef __DATE__ */ | /* #ifdef __DATE__ */ | |||
/* # define SLANG_VERSION_STRING SLANG_VERSION_STRING0 " " __DATE__ */ | /* # define SLANG_VERSION_STRING SLANG_VERSION_STRING0 " " __DATE__ */ | |||
/* #else */ | /* #else */ | |||
/* # define SLANG_VERSION_STRING SLANG_VERSION_STRING0 */ | /* # define SLANG_VERSION_STRING SLANG_VERSION_STRING0 */ | |||
/* #endif */ | /* #endif */ | |||
/*{{{ System Dependent Macros and Typedefs */ | /*{{{ System Dependent Macros and Typedefs */ | |||
#if defined(__WATCOMC__) && defined(DOS) | #if defined(__WATCOMC__) && defined(DOS) | |||
# ifndef __MSDOS__ | # ifndef __MSDOS__ | |||
# define __MSDOS__ | # define __MSDOS__ | |||
skipping to change at line 219 | skipping to change at line 219 | |||
#define SLATTRIBUTE_PRINTF(a,b) SLATTRIBUTE_((format(printf,a,b))) | #define SLATTRIBUTE_PRINTF(a,b) SLATTRIBUTE_((format(printf,a,b))) | |||
#if defined (__cplusplus) || defined(__STDC__) || defined(IBMPC_SYSTEM) | #if defined (__cplusplus) || defined(__STDC__) || defined(IBMPC_SYSTEM) | |||
typedef void *VOID_STAR; | typedef void *VOID_STAR; | |||
#define SLCONST const | #define SLCONST const | |||
#else | #else | |||
typedef unsigned char *VOID_STAR; | typedef unsigned char *VOID_STAR; | |||
#define SLCONST | #define SLCONST | |||
#endif | #endif | |||
#ifdef ENABLE_SLFUTURE_CONST | ||||
# define SLFUTURE_CONST SLCONST | ||||
#else | ||||
# define SLFUTURE_CONST | ||||
#endif | ||||
typedef int (*FVOID_STAR)(void); | typedef int (*FVOID_STAR)(void); | |||
#if defined(__MSDOS__) && defined(__BORLANDC__) | #if defined(__MSDOS__) && defined(__BORLANDC__) | |||
# define SLFREE(buf) farfree((void far *)(buf)) | # define SLFREE(buf) farfree((void far *)(buf)) | |||
# define SLMALLOC(x) farmalloc((unsigned long) (x)) | # define SLMALLOC(x) farmalloc((unsigned long) (x)) | |||
# define SLREALLOC(buf, n) farrealloc((void far *) (buf), (unsigned long) ( n)) | # define SLREALLOC(buf, n) farrealloc((void far *) (buf), (unsigned long) ( n)) | |||
# define SLCALLOC(n, m) farcalloc((unsigned long) (n), (unsigned long) (m)) | # define SLCALLOC(n, m) farcalloc((unsigned long) (n), (unsigned long) (m)) | |||
#else | #else | |||
# if defined(VMS) && !defined(__DECC) | # if defined(VMS) && !defined(__DECC) | |||
# define SLFREE VAXC$FREE_OPT | # define SLFREE VAXC$FREE_OPT | |||
skipping to change at line 274 | skipping to change at line 280 | |||
SL_EXTERN char *SLmemcpy (char *, char *, int); | SL_EXTERN char *SLmemcpy (char *, char *, int); | |||
SL_EXTERN int SLmemcmp (char *, char *, int); | SL_EXTERN int SLmemcmp (char *, char *, int); | |||
/*}}}*/ | /*}}}*/ | |||
/* SLstrings */ | /* SLstrings */ | |||
typedef char SLstr_Type; | typedef char SLstr_Type; | |||
/* An SLstr_Type object must be treated as a constant and may only be freed | /* An SLstr_Type object must be treated as a constant and may only be freed | |||
* by the SLang_free_slstring function and nothing else. | * by the SLang_free_slstring function and nothing else. | |||
*/ | */ | |||
SL_EXTERN SLstr_Type *SLang_create_nslstring (char *, unsigned int); | SL_EXTERN SLstr_Type *SLang_create_nslstring (SLFUTURE_CONST char *, unsign | |||
SL_EXTERN SLstr_Type *SLang_create_slstring (char *); | ed int); | |||
SL_EXTERN SLstr_Type *SLang_create_slstring (SLFUTURE_CONST char *); | ||||
SL_EXTERN void SLang_free_slstring (SLstr_Type *); /* handles NULL */ | SL_EXTERN void SLang_free_slstring (SLstr_Type *); /* handles NULL */ | |||
SL_EXTERN int SLang_pop_slstring (SLstr_Type **); /* free with SLang_free _slstring */ | SL_EXTERN int SLang_pop_slstring (SLstr_Type **); /* free with SLang_free _slstring */ | |||
SL_EXTERN SLstr_Type *SLang_concat_slstrings (SLstr_Type *a, SLstr_Type *b) ; | SL_EXTERN SLstr_Type *SLang_concat_slstrings (SLstr_Type *a, SLstr_Type *b) ; | |||
SL_EXTERN void SLstring_dump_stats (void); | SL_EXTERN void SLstring_dump_stats (void); | |||
/*{{{ UTF-8 and Wide Char support */ | /*{{{ UTF-8 and Wide Char support */ | |||
#if SLANG_SIZEOF_INT == 4 | #if SLANG_SIZEOF_INT == 4 | |||
typedef unsigned int SLwchar_Type; | typedef unsigned int SLwchar_Type; | |||
skipping to change at line 330 | skipping to change at line 336 | |||
SL_EXTERN int SLwchar_iscntrl (SLwchar_Type); | SL_EXTERN int SLwchar_iscntrl (SLwchar_Type); | |||
SL_EXTERN int SLwchar_isdigit (SLwchar_Type); | SL_EXTERN int SLwchar_isdigit (SLwchar_Type); | |||
SL_EXTERN int SLwchar_isgraph (SLwchar_Type); | SL_EXTERN int SLwchar_isgraph (SLwchar_Type); | |||
SL_EXTERN int SLwchar_islower (SLwchar_Type); | SL_EXTERN int SLwchar_islower (SLwchar_Type); | |||
SL_EXTERN int SLwchar_isprint (SLwchar_Type); | SL_EXTERN int SLwchar_isprint (SLwchar_Type); | |||
SL_EXTERN int SLwchar_ispunct (SLwchar_Type); | SL_EXTERN int SLwchar_ispunct (SLwchar_Type); | |||
SL_EXTERN int SLwchar_isspace (SLwchar_Type); | SL_EXTERN int SLwchar_isspace (SLwchar_Type); | |||
SL_EXTERN int SLwchar_isupper (SLwchar_Type); | SL_EXTERN int SLwchar_isupper (SLwchar_Type); | |||
SL_EXTERN int SLwchar_isxdigit (SLwchar_Type); | SL_EXTERN int SLwchar_isxdigit (SLwchar_Type); | |||
#define SLWCWIDTH_SINGLE_WIDTH 0x0001 | #define SLWCWIDTH_SINGLE_WIDTH 0x0001 /* all double width characters given | |||
as single width */ | ||||
#define SLWCWIDTH_CJK_LEGACY 0x0002 /* Ambiguous characters given width o | ||||
f 2 */ | ||||
SL_EXTERN int SLwchar_set_wcwidth_flags (int flags); | SL_EXTERN int SLwchar_set_wcwidth_flags (int flags); | |||
/* The skip_char functions also skip over malformed strings counting each b yte | /* The skip_char functions also skip over malformed strings counting each b yte | |||
* in the malformed sequence. | * in the malformed sequence. | |||
*/ | */ | |||
SL_EXTERN SLuchar_Type *SLutf8_skip_char (SLuchar_Type *u, SLuchar_Type *um ax); | SL_EXTERN SLuchar_Type *SLutf8_skip_char (SLuchar_Type *u, SLuchar_Type *um ax); | |||
SL_EXTERN SLuchar_Type *SLutf8_bskip_char (SLuchar_Type *umin, SLuchar_Type *u); | SL_EXTERN SLuchar_Type *SLutf8_bskip_char (SLuchar_Type *umin, SLuchar_Type *u); | |||
SL_EXTERN SLuchar_Type *SLutf8_skip_chars (SLuchar_Type *u, SLuchar_Type *u max, | SL_EXTERN SLuchar_Type *SLutf8_skip_chars (SLuchar_Type *u, SLuchar_Type *u max, | |||
unsigned int num, unsigned int *dnum , | unsigned int num, unsigned int *dnum , | |||
int ignore_combining ); | int ignore_combining ); | |||
skipping to change at line 400 | skipping to change at line 407 | |||
/*}}}*/ | /*}}}*/ | |||
/*{{{ Interpreter Typedefs */ | /*{{{ Interpreter Typedefs */ | |||
typedef unsigned int SLtype; | typedef unsigned int SLtype; | |||
/* typedef unsigned short SLtype; */ | /* typedef unsigned short SLtype; */ | |||
typedef struct _pSLang_Name_Type | typedef struct _pSLang_Name_Type | |||
{ | { | |||
char *name; | SLFUTURE_CONST char *name; | |||
struct _pSLang_Name_Type *next; | struct _pSLang_Name_Type *next; | |||
unsigned char name_type; | unsigned char name_type; | |||
/* These values here map directly to byte codes. See _slang.h. | /* These values here map directly to byte codes. See _slang.h. | |||
*/ | */ | |||
#define SLANG_LVARIABLE 0x01 | #define SLANG_LVARIABLE 0x01 | |||
#define SLANG_GVARIABLE 0x02 | #define SLANG_GVARIABLE 0x02 | |||
#define SLANG_IVARIABLE 0x03 /* intrinsic variables */ | #define SLANG_IVARIABLE 0x03 /* intrinsic variables */ | |||
/* Note!!! For Macro MAKE_VARIABLE below to work, SLANG_IVARIABLE Must | /* Note!!! For Macro MAKE_VARIABLE below to work, SLANG_IVARIABLE Must | |||
be 1 less than SLANG_RVARIABLE!!! */ | be 1 less than SLANG_RVARIABLE!!! */ | |||
#define SLANG_RVARIABLE 0x04 /* read only variable */ | #define SLANG_RVARIABLE 0x04 /* read only variable */ | |||
skipping to change at line 431 | skipping to change at line 438 | |||
#define SLANG_PVARIABLE 0x0F /* private */ | #define SLANG_PVARIABLE 0x0F /* private */ | |||
#define SLANG_PFUNCTION 0x10 /* private */ | #define SLANG_PFUNCTION 0x10 /* private */ | |||
#define SLANG_HCONSTANT 0x11 | #define SLANG_HCONSTANT 0x11 | |||
#define SLANG_LCONSTANT 0x12 | #define SLANG_LCONSTANT 0x12 | |||
/* Rest of fields depend on name type */ | /* Rest of fields depend on name type */ | |||
} | } | |||
SLang_Name_Type; | SLang_Name_Type; | |||
typedef struct | typedef struct | |||
{ | { | |||
char *name; | SLFUTURE_CONST char *name; | |||
struct _pSLang_Name_Type *next; /* this is for the hash table */ | struct _pSLang_Name_Type *next; /* this is for the hash table */ | |||
char name_type; | char name_type; | |||
FVOID_STAR i_fun; /* address of object */ | FVOID_STAR i_fun; /* address of object */ | |||
/* Do not change this without modifying slang.c:execute_intrinsic_fun */ | /* Do not change this without modifying slang.c:execute_intrinsic_fun */ | |||
#define SLANG_MAX_INTRIN_ARGS 7 | #define SLANG_MAX_INTRIN_ARGS 7 | |||
SLtype arg_types [SLANG_MAX_INTRIN_ARGS]; | SLtype arg_types [SLANG_MAX_INTRIN_ARGS]; | |||
unsigned char num_args; | unsigned char num_args; | |||
SLtype return_type; | SLtype return_type; | |||
} | } | |||
SLang_Intrin_Fun_Type; | SLang_Intrin_Fun_Type; | |||
typedef struct | typedef struct | |||
{ | { | |||
char *name; | SLFUTURE_CONST char *name; | |||
SLang_Name_Type *next; | SLang_Name_Type *next; | |||
char name_type; | char name_type; | |||
VOID_STAR addr; | VOID_STAR addr; | |||
SLtype type; | SLtype type; | |||
} | } | |||
SLang_Intrin_Var_Type; | SLang_Intrin_Var_Type; | |||
typedef struct | typedef struct | |||
{ | { | |||
char *name; | SLFUTURE_CONST char *name; | |||
SLang_Name_Type *next; | SLang_Name_Type *next; | |||
char name_type; | char name_type; | |||
int unary_op; | int unary_op; | |||
} | } | |||
SLang_App_Unary_Type; | SLang_App_Unary_Type; | |||
typedef struct | typedef struct | |||
{ | { | |||
char *name; | SLFUTURE_CONST char *name; | |||
SLang_Name_Type *next; | SLang_Name_Type *next; | |||
char name_type; | char name_type; | |||
int unary_op; | int unary_op; | |||
} | } | |||
SLang_Math_Unary_Type; | SLang_Math_Unary_Type; | |||
typedef struct | typedef struct | |||
{ | { | |||
char *name; | SLFUTURE_CONST char *name; | |||
SLang_Name_Type *next; | SLang_Name_Type *next; | |||
char name_type; | char name_type; | |||
SLtype data_type; | SLtype data_type; | |||
short value; | short value; | |||
} | } | |||
SLang_HConstant_Type; | SLang_HConstant_Type; | |||
typedef struct | typedef struct | |||
{ | { | |||
char *name; | SLFUTURE_CONST char *name; | |||
SLang_Name_Type *next; | SLang_Name_Type *next; | |||
char name_type; | char name_type; | |||
SLtype data_type; | SLtype data_type; | |||
int value; | int value; | |||
} | } | |||
SLang_IConstant_Type; | SLang_IConstant_Type; | |||
typedef struct | typedef struct | |||
{ | { | |||
char *name; | SLFUTURE_CONST char *name; | |||
SLang_Name_Type *next; | SLang_Name_Type *next; | |||
char name_type; | char name_type; | |||
SLtype data_type; | SLtype data_type; | |||
long value; | long value; | |||
} | } | |||
SLang_LConstant_Type; | SLang_LConstant_Type; | |||
#ifdef HAVE_LONG_LONG | #ifdef HAVE_LONG_LONG | |||
typedef struct | typedef struct | |||
{ | { | |||
char *name; | SLFUTURE_CONST char *name; | |||
SLang_Name_Type *next; | SLang_Name_Type *next; | |||
char name_type; | char name_type; | |||
long long ll; | long long ll; | |||
} | } | |||
SLang_LLConstant_Type; | SLang_LLConstant_Type; | |||
#endif | #endif | |||
typedef struct | typedef struct | |||
{ | { | |||
char *name; | SLFUTURE_CONST char *name; | |||
SLang_Name_Type *next; | SLang_Name_Type *next; | |||
char name_type; | char name_type; | |||
double d; | double d; | |||
} | } | |||
SLang_DConstant_Type; | SLang_DConstant_Type; | |||
typedef struct | typedef struct | |||
{ | { | |||
char *name; | SLFUTURE_CONST char *name; | |||
SLang_Name_Type *next; | SLang_Name_Type *next; | |||
char name_type; | char name_type; | |||
float f; | float f; | |||
} | } | |||
SLang_FConstant_Type; | SLang_FConstant_Type; | |||
typedef struct | typedef struct | |||
{ | { | |||
char *field_name; /* gets replaced by slstring at run-t ime */ | SLFUTURE_CONST char *field_name; /* gets replaced by s lstring at run-time */ | |||
unsigned int offset; | unsigned int offset; | |||
SLtype type; | SLtype type; | |||
unsigned char read_only; | unsigned char read_only; | |||
} | } | |||
SLang_IStruct_Field_Type; | SLang_IStruct_Field_Type; | |||
typedef SLCONST struct _pSLang_CStruct_Field_Type /* a g++ bug?? yuk*/ | typedef SLCONST struct _pSLang_CStruct_Field_Type /* a g++ bug?? yuk*/ | |||
{ | { | |||
char *field_name; | SLFUTURE_CONST char *field_name; | |||
unsigned int offset; | unsigned int offset; | |||
SLtype type; | SLtype type; | |||
unsigned char read_only; | unsigned char read_only; | |||
} | } | |||
SLang_CStruct_Field_Type; | SLang_CStruct_Field_Type; | |||
SL_EXTERN int SLadd_intrin_fun_table (SLang_Intrin_Fun_Type *, char *); | SL_EXTERN int SLadd_intrin_fun_table (SLang_Intrin_Fun_Type *, SLFUTURE_CON | |||
SL_EXTERN int SLadd_intrin_var_table (SLang_Intrin_Var_Type *, char *); | ST char *); | |||
SL_EXTERN int SLadd_app_unary_table (SLang_App_Unary_Type *, char *); | SL_EXTERN int SLadd_intrin_var_table (SLang_Intrin_Var_Type *, SLFUTURE_CON | |||
SL_EXTERN int SLadd_math_unary_table (SLang_Math_Unary_Type *, char *); | ST char *); | |||
SL_EXTERN int SLadd_iconstant_table (SLang_IConstant_Type *, char *); | SL_EXTERN int SLadd_app_unary_table (SLang_App_Unary_Type *, SLFUTURE_CONST | |||
SL_EXTERN int SLadd_dconstant_table (SLang_DConstant_Type *, char *); | char *); | |||
SL_EXTERN int SLadd_fconstant_table (SLang_FConstant_Type *, char *); | SL_EXTERN int SLadd_math_unary_table (SLang_Math_Unary_Type *, SLFUTURE_CON | |||
ST char *); | ||||
SL_EXTERN int SLadd_iconstant_table (SLang_IConstant_Type *, SLFUTURE_CONST | ||||
char *); | ||||
SL_EXTERN int SLadd_dconstant_table (SLang_DConstant_Type *, SLFUTURE_CONST | ||||
char *); | ||||
SL_EXTERN int SLadd_fconstant_table (SLang_FConstant_Type *, SLFUTURE_CONST | ||||
char *); | ||||
#ifdef HAVE_LONG_LONG | #ifdef HAVE_LONG_LONG | |||
SL_EXTERN int SLadd_llconstant_table (SLang_LLConstant_Type *, char *); | SL_EXTERN int SLadd_llconstant_table (SLang_LLConstant_Type *, SLFUTURE_CON ST char *); | |||
#endif | #endif | |||
SL_EXTERN int SLadd_istruct_table (SLang_IStruct_Field_Type *, VOID_STAR, c har *); | SL_EXTERN int SLadd_istruct_table (SLang_IStruct_Field_Type *, VOID_STAR, S LFUTURE_CONST char *); | |||
typedef struct _pSLang_NameSpace_Type SLang_NameSpace_Type; | typedef struct _pSLang_NameSpace_Type SLang_NameSpace_Type; | |||
SL_EXTERN int SLns_add_intrin_fun_table (SLang_NameSpace_Type *, SLang_Intr | SL_EXTERN int SLns_add_intrin_fun_table (SLang_NameSpace_Type *, SLang_Intr | |||
in_Fun_Type *, char *); | in_Fun_Type *, SLFUTURE_CONST char *); | |||
SL_EXTERN int SLns_add_intrin_var_table (SLang_NameSpace_Type *, SLang_Intr | SL_EXTERN int SLns_add_intrin_var_table (SLang_NameSpace_Type *, SLang_Intr | |||
in_Var_Type *, char *); | in_Var_Type *, SLFUTURE_CONST char *); | |||
SL_EXTERN int SLns_add_app_unary_table (SLang_NameSpace_Type *, SLang_App_U | SL_EXTERN int SLns_add_app_unary_table (SLang_NameSpace_Type *, SLang_App_U | |||
nary_Type *, char *); | nary_Type *, SLFUTURE_CONST char *); | |||
SL_EXTERN int SLns_add_math_unary_table (SLang_NameSpace_Type *, SLang_Math | SL_EXTERN int SLns_add_math_unary_table (SLang_NameSpace_Type *, SLang_Math | |||
_Unary_Type *, char *); | _Unary_Type *, SLFUTURE_CONST char *); | |||
SL_EXTERN int SLns_add_hconstant_table (SLang_NameSpace_Type *, SLang_HCons | SL_EXTERN int SLns_add_hconstant_table (SLang_NameSpace_Type *, SLang_HCons | |||
tant_Type *, char *); | tant_Type *, SLFUTURE_CONST char *); | |||
SL_EXTERN int SLns_add_iconstant_table (SLang_NameSpace_Type *, SLang_ICons | SL_EXTERN int SLns_add_iconstant_table (SLang_NameSpace_Type *, SLang_ICons | |||
tant_Type *, char *); | tant_Type *, SLFUTURE_CONST char *); | |||
SL_EXTERN int SLns_add_lconstant_table (SLang_NameSpace_Type *, SLang_LCons | SL_EXTERN int SLns_add_lconstant_table (SLang_NameSpace_Type *, SLang_LCons | |||
tant_Type *, char *); | tant_Type *, SLFUTURE_CONST char *); | |||
SL_EXTERN int SLns_add_fconstant_table (SLang_NameSpace_Type *, SLang_FCons | SL_EXTERN int SLns_add_fconstant_table (SLang_NameSpace_Type *, SLang_FCons | |||
tant_Type *, char *); | tant_Type *, SLFUTURE_CONST char *); | |||
SL_EXTERN int SLns_add_dconstant_table (SLang_NameSpace_Type *, SLang_DCons | SL_EXTERN int SLns_add_dconstant_table (SLang_NameSpace_Type *, SLang_DCons | |||
tant_Type *, char *); | tant_Type *, SLFUTURE_CONST char *); | |||
#ifdef HAVE_LONG_LONG | #ifdef HAVE_LONG_LONG | |||
SL_EXTERN int SLns_add_llconstant_table (SLang_NameSpace_Type *, SLang_LLCo nstant_Type *, char *); | SL_EXTERN int SLns_add_llconstant_table (SLang_NameSpace_Type *, SLang_LLCo nstant_Type *, SLFUTURE_CONST char *); | |||
#endif | #endif | |||
SL_EXTERN int SLns_add_istruct_table (SLang_NameSpace_Type *, SLang_IStruct _Field_Type *, VOID_STAR, char *); | SL_EXTERN int SLns_add_istruct_table (SLang_NameSpace_Type *, SLang_IStruct _Field_Type *, VOID_STAR, SLFUTURE_CONST char *); | |||
SL_EXTERN int SLns_add_hconstant (SLang_NameSpace_Type *, char *, SLtype, s | SL_EXTERN int SLns_add_hconstant (SLang_NameSpace_Type *, SLFUTURE_CONST ch | |||
hort); | ar *, SLtype, short); | |||
SL_EXTERN int SLns_add_iconstant (SLang_NameSpace_Type *, char *, SLtype, i | SL_EXTERN int SLns_add_iconstant (SLang_NameSpace_Type *, SLFUTURE_CONST ch | |||
nt); | ar *, SLtype, int); | |||
SL_EXTERN int SLns_add_lconstant (SLang_NameSpace_Type *, char *, SLtype, l | SL_EXTERN int SLns_add_lconstant (SLang_NameSpace_Type *, SLFUTURE_CONST ch | |||
ong); | ar *, SLtype, long); | |||
SL_EXTERN int SLns_add_fconstant (SLang_NameSpace_Type *, char *, float); | SL_EXTERN int SLns_add_fconstant (SLang_NameSpace_Type *, SLFUTURE_CONST ch | |||
SL_EXTERN int SLns_add_dconstant (SLang_NameSpace_Type *, char *, double); | ar *, float); | |||
SL_EXTERN int SLns_add_dconstant (SLang_NameSpace_Type *, SLFUTURE_CONST ch | ||||
ar *, double); | ||||
#ifdef HAVE_LONG_LONG | #ifdef HAVE_LONG_LONG | |||
SL_EXTERN int SLns_add_llconstant (SLang_NameSpace_Type *, char *, long lon g); | SL_EXTERN int SLns_add_llconstant (SLang_NameSpace_Type *, SLFUTURE_CONST c har *, long long); | |||
#endif | #endif | |||
SL_EXTERN SLang_NameSpace_Type *SLns_create_namespace (char *); | SL_EXTERN SLang_NameSpace_Type *SLns_create_namespace (SLFUTURE_CONST char *); | |||
SL_EXTERN void SLns_delete_namespace (SLang_NameSpace_Type *); | SL_EXTERN void SLns_delete_namespace (SLang_NameSpace_Type *); | |||
SL_EXTERN int SLns_load_file (char *, char *); | SL_EXTERN int SLns_load_file (SLFUTURE_CONST char *, SLFUTURE_CONST char *) | |||
SL_EXTERN int SLns_load_string (char *, char *); | ; | |||
SL_EXTERN int (*SLns_Load_File_Hook) (char *, char *); | SL_EXTERN int SLns_load_string (SLFUTURE_CONST char *, SLFUTURE_CONST char | |||
*); | ||||
SL_EXTERN int (*SLns_Load_File_Hook) (SLFUTURE_CONST char *, SLFUTURE_CONST | ||||
char *); | ||||
#define SLANG_LOAD_FILE_VERBOSE 0x1 | ||||
#define SLANG_LOAD_MODULE_VERBOSE 0x2 | ||||
SL_EXTERN int SLang_load_file_verbose (int); | SL_EXTERN int SLang_load_file_verbose (int); | |||
/* if non-zero, display file loading messages */ | /* Bitmapped value that controls loading messages */ | |||
typedef struct SLang_Load_Type | typedef struct SLang_Load_Type | |||
{ | { | |||
int type; | int type; | |||
VOID_STAR client_data; | VOID_STAR client_data; | |||
/* Pointer to data that client needs for loading */ | /* Pointer to data that client needs for loading */ | |||
int auto_declare_globals; | int auto_declare_globals; | |||
/* if non-zero, undefined global variables are declared as static */ | /* if non-zero, undefined global variables are declared as static */ | |||
char *(*read)(struct SLang_Load_Type *); | char *(*read)(struct SLang_Load_Type *); | |||
/* function to call to read next line from obj. */ | /* function to call to read next line from obj. */ | |||
unsigned int line_num; | unsigned int line_num; | |||
/* Number of lines read, used for error reporting */ | /* Number of lines read, used for error reporting */ | |||
int parse_level; | int parse_level; | |||
/* 0 if at top level of parsing */ | /* 0 if at top level of parsing */ | |||
char *name; | SLFUTURE_CONST char *name; | |||
/* Name of this object, e.g., filename. This name should be unique beca use | /* Name of this object, e.g., filename. This name should be unique beca use | |||
* it alone determines the name space for static objects associated with | * it alone determines the name space for static objects associated with | |||
* the compilable unit. | * the compilable unit. | |||
*/ | */ | |||
char *namespace_name; | SLFUTURE_CONST char *namespace_name; | |||
unsigned long reserved[3]; | unsigned long reserved[3]; | |||
/* For future expansion */ | /* For future expansion */ | |||
} SLang_Load_Type; | } SLang_Load_Type; | |||
SL_EXTERN SLang_Load_Type *SLallocate_load_type (char *); | SL_EXTERN SLang_Load_Type *SLallocate_load_type (SLFUTURE_CONST char *); | |||
SL_EXTERN void SLdeallocate_load_type (SLang_Load_Type *); | SL_EXTERN void SLdeallocate_load_type (SLang_Load_Type *); | |||
SL_EXTERN SLang_Load_Type *SLns_allocate_load_type (char *, char *); | SL_EXTERN SLang_Load_Type *SLns_allocate_load_type (SLFUTURE_CONST char *, SLFUTURE_CONST char *); | |||
/* Returns SLang_Error upon failure */ | /* Returns SLang_Error upon failure */ | |||
SL_EXTERN int SLang_load_object (SLang_Load_Type *); | SL_EXTERN int SLang_load_object (SLang_Load_Type *); | |||
SL_EXTERN int (*SLang_Load_File_Hook)(char *); | SL_EXTERN int (*SLang_Load_File_Hook)(SLFUTURE_CONST char *); | |||
SL_EXTERN int (*SLang_Auto_Declare_Var_Hook) (char *); | SL_EXTERN int (*SLang_Auto_Declare_Var_Hook) (SLFUTURE_CONST char *); | |||
SL_EXTERN int SLang_generate_debug_info (int); | SL_EXTERN int SLang_generate_debug_info (int); | |||
#if defined(ultrix) && !defined(__GNUC__) | #if defined(ultrix) && !defined(__GNUC__) | |||
# ifndef NO_PROTOTYPES | # ifndef NO_PROTOTYPES | |||
# define NO_PROTOTYPES | # define NO_PROTOTYPES | |||
# endif | # endif | |||
#endif | #endif | |||
#ifndef NO_PROTOTYPES | #ifndef NO_PROTOTYPES | |||
skipping to change at line 693 | skipping to change at line 702 | |||
#ifdef HAVE_LONG_LONG | #ifdef HAVE_LONG_LONG | |||
SL_EXTERN int SLang_pop_long_long (long long *); | SL_EXTERN int SLang_pop_long_long (long long *); | |||
SL_EXTERN int SLang_push_long_long (long long); | SL_EXTERN int SLang_push_long_long (long long); | |||
SL_EXTERN int SLang_pop_ulong_long (unsigned long long *); | SL_EXTERN int SLang_pop_ulong_long (unsigned long long *); | |||
SL_EXTERN int SLang_push_ulong_long (unsigned long long); | SL_EXTERN int SLang_push_ulong_long (unsigned long long); | |||
SL_EXTERN int SLclass_pop_llong_obj (SLtype, long long *); | SL_EXTERN int SLclass_pop_llong_obj (SLtype, long long *); | |||
SL_EXTERN int SLclass_push_llong_obj (SLtype, long long); | SL_EXTERN int SLclass_push_llong_obj (SLtype, long long); | |||
#endif | #endif | |||
SL_EXTERN SLang_Class_Type *SLclass_allocate_class (char *); | SL_EXTERN SLang_Class_Type *SLclass_allocate_class (SLFUTURE_CONST char *); | |||
SL_EXTERN int SLclass_get_class_id (SLang_Class_Type *cl); | SL_EXTERN int SLclass_get_class_id (SLang_Class_Type *cl); | |||
SL_EXTERN int SLclass_create_synonym (char *, SLtype); | SL_EXTERN int SLclass_create_synonym (SLFUTURE_CONST char *, SLtype); | |||
SL_EXTERN int SLclass_is_class_defined (SLtype); | SL_EXTERN int SLclass_is_class_defined (SLtype); | |||
SL_EXTERN int SLclass_dup_object (SLtype type, VOID_STAR from, VOID_STAR to ); | SL_EXTERN int SLclass_dup_object (SLtype type, VOID_STAR from, VOID_STAR to ); | |||
typedef int SLclass_Type; | typedef int SLclass_Type; | |||
#define SLANG_CLASS_TYPE_MMT 0 | #define SLANG_CLASS_TYPE_MMT 0 | |||
#define SLANG_CLASS_TYPE_SCALAR 1 | #define SLANG_CLASS_TYPE_SCALAR 1 | |||
#define SLANG_CLASS_TYPE_VECTOR 2 | #define SLANG_CLASS_TYPE_VECTOR 2 | |||
#define SLANG_CLASS_TYPE_PTR 3 | #define SLANG_CLASS_TYPE_PTR 3 | |||
SL_EXTERN int SLclass_register_class (SLang_Class_Type *, SLtype, unsigned int, SLclass_Type); | SL_EXTERN int SLclass_register_class (SLang_Class_Type *, SLtype, unsigned int, SLclass_Type); | |||
SL_EXTERN int SLclass_set_string_function (SLang_Class_Type *, char *(*)(SL type, VOID_STAR)); | SL_EXTERN int SLclass_set_string_function (SLang_Class_Type *, char *(*)(SL type, VOID_STAR)); | |||
SL_EXTERN int SLclass_set_destroy_function (SLang_Class_Type *, void (*)(SL type, VOID_STAR)); | SL_EXTERN int SLclass_set_destroy_function (SLang_Class_Type *, void (*)(SL type, VOID_STAR)); | |||
SL_EXTERN int SLclass_set_push_function (SLang_Class_Type *, int (*)(SLtype , VOID_STAR)); | SL_EXTERN int SLclass_set_push_function (SLang_Class_Type *, int (*)(SLtype , VOID_STAR)); | |||
SL_EXTERN int SLclass_set_apush_function (SLang_Class_Type *, int (*)(SLtyp e, VOID_STAR)); | SL_EXTERN int SLclass_set_apush_function (SLang_Class_Type *, int (*)(SLtyp e, VOID_STAR)); | |||
SL_EXTERN int SLclass_set_pop_function (SLang_Class_Type *, int (*)(SLtype, VOID_STAR)); | SL_EXTERN int SLclass_set_pop_function (SLang_Class_Type *, int (*)(SLtype, VOID_STAR)); | |||
SL_EXTERN int SLclass_set_aget_function (SLang_Class_Type *, int (*)(SLtype , unsigned int)); | SL_EXTERN int SLclass_set_aget_function (SLang_Class_Type *, int (*)(SLtype , unsigned int)); | |||
SL_EXTERN int SLclass_set_aput_function (SLang_Class_Type *, int (*)(SLtype , unsigned int)); | SL_EXTERN int SLclass_set_aput_function (SLang_Class_Type *, int (*)(SLtype , unsigned int)); | |||
SL_EXTERN int SLclass_set_anew_function (SLang_Class_Type *, int (*)(SLtype , unsigned int)); | SL_EXTERN int SLclass_set_anew_function (SLang_Class_Type *, int (*)(SLtype , unsigned int)); | |||
SL_EXTERN int SLclass_set_sget_function (SLang_Class_Type *, int (*)(SLtype | SL_EXTERN int SLclass_set_sget_function (SLang_Class_Type *, int (*)(SLtype | |||
, char *)); | , SLFUTURE_CONST char *)); | |||
SL_EXTERN int SLclass_set_sput_function (SLang_Class_Type *, int (*)(SLtype | SL_EXTERN int SLclass_set_sput_function (SLang_Class_Type *, int (*)(SLtype | |||
, char *)); | , SLFUTURE_CONST char *)); | |||
SL_EXTERN int SLclass_set_acopy_function (SLang_Class_Type *, int (*)(SLtyp e, VOID_STAR, VOID_STAR)); | SL_EXTERN int SLclass_set_acopy_function (SLang_Class_Type *, int (*)(SLtyp e, VOID_STAR, VOID_STAR)); | |||
SL_EXTERN int SLclass_set_deref_function (SLang_Class_Type *, int (*)(SLtyp e, VOID_STAR)); | SL_EXTERN int SLclass_set_deref_function (SLang_Class_Type *, int (*)(SLtyp e, VOID_STAR)); | |||
SL_EXTERN int SLclass_set_eqs_function (SLang_Class_Type *, int (*)(SLtype, VOID_STAR, SLtype, VOID_STAR)); | SL_EXTERN int SLclass_set_eqs_function (SLang_Class_Type *, int (*)(SLtype, VOID_STAR, SLtype, VOID_STAR)); | |||
SL_EXTERN int SLclass_set_length_function (SLang_Class_Type *, int(*)(SLtyp e, VOID_STAR, unsigned int *)); | SL_EXTERN int SLclass_set_length_function (SLang_Class_Type *, int(*)(SLtyp e, VOID_STAR, unsigned int *)); | |||
SL_EXTERN int SLclass_set_is_container (SLang_Class_Type *, int); | SL_EXTERN int SLclass_set_is_container (SLang_Class_Type *, int); | |||
SL_EXTERN int SLclass_set_foreach_functions ( | SL_EXTERN int SLclass_set_foreach_functions ( | |||
SLang_Class_Type *, | SLang_Class_Type *, | |||
skipping to change at line 796 | skipping to change at line 805 | |||
VOID_STAR), | VOID_STAR), | |||
int (*)(int, SLtype, SLtype *)); | int (*)(int, SLtype, SLtype *)); | |||
SL_EXTERN int | SL_EXTERN int | |||
SLclass_add_typecast (SLtype /* from */, SLtype /* to */, | SLclass_add_typecast (SLtype /* from */, SLtype /* to */, | |||
int (*)_PROTO((SLtype, VOID_STAR, unsigned int, | int (*)_PROTO((SLtype, VOID_STAR, unsigned int, | |||
SLtype, VOID_STAR)), | SLtype, VOID_STAR)), | |||
int /* allow implicit typecasts */ | int /* allow implicit typecasts */ | |||
); | ); | |||
SL_EXTERN char *SLclass_get_datatype_name (SLtype); | SL_EXTERN SLFUTURE_CONST char *SLclass_get_datatype_name (SLtype); | |||
SL_EXTERN double SLcomplex_abs (double *); | SL_EXTERN double SLcomplex_abs (double *); | |||
SL_EXTERN double *SLcomplex_times (double *, double *, double *); | SL_EXTERN double *SLcomplex_times (double *, double *, double *); | |||
SL_EXTERN double *SLcomplex_divide (double *, double *, double *); | SL_EXTERN double *SLcomplex_divide (double *, double *, double *); | |||
SL_EXTERN double *SLcomplex_sin (double *, double *); | SL_EXTERN double *SLcomplex_sin (double *, double *); | |||
SL_EXTERN double *SLcomplex_cos (double *, double *); | SL_EXTERN double *SLcomplex_cos (double *, double *); | |||
SL_EXTERN double *SLcomplex_tan (double *, double *); | SL_EXTERN double *SLcomplex_tan (double *, double *); | |||
SL_EXTERN double *SLcomplex_asin (double *, double *); | SL_EXTERN double *SLcomplex_asin (double *, double *); | |||
SL_EXTERN double *SLcomplex_acos (double *, double *); | SL_EXTERN double *SLcomplex_acos (double *, double *); | |||
SL_EXTERN double *SLcomplex_atan (double *, double *); | SL_EXTERN double *SLcomplex_atan (double *, double *); | |||
skipping to change at line 907 | skipping to change at line 916 | |||
SL_EXTERN int SLarray_map_array_1 (SLCONST SLarray_Map_Type *, | SL_EXTERN int SLarray_map_array_1 (SLCONST SLarray_Map_Type *, | |||
int *use_this_dim, | int *use_this_dim, | |||
VOID_STAR clientdata); | VOID_STAR clientdata); | |||
SL_EXTERN int SLarray_map_array (SLCONST SLarray_Map_Type *); | SL_EXTERN int SLarray_map_array (SLCONST SLarray_Map_Type *); | |||
/*}}}*/ | /*}}}*/ | |||
/*{{{ Interpreter Function Prototypes */ | /*{{{ Interpreter Function Prototypes */ | |||
SL_EXTERN int SLerr_throw (int err, char *msg, SLtype obj_type, VOID_STAR o | SL_EXTERN int SLerr_throw (int err, SLFUTURE_CONST char *msg, SLtype obj_ty | |||
bjptr); | pe, VOID_STAR objptr); | |||
SL_EXTERN void SLang_verror (int, char *, ...) SLATTRIBUTE_PRINTF(2,3); | SL_EXTERN void SLang_verror (int, SLFUTURE_CONST char *, ...) SLATTRIBUTE_P | |||
SL_EXTERN void SLang_verror_va (int errcode, char *fmt, va_list va); | RINTF(2,3); | |||
SL_EXTERN void SLang_verror_va (int errcode, SLFUTURE_CONST char *fmt, va_l | ||||
ist va); | ||||
SL_EXTERN int SLang_get_error (void); | SL_EXTERN int SLang_get_error (void); | |||
SL_EXTERN int SLang_set_error (int); | SL_EXTERN int SLang_set_error (int); | |||
SL_EXTERN char *SLerr_strerror (int errcode); | SL_EXTERN SLFUTURE_CONST char *SLerr_strerror (int errcode); | |||
SL_EXTERN int SLerr_new_exception (int baseclass, char *name, char *descrip | SL_EXTERN int SLerr_new_exception (int baseclass, SLFUTURE_CONST char *name | |||
t); | , SLFUTURE_CONST char *descript); | |||
SL_EXTERN int SLerr_exception_eqs (int, int); | SL_EXTERN int SLerr_exception_eqs (int, int); | |||
SL_EXTERN int SL_Any_Error; | SL_EXTERN int SL_Any_Error; | |||
SL_EXTERN int SL_OS_Error; | SL_EXTERN int SL_OS_Error; | |||
SL_EXTERN int SL_Malloc_Error; | SL_EXTERN int SL_Malloc_Error; | |||
SL_EXTERN int SL_IO_Error; | SL_EXTERN int SL_IO_Error; | |||
SL_EXTERN int SL_Write_Error; | SL_EXTERN int SL_Write_Error; | |||
SL_EXTERN int SL_Read_Error; | SL_EXTERN int SL_Read_Error; | |||
SL_EXTERN int SL_Open_Error; | SL_EXTERN int SL_Open_Error; | |||
SL_EXTERN int SL_RunTime_Error; | SL_EXTERN int SL_RunTime_Error; | |||
skipping to change at line 1006 | skipping to change at line 1015 | |||
#define SL_TB_FULL 0x1 /* full traceback */ | #define SL_TB_FULL 0x1 /* full traceback */ | |||
#define SL_TB_OMIT_LOCALS 0x2 /* full, but omit local vars */ | #define SL_TB_OMIT_LOCALS 0x2 /* full, but omit local vars */ | |||
#define SL_TB_PARTIAL 0x4 /* show just on line of traceback */ | #define SL_TB_PARTIAL 0x4 /* show just on line of traceback */ | |||
/* If non-zero, dump an S-Lang traceback upon error. Available as | /* If non-zero, dump an S-Lang traceback upon error. Available as | |||
_traceback in S-Lang. */ | _traceback in S-Lang. */ | |||
SL_EXTERN char *SLang_User_Prompt; | SL_EXTERN char *SLang_User_Prompt; | |||
/* Prompt to use when reading from stdin */ | /* Prompt to use when reading from stdin */ | |||
SL_EXTERN int SLang_Version; | SL_EXTERN int SLang_Version; | |||
SL_EXTERN char *SLang_Version_String; | SL_EXTERN SLFUTURE_CONST char *SLang_Version_String; | |||
SL_EXTERN char *SLang_Doc_Dir; | SL_EXTERN SLFUTURE_CONST char *SLang_Doc_Dir; | |||
SL_EXTERN void (*SLang_VMessage_Hook) (char *, va_list); | SL_EXTERN void (*SLang_VMessage_Hook) (SLFUTURE_CONST char *, va_list); | |||
SL_EXTERN void SLang_vmessage (char *, ...) SLATTRIBUTE_PRINTF(1,2); | SL_EXTERN void SLang_vmessage (SLFUTURE_CONST char *, ...) SLATTRIBUTE_PRIN | |||
TF(1,2); | ||||
SL_EXTERN void (*SLang_Error_Hook)(char *); | SL_EXTERN void (*SLang_Error_Hook)(SLFUTURE_CONST char *); | |||
/* Pointer to application dependent error messaging routine. By default, | /* Pointer to application dependent error messaging routine. By default, | |||
messages are displayed on stderr. */ | messages are displayed on stderr. */ | |||
SL_EXTERN void (*SLang_Exit_Error_Hook)(char *, va_list); | SL_EXTERN void (*SLang_Exit_Error_Hook)(SLFUTURE_CONST char *, va_list); | |||
SL_EXTERN void SLang_exit_error (char *, ...) SLATTRIBUTE_((format (printf, | SL_EXTERN void SLang_exit_error (SLFUTURE_CONST char *, ...) SLATTRIBUTE_(( | |||
1, 2), noreturn)); | format (printf, 1, 2), noreturn)); | |||
SL_EXTERN void (*SLang_Dump_Routine)(char *); | SL_EXTERN void (*SLang_Dump_Routine)(SLFUTURE_CONST char *); | |||
/* Called if S-Lang traceback is enabled as well as other debugging | /* Called if S-Lang traceback is enabled as well as other debugging | |||
routines (e.g., trace). By default, these messages go to stderr. */ | routines (e.g., trace). By default, these messages go to stderr. */ | |||
SL_EXTERN void (*SLang_Interrupt)(void); | SL_EXTERN void (*SLang_Interrupt)(void); | |||
/* function to call whenever inner interpreter is entered. This is | /* function to call whenever inner interpreter is entered. This is | |||
a good place to set SLang_Error to USER_BREAK. */ | a good place to set SLang_Error to USER_BREAK. */ | |||
SL_EXTERN void (*SLang_User_Clear_Error)(void); | SL_EXTERN void (*SLang_User_Clear_Error)(void); | |||
/* function that gets called when '_clear_error' is called. */ | /* function that gets called when '_clear_error' is called. */ | |||
/* If non null, these call C functions before and after a slang function. */ | /* If non null, these call C functions before and after a slang function. */ | |||
SL_EXTERN void (*SLang_Enter_Function)(char *); | SL_EXTERN void (*SLang_Enter_Function)(SLFUTURE_CONST char *); | |||
SL_EXTERN void (*SLang_Exit_Function)(char *); | SL_EXTERN void (*SLang_Exit_Function)(SLFUTURE_CONST char *); | |||
SL_EXTERN int SLang_Num_Function_Args; | SL_EXTERN int SLang_Num_Function_Args; | |||
/* This function should be called when a system call is interrupted. It | /* This function should be called when a system call is interrupted. It | |||
* runs a set of hooks. If any of the hooks returns -1, then the system ca ll | * runs a set of hooks. If any of the hooks returns -1, then the system ca ll | |||
* should not be restarted. | * should not be restarted. | |||
*/ | */ | |||
SL_EXTERN int SLang_handle_interrupt (void); | SL_EXTERN int SLang_handle_interrupt (void); | |||
SL_EXTERN int SLang_add_interrupt_hook (int (*)(VOID_STAR), VOID_STAR); | SL_EXTERN int SLang_add_interrupt_hook (int (*)(VOID_STAR), VOID_STAR); | |||
SL_EXTERN void SLang_remove_interrupt_hook (int (*)(VOID_STAR), VOID_STAR); | SL_EXTERN void SLang_remove_interrupt_hook (int (*)(VOID_STAR), VOID_STAR); | |||
skipping to change at line 1079 | skipping to change at line 1088 | |||
SL_EXTERN int SLang_init_array_extra (void); | SL_EXTERN int SLang_init_array_extra (void); | |||
/* Additional arrays functions, if any */ | /* Additional arrays functions, if any */ | |||
SL_EXTERN int SLang_init_signal (void); | SL_EXTERN int SLang_init_signal (void); | |||
/* signal handling within the interpreter */ | /* signal handling within the interpreter */ | |||
/* Dynamic linking facility */ | /* Dynamic linking facility */ | |||
SL_EXTERN int SLang_init_import (void); | SL_EXTERN int SLang_init_import (void); | |||
SL_EXTERN int SLang_load_file (char *); | SL_EXTERN int SLang_load_file (SLFUTURE_CONST char *); | |||
/* Load a file of S-Lang code for interpreting. If the parameter is | /* Load a file of S-Lang code for interpreting. If the parameter is | |||
* NULL, input comes from stdin. */ | * NULL, input comes from stdin. */ | |||
SL_EXTERN void SLang_restart(int); | SL_EXTERN void SLang_restart(int); | |||
/* should be called if an error occurs. If the passed integer is | /* should be called if an error occurs. If the passed integer is | |||
* non-zero, items are popped off the stack; otherwise, the stack is | * non-zero, items are popped off the stack; otherwise, the stack is | |||
* left intact. Any time the stack is believed to be trashed, this rout ine | * left intact. Any time the stack is believed to be trashed, this rout ine | |||
* should be called with a non-zero argument (e.g., if setjmp/longjmp is | * should be called with a non-zero argument (e.g., if setjmp/longjmp is | |||
* called). */ | * called). */ | |||
SL_EXTERN int SLang_byte_compile_file(char *, int); | SL_EXTERN int SLang_byte_compile_file(SLFUTURE_CONST char *, int); | |||
/* takes a file of S-Lang code and ``byte-compiles'' it for faster | /* takes a file of S-Lang code and ``byte-compiles'' it for faster | |||
* loading. The new filename is equivalent to the old except that a `c' is | * loading. The new filename is equivalent to the old except that a `c' is | |||
* appended to the name. (e.g., init.sl --> init.slc). The second | * appended to the name. (e.g., init.sl --> init.slc). The second | |||
* specified the method; currently, it is not used. | * specified the method; currently, it is not used. | |||
*/ | */ | |||
SL_EXTERN int SLang_autoload(char *, char *); | SL_EXTERN int SLang_autoload(SLFUTURE_CONST char *, SLFUTURE_CONST char *); | |||
/* Automatically load S-Lang function p1 from file p2. This function | /* Automatically load S-Lang function p1 from file p2. This function | |||
is also available via S-Lang */ | is also available via S-Lang */ | |||
SL_EXTERN int SLang_load_string(char *); | SL_EXTERN int SLang_load_string(SLFUTURE_CONST char *); | |||
/* Like SLang_load_file except input is from a null terminated string. * / | /* Like SLang_load_file except input is from a null terminated string. * / | |||
SL_EXTERN int SLstack_depth(void); | SL_EXTERN int SLstack_depth(void); | |||
SL_EXTERN int SLdo_pop(void); | SL_EXTERN int SLdo_pop(void); | |||
SL_EXTERN int SLdo_pop_n(unsigned int); | SL_EXTERN int SLdo_pop_n(unsigned int); | |||
SL_EXTERN int SLang_push_char (char); | SL_EXTERN int SLang_push_char (char); | |||
SL_EXTERN int SLang_push_uchar (unsigned char); | SL_EXTERN int SLang_push_uchar (unsigned char); | |||
SL_EXTERN int SLang_pop_char (char *); | SL_EXTERN int SLang_pop_char (char *); | |||
skipping to change at line 1153 | skipping to change at line 1162 | |||
SL_EXTERN int SLang_pop_datatype (SLtype *); | SL_EXTERN int SLang_pop_datatype (SLtype *); | |||
SL_EXTERN int SLang_push_malloced_string(char *); | SL_EXTERN int SLang_push_malloced_string(char *); | |||
/* The normal SLang_push_string pushes an slstring. This one converts | /* The normal SLang_push_string pushes an slstring. This one converts | |||
* a normally malloced string to an slstring, and then frees the | * a normally malloced string to an slstring, and then frees the | |||
* malloced string. So, do NOT use the malloced string after calling | * malloced string. So, do NOT use the malloced string after calling | |||
* this routine because it will be freed! The routine returns -1 upon | * this routine because it will be freed! The routine returns -1 upon | |||
* error, but the string will be freed. | * error, but the string will be freed. | |||
*/ | */ | |||
SL_EXTERN int SLang_push_string(char *); | SL_EXTERN int SLang_push_string(SLFUTURE_CONST char *); | |||
SL_EXTERN int SLpop_string (char **); | SL_EXTERN int SLpop_string (char **); /* malloced -- free with SLfree */ | |||
SL_EXTERN int SLang_push_null (void); | SL_EXTERN int SLang_push_null (void); | |||
SL_EXTERN int SLang_pop_null (void); | SL_EXTERN int SLang_pop_null (void); | |||
SL_EXTERN int SLang_push_value (SLtype type, VOID_STAR); | SL_EXTERN int SLang_push_value (SLtype type, VOID_STAR); | |||
SL_EXTERN int SLang_pop_value (SLtype type, VOID_STAR); | SL_EXTERN int SLang_pop_value (SLtype type, VOID_STAR); | |||
SL_EXTERN void SLang_free_value (SLtype type, VOID_STAR); | SL_EXTERN void SLang_free_value (SLtype type, VOID_STAR); | |||
typedef struct _pSLang_Object_Type SLang_Any_Type; | typedef struct _pSLang_Object_Type SLang_Any_Type; | |||
skipping to change at line 1191 | skipping to change at line 1200 | |||
SL_EXTERN SLang_Name_Type *SLang_get_fun_from_ref (SLang_Ref_Type *); | SL_EXTERN SLang_Name_Type *SLang_get_fun_from_ref (SLang_Ref_Type *); | |||
SL_EXTERN void SLang_free_function (SLang_Name_Type *f); | SL_EXTERN void SLang_free_function (SLang_Name_Type *f); | |||
SL_EXTERN SLang_Name_Type *SLang_copy_function (SLang_Name_Type *); | SL_EXTERN SLang_Name_Type *SLang_copy_function (SLang_Name_Type *); | |||
/* C structure interface */ | /* C structure interface */ | |||
SL_EXTERN int SLang_push_cstruct (VOID_STAR, SLang_CStruct_Field_Type *); | SL_EXTERN int SLang_push_cstruct (VOID_STAR, SLang_CStruct_Field_Type *); | |||
SL_EXTERN int SLang_pop_cstruct (VOID_STAR, SLang_CStruct_Field_Type *); | SL_EXTERN int SLang_pop_cstruct (VOID_STAR, SLang_CStruct_Field_Type *); | |||
SL_EXTERN void SLang_free_cstruct (VOID_STAR, SLang_CStruct_Field_Type *); | SL_EXTERN void SLang_free_cstruct (VOID_STAR, SLang_CStruct_Field_Type *); | |||
SL_EXTERN int SLang_assign_cstruct_to_ref (SLang_Ref_Type *, VOID_STAR, SLa ng_CStruct_Field_Type *); | SL_EXTERN int SLang_assign_cstruct_to_ref (SLang_Ref_Type *, VOID_STAR, SLa ng_CStruct_Field_Type *); | |||
SL_EXTERN int SLang_is_defined(char *); | SL_EXTERN int SLang_is_defined(SLFUTURE_CONST char *); | |||
/* Return non-zero is p1 is defined otherwise returns 0. */ | /* Return non-zero is p1 is defined otherwise returns 0. */ | |||
SL_EXTERN int SLang_run_hooks(char *, unsigned int, ...); | SL_EXTERN int SLang_run_hooks(SLFUTURE_CONST char *, unsigned int, ...); | |||
/* calls S-Lang function p1 pushing p2 strings in the variable argument | /* calls S-Lang function p1 pushing p2 strings in the variable argument | |||
* list onto the stack first. | * list onto the stack first. | |||
* Returns -1 upon error, 1 if hooks exists and it ran, | * 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 ca lled. | * or 0 if hook does not exist. Thus it returns non-zero is hook was ca lled. | |||
*/ | */ | |||
/* These functions return 1 if the indicated function exists and the functi on | /* These functions return 1 if the indicated function exists and the functi on | |||
* runs without error. If the function does not exist, the function return s | * runs without error. If the function does not exist, the function return s | |||
* 0. Otherwise -1 is returned with SLang_Error set appropriately. | * 0. Otherwise -1 is returned with SLang_Error set appropriately. | |||
*/ | */ | |||
SL_EXTERN int SLexecute_function (SLang_Name_Type *); | SL_EXTERN int SLexecute_function (SLang_Name_Type *); | |||
SL_EXTERN int SLang_execute_function(char *); | SL_EXTERN int SLang_execute_function(SLFUTURE_CONST char *); | |||
SL_EXTERN int SLang_end_arg_list (void); | SL_EXTERN int SLang_end_arg_list (void); | |||
SL_EXTERN int SLang_start_arg_list (void); | SL_EXTERN int SLang_start_arg_list (void); | |||
SL_EXTERN int SLang_add_intrinsic_array (char *, /* name */ | SL_EXTERN int SLang_add_intrinsic_array (SLFUTURE_CONST char *, /* name * / | |||
SLtype, /* type */ | SLtype, /* type */ | |||
int, /* readonly */ | int, /* readonly */ | |||
VOID_STAR, /* data */ | VOID_STAR, /* data */ | |||
unsigned int, ...); /* num dims */ | unsigned int, ...); /* num dims */ | |||
SL_EXTERN int SLextract_list_element (char *, unsigned int, char, | SL_EXTERN int SLextract_list_element (SLFUTURE_CONST char *, unsigned int, char, | |||
char *, unsigned int); | char *, unsigned int); | |||
/* If utf8_encode is >1, then byte values > 127 will be utf8-encoded. | /* If utf8_encode is >1, then byte values > 127 will be utf8-encoded. | |||
* If the string is already in utf8 form, and utf8 is desired, then use wit h | * If the string is already in utf8 form, and utf8 is desired, then use wit h | |||
* utf8_encode set to 0. A value of -1 implies use the value appropriate f or | * utf8_encode set to 0. A value of -1 implies use the value appropriate f or | |||
* the current state of the interpreter. | * the current state of the interpreter. | |||
*/ | */ | |||
SL_EXTERN int SLexpand_escaped_string (char *dest, char *src, char *src_max , | SL_EXTERN int SLexpand_escaped_string (char *dest, char *src, char *src_max , | |||
int utf8_encode); | int utf8_encode); | |||
SL_EXTERN SLang_Name_Type *SLang_get_function (char *); | SL_EXTERN SLang_Name_Type *SLang_get_function (SLFUTURE_CONST char *); | |||
SL_EXTERN void SLang_release_function (SLang_Name_Type *); | SL_EXTERN void SLang_release_function (SLang_Name_Type *); | |||
SL_EXTERN int SLreverse_stack (int); | SL_EXTERN int SLreverse_stack (int); | |||
SL_EXTERN int SLroll_stack (int); | SL_EXTERN int SLroll_stack (int); | |||
/* If argument p is positive, the top p objects on the stack are rolled | /* If argument p is positive, the top p objects on the stack are rolled | |||
* up. If negative, the stack is rolled down. | * up. If negative, the stack is rolled down. | |||
*/ | */ | |||
SL_EXTERN int SLdup_n (int n); | SL_EXTERN int SLdup_n (int n); | |||
/* Duplicate top n elements of stack */ | /* Duplicate top n elements of stack */ | |||
SL_EXTERN int SLang_peek_at_stack1 (void); | SL_EXTERN int SLang_peek_at_stack1 (void); | |||
SL_EXTERN int SLang_peek_at_stack (void); | SL_EXTERN int SLang_peek_at_stack (void); | |||
SL_EXTERN int SLang_peek_at_stack_n (unsigned int n); | SL_EXTERN int SLang_peek_at_stack_n (unsigned int n); | |||
SL_EXTERN int SLang_peek_at_stack1_n (unsigned int n); | SL_EXTERN int SLang_peek_at_stack1_n (unsigned int n); | |||
/* Returns type of next object on stack-- -1 upon stack underflow. */ | /* Returns type of next object on stack-- -1 upon stack underflow. */ | |||
SL_EXTERN void SLmake_lut (unsigned char *, unsigned char *, unsigned char) ; | SL_EXTERN void SLmake_lut (unsigned char *, unsigned char *, unsigned char) ; | |||
SL_EXTERN int SLang_guess_type (char *); | SL_EXTERN int SLang_guess_type (SLFUTURE_CONST char *); | |||
SL_EXTERN int SLstruct_create_struct (unsigned int, | SL_EXTERN int SLstruct_create_struct (unsigned int, | |||
char **, | SLFUTURE_CONST char **, | |||
SLtype *, | SLtype *, | |||
VOID_STAR *); | VOID_STAR *); | |||
/*}}}*/ | /*}}}*/ | |||
/*{{{ Misc Functions */ | /*{{{ Misc Functions */ | |||
/* This is an interface to atexit */ | /* This is an interface to atexit */ | |||
SL_EXTERN int SLang_add_cleanup_function (void (*)(void)); | SL_EXTERN int SLang_add_cleanup_function (void (*)(void)); | |||
SL_EXTERN char *SLmake_string (char *); | SL_EXTERN char *SLmake_string (SLFUTURE_CONST char *); | |||
SL_EXTERN char *SLmake_nstring (char *, unsigned int); | SL_EXTERN char *SLmake_nstring (SLFUTURE_CONST char *, unsigned int); | |||
/* Returns a null terminated string made from the first n characters of the | /* Returns a null terminated string made from the first n characters of the | |||
* string. | * string. | |||
*/ | */ | |||
/* Binary strings */ | /* Binary strings */ | |||
/* The binary string is an opaque type. Use the SLbstring_get_pointer func tion | /* The binary string is an opaque type. Use the SLbstring_get_pointer func tion | |||
* to get a pointer and length. | * to get a pointer and length. | |||
*/ | */ | |||
typedef struct _pSLang_BString_Type SLang_BString_Type; | typedef struct _pSLang_BString_Type SLang_BString_Type; | |||
SL_EXTERN unsigned char *SLbstring_get_pointer (SLang_BString_Type *, unsig ned int *); | SL_EXTERN unsigned char *SLbstring_get_pointer (SLang_BString_Type *, unsig ned int *); | |||
skipping to change at line 1284 | skipping to change at line 1293 | |||
SL_EXTERN SLang_BString_Type *SLbstring_dup (SLang_BString_Type *); | SL_EXTERN SLang_BString_Type *SLbstring_dup (SLang_BString_Type *); | |||
SL_EXTERN SLang_BString_Type *SLbstring_create (unsigned char *, unsigned i nt); | SL_EXTERN SLang_BString_Type *SLbstring_create (unsigned char *, unsigned i nt); | |||
/* The create_malloced function used the first argument which is assumed | /* 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 | * to be a pointer to a len + 1 malloced string. The extra byte is for | |||
* \0 termination. | * \0 termination. | |||
*/ | */ | |||
SL_EXTERN SLang_BString_Type *SLbstring_create_malloced (unsigned char *, u nsigned int, int); | SL_EXTERN SLang_BString_Type *SLbstring_create_malloced (unsigned char *, u nsigned int, int); | |||
/* Create a bstring from an slstring */ | /* Create a bstring from an slstring */ | |||
SL_EXTERN SLang_BString_Type *SLbstring_create_slstring (char *); | SL_EXTERN SLang_BString_Type *SLbstring_create_slstring (SLFUTURE_CONST cha r *); | |||
SL_EXTERN void SLbstring_free (SLang_BString_Type *); | SL_EXTERN void SLbstring_free (SLang_BString_Type *); | |||
SL_EXTERN int SLang_pop_bstring (SLang_BString_Type **); | SL_EXTERN int SLang_pop_bstring (SLang_BString_Type **); | |||
SL_EXTERN int SLang_push_bstring (SLang_BString_Type *); | SL_EXTERN int SLang_push_bstring (SLang_BString_Type *); | |||
SL_EXTERN char *SLmalloc (unsigned int); | SL_EXTERN char *SLmalloc (unsigned int); | |||
SL_EXTERN char *SLcalloc (unsigned int, unsigned int); | SL_EXTERN char *SLcalloc (unsigned int, unsigned int); | |||
SL_EXTERN void SLfree(char *); /* This function handles NULL */ | SL_EXTERN void SLfree(char *); /* This function handles NULL */ | |||
SL_EXTERN char *SLrealloc (char *, unsigned int); | SL_EXTERN char *SLrealloc (char *, unsigned int); | |||
skipping to change at line 1306 | skipping to change at line 1315 | |||
SL_EXTERN int SLatoi(unsigned char *); | SL_EXTERN int SLatoi(unsigned char *); | |||
SL_EXTERN long SLatol (unsigned char *); | SL_EXTERN long SLatol (unsigned char *); | |||
SL_EXTERN unsigned long SLatoul (unsigned char *); | SL_EXTERN unsigned long SLatoul (unsigned char *); | |||
#ifdef HAVE_LONG_LONG | #ifdef HAVE_LONG_LONG | |||
SL_EXTERN long long SLatoll (unsigned char *s); | SL_EXTERN long long SLatoll (unsigned char *s); | |||
SL_EXTERN unsigned long long SLatoull (unsigned char *s); | SL_EXTERN unsigned long long SLatoull (unsigned char *s); | |||
#endif | #endif | |||
SL_EXTERN int SLang_pop_fileptr (SLang_MMT_Type **, FILE **); | SL_EXTERN int SLang_pop_fileptr (SLang_MMT_Type **, FILE **); | |||
SL_EXTERN char *SLang_get_name_from_fileptr (SLang_MMT_Type *); | SL_EXTERN SLFUTURE_CONST char *SLang_get_name_from_fileptr (SLang_MMT_Type *); | |||
SL_EXTERN int SLang_get_fileptr (SLang_MMT_Type *, FILE **); | SL_EXTERN int SLang_get_fileptr (SLang_MMT_Type *, FILE **); | |||
/* This function may be used to obtain the FILE* object associated with an MMT. | /* This function may be used to obtain the FILE* object associated with an MMT. | |||
* It returns 0 if no-errors were encountered, and -1 otherwise. | * It returns 0 if no-errors were encountered, and -1 otherwise. | |||
* If FILE* object has been closed, this function will return 0 and set the FILE* | * If FILE* object has been closed, this function will return 0 and set the FILE* | |||
* parameter to NULL. | * parameter to NULL. | |||
*/ | */ | |||
typedef struct _pSLFile_FD_Type SLFile_FD_Type; | typedef struct _pSLFile_FD_Type SLFile_FD_Type; | |||
SL_EXTERN SLFile_FD_Type *SLfile_create_fd (char *, int); | SL_EXTERN SLFile_FD_Type *SLfile_create_fd (SLFUTURE_CONST char *, int); | |||
SL_EXTERN void SLfile_free_fd (SLFile_FD_Type *); | SL_EXTERN void SLfile_free_fd (SLFile_FD_Type *); | |||
SL_EXTERN int SLfile_push_fd (SLFile_FD_Type *); | SL_EXTERN int SLfile_push_fd (SLFile_FD_Type *); | |||
SL_EXTERN int SLfile_pop_fd (SLFile_FD_Type **); | SL_EXTERN int SLfile_pop_fd (SLFile_FD_Type **); | |||
SL_EXTERN int SLfile_get_fd (SLFile_FD_Type *, int *); | SL_EXTERN int SLfile_get_fd (SLFile_FD_Type *, int *); | |||
SL_EXTERN SLFile_FD_Type *SLfile_dup_fd (SLFile_FD_Type *f0); | SL_EXTERN SLFile_FD_Type *SLfile_dup_fd (SLFile_FD_Type *f0); | |||
SL_EXTERN int SLang_init_posix_io (void); | SL_EXTERN int SLang_init_posix_io (void); | |||
/* These routines allow an application to attach an object to a file-descri ptor | /* These routines allow an application to attach an object to a file-descri ptor | |||
* as well a provide read/write/close/etc methods. To allow the coexistenc e of | * as well a provide read/write/close/etc methods. To allow the coexistenc e of | |||
* different types of objects, a clientdata-id must be used. | * different types of objects, a clientdata-id must be used. | |||
skipping to change at line 1422 | skipping to change at line 1431 | |||
#ifdef VMS | #ifdef VMS | |||
/* If this function returns -1, ^Y will be added to input buffer. */ | /* If this function returns -1, ^Y will be added to input buffer. */ | |||
SL_EXTERN int (*SLtty_VMS_Ctrl_Y_Hook) (void); | SL_EXTERN int (*SLtty_VMS_Ctrl_Y_Hook) (void); | |||
#endif | #endif | |||
/*}}}*/ | /*}}}*/ | |||
/*{{{ SLang Keymap routines */ | /*{{{ SLang Keymap routines */ | |||
typedef struct SLKeymap_Function_Type | typedef struct SLKeymap_Function_Type | |||
{ | { | |||
char *name; | SLFUTURE_CONST char *name; | |||
int (*f)(void); | int (*f)(void); | |||
} | } | |||
SLKeymap_Function_Type; | SLKeymap_Function_Type; | |||
#define SLANG_MAX_KEYMAP_KEY_SEQ 14 | #define SLANG_MAX_KEYMAP_KEY_SEQ 14 | |||
typedef struct SLang_Key_Type | typedef struct SLang_Key_Type | |||
{ | { | |||
struct SLang_Key_Type *next; | struct SLang_Key_Type *next; | |||
union | union | |||
{ | { | |||
skipping to change at line 1452 | skipping to change at line 1461 | |||
#define SLKEY_F_KEYSYM 0x03 | #define SLKEY_F_KEYSYM 0x03 | |||
#define SLKEY_F_SLANG 0x04 | #define SLKEY_F_SLANG 0x04 | |||
unsigned char str[SLANG_MAX_KEYMAP_KEY_SEQ + 1];/* key sequence */ | unsigned char str[SLANG_MAX_KEYMAP_KEY_SEQ + 1];/* key sequence */ | |||
} | } | |||
SLang_Key_Type; | SLang_Key_Type; | |||
int SLkm_set_free_method (int, void (*)(int, VOID_STAR)); | int SLkm_set_free_method (int, void (*)(int, VOID_STAR)); | |||
typedef struct _pSLkeymap_Type | typedef struct _pSLkeymap_Type | |||
{ | { | |||
char *name; /* hashed string */ | SLFUTURE_CONST char *name; /* hashed string */ | |||
SLang_Key_Type *keymap; | SLang_Key_Type *keymap; | |||
SLKeymap_Function_Type *functions; /* intrinsic functions */ | SLKeymap_Function_Type *functions; /* intrinsic functions */ | |||
struct _pSLkeymap_Type *next; | struct _pSLkeymap_Type *next; | |||
} SLkeymap_Type; | } SLkeymap_Type; | |||
SL_EXTERN SLkeymap_Type *SLKeyMap_List_Root; /* linked list of keymaps */ | SL_EXTERN SLkeymap_Type *SLKeyMap_List_Root; /* linked list of keymaps */ | |||
/* backward compat */ | /* backward compat */ | |||
typedef SLkeymap_Type SLKeyMap_List_Type; | typedef SLkeymap_Type SLKeyMap_List_Type; | |||
SL_EXTERN char *SLang_process_keystring(char *); | SL_EXTERN char *SLang_process_keystring(SLFUTURE_CONST char *); | |||
SL_EXTERN int SLkm_define_key (char *, FVOID_STAR, SLkeymap_Type *); | SL_EXTERN int SLkm_define_key (SLFUTURE_CONST char *, FVOID_STAR, SLkeymap_ Type *); | |||
SL_EXTERN int SLang_define_key(char *, char *, SLkeymap_Type *); | SL_EXTERN int SLang_define_key(SLFUTURE_CONST char *, SLFUTURE_CONST char * , SLkeymap_Type *); | |||
/* Like define_key1 except that p2 is a string that is to be associated wit h | /* Like define_key1 except that p2 is a string that is to be associated wit h | |||
* a function in the functions field of p3. | * a function in the functions field of p3. | |||
*/ | */ | |||
SL_EXTERN int SLkm_define_keysym (char *, unsigned int, SLkeymap_Type *); | SL_EXTERN int SLkm_define_keysym (SLFUTURE_CONST char *, unsigned int, SLke | |||
SL_EXTERN int SLkm_define_slkey (char *keysequence, SLang_Name_Type *func, | ymap_Type *); | |||
SLkeymap_Type *); | SL_EXTERN int SLkm_define_slkey (SLFUTURE_CONST char *keysequence, SLang_Na | |||
SL_EXTERN void SLang_undefine_key(char *, SLkeymap_Type *); | me_Type *func, SLkeymap_Type *); | |||
SL_EXTERN void SLang_undefine_key(SLFUTURE_CONST char *, SLkeymap_Type *); | ||||
SL_EXTERN SLkeymap_Type *SLang_create_keymap(char *, SLkeymap_Type *); | SL_EXTERN SLkeymap_Type *SLang_create_keymap(SLFUTURE_CONST char *, SLkeyma p_Type *); | |||
/* create and returns a pointer to a new keymap named p1 created by copying | /* 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 | * keymap p2. If p2 is NULL, it is up to the calling routine to initialize | |||
* the keymap. | * the keymap. | |||
*/ | */ | |||
SL_EXTERN char *SLang_make_keystring(unsigned char *); | SL_EXTERN char *SLang_make_keystring(unsigned char *); | |||
SL_EXTERN SLang_Key_Type *SLang_do_key(SLkeymap_Type *, int (*)(void)); | SL_EXTERN SLang_Key_Type *SLang_do_key(SLkeymap_Type *, int (*)(void)); | |||
/* read a key using keymap p1 with getkey function p2 */ | /* read a key using keymap p1 with getkey function p2 */ | |||
SL_EXTERN FVOID_STAR SLang_find_key_function(char *, SLkeymap_Type *); | SL_EXTERN FVOID_STAR SLang_find_key_function(SLFUTURE_CONST char *, SLkeyma p_Type *); | |||
SL_EXTERN SLkeymap_Type *SLang_find_keymap(char *); | SL_EXTERN SLkeymap_Type *SLang_find_keymap(SLFUTURE_CONST char *); | |||
SL_EXTERN int SLang_Last_Key_Char; | SL_EXTERN int SLang_Last_Key_Char; | |||
/* Despite the name of this variable, its value is the last BYTE of a key-s equence */ | /* Despite the name of this variable, its value is the last BYTE of a key-s equence */ | |||
SL_EXTERN int SLang_Key_TimeOut_Flag; | SL_EXTERN int SLang_Key_TimeOut_Flag; | |||
/*}}}*/ | /*}}}*/ | |||
/*{{{ SLang Readline Interface */ | /*{{{ SLang Readline Interface */ | |||
typedef struct _pSLrline_Type SLrline_Type; | typedef struct _pSLrline_Type SLrline_Type; | |||
SL_EXTERN SLrline_Type *SLrline_open (unsigned int width, unsigned int flag s); | SL_EXTERN SLrline_Type *SLrline_open (unsigned int width, unsigned int flag s); | |||
SL_EXTERN SLrline_Type *SLrline_open2 (char *, unsigned int width, unsigned int flags); | SL_EXTERN SLrline_Type *SLrline_open2 (SLFUTURE_CONST char *, unsigned int width, unsigned int flags); | |||
#define SL_RLINE_NO_ECHO 1 | #define SL_RLINE_NO_ECHO 1 | |||
#define SL_RLINE_USE_ANSI 2 | #define SL_RLINE_USE_ANSI 2 | |||
#define SL_RLINE_BLINK_MATCH 4 | #define SL_RLINE_BLINK_MATCH 4 | |||
#define SL_RLINE_UTF8_MODE 8 | #define SL_RLINE_UTF8_MODE 8 | |||
SL_EXTERN void SLrline_close (SLrline_Type *); | SL_EXTERN void SLrline_close (SLrline_Type *); | |||
/* This returns a malloced string */ | /* This returns a malloced string */ | |||
SL_EXTERN char *SLrline_read_line (SLrline_Type *, char *prompt, unsigned i nt *lenp); | SL_EXTERN char *SLrline_read_line (SLrline_Type *, SLFUTURE_CONST char *pro mpt, unsigned int *lenp); | |||
SL_EXTERN int SLrline_bol (SLrline_Type *); | SL_EXTERN int SLrline_bol (SLrline_Type *); | |||
SL_EXTERN int SLrline_eol (SLrline_Type *); | SL_EXTERN int SLrline_eol (SLrline_Type *); | |||
SL_EXTERN int SLrline_del (SLrline_Type *, unsigned int len); | SL_EXTERN int SLrline_del (SLrline_Type *, unsigned int len); | |||
SL_EXTERN int SLrline_ins (SLrline_Type *, char *s, unsigned int len); | SL_EXTERN int SLrline_ins (SLrline_Type *, SLFUTURE_CONST char *s, unsigned int len); | |||
SL_EXTERN int SLrline_move (SLrline_Type *, int); | SL_EXTERN int SLrline_move (SLrline_Type *, int); | |||
SL_EXTERN int SLrline_set_echo (SLrline_Type *, int); | SL_EXTERN int SLrline_set_echo (SLrline_Type *, int); | |||
SL_EXTERN int SLrline_set_tab (SLrline_Type *, unsigned int tabwidth); | SL_EXTERN int SLrline_set_tab (SLrline_Type *, unsigned int tabwidth); | |||
SL_EXTERN int SLrline_set_point (SLrline_Type *, unsigned int); | SL_EXTERN int SLrline_set_point (SLrline_Type *, unsigned int); | |||
SL_EXTERN int SLrline_set_line (SLrline_Type *, char *); | SL_EXTERN int SLrline_set_line (SLrline_Type *, SLFUTURE_CONST char *); | |||
SL_EXTERN int SLrline_set_hscroll (SLrline_Type *, unsigned int); | SL_EXTERN int SLrline_set_hscroll (SLrline_Type *, unsigned int); | |||
SL_EXTERN int SLrline_set_display_width (SLrline_Type *, unsigned int); | SL_EXTERN int SLrline_set_display_width (SLrline_Type *, unsigned int); | |||
SL_EXTERN int SLrline_get_echo (SLrline_Type *, int *); | SL_EXTERN int SLrline_get_echo (SLrline_Type *, int *); | |||
SL_EXTERN int SLrline_get_tab (SLrline_Type *, unsigned int *); | SL_EXTERN int SLrline_get_tab (SLrline_Type *, unsigned int *); | |||
SL_EXTERN int SLrline_get_point (SLrline_Type *, unsigned int *); | SL_EXTERN int SLrline_get_point (SLrline_Type *, unsigned int *); | |||
SL_EXTERN char *SLrline_get_line (SLrline_Type *); | SL_EXTERN char *SLrline_get_line (SLrline_Type *); | |||
SL_EXTERN int SLrline_get_hscroll (SLrline_Type *, unsigned int *); | SL_EXTERN int SLrline_get_hscroll (SLrline_Type *, unsigned int *); | |||
SL_EXTERN int SLrline_get_display_width (SLrline_Type *, unsigned int *); | SL_EXTERN int SLrline_get_display_width (SLrline_Type *, unsigned int *); | |||
SL_EXTERN int SLrline_set_update_hook (SLrline_Type *, | SL_EXTERN int SLrline_set_update_hook (SLrline_Type *, | |||
void (*)(SLrline_Type *rli, | void (*)(SLrline_Type *rli, | |||
char *prompt, | SLFUTURE_CONST char *prompt, | |||
char *buf, unsigned int len, | SLFUTURE_CONST char *buf, unsig | |||
ned int len, | ||||
unsigned int point, VOID_STAR c lient_data), | unsigned int point, VOID_STAR c lient_data), | |||
VOID_STAR client_data); | VOID_STAR client_data); | |||
SL_EXTERN SLkeymap_Type *SLrline_get_keymap (SLrline_Type *); | SL_EXTERN SLkeymap_Type *SLrline_get_keymap (SLrline_Type *); | |||
SL_EXTERN void SLrline_redraw (SLrline_Type *); | SL_EXTERN void SLrline_redraw (SLrline_Type *); | |||
SL_EXTERN int SLrline_save_line (SLrline_Type *); | SL_EXTERN int SLrline_save_line (SLrline_Type *); | |||
SL_EXTERN int SLrline_add_to_history (SLrline_Type *, char *); | SL_EXTERN int SLrline_add_to_history (SLrline_Type *, SLFUTURE_CONST char * ); | |||
/* Interpreter interface */ | /* Interpreter interface */ | |||
SL_EXTERN int SLrline_init (char *appdef, char *user_initfile, char *sys_in itfile); | SL_EXTERN int SLrline_init (SLFUTURE_CONST char *appname, SLFUTURE_CONST ch ar *user_initfile, SLFUTURE_CONST char *sys_initfile); | |||
/* Compatibility */ | /* Compatibility */ | |||
typedef SLrline_Type SLang_RLine_Info_Type; | typedef SLrline_Type SLang_RLine_Info_Type; | |||
/*}}}*/ | /*}}}*/ | |||
/*{{{ Low Level Screen Output Interface */ | /*{{{ Low Level Screen Output Interface */ | |||
SL_EXTERN unsigned long SLtt_Num_Chars_Output; | SL_EXTERN unsigned long SLtt_Num_Chars_Output; | |||
SL_EXTERN int SLtt_Baud_Rate; | SL_EXTERN int SLtt_Baud_Rate; | |||
skipping to change at line 1632 | skipping to change at line 1641 | |||
SL_EXTERN void SLtt_del_eol(void); | SL_EXTERN void SLtt_del_eol(void); | |||
SL_EXTERN void SLtt_goto_rc (int, int); | SL_EXTERN void SLtt_goto_rc (int, int); | |||
SL_EXTERN void SLtt_delete_nlines(int); | SL_EXTERN void SLtt_delete_nlines(int); | |||
SL_EXTERN void SLtt_delete_char(void); | SL_EXTERN void SLtt_delete_char(void); | |||
SL_EXTERN void SLtt_erase_line(void); | SL_EXTERN void SLtt_erase_line(void); | |||
SL_EXTERN void SLtt_normal_video(void); | SL_EXTERN void SLtt_normal_video(void); | |||
SL_EXTERN void SLtt_cls(void); | SL_EXTERN void SLtt_cls(void); | |||
SL_EXTERN void SLtt_beep(void); | SL_EXTERN void SLtt_beep(void); | |||
SL_EXTERN void SLtt_reverse_index(int); | SL_EXTERN void SLtt_reverse_index(int); | |||
SL_EXTERN void SLtt_smart_puts(SLsmg_Char_Type *, SLsmg_Char_Type *, int, i nt); | SL_EXTERN void SLtt_smart_puts(SLsmg_Char_Type *, SLsmg_Char_Type *, int, i nt); | |||
SL_EXTERN void SLtt_write_string (char *); | SL_EXTERN void SLtt_write_string (SLFUTURE_CONST char *); | |||
SL_EXTERN void SLtt_putchar(char); | SL_EXTERN void SLtt_putchar(char); | |||
SL_EXTERN int SLtt_init_video (void); | SL_EXTERN int SLtt_init_video (void); | |||
SL_EXTERN int SLtt_reset_video (void); | SL_EXTERN int SLtt_reset_video (void); | |||
SL_EXTERN void SLtt_get_terminfo(void); | SL_EXTERN void SLtt_get_terminfo(void); | |||
SL_EXTERN void SLtt_get_screen_size (void); | SL_EXTERN void SLtt_get_screen_size (void); | |||
SL_EXTERN int SLtt_set_cursor_visibility (int); | SL_EXTERN int SLtt_set_cursor_visibility (int); | |||
SL_EXTERN int SLtt_set_mouse_mode (int, int); | SL_EXTERN int SLtt_set_mouse_mode (int, int); | |||
#if defined(VMS) || defined(REAL_UNIX_SYSTEM) | #if defined(VMS) || defined(REAL_UNIX_SYSTEM) | |||
SL_EXTERN int SLtt_initialize (char *); | SL_EXTERN int SLtt_initialize (SLFUTURE_CONST char *); | |||
SL_EXTERN void SLtt_enable_cursor_keys(void); | SL_EXTERN void SLtt_enable_cursor_keys(void); | |||
SL_EXTERN void SLtt_set_term_vtxxx(int *); | SL_EXTERN void SLtt_set_term_vtxxx(int *); | |||
SL_EXTERN void SLtt_wide_width(void); | SL_EXTERN void SLtt_wide_width(void); | |||
SL_EXTERN void SLtt_narrow_width(void); | SL_EXTERN void SLtt_narrow_width(void); | |||
SL_EXTERN void SLtt_set_alt_char_set (int); | SL_EXTERN void SLtt_set_alt_char_set (int); | |||
SL_EXTERN int SLtt_write_to_status_line (char *, int); | SL_EXTERN int SLtt_write_to_status_line (SLFUTURE_CONST char *, int); | |||
SL_EXTERN void SLtt_disable_status_line (void); | SL_EXTERN void SLtt_disable_status_line (void); | |||
# ifdef REAL_UNIX_SYSTEM | # ifdef REAL_UNIX_SYSTEM | |||
/* These are termcap/terminfo routines that assume SLtt_initialize has | /* These are termcap/terminfo routines that assume SLtt_initialize has | |||
* been called. | * been called. | |||
*/ | */ | |||
SL_EXTERN char *SLtt_tgetstr (char *); | SL_EXTERN char *SLtt_tgetstr (SLFUTURE_CONST char *); | |||
SL_EXTERN int SLtt_tgetnum (char *); | SL_EXTERN int SLtt_tgetnum (SLFUTURE_CONST char *); | |||
SL_EXTERN int SLtt_tgetflag (char *); | SL_EXTERN int SLtt_tgetflag (SLFUTURE_CONST char *); | |||
/* The following are terminfo-only routines -- these prototypes will change | /* The following are terminfo-only routines -- these prototypes will change | |||
* in V2.x. | * in V2.x. | |||
*/ | */ | |||
SL_EXTERN char *SLtt_tigetent (char *); | SL_EXTERN char *SLtt_tigetent (SLFUTURE_CONST char *); | |||
SL_EXTERN char *SLtt_tigetstr (char *, char **); | SL_EXTERN char *SLtt_tigetstr (SLFUTURE_CONST char *, char **); | |||
SL_EXTERN int SLtt_tigetnum (char *, char **); | SL_EXTERN int SLtt_tigetnum (SLFUTURE_CONST char *, char **); | |||
# endif | # endif | |||
#endif | #endif | |||
SL_EXTERN SLtt_Char_Type SLtt_get_color_object (int); | SL_EXTERN SLtt_Char_Type SLtt_get_color_object (int); | |||
SL_EXTERN int SLtt_set_color_object (int, SLtt_Char_Type); | SL_EXTERN int SLtt_set_color_object (int, SLtt_Char_Type); | |||
SL_EXTERN int SLtt_set_color (int, char *, char *, char *); | SL_EXTERN int SLtt_set_color (int, SLFUTURE_CONST char *, SLFUTURE_CONST ch | |||
SL_EXTERN int SLtt_set_mono (int, char *, SLtt_Char_Type); | ar *, SLFUTURE_CONST char *); | |||
SL_EXTERN int SLtt_set_mono (int, SLFUTURE_CONST char *, SLtt_Char_Type); | ||||
SL_EXTERN int SLtt_add_color_attribute (int, SLtt_Char_Type); | SL_EXTERN int SLtt_add_color_attribute (int, SLtt_Char_Type); | |||
SL_EXTERN int SLtt_set_color_fgbg (int, SLtt_Char_Type, SLtt_Char_Type); | SL_EXTERN int SLtt_set_color_fgbg (int, SLtt_Char_Type, SLtt_Char_Type); | |||
/*}}}*/ | /*}}}*/ | |||
/*{{{ SLang Preprocessor Interface */ | /*{{{ SLang Preprocessor Interface */ | |||
/* #define SLPreprocess_Type SLprep_Type; */ | /* #define SLPreprocess_Type SLprep_Type; */ | |||
typedef struct _pSLprep_Type SLprep_Type; | typedef struct _pSLprep_Type SLprep_Type; | |||
SL_EXTERN SLprep_Type *SLprep_new (void); | SL_EXTERN SLprep_Type *SLprep_new (void); | |||
SL_EXTERN void SLprep_delete (SLprep_Type *); | SL_EXTERN void SLprep_delete (SLprep_Type *); | |||
SL_EXTERN int SLprep_line_ok (char *, SLprep_Type *); | SL_EXTERN int SLprep_line_ok (SLFUTURE_CONST char *, SLprep_Type *); | |||
SL_EXTERN int SLprep_set_flags (SLprep_Type *, unsigned int flags); | SL_EXTERN int SLprep_set_flags (SLprep_Type *, unsigned int flags); | |||
#define SLPREP_BLANK_LINES_OK 0x1 | #define SLPREP_BLANK_LINES_OK 0x1 | |||
#define SLPREP_COMMENT_LINES_OK 0x2 | #define SLPREP_COMMENT_LINES_OK 0x2 | |||
SL_EXTERN int SLprep_set_comment (SLprep_Type *, char *, char *); | SL_EXTERN int SLprep_set_comment (SLprep_Type *, SLFUTURE_CONST char *, SLF | |||
SL_EXTERN int SLprep_set_prefix (SLprep_Type *, char *); | UTURE_CONST char *); | |||
SL_EXTERN int SLprep_set_prefix (SLprep_Type *, SLFUTURE_CONST char *); | ||||
SL_EXTERN int SLprep_set_exists_hook (SLprep_Type *, | SL_EXTERN int SLprep_set_exists_hook (SLprep_Type *, | |||
int (*)(SLprep_Type *, char *)); | int (*)(SLprep_Type *, SLFUTURE_CONST cha r *)); | |||
SL_EXTERN int SLprep_set_eval_hook (SLprep_Type *, | SL_EXTERN int SLprep_set_eval_hook (SLprep_Type *, | |||
int (*)(SLprep_Type *, char *)); | int (*)(SLprep_Type *, SLFUTURE_CONST char *)); | |||
SL_EXTERN int SLdefine_for_ifdef (char *); | SL_EXTERN int SLdefine_for_ifdef (SLFUTURE_CONST char *); | |||
/* Adds a string to the SLang #ifdef preparsing defines. SLang already | /* Adds a string to the SLang #ifdef preparsing defines. SLang already | |||
defines MSDOS, UNIX, and VMS on the appropriate system. */ | defines MSDOS, UNIX, and VMS on the appropriate system. */ | |||
/*}}}*/ | /*}}}*/ | |||
/*{{{ SLsmg Screen Management Functions */ | /*{{{ SLsmg Screen Management Functions */ | |||
SL_EXTERN void SLsmg_fill_region (int, int, unsigned int, unsigned int, | SL_EXTERN void SLsmg_fill_region (int, int, unsigned int, unsigned int, | |||
SLwchar_Type); | SLwchar_Type); | |||
SL_EXTERN void SLsmg_set_char_set (int); | SL_EXTERN void SLsmg_set_char_set (int); | |||
skipping to change at line 1718 | skipping to change at line 1727 | |||
SL_EXTERN int SLsmg_Scroll_Hash_Border; | SL_EXTERN int SLsmg_Scroll_Hash_Border; | |||
#endif | #endif | |||
SL_EXTERN int SLsmg_suspend_smg (void); | SL_EXTERN int SLsmg_suspend_smg (void); | |||
SL_EXTERN int SLsmg_resume_smg (void); | SL_EXTERN int SLsmg_resume_smg (void); | |||
SL_EXTERN void SLsmg_erase_eol (void); | SL_EXTERN void SLsmg_erase_eol (void); | |||
SL_EXTERN void SLsmg_gotorc (int, int); | SL_EXTERN void SLsmg_gotorc (int, int); | |||
SL_EXTERN void SLsmg_erase_eos (void); | SL_EXTERN void SLsmg_erase_eos (void); | |||
SL_EXTERN void SLsmg_reverse_video (void); | SL_EXTERN void SLsmg_reverse_video (void); | |||
SL_EXTERN void SLsmg_set_color (SLsmg_Color_Type); | SL_EXTERN void SLsmg_set_color (SLsmg_Color_Type); | |||
SL_EXTERN void SLsmg_normal_video (void); | SL_EXTERN void SLsmg_normal_video (void); | |||
SL_EXTERN void SLsmg_printf (char *, ...) SLATTRIBUTE_PRINTF(1,2); | SL_EXTERN void SLsmg_printf (SLFUTURE_CONST char *, ...) SLATTRIBUTE_PRINTF | |||
/* SL_EXTERN void SLsmg_printf (char *, ...) SLATTRIBUTE_PRINTF(1,2); */ | (1,2); | |||
SL_EXTERN void SLsmg_vprintf (char *, va_list); | /* SL_EXTERN void SLsmg_printf (SLFUTURE_CONST char *, ...) SLATTRIBUTE_PRI | |||
SL_EXTERN void SLsmg_write_string (char *); | NTF(1,2); */ | |||
SL_EXTERN void SLsmg_write_nstring (char *, unsigned int); | SL_EXTERN void SLsmg_vprintf (SLFUTURE_CONST char *, va_list); | |||
SL_EXTERN void SLsmg_write_string (SLFUTURE_CONST char *); | ||||
SL_EXTERN void SLsmg_write_nstring (SLFUTURE_CONST char *, unsigned int); | ||||
SL_EXTERN void SLsmg_write_chars (SLuchar_Type *u, SLuchar_Type *umax); | SL_EXTERN void SLsmg_write_chars (SLuchar_Type *u, SLuchar_Type *umax); | |||
SL_EXTERN void SLsmg_write_nchars (char *str, unsigned int len); | SL_EXTERN void SLsmg_write_nchars (SLFUTURE_CONST char *str, unsigned int l en); | |||
SL_EXTERN void SLsmg_write_char (SLwchar_Type ch); | SL_EXTERN void SLsmg_write_char (SLwchar_Type ch); | |||
SL_EXTERN void SLsmg_write_wrapped_string (SLuchar_Type *, int, int, unsign ed int, unsigned int, int); | SL_EXTERN void SLsmg_write_wrapped_string (SLuchar_Type *, int, int, unsign ed int, unsigned int, int); | |||
SL_EXTERN void SLsmg_cls (void); | SL_EXTERN void SLsmg_cls (void); | |||
SL_EXTERN void SLsmg_refresh (void); | SL_EXTERN void SLsmg_refresh (void); | |||
SL_EXTERN void SLsmg_touch_lines (int, unsigned int); | SL_EXTERN void SLsmg_touch_lines (int, unsigned int); | |||
SL_EXTERN void SLsmg_touch_screen (void); | SL_EXTERN void SLsmg_touch_screen (void); | |||
SL_EXTERN int SLsmg_init_smg (void); | SL_EXTERN int SLsmg_init_smg (void); | |||
SL_EXTERN int SLsmg_reinit_smg (void); | SL_EXTERN int SLsmg_reinit_smg (void); | |||
SL_EXTERN void SLsmg_reset_smg (void); | SL_EXTERN void SLsmg_reset_smg (void); | |||
SL_EXTERN int SLsmg_char_at (SLsmg_Char_Type *); | SL_EXTERN int SLsmg_char_at (SLsmg_Char_Type *); | |||
skipping to change at line 1917 | skipping to change at line 1926 | |||
#define SL_KEY_BACKSPACE 0x110 | #define SL_KEY_BACKSPACE 0x110 | |||
#define SL_KEY_ENTER 0x111 | #define SL_KEY_ENTER 0x111 | |||
#define SL_KEY_IC 0x112 | #define SL_KEY_IC 0x112 | |||
#define SL_KEY_DELETE 0x113 | #define SL_KEY_DELETE 0x113 | |||
#define SL_KEY_F0 0x200 | #define SL_KEY_F0 0x200 | |||
#define SL_KEY_F(X) (SL_KEY_F0 + X) | #define SL_KEY_F(X) (SL_KEY_F0 + X) | |||
/* I do not intend to use keysymps > 0x1000. Applications can use those. * / | /* I do not intend to use keysymps > 0x1000. Applications can use those. * / | |||
/* Returns 0 upon success or -1 upon error. */ | /* Returns 0 upon success or -1 upon error. */ | |||
SL_EXTERN int SLkp_define_keysym (char *, unsigned int); | SL_EXTERN int SLkp_define_keysym (SLFUTURE_CONST char *, unsigned int); | |||
/* This function must be called AFTER SLtt_get_terminfo and not before. */ | /* This function must be called AFTER SLtt_get_terminfo and not before. */ | |||
SL_EXTERN int SLkp_init (void); | SL_EXTERN int SLkp_init (void); | |||
/* By default, SLang_getkey is used as the low-level function. This hook | /* By default, SLang_getkey is used as the low-level function. This hook | |||
* allows you to specify something else. | * allows you to specify something else. | |||
*/ | */ | |||
SL_EXTERN void SLkp_set_getkey_function (int (*)(void)); | SL_EXTERN void SLkp_set_getkey_function (int (*)(void)); | |||
/* This function uses SLang_getkey and assumes that what ever initializatio n | /* This function uses SLang_getkey and assumes that what ever initializatio n | |||
skipping to change at line 1979 | skipping to change at line 1988 | |||
/*}}}*/ | /*}}}*/ | |||
/*{{{ Signal Routines */ | /*{{{ Signal Routines */ | |||
typedef void SLSig_Fun_Type (int); | typedef void SLSig_Fun_Type (int); | |||
SL_EXTERN SLSig_Fun_Type *SLsignal (int, SLSig_Fun_Type *); | SL_EXTERN SLSig_Fun_Type *SLsignal (int, SLSig_Fun_Type *); | |||
SL_EXTERN SLSig_Fun_Type *SLsignal_intr (int, SLSig_Fun_Type *); | SL_EXTERN SLSig_Fun_Type *SLsignal_intr (int, SLSig_Fun_Type *); | |||
SL_EXTERN int SLsig_block_signals (void); | SL_EXTERN int SLsig_block_signals (void); | |||
SL_EXTERN int SLsig_unblock_signals (void); | SL_EXTERN int SLsig_unblock_signals (void); | |||
SL_EXTERN int SLsystem (char *); | SL_EXTERN int SLsystem (SLFUTURE_CONST char *); | |||
/* Make a signal off-limits to the interpreter */ | /* Make a signal off-limits to the interpreter */ | |||
SL_EXTERN int SLsig_forbid_signal (int); | SL_EXTERN int SLsig_forbid_signal (int); | |||
SL_EXTERN char *SLerrno_strerror (int); | SL_EXTERN SLFUTURE_CONST char *SLerrno_strerror (int); | |||
SL_EXTERN int SLerrno_set_errno (int); | SL_EXTERN int SLerrno_set_errno (int); | |||
/*}}}*/ | /*}}}*/ | |||
/* Functions for dealing with the FPU */ | /* Functions for dealing with the FPU */ | |||
SL_EXTERN void SLfpu_clear_except_bits (void); | SL_EXTERN void SLfpu_clear_except_bits (void); | |||
SL_EXTERN unsigned int SLfpu_test_except_bits (unsigned int bits); | SL_EXTERN unsigned int SLfpu_test_except_bits (unsigned int bits); | |||
#define SL_FE_DIVBYZERO 0x01 | #define SL_FE_DIVBYZERO 0x01 | |||
#define SL_FE_INVALID 0x02 | #define SL_FE_INVALID 0x02 | |||
#define SL_FE_OVERFLOW 0x04 | #define SL_FE_OVERFLOW 0x04 | |||
skipping to change at line 2123 | skipping to change at line 2132 | |||
#define SLANG_ABS 0x25 | #define SLANG_ABS 0x25 | |||
#define SLANG_SIGN 0x26 | #define SLANG_SIGN 0x26 | |||
#define SLANG_SQR 0x27 | #define SLANG_SQR 0x27 | |||
#define SLANG_MUL2 0x28 | #define SLANG_MUL2 0x28 | |||
#define SLANG_ISPOS 0x29 | #define SLANG_ISPOS 0x29 | |||
#define SLANG_ISNEG 0x2A | #define SLANG_ISNEG 0x2A | |||
#define SLANG_ISNONNEG 0x2B | #define SLANG_ISNONNEG 0x2B | |||
#define SLANG_UNARY_OP_MAX 0x2B | #define SLANG_UNARY_OP_MAX 0x2B | |||
SL_EXTERN char *SLang_Error_Message; | SL_EXTERN SLFUTURE_CONST char *SLang_Error_Message; | |||
SL_EXTERN int SLadd_intrinsic_variable (char *, VOID_STAR, SLtype, int); | SL_EXTERN int SLadd_intrinsic_variable (SLFUTURE_CONST char *, VOID_STAR, S | |||
SL_EXTERN int SLadd_intrinsic_function (char *, FVOID_STAR, SLtype, unsigne | Ltype, int); | |||
d int,...); | SL_EXTERN int SLadd_intrinsic_function (SLFUTURE_CONST char *, FVOID_STAR, | |||
SLtype, unsigned int,...); | ||||
SL_EXTERN int SLns_add_intrinsic_variable (SLang_NameSpace_Type *, char *, | SL_EXTERN int SLns_add_intrinsic_variable (SLang_NameSpace_Type *, SLFUTURE | |||
VOID_STAR, SLtype, int); | _CONST char *, VOID_STAR, SLtype, int); | |||
SL_EXTERN int SLns_add_intrinsic_function (SLang_NameSpace_Type *, char *, | SL_EXTERN int SLns_add_intrinsic_function (SLang_NameSpace_Type *, SLFUTURE | |||
FVOID_STAR, SLtype, unsigned int,...); | _CONST char *, FVOID_STAR, SLtype, unsigned int,...); | |||
/* These functions are used to patch intrinsic tables that make use of | /* These functions are used to patch intrinsic tables that make use of | |||
* dynamically allocated types whose type id is determined at | * dynamically allocated types whose type id is determined at | |||
* run-time. The second version is useful for the most common case of a | * run-time. The second version is useful for the most common case of a | |||
* single mapping. | * single mapping. | |||
*/ | */ | |||
SL_EXTERN int SLclass_patch_intrin_fun_table (SLang_Intrin_Fun_Type *table, | SL_EXTERN int SLclass_patch_intrin_fun_table (SLang_Intrin_Fun_Type *table, | |||
SLtype *from_types, SLtype *to_type s, unsigned int num); | SLtype *from_types, SLtype *to_type s, unsigned int num); | |||
SL_EXTERN int SLclass_patch_intrin_fun_table1 (SLang_Intrin_Fun_Type *table , | SL_EXTERN int SLclass_patch_intrin_fun_table1 (SLang_Intrin_Fun_Type *table , | |||
SLtype from_type, SLtype to_type); | SLtype from_type, SLtype to_type); | |||
skipping to change at line 2289 | skipping to change at line 2298 | |||
SL_EXTERN unsigned char _pSLChg_LCase_Lut[256]; | SL_EXTERN unsigned char _pSLChg_LCase_Lut[256]; | |||
#define UPPER_CASE(x) (_pSLChg_UCase_Lut[(unsigned char) (x)]) | #define UPPER_CASE(x) (_pSLChg_UCase_Lut[(unsigned char) (x)]) | |||
#define LOWER_CASE(x) (_pSLChg_LCase_Lut[(unsigned char) (x)]) | #define LOWER_CASE(x) (_pSLChg_LCase_Lut[(unsigned char) (x)]) | |||
#define CHANGE_CASE(x) (((x) == _pSLChg_LCase_Lut[(unsigned char) (x)]) ?\ | #define CHANGE_CASE(x) (((x) == _pSLChg_LCase_Lut[(unsigned char) (x)]) ?\ | |||
_pSLChg_UCase_Lut[(unsigned char) (x)] : _pSLChg_LCa se_Lut[(unsigned char) (x)]) | _pSLChg_UCase_Lut[(unsigned char) (x)] : _pSLChg_LCa se_Lut[(unsigned char) (x)]) | |||
/*}}}*/ | /*}}}*/ | |||
/*{{{ Regular Expression Interface */ | /*{{{ Regular Expression Interface */ | |||
typedef struct _pSLRegexp_Type SLRegexp_Type; | typedef struct _pSLRegexp_Type SLRegexp_Type; | |||
SL_EXTERN SLRegexp_Type *SLregexp_compile (char *pattern, unsigned int flag s); | SL_EXTERN SLRegexp_Type *SLregexp_compile (SLFUTURE_CONST char *pattern, un signed int flags); | |||
#define SLREGEXP_CASELESS 0x01 | #define SLREGEXP_CASELESS 0x01 | |||
#define SLREGEXP_UTF8 0x10 | #define SLREGEXP_UTF8 0x10 | |||
SL_EXTERN void SLregexp_free (SLRegexp_Type *); | SL_EXTERN void SLregexp_free (SLRegexp_Type *); | |||
SL_EXTERN char *SLregexp_match (SLRegexp_Type *compiled_regexp, char *str, unsigned int len); | SL_EXTERN char *SLregexp_match (SLRegexp_Type *compiled_regexp, SLFUTURE_CO NST char *str, unsigned int len); | |||
SL_EXTERN int SLregexp_nth_match (SLRegexp_Type *, unsigned int nth, unsign ed int *ofsp, unsigned int *lenp); | SL_EXTERN int SLregexp_nth_match (SLRegexp_Type *, unsigned int nth, unsign ed int *ofsp, unsigned int *lenp); | |||
SL_EXTERN int SLregexp_get_hints (SLRegexp_Type *, unsigned int *flagsp); | SL_EXTERN int SLregexp_get_hints (SLRegexp_Type *, unsigned int *flagsp); | |||
#define SLREGEXP_HINT_BOL 0x01 /* pattern must match bol */ | #define SLREGEXP_HINT_BOL 0x01 /* pattern must match bol */ | |||
#define SLREGEXP_HINT_OSEARCH 0x02 /* ordinary search will do */ | #define SLREGEXP_HINT_OSEARCH 0x02 /* ordinary search will do */ | |||
SL_EXTERN char *SLregexp_quote_string (char *pattern, char *buf, unsigned i nt buflen); | SL_EXTERN char *SLregexp_quote_string (SLFUTURE_CONST char *pattern, char * buf, unsigned int buflen); | |||
/*}}}*/ | /*}}}*/ | |||
/*{{{ SLang Command Interface */ | /*{{{ SLang Command Interface */ | |||
struct _pSLcmd_Cmd_Type; /* Pre-declaration is needed below */ | struct _pSLcmd_Cmd_Type; /* Pre-declaration is needed below */ | |||
typedef struct | typedef struct | |||
{ | { | |||
struct _pSLcmd_Cmd_Type *table; | struct _pSLcmd_Cmd_Type *table; | |||
int argc; | int argc; | |||
/* Version 2.0 needs to use a union!! */ | /* Version 2.0 needs to use a union!! */ | |||
char **string_args; | SLFUTURE_CONST char **string_args; | |||
int *int_args; | int *int_args; | |||
double *double_args; | double *double_args; | |||
SLtype *arg_type; | SLtype *arg_type; | |||
unsigned long reserved[4]; | unsigned long reserved[4]; | |||
} SLcmd_Cmd_Table_Type; | } SLcmd_Cmd_Table_Type; | |||
typedef struct _pSLcmd_Cmd_Type | typedef struct _pSLcmd_Cmd_Type | |||
{ | { | |||
int (*cmdfun)(int, SLcmd_Cmd_Table_Type *); | int (*cmdfun)(int, SLcmd_Cmd_Table_Type *); | |||
char *cmd; | SLFUTURE_CONST char *cmd; | |||
char *arg_type; | SLFUTURE_CONST char *arg_type; | |||
} SLcmd_Cmd_Type; | } SLcmd_Cmd_Type; | |||
SL_EXTERN int SLcmd_execute_string (char *, SLcmd_Cmd_Table_Type *); | SL_EXTERN int SLcmd_execute_string (SLFUTURE_CONST char *, SLcmd_Cmd_Table_ Type *); | |||
/*}}}*/ | /*}}}*/ | |||
/*{{{ SLang Search Interface */ | /*{{{ SLang Search Interface */ | |||
typedef struct _pSLsearch_Type SLsearch_Type; | typedef struct _pSLsearch_Type SLsearch_Type; | |||
SL_EXTERN SLsearch_Type *SLsearch_new (SLuchar_Type *u, int search_flags); | SL_EXTERN SLsearch_Type *SLsearch_new (SLuchar_Type *u, int search_flags); | |||
#define SLSEARCH_CASELESS 0x1 | #define SLSEARCH_CASELESS 0x1 | |||
#define SLSEARCH_UTF8 0x2 | #define SLSEARCH_UTF8 0x2 | |||
skipping to change at line 2351 | skipping to change at line 2360 | |||
SLuchar_Type *pmin, SLuchar_Type *p max); | SLuchar_Type *pmin, SLuchar_Type *p max); | |||
SL_EXTERN SLuchar_Type *SLsearch_backward (SLsearch_Type *st, | SL_EXTERN SLuchar_Type *SLsearch_backward (SLsearch_Type *st, | |||
SLuchar_Type *pmin, SLuchar_Type * pstart, SLuchar_Type *pmax); | SLuchar_Type *pmin, SLuchar_Type * pstart, SLuchar_Type *pmax); | |||
SL_EXTERN unsigned int SLsearch_match_len (SLsearch_Type *); | SL_EXTERN unsigned int SLsearch_match_len (SLsearch_Type *); | |||
/*}}}*/ | /*}}}*/ | |||
/*{{{ SLang Pathname Interface */ | /*{{{ SLang Pathname Interface */ | |||
/* These function return pointers to the original space */ | /* These function return pointers to the original space */ | |||
SL_EXTERN char *SLpath_basename (char *); | SL_EXTERN char *SLpath_basename (SLFUTURE_CONST char *); | |||
SL_EXTERN char *SLpath_extname (char *); | SL_EXTERN char *SLpath_extname (SLFUTURE_CONST char *); | |||
SL_EXTERN int SLpath_is_absolute_path (char *); | SL_EXTERN int SLpath_is_absolute_path (SLFUTURE_CONST char *); | |||
/* Get and set the character delimiter for search paths */ | /* Get and set the character delimiter for search paths */ | |||
SL_EXTERN int SLpath_get_delimiter (void); | SL_EXTERN int SLpath_get_delimiter (void); | |||
SL_EXTERN int SLpath_set_delimiter (int); | SL_EXTERN int SLpath_set_delimiter (int); | |||
/* search path for loading .sl files */ | /* search path for loading .sl files */ | |||
SL_EXTERN int SLpath_set_load_path (char *); | SL_EXTERN int SLpath_set_load_path (SLFUTURE_CONST char *); | |||
/* search path for loading .sl files --- returns slstring */ | /* search path for loading .sl files --- returns slstring */ | |||
SL_EXTERN char *SLpath_get_load_path (void); | SL_EXTERN char *SLpath_get_load_path (void); | |||
/* These return malloced strings--- NOT slstrings */ | /* These return malloced strings--- NOT slstrings */ | |||
SL_EXTERN char *SLpath_dircat (char *, char *); | SL_EXTERN char *SLpath_dircat (SLFUTURE_CONST char *, SLFUTURE_CONST char * | |||
SL_EXTERN char *SLpath_find_file_in_path (char *, char *); | ); | |||
SL_EXTERN char *SLpath_dirname (char *); | SL_EXTERN char *SLpath_find_file_in_path (SLFUTURE_CONST char *, SLFUTURE_C | |||
SL_EXTERN int SLpath_file_exists (char *); | ONST char *); | |||
SL_EXTERN char *SLpath_pathname_sans_extname (char *); | SL_EXTERN char *SLpath_dirname (SLFUTURE_CONST char *); | |||
SL_EXTERN int SLpath_file_exists (SLFUTURE_CONST char *); | ||||
SL_EXTERN char *SLpath_pathname_sans_extname (SLFUTURE_CONST char *); | ||||
/*}}}*/ | /*}}}*/ | |||
SL_EXTERN int SLang_set_module_load_path (char *); | SL_EXTERN int SLang_set_module_load_path (SLFUTURE_CONST char *); | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
# define SLANG_MODULE(name) \ | # define SLANG_MODULE(name) \ | |||
extern SL_EXPORT "C" int init_##name##_module_ns (char *); \ | extern SL_EXPORT "C" int init_##name##_module_ns (char *); \ | |||
extern SL_EXPORT "C" void deinit_##name##_module (void); \ | extern SL_EXPORT "C" void deinit_##name##_module (void); \ | |||
extern SL_EXPORT "C" int SLmodule_##name##_api_version; \ | extern SL_EXPORT "C" int SLmodule_##name##_api_version; \ | |||
SL_EXPORT int SLmodule_##name##_api_version = SLANG_VERSION | SL_EXPORT int SLmodule_##name##_api_version = SLANG_VERSION | |||
#else | #else | |||
# define SLANG_MODULE(name) \ | # define SLANG_MODULE(name) \ | |||
extern SL_EXPORT int init_##name##_module_ns (char *); \ | extern SL_EXPORT int init_##name##_module_ns (char *); \ | |||
extern SL_EXPORT void deinit_##name##_module (void); \ | extern SL_EXPORT void deinit_##name##_module (void); \ | |||
SL_EXPORT int SLmodule_##name##_api_version = SLANG_VERSION | SL_EXPORT int SLmodule_##name##_api_version = SLANG_VERSION | |||
#endif | #endif | |||
SL_EXTERN int SLvsnprintf (char *, unsigned int, char *, va_list); | SL_EXTERN int SLvsnprintf (char *, unsigned int, SLFUTURE_CONST char *, va_ | |||
SL_EXTERN int SLsnprintf (char *, unsigned int, char *, ...); | list); | |||
SL_EXTERN int SLsnprintf (char *, unsigned int, SLFUTURE_CONST char *, ...) | ||||
SLATTRIBUTE_PRINTF(3,4); | ||||
#if 0 | #if 0 | |||
{ | { | |||
#endif | #endif | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* DAVIS_SLANG_H_ */ | #endif /* DAVIS_SLANG_H_ */ | |||
End of changes. 111 change blocks. | ||||
186 lines changed or deleted | 224 lines changed or added | |||