mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 12:32:40 +03:00
Removed bundled slang
This commit is contained in:
parent
3410eb3229
commit
4f9185a3ee
@ -158,6 +158,10 @@
|
||||
Changed message type codes on calls to message(), query_dialog(),
|
||||
close_error_pipe() from numeric IDs to symbols D_ERROR, D_NORMAL
|
||||
|
||||
2009-01-07 Enrico Weigelt, metux ITS <weigelt@metux.de>
|
||||
|
||||
* removed bundled slang
|
||||
|
||||
2008-12-18 Roland Illig <roland.illig@gmx.de>
|
||||
|
||||
* doc/mcedit.1: Documented the newly added filename:lineno
|
||||
|
14
INSTALL
14
INSTALL
@ -169,19 +169,11 @@ included one, but you can override this by using the following flag
|
||||
(please note that since S-Lang is default, it is tested better than
|
||||
ncurses):
|
||||
|
||||
`--with-screen={slang|mcslang|ncurses}'
|
||||
`--with-screen={slang|ncurses}'
|
||||
Choose the library used to manage interaction with the terminal.
|
||||
`slang' means S-Lang library already installed on the system,
|
||||
`mcslang' means S-Lang library included with the sources of
|
||||
GNU Midnight Commander, `ncurses' means ncurses library already
|
||||
installed on the system. The installed S-Lang library is used
|
||||
by default if found, otherwise the included S-Lang library is
|
||||
used.
|
||||
|
||||
`--with-termcap'
|
||||
If the included S-Lang library is used, this option forces it to
|
||||
use the termcap database, as opposed to the default terminfo
|
||||
database.
|
||||
`ncurses' means ncurses library already installed on the system.
|
||||
The installed S-Lang library is used by default if found.
|
||||
|
||||
On systems that require unusual options for compilation or linking that
|
||||
the package's `configure' script does not know about, you can give
|
||||
|
@ -24,14 +24,11 @@ The most often needed options to configure are following:
|
||||
You can specify an installation prefix other than default by
|
||||
giving `configure' the option `--prefix=PATH'.
|
||||
|
||||
`--with-screen={slang|mcslang|ncurses}'
|
||||
`--with-screen={slang|ncurses}'
|
||||
Choose the library used to manage interaction with the terminal.
|
||||
`slang' means S-Lang library already installed on the system,
|
||||
`mcslang' means S-Lang library included with the sources of
|
||||
GNU Midnight Commander, `ncurses' means ncurses library already
|
||||
installed on the system. The installed S-Lang library is used
|
||||
by default if found, otherwise the included S-Lang library is
|
||||
used.
|
||||
`ncurses' means ncurses library already installed on the system.
|
||||
The installed S-Lang library is used by default if found.
|
||||
|
||||
You may also want to specify CFLAGS for the compiler, even if it finds
|
||||
itself some defaults by typing e.g.
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
AUTOMAKE_OPTIONS = 1.5
|
||||
|
||||
SUBDIRS = intl po m4 vfs slang edit src lib doc syntax
|
||||
SUBDIRS = intl po m4 vfs edit src lib doc syntax
|
||||
|
||||
EXTRA_DIST = FAQ HACKING INSTALL.FAST MAINTAINERS README.QNX TODO pkginfo.in prototype.in mc.qpg mc.spec
|
||||
|
||||
|
73
acinclude.m4
73
acinclude.m4
@ -362,7 +362,7 @@ AC_DEFUN([MC_SLANG_TERMCAP], [
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl Common code for MC_WITH_SLANG and MC_WITH_MCSLANG
|
||||
dnl Common code for MC_WITH_SLANG
|
||||
dnl
|
||||
AC_DEFUN([_MC_WITH_XSLANG], [
|
||||
screen_type=slang
|
||||
@ -373,7 +373,7 @@ AC_DEFUN([_MC_WITH_XSLANG], [
|
||||
|
||||
dnl
|
||||
dnl Check if the system S-Lang library can be used.
|
||||
dnl If not, and $1 is "strict", exit, otherwise fall back to mcslang.
|
||||
dnl If not, and $1 is "strict", exit.
|
||||
dnl
|
||||
AC_DEFUN([MC_WITH_SLANG], [
|
||||
with_screen=slang
|
||||
@ -383,7 +383,7 @@ AC_DEFUN([MC_WITH_SLANG], [
|
||||
AC_CHECK_HEADERS([slang.h slang/slang.h],
|
||||
[slang_h_found=yes; break])
|
||||
if test -z "$slang_h_found"; then
|
||||
with_screen=mcslang
|
||||
AC_MSG_ERROR([Slang header not found])
|
||||
fi
|
||||
|
||||
dnl Check if termcap is needed.
|
||||
@ -395,78 +395,23 @@ AC_DEFUN([MC_WITH_SLANG], [
|
||||
dnl Check the library
|
||||
if test x$with_screen = xslang; then
|
||||
AC_CHECK_LIB([slang], [SLang_init_tty], [MCLIBS="$MCLIBS -lslang"],
|
||||
[with_screen=mcslang], ["$MCLIBS"])
|
||||
AC_MSG_ERROR([Slang library not found]), ["$MCLIBS"])
|
||||
fi
|
||||
|
||||
dnl Unless external S-Lang was requested, reject S-Lang with UTF-8 hacks
|
||||
if test x$with_screen = xslang; then
|
||||
:
|
||||
m4_if([$1], strict, ,
|
||||
[AC_CHECK_LIB([slang], [SLsmg_write_nwchars],
|
||||
[AC_MSG_WARN([Rejecting S-Lang with UTF-8 support, \
|
||||
it's not fully supported yet])
|
||||
with_screen=mcslang])])
|
||||
AC_CHECK_LIB(
|
||||
[slang],
|
||||
[SLsmg_write_nwchars],
|
||||
[AC_MSG_ERROR([Rejecting S-Lang with UTF-8 support, it's not fully supported yet])])
|
||||
fi
|
||||
|
||||
if test x$with_screen = xslang; then
|
||||
AC_DEFINE(HAVE_SYSTEM_SLANG, 1,
|
||||
[Define to use S-Lang library installed on the system])
|
||||
MC_SLANG_PRIVATE
|
||||
screen_type=slang
|
||||
screen_msg="S-Lang library (installed on the system)"
|
||||
else
|
||||
m4_if([$1], strict,
|
||||
[if test $with_screen != slang; then
|
||||
AC_MSG_ERROR([S-Lang library not found])
|
||||
fi],
|
||||
[MC_WITH_MCSLANG]
|
||||
)
|
||||
fi
|
||||
|
||||
_MC_WITH_XSLANG
|
||||
])
|
||||
|
||||
|
||||
dnl
|
||||
dnl Use the included S-Lang library.
|
||||
dnl
|
||||
AC_DEFUN([MC_WITH_MCSLANG], [
|
||||
screen_type=mcslang
|
||||
screen_msg="Included S-Lang library (mcslang)"
|
||||
|
||||
dnl Type checks from S-Lang sources
|
||||
AC_CHECK_SIZEOF(short, 2)
|
||||
AC_CHECK_SIZEOF(int, 4)
|
||||
AC_CHECK_SIZEOF(long, 4)
|
||||
AC_CHECK_SIZEOF(float, 4)
|
||||
AC_CHECK_SIZEOF(double, 8)
|
||||
AC_TYPE_OFF_T
|
||||
AC_CHECK_SIZEOF(off_t)
|
||||
AC_CHECK_TYPES(long long)
|
||||
AC_CHECK_SIZEOF(long long)
|
||||
AC_CHECK_FUNCS(atexit on_exit)
|
||||
|
||||
# Search for terminfo database.
|
||||
use_terminfo=
|
||||
if test x"$with_termcap" != xyes; then
|
||||
if test x"$with_termcap" = xno; then
|
||||
use_terminfo=yes
|
||||
fi
|
||||
if test -n "$TERMINFO" && test -r "$TERMINFO/v/vt100"; then
|
||||
use_terminfo=yes
|
||||
fi
|
||||
for dir in "/usr/share/terminfo" "/usr/lib/terminfo" \
|
||||
"/usr/share/lib/terminfo" "/etc/terminfo" \
|
||||
"/usr/local/lib/terminfo" "$HOME/.terminfo"; do
|
||||
if test -r "$dir/v/vt100"; then
|
||||
use_terminfo=yes
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# If there is no terminfo, use termcap
|
||||
if test -z "$use_terminfo"; then
|
||||
MC_USE_TERMCAP
|
||||
AC_MSG_ERROR([S-Lang library not found])
|
||||
fi
|
||||
|
||||
_MC_WITH_XSLANG
|
||||
|
29
configure.ac
29
configure.ac
@ -182,12 +182,6 @@ AC_CHECK_FUNCS([\
|
||||
tcgetattr tcsetattr truncate \
|
||||
])
|
||||
|
||||
dnl S-Lang needs all four functions to be defined to use POSIX signal API
|
||||
AC_CHECK_FUNCS([sigaction sigemptyset sigprocmask sigaddset], , [slang_signals=no])
|
||||
if test x$slang_signals != xno; then
|
||||
AC_DEFINE(SLANG_POSIX_SIGNALS, 1, [Define to use POSIX signal API in S-Lang])
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl getpt is a GNU Extension (glibc 2.1.x)
|
||||
dnl
|
||||
@ -452,19 +446,16 @@ subshell="$result"
|
||||
|
||||
|
||||
dnl
|
||||
dnl Select the screen library. mcslang is the included S-Lang library.
|
||||
dnl Select the screen library.
|
||||
dnl
|
||||
AC_ARG_WITH(screen,
|
||||
[ --with-screen=LIB Compile with screen library: slang, mcslang or
|
||||
ncurses [[slang if found, else mcslang]]])
|
||||
[ --with-screen=LIB Compile with screen library: slang or
|
||||
ncurses [[slang if found]]])
|
||||
|
||||
case x$with_screen in
|
||||
xslang)
|
||||
MC_WITH_SLANG(strict)
|
||||
;;
|
||||
xmcslang)
|
||||
MC_WITH_MCSLANG
|
||||
;;
|
||||
xncurses)
|
||||
MC_WITH_NCURSES
|
||||
;;
|
||||
@ -477,18 +468,6 @@ x)
|
||||
esac
|
||||
|
||||
|
||||
dnl
|
||||
dnl Force using termcap. This option is processed in MC_WITH_MCSLANG.
|
||||
dnl Report an error if this option is not applicable.
|
||||
dnl
|
||||
AC_ARG_WITH(termcap,
|
||||
[ --with-termcap Try using termcap database [[only if no terminfo]]],
|
||||
[if test x$with_screen != xmcslang; then
|
||||
AC_MSG_ERROR([Option `--with-termcap' only works with `--with-screen=mcslang'])
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
dnl
|
||||
dnl Internal editor support.
|
||||
dnl
|
||||
@ -572,7 +551,6 @@ AM_CONDITIONAL(USE_VFS_NET, [test x"$use_net_code" = xtrue])
|
||||
AM_CONDITIONAL(USE_UNDEL_FS, [test -n "$use_undelfs"])
|
||||
AM_CONDITIONAL(USE_SAMBA_FS, [test -n "$use_smbfs"])
|
||||
AM_CONDITIONAL(USE_MCFS, [test -n "$use_mcfs"])
|
||||
AM_CONDITIONAL(INCLUDED_SLANG, [test "x$with_screen" = xmcslang])
|
||||
AM_CONDITIONAL(CHARSET, [test -n "$have_charset"])
|
||||
AM_CONDITIONAL(CONS_SAVER, [test -n "$cons_saver"])
|
||||
|
||||
@ -587,7 +565,6 @@ vfs/Makefile
|
||||
vfs/extfs/Makefile
|
||||
lib/Makefile
|
||||
src/Makefile
|
||||
slang/Makefile
|
||||
edit/Makefile
|
||||
syntax/Makefile
|
||||
m4/Makefile
|
||||
|
@ -49,7 +49,7 @@ mc_cflags=""
|
||||
mc_ldflags=""
|
||||
|
||||
mc_tests="plain glib12 charset no_charset vfs no_vfs mcfs no_mcfs samba "\
|
||||
"no_samba ext2undel no_ext2undel slang mcslang ncurses maintainer "\
|
||||
"no_samba ext2undel no_ext2undel slang ncurses maintainer "\
|
||||
"no_maintainer i18n no_i18n no_features all_features"
|
||||
|
||||
do_clean_basedir=no
|
||||
@ -443,12 +443,6 @@ test_slang() {
|
||||
confbuild
|
||||
}
|
||||
|
||||
test_mcslang() {
|
||||
testname="mcslang"
|
||||
configure_args="--with-screen=mcslang"
|
||||
confbuild
|
||||
}
|
||||
|
||||
test_ncurses() {
|
||||
testname="ncurses"
|
||||
configure_args="--with-screen=ncurses"
|
||||
|
@ -48,7 +48,7 @@
|
||||
|
||||
# The list of tests that will be run.
|
||||
#mc_tests="plain glib12 charset no_charset vfs no_vfs mcfs no_mcfs samba "\
|
||||
#"no_samba ext2undel no_ext2undel slang mcslang ncurses maintainer "\
|
||||
#"no_samba ext2undel no_ext2undel slang ncurses maintainer "\
|
||||
#"no_maintainer i18n no_i18n no_features all_features"
|
||||
|
||||
# This cleans mc_basedir and all its subdirectories. Any directories outside
|
||||
|
@ -78,7 +78,7 @@ mkdir "$RPM_SRC_DIR/RPMS"
|
||||
mkdir "$RPM_SRC_DIR/RPMS/i386"
|
||||
mkdir "$RPM_SRC_DIR/SPECS"
|
||||
$RPMBUILD -tb --define="_topdir $RPM_SRC_DIR" \
|
||||
--define="_with_included_slang 1" "$MCTARBALL"
|
||||
"$MCTARBALL"
|
||||
MC_RPM_VERSION=`echo $MCVERSION | sed s/-//g`
|
||||
MC_RPM=$RPM_SRC_DIR/RPMS/i386/mc-$MC_RPM_VERSION-1.i386.rpm
|
||||
if test ! -f $MC_RPM; then
|
||||
|
@ -40,7 +40,7 @@ echo "Checking the default configuration"
|
||||
distcheck 1
|
||||
|
||||
echo "Checking the configuration with maximal code coverage"
|
||||
distcheck 2 with_screen=mcslang enable_charset=yes with_samba=yes \
|
||||
distcheck 2 enable_charset=yes with_samba=yes \
|
||||
with_mcfs=yes with_included_gettext=yes with_glib12=yes
|
||||
|
||||
echo "Checking the configuration with minimal code coverage"
|
||||
@ -54,7 +54,7 @@ distcheck 4 enable_largefile=no enable_nls=no with_vfs=no \
|
||||
with_screen=ncurses
|
||||
|
||||
echo "Checking the configuration with experimental and rarely used options"
|
||||
distcheck 5 with_screen=mcslang with_termcap=yes \
|
||||
distcheck 5 with_termcap=yes \
|
||||
with_mmap=no with_subshell=optional enable_netcode=no
|
||||
|
||||
RPMBUILD=/usr/bin/rpmbuild
|
||||
|
@ -1,7 +1,6 @@
|
||||
# Conditional build (replace "#" with "%" to enable):
|
||||
#
|
||||
#define _with_ncurses 1 # use ncurses
|
||||
#define _with_included_slang 1 # use included S-Lang library
|
||||
#define _with_charset 1 # enable code for charset conversion
|
||||
#define _with_samba 1 # enable SMB/CIFS virtual file system
|
||||
#define _with_ext2undel 1 # compile with ext2 undelete code
|
||||
@ -26,7 +25,7 @@ BuildRoot: /var/tmp/mc-%{PACKAGE_VERSION}-root
|
||||
|
||||
# Names of those packages are distribution specific
|
||||
#BuildRequires: glib-devel
|
||||
#%{!?_with_included_slang:%{!?_with_ncurses:BuildRequires: slang-devel}}
|
||||
#%{!?_with_ncurses:BuildRequires: slang-devel}
|
||||
#%{?_with_ncurses:BuildRequires: ncurses-devel}
|
||||
|
||||
%description
|
||||
@ -46,7 +45,6 @@ CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="-s" ./configure \
|
||||
--prefix=%{_prefix} \
|
||||
--mandir=%{_mandir} \
|
||||
%{?_with_ncurses: --with-screen=ncurses} \
|
||||
%{?_with_included_slang: --with-screen=mcslang} \
|
||||
%{?_with_charset: --enable-charset} \
|
||||
%{?_with_samba: --with-samba} \
|
||||
%{?_with_ext2undel: --with-ext2undel} \
|
||||
|
4
slang/.gitignore
vendored
4
slang/.gitignore
vendored
@ -1,4 +0,0 @@
|
||||
.deps
|
||||
Makefile
|
||||
Makefile.in
|
||||
slang.h
|
287
slang/ChangeLog
287
slang/ChangeLog
@ -1,287 +0,0 @@
|
||||
2006-02-20 Pavel Tsekov <ptsekov@gmx.net>
|
||||
|
||||
* slmisc.c: Import SLmake_string() and SLmake_nstring().
|
||||
|
||||
2006-02-15 Leonard den Ottolander <leonard den ottolander nl>
|
||||
|
||||
* slcommon.c: Patch to slang-2.0.6 leaving local patches intact.
|
||||
* sldisply.c: Likewise.
|
||||
* slerr.c: Likewise.
|
||||
* slgetkey.c: Likewise.
|
||||
* slmisc.c: Likewise.
|
||||
* slsignal.c: Likewise.
|
||||
* slsmg.c: Likewise.
|
||||
* slstring.c: Likewise.
|
||||
* sltermin.c: Likewise.
|
||||
* slutty.c: Likewise.
|
||||
* include/_slang.h: Likewise.
|
||||
* include/slang.h: Likewise.
|
||||
|
||||
2006-02-01 Vladimir Nadvorknik <nadvornik@suse.cz>
|
||||
|
||||
* slcommon.c (utf8_enable_function): Use '==' instead of '=' for
|
||||
comparison. Reported by David Binderman.
|
||||
|
||||
2006-01-18 Pavel Shirshov <me@pavelsh.pp.ru>
|
||||
|
||||
* include/slang.h: comment out declaration of SLmemset(), SLmemchr(),
|
||||
SLmemcpy(), SLmemcmp(), SLmalloc(), SLfree(), SLrealloc().
|
||||
* slcommon.c: comment out definitions of SLmalloc(), SLfree(),
|
||||
SLrealloc().
|
||||
* include/jdmacros.h: Fully rewritten to use glib rather than S-Lang
|
||||
replacements.
|
||||
* slmisc.c: Remove SLang_Version variable.
|
||||
|
||||
2006-01-14 Pavel Shirshov <me@pavelsh.pp.ru>
|
||||
|
||||
* sldisply.c (SLtt_initialize): Fix typo. Change Is_Bg_BGR
|
||||
to Is_Fg_BGR. (SLtt_goto_rc): Disable cursor movement optimizations
|
||||
for qansi-m consoles. Needed on QNX Neutrino. (SLtt_initialize): Init
|
||||
QANSI_Console variable. (SLtt_erase_line): Use tt_write() instead
|
||||
tt_write_string(). (SLtt_cls): Use tt_write() instead tt_write_string().
|
||||
(SLtt_tgetstr): Fix warning.
|
||||
* slmisc.c: Trimmed down for use in GNU Midnight Commander.
|
||||
* sltermin.c (_pSLtt_tigetent): Avoid strncpy, home_ti is 1K long and
|
||||
obody really needs it whole cleared. Fix possible off-by-one error.
|
||||
* include/slang.h: Define __unix__ if __MACH__, __NetBSD__, _AIX is
|
||||
defined.
|
||||
|
||||
2005-11-28 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* slvideo.c: Remove, it's only used by the obsolete PC port.
|
||||
* slw32tty.c: Likewise.
|
||||
* Makefile.am: Adjust for the above.
|
||||
|
||||
2005-11-17 Leonard den Ottolander <leonard den ottolander nl>
|
||||
|
||||
* Makefile.am: Reinstate ChangeLog.
|
||||
|
||||
2005-11-16 Roland Illig <roland.illig@gmx.de>
|
||||
|
||||
* slcommon.c (_pSLsecure_issetugid): Made the #ifdef more
|
||||
readable.
|
||||
|
||||
2005-11-15 Leonard den Ottolander <leonard den ottolander nl>
|
||||
|
||||
* slcommon.c (_pSLsecure_issetugid): Remove dependency on glibc
|
||||
private integer __libc_enable_secure.
|
||||
|
||||
2005-11-10 Leonard den Ottolander <leonard den ottolander nl>
|
||||
|
||||
* *: Upgrade slang to 2.0.5.
|
||||
|
||||
2005-07-30 Roland Illig <roland.illig@gmx.de>
|
||||
|
||||
* include/slang.h: Define __unix__ if __MACH__ is defined.
|
||||
|
||||
2005-03-19 Pavel S. Shirshov <me@pavelsh.pp.ru>
|
||||
|
||||
* sldisply.c (SLtt_initialize): Fix typo. Change Is_Bg_BGR,
|
||||
not Is_Fg_BGR.
|
||||
|
||||
2005-02-10 Roland Illig <roland.illig@gmx.de>
|
||||
|
||||
* include/slang.h: Define __unix__ if __NetBSD__ is defined.
|
||||
|
||||
2004-11-29 Pavel S. Shirshov <me@pavelsh.pp.ru>
|
||||
|
||||
* Makefile.am: Use AM_CPPFLAGS for path to mc-slang includes.
|
||||
* slmisc.c (SLang_Version): Declare const. Use SLANG_VERSION for version
|
||||
number.
|
||||
* include/slang.h (SLang_Version): Declare const.
|
||||
|
||||
2004-11-09 Andrew V. Samoilov <sav@bcs.zp.ua>
|
||||
|
||||
* sldisply.c (SLtt_delete_nlines): Add boundary check.
|
||||
(forward_cursor): Remove unneeded boundary check.
|
||||
(tt_write): Remove unneeded cast.
|
||||
|
||||
2004-11-09 Pavel S. Shirshov <me@pavelsh.pp.ru>
|
||||
|
||||
* include/slang.h (SLang_Version): Delete const qualifier for
|
||||
compatibility with system slang library.
|
||||
* slmisc.c: Likewise.
|
||||
|
||||
* sldisply.c (tt_sprintf): Import last changes from libslang-current.
|
||||
Add code to check for a buffer overflow.
|
||||
(tt_printf): Likewise.
|
||||
(forward_cursor): Likewise.
|
||||
|
||||
From: John E. Davis <davis@space.mit.edu>
|
||||
|
||||
2004-11-08 Andrew V. Samoilov <sav@bcs.zp.ua>
|
||||
|
||||
* include/slang.h (SLang_Version): Declare const.
|
||||
* slmisc.c: Add SLang_Version.
|
||||
|
||||
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.
|
||||
Needed on AIX.
|
||||
|
||||
2004-10-14 Andrew V. Samoilov <sav@bcs.zp.ua>
|
||||
|
||||
* sldisply.c (tt_sprintf): Add missed break.
|
||||
* sldisply.c (SLtt_erase_line): Use tt_write() instead
|
||||
tt_write_string().
|
||||
|
||||
2004-09-26 Mike Gorchak <mike@malva.ua>
|
||||
|
||||
* sldisplay.c (SLtt_goto_rc): Disable cursor movement optimizations
|
||||
for qansi-m consoles. Needed on QNX Neutrino.
|
||||
(SLtt_initialize): Init QANSI_Console variable.
|
||||
|
||||
2004-09-24 Roland Illig <roland.illig@gmx.de>
|
||||
|
||||
* slsignal.c (SLsystem): Replaced NULL with (char *) NULL in
|
||||
call to execl.
|
||||
|
||||
From patches from the OpenBSD ports collection.
|
||||
|
||||
2004-09-04 Pavel S. Shirshov <me@pavelsh.pp.ru>
|
||||
|
||||
* sltermin.c (_SLtt_tigetent): Avoid strncpy, home_ti is 1K long and
|
||||
nobody really needs it whole cleared
|
||||
|
||||
2004-08-31 Pavel S. Shirshov <me@pavelsh.pp.ru>
|
||||
|
||||
* include/slang.h: Revert last changes - it breaks compiling
|
||||
* sldisply.c: Likewise.
|
||||
* slerr.c: Likewise.
|
||||
* slsmg.c: Likewise.
|
||||
* sltermin.c: Likewise.
|
||||
|
||||
2004-08-29 Roland Illig <roland.illig@gmx.de>
|
||||
|
||||
* slang.h: Added const qualifier to some of the SLang functions.
|
||||
|
||||
2003-09-26 Andrew V. Samoilov <sav@bcs.zp.ua>
|
||||
|
||||
* sldisply.c (RGB_to_BGR): Make const.
|
||||
* slsignal.c (SLsystem): Commented out.
|
||||
|
||||
2003-09-11 Andrew V. Samoilov <sav@bcs.zp.ua>
|
||||
|
||||
* slerr.c (SLang_doerror): Fix possible off-by-one error.
|
||||
* sltermin.c (_SLtt_tigetent): Likewise.
|
||||
|
||||
2002-11-28 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* sldisply.c: Fix for the previous patch. Only swap colors if
|
||||
setf and setb are not empty.
|
||||
Reported by Andras Barthazi <andras@barthazi.hu>
|
||||
|
||||
2002-10-25 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* sldisply.c: Patch to swap blue and red colors for setf/setb
|
||||
capabilities. Needed on QNX Neutrino.
|
||||
Reported by Pavel Shirshov <me@pavelsh.pp.ru>
|
||||
|
||||
2002-10-07 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* include/jdmacros.h: Define SLMEMSET and SLMEMCPY
|
||||
unconditionally, use macros with arguments.
|
||||
* include/_slang.h: Make it clear which parts are disabled
|
||||
for compatibility with glib.
|
||||
* include/slinclud.h: Include malloc.h only if STDC_HEADERS is
|
||||
not defined.
|
||||
|
||||
2002-10-07 Andrew V. Samoilov <sav@bcs.zp.ua>
|
||||
|
||||
* sldisply.c (Color_Def_Type): Make const.
|
||||
* slsmg.c (Fake_Alt_Char_Pairs): Likewise.
|
||||
* sltermin.c (Tgetstr_Map_Type): Likewise.
|
||||
* slutty.c (Baud_Rate_Type): Likewise.
|
||||
|
||||
2002-10-07 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
Update to S-Lang 1.4.5. Move include files to "include"
|
||||
directory to avoid the need to rename slang.h.
|
||||
* Makefile.am: Adjust file list. Add "-Iinclude" to the
|
||||
compiler flags.
|
||||
* include/jdmacros.h: Rewrite to use glib.
|
||||
* slmisc.c: Trim to include only needed functions.
|
||||
|
||||
2002-09-18 Andrew V. Samoilov <sav@bcs.zp.ua>
|
||||
|
||||
* slerr.c (SLang_doerror): Use error parameter. Eliminate
|
||||
err[] array.
|
||||
|
||||
2002-08-21 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* slsmg.c (Fake_Alt_Char_Pairs): Update from slang-1.4.5. This
|
||||
fixes the MC logo in the help screen.
|
||||
|
||||
2002-01-21 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* slvideo.c: Include _slang.h, not slang.h.
|
||||
|
||||
* slos2tty.c: Remove since OS/2 is no longer supported.
|
||||
* Makefile.am (EXTRASRC): Remove slos2tty.c.
|
||||
|
||||
2001-12-21 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* _slang.h: Include slang-mc.h.
|
||||
* slang-mc.h: Add protection against using with system installed
|
||||
S-Lang library.
|
||||
* sl*.c: Only include _slang.h, but not slang.h to avoid making
|
||||
symlinks.
|
||||
|
||||
2001-09-04 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* Makefile.am (AM_CFLAGS): Remove CFLAGS, don't use substituted
|
||||
values directly.
|
||||
|
||||
2001-08-26 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* Makefile.am: Don't install libmcslang.a.
|
||||
|
||||
* Makefile.am (AM_CPPFLAGS): Remove, it's not needed.
|
||||
|
||||
2001-08-25 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* Makefile.in: Converted to ...
|
||||
* Makefile.am: ... this.
|
||||
|
||||
2001-02-22 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* _slang.h: Include glib.h.
|
||||
|
||||
Tue Apr 13 07:07:36 1999 Norbert Warmuth <nwarmuth@privat.circular.de>
|
||||
|
||||
* slutty.c (SLsys_getkey): handle EOF on stdin (return
|
||||
SLANG_GETKEY_ERROR on EOF instead of returning garbage)
|
||||
|
||||
* Makefile.in (clean): remove the symbolic link slang.h on the
|
||||
distclean target and not on the clean target.
|
||||
|
||||
Sun Feb 14 01:05:42 1999 Norbert Warmuth <nwarmuth@privat.circular.de>
|
||||
|
||||
* sldisply.c (SLtt_get_terminfo): use g_snprintf instead of
|
||||
sprintf
|
||||
|
||||
* slsmg.c (SLsmg_printf): ditto
|
||||
|
||||
* sltermin.c (SLtt_tigetent): ditto
|
||||
|
||||
|
@ -1,38 +0,0 @@
|
||||
AM_CFLAGS = $(GLIB_CFLAGS)
|
||||
AM_CPPFLAGS = -I$(srcdir)/include
|
||||
|
||||
if INCLUDED_SLANG
|
||||
noinst_LIBRARIES = libmcslang.a
|
||||
else
|
||||
noinst_LIBRARIES =
|
||||
endif
|
||||
|
||||
SLANG_INCLUDES = \
|
||||
include/_slang.h \
|
||||
include/jdmacros.h \
|
||||
include/sl-feat.h \
|
||||
include/slang.h \
|
||||
include/slinclud.h \
|
||||
include/sllimits.h \
|
||||
include/sllower.h \
|
||||
include/slupper.h \
|
||||
include/slwcwidth.h
|
||||
|
||||
libmcslang_a_SOURCES = \
|
||||
slcommon.c \
|
||||
sldisply.c \
|
||||
slerr.c \
|
||||
slgetkey.c \
|
||||
sllower.c \
|
||||
slmisc.c \
|
||||
slsignal.c \
|
||||
slsmg.c \
|
||||
slstring.c \
|
||||
sltermin.c \
|
||||
slupper.c \
|
||||
slutf8.c \
|
||||
slutty.c \
|
||||
slwcwidth.c \
|
||||
$(SLANG_INCLUDES)
|
||||
|
||||
EXTRA_DIST = ChangeLog README
|
11
slang/README
11
slang/README
@ -1,11 +0,0 @@
|
||||
This is the S-Lang library, version 2.0.5. 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:
|
||||
|
||||
http://www.s-lang.org/
|
||||
|
||||
The sources in this directory are only used if you don't have the S-Lang
|
||||
library installed on your system or if you request to use these sources
|
||||
by specifying the option `--with-screen=mcslang' to the `configure'
|
||||
script.
|
File diff suppressed because it is too large
Load Diff
@ -1,15 +0,0 @@
|
||||
/* Fully rewritten to use glib rather than S-Lang replacements */
|
||||
|
||||
#ifndef _JD_MACROS_H_
|
||||
#define _JD_MACROS_H_
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#define SLMEMSET(x,y,z) memset(x,y,z)
|
||||
#define SLMEMCPY(x,y,z) memcpy(x,y,z)
|
||||
#define SLfree(x) g_free(x)
|
||||
#define SLmalloc(x) g_malloc(x)
|
||||
#define SLrealloc(x,y) g_realloc(x,y)
|
||||
#define SLvsnprintf g_vsnprintf
|
||||
|
||||
#endif /* _JD_MACROS_H_ */
|
@ -1,74 +0,0 @@
|
||||
/* Setting this to one permits strings with embedded color changing commands.
|
||||
* This is experimental.
|
||||
*/
|
||||
#define SLSMG_HAS_EMBEDDED_ESCAPE 1
|
||||
|
||||
/* Setting this to 1 enables automatic support for associative arrays.
|
||||
* If this is set to 0, an application must explicitly enable associative
|
||||
* array support via SLang_init_slassoc.
|
||||
*/
|
||||
#define SLANG_HAS_ASSOC_ARRAYS 1
|
||||
|
||||
#define SLANG_HAS_COMPLEX 1
|
||||
#define SLANG_HAS_FLOAT 1
|
||||
|
||||
/* This is the old space-speed trade off. To reduce memory usage and code
|
||||
* size, set this to zero.
|
||||
*/
|
||||
/* #define SLANG_OPTIMIZE_FOR_SPEED 0 */
|
||||
#define SLANG_OPTIMIZE_FOR_SPEED 2
|
||||
|
||||
#define SLANG_USE_INLINE_CODE 1
|
||||
|
||||
/* Add extra information for tracking down errors. */
|
||||
#define SLANG_HAS_DEBUG_CODE 1
|
||||
|
||||
/* Experimental: Support for examining call frames */
|
||||
#define SLANG_HAS_DEBUGGER_SUPPORT 1
|
||||
|
||||
/* Allow optimizations based upon the __tmp operator. */
|
||||
#define SLANG_USE_TMP_OPTIMIZATION 1
|
||||
|
||||
/* Setting this to one will map 8 bit vtxxx terminals to 7 bit. Terminals
|
||||
* such as the vt320 can be set up to output the two-character escape sequence
|
||||
* encoded as 'ESC [' as single character. Setting this variable to 1 will
|
||||
* insert code to map such characters to the 7 bit equivalent.
|
||||
* This affects just input characters in the range 128-160 on non PC
|
||||
* systems.
|
||||
*/
|
||||
#if defined(VMS) || defined(AMIGA)
|
||||
# define SLANG_MAP_VTXXX_8BIT 1
|
||||
#else
|
||||
# define SLANG_MAP_VTXXX_8BIT 0
|
||||
#endif
|
||||
|
||||
/* Add support for color terminals that cannot do background color erases
|
||||
* Such terminals are poorly designed and are slowly disappearing but they
|
||||
* are still quite common. For example, screen is one of them!
|
||||
*
|
||||
* This is experimental. In particular, it is not known to work if
|
||||
* KANJI suupport is enabled.
|
||||
*/
|
||||
#if !defined(IBMPC_SYSTEM)
|
||||
# define SLTT_HAS_NON_BCE_SUPPORT 1
|
||||
#else
|
||||
# define SLTT_HAS_NON_BCE_SUPPORT 0
|
||||
#endif
|
||||
|
||||
/* If you want slang to assume that an xterm always has the background color
|
||||
* erase feature, then set this to 1. Otherwise, it will check the terminfo
|
||||
* database. This may or may not be a good idea since most good color xterms
|
||||
* support bce but many terminfo systems do not support it.
|
||||
*/
|
||||
#define SLTT_XTERM_ALWAYS_BCE 0
|
||||
|
||||
/* Set this to 1 to enable Kanji support. See above comment. */
|
||||
#define SLANG_HAS_KANJI_SUPPORT 0
|
||||
|
||||
#define SLANG_HAS_SIGNALS 1
|
||||
|
||||
/* Enable this if you want beginning-of-statement and end-of-statement
|
||||
* callbacks. This allows the creation of profilers, stack-checkers, etc.
|
||||
* SLANG_HAS_DEBUG_CODE must be enabled for this to work.
|
||||
*/
|
||||
#define SLANG_HAS_BOSEOS SLANG_HAS_DEBUG_CODE
|
@ -1,31 +0,0 @@
|
||||
#ifndef _SLANG_INCLUDE_H_
|
||||
#define _SLANG_INCLUDE_H_
|
||||
|
||||
#define SLANG_SOURCE_ 1
|
||||
#include "config.h"
|
||||
#include "sl-feat.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(__QNX__) && defined(__WATCOMC__)
|
||||
# include <unix.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MALLOC_H
|
||||
# include <malloc.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MEMORY_H
|
||||
# include <memory.h>
|
||||
#endif
|
||||
|
||||
#endif /* _SLANG_INCLUDE_H_ */
|
@ -1,96 +0,0 @@
|
||||
/* sllimits.h */
|
||||
/*
|
||||
Copyright (C) 2004, 2005 John E. Davis
|
||||
|
||||
This file is part of the S-Lang Library.
|
||||
|
||||
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
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The S-Lang Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA.
|
||||
*/
|
||||
|
||||
#define USE_NEW_HASH_CODE 1
|
||||
|
||||
#define SLSTRING_HASH_TABLE_SIZE 10007
|
||||
#if 0
|
||||
/* slstring.c: Size of the hash table used for strings (prime numbers) */
|
||||
#ifdef __MSDOS_16BIT__
|
||||
# define SLSTRING_HASH_TABLE_SIZE 601
|
||||
#else
|
||||
# define SLSTRING_HASH_TABLE_SIZE 6007 /* 2909 */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* slang.c: maximum size of run time stack */
|
||||
#ifdef __MSDOS_16BIT__
|
||||
# define SLANG_MAX_STACK_LEN 500
|
||||
#else
|
||||
# define SLANG_MAX_STACK_LEN 2500
|
||||
#endif
|
||||
|
||||
/* slang.c: This sets the size on the depth of function calls */
|
||||
#ifdef __MSDOS_16BIT__
|
||||
# define SLANG_MAX_RECURSIVE_DEPTH 50
|
||||
#else
|
||||
# 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 4096
|
||||
#endif
|
||||
|
||||
/* slang.c: The size of the hash table used for local and global objects.
|
||||
* These should be prime numbers.
|
||||
*/
|
||||
#if USE_NEW_HASH_CODE
|
||||
# define SLGLOBALS_HASH_TABLE_SIZE 2048
|
||||
# define SLLOCALS_HASH_TABLE_SIZE 64
|
||||
# define SLSTATIC_HASH_TABLE_SIZE 64
|
||||
#else
|
||||
# define SLGLOBALS_HASH_TABLE_SIZE 2909
|
||||
# define SLLOCALS_HASH_TABLE_SIZE 73
|
||||
# define SLSTATIC_HASH_TABLE_SIZE 73
|
||||
#endif
|
||||
|
||||
/* Size of the keyboard buffer use by the ungetkey routines */
|
||||
#ifdef __MSDOS_16BIT__
|
||||
# define SL_MAX_INPUT_BUFFER_LEN 40
|
||||
#else
|
||||
# define SL_MAX_INPUT_BUFFER_LEN 1024
|
||||
#endif
|
||||
|
||||
/* Maximum number of nested switch statements */
|
||||
#define SLANG_MAX_NESTED_SWITCH 10
|
||||
|
||||
/* Size of the block stack (used in byte-compiling) */
|
||||
#define SLANG_MAX_BLOCK_STACK_LEN 50
|
||||
|
||||
/* slfile.c: Max number of open file pointers */
|
||||
#ifdef __MSDOS_16BIT__
|
||||
# define SL_MAX_FILES 32
|
||||
#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
|
||||
|
@ -1,460 +0,0 @@
|
||||
/* This file was automatically created by ./mktables */
|
||||
#define SL_TOLOWER_MAX_CHAR 0x10480ul
|
||||
|
||||
#define SL_TOLOWER_LOOKUP(x) \
|
||||
(((unsigned)(x)>=SL_TOLOWER_MAX_CHAR)?0:(_pSLwc_Tolower_Table[(unsigned)(x)>>7][(unsigned)(x)&0x7F]))
|
||||
|
||||
extern const short *_pSLwc_Tolower_Table[521];
|
||||
|
||||
#ifdef DEFINE_PSLWC_TOLOWER_TABLE
|
||||
static const short Table_00[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x08-0x0F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x10-0x17*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x18-0x1F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x20-0x27*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x28-0x2F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x30-0x37*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x38-0x3F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x40-0x47*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x48-0x4F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x50-0x57*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x58-0x5F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x60-0x67*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x68-0x6F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x70-0x77*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x78-0x7F*/ 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static const short Table_01[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x08-0x0F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x10-0x17*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x18-0x1F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x20-0x27*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x28-0x2F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x30-0x37*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x38-0x3F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x40-0x47*/ 0, 32, 32, 32, 32, 32, 32, 32,
|
||||
/*0x48-0x4F*/ 32, 32, 32, 32, 32, 32, 32, 32,
|
||||
/*0x50-0x57*/ 32, 32, 32, 32, 32, 32, 32, 32,
|
||||
/*0x58-0x5F*/ 32, 32, 32, 0, 0, 0, 0, 0,
|
||||
/*0x60-0x67*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x68-0x6F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x70-0x77*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x78-0x7F*/ 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static const short Table_02[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x08-0x0F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x10-0x17*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x18-0x1F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x20-0x27*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x28-0x2F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x30-0x37*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x38-0x3F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x40-0x47*/ 32, 32, 32, 32, 32, 32, 32, 32,
|
||||
/*0x48-0x4F*/ 32, 32, 32, 32, 32, 32, 32, 32,
|
||||
/*0x50-0x57*/ 32, 32, 32, 32, 32, 32, 32, 0,
|
||||
/*0x58-0x5F*/ 32, 32, 32, 32, 32, 32, 32, 0,
|
||||
/*0x60-0x67*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x68-0x6F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x70-0x77*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x78-0x7F*/ 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static const short Table_03[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x08-0x0F*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x10-0x17*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x18-0x1F*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x20-0x27*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x28-0x2F*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x30-0x37*/ -199, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x38-0x3F*/ 0, 1, 0, 1, 0, 1, 0, 1,
|
||||
/*0x40-0x47*/ 0, 1, 0, 1, 0, 1, 0, 1,
|
||||
/*0x48-0x4F*/ 0, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x50-0x57*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x58-0x5F*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x60-0x67*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x68-0x6F*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x70-0x77*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x78-0x7F*/ -121, 1, 0, 1, 0, 1, 0, 0
|
||||
};
|
||||
|
||||
static const short Table_04[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 0, 210, 1, 0, 1, 0, 206, 1,
|
||||
/*0x08-0x0F*/ 0, 205, 205, 1, 0, 0, 79, 202,
|
||||
/*0x10-0x17*/ 203, 1, 0, 205, 207, 0, 211, 209,
|
||||
/*0x18-0x1F*/ 1, 0, 0, 0, 211, 213, 0, 214,
|
||||
/*0x20-0x27*/ 1, 0, 1, 0, 1, 0, 218, 1,
|
||||
/*0x28-0x2F*/ 0, 218, 0, 0, 1, 0, 218, 1,
|
||||
/*0x30-0x37*/ 0, 217, 217, 1, 0, 1, 0, 219,
|
||||
/*0x38-0x3F*/ 1, 0, 0, 0, 1, 0, 0, 0,
|
||||
/*0x40-0x47*/ 0, 0, 0, 0, 2, 1, 0, 2,
|
||||
/*0x48-0x4F*/ 1, 0, 2, 1, 0, 1, 0, 1,
|
||||
/*0x50-0x57*/ 0, 1, 0, 1, 0, 1, 0, 1,
|
||||
/*0x58-0x5F*/ 0, 1, 0, 1, 0, 0, 1, 0,
|
||||
/*0x60-0x67*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x68-0x6F*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x70-0x77*/ 0, 2, 1, 0, 1, 0, -97, -56,
|
||||
/*0x78-0x7F*/ 1, 0, 1, 0, 1, 0, 1, 0
|
||||
};
|
||||
|
||||
static const short Table_05[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x08-0x0F*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x10-0x17*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x18-0x1F*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x20-0x27*/ -130, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x28-0x2F*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x30-0x37*/ 1, 0, 1, 0, 0, 0, 0, 0,
|
||||
/*0x38-0x3F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x40-0x47*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x48-0x4F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x50-0x57*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x58-0x5F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x60-0x67*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x68-0x6F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x70-0x77*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x78-0x7F*/ 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static const short Table_06[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 0, 0, 0, 0, 0, 0, 38, 0,
|
||||
/*0x08-0x0F*/ 37, 37, 37, 0, 64, 0, 63, 63,
|
||||
/*0x10-0x17*/ 0, 32, 32, 32, 32, 32, 32, 32,
|
||||
/*0x18-0x1F*/ 32, 32, 32, 32, 32, 32, 32, 32,
|
||||
/*0x20-0x27*/ 32, 32, 0, 32, 32, 32, 32, 32,
|
||||
/*0x28-0x2F*/ 32, 32, 32, 32, 0, 0, 0, 0,
|
||||
/*0x30-0x37*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x38-0x3F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x40-0x47*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x48-0x4F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x50-0x57*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x58-0x5F*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x60-0x67*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x68-0x6F*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x70-0x77*/ 0, 0, 0, 0, -60, 0, 0, 0,
|
||||
/*0x78-0x7F*/ 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static const short Table_07[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 80, 80, 80, 80, 80, 80, 80, 80,
|
||||
/*0x08-0x0F*/ 80, 80, 80, 80, 80, 80, 80, 80,
|
||||
/*0x10-0x17*/ 32, 32, 32, 32, 32, 32, 32, 32,
|
||||
/*0x18-0x1F*/ 32, 32, 32, 32, 32, 32, 32, 32,
|
||||
/*0x20-0x27*/ 32, 32, 32, 32, 32, 32, 32, 32,
|
||||
/*0x28-0x2F*/ 32, 32, 32, 32, 32, 32, 32, 32,
|
||||
/*0x30-0x37*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x38-0x3F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x40-0x47*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x48-0x4F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x50-0x57*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x58-0x5F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x60-0x67*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x68-0x6F*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x70-0x77*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x78-0x7F*/ 1, 0, 1, 0, 1, 0, 1, 0
|
||||
};
|
||||
|
||||
static const short Table_08[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 1, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x08-0x0F*/ 0, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x10-0x17*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x18-0x1F*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x20-0x27*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x28-0x2F*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x30-0x37*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x38-0x3F*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x40-0x47*/ 0, 1, 0, 1, 0, 1, 0, 1,
|
||||
/*0x48-0x4F*/ 0, 1, 0, 1, 0, 1, 0, 0,
|
||||
/*0x50-0x57*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x58-0x5F*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x60-0x67*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x68-0x6F*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x70-0x77*/ 1, 0, 1, 0, 1, 0, 0, 0,
|
||||
/*0x78-0x7F*/ 1, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static const short Table_09[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x08-0x0F*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x10-0x17*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x18-0x1F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x20-0x27*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x28-0x2F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x30-0x37*/ 0, 48, 48, 48, 48, 48, 48, 48,
|
||||
/*0x38-0x3F*/ 48, 48, 48, 48, 48, 48, 48, 48,
|
||||
/*0x40-0x47*/ 48, 48, 48, 48, 48, 48, 48, 48,
|
||||
/*0x48-0x4F*/ 48, 48, 48, 48, 48, 48, 48, 48,
|
||||
/*0x50-0x57*/ 48, 48, 48, 48, 48, 48, 48, 0,
|
||||
/*0x58-0x5F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x60-0x67*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x68-0x6F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x70-0x77*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x78-0x7F*/ 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static const short Table_10[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x08-0x0F*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x10-0x17*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x18-0x1F*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x20-0x27*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x28-0x2F*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x30-0x37*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x38-0x3F*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x40-0x47*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x48-0x4F*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x50-0x57*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x58-0x5F*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x60-0x67*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x68-0x6F*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x70-0x77*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x78-0x7F*/ 1, 0, 1, 0, 1, 0, 1, 0
|
||||
};
|
||||
|
||||
static const short Table_11[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x08-0x0F*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x10-0x17*/ 1, 0, 1, 0, 1, 0, 0, 0,
|
||||
/*0x18-0x1F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x20-0x27*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x28-0x2F*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x30-0x37*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x38-0x3F*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x40-0x47*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x48-0x4F*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x50-0x57*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x58-0x5F*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x60-0x67*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x68-0x6F*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x70-0x77*/ 1, 0, 1, 0, 1, 0, 1, 0,
|
||||
/*0x78-0x7F*/ 1, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static const short Table_12[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x08-0x0F*/ -8, -8, -8, -8, -8, -8, -8, -8,
|
||||
/*0x10-0x17*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x18-0x1F*/ -8, -8, -8, -8, -8, -8, 0, 0,
|
||||
/*0x20-0x27*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x28-0x2F*/ -8, -8, -8, -8, -8, -8, -8, -8,
|
||||
/*0x30-0x37*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x38-0x3F*/ -8, -8, -8, -8, -8, -8, -8, -8,
|
||||
/*0x40-0x47*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x48-0x4F*/ -8, -8, -8, -8, -8, -8, 0, 0,
|
||||
/*0x50-0x57*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x58-0x5F*/ 0, -8, 0, -8, 0, -8, 0, -8,
|
||||
/*0x60-0x67*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x68-0x6F*/ -8, -8, -8, -8, -8, -8, -8, -8,
|
||||
/*0x70-0x77*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x78-0x7F*/ 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static const short Table_13[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x08-0x0F*/ -8, -8, -8, -8, -8, -8, -8, -8,
|
||||
/*0x10-0x17*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x18-0x1F*/ -8, -8, -8, -8, -8, -8, -8, -8,
|
||||
/*0x20-0x27*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x28-0x2F*/ -8, -8, -8, -8, -8, -8, -8, -8,
|
||||
/*0x30-0x37*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x38-0x3F*/ -8, -8, -74, -74, -9, 0, 0, 0,
|
||||
/*0x40-0x47*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x48-0x4F*/ -86, -86, -86, -86, -9, 0, 0, 0,
|
||||
/*0x50-0x57*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x58-0x5F*/ -8, -8, -100, -100, 0, 0, 0, 0,
|
||||
/*0x60-0x67*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x68-0x6F*/ -8, -8, -112, -112, -7, 0, 0, 0,
|
||||
/*0x70-0x77*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x78-0x7F*/ -128, -128, -126, -126, -9, 0, 0, 0
|
||||
};
|
||||
|
||||
static const short Table_14[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x08-0x0F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x10-0x17*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x18-0x1F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x20-0x27*/ 0, 0, 0, 0, 0, 0, -7517, 0,
|
||||
/*0x28-0x2F*/ 0, 0, -8383, -8262, 0, 0, 0, 0,
|
||||
/*0x30-0x37*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x38-0x3F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x40-0x47*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x48-0x4F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x50-0x57*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x58-0x5F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x60-0x67*/ 16, 16, 16, 16, 16, 16, 16, 16,
|
||||
/*0x68-0x6F*/ 16, 16, 16, 16, 16, 16, 16, 16,
|
||||
/*0x70-0x77*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x78-0x7F*/ 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static const short Table_15[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x08-0x0F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x10-0x17*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x18-0x1F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x20-0x27*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x28-0x2F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x30-0x37*/ 0, 0, 0, 0, 0, 0, 26, 26,
|
||||
/*0x38-0x3F*/ 26, 26, 26, 26, 26, 26, 26, 26,
|
||||
/*0x40-0x47*/ 26, 26, 26, 26, 26, 26, 26, 26,
|
||||
/*0x48-0x4F*/ 26, 26, 26, 26, 26, 26, 26, 26,
|
||||
/*0x50-0x57*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x58-0x5F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x60-0x67*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x68-0x6F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x70-0x77*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x78-0x7F*/ 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static const short Table_16[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x08-0x0F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x10-0x17*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x18-0x1F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x20-0x27*/ 0, 32, 32, 32, 32, 32, 32, 32,
|
||||
/*0x28-0x2F*/ 32, 32, 32, 32, 32, 32, 32, 32,
|
||||
/*0x30-0x37*/ 32, 32, 32, 32, 32, 32, 32, 32,
|
||||
/*0x38-0x3F*/ 32, 32, 32, 0, 0, 0, 0, 0,
|
||||
/*0x40-0x47*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x48-0x4F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x50-0x57*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x58-0x5F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x60-0x67*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x68-0x6F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x70-0x77*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x78-0x7F*/ 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static const short Table_17[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 40, 40, 40, 40, 40, 40, 40, 40,
|
||||
/*0x08-0x0F*/ 40, 40, 40, 40, 40, 40, 40, 40,
|
||||
/*0x10-0x17*/ 40, 40, 40, 40, 40, 40, 40, 40,
|
||||
/*0x18-0x1F*/ 40, 40, 40, 40, 40, 40, 40, 40,
|
||||
/*0x20-0x27*/ 40, 40, 40, 40, 40, 40, 0, 0,
|
||||
/*0x28-0x2F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x30-0x37*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x38-0x3F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x40-0x47*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x48-0x4F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x50-0x57*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x58-0x5F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x60-0x67*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x68-0x6F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x70-0x77*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x78-0x7F*/ 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
const short *_pSLwc_Tolower_Table[521] =
|
||||
{
|
||||
Table_01, Table_02, Table_03, Table_04, Table_05, Table_00,
|
||||
Table_00, Table_06, Table_07, Table_08, Table_09, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_10, Table_11, Table_12, Table_13, Table_00, Table_00,
|
||||
Table_14, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_15, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_16, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_17
|
||||
};
|
||||
#endif /* DEFINE_PSLWC_TOLOWER_TABLE */
|
@ -1,520 +0,0 @@
|
||||
/* This file was automatically created by ./mktables */
|
||||
#define SL_TOUPPER_MAX_CHAR 0x10480ul
|
||||
|
||||
#define SL_TOUPPER_LOOKUP(x) \
|
||||
(((unsigned)(x)>=SL_TOUPPER_MAX_CHAR)?0:(_pSLwc_Toupper_Table[(unsigned)(x)>>7][(unsigned)(x)&0x7F]))
|
||||
|
||||
extern const short *_pSLwc_Toupper_Table[521];
|
||||
|
||||
#ifdef DEFINE_PSLWC_TOUPPER_TABLE
|
||||
static const short Table_00[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x08-0x0F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x10-0x17*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x18-0x1F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x20-0x27*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x28-0x2F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x30-0x37*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x38-0x3F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x40-0x47*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x48-0x4F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x50-0x57*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x58-0x5F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x60-0x67*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x68-0x6F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x70-0x77*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x78-0x7F*/ 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static const short Table_01[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x08-0x0F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x10-0x17*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x18-0x1F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x20-0x27*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x28-0x2F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x30-0x37*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x38-0x3F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x40-0x47*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x48-0x4F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x50-0x57*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x58-0x5F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x60-0x67*/ 0, -32, -32, -32, -32, -32, -32, -32,
|
||||
/*0x68-0x6F*/ -32, -32, -32, -32, -32, -32, -32, -32,
|
||||
/*0x70-0x77*/ -32, -32, -32, -32, -32, -32, -32, -32,
|
||||
/*0x78-0x7F*/ -32, -32, -32, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static const short Table_02[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x08-0x0F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x10-0x17*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x18-0x1F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x20-0x27*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x28-0x2F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x30-0x37*/ 0, 0, 0, 0, 0, 743, 0, 0,
|
||||
/*0x38-0x3F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x40-0x47*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x48-0x4F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x50-0x57*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x58-0x5F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x60-0x67*/ -32, -32, -32, -32, -32, -32, -32, -32,
|
||||
/*0x68-0x6F*/ -32, -32, -32, -32, -32, -32, -32, -32,
|
||||
/*0x70-0x77*/ -32, -32, -32, -32, -32, -32, -32, 0,
|
||||
/*0x78-0x7F*/ -32, -32, -32, -32, -32, -32, -32, 121
|
||||
};
|
||||
|
||||
static const short Table_03[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x08-0x0F*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x10-0x17*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x18-0x1F*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x20-0x27*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x28-0x2F*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x30-0x37*/ 0, -232, 0, -1, 0, -1, 0, -1,
|
||||
/*0x38-0x3F*/ 0, 0, -1, 0, -1, 0, -1, 0,
|
||||
/*0x40-0x47*/ -1, 0, -1, 0, -1, 0, -1, 0,
|
||||
/*0x48-0x4F*/ -1, 0, 0, -1, 0, -1, 0, -1,
|
||||
/*0x50-0x57*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x58-0x5F*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x60-0x67*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x68-0x6F*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x70-0x77*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x78-0x7F*/ 0, 0, -1, 0, -1, 0, -1, -300
|
||||
};
|
||||
|
||||
static const short Table_04[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 0, 0, 0, -1, 0, -1, 0, 0,
|
||||
/*0x08-0x0F*/ -1, 0, 0, 0, -1, 0, 0, 0,
|
||||
/*0x10-0x17*/ 0, 0, -1, 0, 0, 97, 0, 0,
|
||||
/*0x18-0x1F*/ 0, -1, 0, 0, 0, 0, 130, 0,
|
||||
/*0x20-0x27*/ 0, -1, 0, -1, 0, -1, 0, 0,
|
||||
/*0x28-0x2F*/ -1, 0, 0, 0, 0, -1, 0, 0,
|
||||
/*0x30-0x37*/ -1, 0, 0, 0, -1, 0, -1, 0,
|
||||
/*0x38-0x3F*/ 0, -1, 0, 0, 0, -1, 0, 56,
|
||||
/*0x40-0x47*/ 0, 0, 0, 0, 0, -1, -2, 0,
|
||||
/*0x48-0x4F*/ -1, -2, 0, -1, -2, 0, -1, 0,
|
||||
/*0x50-0x57*/ -1, 0, -1, 0, -1, 0, -1, 0,
|
||||
/*0x58-0x5F*/ -1, 0, -1, 0, -1, -79, 0, -1,
|
||||
/*0x60-0x67*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x68-0x6F*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x70-0x77*/ 0, 0, -1, -2, 0, -1, 0, 0,
|
||||
/*0x78-0x7F*/ 0, -1, 0, -1, 0, -1, 0, -1
|
||||
};
|
||||
|
||||
static const short Table_05[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x08-0x0F*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x10-0x17*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x18-0x1F*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x20-0x27*/ 0, 0, 0, -1, 0, -1, 0, -1,
|
||||
/*0x28-0x2F*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x30-0x37*/ 0, -1, 0, -1, 0, 0, 0, 0,
|
||||
/*0x38-0x3F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x40-0x47*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x48-0x4F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x50-0x57*/ 0, 0, 0, -210, -206, 0, -205, -205,
|
||||
/*0x58-0x5F*/ 0, -202, 0, -203, 0, 0, 0, 0,
|
||||
/*0x60-0x67*/ -205, 0, 0, -207, 0, 0, 0, 0,
|
||||
/*0x68-0x6F*/ -209, -211, 0, 0, 0, 0, 0, -211,
|
||||
/*0x70-0x77*/ 0, 0, -213, 0, 0, -214, 0, 0,
|
||||
/*0x78-0x7F*/ 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static const short Table_06[128] =
|
||||
{
|
||||
/*0x00-0x07*/ -218, 0, 0, -218, 0, 0, 0, 0,
|
||||
/*0x08-0x0F*/ -218, 0, -217, -217, 0, 0, 0, 0,
|
||||
/*0x10-0x17*/ 0, 0, -219, 0, 0, 0, 0, 0,
|
||||
/*0x18-0x1F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x20-0x27*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x28-0x2F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x30-0x37*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x38-0x3F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x40-0x47*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x48-0x4F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x50-0x57*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x58-0x5F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x60-0x67*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x68-0x6F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x70-0x77*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x78-0x7F*/ 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static const short Table_07[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x08-0x0F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x10-0x17*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x18-0x1F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x20-0x27*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x28-0x2F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x30-0x37*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x38-0x3F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x40-0x47*/ 0, 0, 0, 0, 0, 84, 0, 0,
|
||||
/*0x48-0x4F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x50-0x57*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x58-0x5F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x60-0x67*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x68-0x6F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x70-0x77*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x78-0x7F*/ 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static const short Table_08[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x08-0x0F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x10-0x17*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x18-0x1F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x20-0x27*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x28-0x2F*/ 0, 0, 0, 0, -38, -37, -37, -37,
|
||||
/*0x30-0x37*/ 0, -32, -32, -32, -32, -32, -32, -32,
|
||||
/*0x38-0x3F*/ -32, -32, -32, -32, -32, -32, -32, -32,
|
||||
/*0x40-0x47*/ -32, -32, -31, -32, -32, -32, -32, -32,
|
||||
/*0x48-0x4F*/ -32, -32, -32, -32, -64, -63, -63, 0,
|
||||
/*0x50-0x57*/ -62, -57, 0, 0, 0, -47, -54, 0,
|
||||
/*0x58-0x5F*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x60-0x67*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x68-0x6F*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x70-0x77*/ -86, -80, -79, 0, 0, -96, 0, 0,
|
||||
/*0x78-0x7F*/ 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static const short Table_09[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x08-0x0F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x10-0x17*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x18-0x1F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x20-0x27*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x28-0x2F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x30-0x37*/ -32, -32, -32, -32, -32, -32, -32, -32,
|
||||
/*0x38-0x3F*/ -32, -32, -32, -32, -32, -32, -32, -32,
|
||||
/*0x40-0x47*/ -32, -32, -32, -32, -32, -32, -32, -32,
|
||||
/*0x48-0x4F*/ -32, -32, -32, -32, -32, -32, -32, -32,
|
||||
/*0x50-0x57*/ -80, -80, -80, -80, -80, -80, -80, -80,
|
||||
/*0x58-0x5F*/ -80, -80, -80, -80, -80, -80, -80, -80,
|
||||
/*0x60-0x67*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x68-0x6F*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x70-0x77*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x78-0x7F*/ 0, -1, 0, -1, 0, -1, 0, -1
|
||||
};
|
||||
|
||||
static const short Table_10[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 0, -1, 0, 0, 0, 0, 0, 0,
|
||||
/*0x08-0x0F*/ 0, 0, 0, -1, 0, -1, 0, -1,
|
||||
/*0x10-0x17*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x18-0x1F*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x20-0x27*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x28-0x2F*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x30-0x37*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x38-0x3F*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x40-0x47*/ 0, 0, -1, 0, -1, 0, -1, 0,
|
||||
/*0x48-0x4F*/ -1, 0, -1, 0, -1, 0, -1, 0,
|
||||
/*0x50-0x57*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x58-0x5F*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x60-0x67*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x68-0x6F*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x70-0x77*/ 0, -1, 0, -1, 0, -1, 0, 0,
|
||||
/*0x78-0x7F*/ 0, -1, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static const short Table_11[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x08-0x0F*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x10-0x17*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x18-0x1F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x20-0x27*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x28-0x2F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x30-0x37*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x38-0x3F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x40-0x47*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x48-0x4F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x50-0x57*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x58-0x5F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x60-0x67*/ 0, -48, -48, -48, -48, -48, -48, -48,
|
||||
/*0x68-0x6F*/ -48, -48, -48, -48, -48, -48, -48, -48,
|
||||
/*0x70-0x77*/ -48, -48, -48, -48, -48, -48, -48, -48,
|
||||
/*0x78-0x7F*/ -48, -48, -48, -48, -48, -48, -48, -48
|
||||
};
|
||||
|
||||
static const short Table_12[128] =
|
||||
{
|
||||
/*0x00-0x07*/ -48, -48, -48, -48, -48, -48, -48, 0,
|
||||
/*0x08-0x0F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x10-0x17*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x18-0x1F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x20-0x27*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x28-0x2F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x30-0x37*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x38-0x3F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x40-0x47*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x48-0x4F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x50-0x57*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x58-0x5F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x60-0x67*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x68-0x6F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x70-0x77*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x78-0x7F*/ 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static const short Table_13[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x08-0x0F*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x10-0x17*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x18-0x1F*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x20-0x27*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x28-0x2F*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x30-0x37*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x38-0x3F*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x40-0x47*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x48-0x4F*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x50-0x57*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x58-0x5F*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x60-0x67*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x68-0x6F*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x70-0x77*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x78-0x7F*/ 0, -1, 0, -1, 0, -1, 0, -1
|
||||
};
|
||||
|
||||
static const short Table_14[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x08-0x0F*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x10-0x17*/ 0, -1, 0, -1, 0, -1, 0, 0,
|
||||
/*0x18-0x1F*/ 0, 0, 0, -59, 0, 0, 0, 0,
|
||||
/*0x20-0x27*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x28-0x2F*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x30-0x37*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x38-0x3F*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x40-0x47*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x48-0x4F*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x50-0x57*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x58-0x5F*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x60-0x67*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x68-0x6F*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x70-0x77*/ 0, -1, 0, -1, 0, -1, 0, -1,
|
||||
/*0x78-0x7F*/ 0, -1, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static const short Table_15[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
/*0x08-0x0F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x10-0x17*/ 8, 8, 8, 8, 8, 8, 0, 0,
|
||||
/*0x18-0x1F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x20-0x27*/ 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
/*0x28-0x2F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x30-0x37*/ 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
/*0x38-0x3F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x40-0x47*/ 8, 8, 8, 8, 8, 8, 0, 0,
|
||||
/*0x48-0x4F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x50-0x57*/ 0, 8, 0, 8, 0, 8, 0, 8,
|
||||
/*0x58-0x5F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x60-0x67*/ 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
/*0x68-0x6F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x70-0x77*/ 74, 74, 86, 86, 86, 86, 100, 100,
|
||||
/*0x78-0x7F*/ 128, 128, 112, 112, 126, 126, 0, 0
|
||||
};
|
||||
|
||||
static const short Table_16[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
/*0x08-0x0F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x10-0x17*/ 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
/*0x18-0x1F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x20-0x27*/ 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
/*0x28-0x2F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x30-0x37*/ 8, 8, 0, 9, 0, 0, 0, 0,
|
||||
/*0x38-0x3F*/ 0, 0, 0, 0, 0, 0, -7205, 0,
|
||||
/*0x40-0x47*/ 0, 0, 0, 9, 0, 0, 0, 0,
|
||||
/*0x48-0x4F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x50-0x57*/ 8, 8, 0, 0, 0, 0, 0, 0,
|
||||
/*0x58-0x5F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x60-0x67*/ 8, 8, 0, 0, 0, 7, 0, 0,
|
||||
/*0x68-0x6F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x70-0x77*/ 0, 0, 0, 9, 0, 0, 0, 0,
|
||||
/*0x78-0x7F*/ 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static const short Table_17[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x08-0x0F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x10-0x17*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x18-0x1F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x20-0x27*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x28-0x2F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x30-0x37*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x38-0x3F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x40-0x47*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x48-0x4F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x50-0x57*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x58-0x5F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x60-0x67*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x68-0x6F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x70-0x77*/ -16, -16, -16, -16, -16, -16, -16, -16,
|
||||
/*0x78-0x7F*/ -16, -16, -16, -16, -16, -16, -16, -16
|
||||
};
|
||||
|
||||
static const short Table_18[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x08-0x0F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x10-0x17*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x18-0x1F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x20-0x27*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x28-0x2F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x30-0x37*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x38-0x3F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x40-0x47*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x48-0x4F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x50-0x57*/ -26, -26, -26, -26, -26, -26, -26, -26,
|
||||
/*0x58-0x5F*/ -26, -26, -26, -26, -26, -26, -26, -26,
|
||||
/*0x60-0x67*/ -26, -26, -26, -26, -26, -26, -26, -26,
|
||||
/*0x68-0x6F*/ -26, -26, 0, 0, 0, 0, 0, 0,
|
||||
/*0x70-0x77*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x78-0x7F*/ 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static const short Table_19[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x08-0x0F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x10-0x17*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x18-0x1F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x20-0x27*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x28-0x2F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x30-0x37*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x38-0x3F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x40-0x47*/ 0, -32, -32, -32, -32, -32, -32, -32,
|
||||
/*0x48-0x4F*/ -32, -32, -32, -32, -32, -32, -32, -32,
|
||||
/*0x50-0x57*/ -32, -32, -32, -32, -32, -32, -32, -32,
|
||||
/*0x58-0x5F*/ -32, -32, -32, 0, 0, 0, 0, 0,
|
||||
/*0x60-0x67*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x68-0x6F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x70-0x77*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x78-0x7F*/ 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static const short Table_20[128] =
|
||||
{
|
||||
/*0x00-0x07*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x08-0x0F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x10-0x17*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x18-0x1F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x20-0x27*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x28-0x2F*/ -40, -40, -40, -40, -40, -40, -40, -40,
|
||||
/*0x30-0x37*/ -40, -40, -40, -40, -40, -40, -40, -40,
|
||||
/*0x38-0x3F*/ -40, -40, -40, -40, -40, -40, -40, -40,
|
||||
/*0x40-0x47*/ -40, -40, -40, -40, -40, -40, -40, -40,
|
||||
/*0x48-0x4F*/ -40, -40, -40, -40, -40, -40, 0, 0,
|
||||
/*0x50-0x57*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x58-0x5F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x60-0x67*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x68-0x6F*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x70-0x77*/ 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
/*0x78-0x7F*/ 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
const short *_pSLwc_Toupper_Table[521] =
|
||||
{
|
||||
Table_01, Table_02, Table_03, Table_04, Table_05, Table_06,
|
||||
Table_07, Table_08, Table_09, Table_10, Table_11, Table_12,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_13, Table_14, Table_15, Table_16, Table_00, Table_00,
|
||||
Table_17, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_18, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_19, Table_00, Table_00, Table_00, Table_00, Table_00,
|
||||
Table_00, Table_00, Table_00, Table_00, Table_20
|
||||
};
|
||||
#endif /* DEFINE_PSLWC_TOUPPER_TABLE */
|
File diff suppressed because it is too large
Load Diff
322
slang/slcommon.c
322
slang/slcommon.c
@ -1,322 +0,0 @@
|
||||
/* This file contains library-wide symbols that are always needed when one
|
||||
* links to the library.
|
||||
*/
|
||||
/*
|
||||
Copyright (C) 2004, 2005, 2006 John E. Davis
|
||||
|
||||
This file is part of the S-Lang Library.
|
||||
|
||||
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
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The S-Lang Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA.
|
||||
*/
|
||||
#define _GNU_SOURCE
|
||||
#include "slinclud.h"
|
||||
|
||||
#include "slang.h"
|
||||
#include "_slang.h"
|
||||
|
||||
#ifdef HAVE_LOCALE_H
|
||||
# include <locale.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LANGINFO_H
|
||||
# include <langinfo.h>
|
||||
#endif
|
||||
|
||||
#define DEBUG_MALLOC 0
|
||||
|
||||
#if DEBUG_MALLOC
|
||||
# define SLREALLOC_FUN SLdebug_realloc
|
||||
# define SLMALLOC_FUN SLdebug_malloc
|
||||
# define SLFREE_FUN SLdebug_free
|
||||
#else
|
||||
# define SLREALLOC_FUN SLREALLOC
|
||||
# define SLMALLOC_FUN SLMALLOC
|
||||
# define SLFREE_FUN SLFREE
|
||||
#endif
|
||||
|
||||
|
||||
int SLang_Version = SLANG_VERSION;
|
||||
char *SLang_Version_String = SLANG_VERSION_STRING;
|
||||
|
||||
int _pSLinterp_UTF8_Mode = 0;
|
||||
int _pSLtt_UTF8_Mode = 0;
|
||||
int _pSLutf8_mode = 0;
|
||||
|
||||
#ifndef HAVE_LOCALE_H
|
||||
# define setlocale(x,y) (NULL)
|
||||
# define LC_ALL 0
|
||||
#endif
|
||||
|
||||
int SLutf8_is_utf8_mode (void)
|
||||
{
|
||||
return _pSLutf8_mode;
|
||||
}
|
||||
|
||||
int SLinterp_utf8_enable (int mode)
|
||||
{
|
||||
if (mode == -1)
|
||||
mode = _pSLutf8_mode;
|
||||
|
||||
return _pSLinterp_UTF8_Mode = mode;
|
||||
}
|
||||
|
||||
int SLinterp_is_utf8_mode (void)
|
||||
{
|
||||
return _pSLinterp_UTF8_Mode;
|
||||
}
|
||||
|
||||
static int utf8_enable (int mode)
|
||||
{
|
||||
char *locale;
|
||||
|
||||
if (mode != -1)
|
||||
return (mode != 0);
|
||||
|
||||
(void) setlocale (LC_ALL, "");
|
||||
|
||||
#ifdef HAVE_NL_LANGINFO_CODESET
|
||||
locale = nl_langinfo (CODESET);
|
||||
if ((locale != NULL) && (*locale))
|
||||
{
|
||||
if ((0 == strcmp (locale, "UTF-8"))
|
||||
|| (0 == strcmp (locale, "utf-8"))
|
||||
|| (0 == strcmp (locale, "utf8"))
|
||||
|| (0 == strcmp (locale, "UTF8")))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
locale = setlocale (LC_ALL, "");
|
||||
|
||||
if (((locale == NULL) || (*locale == 0))
|
||||
&& ((NULL == (locale = getenv ("LC_ALL"))) || (*locale == 0))
|
||||
&& ((NULL == (locale = getenv ("LC_CTYPE"))) || (*locale == 0))
|
||||
&& ((NULL == (locale = getenv ("LANG"))) || (*locale == 0)))
|
||||
return 0;
|
||||
|
||||
/* setlocale man page says the return value is something like:
|
||||
* language[_territory][.codeset][@modifier][+special][,...
|
||||
* Here, we want the codeset, if present.
|
||||
*/
|
||||
|
||||
while (*locale && (*locale != '.') && (*locale != '@')
|
||||
&& (*locale != '+') && (*locale != ','))
|
||||
locale++;
|
||||
|
||||
if (*locale == '.')
|
||||
{
|
||||
locale++;
|
||||
if (0 == strncmp (locale, "UTF-8", 5))
|
||||
locale += 5;
|
||||
else if (0 == strncmp (locale, "utf8", 4))
|
||||
locale += 4;
|
||||
else
|
||||
return 0;
|
||||
|
||||
if ((*locale == 0) || (*locale == '@')
|
||||
|| (*locale == '+') || (*locale == ','))
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Returns the value of _pSLutf8_mode */
|
||||
int SLutf8_enable (int mode)
|
||||
{
|
||||
mode = utf8_enable (mode);
|
||||
_pSLutf8_mode = mode;
|
||||
_pSLtt_UTF8_Mode = mode;
|
||||
_pSLinterp_UTF8_Mode = mode;
|
||||
return mode;
|
||||
}
|
||||
|
||||
#ifndef MIDNIGHT_COMMANDER_CODE
|
||||
|
||||
char *SLmalloc (unsigned int len)
|
||||
{
|
||||
char *p;
|
||||
|
||||
p = (char *) SLMALLOC_FUN (len);
|
||||
if (p == NULL)
|
||||
SLang_set_error (SL_MALLOC_ERROR);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
void SLfree (char *p)
|
||||
{
|
||||
if (p != NULL) SLFREE_FUN (p);
|
||||
}
|
||||
|
||||
char *SLrealloc (char *p, unsigned int len)
|
||||
{
|
||||
if (len == 0)
|
||||
{
|
||||
SLfree (p);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (p == NULL) p = SLmalloc (len);
|
||||
else
|
||||
{
|
||||
p = (char *)SLREALLOC_FUN (p, len);
|
||||
if (p == NULL)
|
||||
SLang_set_error (SL_MALLOC_ERROR);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
#endif /* !MIDNIGHT_COMMANDER_CODE */
|
||||
|
||||
char *SLcalloc (unsigned int nelems, unsigned int len)
|
||||
{
|
||||
char *p;
|
||||
|
||||
len = nelems * len;
|
||||
p = SLmalloc (len);
|
||||
if (p != NULL) memset (p, 0, len);
|
||||
return p;
|
||||
}
|
||||
|
||||
#if 0 /* was: !defined(HAVE_ISSETUGID) && defined(__GLIBC__) && (__GLIBC__ >= 2) */
|
||||
extern int __libc_enable_secure;
|
||||
# define HAVE___LIBC_ENABLE_SECURE 1
|
||||
#endif
|
||||
|
||||
int _pSLsecure_issetugid (void)
|
||||
{
|
||||
#ifdef HAVE_ISSETUGID
|
||||
return (1 == issetugid ());
|
||||
#else
|
||||
# if defined HAVE___LIBC_ENABLE_SECURE && 0
|
||||
return __libc_enable_secure;
|
||||
# else
|
||||
# if defined(HAVE_GETUID) && defined(HAVE_GETEUID) && defined(HAVE_GETGID) && defined(HAVE_GETEUID)
|
||||
static int enable_secure;
|
||||
if (enable_secure == 0)
|
||||
{
|
||||
if ((getuid () != geteuid ())
|
||||
|| (getgid () != getegid ()))
|
||||
enable_secure = 1;
|
||||
else
|
||||
enable_secure = -1;
|
||||
}
|
||||
return (enable_secure == 1);
|
||||
# else
|
||||
return 0;
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Like getenv, except if running as setuid or setgid, returns NULL */
|
||||
char *_pSLsecure_getenv (char *s)
|
||||
{
|
||||
if (_pSLsecure_issetugid ())
|
||||
return NULL;
|
||||
return getenv (s);
|
||||
}
|
||||
|
||||
|
||||
typedef struct Interrupt_Hook_Type
|
||||
{
|
||||
int (*func)(VOID_STAR);
|
||||
VOID_STAR client_data;
|
||||
struct Interrupt_Hook_Type *next;
|
||||
}
|
||||
Interrupt_Hook_Type;
|
||||
|
||||
static Interrupt_Hook_Type *Interrupt_Hooks = NULL;
|
||||
|
||||
static Interrupt_Hook_Type *
|
||||
find_interrupt_hook (int (*func)(VOID_STAR), VOID_STAR cd,
|
||||
Interrupt_Hook_Type **prevp)
|
||||
{
|
||||
Interrupt_Hook_Type *h = Interrupt_Hooks;
|
||||
Interrupt_Hook_Type *prev = NULL;
|
||||
while (h != NULL)
|
||||
{
|
||||
if ((h->func == func) && (h->client_data == cd))
|
||||
{
|
||||
if (prevp != NULL)
|
||||
*prevp = prev;
|
||||
return h;
|
||||
}
|
||||
h = h->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int SLang_add_interrupt_hook (int (*func)(VOID_STAR), VOID_STAR cd)
|
||||
{
|
||||
Interrupt_Hook_Type *h;
|
||||
|
||||
if (NULL != find_interrupt_hook (func, cd, NULL))
|
||||
return 0;
|
||||
|
||||
if (NULL == (h = (Interrupt_Hook_Type *)SLmalloc (sizeof (Interrupt_Hook_Type))))
|
||||
return -1;
|
||||
|
||||
h->func = func;
|
||||
h->client_data = cd;
|
||||
h->next = Interrupt_Hooks;
|
||||
Interrupt_Hooks = h;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SLang_remove_interrupt_hook (int (*func)(VOID_STAR), VOID_STAR cd)
|
||||
{
|
||||
Interrupt_Hook_Type *h, *hprev;
|
||||
|
||||
if (NULL == (h = find_interrupt_hook (func, cd, &hprev)))
|
||||
return;
|
||||
|
||||
if (hprev == NULL)
|
||||
Interrupt_Hooks = h->next;
|
||||
else
|
||||
hprev->next = h->next;
|
||||
|
||||
SLfree ((char *) h);
|
||||
}
|
||||
|
||||
int SLang_handle_interrupt (void)
|
||||
{
|
||||
Interrupt_Hook_Type *h;
|
||||
int status = 0;
|
||||
|
||||
h = Interrupt_Hooks;
|
||||
while (h != NULL)
|
||||
{
|
||||
if (-1 == (*h->func)(h->client_data))
|
||||
status = -1;
|
||||
|
||||
h = h->next;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
#if defined(__WIN32__) && defined(SLANG_DLL)
|
||||
# include <windows.h>
|
||||
|
||||
BOOL WINAPI DllMain(HANDLE hInstance,DWORD dwReason,LPVOID lpParam)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
#endif
|
2897
slang/sldisply.c
2897
slang/sldisply.c
File diff suppressed because it is too large
Load Diff
766
slang/slerr.c
766
slang/slerr.c
@ -1,766 +0,0 @@
|
||||
/* error handling common to all routines. */
|
||||
/*
|
||||
Copyright (C) 2004, 2005, 2006 John E. Davis
|
||||
|
||||
This file is part of the S-Lang Library.
|
||||
|
||||
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
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The S-Lang Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA.
|
||||
*/
|
||||
|
||||
#include "slinclud.h"
|
||||
|
||||
#include "slang.h"
|
||||
#include "_slang.h"
|
||||
|
||||
void (*_pSLinterpreter_Error_Hook) (int);
|
||||
|
||||
void (*SLang_VMessage_Hook) (char *, va_list);
|
||||
void (*SLang_Error_Hook)(char *);
|
||||
void (*SLang_Exit_Error_Hook)(char *, va_list);
|
||||
void (*SLang_Dump_Routine)(char *);
|
||||
|
||||
volatile int _pSLang_Error = 0;
|
||||
volatile int SLKeyBoard_Quit = 0;
|
||||
|
||||
typedef struct _Exception_Type Exception_Type;
|
||||
struct _Exception_Type
|
||||
{
|
||||
int error_code;
|
||||
char *name;
|
||||
char *description;
|
||||
Exception_Type *subclasses;
|
||||
Exception_Type *next;
|
||||
Exception_Type *parent;
|
||||
};
|
||||
|
||||
static Exception_Type *Exception_Root;
|
||||
static Exception_Type Exception_Root_Buf =
|
||||
{
|
||||
-1, "AnyError", "All Errors", NULL, NULL, NULL
|
||||
};
|
||||
|
||||
|
||||
/* Built-in error codes */
|
||||
/* These values should correspond to the values produced by _pSLerr_init.
|
||||
* Some apps may not use the interpreter, and as such _pSLerr_init will not
|
||||
* get called.
|
||||
*/
|
||||
int SL_Any_Error = -1;
|
||||
int SL_Unknown_Error = 6;
|
||||
int SL_Internal_Error = 5;
|
||||
int SL_OS_Error = 1;
|
||||
int SL_Malloc_Error = 2;
|
||||
int SL_Import_Error = 7;
|
||||
int SL_RunTime_Error = 3;
|
||||
int SL_InvalidParm_Error = 4;
|
||||
int SL_TypeMismatch_Error = 8;
|
||||
int SL_UserBreak_Error = 9;
|
||||
int SL_Stack_Error = 10;
|
||||
int SL_StackOverflow_Error = 12;
|
||||
int SL_StackUnderflow_Error = 11;
|
||||
int SL_ReadOnly_Error = 13;
|
||||
int SL_VariableUninitialized_Error = 14;
|
||||
int SL_NumArgs_Error = 15;
|
||||
int SL_Index_Error = 16;
|
||||
int SL_Usage_Error = 17;
|
||||
int SL_Application_Error = 18;
|
||||
int SL_NotImplemented_Error = 19;
|
||||
int SL_LimitExceeded_Error = 20;
|
||||
int SL_Forbidden_Error = 21;
|
||||
int SL_Math_Error = 22;
|
||||
int SL_DivideByZero_Error = 23;
|
||||
int SL_ArithOverflow_Error = 24;
|
||||
int SL_ArithUnderflow_Error = 25;
|
||||
int SL_Domain_Error = 26;
|
||||
int SL_IO_Error = 27;
|
||||
int SL_Write_Error = 28;
|
||||
int SL_Read_Error = 29;
|
||||
int SL_Open_Error = 30;
|
||||
int SL_Data_Error = 31;
|
||||
int SL_Unicode_Error = 32;
|
||||
int SL_InvalidUTF8_Error = 33;
|
||||
int SL_Namespace_Error = 34;
|
||||
int SL_Parse_Error = 35;
|
||||
int SL_Syntax_Error = 36;
|
||||
int SL_DuplicateDefinition_Error = 37;
|
||||
int SL_UndefinedName_Error = 38;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int *errcode_ptr;
|
||||
char *name;
|
||||
char *description;
|
||||
int *base_class_ptr;
|
||||
}
|
||||
BuiltIn_Exception_Table_Type;
|
||||
|
||||
static SLCONST BuiltIn_Exception_Table_Type BuiltIn_Exception_Table[] =
|
||||
{
|
||||
/* Define MallocError and InvalidParmError ASAP */
|
||||
{&SL_OS_Error, "OSError", "OS Error", &SL_Any_Error},
|
||||
{&SL_Malloc_Error, "MallocError", "Not enough memory", &SL_OS_Error},
|
||||
|
||||
{&SL_RunTime_Error, "RunTimeError", "Run-Time Error", &SL_Any_Error},
|
||||
{&SL_InvalidParm_Error, "InvalidParmError", "Invalid Parameter", &SL_RunTime_Error},
|
||||
|
||||
{&SL_Internal_Error, "InternalError", "Internal Error", &SL_Any_Error},
|
||||
{&SL_Unknown_Error, "UnknownError", "Unknown Error", &SL_Any_Error},
|
||||
|
||||
/* Rest of OSErrors */
|
||||
{&SL_Import_Error, "ImportError", "Import Error", &SL_OS_Error},
|
||||
|
||||
/* Rest of RunTimeErrors */
|
||||
{&SL_TypeMismatch_Error, "TypeMismatchError", "Type Mismatch", &SL_RunTime_Error},
|
||||
{&SL_UserBreak_Error, "UserBreakError", "User Break", &SL_RunTime_Error},
|
||||
{&SL_Stack_Error, "StackError", "Stack Error", &SL_RunTime_Error},
|
||||
{&SL_StackUnderflow_Error, "StackUnderflowError", "Stack Underflow Error", &SL_Stack_Error},
|
||||
{&SL_StackOverflow_Error, "StackOverflowError", "Stack Overflow Error", &SL_Stack_Error},
|
||||
{&SL_ReadOnly_Error, "ReadOnlyError", "Read-Only Error", &SL_RunTime_Error},
|
||||
{&SL_VariableUninitialized_Error, "VariableUninitializedError", "Variable Uninitialized Error", &SL_RunTime_Error},
|
||||
{&SL_NumArgs_Error, "NumArgsError", "Invalid Number of Arguments", &SL_RunTime_Error},
|
||||
{&SL_Index_Error, "IndexError", "Invalid Index", &SL_RunTime_Error},
|
||||
{&SL_Usage_Error, "UsageError", "Illegal Usage", &SL_RunTime_Error},
|
||||
{&SL_Application_Error, "ApplicationError", "Application Error", &SL_RunTime_Error},
|
||||
{&SL_NotImplemented_Error, "NotImplementedError", "Not Implemented", &SL_RunTime_Error},
|
||||
{&SL_LimitExceeded_Error, "LimitExceededError", "Limit Exceeded", &SL_RunTime_Error},
|
||||
{&SL_Forbidden_Error, "ForbiddenError", "Operation Forbidden", &SL_RunTime_Error},
|
||||
{&SL_Math_Error, "MathError", "Math Error", &SL_RunTime_Error},
|
||||
{&SL_DivideByZero_Error, "DivideByZeroError", "Divide by Zero", &SL_Math_Error},
|
||||
{&SL_ArithOverflow_Error, "ArithOverflowError", "Arithmetic Overflow", &SL_Math_Error},
|
||||
{&SL_ArithUnderflow_Error, "ArithUnderflowError", "Arithmetic Underflow", &SL_Math_Error},
|
||||
{&SL_Domain_Error, "DomainError", "Domain Error", &SL_Math_Error},
|
||||
{&SL_IO_Error, "IOError", "I/O Error", &SL_RunTime_Error},
|
||||
{&SL_Write_Error, "WriteError", "Write failed", &SL_IO_Error},
|
||||
{&SL_Read_Error, "ReadError", "Read failed", &SL_IO_Error},
|
||||
{&SL_Open_Error, "OpenError", "Open failed", &SL_IO_Error},
|
||||
{&SL_Data_Error, "DataError", "Data Error", &SL_RunTime_Error},
|
||||
{&SL_Unicode_Error, "UnicodeError", "Unicode Error", &SL_RunTime_Error},
|
||||
{&SL_InvalidUTF8_Error, "UTF8Error", "Invalid UTF8", &SL_Unicode_Error},
|
||||
{&SL_Namespace_Error, "NamespaceError", "Namespace Error", &SL_RunTime_Error},
|
||||
|
||||
/* Parse Errors */
|
||||
{&SL_Parse_Error, "ParseError", "Parse Error", &SL_Any_Error},
|
||||
{&SL_Syntax_Error, "SyntaxError", "Syntax Error", &SL_Parse_Error},
|
||||
{&SL_DuplicateDefinition_Error, "DuplicateDefinitionError", "Duplicate Definition", &SL_Parse_Error},
|
||||
{&SL_UndefinedName_Error, "UndefinedNameError", "Undefined Name", &SL_Parse_Error},
|
||||
{NULL, NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
static Exception_Type *find_exception (Exception_Type *root, int error_code)
|
||||
{
|
||||
Exception_Type *e;
|
||||
|
||||
while (root != NULL)
|
||||
{
|
||||
if (error_code == root->error_code)
|
||||
return root;
|
||||
|
||||
if (root->subclasses != NULL)
|
||||
{
|
||||
e = find_exception (root->subclasses, error_code);
|
||||
if (e != NULL)
|
||||
return e;
|
||||
}
|
||||
root = root->next;
|
||||
}
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
static int is_exception_ancestor (int a, int b)
|
||||
{
|
||||
Exception_Type *e;
|
||||
|
||||
if (a == b)
|
||||
return 1;
|
||||
|
||||
if (NULL == (e = find_exception (Exception_Root, a)))
|
||||
return 0;
|
||||
|
||||
while (e->parent != NULL)
|
||||
{
|
||||
e = e->parent;
|
||||
if (e->error_code == b)
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SLerr_exception_eqs (int a, int b)
|
||||
{
|
||||
if (is_exception_ancestor (a, b))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void free_this_exception (Exception_Type *e)
|
||||
{
|
||||
if (e == NULL)
|
||||
return;
|
||||
|
||||
if (e->name != NULL)
|
||||
SLang_free_slstring (e->name);
|
||||
|
||||
if (e->description != NULL)
|
||||
SLang_free_slstring (e->description);
|
||||
|
||||
SLfree ((char *)e);
|
||||
}
|
||||
|
||||
|
||||
static int Next_Exception_Code;
|
||||
/* The whole point of this nonsense involving the _pSLerr_New_Exception_Hook
|
||||
* is to provide a mechanism to avoid linking in the interpreter for apps
|
||||
* that just want the other facilities.
|
||||
*/
|
||||
int (*_pSLerr_New_Exception_Hook)(char *name, char *desc, int error_code);
|
||||
|
||||
int _pSLerr_init_interp_exceptions (void)
|
||||
{
|
||||
SLCONST BuiltIn_Exception_Table_Type *b;
|
||||
Exception_Type *e;
|
||||
|
||||
if (_pSLerr_New_Exception_Hook == NULL)
|
||||
return 0;
|
||||
|
||||
e = &Exception_Root_Buf;
|
||||
if (-1 == (*_pSLerr_New_Exception_Hook)(e->name, e->description, e->error_code))
|
||||
return -1;
|
||||
|
||||
b = BuiltIn_Exception_Table;
|
||||
while (b->errcode_ptr != NULL)
|
||||
{
|
||||
if (-1 == (*_pSLerr_New_Exception_Hook)(b->name, b->description, *b->errcode_ptr))
|
||||
return -1;
|
||||
|
||||
b++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SLerr_new_exception (int baseclass, char *name, char *descript)
|
||||
{
|
||||
Exception_Type *base;
|
||||
Exception_Type *e;
|
||||
|
||||
if (-1 == _pSLerr_init ())
|
||||
return -1;
|
||||
|
||||
base = find_exception (Exception_Root, baseclass);
|
||||
if (base == NULL)
|
||||
{
|
||||
SLang_verror (SL_InvalidParm_Error,
|
||||
"Base class for new exception not found");
|
||||
return -1;
|
||||
}
|
||||
|
||||
e = (Exception_Type *) SLcalloc (1, sizeof (Exception_Type));
|
||||
if (e == NULL)
|
||||
return -1;
|
||||
|
||||
if ((NULL == (e->name = SLang_create_slstring (name)))
|
||||
|| (NULL == (e->description = SLang_create_slstring (descript))))
|
||||
{
|
||||
free_this_exception (e);
|
||||
return -1;
|
||||
}
|
||||
|
||||
e->error_code = Next_Exception_Code;
|
||||
|
||||
if ((_pSLerr_New_Exception_Hook != NULL)
|
||||
&& (-1 == (*_pSLerr_New_Exception_Hook) (e->name, e->description, e->error_code)))
|
||||
{
|
||||
free_this_exception (e);
|
||||
return -1;
|
||||
}
|
||||
|
||||
e->parent = base;
|
||||
e->next = base->subclasses;
|
||||
base->subclasses = e;
|
||||
|
||||
Next_Exception_Code++;
|
||||
return e->error_code;
|
||||
}
|
||||
|
||||
|
||||
static int init_exceptions (void)
|
||||
{
|
||||
SLCONST BuiltIn_Exception_Table_Type *b;
|
||||
|
||||
if (Exception_Root != NULL)
|
||||
return 0;
|
||||
|
||||
Exception_Root = &Exception_Root_Buf;
|
||||
Next_Exception_Code = 1;
|
||||
b = BuiltIn_Exception_Table;
|
||||
while (b->errcode_ptr != NULL)
|
||||
{
|
||||
int err_code;
|
||||
|
||||
err_code = SLerr_new_exception (*b->base_class_ptr, b->name, b->description);
|
||||
if (err_code == -1)
|
||||
return -1;
|
||||
|
||||
*b->errcode_ptr = err_code;
|
||||
b++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void free_exceptions (Exception_Type *root)
|
||||
{
|
||||
while (root != NULL)
|
||||
{
|
||||
Exception_Type *next;
|
||||
|
||||
if (root->subclasses != NULL)
|
||||
free_exceptions (root->subclasses);
|
||||
|
||||
next = root->next;
|
||||
free_this_exception (root);
|
||||
root = next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void deinit_exceptions (void)
|
||||
{
|
||||
Exception_Type *root = Exception_Root;
|
||||
|
||||
if (root != NULL)
|
||||
free_exceptions (root->subclasses);
|
||||
|
||||
Exception_Root = NULL;
|
||||
Next_Exception_Code = 0;
|
||||
}
|
||||
|
||||
char *SLerr_strerror (int err_code)
|
||||
{
|
||||
Exception_Type *e;
|
||||
|
||||
if (err_code == 0)
|
||||
err_code = _pSLang_Error;
|
||||
|
||||
if (-1 == _pSLerr_init ())
|
||||
return "Unable to initialize SLerr module";
|
||||
|
||||
if (NULL == (e = find_exception (Exception_Root, err_code)))
|
||||
return "Invalid/Unknown Error Code";
|
||||
|
||||
return e->description;
|
||||
}
|
||||
|
||||
/* Error Queue Functions
|
||||
* SLang_verror (int errcode, fmt, args)
|
||||
* Add an error message to the queue.
|
||||
* SLerr_delete_queue ()
|
||||
* Removes messages from the error queue
|
||||
* SLerr_print_queue ()
|
||||
* Prints all messages from the queue, deletes the queue
|
||||
*/
|
||||
typedef struct _Error_Message_Type
|
||||
{
|
||||
char *msg; /* SLstring, may be NULL */
|
||||
int msg_type;
|
||||
#define _SLERR_MSG_ERROR 1
|
||||
#define _SLERR_MSG_WARNING 2
|
||||
#define _SLERR_MSG_TRACEBACK 4
|
||||
struct _Error_Message_Type *next;
|
||||
}
|
||||
Error_Message_Type;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Error_Message_Type *head;
|
||||
Error_Message_Type *tail;
|
||||
}
|
||||
Error_Queue_Type;
|
||||
|
||||
static Error_Queue_Type *Default_Error_Queue;
|
||||
|
||||
static void free_error_msg (Error_Message_Type *m)
|
||||
{
|
||||
if (m == NULL)
|
||||
return;
|
||||
if (m->msg != NULL)
|
||||
SLang_free_slstring (m->msg);
|
||||
SLfree ((char *)m);
|
||||
}
|
||||
|
||||
static Error_Message_Type *allocate_error_msg (char *msg, int msg_type)
|
||||
{
|
||||
Error_Message_Type *m;
|
||||
|
||||
if (NULL == (m = (Error_Message_Type*) SLcalloc (1, sizeof (Error_Message_Type))))
|
||||
return NULL;
|
||||
|
||||
if ((NULL != msg) && (NULL == (m->msg = SLang_create_slstring (msg))))
|
||||
{
|
||||
free_error_msg (m);
|
||||
return NULL;
|
||||
}
|
||||
m->msg_type = msg_type;
|
||||
return m;
|
||||
}
|
||||
|
||||
static void free_queued_messages (Error_Queue_Type *q)
|
||||
{
|
||||
Error_Message_Type *m;
|
||||
|
||||
if (q == NULL)
|
||||
return;
|
||||
|
||||
m = q->head;
|
||||
while (m != NULL)
|
||||
{
|
||||
Error_Message_Type *m1 = m->next;
|
||||
free_error_msg (m);
|
||||
m = m1;
|
||||
}
|
||||
q->head = NULL;
|
||||
q->tail = NULL;
|
||||
}
|
||||
|
||||
static void delete_msg_queue (Error_Queue_Type *q)
|
||||
{
|
||||
if (q == NULL)
|
||||
return;
|
||||
|
||||
free_queued_messages (q);
|
||||
SLfree ((char *)q);
|
||||
}
|
||||
|
||||
|
||||
static Error_Queue_Type *create_msg_queue (void)
|
||||
{
|
||||
Error_Queue_Type *q;
|
||||
|
||||
if (NULL == (q = (Error_Queue_Type *)SLcalloc (1, sizeof(Error_Queue_Type))))
|
||||
return NULL;
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
static int queue_message (Error_Queue_Type *q, char *msg, int msg_type)
|
||||
{
|
||||
Error_Message_Type *m;
|
||||
|
||||
if (NULL == (m = allocate_error_msg (msg, msg_type)))
|
||||
return -1;
|
||||
|
||||
if (q->tail != NULL)
|
||||
q->tail->next = m;
|
||||
if (q->head == NULL)
|
||||
q->head = m;
|
||||
q->tail = m;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void print_error (int msg_type, char *err)
|
||||
{
|
||||
unsigned int len;
|
||||
|
||||
switch (msg_type)
|
||||
{
|
||||
case _SLERR_MSG_ERROR:
|
||||
if (SLang_Error_Hook != NULL)
|
||||
{
|
||||
(*SLang_Error_Hook)(err);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case _SLERR_MSG_TRACEBACK:
|
||||
case _SLERR_MSG_WARNING:
|
||||
if (SLang_Dump_Routine != NULL)
|
||||
{
|
||||
(*SLang_Dump_Routine)(err);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
len = strlen (err);
|
||||
if (len == 0)
|
||||
return;
|
||||
|
||||
fputs (err, stderr);
|
||||
if ((err[len-1] != '\n')
|
||||
&& (msg_type != _SLERR_MSG_TRACEBACK))
|
||||
fputs("\n", stderr);
|
||||
|
||||
fflush (stderr);
|
||||
}
|
||||
|
||||
static void print_queue (void)
|
||||
{
|
||||
if (-1 == _pSLerr_init ())
|
||||
print_error (_SLERR_MSG_ERROR, "Unable to initialize SLerr module");
|
||||
|
||||
if (_pSLang_Error == 0)
|
||||
return;
|
||||
|
||||
if (Default_Error_Queue != NULL)
|
||||
{
|
||||
Error_Queue_Type *q = Default_Error_Queue;
|
||||
Error_Message_Type *m = q->head;
|
||||
while (m != NULL)
|
||||
{
|
||||
Error_Message_Type *m_next = m->next;
|
||||
if (m->msg != NULL)
|
||||
print_error (m->msg_type, m->msg);
|
||||
m = m_next;
|
||||
}
|
||||
|
||||
free_queued_messages (q);
|
||||
}
|
||||
#if 0
|
||||
if (_pSLang_Error != SL_Usage_Error)
|
||||
{
|
||||
print_error (_SLERR_MSG_ERROR, SLerr_strerror (_pSLang_Error));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* This function returns a pointer to the first error message in the queue.
|
||||
* Make no attempts to free the returned pointer.
|
||||
*/
|
||||
char *_pSLerr_get_error_from_queue (void)
|
||||
{
|
||||
Error_Queue_Type *q;
|
||||
Error_Message_Type *m;
|
||||
unsigned int len;
|
||||
char *err, *err1, *err_max;
|
||||
|
||||
if (NULL == (q = Default_Error_Queue))
|
||||
return NULL;
|
||||
|
||||
len = 0;
|
||||
m = q->head;
|
||||
while (m != NULL)
|
||||
{
|
||||
if (m->msg_type == _SLERR_MSG_ERROR)
|
||||
len += 1 + strlen (m->msg);
|
||||
|
||||
m = m->next;
|
||||
}
|
||||
|
||||
if (len)
|
||||
len--; /* last \n not needed */
|
||||
|
||||
if (NULL == (err = _pSLallocate_slstring (len)))
|
||||
return NULL;
|
||||
|
||||
err_max = err + len;
|
||||
err1 = err;
|
||||
m = q->head;
|
||||
while (m != NULL)
|
||||
{
|
||||
if (m->msg_type == _SLERR_MSG_ERROR)
|
||||
{
|
||||
unsigned int dlen = strlen (m->msg);
|
||||
strcpy (err1, m->msg);
|
||||
err1 += dlen;
|
||||
if (err1 != err_max)
|
||||
*err1++ = '\n';
|
||||
}
|
||||
m = m->next;
|
||||
}
|
||||
*err1 = 0;
|
||||
|
||||
return _pSLcreate_via_alloced_slstring (err, len);
|
||||
}
|
||||
|
||||
void _pSLerr_print_message_queue (void)
|
||||
{
|
||||
print_queue ();
|
||||
}
|
||||
|
||||
|
||||
static volatile int Suspend_Error_Messages = 0;
|
||||
int _pSLerr_resume_messages (void)
|
||||
{
|
||||
if (Suspend_Error_Messages == 0)
|
||||
return 0;
|
||||
|
||||
Suspend_Error_Messages--;
|
||||
if (Suspend_Error_Messages == 0)
|
||||
print_queue ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int _pSLerr_suspend_messages (void)
|
||||
{
|
||||
Suspend_Error_Messages++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void _pSLerr_free_queued_messages (void)
|
||||
{
|
||||
free_queued_messages (Default_Error_Queue);
|
||||
}
|
||||
|
||||
|
||||
void SLang_verror (int err_code, char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char err [4096];
|
||||
|
||||
if (-1 == _pSLerr_init ())
|
||||
{
|
||||
print_queue ();
|
||||
return;
|
||||
}
|
||||
|
||||
if (err_code == 0)
|
||||
err_code = SL_INTRINSIC_ERROR;
|
||||
|
||||
if (_pSLang_Error == 0)
|
||||
SLang_set_error (err_code);
|
||||
|
||||
if (fmt == NULL)
|
||||
return;
|
||||
|
||||
va_start(ap, fmt);
|
||||
(void) SLvsnprintf (err, sizeof (err), fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
if (Suspend_Error_Messages)
|
||||
(void) queue_message (Default_Error_Queue, err, _SLERR_MSG_ERROR);
|
||||
else
|
||||
print_error (_SLERR_MSG_ERROR, err);
|
||||
}
|
||||
|
||||
int _pSLerr_traceback_msg (char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char msg [4096];
|
||||
|
||||
va_start(ap, fmt);
|
||||
(void) SLvsnprintf (msg, sizeof (msg), fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
return queue_message (Default_Error_Queue, msg, _SLERR_MSG_TRACEBACK);
|
||||
}
|
||||
|
||||
void SLang_exit_error (char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
print_queue ();
|
||||
va_start (ap, fmt);
|
||||
if (SLang_Exit_Error_Hook != NULL)
|
||||
{
|
||||
(*SLang_Exit_Error_Hook) (fmt, ap);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
if (fmt != NULL)
|
||||
{
|
||||
vfprintf (stderr, fmt, ap);
|
||||
fputs ("\n", stderr);
|
||||
fflush (stderr);
|
||||
}
|
||||
va_end (ap);
|
||||
|
||||
exit (1);
|
||||
}
|
||||
|
||||
int SLang_set_error (int error)
|
||||
{
|
||||
/* Only allow an error to be cleared (error==0), but not changed
|
||||
* if there already is an error.
|
||||
*/
|
||||
if ((error == 0)
|
||||
|| (_pSLang_Error == 0))
|
||||
_pSLang_Error = error;
|
||||
|
||||
if (_pSLinterpreter_Error_Hook != NULL)
|
||||
(*_pSLinterpreter_Error_Hook) (_pSLang_Error);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SLang_get_error (void)
|
||||
{
|
||||
return _pSLang_Error;
|
||||
}
|
||||
|
||||
void SLang_vmessage (char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
if (fmt == NULL)
|
||||
return;
|
||||
|
||||
va_start (ap, fmt);
|
||||
|
||||
if (SLang_VMessage_Hook != NULL)
|
||||
(*SLang_VMessage_Hook) (fmt, ap);
|
||||
else
|
||||
{
|
||||
vfprintf (stdout, fmt, ap);
|
||||
fputs ("\n", stdout);
|
||||
}
|
||||
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
/* This routine does not queue messages. It is used for tracing, etc. */
|
||||
void _pSLerr_dump_msg (char *fmt, ...)
|
||||
{
|
||||
char buf[1024];
|
||||
va_list ap;
|
||||
|
||||
va_start (ap, fmt);
|
||||
if (SLang_Dump_Routine != NULL)
|
||||
{
|
||||
(void) SLvsnprintf (buf, sizeof (buf), fmt, ap);
|
||||
(*SLang_Dump_Routine) (buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
vfprintf (stderr, fmt, ap);
|
||||
fflush (stderr);
|
||||
}
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
int _pSLerr_init (void)
|
||||
{
|
||||
if (Default_Error_Queue == NULL)
|
||||
{
|
||||
Suspend_Error_Messages = 0;
|
||||
if (NULL == (Default_Error_Queue = create_msg_queue ()))
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (-1 == init_exceptions ())
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void _pSLerr_deinit (void)
|
||||
{
|
||||
deinit_exceptions ();
|
||||
delete_msg_queue (Default_Error_Queue);
|
||||
Suspend_Error_Messages = 0;
|
||||
Default_Error_Queue = NULL;
|
||||
}
|
||||
|
320
slang/slgetkey.c
320
slang/slgetkey.c
@ -1,320 +0,0 @@
|
||||
/*
|
||||
Copyright (C) 2004, 2005, 2006 John E. Davis
|
||||
|
||||
This file is part of the S-Lang Library.
|
||||
|
||||
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
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The S-Lang Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA.
|
||||
*/
|
||||
|
||||
#include "slinclud.h"
|
||||
|
||||
#include "slang.h"
|
||||
#include "_slang.h"
|
||||
|
||||
unsigned int SLang_Input_Buffer_Len = 0;
|
||||
unsigned char SLang_Input_Buffer [SL_MAX_INPUT_BUFFER_LEN];
|
||||
|
||||
int SLang_Abort_Char = 7;
|
||||
int SLang_Ignore_User_Abort = 0;
|
||||
|
||||
/* This has the effect of mapping all characters in the range 128-169 to
|
||||
* ESC [ something
|
||||
*/
|
||||
|
||||
unsigned int SLang_getkey (void)
|
||||
{
|
||||
unsigned int imax;
|
||||
unsigned int ch;
|
||||
|
||||
if (SLang_Input_Buffer_Len)
|
||||
{
|
||||
ch = (unsigned int) *SLang_Input_Buffer;
|
||||
SLang_Input_Buffer_Len--;
|
||||
imax = SLang_Input_Buffer_Len;
|
||||
|
||||
SLMEMCPY ((char *) SLang_Input_Buffer,
|
||||
(char *) (SLang_Input_Buffer + 1), imax);
|
||||
}
|
||||
else if (SLANG_GETKEY_ERROR == (ch = _pSLsys_getkey ())) return ch;
|
||||
|
||||
#if SLANG_MAP_VTXXX_8BIT
|
||||
# if !defined(IBMPC_SYSTEM)
|
||||
if (ch & 0x80)
|
||||
{
|
||||
unsigned char i;
|
||||
i = (unsigned char) (ch & 0x7F);
|
||||
if (i < ' ')
|
||||
{
|
||||
i += 64;
|
||||
SLang_ungetkey (i);
|
||||
ch = 27;
|
||||
}
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
return(ch);
|
||||
}
|
||||
|
||||
int SLang_ungetkey_string (unsigned char *s, unsigned int n)
|
||||
{
|
||||
register unsigned char *bmax, *b, *b1;
|
||||
if (SLang_Input_Buffer_Len + n + 3 > SL_MAX_INPUT_BUFFER_LEN)
|
||||
return -1;
|
||||
|
||||
b = SLang_Input_Buffer;
|
||||
bmax = (b - 1) + SLang_Input_Buffer_Len;
|
||||
b1 = bmax + n;
|
||||
while (bmax >= b) *b1-- = *bmax--;
|
||||
bmax = b + n;
|
||||
while (b < bmax) *b++ = *s++;
|
||||
SLang_Input_Buffer_Len += n;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SLang_buffer_keystring (unsigned char *s, unsigned int n)
|
||||
{
|
||||
|
||||
if (n + SLang_Input_Buffer_Len + 3 > SL_MAX_INPUT_BUFFER_LEN) return -1;
|
||||
|
||||
SLMEMCPY ((char *) SLang_Input_Buffer + SLang_Input_Buffer_Len,
|
||||
(char *) s, n);
|
||||
SLang_Input_Buffer_Len += n;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SLang_ungetkey (unsigned char ch)
|
||||
{
|
||||
return SLang_ungetkey_string(&ch, 1);
|
||||
}
|
||||
|
||||
int SLang_input_pending (int tsecs)
|
||||
{
|
||||
int n;
|
||||
unsigned char c;
|
||||
if (SLang_Input_Buffer_Len) return (int) SLang_Input_Buffer_Len;
|
||||
|
||||
n = _pSLsys_input_pending (tsecs);
|
||||
|
||||
if (n <= 0) return 0;
|
||||
|
||||
c = (unsigned char) SLang_getkey ();
|
||||
SLang_ungetkey_string (&c, 1);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
void SLang_flush_input (void)
|
||||
{
|
||||
int quit = SLKeyBoard_Quit;
|
||||
|
||||
SLang_Input_Buffer_Len = 0;
|
||||
SLKeyBoard_Quit = 0;
|
||||
while (_pSLsys_input_pending (0) > 0)
|
||||
{
|
||||
(void) _pSLsys_getkey ();
|
||||
/* Set this to 0 because _pSLsys_getkey may stuff keyboard buffer if
|
||||
* key sends key sequence (OS/2, DOS, maybe VMS).
|
||||
*/
|
||||
SLang_Input_Buffer_Len = 0;
|
||||
}
|
||||
SLKeyBoard_Quit = quit;
|
||||
}
|
||||
|
||||
#ifdef IBMPC_SYSTEM
|
||||
static int Map_To_ANSI;
|
||||
int SLgetkey_map_to_ansi (int enable)
|
||||
{
|
||||
Map_To_ANSI = enable;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int convert_scancode (unsigned int scan,
|
||||
unsigned int shift,
|
||||
int getkey,
|
||||
unsigned int *ret_key)
|
||||
{
|
||||
unsigned char buf[16];
|
||||
unsigned char *b;
|
||||
unsigned char end;
|
||||
int is_arrow;
|
||||
|
||||
shift &= (_pSLTT_KEY_ALT|_pSLTT_KEY_SHIFT|_pSLTT_KEY_CTRL);
|
||||
|
||||
b = buf;
|
||||
if (_pSLTT_KEY_ALT == shift)
|
||||
{
|
||||
shift = 0;
|
||||
*b++ = 27;
|
||||
}
|
||||
*b++ = 27;
|
||||
*b++ = '[';
|
||||
|
||||
is_arrow = 0;
|
||||
end = '~';
|
||||
if (shift)
|
||||
{
|
||||
if (shift == _pSLTT_KEY_CTRL)
|
||||
end = '^';
|
||||
else if (shift == _pSLTT_KEY_SHIFT)
|
||||
end = '$';
|
||||
else shift = 0;
|
||||
}
|
||||
|
||||
/* These mappings correspond to what rxvt produces under Linux */
|
||||
switch (scan & 0xFF)
|
||||
{
|
||||
default:
|
||||
return -1;
|
||||
|
||||
case 0x47: /* home */
|
||||
*b++ = '1';
|
||||
break;
|
||||
case 0x48: /* up */
|
||||
end = 'A';
|
||||
is_arrow = 1;
|
||||
break;
|
||||
case 0x49: /* PgUp */
|
||||
*b++ = '5';
|
||||
break;
|
||||
case 0x4B: /* Left */
|
||||
end = 'D';
|
||||
is_arrow = 1;
|
||||
break;
|
||||
case 0x4D: /* Right */
|
||||
end = 'C';
|
||||
is_arrow = 1;
|
||||
break;
|
||||
case 0x4F: /* End */
|
||||
*b++ = '4';
|
||||
break;
|
||||
case 0x50: /* Down */
|
||||
end = 'B';
|
||||
is_arrow = 1;
|
||||
break;
|
||||
case 0x51: /* PgDn */
|
||||
*b++ = '6';
|
||||
break;
|
||||
case 0x52: /* Insert */
|
||||
*b++ = '2';
|
||||
break;
|
||||
case 0x53: /* Delete */
|
||||
*b++ = '3';
|
||||
break;
|
||||
case ';': /* F1 */
|
||||
*b++ = '1';
|
||||
*b++ = '1';
|
||||
break;
|
||||
case '<': /* F2 */
|
||||
*b++ = '1';
|
||||
*b++ = '2';
|
||||
break;
|
||||
case '=': /* F3 */
|
||||
*b++ = '1';
|
||||
*b++ = '3';
|
||||
break;
|
||||
|
||||
case '>': /* F4 */
|
||||
*b++ = '1';
|
||||
*b++ = '4';
|
||||
break;
|
||||
|
||||
case '?': /* F5 */
|
||||
*b++ = '1';
|
||||
*b++ = '5';
|
||||
break;
|
||||
|
||||
case '@': /* F6 */
|
||||
*b++ = '1';
|
||||
*b++ = '7';
|
||||
break;
|
||||
|
||||
case 'A': /* F7 */
|
||||
*b++ = '1';
|
||||
*b++ = '8';
|
||||
break;
|
||||
|
||||
case 'B': /* F8 */
|
||||
*b++ = '1';
|
||||
*b++ = '9';
|
||||
break;
|
||||
|
||||
case 'C': /* F9 */
|
||||
*b++ = '2';
|
||||
*b++ = '0';
|
||||
break;
|
||||
|
||||
case 'D': /* F10 */
|
||||
*b++ = '2';
|
||||
*b++ = '1';
|
||||
break;
|
||||
|
||||
case 0x57: /* F11 */
|
||||
*b++ = '2';
|
||||
*b++ = '3';
|
||||
break;
|
||||
|
||||
case 0x58: /* F12 */
|
||||
*b++ = '2';
|
||||
*b++ = '4';
|
||||
break;
|
||||
}
|
||||
|
||||
if (is_arrow && shift)
|
||||
{
|
||||
if (shift == _pSLTT_KEY_CTRL)
|
||||
end &= 0x1F;
|
||||
else
|
||||
end |= 0x20;
|
||||
}
|
||||
*b++ = end;
|
||||
|
||||
if (getkey)
|
||||
{
|
||||
(void) SLang_buffer_keystring (buf + 1, (unsigned int) (b - (buf + 1)));
|
||||
*ret_key = buf[0];
|
||||
return 0;
|
||||
}
|
||||
|
||||
(void) SLang_buffer_keystring (buf, (unsigned int) (b - buf));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
unsigned int _pSLpc_convert_scancode (unsigned int scan,
|
||||
unsigned int shift,
|
||||
int getkey)
|
||||
{
|
||||
unsigned char buf[16];
|
||||
|
||||
if (Map_To_ANSI)
|
||||
{
|
||||
if (0 == convert_scancode (scan, shift, getkey, &scan))
|
||||
return scan;
|
||||
}
|
||||
|
||||
if (getkey)
|
||||
{
|
||||
buf[0] = scan & 0xFF;
|
||||
SLang_buffer_keystring (buf, 1);
|
||||
return (scan >> 8) & 0xFF;
|
||||
}
|
||||
buf[0] = (scan >> 8) & 0xFF;
|
||||
buf[1] = scan & 0xFF;
|
||||
(void) SLang_buffer_keystring (buf, 2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
@ -1,17 +0,0 @@
|
||||
#include "slinclud.h"
|
||||
#include <ctype.h>
|
||||
|
||||
#include "slang.h"
|
||||
#include "_slang.h"
|
||||
|
||||
#define DEFINE_PSLWC_TOLOWER_TABLE
|
||||
#include "sllower.h"
|
||||
|
||||
#define MODE_VARIABLE _pSLinterp_UTF8_Mode
|
||||
SLwchar_Type SLwchar_tolower (SLwchar_Type ch)
|
||||
{
|
||||
if (MODE_VARIABLE)
|
||||
return ch + SL_TOLOWER_LOOKUP(ch);
|
||||
|
||||
return tolower(ch);
|
||||
}
|
162
slang/slmisc.c
162
slang/slmisc.c
@ -1,162 +0,0 @@
|
||||
/*
|
||||
Copyright (C) 2004, 2005, 2006 John E. Davis
|
||||
|
||||
This file is part of the S-Lang Library.
|
||||
|
||||
Trimmed down for use in GNU Midnight Commander.
|
||||
|
||||
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
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The S-Lang Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA.
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include "slinclud.h"
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#include "slang.h"
|
||||
#include "_slang.h"
|
||||
|
||||
|
||||
char *SLmake_string(char *str)
|
||||
{
|
||||
return SLmake_nstring(str, strlen (str));
|
||||
}
|
||||
|
||||
char *SLmake_nstring (char *str, unsigned int n)
|
||||
{
|
||||
char *ptr;
|
||||
|
||||
if (NULL == (ptr = SLmalloc(n + 1)))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
SLMEMCPY (ptr, str, n);
|
||||
ptr[n] = 0;
|
||||
return(ptr);
|
||||
}
|
||||
|
||||
/*
|
||||
* This function assumes that the initial \ char has been removed.
|
||||
*/
|
||||
char *_pSLexpand_escaped_char(char *p, SLwchar_Type *ch, int *isunicodep)
|
||||
{
|
||||
int i = 0;
|
||||
SLwchar_Type max = 0;
|
||||
SLwchar_Type num, base = 0;
|
||||
SLwchar_Type ch1;
|
||||
int isunicode;
|
||||
int needs_brace;
|
||||
|
||||
ch1 = *p++;
|
||||
isunicode = 0;
|
||||
needs_brace = 0;
|
||||
|
||||
switch (ch1)
|
||||
{
|
||||
default: num = ch1; break;
|
||||
case 'n': num = '\n'; break;
|
||||
case 't': num = '\t'; break;
|
||||
case 'v': num = '\v'; break;
|
||||
case 'b': num = '\b'; break;
|
||||
case 'r': num = '\r'; break;
|
||||
case 'f': num = '\f'; break;
|
||||
case 'E': case 'e': num = 27; break;
|
||||
case 'a': num = 7;
|
||||
break;
|
||||
|
||||
/* octal */
|
||||
case '0': case '1': case '2': case '3':
|
||||
case '4': case '5': case '6': case '7':
|
||||
max = '7';
|
||||
base = 8; i = 2; num = ch1 - '0';
|
||||
break;
|
||||
|
||||
case 'd': /* decimal -- S-Lang extension */
|
||||
base = 10;
|
||||
i = 3;
|
||||
max = '9';
|
||||
num = 0;
|
||||
break;
|
||||
|
||||
case 'u':
|
||||
isunicode = 1;
|
||||
/* drop */
|
||||
case 'x': /* hex */
|
||||
base = 16;
|
||||
max = '9';
|
||||
i = 2;
|
||||
num = 0;
|
||||
|
||||
if (*p == '{')
|
||||
{
|
||||
p++;
|
||||
i = 0;
|
||||
while (p[i] && (p[i] != '}'))
|
||||
i++;
|
||||
if (p[i] != '}')
|
||||
{
|
||||
SLang_verror (SL_SYNTAX_ERROR, "Escaped character missing closing }.");
|
||||
return NULL;
|
||||
}
|
||||
/* The meaning of \x{...} is mode dependent. If in UTF-8 mode, then
|
||||
* \x{...} always generates a unicode character. Otherwise, the
|
||||
* meaning of \x{...} depends upon the number of characters enclosed
|
||||
* by the brace. If there are less than 3, then assume no unicode.
|
||||
* If greater than or equal to 3, then assume unicode.
|
||||
*/
|
||||
if (isunicode == 0) /* \x... */
|
||||
isunicode = _pSLinterp_UTF8_Mode || (i > 2);
|
||||
needs_brace = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
while (i)
|
||||
{
|
||||
ch1 = *p;
|
||||
|
||||
i--;
|
||||
|
||||
if ((ch1 <= max) && (ch1 >= '0'))
|
||||
{
|
||||
num = base * num + (ch1 - '0');
|
||||
}
|
||||
else if (base == 16)
|
||||
{
|
||||
ch1 |= 0x20;
|
||||
if ((ch1 < 'a') || ((ch1 > 'f'))) break;
|
||||
num = base * num + 10 + (ch1 - 'a');
|
||||
}
|
||||
else break;
|
||||
p++;
|
||||
}
|
||||
|
||||
if (needs_brace)
|
||||
{
|
||||
if (*p != '}')
|
||||
{
|
||||
SLang_verror (SL_SYNTAX_ERROR, "Malformed escaped character.");
|
||||
return NULL;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
|
||||
if (isunicodep != NULL)
|
||||
*isunicodep = isunicode;
|
||||
|
||||
*ch = num;
|
||||
return p;
|
||||
}
|
351
slang/slsignal.c
351
slang/slsignal.c
@ -1,351 +0,0 @@
|
||||
/*
|
||||
Copyright (C) 2004, 2005, 2006 John E. Davis
|
||||
|
||||
This file is part of the S-Lang Library.
|
||||
|
||||
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
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The S-Lang Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA.
|
||||
*/
|
||||
|
||||
#include "slinclud.h"
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_WAIT_H
|
||||
# include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include "slang.h"
|
||||
#include "_slang.h"
|
||||
|
||||
/* Do not trust these environments */
|
||||
#if defined(__MINGW32__) || defined(AMIGA)
|
||||
# ifdef SLANG_POSIX_SIGNALS
|
||||
# undef SLANG_POSIX_SIGNALS
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* This function will cause system calls to be restarted after signal if possible */
|
||||
SLSig_Fun_Type *SLsignal (int sig, SLSig_Fun_Type *f)
|
||||
{
|
||||
#if defined(SLANG_POSIX_SIGNALS)
|
||||
struct sigaction old_sa, new_sa;
|
||||
|
||||
# ifdef SIGALRM
|
||||
/* We want system calls to be interrupted by SIGALRM. */
|
||||
if (sig == SIGALRM) return SLsignal_intr (sig, f);
|
||||
# endif
|
||||
|
||||
sigemptyset (&new_sa.sa_mask);
|
||||
new_sa.sa_handler = f;
|
||||
|
||||
new_sa.sa_flags = 0;
|
||||
# ifdef SA_RESTART
|
||||
new_sa.sa_flags |= SA_RESTART;
|
||||
# endif
|
||||
|
||||
if (-1 == sigaction (sig, &new_sa, &old_sa))
|
||||
return (SLSig_Fun_Type *) SIG_ERR;
|
||||
|
||||
return old_sa.sa_handler;
|
||||
#else
|
||||
/* Not POSIX. */
|
||||
return signal (sig, f);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* This function will NOT cause system calls to be restarted after
|
||||
* signal if possible
|
||||
*/
|
||||
SLSig_Fun_Type *SLsignal_intr (int sig, SLSig_Fun_Type *f)
|
||||
{
|
||||
#ifdef SLANG_POSIX_SIGNALS
|
||||
struct sigaction old_sa, new_sa;
|
||||
|
||||
sigemptyset (&new_sa.sa_mask);
|
||||
new_sa.sa_handler = f;
|
||||
|
||||
new_sa.sa_flags = 0;
|
||||
# ifdef SA_INTERRUPT
|
||||
new_sa.sa_flags |= SA_INTERRUPT;
|
||||
# endif
|
||||
|
||||
if (-1 == sigaction (sig, &new_sa, &old_sa))
|
||||
return (SLSig_Fun_Type *) SIG_ERR;
|
||||
|
||||
return old_sa.sa_handler;
|
||||
#else
|
||||
/* Not POSIX. */
|
||||
return signal (sig, f);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* We are primarily interested in blocking signals that would cause the
|
||||
* application to reset the tty. These include suspend signals and
|
||||
* possibly interrupt signals.
|
||||
*/
|
||||
#ifdef SLANG_POSIX_SIGNALS
|
||||
static sigset_t Old_Signal_Mask;
|
||||
#endif
|
||||
|
||||
static volatile unsigned int Blocked_Depth;
|
||||
|
||||
int SLsig_block_signals (void)
|
||||
{
|
||||
#ifdef SLANG_POSIX_SIGNALS
|
||||
sigset_t new_mask;
|
||||
#endif
|
||||
|
||||
Blocked_Depth++;
|
||||
if (Blocked_Depth != 1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef SLANG_POSIX_SIGNALS
|
||||
sigemptyset (&new_mask);
|
||||
# ifdef SIGQUIT
|
||||
sigaddset (&new_mask, SIGQUIT);
|
||||
# endif
|
||||
# ifdef SIGTSTP
|
||||
sigaddset (&new_mask, SIGTSTP);
|
||||
# endif
|
||||
# ifdef SIGINT
|
||||
sigaddset (&new_mask, SIGINT);
|
||||
# endif
|
||||
# ifdef SIGTTIN
|
||||
sigaddset (&new_mask, SIGTTIN);
|
||||
# endif
|
||||
# ifdef SIGTTOU
|
||||
sigaddset (&new_mask, SIGTTOU);
|
||||
# endif
|
||||
# ifdef SIGWINCH
|
||||
sigaddset (&new_mask, SIGWINCH);
|
||||
# endif
|
||||
|
||||
(void) sigprocmask (SIG_BLOCK, &new_mask, &Old_Signal_Mask);
|
||||
return 0;
|
||||
#else
|
||||
/* Not implemented. */
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
int SLsig_unblock_signals (void)
|
||||
{
|
||||
if (Blocked_Depth == 0)
|
||||
return -1;
|
||||
|
||||
Blocked_Depth--;
|
||||
|
||||
if (Blocked_Depth != 0)
|
||||
return 0;
|
||||
|
||||
#ifdef SLANG_POSIX_SIGNALS
|
||||
(void) sigprocmask (SIG_SETMASK, &Old_Signal_Mask, NULL);
|
||||
return 0;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef MSWINDOWS
|
||||
int SLsystem (char *cmd)
|
||||
{
|
||||
SLang_verror (SL_NOT_IMPLEMENTED, "system not implemented");
|
||||
return -1;
|
||||
}
|
||||
|
||||
#else
|
||||
int SLsystem (char *cmd)
|
||||
{
|
||||
#ifdef SLANG_POSIX_SIGNALS
|
||||
pid_t pid;
|
||||
int status;
|
||||
struct sigaction ignore;
|
||||
# ifdef SIGINT
|
||||
struct sigaction save_intr;
|
||||
# endif
|
||||
# ifdef SIGQUIT
|
||||
struct sigaction save_quit;
|
||||
# endif
|
||||
# ifdef SIGCHLD
|
||||
sigset_t child_mask, save_mask;
|
||||
# endif
|
||||
|
||||
if (cmd == NULL) return 1;
|
||||
|
||||
ignore.sa_handler = SIG_IGN;
|
||||
sigemptyset (&ignore.sa_mask);
|
||||
ignore.sa_flags = 0;
|
||||
|
||||
# ifdef SIGINT
|
||||
if (-1 == sigaction (SIGINT, &ignore, &save_intr))
|
||||
return -1;
|
||||
# endif
|
||||
|
||||
# ifdef SIGQUIT
|
||||
if (-1 == sigaction (SIGQUIT, &ignore, &save_quit))
|
||||
{
|
||||
(void) sigaction (SIGINT, &save_intr, NULL);
|
||||
return -1;
|
||||
}
|
||||
# endif
|
||||
|
||||
# ifdef SIGCHLD
|
||||
sigemptyset (&child_mask);
|
||||
sigaddset (&child_mask, SIGCHLD);
|
||||
if (-1 == sigprocmask (SIG_BLOCK, &child_mask, &save_mask))
|
||||
{
|
||||
# ifdef SIGINT
|
||||
(void) sigaction (SIGINT, &save_intr, NULL);
|
||||
# endif
|
||||
# ifdef SIGQUIT
|
||||
(void) sigaction (SIGQUIT, &save_quit, NULL);
|
||||
# endif
|
||||
return -1;
|
||||
}
|
||||
# endif
|
||||
|
||||
pid = fork();
|
||||
|
||||
if (pid == -1)
|
||||
status = -1;
|
||||
else if (pid == 0)
|
||||
{
|
||||
/* Child */
|
||||
# ifdef SIGINT
|
||||
(void) sigaction (SIGINT, &save_intr, NULL);
|
||||
# endif
|
||||
# ifdef SIGQUIT
|
||||
(void) sigaction (SIGQUIT, &save_quit, NULL);
|
||||
# endif
|
||||
# ifdef SIGCHLD
|
||||
(void) sigprocmask (SIG_SETMASK, &save_mask, NULL);
|
||||
# endif
|
||||
|
||||
execl ("/bin/sh", "sh", "-c", cmd, NULL);
|
||||
_exit (127);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* parent */
|
||||
while (-1 == waitpid (pid, &status, 0))
|
||||
{
|
||||
# ifdef EINTR
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
# endif
|
||||
# ifdef ERESTARTSYS
|
||||
if (errno == ERESTARTSYS)
|
||||
continue;
|
||||
# endif
|
||||
status = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
# ifdef SIGINT
|
||||
if (-1 == sigaction (SIGINT, &save_intr, NULL))
|
||||
status = -1;
|
||||
# endif
|
||||
# ifdef SIGQUIT
|
||||
if (-1 == sigaction (SIGQUIT, &save_quit, NULL))
|
||||
status = -1;
|
||||
# endif
|
||||
# ifdef SIGCHLD
|
||||
if (-1 == sigprocmask (SIG_SETMASK, &save_mask, NULL))
|
||||
status = -1;
|
||||
# endif
|
||||
|
||||
return status;
|
||||
|
||||
#else /* No POSIX Signals */
|
||||
# ifdef SIGINT
|
||||
void (*sint)(int);
|
||||
# endif
|
||||
# ifdef SIGQUIT
|
||||
void (*squit)(int);
|
||||
# endif
|
||||
int status;
|
||||
|
||||
# ifdef SIGQUIT
|
||||
squit = SLsignal (SIGQUIT, SIG_IGN);
|
||||
# endif
|
||||
# ifdef SIGINT
|
||||
sint = SLsignal (SIGINT, SIG_IGN);
|
||||
# endif
|
||||
status = system (cmd);
|
||||
# ifdef SIGINT
|
||||
SLsignal (SIGINT, sint);
|
||||
# endif
|
||||
# ifdef SIGQUIT
|
||||
SLsignal (SIGQUIT, squit);
|
||||
# endif
|
||||
return status;
|
||||
#endif /* POSIX_SIGNALS */
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#include <windows.h>
|
||||
static int msw_system (char *cmd)
|
||||
{
|
||||
STARTUPINFO startup_info;
|
||||
PROCESS_INFORMATION process_info;
|
||||
int status;
|
||||
|
||||
if (cmd == NULL) return -1;
|
||||
|
||||
memset ((char *) &startup_info, 0, sizeof (STARTUPINFO));
|
||||
startup_info.cb = sizeof(STARTUPINFO);
|
||||
startup_info.dwFlags = STARTF_USESHOWWINDOW;
|
||||
startup_info.wShowWindow = SW_SHOWDEFAULT;
|
||||
|
||||
if (FALSE == CreateProcess (NULL,
|
||||
cmd,
|
||||
NULL,
|
||||
NULL,
|
||||
FALSE,
|
||||
NORMAL_PRIORITY_CLASS|CREATE_NEW_CONSOLE,
|
||||
NULL,
|
||||
NULL,
|
||||
&startup_info,
|
||||
&process_info))
|
||||
{
|
||||
SLang_verror (0, "%s: CreateProcess failed.", cmd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
status = -1;
|
||||
|
||||
if (0xFFFFFFFFUL != WaitForSingleObject (process_info.hProcess, INFINITE))
|
||||
{
|
||||
DWORD exit_code;
|
||||
|
||||
if (TRUE == GetExitCodeProcess (process_info.hProcess, &exit_code))
|
||||
status = (int) exit_code;
|
||||
}
|
||||
|
||||
CloseHandle (process_info.hThread);
|
||||
CloseHandle (process_info.hProcess);
|
||||
|
||||
return status;
|
||||
}
|
||||
#endif
|
2165
slang/slsmg.c
2165
slang/slsmg.c
File diff suppressed because it is too large
Load Diff
692
slang/slstring.c
692
slang/slstring.c
@ -1,692 +0,0 @@
|
||||
/*
|
||||
Copyright (C) 2004, 2005, 2006 John E. Davis
|
||||
|
||||
This file is part of the S-Lang Library.
|
||||
|
||||
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
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The S-Lang Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA.
|
||||
*/
|
||||
|
||||
#include "slinclud.h"
|
||||
|
||||
#include "slang.h"
|
||||
#include "_slang.h"
|
||||
|
||||
typedef struct _pSLstring_Type
|
||||
{
|
||||
struct _pSLstring_Type *next;
|
||||
unsigned int ref_count;
|
||||
unsigned long hash;
|
||||
unsigned int len;
|
||||
char bytes [1];
|
||||
}
|
||||
SLstring_Type;
|
||||
|
||||
#define MAP_HASH_TO_INDEX(hash) ((hash) % SLSTRING_HASH_TABLE_SIZE)
|
||||
|
||||
static SLstring_Type *String_Hash_Table [SLSTRING_HASH_TABLE_SIZE];
|
||||
static char Single_Char_Strings [256 * 2];
|
||||
|
||||
#if SLANG_OPTIMIZE_FOR_SPEED
|
||||
#define MAX_FREE_STORE_LEN 32
|
||||
static SLstring_Type *SLS_Free_Store [MAX_FREE_STORE_LEN];
|
||||
|
||||
# define NUM_CACHED_STRINGS 601
|
||||
typedef struct
|
||||
{
|
||||
SLstring_Type *sls;
|
||||
char *str;
|
||||
}
|
||||
Cached_String_Type;
|
||||
static char *Deleted_String = "*deleted*";
|
||||
static Cached_String_Type Cached_Strings [NUM_CACHED_STRINGS];
|
||||
|
||||
#define GET_CACHED_STRING(s) \
|
||||
(Cached_Strings + (unsigned int)(((unsigned long) (s)) % NUM_CACHED_STRINGS))
|
||||
|
||||
|
||||
_INLINE_
|
||||
static void cache_string (SLstring_Type *sls)
|
||||
{
|
||||
Cached_String_Type *cs;
|
||||
|
||||
cs = GET_CACHED_STRING(sls->bytes);
|
||||
cs->str = sls->bytes;
|
||||
cs->sls = sls;
|
||||
}
|
||||
|
||||
_INLINE_
|
||||
static void uncache_string (char *s)
|
||||
{
|
||||
Cached_String_Type *cs;
|
||||
|
||||
cs = GET_CACHED_STRING(s);
|
||||
if (cs->str == s)
|
||||
{
|
||||
cs->sls = NULL;
|
||||
cs->str = Deleted_String;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if USE_NEW_HASH_CODE
|
||||
/* This hash algorithm comes from:
|
||||
*
|
||||
* Bob Jenkins, 1996. bob_jenkins@burtleburtle.net.
|
||||
* You may use this code any way you wish, private, educational, or commercial. It's free.
|
||||
* See http://burtleburtle.net/bob/hash/evahash.html
|
||||
*/
|
||||
|
||||
typedef unsigned long uint32;
|
||||
|
||||
#define mix(a,b,c) \
|
||||
{ \
|
||||
a -= b; a -= c; a ^= (c>>13); \
|
||||
b -= c; b -= a; b ^= (a<<8); \
|
||||
c -= a; c -= b; c ^= (b>>13); \
|
||||
a -= b; a -= c; a ^= (c>>12); \
|
||||
b -= c; b -= a; b ^= (a<<16); \
|
||||
c -= a; c -= b; c ^= (b>>5); \
|
||||
a -= b; a -= c; a ^= (c>>3); \
|
||||
b -= c; b -= a; b ^= (a<<10); \
|
||||
c -= a; c -= b; c ^= (b>>15); \
|
||||
}
|
||||
|
||||
_INLINE_
|
||||
unsigned long _pSLstring_hash (unsigned char *s, unsigned char *smax)
|
||||
{
|
||||
register uint32 a,b,c;
|
||||
unsigned int length = (unsigned int)(smax - s);
|
||||
unsigned int len = length;
|
||||
|
||||
a = b = 0x9e3779b9; /* the golden ratio; an arbitrary value */
|
||||
c = 0;
|
||||
|
||||
/*---------------------------------------- handle most of the key */
|
||||
while (len >= 12)
|
||||
{
|
||||
a += (s[0] +((uint32)s[1]<<8) +((uint32)s[2]<<16) +((uint32)s[3]<<24));
|
||||
b += (s[4] +((uint32)s[5]<<8) +((uint32)s[6]<<16) +((uint32)s[7]<<24));
|
||||
c += (s[8] +((uint32)s[9]<<8) +((uint32)s[10]<<16)+((uint32)s[11]<<24));
|
||||
mix(a,b,c);
|
||||
s += 12; len -= 12;
|
||||
}
|
||||
|
||||
/*------------------------------------- handle the last 11 bytes */
|
||||
c += length;
|
||||
switch(len) /* all the case statements fall through */
|
||||
{
|
||||
case 11: c+=((uint32)s[10]<<24);
|
||||
case 10: c+=((uint32)s[9]<<16);
|
||||
case 9 : c+=((uint32)s[8]<<8);
|
||||
/* the first byte of c is reserved for the length */
|
||||
case 8 : b+=((uint32)s[7]<<24);
|
||||
case 7 : b+=((uint32)s[6]<<16);
|
||||
case 6 : b+=((uint32)s[5]<<8);
|
||||
case 5 : b+=s[4];
|
||||
case 4 : a+=((uint32)s[3]<<24);
|
||||
case 3 : a+=((uint32)s[2]<<16);
|
||||
case 2 : a+=((uint32)s[1]<<8);
|
||||
case 1 : a+=s[0];
|
||||
/* case 0: nothing left to add */
|
||||
}
|
||||
mix(a,b,c);
|
||||
/*-------------------------------------------- report the result */
|
||||
return (unsigned long) c;
|
||||
}
|
||||
#else
|
||||
_INLINE_
|
||||
unsigned long _pSLstring_hash (unsigned char *s, unsigned char *smax)
|
||||
{
|
||||
register unsigned long h = 0;
|
||||
register unsigned long sum = 0;
|
||||
unsigned char *smax4;
|
||||
|
||||
smax4 = smax - 4;
|
||||
|
||||
while (s < smax4)
|
||||
{
|
||||
sum += s[0];
|
||||
h = sum + (h << 1);
|
||||
sum += s[1];
|
||||
h = sum + (h << 1);
|
||||
sum += s[2];
|
||||
h = sum + (h << 1);
|
||||
sum += s[3];
|
||||
h = sum + (h << 1);
|
||||
|
||||
s += 4;
|
||||
}
|
||||
|
||||
while (s < smax)
|
||||
{
|
||||
sum += *s++;
|
||||
h ^= sum + (h << 3); /* slightly different */
|
||||
}
|
||||
|
||||
return h;
|
||||
}
|
||||
#endif
|
||||
unsigned long _pSLcompute_string_hash (char *s)
|
||||
{
|
||||
#if SLANG_OPTIMIZE_FOR_SPEED
|
||||
Cached_String_Type *cs;
|
||||
|
||||
cs = GET_CACHED_STRING(s);
|
||||
if (cs->str == s)
|
||||
return cs->sls->hash;
|
||||
#endif
|
||||
return _pSLstring_hash ((unsigned char *) s, (unsigned char *) s + strlen (s));
|
||||
}
|
||||
|
||||
_INLINE_
|
||||
/* This routine works with any (long) string */
|
||||
static SLstring_Type *find_string (char *s, unsigned int len, unsigned long hash)
|
||||
{
|
||||
SLstring_Type *sls;
|
||||
|
||||
sls = String_Hash_Table [(unsigned int) MAP_HASH_TO_INDEX(hash)];
|
||||
|
||||
if (sls == NULL)
|
||||
return NULL;
|
||||
|
||||
do
|
||||
{
|
||||
/* Note that we need to actually make sure that bytes[len] == 0.
|
||||
* In this case, it is not enough to just compare pointers. In fact,
|
||||
* this is called from create_nstring, etc... It is unlikely that the
|
||||
* pointer is a slstring
|
||||
*/
|
||||
if ((sls->hash == hash)
|
||||
&& (sls->len == len)
|
||||
&& (0 == strncmp (s, sls->bytes, len)))
|
||||
break;
|
||||
|
||||
sls = sls->next;
|
||||
}
|
||||
while (sls != NULL);
|
||||
|
||||
return sls;
|
||||
}
|
||||
|
||||
_INLINE_
|
||||
static SLstring_Type *find_slstring (char *s, unsigned long hash)
|
||||
{
|
||||
SLstring_Type *sls;
|
||||
|
||||
sls = String_Hash_Table [MAP_HASH_TO_INDEX(hash)];
|
||||
while (sls != NULL)
|
||||
{
|
||||
if (s == sls->bytes)
|
||||
return sls;
|
||||
|
||||
sls = sls->next;
|
||||
}
|
||||
return sls;
|
||||
}
|
||||
|
||||
_INLINE_
|
||||
static SLstring_Type *allocate_sls (unsigned int len)
|
||||
{
|
||||
SLstring_Type *sls;
|
||||
#if SLANG_OPTIMIZE_FOR_SPEED
|
||||
|
||||
if ((len < MAX_FREE_STORE_LEN)
|
||||
&& (NULL != (sls = SLS_Free_Store [len])))
|
||||
{
|
||||
SLS_Free_Store[len] = NULL;
|
||||
return sls;
|
||||
}
|
||||
#endif
|
||||
/* FIXME: use structure padding */
|
||||
sls = (SLstring_Type *) SLmalloc (len + sizeof (SLstring_Type));
|
||||
if (sls != NULL)
|
||||
sls->len = len;
|
||||
return sls;
|
||||
}
|
||||
|
||||
_INLINE_
|
||||
static void free_sls (SLstring_Type *sls)
|
||||
{
|
||||
#if SLANG_OPTIMIZE_FOR_SPEED
|
||||
unsigned int len = sls->len;
|
||||
if ((len < MAX_FREE_STORE_LEN)
|
||||
&& (SLS_Free_Store[len] == NULL))
|
||||
{
|
||||
SLS_Free_Store [len] = sls;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
SLfree ((char *)sls);
|
||||
}
|
||||
|
||||
_INLINE_
|
||||
static char *create_long_string (char *s, unsigned int len, unsigned long hash)
|
||||
{
|
||||
SLstring_Type *sls;
|
||||
|
||||
sls = find_string (s, len, hash);
|
||||
|
||||
if (sls != NULL)
|
||||
{
|
||||
sls->ref_count++;
|
||||
#if SLANG_OPTIMIZE_FOR_SPEED
|
||||
cache_string (sls);
|
||||
#endif
|
||||
return sls->bytes;
|
||||
}
|
||||
|
||||
sls = allocate_sls (len);
|
||||
if (sls == NULL)
|
||||
return NULL;
|
||||
|
||||
strncpy (sls->bytes, s, len);
|
||||
sls->bytes[len] = 0;
|
||||
sls->ref_count = 1;
|
||||
sls->hash = hash;
|
||||
#if SLANG_OPTIMIZE_FOR_SPEED
|
||||
cache_string (sls);
|
||||
#endif
|
||||
|
||||
hash = MAP_HASH_TO_INDEX(hash);
|
||||
sls->next = String_Hash_Table [(unsigned int)hash];
|
||||
String_Hash_Table [(unsigned int)hash] = sls;
|
||||
|
||||
return sls->bytes;
|
||||
}
|
||||
|
||||
_INLINE_
|
||||
static char *create_short_string (char *s, unsigned int len)
|
||||
{
|
||||
char ch;
|
||||
|
||||
/* Note: if len is 0, then it does not matter what *s is. This is
|
||||
* important for SLang_create_nslstring.
|
||||
*/
|
||||
if (len) ch = *s; else ch = 0;
|
||||
|
||||
len = 2 * (unsigned int) ((unsigned char) ch);
|
||||
Single_Char_Strings [len] = ch;
|
||||
Single_Char_Strings [len + 1] = 0;
|
||||
return Single_Char_Strings + len;
|
||||
}
|
||||
|
||||
/* s cannot be NULL */
|
||||
_INLINE_
|
||||
static SLstr_Type *create_nstring (char *s, unsigned int len, unsigned long *hash_ptr)
|
||||
{
|
||||
unsigned long hash;
|
||||
|
||||
if (len < 2)
|
||||
return create_short_string (s, len);
|
||||
|
||||
hash = _pSLstring_hash ((unsigned char *) s, (unsigned char *) (s + len));
|
||||
*hash_ptr = hash;
|
||||
|
||||
return create_long_string (s, len, hash);
|
||||
}
|
||||
|
||||
SLstr_Type *SLang_create_nslstring (char *s, unsigned int len)
|
||||
{
|
||||
unsigned long hash;
|
||||
if (s == NULL)
|
||||
return NULL;
|
||||
return create_nstring (s, len, &hash);
|
||||
}
|
||||
|
||||
char *_pSLstring_make_hashed_string (char *s, unsigned int len, unsigned long *hashptr)
|
||||
{
|
||||
unsigned long hash;
|
||||
|
||||
if (s == NULL) return NULL;
|
||||
|
||||
hash = _pSLstring_hash ((unsigned char *) s, (unsigned char *) s + len);
|
||||
*hashptr = hash;
|
||||
|
||||
if (len < 2)
|
||||
return create_short_string (s, len);
|
||||
|
||||
return create_long_string (s, len, hash);
|
||||
}
|
||||
|
||||
char *_pSLstring_dup_hashed_string (char *s, unsigned long hash)
|
||||
{
|
||||
unsigned int len;
|
||||
#if SLANG_OPTIMIZE_FOR_SPEED
|
||||
Cached_String_Type *cs;
|
||||
|
||||
if (s == NULL) return NULL;
|
||||
if (s[0] == 0)
|
||||
return create_short_string (s, 0);
|
||||
if (s[1] == 0)
|
||||
return create_short_string (s, 1);
|
||||
|
||||
cs = GET_CACHED_STRING(s);
|
||||
if (cs->str == s)
|
||||
{
|
||||
cs->sls->ref_count += 1;
|
||||
return s;
|
||||
}
|
||||
#else
|
||||
if (s == NULL) return NULL;
|
||||
#endif
|
||||
|
||||
len = strlen (s);
|
||||
#if !SLANG_OPTIMIZE_FOR_SPEED
|
||||
if (len < 2) return create_short_string (s, len);
|
||||
#endif
|
||||
|
||||
return create_long_string (s, len, hash);
|
||||
}
|
||||
|
||||
/* This function requires an slstring!!! */
|
||||
char *_pSLstring_dup_slstring (char *s)
|
||||
{
|
||||
SLstring_Type *sls;
|
||||
#if SLANG_OPTIMIZE_FOR_SPEED
|
||||
Cached_String_Type *cs;
|
||||
#endif
|
||||
|
||||
if (s == NULL)
|
||||
return s;
|
||||
#if SLANG_OPTIMIZE_FOR_SPEED
|
||||
cs = GET_CACHED_STRING(s);
|
||||
if (cs->str == s)
|
||||
{
|
||||
cs->sls->ref_count += 1;
|
||||
return s;
|
||||
}
|
||||
#endif
|
||||
if ((s[0] == 0) || (s[1] == 0))
|
||||
return s;
|
||||
|
||||
sls = (SLstring_Type *) (s - offsetof(SLstring_Type,bytes[0]));
|
||||
sls->ref_count++;
|
||||
#if SLANG_OPTIMIZE_FOR_SPEED
|
||||
cache_string (sls);
|
||||
#endif
|
||||
return s;
|
||||
}
|
||||
|
||||
static void free_sls_string (SLstring_Type *sls)
|
||||
{
|
||||
SLstring_Type *sls1, *prev;
|
||||
unsigned long hash = sls->hash;
|
||||
|
||||
hash = MAP_HASH_TO_INDEX(hash);
|
||||
|
||||
sls1 = String_Hash_Table [(unsigned int) hash];
|
||||
|
||||
prev = NULL;
|
||||
|
||||
/* This should not fail. */
|
||||
while (sls1 != sls)
|
||||
{
|
||||
prev = sls1;
|
||||
sls1 = sls1->next;
|
||||
}
|
||||
|
||||
if (prev != NULL)
|
||||
prev->next = sls->next;
|
||||
else
|
||||
String_Hash_Table [(unsigned int) hash] = sls->next;
|
||||
|
||||
free_sls (sls);
|
||||
}
|
||||
|
||||
_INLINE_
|
||||
static void free_long_string (char *s, unsigned long hash)
|
||||
{
|
||||
SLstring_Type *sls;
|
||||
|
||||
if (NULL == (sls = find_slstring (s, hash)))
|
||||
{
|
||||
SLang_verror (SL_APPLICATION_ERROR, "invalid attempt to free string:%s", s);
|
||||
return;
|
||||
}
|
||||
|
||||
sls->ref_count--;
|
||||
if (sls->ref_count != 0)
|
||||
{
|
||||
#if SLANG_OPTIMIZE_FOR_SPEED
|
||||
/* cache_string (sls, len, hash); */
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
#if SLANG_OPTIMIZE_FOR_SPEED
|
||||
uncache_string (s);
|
||||
#endif
|
||||
free_sls_string (sls);
|
||||
}
|
||||
|
||||
/* This routine may be passed NULL-- it is not an error. */
|
||||
void SLang_free_slstring (char *s)
|
||||
{
|
||||
unsigned long hash;
|
||||
unsigned int len;
|
||||
#if SLANG_OPTIMIZE_FOR_SPEED
|
||||
Cached_String_Type *cs;
|
||||
#endif
|
||||
|
||||
if (s == NULL) return;
|
||||
|
||||
#if SLANG_OPTIMIZE_FOR_SPEED
|
||||
cs = GET_CACHED_STRING(s);
|
||||
if (cs->str == s)
|
||||
{
|
||||
SLstring_Type *sls = cs->sls;
|
||||
if (sls->ref_count <= 1)
|
||||
{
|
||||
#if SLANG_OPTIMIZE_FOR_SPEED
|
||||
cs->sls = NULL;
|
||||
cs->str = Deleted_String;
|
||||
#endif
|
||||
free_sls_string (sls);
|
||||
}
|
||||
else
|
||||
sls->ref_count -= 1;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((len = strlen (s)) < 2)
|
||||
return;
|
||||
|
||||
hash = _pSLstring_hash ((unsigned char *)s, (unsigned char *) s + len);
|
||||
free_long_string (s, hash);
|
||||
}
|
||||
|
||||
char *SLang_create_slstring (char *s)
|
||||
{
|
||||
unsigned long hash;
|
||||
#if SLANG_OPTIMIZE_FOR_SPEED
|
||||
Cached_String_Type *cs;
|
||||
#endif
|
||||
|
||||
if (s == NULL) return NULL;
|
||||
#if SLANG_OPTIMIZE_FOR_SPEED
|
||||
cs = GET_CACHED_STRING(s);
|
||||
if (cs->str == s)
|
||||
{
|
||||
cs->sls->ref_count += 1;
|
||||
return s;
|
||||
}
|
||||
#endif
|
||||
|
||||
return create_nstring (s, strlen (s), &hash);
|
||||
}
|
||||
|
||||
void _pSLfree_hashed_string (char *s, unsigned int len, unsigned long hash)
|
||||
{
|
||||
if ((s == NULL) || (len < 2)) return;
|
||||
free_long_string (s, hash);
|
||||
}
|
||||
|
||||
|
||||
char *_pSLallocate_slstring (unsigned int len)
|
||||
{
|
||||
SLstring_Type *sls = allocate_sls (len);
|
||||
if (sls == NULL)
|
||||
return NULL;
|
||||
|
||||
sls->hash = 0;
|
||||
return sls->bytes;
|
||||
}
|
||||
|
||||
void _pSLunallocate_slstring (char *s, unsigned int len)
|
||||
{
|
||||
SLstring_Type *sls;
|
||||
|
||||
(void) len;
|
||||
if (s == NULL)
|
||||
return;
|
||||
|
||||
sls = (SLstring_Type *) (s - offsetof(SLstring_Type,bytes[0]));
|
||||
free_sls (sls);
|
||||
}
|
||||
|
||||
char *_pSLcreate_via_alloced_slstring (char *s, unsigned int len)
|
||||
{
|
||||
unsigned long hash;
|
||||
SLstring_Type *sls;
|
||||
|
||||
if (s == NULL)
|
||||
return NULL;
|
||||
|
||||
if (len < 2)
|
||||
{
|
||||
char *s1 = create_short_string (s, len);
|
||||
_pSLunallocate_slstring (s, len);
|
||||
return s1;
|
||||
}
|
||||
|
||||
/* s is not going to be in the cache because when it was malloced, its
|
||||
* value was unknown. This simplifies the coding.
|
||||
*/
|
||||
hash = _pSLstring_hash ((unsigned char *)s, (unsigned char *)s + len);
|
||||
sls = find_string (s, len, hash);
|
||||
if (sls != NULL)
|
||||
{
|
||||
sls->ref_count++;
|
||||
_pSLunallocate_slstring (s, len);
|
||||
s = sls->bytes;
|
||||
|
||||
#if SLANG_OPTIMIZE_FOR_SPEED
|
||||
cache_string (sls);
|
||||
#endif
|
||||
return s;
|
||||
}
|
||||
|
||||
sls = (SLstring_Type *) (s - offsetof(SLstring_Type,bytes[0]));
|
||||
sls->ref_count = 1;
|
||||
sls->hash = hash;
|
||||
|
||||
#if SLANG_OPTIMIZE_FOR_SPEED
|
||||
cache_string (sls);
|
||||
#endif
|
||||
|
||||
hash = MAP_HASH_TO_INDEX(hash);
|
||||
sls->next = String_Hash_Table [(unsigned int)hash];
|
||||
String_Hash_Table [(unsigned int)hash] = sls;
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
/* Note, a and b may be ordinary strings. The result is an slstring */
|
||||
char *SLang_concat_slstrings (char *a, char *b)
|
||||
{
|
||||
unsigned int lena, len;
|
||||
char *c;
|
||||
|
||||
lena = strlen (a);
|
||||
len = lena + strlen (b);
|
||||
|
||||
c = _pSLallocate_slstring (len);
|
||||
if (c == NULL)
|
||||
return NULL;
|
||||
|
||||
strcpy (c, a);
|
||||
strcpy (c + lena, b);
|
||||
|
||||
return _pSLcreate_via_alloced_slstring (c, len);
|
||||
}
|
||||
|
||||
/* This routine is assumed to work even if s is not an slstring */
|
||||
unsigned int _pSLstring_bytelen (SLstr_Type *s)
|
||||
{
|
||||
#if SLANG_OPTIMIZE_FOR_SPEED
|
||||
Cached_String_Type *cs;
|
||||
|
||||
cs = GET_CACHED_STRING(s);
|
||||
if (cs->str == s)
|
||||
return cs->sls->len;
|
||||
#endif
|
||||
return strlen (s);
|
||||
}
|
||||
|
||||
/* The caller must ensure that this is an slstring */
|
||||
void _pSLang_free_slstring (SLstr_Type *s)
|
||||
{
|
||||
#if SLANG_OPTIMIZE_FOR_SPEED
|
||||
Cached_String_Type *cs;
|
||||
#endif
|
||||
SLstring_Type *sls;
|
||||
|
||||
if (s == NULL) return;
|
||||
|
||||
#if SLANG_OPTIMIZE_FOR_SPEED
|
||||
cs = GET_CACHED_STRING(s);
|
||||
if (cs->str == s)
|
||||
{
|
||||
sls = cs->sls;
|
||||
if (sls->ref_count <= 1)
|
||||
{
|
||||
#if SLANG_OPTIMIZE_FOR_SPEED
|
||||
cs->sls = NULL;
|
||||
cs->str = Deleted_String;
|
||||
#endif
|
||||
free_sls_string (sls);
|
||||
}
|
||||
else
|
||||
sls->ref_count -= 1;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((s[0] == 0) || (s[1] == 0))
|
||||
return;
|
||||
|
||||
sls = (SLstring_Type *) (s - offsetof(SLstring_Type,bytes[0]));
|
||||
if (sls->ref_count > 1)
|
||||
{
|
||||
sls->ref_count--;
|
||||
return;
|
||||
}
|
||||
free_long_string (s, sls->hash);
|
||||
}
|
||||
|
||||
/* An SLstring is required */
|
||||
unsigned long _pSLstring_get_hash (SLstr_Type *s)
|
||||
{
|
||||
SLstring_Type *sls;
|
||||
|
||||
if (s[0] == 0)
|
||||
return _pSLstring_hash ((unsigned char*)s, (unsigned char *)s);
|
||||
if (s[1] == 0)
|
||||
return _pSLstring_hash ((unsigned char *)s, (unsigned char *)s+1);
|
||||
|
||||
sls = (SLstring_Type *) (s - offsetof(SLstring_Type,bytes[0]));
|
||||
return sls->hash;
|
||||
}
|
1204
slang/sltermin.c
1204
slang/sltermin.c
File diff suppressed because it is too large
Load Diff
@ -1,18 +0,0 @@
|
||||
#include "slinclud.h"
|
||||
#include <ctype.h>
|
||||
|
||||
#include "slang.h"
|
||||
#include "_slang.h"
|
||||
|
||||
#define DEFINE_PSLWC_TOUPPER_TABLE
|
||||
#include "slupper.h"
|
||||
|
||||
|
||||
#define MODE_VARIABLE _pSLinterp_UTF8_Mode
|
||||
SLwchar_Type SLwchar_toupper (SLwchar_Type ch)
|
||||
{
|
||||
if (MODE_VARIABLE)
|
||||
return ch + SL_TOUPPER_LOOKUP(ch);
|
||||
|
||||
return toupper (ch);
|
||||
}
|
841
slang/slutf8.c
841
slang/slutf8.c
@ -1,841 +0,0 @@
|
||||
#include "slinclud.h"
|
||||
#include <string.h>
|
||||
|
||||
#include "slang.h"
|
||||
#include "_slang.h"
|
||||
|
||||
static unsigned char Len_Map[256] =
|
||||
{
|
||||
0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* - 31 */
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* - 63 */
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* - 95 */
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* - 127 */
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* - 159 */
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* - 191 */
|
||||
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, /* - 223 */
|
||||
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,6,6,1,1 /* - 255 */
|
||||
};
|
||||
|
||||
/*
|
||||
* Also note that the code positions U+D800 to U+DFFF (UTF-16 surrogates)
|
||||
* as well as U+FFFE and U+FFFF must not occur in normal UTF-8 or UCS-4
|
||||
* data. UTF-8 decoders should treat them like malformed or overlong
|
||||
* sequences for safety reasons.
|
||||
*/
|
||||
#define IS_ILLEGAL_UNICODE(w) \
|
||||
(((w >= 0xD800) && (w <= 0xDFFF)) || (w == 0xFFFE) || (w == 0xFFFF))
|
||||
|
||||
_INLINE_
|
||||
static int is_invalid_or_overlong_utf8 (SLuchar_Type *u, unsigned int len)
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned char ch, ch1;
|
||||
|
||||
/* Check for invalid sequences */
|
||||
for (i = 1; i < len; i++)
|
||||
{
|
||||
if ((u[i] & 0xC0) != 0x80)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Illegal (overlong) sequences */
|
||||
/* 1100000x (10xxxxxx) */
|
||||
/* 11100000 100xxxxx (10xxxxxx) */
|
||||
/* 11110000 1000xxxx (10xxxxxx 10xxxxxx) */
|
||||
/* 11111000 10000xxx (10xxxxxx 10xxxxxx 10xxxxxx) */
|
||||
/* 11111100 100000xx (10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx) */
|
||||
ch = *u;
|
||||
if ((ch == 0xC0) || (ch == 0xC1))
|
||||
return 1;
|
||||
|
||||
ch1 = u[1];
|
||||
if (((ch1 & ch) == 0x80)
|
||||
&& ((ch == 0xE0)
|
||||
|| (ch == 0xF0)
|
||||
|| (ch == 0xF8)
|
||||
|| (ch == 0xFC)))
|
||||
return 1;
|
||||
|
||||
if (len == 3)
|
||||
{
|
||||
/* D800 is encoded as 0xED 0xA0 0x80 and DFFF as 0xED 0xBF 0xBF */
|
||||
if ((ch == 0xED)
|
||||
&& ((ch1 >= 0xA0) && (ch1 <= 0xBF))
|
||||
&& (u[2] >= 0x80) && (u[2] <= 0xBF))
|
||||
return 1;
|
||||
/* Now FFFE and FFFF */
|
||||
if ((ch == 0xEF)
|
||||
&& (ch1 == 0xBF)
|
||||
&& ((u[2] == 0xBE) || (u[2] == 0xBF)))
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* This function assumes that the necessary checks have been made to ensure
|
||||
* a valid UTF-8 encoded character is present.
|
||||
*/
|
||||
_INLINE_
|
||||
static SLwchar_Type fast_utf8_decode (SLuchar_Type *u, unsigned int len)
|
||||
{
|
||||
static unsigned char masks[7] =
|
||||
{
|
||||
0, 0, 0x1F, 0xF, 0x7, 0x3, 0x1
|
||||
};
|
||||
SLuchar_Type *umax;
|
||||
SLwchar_Type w;
|
||||
|
||||
w = (*u & masks[len]);
|
||||
umax = u + len;
|
||||
u++;
|
||||
while (u < umax)
|
||||
{
|
||||
w = (w << 6)| (u[0] & 0x3F);
|
||||
u++;
|
||||
}
|
||||
return w;
|
||||
}
|
||||
|
||||
unsigned char *SLutf8_skip_char (unsigned char *s, unsigned char *smax)
|
||||
{
|
||||
unsigned int len;
|
||||
|
||||
if (s >= smax)
|
||||
return s;
|
||||
|
||||
len = Len_Map[*s];
|
||||
if (len <= 1)
|
||||
return s+1;
|
||||
|
||||
if (s + len > smax)
|
||||
return s+1;
|
||||
|
||||
if (is_invalid_or_overlong_utf8 (s, len))
|
||||
return s + 1;
|
||||
|
||||
return s + len;
|
||||
}
|
||||
|
||||
SLuchar_Type *SLutf8_skip_chars (SLuchar_Type *s, SLuchar_Type *smax,
|
||||
unsigned int num, unsigned int *dnum,
|
||||
int ignore_combining)
|
||||
{
|
||||
unsigned int n;
|
||||
|
||||
n = 0;
|
||||
while ((n < num) && (s < smax))
|
||||
{
|
||||
unsigned int len = Len_Map[*s];
|
||||
|
||||
if (len <= 1)
|
||||
{
|
||||
n++;
|
||||
s++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (s + len > smax)
|
||||
{
|
||||
s++;
|
||||
n++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (is_invalid_or_overlong_utf8 (s, len))
|
||||
{
|
||||
s++;
|
||||
n++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ignore_combining)
|
||||
{
|
||||
SLwchar_Type w = fast_utf8_decode (s, len);
|
||||
if (0 != SLwchar_wcwidth (w))
|
||||
n++;
|
||||
s += len;
|
||||
continue;
|
||||
}
|
||||
|
||||
n++;
|
||||
s += len;
|
||||
}
|
||||
|
||||
if (ignore_combining)
|
||||
{
|
||||
while (s < smax)
|
||||
{
|
||||
SLwchar_Type w;
|
||||
unsigned int nconsumed;
|
||||
if (NULL == SLutf8_decode (s, smax, &w, &nconsumed))
|
||||
break;
|
||||
|
||||
if (0 != SLwchar_wcwidth (w))
|
||||
break;
|
||||
|
||||
s += nconsumed;
|
||||
}
|
||||
}
|
||||
|
||||
if (dnum != NULL)
|
||||
*dnum = n;
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
SLuchar_Type *SLutf8_bskip_chars (SLuchar_Type *smin, SLuchar_Type *s,
|
||||
unsigned int num, unsigned int *dnum,
|
||||
int ignore_combining)
|
||||
{
|
||||
unsigned int n;
|
||||
SLuchar_Type *smax = s;
|
||||
|
||||
n = 0;
|
||||
while ((n < num) && (s > smin))
|
||||
{
|
||||
unsigned char ch;
|
||||
unsigned int dn;
|
||||
|
||||
s--;
|
||||
ch = *s;
|
||||
if (ch < 0x80)
|
||||
{
|
||||
n++;
|
||||
smax = s;
|
||||
continue;
|
||||
}
|
||||
|
||||
dn = 0;
|
||||
while ((s != smin)
|
||||
&& (Len_Map[ch] == 0)
|
||||
&& (dn < SLUTF8_MAX_MBLEN))
|
||||
{
|
||||
s--;
|
||||
ch = *s;
|
||||
dn++;
|
||||
}
|
||||
|
||||
if (ch <= 0xBF)
|
||||
{
|
||||
/* Invalid sequence */
|
||||
n++;
|
||||
smax--;
|
||||
s = smax;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ch > 0xBF)
|
||||
{
|
||||
SLwchar_Type w;
|
||||
SLuchar_Type *s1;
|
||||
|
||||
if ((NULL == (s1 = SLutf8_decode (s, smax, &w, NULL)))
|
||||
|| (s1 != smax))
|
||||
{
|
||||
/* This means we backed up over an invalid sequence */
|
||||
dn = (unsigned int) (smax - s);
|
||||
n++;
|
||||
smax--;
|
||||
s = smax;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((ignore_combining == 0)
|
||||
|| (0 != SLwchar_wcwidth (w)))
|
||||
n++;
|
||||
|
||||
smax = s;
|
||||
}
|
||||
}
|
||||
|
||||
if (dnum != NULL)
|
||||
*dnum = n;
|
||||
return s;
|
||||
}
|
||||
|
||||
SLuchar_Type *SLutf8_bskip_char (SLuchar_Type *smin, SLuchar_Type *s)
|
||||
{
|
||||
if (s > smin)
|
||||
{
|
||||
unsigned int dn;
|
||||
|
||||
s--;
|
||||
if (*s >= 0x80)
|
||||
s = SLutf8_bskip_chars (smin, s+1, 1, &dn, 0);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
/* This function counts the number of wide characters in a UTF-8 encoded
|
||||
* string. Each byte in an invalid sequence is counted as a single character.
|
||||
* If the string contains illegal values, the bytes making up the character is
|
||||
* counted as 1 character.
|
||||
*/
|
||||
unsigned int SLutf8_strlen (SLuchar_Type *s, int ignore_combining)
|
||||
{
|
||||
unsigned int count, len;
|
||||
|
||||
if (s == NULL)
|
||||
return 0;
|
||||
|
||||
len = strlen ((char *)s);
|
||||
(void) SLutf8_skip_chars (s, s + len, len, &count, ignore_combining);
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This function returns NULL if the input does not correspond to a valid
|
||||
* UTF-8 sequence, otherwise, it returns the position of the next character
|
||||
* in the sequence.
|
||||
*/
|
||||
unsigned char *SLutf8_decode (unsigned char *u, unsigned char *umax,
|
||||
SLwchar_Type *wp, unsigned int *nconsumedp)
|
||||
{
|
||||
unsigned int len;
|
||||
unsigned char ch;
|
||||
SLwchar_Type w;
|
||||
|
||||
if (u >= umax)
|
||||
{
|
||||
*wp = 0;
|
||||
if (nconsumedp != NULL)
|
||||
*nconsumedp = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*wp = ch = *u;
|
||||
if (ch < 0x80)
|
||||
{
|
||||
if (nconsumedp != NULL) *nconsumedp = 1;
|
||||
return u+1;
|
||||
}
|
||||
|
||||
len = Len_Map[ch];
|
||||
if (len < 2)
|
||||
{
|
||||
/* should not happen--- code here for completeness */
|
||||
if (nconsumedp != NULL) *nconsumedp = 1;
|
||||
return NULL;
|
||||
}
|
||||
if (u + len > umax)
|
||||
{
|
||||
if (nconsumedp != NULL) *nconsumedp = 1; /* (unsigned int) (umax - u); */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (is_invalid_or_overlong_utf8 (u, len))
|
||||
{
|
||||
if (nconsumedp != NULL)
|
||||
*nconsumedp = 1;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (nconsumedp != NULL)
|
||||
*nconsumedp = len;
|
||||
|
||||
*wp = w = fast_utf8_decode (u, len);
|
||||
|
||||
if (IS_ILLEGAL_UNICODE(w))
|
||||
return NULL;
|
||||
|
||||
return u + len;
|
||||
}
|
||||
|
||||
|
||||
/* Encode the wide character returning a pointer to the end of the
|
||||
* utf8 of the encoded multi-byte character. This function will also encode
|
||||
* illegal unicode values. It returns NULL if buflen is too small.
|
||||
* Otherwise, it returns a pointer at the end of the last encoded byte.
|
||||
* It does not null terminate the encoded string.
|
||||
*/
|
||||
SLuchar_Type *SLutf8_encode (SLwchar_Type w, SLuchar_Type *u, unsigned int ulen)
|
||||
{
|
||||
SLuchar_Type *umax = u + ulen;
|
||||
|
||||
/* U-00000000 - U-0000007F: 0xxxxxxx */
|
||||
if (w <= 0x7F)
|
||||
{
|
||||
if (u >= umax)
|
||||
return NULL;
|
||||
|
||||
*u++ = (unsigned char) w;
|
||||
return u;
|
||||
}
|
||||
|
||||
/* U-00000080 - U-000007FF: 110xxxxx 10xxxxxx */
|
||||
if (w <= 0x7FF)
|
||||
{
|
||||
if ((u + 1) >= umax)
|
||||
return NULL;
|
||||
|
||||
*u++ = (w >> 6) | 0xC0;
|
||||
*u++ = (w & 0x3F) | 0x80;
|
||||
return u;
|
||||
}
|
||||
|
||||
/* First bad character starts at 0xD800 */
|
||||
|
||||
/* Allow illegal values to be encoded */
|
||||
|
||||
/*
|
||||
*if (IS_ILLEGAL_UNICODE(w))
|
||||
* return NULL;
|
||||
*/
|
||||
|
||||
/* U-00000800 - U-0000FFFF: 1110xxxx 10xxxxxx 10xxxxxx */
|
||||
if (w <= 0xFFFF)
|
||||
{
|
||||
if (u+2 >= umax)
|
||||
return NULL;
|
||||
*u++ = (w >> 12 ) | 0xE0;
|
||||
goto finish_2;
|
||||
}
|
||||
|
||||
/* U-00010000 - U-001FFFFF: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */
|
||||
if (w <= 0x1FFFFF)
|
||||
{
|
||||
if (u+3 >= umax)
|
||||
return NULL;
|
||||
*u++ = (w >> 18) | 0xF0;
|
||||
goto finish_3;
|
||||
}
|
||||
|
||||
/* U-00200000 - U-03FFFFFF: 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx */
|
||||
if (w <= 0x3FFFFFF)
|
||||
{
|
||||
if (u+4 >= umax)
|
||||
return NULL;
|
||||
*u++ = (w >> 24) | 0xF8;
|
||||
goto finish_4;
|
||||
}
|
||||
|
||||
/* U-04000000 - U-7FFFFFFF: 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx */
|
||||
if (w <= 0x7FFFFFFF)
|
||||
{
|
||||
if (u+5 >= umax)
|
||||
return NULL;
|
||||
*u++ = (w >> 30) | 0xFC;
|
||||
goto finish_5;
|
||||
}
|
||||
|
||||
/* unreached?? */
|
||||
return NULL;
|
||||
|
||||
finish_5: *u++ = ((w >> 24) & 0x3F)|0x80;
|
||||
finish_4: *u++ = ((w >> 18) & 0x3F)|0x80;
|
||||
finish_3: *u++ = ((w >> 12) & 0x3F)|0x80;
|
||||
finish_2: *u++ = ((w >> 6) & 0x3F)|0x80;
|
||||
*u++ = (w & 0x3F)|0x80;
|
||||
|
||||
return u;
|
||||
}
|
||||
|
||||
/* Like SLutf8_encode, but null terminates the result.
|
||||
* At least SLUTF8_MAX_MBLEN+1 bytes assumed.
|
||||
*/
|
||||
SLuchar_Type *SLutf8_encode_null_terminate (SLwchar_Type w, SLuchar_Type *u)
|
||||
{
|
||||
SLuchar_Type *p;
|
||||
|
||||
p = SLutf8_encode (w, u, SLUTF8_MAX_MBLEN);
|
||||
if (p != NULL)
|
||||
*p = 0;
|
||||
return p;
|
||||
}
|
||||
|
||||
#if 0
|
||||
int SLutf8_decode_bytes (SLuchar_Type *u, SLuchar_Type *umax,
|
||||
unsigned char *b, unsigned int *np)
|
||||
{
|
||||
unsigned char *bmax;
|
||||
|
||||
bmax = b;
|
||||
while (u < umax)
|
||||
{
|
||||
SLwchar_Type w;
|
||||
|
||||
if (0 == (*u & 0x80))
|
||||
{
|
||||
*bmax++ = *u++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (NULL == (u = SLutf8_decode (u, umax, &w, NULL)))
|
||||
return -1; /* FIXME: HANDLE ERROR */
|
||||
|
||||
if (w > 0xFF)
|
||||
{
|
||||
#if 0
|
||||
sprintf (bmax, "<U+%04X>", w);
|
||||
bmax += strlen (bmax);
|
||||
continue;
|
||||
#endif
|
||||
/* FIXME: HANDLE ERROR */
|
||||
w = w & 0xFF;
|
||||
}
|
||||
|
||||
*bmax++ = w;
|
||||
}
|
||||
*np = bmax - b;
|
||||
*bmax = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* UTF-8 Encode the bytes between b and bmax storing the results in the
|
||||
* buffer defined by u and umax, returning the position following the
|
||||
* last encoded character. Upon return, *np is set to the number of bytes
|
||||
* sucessfully encoded.
|
||||
*/
|
||||
SLuchar_Type *SLutf8_encode_bytes (unsigned char *b, unsigned char *bmax,
|
||||
SLuchar_Type *u, unsigned int ulen,
|
||||
unsigned int *np)
|
||||
{
|
||||
unsigned char *bstart = b;
|
||||
SLuchar_Type *umax = u + ulen;
|
||||
|
||||
while (b < bmax)
|
||||
{
|
||||
SLuchar_Type *u1;
|
||||
|
||||
if (0 == (*b & 0x80))
|
||||
{
|
||||
if (u >= umax)
|
||||
break;
|
||||
|
||||
*u++ = *b++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (NULL == (u1 = SLutf8_encode (*b, u, umax - u)))
|
||||
break;
|
||||
u = u1;
|
||||
b++;
|
||||
}
|
||||
|
||||
*np = b - bstart;
|
||||
if (u < umax)
|
||||
*u = 0;
|
||||
|
||||
return u;
|
||||
}
|
||||
#endif
|
||||
|
||||
static SLuchar_Type *xform_utf8 (SLuchar_Type *u, SLuchar_Type *umax,
|
||||
SLwchar_Type (*fun)(SLwchar_Type))
|
||||
{
|
||||
SLuchar_Type *buf, *p;
|
||||
unsigned int malloced_len, len;
|
||||
|
||||
if (umax < u)
|
||||
return NULL;
|
||||
|
||||
len = 0;
|
||||
p = buf = NULL;
|
||||
malloced_len = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
SLwchar_Type w;
|
||||
SLuchar_Type *u1;
|
||||
unsigned int nconsumed;
|
||||
|
||||
if (malloced_len <= len + SLUTF8_MAX_MBLEN)
|
||||
{
|
||||
SLuchar_Type *newbuf;
|
||||
malloced_len += 1 + (umax - u) + SLUTF8_MAX_MBLEN;
|
||||
|
||||
newbuf = (SLuchar_Type *)SLrealloc ((char *)buf, malloced_len);
|
||||
if (newbuf == NULL)
|
||||
{
|
||||
SLfree ((char *)buf);
|
||||
return NULL;
|
||||
}
|
||||
buf = newbuf;
|
||||
p = buf + len;
|
||||
}
|
||||
|
||||
if (u >= umax)
|
||||
{
|
||||
*p = 0;
|
||||
p = (SLuchar_Type *) SLang_create_nslstring ((char *)buf, len);
|
||||
SLfree ((char *)buf);
|
||||
return p;
|
||||
}
|
||||
|
||||
if (NULL == (u1 = SLutf8_decode (u, umax, &w, &nconsumed)))
|
||||
{
|
||||
/* Invalid sequence */
|
||||
memcpy ((char *) p, u, nconsumed);
|
||||
p += nconsumed;
|
||||
len += nconsumed;
|
||||
u1 = u + nconsumed;
|
||||
}
|
||||
else
|
||||
{
|
||||
SLuchar_Type *p1;
|
||||
|
||||
p1 = SLutf8_encode ((*fun)(w), p, malloced_len);
|
||||
if (p1 == NULL)
|
||||
{
|
||||
SLfree ((char *)buf);
|
||||
SLang_verror (SL_INTERNAL_ERROR, "SLutf8_encode returned NULL");
|
||||
return NULL;
|
||||
}
|
||||
len += p1 - p;
|
||||
p = p1;
|
||||
}
|
||||
|
||||
u = u1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Returned an uppercased version of an UTF-8 encoded string. Illegal or
|
||||
* invalid sequences will be returned as-is. This function returns
|
||||
* an SLstring.
|
||||
*/
|
||||
SLuchar_Type *SLutf8_strup (SLuchar_Type *u, SLuchar_Type *umax)
|
||||
{
|
||||
return xform_utf8 (u, umax, SLwchar_toupper);
|
||||
}
|
||||
|
||||
/* Returned an lowercased version of an UTF-8 encoded string. Illegal or
|
||||
* invalid sequences will be returned as-is. This function returns
|
||||
* an SLstring.
|
||||
*/
|
||||
SLuchar_Type *SLutf8_strlo (SLuchar_Type *u, SLuchar_Type *umax)
|
||||
{
|
||||
return xform_utf8 (u, umax, SLwchar_tolower);
|
||||
}
|
||||
|
||||
int SLutf8_compare (SLuchar_Type *a, SLuchar_Type *amax,
|
||||
SLuchar_Type *b, SLuchar_Type *bmax,
|
||||
unsigned int nchars,
|
||||
int cs)
|
||||
{
|
||||
while (nchars && (a < amax) && (b < bmax))
|
||||
{
|
||||
SLwchar_Type cha, chb;
|
||||
unsigned int na, nb;
|
||||
int aok, bok;
|
||||
|
||||
if (*a < 0x80)
|
||||
{
|
||||
cha = (SLwchar_Type) *a++;
|
||||
aok = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
aok = (NULL != SLutf8_decode (a, amax, &cha, &na));
|
||||
a += na;
|
||||
}
|
||||
|
||||
if (*b < 0x80)
|
||||
{
|
||||
chb = (SLwchar_Type) *b++;
|
||||
bok = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
bok = (NULL != SLutf8_decode (b, bmax, &chb, &nb));
|
||||
b += nb;
|
||||
}
|
||||
|
||||
nchars--;
|
||||
|
||||
if (aok && bok)
|
||||
{
|
||||
if (cs == 0)
|
||||
{
|
||||
cha = SLwchar_toupper (cha);
|
||||
chb = SLwchar_toupper (chb);
|
||||
}
|
||||
}
|
||||
else if (aok)
|
||||
return 1;
|
||||
else if (bok)
|
||||
return -1;
|
||||
|
||||
if (cha == chb)
|
||||
continue;
|
||||
|
||||
if (cha > chb)
|
||||
return 1;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (nchars == 0)
|
||||
return 0;
|
||||
|
||||
if ((a >= amax) && (b >= bmax))
|
||||
return 0;
|
||||
|
||||
if (b >= bmax)
|
||||
return 1;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/* Returns an SLstring */
|
||||
SLstr_Type *SLutf8_subst_wchar (SLuchar_Type *u, SLuchar_Type *umax,
|
||||
SLwchar_Type wch, unsigned int pos,
|
||||
int ignore_combining)
|
||||
{
|
||||
SLuchar_Type *a, *a1, *b;
|
||||
unsigned int dpos;
|
||||
SLuchar_Type buf[SLUTF8_MAX_MBLEN+1];
|
||||
SLstr_Type *c;
|
||||
unsigned int n1, n2, n3, len;
|
||||
|
||||
a = SLutf8_skip_chars (u, umax, pos, &dpos, ignore_combining);
|
||||
|
||||
if ((dpos != pos) || (a == umax))
|
||||
{
|
||||
SLang_verror (SL_INDEX_ERROR, "Specified character position is invalid for string");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
a1 = SLutf8_skip_chars (a, umax, 1, NULL, ignore_combining);
|
||||
|
||||
b = SLutf8_encode (wch, buf, SLUTF8_MAX_MBLEN);
|
||||
if (b == NULL)
|
||||
{
|
||||
SLang_verror (SL_UNICODE_ERROR, "Unable to encode wchar 0x%lX", (unsigned long)wch);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
n1 = (a-u);
|
||||
n2 = (b-buf);
|
||||
n3 = (umax-a1);
|
||||
len = n1 + n2 + n3;
|
||||
c = _pSLallocate_slstring (len);
|
||||
if (c == NULL)
|
||||
return NULL;
|
||||
|
||||
memcpy (c, (char *)u, n1);
|
||||
memcpy (c+n1, (char *)buf, n2);
|
||||
memcpy (c+n1+n2, (char *)a1, n3);
|
||||
c[len] = 0;
|
||||
|
||||
/* No need to worry about this failing-- it frees its argument */
|
||||
return _pSLcreate_via_alloced_slstring (c, len);
|
||||
}
|
||||
|
||||
|
||||
/* utf8 buffer assumed to be at least SLUTF8_MAX_MBLEN+1 bytes. Result will be
|
||||
* null terminated. Returns position of NEXT character.
|
||||
* Analogous to: *p++
|
||||
*/
|
||||
SLuchar_Type *SLutf8_extract_utf8_char (SLuchar_Type *u,
|
||||
SLuchar_Type *umax,
|
||||
SLuchar_Type *utf8)
|
||||
{
|
||||
SLuchar_Type *u1;
|
||||
|
||||
u1 = SLutf8_skip_char (u, umax);
|
||||
memcpy ((char *)utf8, u, u1-u);
|
||||
utf8[u1-u] = 0;
|
||||
|
||||
return u1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* These routines depend upon the value of the _pSLinterp_UTF8_Mode variable.
|
||||
* They also generate slang errors upon error.
|
||||
*/
|
||||
SLuchar_Type *_pSLinterp_decode_wchar (SLuchar_Type *u,
|
||||
SLuchar_Type *umax,
|
||||
SLwchar_Type *chp)
|
||||
{
|
||||
if (_pSLinterp_UTF8_Mode == 0)
|
||||
{
|
||||
if (u < umax)
|
||||
*chp = (SLwchar_Type) *u++;
|
||||
return u;
|
||||
}
|
||||
|
||||
if (NULL == (u = SLutf8_decode (u, umax, chp, NULL)))
|
||||
SLang_verror (SL_INVALID_UTF8, "Invalid UTF-8 encoded string");
|
||||
|
||||
return u;
|
||||
}
|
||||
|
||||
/* At least SLUTF8_MAX_MBLEN+1 bytes assumed-- null terminates result.
|
||||
* Upon success, it returns a pointer to the _end_ of the encoded character
|
||||
*/
|
||||
SLuchar_Type *_pSLinterp_encode_wchar (SLwchar_Type wch, SLuchar_Type *u, unsigned int *encoded_len)
|
||||
{
|
||||
SLuchar_Type *u1;
|
||||
|
||||
if (_pSLinterp_UTF8_Mode == 0)
|
||||
{
|
||||
*encoded_len = 1;
|
||||
*u++ = (SLuchar_Type) wch;
|
||||
*u++ = 0;
|
||||
return u;
|
||||
}
|
||||
|
||||
if (NULL == (u1 = SLutf8_encode_null_terminate (wch, u)))
|
||||
{
|
||||
SLang_verror (SL_UNICODE_ERROR, "Unable to encode character 0x%lX", (unsigned long)wch);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*encoded_len = (unsigned int) (u1 - u);
|
||||
return u1;
|
||||
}
|
||||
|
||||
#ifdef REGRESSION
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
unsigned char *s, *smax;
|
||||
char **t;
|
||||
char *ok_tests [] =
|
||||
{
|
||||
"퟿",
|
||||
"",
|
||||
"�",
|
||||
"ô<EFBFBD>¿¿",
|
||||
"ô<EFBFBD>€€",
|
||||
NULL
|
||||
};
|
||||
char *long_tests [] =
|
||||
{
|
||||
"À¯",
|
||||
"à€¯",
|
||||
"ð€€¯",
|
||||
"ø€€€¯",
|
||||
"ü€€€€¯",
|
||||
NULL
|
||||
};
|
||||
|
||||
t = long_tests;
|
||||
while ((s = (unsigned char *) *t++) != NULL)
|
||||
{
|
||||
smax = s + strlen ((char *)s);
|
||||
|
||||
while (s < smax)
|
||||
{
|
||||
SLwchar_Type w;
|
||||
|
||||
if (NULL == (s = SLutf8_to_wc (s, smax, &w)))
|
||||
{
|
||||
fprintf (stderr, "SLutf8_to_wc failed\n");
|
||||
break;
|
||||
}
|
||||
if (w == 0)
|
||||
break;
|
||||
fprintf (stdout, " 0x%X", w);
|
||||
}
|
||||
|
||||
fprintf (stdout, "\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
618
slang/slutty.c
618
slang/slutty.c
@ -1,618 +0,0 @@
|
||||
/* slutty.c --- Unix Low level terminal (tty) functions for S-Lang */
|
||||
/*
|
||||
Copyright (C) 2004, 2005, 2006 John E. Davis
|
||||
|
||||
This file is part of the S-Lang Library.
|
||||
|
||||
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
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The S-Lang Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA.
|
||||
*/
|
||||
|
||||
#include "slinclud.h"
|
||||
|
||||
#include <signal.h>
|
||||
/* sequent support thanks to Kenneth Lorber <keni@oasys.dt.navy.mil> */
|
||||
/* SYSV (SYSV ISC R3.2 v3.0) provided by iain.lea@erlm.siemens.de */
|
||||
|
||||
#if defined (_AIX) && !defined (_ALL_SOURCE)
|
||||
# define _ALL_SOURCE /* so NBBY is defined in <sys/types.h> */
|
||||
#endif
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef SYSV
|
||||
# include <fcntl.h>
|
||||
# ifndef CRAY
|
||||
# include <sys/termio.h>
|
||||
# include <sys/stream.h>
|
||||
# include <sys/ptem.h>
|
||||
# include <sys/tty.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __BEOS__
|
||||
/* Prototype for select */
|
||||
# include <net/socket.h>
|
||||
#endif
|
||||
|
||||
#include <sys/file.h>
|
||||
|
||||
#ifndef sun
|
||||
# include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#ifdef __QNX__
|
||||
# include <sys/select.h>
|
||||
#endif
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
|
||||
#if defined (_AIX) && !defined (FD_SET)
|
||||
# include <sys/select.h> /* for FD_ISSET, FD_SET, FD_ZERO */
|
||||
#endif
|
||||
|
||||
#ifndef O_RDWR
|
||||
# include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#include "slang.h"
|
||||
#include "_slang.h"
|
||||
|
||||
int SLang_TT_Read_FD = -1;
|
||||
int SLang_TT_Baud_Rate;
|
||||
|
||||
#ifdef HAVE_TERMIOS_H
|
||||
# if !defined(HAVE_TCGETATTR) || !defined(HAVE_TCSETATTR)
|
||||
# undef HAVE_TERMIOS_H
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_TERMIOS_H
|
||||
|
||||
# if !defined(CBREAK) && defined(sun)
|
||||
# ifndef BSD_COMP
|
||||
# define BSD_COMP 1
|
||||
# endif
|
||||
# include <sys/ioctl.h>
|
||||
# endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
struct tchars t;
|
||||
struct ltchars lt;
|
||||
struct sgttyb s;
|
||||
}
|
||||
TTY_Termio_Type;
|
||||
#else
|
||||
# include <termios.h>
|
||||
typedef struct termios TTY_Termio_Type;
|
||||
#endif
|
||||
|
||||
static TTY_Termio_Type Old_TTY;
|
||||
|
||||
#ifdef HAVE_TERMIOS_H
|
||||
typedef SLCONST struct
|
||||
{
|
||||
unsigned int key;
|
||||
unsigned int value;
|
||||
} Baud_Rate_Type;
|
||||
|
||||
static Baud_Rate_Type Baud_Rates [] =
|
||||
{
|
||||
#ifdef B0
|
||||
{B0, 0},
|
||||
#endif
|
||||
#ifdef B50
|
||||
{B50, 50},
|
||||
#endif
|
||||
#ifdef B75
|
||||
{B75, 75},
|
||||
#endif
|
||||
#ifdef B110
|
||||
{B110, 110},
|
||||
#endif
|
||||
#ifdef B134
|
||||
{B134, 134},
|
||||
#endif
|
||||
#ifdef B150
|
||||
{B150, 150},
|
||||
#endif
|
||||
#ifdef B200
|
||||
{B200, 200},
|
||||
#endif
|
||||
#ifdef B300
|
||||
{B300, 300},
|
||||
#endif
|
||||
#ifdef B600
|
||||
{B600, 600},
|
||||
#endif
|
||||
#ifdef B1200
|
||||
{B1200, 1200},
|
||||
#endif
|
||||
#ifdef B1800
|
||||
{B1800, 1800},
|
||||
#endif
|
||||
#ifdef B2400
|
||||
{B2400, 2400},
|
||||
#endif
|
||||
#ifdef B4800
|
||||
{B4800, 4800},
|
||||
#endif
|
||||
#ifdef B9600
|
||||
{B9600, 9600},
|
||||
#endif
|
||||
#ifdef B19200
|
||||
{B19200, 19200},
|
||||
#endif
|
||||
#ifdef B38400
|
||||
{B38400, 38400},
|
||||
#endif
|
||||
#ifdef B57600
|
||||
{B57600, 57600},
|
||||
#endif
|
||||
#ifdef B115200
|
||||
{B115200, 115200},
|
||||
#endif
|
||||
#ifdef B230400
|
||||
{B230400, 230400},
|
||||
#endif
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
static void
|
||||
set_baud_rate (TTY_Termio_Type *tty)
|
||||
{
|
||||
#ifdef HAVE_CFGETOSPEED
|
||||
unsigned int speed;
|
||||
Baud_Rate_Type *b, *bmax;
|
||||
|
||||
if (SLang_TT_Baud_Rate)
|
||||
return; /* already set */
|
||||
|
||||
speed = (unsigned int) cfgetospeed (tty);
|
||||
|
||||
b = Baud_Rates;
|
||||
bmax = b + (sizeof (Baud_Rates)/sizeof(Baud_Rates[0]));
|
||||
while (b < bmax)
|
||||
{
|
||||
if (b->key == speed)
|
||||
{
|
||||
SLang_TT_Baud_Rate = b->value;
|
||||
return;
|
||||
}
|
||||
b++;
|
||||
}
|
||||
#else
|
||||
(void) tty;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* HAVE_TERMIOS_H */
|
||||
|
||||
#ifdef HAVE_TERMIOS_H
|
||||
# define GET_TERMIOS(fd, x) tcgetattr(fd, x)
|
||||
# define SET_TERMIOS(fd, x) tcsetattr(fd, TCSADRAIN, x)
|
||||
#else
|
||||
# ifdef TCGETS
|
||||
# define GET_TERMIOS(fd, x) ioctl(fd, TCGETS, x)
|
||||
# define SET_TERMIOS(fd, x) ioctl(fd, TCSETS, x)
|
||||
# else
|
||||
# define X(x,m) &(((TTY_Termio_Type *)(x))->m)
|
||||
# define GET_TERMIOS(fd, x) \
|
||||
((ioctl(fd, TIOCGETC, X(x,t)) || \
|
||||
ioctl(fd, TIOCGLTC, X(x,lt)) || \
|
||||
ioctl(fd, TIOCGETP, X(x,s))) ? -1 : 0)
|
||||
# define SET_TERMIOS(fd, x) \
|
||||
((ioctl(fd, TIOCSETC, X(x,t)) ||\
|
||||
ioctl(fd, TIOCSLTC, X(x,lt)) || \
|
||||
ioctl(fd, TIOCSETP, X(x,s))) ? -1 : 0)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
static int TTY_Inited = 0;
|
||||
static int TTY_Open = 0;
|
||||
|
||||
#ifdef ultrix /* Ultrix gets _POSIX_VDISABLE wrong! */
|
||||
# define NULL_VALUE -1
|
||||
#else
|
||||
# ifdef _POSIX_VDISABLE
|
||||
# define NULL_VALUE _POSIX_VDISABLE
|
||||
# else
|
||||
# define NULL_VALUE 255
|
||||
# endif
|
||||
#endif
|
||||
|
||||
int SLang_init_tty (int abort_char, int no_flow_control, int opost)
|
||||
{
|
||||
TTY_Termio_Type newtty;
|
||||
|
||||
SLsig_block_signals ();
|
||||
|
||||
if (TTY_Inited)
|
||||
{
|
||||
SLsig_unblock_signals ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
TTY_Open = 0;
|
||||
|
||||
if ((SLang_TT_Read_FD == -1)
|
||||
|| (1 != isatty (SLang_TT_Read_FD)))
|
||||
{
|
||||
#ifdef O_RDWR
|
||||
# if !defined(__BEOS__) && !defined(__APPLE__)
|
||||
/* I have been told that BEOS will HANG if passed /dev/tty */
|
||||
if ((SLang_TT_Read_FD = open("/dev/tty", O_RDWR)) >= 0)
|
||||
{
|
||||
TTY_Open = 1;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
if (TTY_Open == 0)
|
||||
{
|
||||
SLang_TT_Read_FD = fileno (stderr);
|
||||
if (1 != isatty (SLang_TT_Read_FD))
|
||||
{
|
||||
SLang_TT_Read_FD = fileno (stdin);
|
||||
if (1 != isatty (SLang_TT_Read_FD))
|
||||
{
|
||||
fprintf (stderr, "Failed to open terminal.");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SLang_Abort_Char = abort_char;
|
||||
|
||||
/* Some systems may not permit signals to be blocked. As a result, the
|
||||
* return code must be checked.
|
||||
*/
|
||||
while (-1 == GET_TERMIOS(SLang_TT_Read_FD, &Old_TTY))
|
||||
{
|
||||
if (errno != EINTR)
|
||||
{
|
||||
SLsig_unblock_signals ();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
while (-1 == GET_TERMIOS(SLang_TT_Read_FD, &newtty))
|
||||
{
|
||||
if (errno != EINTR)
|
||||
{
|
||||
SLsig_unblock_signals ();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef HAVE_TERMIOS_H
|
||||
(void) opost;
|
||||
(void) no_flow_control;
|
||||
newtty.s.sg_flags &= ~(ECHO);
|
||||
newtty.s.sg_flags &= ~(CRMOD);
|
||||
/* if (Flow_Control == 0) newtty.s.sg_flags &= ~IXON; */
|
||||
newtty.t.t_eofc = 1;
|
||||
if (abort_char == -1) SLang_Abort_Char = newtty.t.t_intrc;
|
||||
newtty.t.t_intrc = SLang_Abort_Char; /* ^G */
|
||||
newtty.t.t_quitc = 255;
|
||||
newtty.lt.t_suspc = 255; /* to ignore ^Z */
|
||||
newtty.lt.t_dsuspc = 255; /* to ignore ^Y */
|
||||
newtty.lt.t_lnextc = 255;
|
||||
newtty.s.sg_flags |= CBREAK; /* do I want cbreak or raw????? */
|
||||
#else
|
||||
|
||||
/* get baud rate */
|
||||
|
||||
newtty.c_iflag &= ~(ECHO | INLCR | ICRNL);
|
||||
#ifdef ISTRIP
|
||||
/* newtty.c_iflag &= ~ISTRIP; */
|
||||
#endif
|
||||
if (opost == 0) newtty.c_oflag &= ~OPOST;
|
||||
|
||||
set_baud_rate (&newtty);
|
||||
|
||||
if (no_flow_control) newtty.c_iflag &= ~IXON; else newtty.c_iflag |= IXON;
|
||||
|
||||
newtty.c_cc[VEOF] = 1;
|
||||
newtty.c_cc[VMIN] = 1;
|
||||
newtty.c_cc[VTIME] = 0;
|
||||
newtty.c_lflag = ISIG | NOFLSH;
|
||||
if (abort_char == -1) SLang_Abort_Char = newtty.c_cc[VINTR];
|
||||
newtty.c_cc[VINTR] = SLang_Abort_Char; /* ^G */
|
||||
newtty.c_cc[VQUIT] = NULL_VALUE;
|
||||
newtty.c_cc[VSUSP] = NULL_VALUE; /* to ignore ^Z */
|
||||
#ifdef VDSUSP
|
||||
newtty.c_cc[VDSUSP] = NULL_VALUE; /* to ignore ^Y */
|
||||
#endif
|
||||
#ifdef VLNEXT
|
||||
newtty.c_cc[VLNEXT] = NULL_VALUE; /* to ignore ^V ? */
|
||||
#endif
|
||||
#ifdef VSWTCH
|
||||
newtty.c_cc[VSWTCH] = NULL_VALUE; /* to ignore who knows what */
|
||||
#endif
|
||||
#endif /* NOT HAVE_TERMIOS_H */
|
||||
|
||||
while (-1 == SET_TERMIOS(SLang_TT_Read_FD, &newtty))
|
||||
{
|
||||
if (errno != EINTR)
|
||||
{
|
||||
SLsig_unblock_signals ();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
TTY_Inited = 1;
|
||||
SLsig_unblock_signals ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SLtty_set_suspend_state (int mode)
|
||||
{
|
||||
TTY_Termio_Type newtty;
|
||||
|
||||
SLsig_block_signals ();
|
||||
|
||||
if (TTY_Inited == 0)
|
||||
{
|
||||
SLsig_unblock_signals ();
|
||||
return;
|
||||
}
|
||||
|
||||
while ((-1 == GET_TERMIOS (SLang_TT_Read_FD, &newtty))
|
||||
&& (errno == EINTR))
|
||||
;
|
||||
|
||||
#ifndef HAVE_TERMIOS_H
|
||||
/* I do not know if all systems define the t_dsuspc field */
|
||||
if (mode == 0)
|
||||
{
|
||||
newtty.lt.t_suspc = 255;
|
||||
newtty.lt.t_dsuspc = 255;
|
||||
}
|
||||
else
|
||||
{
|
||||
newtty.lt.t_suspc = Old_TTY.lt.t_suspc;
|
||||
newtty.lt.t_dsuspc = Old_TTY.lt.t_dsuspc;
|
||||
}
|
||||
#else
|
||||
if (mode == 0)
|
||||
{
|
||||
newtty.c_cc[VSUSP] = NULL_VALUE;
|
||||
#ifdef VDSUSP
|
||||
newtty.c_cc[VDSUSP] = NULL_VALUE;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
newtty.c_cc[VSUSP] = Old_TTY.c_cc[VSUSP];
|
||||
#ifdef VDSUSP
|
||||
newtty.c_cc[VDSUSP] = Old_TTY.c_cc[VDSUSP];
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
while ((-1 == SET_TERMIOS (SLang_TT_Read_FD, &newtty))
|
||||
&& (errno == EINTR))
|
||||
;
|
||||
|
||||
SLsig_unblock_signals ();
|
||||
}
|
||||
|
||||
void SLang_reset_tty (void)
|
||||
{
|
||||
SLsig_block_signals ();
|
||||
|
||||
if (TTY_Inited == 0)
|
||||
{
|
||||
SLsig_unblock_signals ();
|
||||
return;
|
||||
}
|
||||
|
||||
while ((-1 == SET_TERMIOS(SLang_TT_Read_FD, &Old_TTY))
|
||||
&& (errno == EINTR))
|
||||
;
|
||||
|
||||
if (TTY_Open)
|
||||
{
|
||||
while ((-1 == close (SLang_TT_Read_FD))
|
||||
&& (errno == EINTR))
|
||||
;
|
||||
|
||||
TTY_Open = 0;
|
||||
SLang_TT_Read_FD = -1;
|
||||
}
|
||||
|
||||
TTY_Inited = 0;
|
||||
SLsig_unblock_signals ();
|
||||
}
|
||||
|
||||
static void default_sigint (int sig)
|
||||
{
|
||||
sig = errno; /* use parameter */
|
||||
|
||||
SLKeyBoard_Quit = 1;
|
||||
if (SLang_Ignore_User_Abort == 0) SLang_set_error (SL_USER_BREAK);
|
||||
SLsignal_intr (SIGINT, default_sigint);
|
||||
errno = sig;
|
||||
}
|
||||
|
||||
int SLang_set_abort_signal (void (*hand)(int))
|
||||
{
|
||||
int save_errno = errno;
|
||||
SLSig_Fun_Type *f;
|
||||
|
||||
if (hand == NULL) hand = default_sigint;
|
||||
f = SLsignal_intr (SIGINT, hand);
|
||||
|
||||
errno = save_errno;
|
||||
|
||||
if (f == (SLSig_Fun_Type *) SIG_ERR)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef FD_SET
|
||||
#define FD_SET(fd, tthis) *(tthis) = 1 << (fd)
|
||||
#define FD_ZERO(tthis) *(tthis) = 0
|
||||
#define FD_ISSET(fd, tthis) (*(tthis) & (1 << fd))
|
||||
typedef int fd_set;
|
||||
#endif
|
||||
|
||||
static fd_set Read_FD_Set;
|
||||
|
||||
/* HACK: If > 0, use 1/10 seconds. If < 0, use 1/1000 seconds */
|
||||
|
||||
int _pSLsys_input_pending(int tsecs)
|
||||
{
|
||||
struct timeval wait;
|
||||
long usecs, secs;
|
||||
|
||||
if ((TTY_Inited == 0)
|
||||
|| (SLang_TT_Read_FD < 0))
|
||||
{
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (tsecs >= 0)
|
||||
{
|
||||
secs = tsecs / 10;
|
||||
usecs = (tsecs % 10) * 100000;
|
||||
}
|
||||
else
|
||||
{
|
||||
tsecs = -tsecs;
|
||||
secs = tsecs / 1000;
|
||||
usecs = (tsecs % 1000) * 1000;
|
||||
}
|
||||
|
||||
wait.tv_sec = secs;
|
||||
wait.tv_usec = usecs;
|
||||
|
||||
FD_ZERO(&Read_FD_Set);
|
||||
FD_SET(SLang_TT_Read_FD, &Read_FD_Set);
|
||||
|
||||
return select(SLang_TT_Read_FD + 1, &Read_FD_Set, NULL, NULL, &wait);
|
||||
}
|
||||
|
||||
int (*SLang_getkey_intr_hook) (void);
|
||||
|
||||
static int handle_interrupt (void)
|
||||
{
|
||||
if (SLang_getkey_intr_hook != NULL)
|
||||
{
|
||||
int save_tty_fd = SLang_TT_Read_FD;
|
||||
|
||||
if (-1 == (*SLang_getkey_intr_hook) ())
|
||||
return -1;
|
||||
|
||||
if (save_tty_fd != SLang_TT_Read_FD)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int _pSLsys_getkey (void)
|
||||
{
|
||||
unsigned char c;
|
||||
|
||||
if (TTY_Inited == 0)
|
||||
{
|
||||
int ic = fgetc (stdin);
|
||||
if (ic == EOF) return SLANG_GETKEY_ERROR;
|
||||
return (unsigned int) ic;
|
||||
}
|
||||
|
||||
while (1)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (SLKeyBoard_Quit)
|
||||
return SLang_Abort_Char;
|
||||
|
||||
if (0 == (ret = _pSLsys_input_pending (100)))
|
||||
continue;
|
||||
|
||||
if (ret != -1)
|
||||
break;
|
||||
|
||||
if (SLKeyBoard_Quit)
|
||||
return SLang_Abort_Char;
|
||||
|
||||
if (errno == EINTR)
|
||||
{
|
||||
if (-1 == handle_interrupt ())
|
||||
return SLANG_GETKEY_ERROR;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
break; /* let read handle it */
|
||||
}
|
||||
|
||||
while (1)
|
||||
{
|
||||
int status = read(SLang_TT_Read_FD, (char *) &c, 1);
|
||||
|
||||
if (status > 0)
|
||||
break;
|
||||
|
||||
if (status == 0)
|
||||
{
|
||||
/* We are at the end of a file. Let application handle it. */
|
||||
return SLANG_GETKEY_ERROR;
|
||||
}
|
||||
|
||||
if (errno == EINTR)
|
||||
{
|
||||
if (-1 == handle_interrupt ())
|
||||
return SLANG_GETKEY_ERROR;
|
||||
|
||||
if (SLKeyBoard_Quit)
|
||||
return SLang_Abort_Char;
|
||||
|
||||
continue;
|
||||
}
|
||||
#ifdef EAGAIN
|
||||
if (errno == EAGAIN)
|
||||
{
|
||||
sleep (1);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
#ifdef EWOULDBLOCK
|
||||
if (errno == EWOULDBLOCK)
|
||||
{
|
||||
sleep (1);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
#ifdef EIO
|
||||
if (errno == EIO)
|
||||
{
|
||||
SLang_verror (SL_Read_Error, "_pSLsys_getkey: EIO error");
|
||||
}
|
||||
#endif
|
||||
return SLANG_GETKEY_ERROR;
|
||||
}
|
||||
|
||||
return((unsigned int) c);
|
||||
}
|
||||
|
@ -1,15 +0,0 @@
|
||||
#include "slinclud.h"
|
||||
#include <ctype.h>
|
||||
|
||||
#include "slang.h"
|
||||
#include "_slang.h"
|
||||
|
||||
#define DEFINE_PSLWC_WIDTH_TABLE
|
||||
#include "slwcwidth.h"
|
||||
int SLwchar_wcwidth (SLwchar_Type ch)
|
||||
{
|
||||
int w;
|
||||
|
||||
SL_WIDTH_ALOOKUP(w,ch);
|
||||
return w;
|
||||
}
|
@ -22,10 +22,6 @@ cons_saver_SOURCES = cons.saver.c
|
||||
|
||||
man2hlp_SOURCES = man2hlp.c glibcompat.c
|
||||
|
||||
if INCLUDED_SLANG
|
||||
SLANGLIB = ../slang/libmcslang.a
|
||||
endif
|
||||
|
||||
if USE_EDIT
|
||||
EDITLIB = ../edit/libedit.a
|
||||
endif
|
||||
|
@ -2033,10 +2033,6 @@ handle_args (int argc, char *argv[])
|
||||
poptGetContext ("mc", argc, argv, argument_table,
|
||||
POPT_CONTEXT_NO_EXEC);
|
||||
|
||||
#ifdef USE_TERMCAP
|
||||
SLtt_Try_Termcap = 1;
|
||||
#endif
|
||||
|
||||
while ((c = poptGetNextOpt (ctx)) > 0) {
|
||||
process_args (ctx, c, poptGetOptArg (ctx));
|
||||
}
|
||||
|
@ -1,15 +1,11 @@
|
||||
#ifndef MC_MYSLANG_H
|
||||
#define MC_MYSLANG_H
|
||||
|
||||
#ifndef HAVE_SYSTEM_SLANG
|
||||
# include "../slang/include/slang.h"
|
||||
#else
|
||||
#ifdef HAVE_SLANG_SLANG_H
|
||||
# include <slang/slang.h>
|
||||
#else
|
||||
# include <slang.h>
|
||||
#endif /* HAVE_SLANG_SLANG_H */
|
||||
#endif
|
||||
|
||||
enum {
|
||||
KEY_BACKSPACE = 400,
|
||||
|
@ -56,13 +56,6 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Taken from S-Lang's sldisply.c file */
|
||||
#ifndef USE_TERMCAP
|
||||
# define tgetstr(a,b) SLtt_tgetstr (a)
|
||||
#else
|
||||
extern char *tgetstr(char *, char **);
|
||||
#endif
|
||||
|
||||
#ifndef SA_RESTART
|
||||
# define SA_RESTART 0
|
||||
#endif
|
||||
|
@ -58,19 +58,11 @@ static const char *const features[] = {
|
||||
|
||||
#ifdef HAVE_SLANG
|
||||
|
||||
# ifdef HAVE_SYSTEM_SLANG
|
||||
N_("Using system-installed S-Lang library"),
|
||||
# else
|
||||
N_("Using included S-Lang library"),
|
||||
# endif
|
||||
|
||||
" ",
|
||||
|
||||
#ifdef USE_TERMCAP
|
||||
N_("with termcap database"),
|
||||
#else
|
||||
N_("with terminfo database"),
|
||||
#endif
|
||||
|
||||
#elif defined(USE_NCURSES)
|
||||
N_("Using the ncurses library"),
|
||||
|
Loading…
Reference in New Issue
Block a user