Import ncurses 5.6-20080503 snapshot onto the vender branch

This commit is contained in:
Rong-En Fan 2008-05-09 02:28:12 +00:00
parent d8977eaf36
commit aa59d4d4c5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/ncurses/dist/; revision=178866
svn path=/vendor/ncurses/5.6-20080503/; revision=178868; tag=vendor/ncurses/5.6-20080503
43 changed files with 3219 additions and 2086 deletions

View File

@ -25,7 +25,7 @@
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
-- $Id: INSTALL,v 1.122 2007/12/01 19:37:47 tom Exp $
-- $Id: INSTALL,v 1.124 2008/03/29 18:07:32 tom Exp $
---------------------------------------------------------------------
How to install Ncurses/Terminfo on your system
---------------------------------------------------------------------
@ -149,6 +149,9 @@ INSTALLATION PROCEDURE:
recent implementation of libiconv. We have built this configuration on
Linux using libiconv, sometimes requiring libutf8.
If you configure using the --with-pthread option, a "t" is appended to
the library names (e.g., libncursest.a, libncursestw.a).
If you do not specify any models, the normal and debug libraries will be
configured. Typing `configure' with no arguments is equivalent to:
@ -512,7 +515,8 @@ SUMMARY OF CONFIGURE OPTIONS:
--enable-reentrant
Compile experimental configuration which improves reentrant use of the
library by reducing global and static variables.
library by reducing global and static variables. This option is also
set if --with-pthread is used.
--enable-rpath
Use rpath option when generating shared libraries, and (with some
@ -816,6 +820,11 @@ SUMMARY OF CONFIGURE OPTIONS:
Generate profile-libraries These are named by adding "_p" to the root,
e.g., libncurses_p.a
--with-pthread
Link with POSIX threads, set --enable-reentrant. The use_window() and
use_screen() functions will use mutex's, allowing rudimentary support
for multithreaded applications.
--with-rcs-ids
Compile-in RCS identifiers. Most of the C files have an identifier.

View File

@ -25,7 +25,7 @@
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
-- $Id: NEWS,v 1.1206 2008/02/09 23:49:39 tom Exp $
-- $Id: NEWS,v 1.1233 2008/05/03 23:14:39 tom Exp $
-------------------------------------------------------------------------------
This is a log of changes that ncurses has gone through since Zeyd started
@ -45,6 +45,89 @@ See the AUTHORS file for the corresponding full names.
Changes through 1.9.9e did not credit all contributions;
it is not possible to add this information.
20080503
+ modify screen.* terminfo entries using new screen+fkeys to fix
overridden keys in screen.rxvt (Debian #478094) -TD
+ modify internal interfaces to reduce wgetch()'s dependency on the
global SP.
+ simplify some loops with macros each_screen(), each_window() and
each_ripoff().
20080426
+ continue modifying test/ditto.c toward making it demonstrate
multithreaded use_screen(), using fifos to pass data between screens.
+ fix typo in form.3x (report by Mike Gran).
20080419
+ add screen.rxvt terminfo entry -TD
+ modify tic -f option to format spaces as \s to prevent them from
being lost when that is read back in unformatted strings.
+ improve test/ditto.c, using a "talk"-style layout.
20080412
+ change test/ditto.c to use openpty() and xterm.
+ add locks for copywin(), dupwin(), overlap(), overlay() on their
window parameters.
+ add locks for initscr() and newterm() on updates to the SCREEN
pointer.
+ finish table in curs_thread.3x manpage.
20080405
+ begin table in curs_thread.3x manpage describing the scope of data
used by each function (or symbol) for threading analysis.
+ add null-pointer checks to setsyx() and getsyx() (prompted by
discussion by Martin v. Lowis and Jeroen Ruigrok van der Werven on
python-dev2 mailing list).
20080329
+ add null-pointer checks in set_term() and delscreen().
+ move _nc_windows into _nc_globals, since windows can be pads, which
are not associated with a particular screen.
+ change use_screen() to pass the SCREEN* parameter rather than
stdscr to the callback function.
+ force libtool to use tag for 'CC' in case it does not detect this,
e.g., on aix when using CC=powerpc-ibm-aix5.3.0.0-gcc
(report/patch by Michael Haubenwallner).
+ override OBJEXT to "lo" when building with libtool, to work on
platforms such as AIX where libtool may use a different suffix for
the object files than ".o" (report/patch by Michael Haubenwallner).
+ add configure --with-pthread option, for building with the POSIX
thread library.
20080322
+ fill in extended-color pair two more places in wbkgrndset() and
waddch_nosync() (prompted by Sedeno's patch).
+ fill in extended-color pair in _nc_build_wch() to make colors work
for wide-characters using extended-colors (patch by Alejandro R
Sedeno).
+ add x/X toggles to ncurses.c C color test to test/demo
wide-characters with extended-colors.
+ add a/A toggles to ncurses.c c/C color tests.
+ modify test/ditto.c to use use_screen().
+ finish modifying test/rain.c to demonstrate threads.
20080308
+ start modifying test/rain.c for threading demo.
+ modify test/ncurses.c to make 'f' test accept the f/F/b/F/</> toggles
that the 'F' accepts.
+ modify test/worm.c to show trail in reverse-video when other threads
are working concurrently.
+ fix a deadlock from improper nesting of mutexes for windowlist and
window.
20080301
+ fixes from 20080223 resolved issue with mutexes; change to use
recursive mutexes to fix memory leak in delwin() as called from
_nc_free_and_exit().
20080223
+ fix a size-difference in _nc_globals which caused hanging of mutex
lock/unlock when termlib was built separately.
20080216
+ avoid using nanosleep() in threaded configuration since that often
is implemented to suspend the entire process.
20080209
+ update test programs to build/work with various UNIX curses for
comparisons. This was to reinvestigate statement in X/Open curses

View File

@ -1,5 +1,5 @@
dnl***************************************************************************
dnl Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
dnl Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
dnl *
dnl Permission is hereby granted, free of charge, to any person obtaining a *
dnl copy of this software and associated documentation files (the *
@ -28,7 +28,7 @@ dnl***************************************************************************
dnl
dnl Author: Thomas E. Dickey 1995-on
dnl
dnl $Id: aclocal.m4,v 1.442 2007/12/01 20:02:42 tom Exp $
dnl $Id: aclocal.m4,v 1.447 2008/04/12 23:49:55 tom Exp $
dnl Macros used in NCURSES auto-configuration script.
dnl
dnl These macros are maintained separately from NCURSES. The copyright on
@ -168,7 +168,7 @@ AC_SUBST(EXTRA_CPPFLAGS)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_ADD_INCDIR version: 8 updated: 2007/07/30 19:22:58
dnl CF_ADD_INCDIR version: 9 updated: 2008/02/09 13:15:34
dnl -------------
dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it's
dnl redundant. We don't normally need to add -I/usr/local/include for gcc,
@ -210,7 +210,7 @@ if test -n "$1" ; then
fi
if test "$cf_have_incdir" = no ; then
AC_VERBOSE(adding $cf_add_incdir to include-path)
CF_VERBOSE(adding $cf_add_incdir to include-path)
ifelse($2,,CPPFLAGS,$2)="-I$cf_add_incdir $ifelse($2,,CPPFLAGS,[$]$2)"
cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'`
@ -225,7 +225,7 @@ if test -n "$1" ; then
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_ADD_LIBDIR version: 5 updated: 2007/07/30 19:12:03
dnl CF_ADD_LIBDIR version: 6 updated: 2008/02/09 13:15:34
dnl -------------
dnl Adds to the library-path
dnl
@ -253,7 +253,7 @@ if test -n "$1" ; then
done
fi
if test "$cf_have_libdir" = no ; then
AC_VERBOSE(adding $cf_add_libdir to library-path)
CF_VERBOSE(adding $cf_add_libdir to library-path)
ifelse($2,,LDFLAGS,$2)="-L$cf_add_libdir $ifelse($2,,LDFLAGS,[$]$2)"
fi
fi
@ -313,7 +313,7 @@ fi
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_ANSI_CC_REQD version: 3 updated: 1997/09/06 13:40:44
dnl CF_ANSI_CC_REQD version: 4 updated: 2008/03/23 14:48:54
dnl ---------------
dnl For programs that must use an ANSI compiler, obtain compiler options that
dnl will make it recognize prototypes. We'll do preprocessor checks in other
@ -322,7 +322,7 @@ dnl the preprocessor.
AC_DEFUN([CF_ANSI_CC_REQD],
[AC_REQUIRE([CF_ANSI_CC_CHECK])
if test "$cf_cv_ansi_cc" = "no"; then
AC_ERROR(
AC_MSG_ERROR(
[Your compiler does not appear to recognize prototypes.
You have the following choices:
a. adjust your compiler options
@ -614,7 +614,7 @@ AC_MSG_RESULT($cf_cv_cgetent)
test "$cf_cv_cgetent" = yes && AC_DEFINE(HAVE_BSD_CGETENT)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_CHECK_CACHE version: 10 updated: 2004/05/23 13:03:31
dnl CF_CHECK_CACHE version: 11 updated: 2008/03/23 14:45:59
dnl --------------
dnl Check if we're accidentally using a cache from a different machine.
dnl Derive the system name, as a check for reusing the autoconf cache.
@ -645,7 +645,7 @@ test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name
if test ".$system_name" != ".$cf_cv_system_name" ; then
AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
AC_ERROR("Please remove config.cache and try again.")
AC_MSG_ERROR("Please remove config.cache and try again.")
fi
])dnl
dnl ---------------------------------------------------------------------------
@ -1058,6 +1058,34 @@ int main() {
test "$cf_cv_func_nanosleep" = "yes" && AC_DEFINE(HAVE_NANOSLEEP)
])
dnl ---------------------------------------------------------------------------
dnl CF_FUNC_OPENPTY version: 2 updated: 2008/04/12 19:49:01
dnl ---------------
dnl Check for openpty() function, along with <pty.h> header. It may need the
dnl "util" library as well.
AC_DEFUN([CF_FUNC_OPENPTY],
[
AC_CHECK_LIB(util,openpty,cf_cv_lib_util=yes,cf_cv_lib_util=no)
AC_CACHE_CHECK(for openpty header,cf_cv_func_openpty,[
cf_save_LIBS="$LIBS"
test $cf_cv_lib_util = yes && LIBS="-lutil $LIBS"
for cf_header in pty.h libutil.h util.h
do
AC_TRY_LINK([
#include <$cf_header>
],[
int x = openpty((int *)0, (int *)0, (char *)0,
(struct termios *)0, (struct winsize *)0);
],[
cf_cv_func_openpty=$cf_header
break
],[
cf_cv_func_openpty=no
])
done
LIBS="$cf_save_LIBS"
])
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_FUNC_POLL version: 4 updated: 2006/12/16 12:33:30
dnl ------------
dnl See if the poll function really works. Some platforms have poll(), but
@ -3445,7 +3473,7 @@ ifelse($1,,,[$1=$PATHSEP])
AC_SUBST(PATHSEP)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_PATH_SYNTAX version: 11 updated: 2006/09/02 08:55:46
dnl CF_PATH_SYNTAX version: 12 updated: 2008/03/23 14:45:59
dnl --------------
dnl Check the argument to see that it looks like a pathname. Rewrite it if it
dnl begins with one of the prefix/exec_prefix variables, and then again if the
@ -3477,7 +3505,7 @@ case ".[$]$1" in #(vi
$1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
;;
*)
ifelse($2,,[AC_ERROR([expected a pathname, not \"[$]$1\"])],$2)
ifelse($2,,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2)
;;
esac
])dnl
@ -3894,7 +3922,7 @@ AC_MSG_RESULT(no)
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_SHARED_OPTS version: 46 updated: 2007/02/24 18:58:09
dnl CF_SHARED_OPTS version: 47 updated: 2008/03/23 14:48:54
dnl --------------
dnl --------------
dnl Attempt to determine the appropriate CC/LD options for creating a shared
@ -3940,7 +3968,7 @@ AC_DEFUN([CF_SHARED_OPTS],
cf_cv_shlib_version=$withval
;;
*)
AC_ERROR([option value must be one of: rel, abi, auto or no])
AC_MSG_ERROR([option value must be one of: rel, abi, auto or no])
;;
esac
],[cf_cv_shlib_version=auto])
@ -4873,7 +4901,7 @@ if test "$with_dmalloc" = yes ; then
fi
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_WITH_GPM version: 6 updated: 2006/12/17 11:12:09
dnl CF_WITH_GPM version: 7 updated: 2008/03/23 14:48:54
dnl -----------
dnl
dnl The option parameter (if neither yes/no) is assumed to be the name of
@ -4895,7 +4923,7 @@ if test "$with_gpm" != no ; then
AC_DEFINE(HAVE_LIBGPM)
else
AC_CHECK_LIB(gpm,Gpm_Open,[:],[
AC_ERROR(Cannot link with GPM library)
AC_MSG_ERROR(Cannot link with GPM library)
fi
with_gpm=yes
])
@ -4906,7 +4934,7 @@ if test "$with_gpm" != no ; then
fi
])
dnl ---------------------------------------------------------------------------
dnl CF_WITH_LIBTOOL version: 18 updated: 2007/04/08 20:02:38
dnl CF_WITH_LIBTOOL version: 19 updated: 2008/03/29 15:46:43
dnl ---------------
dnl Provide a configure option to incorporate libtool. Define several useful
dnl symbols for the makefile rules.
@ -5007,6 +5035,7 @@ ifdef([AC_PROG_LIBTOOL],[
case $cf_cv_libtool_version in
1.[[5-9]]*|[[2-9]]*)
LIBTOOL_CXX="$LIBTOOL --tag=CXX"
LIBTOOL="$LIBTOOL --tag=CC"
;;
*)
LIBTOOL_CXX="$LIBTOOL"
@ -5099,6 +5128,32 @@ AC_SUBST($3)dnl
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_WITH_PTHREAD version: 1 updated: 2008/03/29 13:42:21
dnl ---------------
dnl Check for POSIX thread library.
AC_DEFUN([CF_WITH_PTHREAD],
[
AC_MSG_CHECKING(if you want to link with the pthread library)
AC_ARG_WITH(pthread,
[ --with-pthread use POSIX thread library],
[with_pthread=$withval],
[with_pthread=no])
AC_MSG_RESULT($with_pthread)
if test "$with_pthread" != no ; then
AC_CHECK_HEADER(pthread.h,[
AC_DEFINE(HAVE_PTHREADS_H)
AC_CHECK_LIB(pthread,pthread_create,[
LIBS="-lpthread $LIBS"
AC_DEFINE(HAVE_LIBPTHREADS)
with_pthread=yes
],[
AC_MSG_ERROR(Cannot link with pthread library)
])
])
fi
])
dnl ---------------------------------------------------------------------------
dnl CF_WITH_REL_VERSION version: 1 updated: 2003/09/20 18:12:49
dnl -------------------
dnl Allow library's release-version to be overridden. Generally this happens when a

View File

@ -1,10 +1,10 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
# Inc.
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
# Free Software Foundation, Inc.
timestamp='2007-05-17'
timestamp='2008-03-12'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@ -56,8 +56,8 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@ -180,7 +180,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
fi
;;
*)
os=netbsd
os=netbsd
;;
esac
# The OS release
@ -219,11 +219,11 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
exit ;;
alpha:OSF1:*:*)
case $UNAME_RELEASE in
*4.0)
*4.0)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
;;
*5.*)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
*5.*)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
;;
esac
# According to Compaq, /usr/sbin/psrinfo has been available on
@ -295,7 +295,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
echo s390-ibm-zvmoe
exit ;;
*:OS400:*:*)
echo powerpc-ibm-os400
echo powerpc-ibm-os400
exit ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
@ -330,7 +330,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
i86pc:SunOS:5.*:* | ix86xen:SunOS:5.*:*)
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:6*:*)
@ -375,23 +375,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# MiNT. But MiNT is downward compatible to TOS, so this should
# be no problem.
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
echo m68k-atari-mint${UNAME_RELEASE}
exit ;;
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit ;;
exit ;;
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
echo m68k-atari-mint${UNAME_RELEASE}
exit ;;
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
echo m68k-milan-mint${UNAME_RELEASE}
exit ;;
echo m68k-milan-mint${UNAME_RELEASE}
exit ;;
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
echo m68k-hades-mint${UNAME_RELEASE}
exit ;;
echo m68k-hades-mint${UNAME_RELEASE}
exit ;;
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
echo m68k-unknown-mint${UNAME_RELEASE}
exit ;;
echo m68k-unknown-mint${UNAME_RELEASE}
exit ;;
m68k:machten:*:*)
echo m68k-apple-machten${UNAME_RELEASE}
exit ;;
@ -461,8 +461,8 @@ EOF
echo m88k-motorola-sysv3
exit ;;
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
then
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
@ -532,7 +532,7 @@ EOF
echo rs6000-ibm-aix3.2
fi
exit ;;
*:AIX:*:[45])
*:AIX:*:[456])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
IBM_ARCH=rs6000
@ -575,8 +575,8 @@ EOF
9000/[678][0-9][0-9])
if [ -x /usr/bin/getconf ]; then
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
case "${sc_cpu_version}" in
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
case "${sc_cpu_version}" in
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
532) # CPU_PA_RISC2_0
@ -711,22 +711,22 @@ EOF
exit ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
exit ;;
exit ;;
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit ;;
exit ;;
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
echo c34-convex-bsd
exit ;;
exit ;;
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
echo c38-convex-bsd
exit ;;
exit ;;
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
echo c4-convex-bsd
exit ;;
exit ;;
CRAY*Y-MP:*:*:*)
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
@ -750,14 +750,14 @@ EOF
exit ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
5000:UNIX_System_V:4.*:*)
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
@ -785,20 +785,23 @@ EOF
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
i*:windows32*:*)
# uname -m includes "-pc" on this system.
echo ${UNAME_MACHINE}-mingw32
# uname -m includes "-pc" on this system.
echo ${UNAME_MACHINE}-mingw32
exit ;;
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
exit ;;
*:Interix*:[3456]*)
case ${UNAME_MACHINE} in
x86)
case ${UNAME_MACHINE} in
x86)
echo i586-pc-interix${UNAME_RELEASE}
exit ;;
EM64T | authenticamd)
echo x86_64-unknown-interix${UNAME_RELEASE}
exit ;;
IA64)
echo ia64-unknown-interix${UNAME_RELEASE}
exit ;;
esac ;;
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
@ -833,7 +836,13 @@ EOF
echo ${UNAME_MACHINE}-pc-minix
exit ;;
arm*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null | grep -q __ARM_EABI__
then
echo ${UNAME_MACHINE}-unknown-linux-gnu
else
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
fi
exit ;;
avr32*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
@ -845,7 +854,7 @@ EOF
echo crisv32-axis-linux-gnu
exit ;;
frv:Linux:*:*)
echo frv-unknown-linux-gnu
echo frv-unknown-linux-gnu
exit ;;
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
@ -873,10 +882,10 @@ EOF
#endif
EOF
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
/^CPU/{
s: ::g
p
}'`"
/^CPU/{
s: ::g
p
}'`"
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
mips64:Linux:*:*)
@ -896,15 +905,15 @@ EOF
#endif
EOF
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
/^CPU/{
s: ::g
p
}'`"
/^CPU/{
s: ::g
p
}'`"
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
or32:Linux:*:*)
echo or32-unknown-linux-gnu
exit ;;
echo or32-unknown-linux-gnu
exit ;;
ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu
exit ;;
@ -920,7 +929,7 @@ EOF
EV6) UNAME_MACHINE=alphaev6 ;;
EV67) UNAME_MACHINE=alphaev67 ;;
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
esac
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
@ -940,7 +949,7 @@ EOF
echo ${UNAME_MACHINE}-ibm-linux
exit ;;
sh64*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
sh*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
@ -954,8 +963,8 @@ EOF
x86_64:Linux:*:*)
echo x86_64-unknown-linux-gnu
exit ;;
xtensa:Linux:*:*)
echo xtensa-unknown-linux-gnu
xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
i*86:Linux:*:*)
# The BFD linker knows what the default object file format is, so
@ -968,7 +977,7 @@ EOF
s/.*supported targets: *//
s/ .*//
p'`
case "$ld_supported_targets" in
case "$ld_supported_targets" in
elf32-i386)
TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
;;
@ -1010,10 +1019,10 @@ EOF
#endif
EOF
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
/^LIBC/{
s: ::g
p
}'`"
/^LIBC/{
s: ::g
p
}'`"
test x"${LIBC}" != x && {
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
exit
@ -1027,11 +1036,11 @@ EOF
echo i386-sequent-sysv4
exit ;;
i*86:UNIX_SV:4.2MP:2.*)
# Unixware is an offshoot of SVR4, but it has its own version
# number series starting with 2...
# I am not positive that other SVR4 systems won't match this,
# Unixware is an offshoot of SVR4, but it has its own version
# number series starting with 2...
# I am not positive that other SVR4 systems won't match this,
# I just have to hope. -- rms.
# Use sysv4.2uw... so that sysv4* matches it.
# Use sysv4.2uw... so that sysv4* matches it.
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
exit ;;
i*86:OS/2:*:*)
@ -1063,7 +1072,7 @@ EOF
fi
exit ;;
i*86:*:5:[678]*)
# UnixWare 7.x, OpenUNIX and OpenServer 6.
# UnixWare 7.x, OpenUNIX and OpenServer 6.
case `/bin/uname -X | grep "^Machine"` in
*486*) UNAME_MACHINE=i486 ;;
*Pentium) UNAME_MACHINE=i586 ;;
@ -1091,10 +1100,10 @@ EOF
exit ;;
pc:*:*:*)
# Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i386.
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i386.
echo i386-pc-msdosdjgpp
exit ;;
exit ;;
Intel:Mach:3*:*)
echo i386-pc-mach3
exit ;;
@ -1129,8 +1138,8 @@ EOF
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4; exit; } ;;
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4; exit; } ;;
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE}
exit ;;
@ -1164,9 +1173,9 @@ EOF
fi
exit ;;
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
# says <Richard.M.Bartel@ccMail.Census.GOV>
echo i586-unisys-sysv4
exit ;;
# says <Richard.M.Bartel@ccMail.Census.GOV>
echo i586-unisys-sysv4
exit ;;
*:UNIX_System_V:4*:FTX*)
# From Gerald Hewes <hewes@openmarket.com>.
# How about differentiating between stratus architectures? -djm
@ -1196,7 +1205,7 @@ EOF
else
echo mips-unknown-sysv${UNAME_RELEASE}
fi
exit ;;
exit ;;
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
echo powerpc-be-beos
exit ;;
@ -1206,6 +1215,9 @@ EOF
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
echo i586-pc-beos
exit ;;
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
echo i586-pc-haiku
exit ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
exit ;;
@ -1240,8 +1252,8 @@ EOF
*:procnto*:*:* | *:QNX:[0123456789]*:*)
UNAME_PROCESSOR=`uname -p`
if test "$UNAME_PROCESSOR" = "x86"; then
UNAME_PROCESSOR=i386
UNAME_MACHINE=pc
UNAME_PROCESSOR=i386
UNAME_MACHINE=pc
fi
echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
exit ;;
@ -1293,13 +1305,13 @@ EOF
echo pdp10-unknown-its
exit ;;
SEI:*:*:SEIUX)
echo mips-sei-seiux${UNAME_RELEASE}
echo mips-sei-seiux${UNAME_RELEASE}
exit ;;
*:DragonFly:*:*)
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit ;;
*:*VMS:*:*)
UNAME_MACHINE=`(uname -p) 2>/dev/null`
UNAME_MACHINE=`(uname -p) 2>/dev/null`
case "${UNAME_MACHINE}" in
A*) echo alpha-dec-vms ; exit ;;
I*) echo ia64-dec-vms ; exit ;;
@ -1474,9 +1486,9 @@ This script, last modified $timestamp, has failed to recognize
the operating system you are using. It is advised that you
download the most up to date version of the config scripts from
http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
and
http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
If the version you run ($0) is already up to date, please
send the following data and any information you think might be

View File

@ -1,10 +1,10 @@
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
# Inc.
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
# Free Software Foundation, Inc.
timestamp='2007-06-28'
timestamp='2008-03-08'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@ -72,8 +72,8 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@ -254,8 +254,10 @@ case $basic_machine in
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
| mips64vr | mips64vrel \
| mips64octeon | mips64octeonel \
| mips64orion | mips64orionel \
| mips64r5900 | mips64r5900el \
| mips64vr | mips64vrel \
| mips64vr4100 | mips64vr4100el \
| mips64vr4300 | mips64vr4300el \
| mips64vr5000 | mips64vr5000el \
@ -304,8 +306,8 @@ case $basic_machine in
# because (1) that's what they normally are, and
# (2) the word "unknown" tends to confuse beginning users.
i*86 | x86_64)
basic_machine=$basic_machine-pc
;;
basic_machine=$basic_machine-pc
;;
# Object if more than one company name word.
*-*-*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
@ -329,14 +331,16 @@ case $basic_machine in
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
| m32c-* | m32r-* | m32rle-* \
| m32c- | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | maxq-* | mcore-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
| mips64vr-* | mips64vrel-* \
| mips64octeon-* | mips64octeonel-* \
| mips64orion-* | mips64orionel-* \
| mips64r5900-* | mips64r5900el-* \
| mips64vr-* | mips64vrel-* \
| mips64vr4100-* | mips64vr4100el-* \
| mips64vr4300-* | mips64vr4300el-* \
| mips64vr5000-* | mips64vr5000el-* \
@ -364,15 +368,19 @@ case $basic_machine in
| sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
| tron-* \
| v850-* | v850e-* | vax-* \
| we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
| xstormy16-* | xtensa-* \
| xstormy16-* | xtensa*-* \
| ymp-* \
| z8k-*)
;;
# Recognize the basic CPU types without company name, with glob match.
xtensa*)
basic_machine=$basic_machine-unknown
;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
386bsd)
@ -389,7 +397,7 @@ case $basic_machine in
basic_machine=a29k-amd
os=-udi
;;
abacus)
abacus)
basic_machine=abacus-unknown
;;
adobe68k)
@ -443,6 +451,14 @@ case $basic_machine in
basic_machine=ns32k-sequent
os=-dynix
;;
blackfin)
basic_machine=bfin-unknown
os=-linux
;;
blackfin-*)
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
c90)
basic_machine=c90-cray
os=-unicos
@ -668,6 +684,14 @@ case $basic_machine in
basic_machine=m68k-isi
os=-sysv
;;
m68knommu)
basic_machine=m68k-unknown
os=-linux
;;
m68knommu-*)
basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
m88k-omron*)
basic_machine=m88k-omron
;;
@ -813,6 +837,14 @@ case $basic_machine in
basic_machine=i860-intel
os=-osf
;;
parisc)
basic_machine=hppa-unknown
os=-linux
;;
parisc-*)
basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
pbd)
basic_machine=sparc-tti
;;
@ -1021,6 +1053,10 @@ case $basic_machine in
basic_machine=tic6x-unknown
os=-coff
;;
tile*)
basic_machine=tile-unknown
os=-linux-gnu
;;
tx39)
basic_machine=mipstx39-unknown
;;
@ -1181,8 +1217,8 @@ esac
if [ x"$os" != x"" ]
then
case $os in
# First match some system type aliases
# that might get confused with valid system types.
# First match some system type aliases
# that might get confused with valid system types.
# -solaris* is a basic system type, with this one exception.
-solaris1 | -solaris1.*)
os=`echo $os | sed -e 's|solaris1|sunos4|'`
@ -1265,7 +1301,7 @@ case $os in
-opened*)
os=-openedition
;;
-os400*)
-os400*)
os=-os400
;;
-wince*)
@ -1314,7 +1350,7 @@ case $os in
-sinix*)
os=-sysv4
;;
-tpf*)
-tpf*)
os=-tpf
;;
-triton*)
@ -1378,10 +1414,10 @@ else
# system, and we'll never get to this point.
case $basic_machine in
score-*)
score-*)
os=-elf
;;
spu-*)
spu-*)
os=-elf
;;
*-acorn)
@ -1393,8 +1429,8 @@ case $basic_machine in
arm*-semi)
os=-aout
;;
c4x-* | tic4x-*)
os=-coff
c4x-* | tic4x-*)
os=-coff
;;
# This must come before the *-dec entry.
pdp10-*)
@ -1421,7 +1457,7 @@ case $basic_machine in
m68*-cisco)
os=-aout
;;
mep-*)
mep-*)
os=-elf
;;
mips*-cisco)
@ -1448,7 +1484,7 @@ case $basic_machine in
*-ibm)
os=-aix
;;
*-knuth)
*-knuth)
os=-mmixware
;;
*-wec)

File diff suppressed because it is too large Load Diff

View File

@ -28,14 +28,14 @@ dnl***************************************************************************
dnl
dnl Author: Thomas E. Dickey 1995-on
dnl
dnl $Id: configure.in,v 1.429 2007/11/24 22:42:43 tom Exp $
dnl $Id: configure.in,v 1.433 2008/04/12 23:39:06 tom Exp $
dnl Process this file with autoconf to produce a configure script.
dnl
dnl See http://invisible-island.net/autoconf/ for additional information.
dnl
dnl ---------------------------------------------------------------------------
AC_PREREQ(2.13.20020210)
AC_REVISION($Revision: 1.429 $)
AC_REVISION($Revision: 1.433 $)
AC_INIT(ncurses/base/lib_initscr.c)
AC_CONFIG_HEADER(include/ncurses_cfg.h:include/ncurses_cfg.hin)
@ -969,8 +969,18 @@ if test "$with_ext_mouse" = yes ; then
fi
AC_SUBST(NCURSES_MOUSE_VERSION)
# This is still experimental (20080329), but should ultimately be moved to
# the script-block --with-normal, etc.
CF_WITH_PTHREAD
if test "$with_pthread" = "yes" ; then
AC_DEFINE(USE_PTHREADS)
enable_reentrant=yes
fi
# Reentrant code has to be opaque; there's little advantage to making ncurses
# opaque outside of that, so there is no --enable-opaque option.
# opaque outside of that, so there is no --enable-opaque option. We can use
# this option without --with-pthreads, but this will be always set for
# pthreads.
AC_MSG_CHECKING(if you want experimental reentrant code)
AC_ARG_ENABLE(reentrant,
[ --enable-reentrant compile with experimental reentrant code],
@ -1242,6 +1252,17 @@ CF_SIZECHANGE
CF_FUNC_MEMMOVE
CF_FUNC_POLL
# special check for test/ditto.c
CF_FUNC_OPENPTY
if test "$cf_cv_func_openpty" != no ; then
AC_DEFINE_UNQUOTED(USE_OPENPTY_HEADER,<$cf_cv_func_openpty>)
AC_DEFINE(USE_XTERM_PTY)
if test "$cf_cv_lib_util" = yes ; then
TEST_LIBS="-lutil $TEST_LIBS"
fi
fi
AC_SUBST(TEST_LIBS)
if test "$with_hashed_db" != no ; then
AC_DEFINE(USE_HASHED_DB)
CF_HASHED_DB($with_hashed_db)
@ -1629,6 +1650,10 @@ if test "$with_dlsym" = yes ; then
CF_REMOVE_LIB(TICS_LIST,$TICS_LIST,dl)
fi
if test "$DFT_LWR_MODEL" = "libtool"; then
OBJEXT=lo
fi
# needed for Ada95
TINFO_ARGS2=`echo "$TINFO_ARGS" | sed -e 's,-L\.\./,-L../../,'`
AC_SUBST(TINFO_ARGS2)

View File

@ -25,7 +25,7 @@
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
# $Id: dist.mk,v 1.629 2008/02/09 15:32:57 tom Exp $
# $Id: dist.mk,v 1.641 2008/05/03 12:31:08 tom Exp $
# Makefile for creating ncurses distributions.
#
# This only needs to be used directly as a makefile by developers, but
@ -37,7 +37,7 @@ SHELL = /bin/sh
# These define the major/minor/patch versions of ncurses.
NCURSES_MAJOR = 5
NCURSES_MINOR = 6
NCURSES_PATCH = 20080209
NCURSES_PATCH = 20080503
# We don't append the patch to the version, since this only applies to releases
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)

View File

@ -32,7 +32,7 @@
* and: Thomas E. Dickey 1996-on *
****************************************************************************/
/* $Id: curses.h.in,v 1.183 2008/01/19 20:03:48 tom Exp $ */
/* $Id: curses.h.in,v 1.186 2008/04/05 15:30:28 tom Exp $ */
#ifndef __NCURSES_H
#define __NCURSES_H
@ -830,7 +830,8 @@ extern NCURSES_EXPORT(int) getpary (const WINDOW *); /* generated */
#if @NCURSES_EXT_FUNCS@
#undef NCURSES_EXT_FUNCS
#define NCURSES_EXT_FUNCS @NCURSES_PATCH@
typedef int (*NCURSES_CALLBACK)(WINDOW *, void *);
typedef int (*NCURSES_WINDOW_CB)(WINDOW *, void *);
typedef int (*NCURSES_SCREEN_CB)(SCREEN *, void *);
extern NCURSES_EXPORT(bool) is_term_resized (int, int);
extern NCURSES_EXPORT(char *) keybound (int, int);
extern NCURSES_EXPORT(const char *) curses_version (void);
@ -845,8 +846,8 @@ extern NCURSES_EXPORT(int) set_tabsize (int);
extern NCURSES_EXPORT(int) use_default_colors (void);
extern NCURSES_EXPORT(int) use_extended_names (bool);
extern NCURSES_EXPORT(int) use_legacy_coding (int);
extern NCURSES_EXPORT(int) use_screen (SCREEN *, NCURSES_CALLBACK, void *);
extern NCURSES_EXPORT(int) use_window (WINDOW *, NCURSES_CALLBACK, void *);
extern NCURSES_EXPORT(int) use_screen (SCREEN *, NCURSES_SCREEN_CB, void *);
extern NCURSES_EXPORT(int) use_window (WINDOW *, NCURSES_WINDOW_CB, void *);
extern NCURSES_EXPORT(int) wresize (WINDOW *, int, int);
extern NCURSES_EXPORT(void) nofilter(void);
@ -911,17 +912,21 @@ extern NCURSES_EXPORT(int) wgetscrreg (const WINDOW *, int *, int *); /* generat
#define getmaxyx(win,y,x) (y = getmaxy(win), x = getmaxx(win))
#define getparyx(win,y,x) (y = getpary(win), x = getparx(win))
#define getsyx(y,x) do { if (is_leaveok(newscr)) \
(y) = (x) = -1; \
else \
getyx(newscr,(y), (x)); \
#define getsyx(y,x) do { if (newscr) { \
if (is_leaveok(newscr)) \
(y) = (x) = -1; \
else \
getyx(newscr,(y), (x)); \
} \
} while(0)
#define setsyx(y,x) do { if ((y) == -1 && (x) == -1) \
leaveok(newscr, TRUE); \
else { \
leaveok(newscr, FALSE); \
wmove(newscr, (y), (x)); \
#define setsyx(y,x) do { if (newscr) { \
if ((y) == -1 && (x) == -1) \
leaveok(newscr, TRUE); \
else { \
leaveok(newscr, FALSE); \
wmove(newscr, (y), (x)); \
} \
} \
} while(0)
@ -1109,13 +1114,13 @@ extern NCURSES_EXPORT(int) wgetscrreg (const WINDOW *, int *, int *); /* generat
#define wattr_set(win,a,p,opts) ((win)->_attrs = ((a) & ~A_COLOR), \
(win)->_color = (p), \
OK)
#define wattr_get(win,a,p,opts) ((void)((a) != 0 && (*(a) = (win)->_attrs)), \
(void)((p) != 0 && (*(p) = (win)->_color)), \
#define wattr_get(win,a,p,opts) ((void)((a) != (void *)0 && (*(a) = (win)->_attrs)), \
(void)((p) != (void *)0 && (*(p) = (win)->_color)), \
OK)
#else
#define wattr_set(win,a,p,opts) ((win)->_attrs = (((a) & ~A_COLOR) | COLOR_PAIR(p)), OK)
#define wattr_get(win,a,p,opts) ((void)((a) != 0 && (*(a) = (win)->_attrs)), \
(void)((p) != 0 && (*(p) = PAIR_NUMBER((win)->_attrs))), \
#define wattr_get(win,a,p,opts) ((void)((a) != (void *)0 && (*(a) = (win)->_attrs)), \
(void)((p) != (void *)0 && (*(p) = PAIR_NUMBER((win)->_attrs))), \
OK)
#endif
#endif /* NCURSES_OPAQUE */

View File

@ -26,7 +26,7 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: curs_threads.3x,v 1.4 2008/01/19 23:29:24 tom Exp $
.\" $Id: curs_threads.3x,v 1.12 2008/04/12 18:22:51 tom Exp $
.TH curs_threads 3X ""
.na
.hy 0
@ -38,15 +38,16 @@
.SH SYNOPSIS
\fB#include <curses.h>\fR
.sp
\fBtypedef int (*NCURSES_CALLBACK)(WINDOW *, void *);\fR
\fBtypedef int (*NCURSES_WINDOW_CB)(WINDOW *, void *);\fR
\fBtypedef int (*NCURSES_SCREEN_CB)(SCREEN *, void *);\fR
.br
\fBint set_escdelay(int size);\fR
.br
\fBint set_tabsize(int size);\fR
.br
\fBint use_screen(SCREEN *scr, NCURSES_CALLBACK func, void *data);\fR
\fBint use_screen(SCREEN *scr, NCURSES_WINDOW_CB func, void *data);\fR
.br
\fBint use_window(WINDOW *win, NCURSES_CALLBACK func, void *data);\fR
\fBint use_window(WINDOW *win, NCURSES_SCREEN_CB func, void *data);\fR
.br
.SH DESCRIPTION
This implementation can be configured to provide rudimentary support
@ -93,6 +94,495 @@ granularity mutexes for their respective \fBWINDOW\fP and \fBSCREEN\fP
parameters, and call a user-supplied function,
passing it a \fIdata\fP parameter,
and returning the value from the user-supplied function to the application.
.\" ***************************************************************************
.SS USAGE
All of the ncurses library functions assume that the locale is not
altered during operation.
In addition,
they use data which is maintained within a hierarchy of scopes.
.RS
.TP 3
-
global data, e.g., used in the low-level terminfo or termcap interfaces.
.TP 3
-
terminal data, e.g., associated with a call to \fIset_curterm\fP.
The terminal data are initialized when screens are created.
.TP 3
-
screen data, e.g., associated with a call to \fInewterm\fP or \fIinitscr\fP.
.TP 3
-
window data, e.g., associated with a call to \fInewwin\fP or \fIsubwin\fP.
Windows are associated with screens.
Pads are not necessarily associated with a particular screen.
.IP
Most curses applications operate on one or more windows within a single screen.
.TP 3
-
reentrant, i.e., it uses only the data passed as parameters.
.RE
.PP
This table lists the scope of data used for each symbol in the
ncurses library when it is configured to support threading:
.TS
center tab(/);
l l
l l .
Symbol/Scope
=
BC/global
COLORS/screen (readonly)
COLOR_PAIR/reentrant
COLOR_PAIRS/screen (readonly)
COLS/screen (readonly)
ESCDELAY/screen (readonly, see \fIset_escdelay\fP)
LINES/screen (readonly)
PAIR_NUMBER/reentrant
PC/global
SP/global
TABSIZE/screen (readonly)
UP/global
acs_map/screen (readonly)
add_wch/window (stdscr)
add_wchnstr/window (stdscr)
add_wchstr/window (stdscr)
addch/window (stdscr)
addchnstr/window (stdscr)
addchstr/window (stdscr)
addnstr/window (stdscr)
addnwstr/window (stdscr)
addstr/window (stdscr)
addwstr/window (stdscr)
assume_default_colors/screen
attr_get/window (stdscr)
attr_off/window (stdscr)
attr_on/window (stdscr)
attr_set/window (stdscr)
attroff/window (stdscr)
attron/window (stdscr)
attrset/window (stdscr)
baudrate/screen
beep/screen
bkgd/window (stdscr)
bkgdset/window (stdscr)
bkgrnd/window (stdscr)
bkgrndset/window (stdscr)
boolcodes/global (readonly)
boolfnames/global (readonly)
boolnames/global (readonly)
border/window (stdscr)
border_set/window (stdscr)
box/window (stdscr)
box_set/window (stdscr)
can_change_color/terminal
cbreak/screen
chgat/window (stdscr)
clear/window (stdscr)
clearok/window
clrtobot/window (stdscr)
clrtoeol/window (stdscr)
color_content/screen
color_set/window (stdscr)
copywin/window locks(source, target)
cur_term/terminal
curs_set/screen
curscr/screen (readonly)
curses_version/global (readonly)
def_prog_mode/terminal
def_shell_mode/terminal
define_key/screen
del_curterm/screen
delay_output/screen
delch/window (stdscr)
deleteln/window (stdscr)
delscreen/global locks(screenlist, screen)
delwin/global locks(windowlist)
derwin/screen
doupdate/screen
dupwin/screen locks(window)
echo/screen
echo_wchar/window (stdscr)
echochar/window (stdscr)
endwin/screen
erase/window (stdscr)
erasechar/window (stdscr)
erasewchar/window (stdscr)
filter/global
flash/terminal
flushinp/screen
get_wch/screen (input-operation)
get_wstr/screen (input-operation)
getattrs/window
getbegx/window
getbegy/window
getbkgd/window
getbkgrnd/window
getcchar/reentrant
getch/screen (input-operation)
getcurx/window
getcury/window
getmaxx/window
getmaxy/window
getmouse/screen (input-operation)
getn_wstr/screen (input-operation)
getnstr/screen (input-operation)
getparx/window
getpary/window
getstr/screen (input-operation)
getwin/screen (input-operation)
halfdelay/screen
has_colors/terminal
has_ic/terminal
has_il/terminal
has_key/screen
hline/window (stdscr)
hline_set/window (stdscr)
idcok/window
idlok/window
immedok/window
in_wch/window (stdscr)
in_wchnstr/window (stdscr)
in_wchstr/window (stdscr)
inch/window (stdscr)
inchnstr/window (stdscr)
inchstr/window (stdscr)
init_color/screen
init_pair/screen
initscr/global locks(screenlist)
innstr/window (stdscr)
innwstr/window (stdscr)
ins_nwstr/window (stdscr)
ins_wch/window (stdscr)
ins_wstr/window (stdscr)
insch/window (stdscr)
insdelln/window (stdscr)
insertln/window (stdscr)
insnstr/window (stdscr)
insstr/window (stdscr)
instr/window (stdscr)
intrflush/terminal
inwstr/window (stdscr)
is_cleared/window
is_idcok/window
is_idlok/window
is_immedok/window
is_keypad/window
is_leaveok/window
is_linetouched/window
is_nodelay/window
is_notimeout/window
is_scrollok/window
is_syncok/window
is_term_resized/terminal
is_wintouched/window
isendwin/screen
key_defined/screen
key_name/global (static data)
keybound/screen
keyname/global (static data)
keyok/screen
keypad/window
killchar/terminal
killwchar/terminal
leaveok/window
longname/screen
mcprint/terminal
meta/screen
mouse_trafo/window (stdscr)
mouseinterval/screen
mousemask/screen
move/window (stdscr)
mvadd_wch/window (stdscr)
mvadd_wchnstr/window (stdscr)
mvadd_wchstr/window (stdscr)
mvaddch/window (stdscr)
mvaddchnstr/window (stdscr)
mvaddchstr/window (stdscr)
mvaddnstr/window (stdscr)
mvaddnwstr/window (stdscr)
mvaddstr/window (stdscr)
mvaddwstr/window (stdscr)
mvchgat/window (stdscr)
mvcur/screen
mvdelch/window (stdscr)
mvderwin/window (stdscr)
mvget_wch/screen (input-operation)
mvget_wstr/screen (input-operation)
mvgetch/screen (input-operation)
mvgetn_wstr/screen (input-operation)
mvgetnstr/screen (input-operation)
mvgetstr/screen (input-operation)
mvhline/window (stdscr)
mvhline_set/window (stdscr)
mvin_wch/window (stdscr)
mvin_wchnstr/window (stdscr)
mvin_wchstr/window (stdscr)
mvinch/window (stdscr)
mvinchnstr/window (stdscr)
mvinchstr/window (stdscr)
mvinnstr/window (stdscr)
mvinnwstr/window (stdscr)
mvins_nwstr/window (stdscr)
mvins_wch/window (stdscr)
mvins_wstr/window (stdscr)
mvinsch/window (stdscr)
mvinsnstr/window (stdscr)
mvinsstr/window (stdscr)
mvinstr/window (stdscr)
mvinwstr/window (stdscr)
mvprintw/window (stdscr)
mvscanw/screen
mvvline/window (stdscr)
mvvline_set/window (stdscr)
mvwadd_wch/window
mvwadd_wchnstr/window
mvwadd_wchstr/window
mvwaddch/window
mvwaddchnstr/window
mvwaddchstr/window
mvwaddnstr/window
mvwaddnwstr/window
mvwaddstr/window
mvwaddwstr/window
mvwchgat/window
mvwdelch/window
mvwget_wch/screen (input-operation)
mvwget_wstr/screen (input-operation)
mvwgetch/screen (input-operation)
mvwgetn_wstr/screen (input-operation)
mvwgetnstr/screen (input-operation)
mvwgetstr/screen (input-operation)
mvwhline/window
mvwhline_set/window
mvwin/window
mvwin_wch/window
mvwin_wchnstr/window
mvwin_wchstr/window
mvwinch/window
mvwinchnstr/window
mvwinchstr/window
mvwinnstr/window
mvwinnwstr/window
mvwins_nwstr/window
mvwins_wch/window
mvwins_wstr/window
mvwinsch/window
mvwinsnstr/window
mvwinsstr/window
mvwinstr/window
mvwinwstr/window
mvwprintw/window
mvwscanw/screen
mvwvline/window
mvwvline_set/window
napms/reentrant
newpad/global locks(windowlist)
newscr/screen (readonly)
newterm/global locks(screenlist)
newwin/global locks(windowlist)
nl/screen
nocbreak/screen
nodelay/window
noecho/screen
nofilter/global
nonl/screen
noqiflush/terminal
noraw/screen
notimeout/window
numcodes/global (readonly)
numfnames/global (readonly)
numnames/global (readonly)
ospeed/global
overlay/window locks(source, target)
overwrite/window locks(source, target)
pair_content/screen
pecho_wchar/screen
pechochar/screen
pnoutrefresh/screen
prefresh/screen
printw/window
putp/global
putwin/window
qiflush/terminal
raw/screen
redrawwin/window
refresh/screen
reset_prog_mode/screen
reset_shell_mode/screen
resetty/terminal
resize_term/screen locks(windowlist)
resizeterm/screen
restartterm/screen
ripoffline/global (static data)
savetty/terminal
scanw/screen
scr_dump/screen
scr_init/screen
scr_restore/screen
scr_set/screen
scrl/window (stdscr)
scroll/window
scrollok/window
set_curterm/screen
set_escdelay/screen
set_tabsize/screen
set_term/global locks(screenlist, screen)
setcchar/reentrant
setscrreg/window (stdscr)
setupterm/global
slk_attr/screen
slk_attr_off/screen
slk_attr_on/screen
slk_attr_set/screen
slk_attroff/screen
slk_attron/screen
slk_attrset/screen
slk_clear/screen
slk_color/screen
slk_init/screen
slk_label/screen
slk_noutrefresh/screen
slk_refresh/screen
slk_restore/screen
slk_set/screen
slk_touch/screen
slk_wset/screen
standend/window
standout/window
start_color/screen
stdscr/screen (readonly)
strcodes/global (readonly)
strfnames/global (readonly)
strnames/global (readonly)
subpad/window
subwin/window
syncok/window
term_attrs/screen
termattrs/screen
termname/terminal
tgetent/global
tgetflag/global
tgetnum/global
tgetstr/global
tgoto/global
tigetflag/terminal
tigetnum/terminal
tigetstr/terminal
timeout/window (stdscr)
touchline/window
touchwin/window
tparm/global (static data)
tputs/screen
trace/global (static data)
ttytype/screen (readonly)
typeahead/screen
unctrl/screen
unget_wch/screen (input-operation)
ungetch/screen (input-operation)
ungetmouse/screen (input-operation)
untouchwin/window
use_default_colors/screen
use_env/global (static data)
use_extended_names/global (static data)
use_legacy_coding/screen
use_screen/global locks(screenlist, screen)
use_window/global locks(windowlist, window)
vid_attr/screen
vid_puts/screen
vidattr/screen
vidputs/screen
vline/window (stdscr)
vline_set/window (stdscr)
vw_printw/window
vw_scanw/screen
vwprintw/window
vwscanw/screen
wadd_wch/window
wadd_wchnstr/window
wadd_wchstr/window
waddch/window
waddchnstr/window
waddchstr/window
waddnstr/window
waddnwstr/window
waddstr/window
waddwstr/window
wattr_get/window
wattr_off/window
wattr_on/window
wattr_set/window
wattroff/window
wattron/window
wattrset/window
wbkgd/window
wbkgdset/window
wbkgrnd/window
wbkgrndset/window
wborder/window
wborder_set/window
wchgat/window
wclear/window
wclrtobot/window
wclrtoeol/window
wcolor_set/window
wcursyncup/screen (affects window plus parents)
wdelch/window
wdeleteln/window
wecho_wchar/window
wechochar/window
wenclose/window
werase/window
wget_wch/screen (input-operation)
wget_wstr/screen (input-operation)
wgetbkgrnd/window
wgetch/screen (input-operation)
wgetn_wstr/screen (input-operation)
wgetnstr/screen (input-operation)
wgetparent/window
wgetscrreg/window
wgetstr/screen (input-operation)
whline/window
whline_set/window
win_wch/window
win_wchnstr/window
win_wchstr/window
winch/window
winchnstr/window
winchstr/window
winnstr/window
winnwstr/window
wins_nwstr/window
wins_wch/window
wins_wstr/window
winsch/window
winsdelln/window
winsertln/window
winsnstr/window
winsstr/window
winstr/window
winwstr/window
wmouse_trafo/window
wmove/window
wnoutrefresh/screen
wprintw/window
wredrawln/window
wrefresh/screen
wresize/window locks(windowlist)
wscanw/screen
wscrl/window
wsetscrreg/window
wstandend/window
wstandout/window
wsyncdown/screen (affects window plus parents)
wsyncup/screen (affects window plus parents)
wtimeout/window
wtouchln/window
wunctrl/global (static data)
wvline/window
wvline_set/window
.TE
.\" ***************************************************************************
.SH RETURN VALUE
These functions all return TRUE or FALSE, except as noted.
.SH NOTES

View File

@ -1,6 +1,6 @@
'\" t
.\"***************************************************************************
.\" Copyright (c) 1998-2002,2006 Free Software Foundation, Inc. *
.\" Copyright (c) 1998-2006,2008 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
.\" copy of this software and associated documentation files (the *
@ -27,7 +27,7 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: form.3x,v 1.20 2006/11/04 18:50:09 tom Exp $
.\" $Id: form.3x,v 1.21 2008/04/26 17:11:52 tom Exp $
.TH form 3X ""
.SH NAME
\fBform\fR - curses extension for programming forms
@ -69,7 +69,7 @@ current_field \fBform_page\fR(3X)
data_ahead \fBform_data\fR(3X)
data_behind \fBform_data\fR(3X)
dup_field \fBform_field_new\fR(3X)
dynamic_fieldinfo \fBform_field_info\fR(3X)
dynamic_field_info \fBform_field_info\fR(3X)
field_arg \fBform_field_validation\fR(3X)
field_back \fBform_field_attributes\fR(3X)
field_buffer \fBform_field_buffer\fR(3X)

View File

@ -1,4 +1,4 @@
.\" $Id: terminfo.tail,v 1.48 2007/06/02 20:30:40 tom Exp $
.\" $Id: terminfo.tail,v 1.49 2008/02/16 20:57:43 tom Exp $
.\" Beginning of terminfo.tail file
.\" This file is part of ncurses.
.\" See "terminfo.head" for copyright.
@ -325,7 +325,9 @@ The \fB%\fR encodings have the following meanings:
outputs `%'
.TP
%\fI[[\fP:\fI]flags][width[.precision]][\fPdoxXs\fI]\fP
as in \fBprintf\fP, flags are [-+#] and space
as in \fBprintf\fP, flags are [-+#] and space.
Use a `:' to allow the next character to be a `-' flag,
avoiding interpreting "%-" as an operator.
.TP
%c
print pop() like %c in \fBprintf\fP

View File

@ -6,8 +6,8 @@
# Report bugs and new terminal descriptions to
# bug-ncurses@gnu.org
#
# $Revision: 1.326 $
# $Date: 2007/11/12 00:22:07 $
# $Revision: 1.328 $
# $Date: 2008/04/29 00:49:41 $
#
# The original header is preserved below for reference. It is noted that there
# is a "newer" version which differs in some cosmetic details (but actually
@ -4359,13 +4359,20 @@ screen-256color-bce-s|GNU Screen with 256 colors, BCE, and status line,
# if the terminal is wide (132 cols or more)). If even this
# entry cannot be found, "vt100" is used as a substitute.
#
# Notwithstanding the manpage, screen uses its own notion of the termcap
# and some keys from "screen.<term>" are ignored. Here is an entry which
# covers those (tested with screen 4.00.02) -TD
screen+fkeys|function-keys according to screen,
kend=\E[4~, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kfnd@,
khome=\E[1~, kslt@,
#
# Here are a few customized entries which are useful -TD
#
# Notes:
# (a) screen does not support invis.
# (b) screen's implementation of bw is incorrect according to tack.
# (c) screen appears to hardcode the strings for khome/kend, making it
# necessary to override the "use=" clause's values.
# necessary to override the "use=" clause's values (screen+fkeys).
# (d) screen sets $TERMCAP to a termcap-formatted copy of the 'screen' entry,
# which is NOT the same as the terminfo screen.<term>.
# (e) when screen finds one of these customized entries, it sets $TERM to
@ -4377,24 +4384,29 @@ screen-256color-bce-s|GNU Screen with 256 colors, BCE, and status line,
# translation. They are suppressed here to show what is tested by tack.
screen.xterm-xfree86|screen.xterm-new|screen customized for modern xterm,
bce@, bw,
invis@, kIC@, kNXT@, kPRV@, kend=\E[4~, khome=\E[1~, meml@,
memu@,
invis@, kIC@, kNXT@, kPRV@, meml@, memu@,
sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m,
use=xterm-new,
use=screen+fkeys, use=xterm-new,
# xterm-r6 does not really support khome/kend unless it is propped up by
# the translations resource.
screen.xterm-r6|screen customized for X11R6 xterm,
bw, use=xterm-r6,
bw, use=screen+fkeys, use=xterm-r6,
# Color applications running in screen and TeraTerm do not play well together
# on Solaris because Sun's curses implementation gets confused.
screen.teraterm|disable ncv in teraterm,
ncv#127,
acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260i\316j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376,
use=screen,
use=screen+fkeys, use=screen,
# Other terminals
screen.rxvt|screen in rxvt,
bw,
cvvis@, flash@, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC,
kcuu1=\EOA, use=screen+fkeys, use=vt100+enq,
use=rxvt+pcfkeys, use=vt220+keypad, use=screen,
# fix the backspace key
screen.linux|screen in linux console,
bw,
kbs=\177, kcbt@, use=screen,
kbs=\177, kcbt@, use=screen+fkeys, use=screen,
screen-w|VT 100/ANSI X3.64 virtual terminal with 132 cols,
cols#132, use=screen,
@ -21661,6 +21673,12 @@ v3220|LANPAR Vision II model 3220/3221/3222,
# * add xterm+app, xterm+noapp, from xterm #230 -TD
# * add/use xterm+pce2 from xterm #230, in xterm+pcfkeys -TD
#
# 2008-04-19
# * add screen.rxvt -TD
#
# 2008-04-28
# * add screen+fkeys (prompted by Debian # 478094) -TD
#
# The following sets edit modes for GNU EMACS.
# Local Variables:
# fill-prefix:"\t"

View File

@ -36,7 +36,7 @@
#include <curses.priv.h>
#include <ctype.h>
MODULE_ID("$Id: lib_addch.c,v 1.108 2008/02/03 18:50:27 tom Exp $")
MODULE_ID("$Id: lib_addch.c,v 1.111 2008/03/29 18:48:02 tom Exp $")
static const NCURSES_CH_T blankchar = NewChar(BLANK_TEXT);
@ -217,7 +217,9 @@ _nc_build_wch(WINDOW *win, ARG_CH_T ch)
buffer,
WINDOW_EXT(win, addch_used), &state)) > 0) {
attr_t attrs = AttrOf(CHDEREF(ch));
if_EXT_COLORS(int pair = GetPair(CHDEREF(ch)));
SetChar(CHDEREF(ch), result, attrs);
if_EXT_COLORS(SetPair(CHDEREF(ch), pair));
WINDOW_EXT(win, addch_used) = 0;
} else if (len == -1) {
/*
@ -474,6 +476,7 @@ waddch_nosync(WINDOW *win, const NCURSES_CH_T ch)
while (*s) {
NCURSES_CH_T sch;
SetChar(sch, *s++, AttrOf(ch));
if_EXT_COLORS(SetPair(sch, GetPair(ch)));
if (waddch_literal(win, sch) == ERR)
return ERR;
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
* Copyright (c) 1998-2006,2008 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@ -36,7 +36,7 @@
#include <curses.priv.h>
MODULE_ID("$Id: lib_bkgd.c,v 1.35 2006/05/27 19:20:11 tom Exp $")
MODULE_ID("$Id: lib_bkgd.c,v 1.36 2008/03/23 00:09:14 tom Exp $")
/*
* Set the window's background information.
@ -70,7 +70,7 @@ wbkgrndset(WINDOW *win, const ARG_CH_T ch)
if (CharOf(CHDEREF(ch)) == L('\0')) {
SetChar(win->_nc_bkgd, BLANK_TEXT, AttrOf(CHDEREF(ch)));
SetPair(win->_nc_bkgd, GetPair(CHDEREF(ch)));
if_EXT_COLORS(SetPair(win->_nc_bkgd, GetPair(CHDEREF(ch))));
} else {
win->_nc_bkgd = CHDEREF(ch);
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 1998-2001,2007 Free Software Foundation, Inc. *
* Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@ -40,7 +40,7 @@
#include <curses.priv.h>
MODULE_ID("$Id: lib_delwin.c,v 1.15 2007/12/22 23:34:26 tom Exp $")
MODULE_ID("$Id: lib_delwin.c,v 1.16 2008/05/03 14:13:51 tom Exp $")
static bool
cannot_delete(WINDOW *win)
@ -48,7 +48,7 @@ cannot_delete(WINDOW *win)
WINDOWLIST *p;
bool result = TRUE;
for (p = _nc_windows; p != 0; p = p->next) {
for (each_window(p)) {
if (&(p->win) == win) {
result = FALSE;
} else if ((p->win._flags & _SUBWIN) != 0

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
* Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@ -40,7 +40,7 @@
extern int malloc_errfd; /* FIXME */
#endif
MODULE_ID("$Id: lib_freeall.c,v 1.45 2007/12/22 23:29:37 tom Exp $")
MODULE_ID("$Id: lib_freeall.c,v 1.46 2008/05/03 14:13:51 tom Exp $")
/*
* Free all ncurses data. This is used for testing only (there's no practical
@ -67,10 +67,10 @@ _nc_freeall(void)
bool deleted = FALSE;
/* Delete only windows that're not a parent */
for (p = _nc_windows; p != 0; p = p->next) {
for (each_window(p)) {
bool found = FALSE;
for (q = _nc_windows; q != 0; q = q->next) {
for (each_window(q)) {
if ((p != q)
&& (q->win._flags & _SUBWIN)
&& (&(p->win) == q->win._parent)) {

View File

@ -41,17 +41,19 @@
#include <curses.priv.h>
MODULE_ID("$Id: lib_getch.c,v 1.82 2008/01/19 21:07:30 tom Exp $")
MODULE_ID("$Id: lib_getch.c,v 1.87 2008/05/03 22:42:10 tom Exp $")
#include <fifo_defs.h>
#if USE_REENTRANT
#define GetEscdelay(sp) (sp)->_ESCDELAY
NCURSES_EXPORT(int)
NCURSES_PUBLIC_VAR(ESCDELAY) (void)
{
return SP ? SP->_ESCDELAY : 1000;
return SP ? GetEscdelay(SP) : 1000;
}
#else
#define GetEscdelay(sp) ESCDELAY
NCURSES_EXPORT_VAR(int)
ESCDELAY = 1000; /* max interval betw. chars in funkeys, in millisecs */
#endif
@ -84,20 +86,20 @@ set_escdelay(int value)
* Check for mouse activity, returning nonzero if we find any.
*/
static int
check_mouse_activity(int delay EVENTLIST_2nd(_nc_eventlist * evl))
check_mouse_activity(SCREEN *sp, int delay EVENTLIST_2nd(_nc_eventlist * evl))
{
int rc;
#if USE_SYSMOUSE
if ((SP->_mouse_type == M_SYSMOUSE)
&& (SP->_sysmouse_head < SP->_sysmouse_tail)) {
if ((sp->_mouse_type == M_SYSMOUSE)
&& (sp->_sysmouse_head < sp->_sysmouse_tail)) {
return 2;
}
#endif
rc = _nc_timed_wait(TWAIT_MASK, delay, (int *) 0 EVENTLIST_2nd(evl));
rc = _nc_timed_wait(sp, TWAIT_MASK, delay, (int *) 0 EVENTLIST_2nd(evl));
#if USE_SYSMOUSE
if ((SP->_mouse_type == M_SYSMOUSE)
&& (SP->_sysmouse_head < SP->_sysmouse_tail)
if ((sp->_mouse_type == M_SYSMOUSE)
&& (sp->_sysmouse_head < sp->_sysmouse_tail)
&& (rc == 0)
&& (errno == EINTR)) {
rc |= 2;
@ -107,9 +109,9 @@ check_mouse_activity(int delay EVENTLIST_2nd(_nc_eventlist * evl))
}
static NCURSES_INLINE int
fifo_peek(void)
fifo_peek(SCREEN *sp)
{
int ch = SP->_fifo[peek];
int ch = sp->_fifo[peek];
TR(TRACE_IEVENT, ("peeking at %d", peek));
p_inc();
@ -117,10 +119,10 @@ fifo_peek(void)
}
static NCURSES_INLINE int
fifo_pull(void)
fifo_pull(SCREEN *sp)
{
int ch;
ch = SP->_fifo[head];
ch = sp->_fifo[head];
TR(TRACE_IEVENT, ("pulling %s from %d", _tracechar(ch), head));
if (peek == head) {
@ -131,7 +133,7 @@ fifo_pull(void)
#ifdef TRACE
if (USE_TRACEF(TRACE_IEVENT)) {
_nc_fifo_dump();
_nc_fifo_dump(sp);
_nc_unlock_global(tracef);
}
#endif
@ -139,7 +141,7 @@ fifo_pull(void)
}
static NCURSES_INLINE int
fifo_push(EVENTLIST_0th(_nc_eventlist * evl))
fifo_push(SCREEN *sp EVENTLIST_2nd(_nc_eventlist * evl))
{
int n;
int ch = 0;
@ -157,47 +159,47 @@ fifo_push(EVENTLIST_0th(_nc_eventlist * evl))
#ifdef NCURSES_WGETCH_EVENTS
if (evl
#if USE_GPM_SUPPORT || USE_EMX_MOUSE || USE_SYSMOUSE
|| (SP->_mouse_fd >= 0)
|| (sp->_mouse_fd >= 0)
#endif
) {
mask = check_mouse_activity(-1 EVENTLIST_2nd(evl));
mask = check_mouse_activity(sp, -1 EVENTLIST_2nd(evl));
} else
mask = 0;
if (mask & 4) {
T(("fifo_push: ungetch KEY_EVENT"));
ungetch(KEY_EVENT);
_nc_ungetch(sp, KEY_EVENT);
return KEY_EVENT;
}
#elif USE_GPM_SUPPORT || USE_EMX_MOUSE || USE_SYSMOUSE
if (SP->_mouse_fd >= 0) {
mask = check_mouse_activity(-1 EVENTLIST_2nd(evl));
if (sp->_mouse_fd >= 0) {
mask = check_mouse_activity(sp, -1 EVENTLIST_2nd(evl));
}
#endif
#if USE_GPM_SUPPORT || USE_EMX_MOUSE
if ((SP->_mouse_fd >= 0) && (mask & 2)) {
SP->_mouse_event(SP);
if ((sp->_mouse_fd >= 0) && (mask & 2)) {
sp->_mouse_event(sp);
ch = KEY_MOUSE;
n = 1;
} else
#endif
#if USE_SYSMOUSE
if ((SP->_mouse_type == M_SYSMOUSE)
&& (SP->_sysmouse_head < SP->_sysmouse_tail)) {
SP->_mouse_event(SP);
if ((sp->_mouse_type == M_SYSMOUSE)
&& (sp->_sysmouse_head < sp->_sysmouse_tail)) {
sp->_mouse_event(sp);
ch = KEY_MOUSE;
n = 1;
} else if ((SP->_mouse_type == M_SYSMOUSE)
} else if ((sp->_mouse_type == M_SYSMOUSE)
&& (mask <= 0) && errno == EINTR) {
SP->_mouse_event(SP);
sp->_mouse_event(sp);
ch = KEY_MOUSE;
n = 1;
} else
#endif
{ /* Can block... */
unsigned char c2 = 0;
n = read(SP->_ifd, &c2, 1);
n = read(sp->_ifd, &c2, 1);
ch = c2;
}
@ -216,20 +218,20 @@ fifo_push(EVENTLIST_0th(_nc_eventlist * evl))
#endif
if ((n == -1) || (n == 0)) {
TR(TRACE_IEVENT, ("read(%d,&ch,1)=%d, errno=%d", SP->_ifd, n, errno));
TR(TRACE_IEVENT, ("read(%d,&ch,1)=%d, errno=%d", sp->_ifd, n, errno));
ch = ERR;
}
TR(TRACE_IEVENT, ("read %d characters", n));
SP->_fifo[tail] = ch;
SP->_fifohold = 0;
sp->_fifo[tail] = ch;
sp->_fifohold = 0;
if (head == -1)
head = peek = tail;
t_inc();
TR(TRACE_IEVENT, ("pushed %s at %d", _tracechar(ch), tail));
#ifdef TRACE
if (USE_TRACEF(TRACE_IEVENT)) {
_nc_fifo_dump();
_nc_fifo_dump(sp);
_nc_unlock_global(tracef);
}
#endif
@ -237,14 +239,14 @@ fifo_push(EVENTLIST_0th(_nc_eventlist * evl))
}
static NCURSES_INLINE void
fifo_clear(void)
fifo_clear(SCREEN *sp)
{
memset(SP->_fifo, 0, sizeof(SP->_fifo));
memset(sp->_fifo, 0, sizeof(sp->_fifo));
head = -1;
tail = peek = 0;
}
static int kgetch(EVENTLIST_0th(_nc_eventlist * evl));
static int kgetch(SCREEN *EVENTLIST_2nd(_nc_eventlist * evl));
#define wgetch_should_refresh(win) (\
(is_wintouched(win) || (win->_flags & _HASMOVED)) \
@ -256,6 +258,7 @@ _nc_wgetch(WINDOW *win,
int use_meta
EVENTLIST_2nd(_nc_eventlist * evl))
{
SCREEN *sp = SP;
int ch;
#ifdef NCURSES_WGETCH_EVENTS
long event_delay = -1;
@ -264,7 +267,7 @@ _nc_wgetch(WINDOW *win,
T((T_CALLED("_nc_wgetch(%p)"), win));
*result = 0;
if (win == 0 || SP == 0) {
if (win == 0 || sp == 0) {
returnCode(ERR);
}
@ -272,7 +275,7 @@ _nc_wgetch(WINDOW *win,
if (wgetch_should_refresh(win))
wrefresh(win);
*result = fifo_pull();
*result = fifo_pull(sp);
returnCode(*result >= KEY_MIN ? KEY_CODE_YES : OK);
}
#ifdef NCURSES_WGETCH_EVENTS
@ -287,26 +290,26 @@ _nc_wgetch(WINDOW *win,
* the first character to return it.
*/
if (head == -1 &&
!SP->_notty &&
!SP->_raw &&
!SP->_cbreak &&
!SP->_called_wgetch) {
char buf[MAXCOLUMNS], *sp;
!sp->_notty &&
!sp->_raw &&
!sp->_cbreak &&
!sp->_called_wgetch) {
char buf[MAXCOLUMNS], *bufp;
int rc;
TR(TRACE_IEVENT, ("filling queue in cooked mode"));
SP->_called_wgetch = TRUE;
sp->_called_wgetch = TRUE;
rc = wgetnstr(win, buf, MAXCOLUMNS);
SP->_called_wgetch = FALSE;
sp->_called_wgetch = FALSE;
/* ungetch in reverse order */
#ifdef NCURSES_WGETCH_EVENTS
if (rc != KEY_EVENT)
#endif
ungetch('\n');
for (sp = buf + strlen(buf); sp > buf; sp--)
ungetch(sp[-1]);
_nc_ungetch(sp, '\n');
for (bufp = buf + strlen(buf); bufp > buf; bufp--)
_nc_ungetch(sp, bufp[-1]);
#ifdef NCURSES_WGETCH_EVENTS
/* Return it first */
@ -314,24 +317,24 @@ _nc_wgetch(WINDOW *win,
*result = rc;
} else
#endif
*result = fifo_pull();
*result = fifo_pull(sp);
returnCode(*result >= KEY_MIN ? KEY_CODE_YES : OK);
}
if (win->_use_keypad != SP->_keypad_on)
_nc_keypad(win->_use_keypad);
if (win->_use_keypad != sp->_keypad_on)
_nc_keypad(sp, win->_use_keypad);
if (wgetch_should_refresh(win))
wrefresh(win);
if (!win->_notimeout && (win->_delay >= 0 || SP->_cbreak > 1)) {
if (!win->_notimeout && (win->_delay >= 0 || sp->_cbreak > 1)) {
if (head == -1) { /* fifo is empty */
int delay;
int rc;
TR(TRACE_IEVENT, ("timed delay in wgetch()"));
if (SP->_cbreak > 1)
delay = (SP->_cbreak - 1) * 100;
if (sp->_cbreak > 1)
delay = (sp->_cbreak - 1) * 100;
else
delay = win->_delay;
@ -342,7 +345,7 @@ _nc_wgetch(WINDOW *win,
TR(TRACE_IEVENT, ("delay is %d milliseconds", delay));
rc = check_mouse_activity(delay EVENTLIST_2nd(evl));
rc = check_mouse_activity(sp, delay EVENTLIST_2nd(evl));
#ifdef NCURSES_WGETCH_EVENTS
if (rc & 4) {
@ -372,23 +375,23 @@ _nc_wgetch(WINDOW *win,
int rc;
do {
ch = kgetch(EVENTLIST_1st(evl));
ch = kgetch(sp EVENTLIST_2nd(evl));
if (ch == KEY_MOUSE) {
++runcount;
if (SP->_mouse_inline(SP))
if (sp->_mouse_inline(sp))
break;
}
if (SP->_maxclick < 0)
if (sp->_maxclick < 0)
break;
} while
(ch == KEY_MOUSE
&& (((rc = check_mouse_activity(SP->_maxclick
&& (((rc = check_mouse_activity(sp, sp->_maxclick
EVENTLIST_2nd(evl))) != 0
&& !(rc & 4))
|| !SP->_mouse_parse(runcount)));
|| !sp->_mouse_parse(runcount)));
#ifdef NCURSES_WGETCH_EVENTS
if ((rc & 4) && !ch == KEY_EVENT) {
ungetch(ch);
_nc_ungetch(sp, ch);
ch = KEY_EVENT;
}
#endif
@ -396,28 +399,28 @@ _nc_wgetch(WINDOW *win,
#ifdef NCURSES_WGETCH_EVENTS
/* mouse event sequence ended by an event, report event */
if (ch == KEY_EVENT) {
ungetch(KEY_MOUSE); /* FIXME This interrupts a gesture... */
_nc_ungetch(sp, KEY_MOUSE); /* FIXME This interrupts a gesture... */
} else
#endif
{
/* mouse event sequence ended by keystroke, store keystroke */
ungetch(ch);
_nc_ungetch(sp, ch);
ch = KEY_MOUSE;
}
}
} else {
if (head == -1)
fifo_push(EVENTLIST_1st(evl));
ch = fifo_pull();
fifo_push(sp EVENTLIST_2nd(evl));
ch = fifo_pull(sp);
}
if (ch == ERR) {
#if USE_SIZECHANGE
if (_nc_handle_sigwinch(FALSE)) {
_nc_update_screensize();
if (_nc_handle_sigwinch(sp)) {
_nc_update_screensize(sp);
/* resizeterm can push KEY_RESIZE */
if (cooked_key_in_fifo()) {
*result = fifo_pull();
*result = fifo_pull(sp);
returnCode(*result >= KEY_MIN ? KEY_CODE_YES : OK);
}
}
@ -443,7 +446,7 @@ _nc_wgetch(WINDOW *win,
* However, we provide the same visual result as Solaris, moving the
* cursor to the left.
*/
if (SP->_echo && !(win->_flags & _ISPAD)) {
if (sp->_echo && !(win->_flags & _ISPAD)) {
chtype backup = (ch == KEY_BACKSPACE) ? '\b' : ch;
if (backup < KEY_MIN)
wechochar(win, backup);
@ -452,7 +455,7 @@ _nc_wgetch(WINDOW *win,
/*
* Simulate ICRNL mode
*/
if ((ch == '\r') && SP->_nl)
if ((ch == '\r') && sp->_nl)
ch = '\n';
/* Strip 8th-bit if so desired. We do this only for characters that
@ -474,13 +477,14 @@ _nc_wgetch(WINDOW *win,
NCURSES_EXPORT(int)
wgetch_events(WINDOW *win, _nc_eventlist * evl)
{
SCREEN *sp = SP;
int code;
unsigned long value;
T((T_CALLED("wgetch_events(%p,%p)"), win, evl));
code = _nc_wgetch(win,
&value,
SP->_use_meta
sp->_use_meta
EVENTLIST_2nd(evl));
if (code != ERR)
code = value;
@ -491,13 +495,14 @@ wgetch_events(WINDOW *win, _nc_eventlist * evl)
NCURSES_EXPORT(int)
wgetch(WINDOW *win)
{
SCREEN *sp = SP;
int code;
unsigned long value;
T((T_CALLED("wgetch(%p)"), win));
code = _nc_wgetch(win,
&value,
(SP ? SP->_use_meta : 0)
(sp ? sp->_use_meta : 0)
EVENTLIST_2nd((_nc_eventlist *) 0));
if (code != ERR)
code = value;
@ -520,21 +525,21 @@ wgetch(WINDOW *win)
*/
static int
kgetch(EVENTLIST_0th(_nc_eventlist * evl))
kgetch(SCREEN *sp EVENTLIST_2nd(_nc_eventlist * evl))
{
TRIES *ptr;
int ch = 0;
int timeleft = ESCDELAY;
int timeleft = GetEscdelay(sp);
TR(TRACE_IEVENT, ("kgetch() called"));
ptr = SP->_keytry;
ptr = sp->_keytry;
for (;;) {
if (cooked_key_in_fifo() && SP->_fifo[head] >= KEY_MIN) {
if (cooked_key_in_fifo() && sp->_fifo[head] >= KEY_MIN) {
break;
} else if (!raw_key_in_fifo()) {
ch = fifo_push(EVENTLIST_1st(evl));
ch = fifo_push(sp EVENTLIST_2nd(evl));
if (ch == ERR) {
peek = head; /* the keys stay uninterpreted */
return ERR;
@ -542,12 +547,12 @@ kgetch(EVENTLIST_0th(_nc_eventlist * evl))
#ifdef NCURSES_WGETCH_EVENTS
else if (ch == KEY_EVENT) {
peek = head; /* the keys stay uninterpreted */
return fifo_pull(); /* Remove KEY_EVENT from the queue */
return fifo_pull(sp); /* Remove KEY_EVENT from the queue */
}
#endif
}
ch = fifo_peek();
ch = fifo_peek(sp);
if (ch >= KEY_MIN) {
/* If not first in queue, somebody put this key there on purpose in
* emergency. Consider it higher priority than the unfinished
@ -573,7 +578,7 @@ kgetch(EVENTLIST_0th(_nc_eventlist * evl))
if (ptr->value != 0) { /* sequence terminated */
TR(TRACE_IEVENT, ("end of sequence"));
if (peek == tail)
fifo_clear();
fifo_clear(sp);
else
head = peek;
return (ptr->value);
@ -585,7 +590,7 @@ kgetch(EVENTLIST_0th(_nc_eventlist * evl))
int rc;
TR(TRACE_IEVENT, ("waiting for rest of sequence"));
rc = check_mouse_activity(timeleft EVENTLIST_2nd(evl));
rc = check_mouse_activity(sp, timeleft EVENTLIST_2nd(evl));
#ifdef NCURSES_WGETCH_EVENTS
if (rc & 4) {
TR(TRACE_IEVENT, ("interrupted by a user event"));
@ -600,7 +605,7 @@ kgetch(EVENTLIST_0th(_nc_eventlist * evl))
}
}
}
ch = fifo_pull();
ch = fifo_pull(sp);
peek = head;
return ch;
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 1998-2005,2007 Free Software Foundation, Inc. *
* Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@ -45,15 +45,19 @@
#include <sys/termio.h> /* needed for ISC */
#endif
MODULE_ID("$Id: lib_initscr.c,v 1.35 2007/04/21 20:43:02 tom Exp $")
MODULE_ID("$Id: lib_initscr.c,v 1.36 2008/04/12 18:11:36 tom Exp $")
NCURSES_EXPORT(WINDOW *)
initscr(void)
{
WINDOW *result;
NCURSES_CONST char *name;
START_TRACE();
T((T_CALLED("initscr()")));
_nc_lock_global(set_SP);
/* Portable applications must not call initscr() more than once */
if (!_nc_globals.init_screen) {
_nc_globals.init_screen = TRUE;
@ -86,5 +90,8 @@ initscr(void)
/* def_shell_mode - done in newterm/_nc_setupscreen */
def_prog_mode();
}
returnWin(stdscr);
result = stdscr;
_nc_unlock_global(set_SP);
returnWin(result);
}

View File

@ -48,7 +48,7 @@
#include <term.h> /* clear_screen, cup & friends, cur_term */
#include <tic.h>
MODULE_ID("$Id: lib_newterm.c,v 1.68 2008/01/12 20:24:40 tom Exp $")
MODULE_ID("$Id: lib_newterm.c,v 1.69 2008/04/12 18:15:04 tom Exp $")
#ifndef ONLCR /* Allows compilation under the QNX 4.2 OS */
#define ONLCR 0
@ -123,17 +123,17 @@ newterm(NCURSES_CONST char *name, FILE *ofp, FILE *ifp)
{
int value;
int errret;
int slk_format = _nc_globals.slk_format;
SCREEN *current;
SCREEN *result = 0;
START_TRACE();
T((T_CALLED("newterm(\"%s\",%p,%p)"), name, ofp, ifp));
_nc_lock_global(set_SP);
/* this loads the capability entry, then sets LINES and COLS */
if (setupterm(name, fileno(ofp), &errret) == ERR) {
result = 0;
} else {
if (setupterm(name, fileno(ofp), &errret) != ERR) {
int slk_format = _nc_globals.slk_format;
/*
* This actually allocates the screen structure, and saves the original
* terminal settings.
@ -143,11 +143,7 @@ newterm(NCURSES_CONST char *name, FILE *ofp, FILE *ifp)
/* allow user to set maximum escape delay from the environment */
if ((value = _nc_getenv_num("ESCDELAY")) >= 0) {
#if USE_REENTRANT
SP->_ESCDELAY = value;
#else
ESCDELAY = value;
#endif
set_escdelay(value);
}
if (_nc_setupscreen(LINES,
@ -216,5 +212,6 @@ newterm(NCURSES_CONST char *name, FILE *ofp, FILE *ifp)
result = SP;
}
}
_nc_unlock_global(set_SP);
returnSP(result);
}

View File

@ -40,42 +40,39 @@
*/
#include <curses.priv.h>
#include <stddef.h>
MODULE_ID("$Id: lib_newwin.c,v 1.44 2008/01/13 00:28:13 tom Exp $")
MODULE_ID("$Id: lib_newwin.c,v 1.50 2008/05/03 16:36:39 tom Exp $")
static WINDOW *
#define window_is(name) ((sp)->_##name == win)
#if USE_REENTRANT
#define remove_window(name) \
sp->_##name = 0
#else
#define remove_window(name) \
sp->_##name = 0; \
if (win == name) \
name = 0
#endif
static void
remove_window_from_screen(WINDOW *win)
{
SCREEN **scan = &_nc_screen_chain;
SCREEN *sp;
while (*scan) {
SCREEN *sp = *scan;
if (sp->_curscr == win) {
sp->_curscr = 0;
#if !USE_REENTRANT
if (win == curscr)
curscr = 0;
#endif
} else if (sp->_stdscr == win) {
sp->_stdscr = 0;
#if !USE_REENTRANT
if (win == stdscr)
stdscr = 0;
#endif
} else if (sp->_newscr == win) {
sp->_newscr = 0;
#if !USE_REENTRANT
if (win == newscr)
newscr = 0;
#endif
} else {
scan = &(*scan)->_next_screen;
continue;
for (each_screen(sp)) {
if (window_is(curscr)) {
remove_window(curscr);
break;
} else if (window_is(stdscr)) {
remove_window(stdscr);
break;
} else if (window_is(newscr)) {
remove_window(newscr);
break;
}
break;
}
return 0;
}
NCURSES_EXPORT(int)
@ -89,7 +86,8 @@ _nc_freewin(WINDOW *win)
if (win != 0) {
if (_nc_try_global(windowlist) == 0) {
for (p = _nc_windows, q = 0; p != 0; q = p, p = p->next) {
q = 0;
for (each_window(p)) {
if (&(p->win) == win) {
remove_window_from_screen(win);
if (q == 0)
@ -108,6 +106,7 @@ _nc_freewin(WINDOW *win)
T(("...deleted win=%p", win));
break;
}
q = p;
}
_nc_unlock_global(windowlist);
}
@ -230,14 +229,7 @@ _nc_makenew(int num_lines, int num_columns, int begy, int begx, int flags)
if ((wp = typeCalloc(WINDOWLIST, 1)) == 0)
returnWin(0);
#ifdef USE_PTHREADS
{
pthread_mutexattr_t recattr;
memset(&recattr, 0, sizeof(recattr));
pthread_mutexattr_settype(&recattr, PTHREAD_MUTEX_NORMAL);
pthread_mutex_init(&(wp->mutex_use_window), &recattr);
}
#endif
_nc_mutex_init(&(wp->mutex_use_window));
win = &(wp->win);

View File

@ -40,46 +40,46 @@
#include <curses.priv.h>
MODULE_ID("$Id: lib_overlay.c,v 1.23 2007/04/07 17:13:52 tom Exp $")
MODULE_ID("$Id: lib_overlay.c,v 1.25 2008/04/12 17:21:59 tom Exp $")
static int
overlap(const WINDOW *const s, WINDOW *const d, int const flag)
overlap(const WINDOW *const src, WINDOW *const dst, int const flag)
{
int rc = ERR;
int sx1, sy1, sx2, sy2;
int dx1, dy1, dx2, dy2;
int sminrow, smincol;
int dminrow, dmincol;
int dmaxrow, dmaxcol;
T((T_CALLED("overlap(%p,%p,%d)"), s, d, flag));
T((T_CALLED("overlap(%p,%p,%d)"), src, dst, flag));
if (src != 0 && dst != 0) {
_nc_lock_window(src);
_nc_lock_window(dst);
if (s == 0 || d == 0) {
returnCode(ERR);
} else {
T(("src : begy %ld, begx %ld, maxy %ld, maxx %ld",
(long) s->_begy,
(long) s->_begx,
(long) s->_maxy,
(long) s->_maxx));
(long) src->_begy,
(long) src->_begx,
(long) src->_maxy,
(long) src->_maxx));
T(("dst : begy %ld, begx %ld, maxy %ld, maxx %ld",
(long) d->_begy,
(long) d->_begx,
(long) d->_maxy,
(long) d->_maxx));
(long) dst->_begy,
(long) dst->_begx,
(long) dst->_maxy,
(long) dst->_maxx));
sx1 = s->_begx;
sy1 = s->_begy;
sx2 = sx1 + s->_maxx;
sy2 = sy1 + s->_maxy;
sx1 = src->_begx;
sy1 = src->_begy;
sx2 = sx1 + src->_maxx;
sy2 = sy1 + src->_maxy;
dx1 = d->_begx;
dy1 = d->_begy;
dx2 = dx1 + d->_maxx;
dy2 = dy1 + d->_maxy;
dx1 = dst->_begx;
dy1 = dst->_begy;
dx2 = dx1 + dst->_maxx;
dy2 = dy1 + dst->_maxy;
if (dx2 < sx1 || dx1 > sx2 || dy2 < sy1 || dy1 > sy2) {
returnCode(ERR); /* No intersection */
} else {
if (dx2 >= sx1 && dx1 <= sx2 && dy2 >= sy1 && dy1 <= sy2) {
sminrow = max(sy1, dy1) - sy1;
smincol = max(sx1, dx1) - sx1;
dminrow = max(sy1, dy1) - dy1;
@ -87,13 +87,16 @@ overlap(const WINDOW *const s, WINDOW *const d, int const flag)
dmaxrow = min(sy2, dy2) - dy1;
dmaxcol = min(sx2, dx2) - dx1;
returnCode(copywin(s, d,
sminrow, smincol,
dminrow, dmincol,
dmaxrow, dmaxcol,
flag));
rc = copywin(src, dst,
sminrow, smincol,
dminrow, dmincol,
dmaxrow, dmaxcol,
flag);
}
_nc_unlock_window(dst);
_nc_unlock_window(src);
}
returnCode(rc);
}
/*
@ -137,6 +140,7 @@ copywin(const WINDOW *src, WINDOW *dst,
int dmaxrow, int dmaxcol,
int over)
{
int rc = ERR;
int sx, sy, dx, dy;
bool touched;
attr_t bk;
@ -145,49 +149,63 @@ copywin(const WINDOW *src, WINDOW *dst,
T((T_CALLED("copywin(%p, %p, %d, %d, %d, %d, %d, %d, %d)"),
src, dst, sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol, over));
if (!src || !dst)
returnCode(ERR);
if (src && dst) {
bk = AttrOf(dst->_nc_bkgd);
mask = ~(attr_t) ((bk & A_COLOR) ? A_COLOR : 0);
_nc_lock_window(src);
_nc_lock_window(dst);
/* make sure rectangle exists in source */
if ((sminrow + dmaxrow - dminrow) > (src->_maxy + 1) ||
(smincol + dmaxcol - dmincol) > (src->_maxx + 1)) {
returnCode(ERR);
}
bk = AttrOf(dst->_nc_bkgd);
mask = ~(attr_t) ((bk & A_COLOR) ? A_COLOR : 0);
T(("rectangle exists in source"));
/* make sure rectangle exists in source */
if ((sminrow + dmaxrow - dminrow) <= (src->_maxy + 1) &&
(smincol + dmaxcol - dmincol) <= (src->_maxx + 1)) {
/* make sure rectangle fits in destination */
if (dmaxrow > dst->_maxy || dmaxcol > dst->_maxx) {
returnCode(ERR);
}
T(("rectangle exists in source"));
T(("rectangle fits in destination"));
/* make sure rectangle fits in destination */
if (dmaxrow <= dst->_maxy && dmaxcol <= dst->_maxx) {
for (dy = dminrow, sy = sminrow; dy <= dmaxrow; sy++, dy++) {
touched = FALSE;
for (dx = dmincol, sx = smincol; dx <= dmaxcol; sx++, dx++) {
if (over) {
if ((CharOf(src->_line[sy].text[sx]) != L(' ')) &&
(!CharEq(dst->_line[dy].text[dx], src->_line[sy].text[sx]))) {
dst->_line[dy].text[dx] = src->_line[sy].text[sx];
SetAttr(dst->_line[dy].text[dx],
(AttrOf(src->_line[sy].text[sx]) & mask) | bk);
touched = TRUE;
}
} else {
if (!CharEq(dst->_line[dy].text[dx], src->_line[sy].text[sx])) {
dst->_line[dy].text[dx] = src->_line[sy].text[sx];
touched = TRUE;
T(("rectangle fits in destination"));
for (dy = dminrow, sy = sminrow;
dy <= dmaxrow;
sy++, dy++) {
touched = FALSE;
for (dx = dmincol, sx = smincol;
dx <= dmaxcol;
sx++, dx++) {
if (over) {
if ((CharOf(src->_line[sy].text[sx]) != L(' ')) &&
(!CharEq(dst->_line[dy].text[dx],
src->_line[sy].text[sx]))) {
dst->_line[dy].text[dx] =
src->_line[sy].text[sx];
SetAttr(dst->_line[dy].text[dx],
((AttrOf(src->_line[sy].text[sx]) &
mask) | bk));
touched = TRUE;
}
} else {
if (!CharEq(dst->_line[dy].text[dx],
src->_line[sy].text[sx])) {
dst->_line[dy].text[dx] =
src->_line[sy].text[sx];
touched = TRUE;
}
}
}
if (touched) {
touchline(dst, dminrow, (dmaxrow - dminrow + 1));
}
}
T(("finished copywin"));
rc = OK;
}
}
if (touched) {
touchline(dst, dminrow, (dmaxrow - dminrow + 1));
}
_nc_unlock_window(dst);
_nc_unlock_window(src);
}
T(("finished copywin"));
returnCode(OK);
returnCode(rc);
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
* Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@ -48,7 +48,7 @@
#include <term.h> /* lines, columns, cur_term */
MODULE_ID("$Id: lib_restart.c,v 1.8 2007/10/13 19:59:47 tom Exp $")
MODULE_ID("$Id: lib_restart.c,v 1.9 2008/05/03 22:43:52 tom Exp $")
NCURSES_EXPORT(int)
restartterm(NCURSES_CONST char *termp, int filenum, int *errret)
@ -88,7 +88,7 @@ restartterm(NCURSES_CONST char *termp, int filenum, int *errret)
reset_prog_mode();
#if USE_SIZECHANGE
_nc_update_screensize();
_nc_update_screensize(SP);
#endif
result = OK;

View File

@ -44,7 +44,7 @@
#include <term.h> /* cur_term */
#include <tic.h>
MODULE_ID("$Id: lib_set_term.c,v 1.103 2008/02/03 20:31:08 tom Exp $")
MODULE_ID("$Id: lib_set_term.c,v 1.108 2008/05/03 22:42:43 tom Exp $")
NCURSES_EXPORT(SCREEN *)
set_term(SCREEN *screenp)
@ -58,14 +58,25 @@ set_term(SCREEN *screenp)
oldSP = SP;
_nc_set_screen(screenp);
set_curterm(SP->_term);
if (SP != 0) {
set_curterm(SP->_term);
#if !USE_REENTRANT
curscr = SP->_curscr;
newscr = SP->_newscr;
stdscr = SP->_stdscr;
COLORS = SP->_color_count;
COLOR_PAIRS = SP->_pair_count;
curscr = SP->_curscr;
newscr = SP->_newscr;
stdscr = SP->_stdscr;
COLORS = SP->_color_count;
COLOR_PAIRS = SP->_pair_count;
#endif
} else {
set_curterm(0);
#if !USE_REENTRANT
curscr = 0;
newscr = 0;
stdscr = 0;
COLORS = 0;
COLOR_PAIRS = 0;
#endif
}
_nc_unlock_global(set_SP);
@ -83,90 +94,105 @@ _nc_free_keytry(TRIES * kt)
}
}
static bool
delink_screen(SCREEN *sp)
{
SCREEN *last = 0;
SCREEN *temp;
bool result = FALSE;
for (each_screen(temp)) {
if (temp == sp) {
if (last)
last = sp->_next_screen;
else
_nc_screen_chain = sp->_next_screen;
result = TRUE;
break;
}
last = temp;
}
return result;
}
/*
* Free the storage associated with the given SCREEN sp.
*/
NCURSES_EXPORT(void)
delscreen(SCREEN *sp)
{
SCREEN **scan = &_nc_screen_chain;
int i;
T((T_CALLED("delscreen(%p)"), sp));
_nc_lock_global(set_SP);
while (*scan) {
if (*scan == sp) {
*scan = sp->_next_screen;
break;
}
scan = &(*scan)->_next_screen;
}
if (delink_screen(sp)) {
(void) _nc_freewin(sp->_curscr);
(void) _nc_freewin(sp->_newscr);
(void) _nc_freewin(sp->_stdscr);
(void) _nc_freewin(sp->_curscr);
(void) _nc_freewin(sp->_newscr);
(void) _nc_freewin(sp->_stdscr);
if (sp->_slk != 0) {
if (sp->_slk->ent != 0) {
for (i = 0; i < sp->_slk->labcnt; ++i) {
FreeIfNeeded(sp->_slk->ent[i].ent_text);
FreeIfNeeded(sp->_slk->ent[i].form_text);
if (sp->_slk != 0) {
if (sp->_slk->ent != 0) {
for (i = 0; i < sp->_slk->labcnt; ++i) {
FreeIfNeeded(sp->_slk->ent[i].ent_text);
FreeIfNeeded(sp->_slk->ent[i].form_text);
}
free(sp->_slk->ent);
}
free(sp->_slk->ent);
free(sp->_slk);
sp->_slk = 0;
}
free(sp->_slk);
sp->_slk = 0;
}
_nc_free_keytry(sp->_keytry);
sp->_keytry = 0;
_nc_free_keytry(sp->_keytry);
sp->_keytry = 0;
_nc_free_keytry(sp->_key_ok);
sp->_key_ok = 0;
_nc_free_keytry(sp->_key_ok);
sp->_key_ok = 0;
FreeIfNeeded(sp->_current_attr);
FreeIfNeeded(sp->_current_attr);
FreeIfNeeded(sp->_color_table);
FreeIfNeeded(sp->_color_pairs);
FreeIfNeeded(sp->_color_table);
FreeIfNeeded(sp->_color_pairs);
FreeIfNeeded(sp->oldhash);
FreeIfNeeded(sp->newhash);
FreeIfNeeded(sp->hashtab);
FreeIfNeeded(sp->oldhash);
FreeIfNeeded(sp->newhash);
FreeIfNeeded(sp->hashtab);
FreeIfNeeded(sp->_acs_map);
FreeIfNeeded(sp->_screen_acs_map);
FreeIfNeeded(sp->_acs_map);
FreeIfNeeded(sp->_screen_acs_map);
del_curterm(sp->_term);
del_curterm(sp->_term);
/*
* If the associated output stream has been closed, we can discard the
* set-buffer. Limit the error check to EBADF, since fflush may fail
* for other reasons than trying to operate upon a closed stream.
*/
if (sp->_ofp != 0
&& sp->_setbuf != 0
&& fflush(sp->_ofp) != 0
&& errno == EBADF) {
free(sp->_setbuf);
}
/*
* If the associated output stream has been closed, we can discard the
* set-buffer. Limit the error check to EBADF, since fflush may fail
* for other reasons than trying to operate upon a closed stream.
*/
if (sp->_ofp != 0
&& sp->_setbuf != 0
&& fflush(sp->_ofp) != 0
&& errno == EBADF) {
free(sp->_setbuf);
}
free(sp);
free(sp);
/*
* If this was the current screen, reset everything that the
* application might try to use (except cur_term, which may have
* multiple references in different screens).
*/
if (sp == SP) {
/*
* If this was the current screen, reset everything that the
* application might try to use (except cur_term, which may have
* multiple references in different screens).
*/
if (sp == SP) {
#if !USE_REENTRANT
curscr = 0;
newscr = 0;
stdscr = 0;
COLORS = 0;
COLOR_PAIRS = 0;
curscr = 0;
newscr = 0;
stdscr = 0;
COLORS = 0;
COLOR_PAIRS = 0;
#endif
_nc_set_screen(0);
_nc_set_screen(0);
}
}
_nc_unlock_global(set_SP);
@ -254,7 +280,7 @@ _nc_setupscreen(int slines GCC_UNUSED,
/*
* We should always check the screensize, just in case.
*/
_nc_get_screensize(&slines, &scolumns);
_nc_get_screensize(SP, &slines, &scolumns);
SET_LINES(slines);
SET_COLS(scolumns);
T((T_CREATE("screen %s %dx%d"), termname(), LINES, COLS));
@ -512,8 +538,6 @@ _nc_setupscreen(int slines GCC_UNUSED,
_nc_idcok = TRUE;
_nc_idlok = FALSE;
_nc_windows = 0; /* no windows yet */
SP->oldhash = 0;
SP->newhash = 0;

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 1998-2002,2007 Free Software Foundation, Inc. *
* Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@ -29,6 +29,7 @@
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
* and: Thomas E. Dickey 1996-on *
****************************************************************************/
/*
@ -40,42 +41,50 @@
#include <curses.priv.h>
MODULE_ID("$Id: lib_ungetch.c,v 1.9 2007/09/29 21:49:56 tom Exp $")
MODULE_ID("$Id: lib_ungetch.c,v 1.10 2008/05/03 20:20:58 tom Exp $")
#include <fifo_defs.h>
#ifdef TRACE
NCURSES_EXPORT(void)
_nc_fifo_dump(void)
_nc_fifo_dump(SCREEN *sp)
{
int i;
T(("head = %d, tail = %d, peek = %d", head, tail, peek));
for (i = 0; i < 10; i++)
T(("char %d = %s", i, _tracechar(SP->_fifo[i])));
T(("char %d = %s", i, _tracechar(sp->_fifo[i])));
}
#endif /* TRACE */
NCURSES_EXPORT(int)
_nc_ungetch(SCREEN *sp, int ch)
{
int rc = ERR;
if (tail != -1) {
if (head == -1) {
head = 0;
t_inc();
peek = tail; /* no raw keys */
} else
h_dec();
sp->_fifo[head] = ch;
T(("ungetch %s ok", _tracechar(ch)));
#ifdef TRACE
if (USE_TRACEF(TRACE_IEVENT)) {
_nc_fifo_dump(sp);
_nc_unlock_global(tracef);
}
#endif
rc = OK;
}
return rc;
}
NCURSES_EXPORT(int)
ungetch(int ch)
{
T((T_CALLED("ungetch(%s)"), _tracechar(ch)));
if (tail == -1)
returnCode(ERR);
if (head == -1) {
head = 0;
t_inc()
peek = tail; /* no raw keys */
} else
h_dec();
SP->_fifo[head] = ch;
T(("ungetch %s ok", _tracechar(ch)));
#ifdef TRACE
if (USE_TRACEF(TRACE_IEVENT)) {
_nc_fifo_dump();
_nc_unlock_global(tracef);
}
#endif
returnCode(OK);
returnCode(_nc_ungetch(SP, ch));
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
* Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@ -39,7 +39,7 @@
#include <curses.priv.h>
MODULE_ID("$Id: lib_window.c,v 1.23 2007/06/30 23:36:11 tom Exp $")
MODULE_ID("$Id: lib_window.c,v 1.24 2008/04/12 22:40:21 tom Exp $")
NCURSES_EXPORT(void)
_nc_synchook(WINDOW *win)
@ -186,6 +186,7 @@ dupwin(WINDOW *win)
if (win != 0) {
_nc_lock_window(win);
if (win->_flags & _ISPAD) {
nwin = newpad(win->_maxy + 1,
win->_maxx + 1);
@ -243,6 +244,7 @@ dupwin(WINDOW *win)
nwin->_line[i].lastchar = win->_line[i].lastchar;
}
}
_nc_unlock_window(win);
}
returnWin(nwin);
}

View File

@ -41,7 +41,7 @@
#include <curses.priv.h>
#include <term.h>
MODULE_ID("$Id: resizeterm.c,v 1.30 2008/01/12 22:26:56 tom Exp $")
MODULE_ID("$Id: resizeterm.c,v 1.32 2008/05/03 14:28:55 tom Exp $")
#define stolen_lines (screen_lines - SP->_lines_avail)
@ -69,7 +69,7 @@ show_window_sizes(const char *name)
_nc_lock_global(windowlist);
_tracef("%s resizing: %2d x %2d (%2d x %2d)", name, LINES, COLS,
screen_lines, screen_columns);
for (wp = _nc_windows; wp != 0; wp = wp->next) {
for (each_window(wp)) {
_tracef(" window %p is %2ld x %2ld at %2ld,%2ld",
&(wp->win),
(long) wp->win._maxy + 1,
@ -104,7 +104,7 @@ ripped_window(WINDOW *win)
ripoff_t *rop;
if (win != 0) {
for (rop = ripoff_stack; (rop - ripoff_stack) < N_RIPS; rop++) {
for (each_ripoff(rop)) {
if (rop->win == win && rop->line != 0) {
result = rop;
break;
@ -125,7 +125,7 @@ ripped_bottom(WINDOW *win)
ripoff_t *rop;
if (win != 0) {
for (rop = ripoff_stack; (rop - ripoff_stack) < N_RIPS; rop++) {
for (each_ripoff(rop)) {
if (rop->line < 0) {
result -= rop->line;
if (rop->win == win) {
@ -148,7 +148,7 @@ child_depth(WINDOW *cmp)
if (cmp != 0) {
WINDOWLIST *wp;
for (wp = _nc_windows; wp != 0; wp = wp->next) {
for (each_window(wp)) {
WINDOW *tst = &(wp->win);
if (tst->_parent == cmp) {
depth = 1 + child_depth(tst);
@ -251,7 +251,7 @@ decrease_size(int ToLines, int ToCols, int stolen EXTRA_DCLS)
found = FALSE;
TR(TRACE_UPDATE, ("decreasing size of windows to %dx%d, depth=%d",
ToLines, ToCols, depth));
for (wp = _nc_windows; wp != 0; wp = wp->next) {
for (each_window(wp)) {
WINDOW *win = &(wp->win);
if (!(win->_flags & _ISPAD)) {
@ -285,7 +285,7 @@ increase_size(int ToLines, int ToCols, int stolen EXTRA_DCLS)
found = FALSE;
TR(TRACE_UPDATE, ("increasing size of windows to %dx%d, depth=%d",
ToLines, ToCols, depth));
for (wp = _nc_windows; wp != 0; wp = wp->next) {
for (each_window(wp)) {
WINDOW *win = &(wp->win);
if (!(win->_flags & _ISPAD)) {
@ -428,7 +428,7 @@ resizeterm(int ToLines, int ToCols)
* decide which to repaint, since without panels, ncurses does
* not know which are really on top.
*/
for (rop = ripoff_stack; (rop - ripoff_stack) < N_RIPS; rop++) {
for (each_ripoff(rop)) {
if (rop->win != stdscr
&& rop->win != 0
&& rop->line < 0) {

View File

@ -32,31 +32,29 @@
#include <curses.priv.h>
MODULE_ID("$Id: use_window.c,v 1.3 2008/01/13 00:36:22 tom Exp $")
MODULE_ID("$Id: use_window.c,v 1.7 2008/05/03 14:09:38 tom Exp $")
#ifdef USE_PTHREADS
NCURSES_EXPORT(void)
_nc_lock_window(WINDOW *win)
_nc_lock_window(const WINDOW *win)
{
WINDOWLIST *p;
_nc_lock_global(windowlist);
for (p = _nc_windows; p != 0; p = p->next) {
for (each_window(p)) {
if (&(p->win) == win) {
_nc_mutex_lock(&(p->mutex_use_window));
break;
}
}
_nc_unlock_global(windowlist);
}
NCURSES_EXPORT(void)
_nc_unlock_window(WINDOW *win)
_nc_unlock_window(const WINDOW *win)
{
WINDOWLIST *p;
_nc_lock_global(windowlist);
for (p = _nc_windows; p != 0; p = p->next) {
for (each_window(p)) {
if (&(p->win) == win) {
_nc_mutex_unlock(&(p->mutex_use_window));
break;
@ -67,7 +65,7 @@ _nc_unlock_window(WINDOW *win)
#endif
NCURSES_EXPORT(int)
use_window(WINDOW *win, NCURSES_CALLBACK func, void *data)
use_window(WINDOW *win, NCURSES_WINDOW_CB func, void *data)
{
int code = OK;

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
* Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@ -32,7 +32,7 @@
#include <curses.priv.h>
MODULE_ID("$Id: wresize.c,v 1.27 2007/12/22 23:20:53 tom Exp $")
MODULE_ID("$Id: wresize.c,v 1.28 2008/05/03 14:13:51 tom Exp $")
static int
cleanup_lines(struct ldat *data, int length)
@ -56,7 +56,7 @@ repair_subwindows(WINDOW *cmp)
_nc_lock_global(windowlist);
for (wp = _nc_windows; wp != 0; wp = wp->next) {
for (each_window(wp)) {
WINDOW *tst = &(wp->win);
if (tst->_parent == cmp) {

View File

@ -34,7 +34,7 @@
/*
* $Id: curses.priv.h,v 1.357 2008/01/13 00:33:10 tom Exp $
* $Id: curses.priv.h,v 1.373 2008/05/03 23:30:35 tom Exp $
*
* curses.priv.h
*
@ -312,8 +312,10 @@ color_t;
#define TR_GLOBAL_MUTEX(name) TR_MUTEX(_nc_globals.mutex_##name)
#ifdef USE_PTHREADS
#if USE_REENTRANT
#include <pthread.h>
extern NCURSES_EXPORT(void) _nc_mutex_init(pthread_mutex_t *);
extern NCURSES_EXPORT(int) _nc_mutex_lock(pthread_mutex_t *);
extern NCURSES_EXPORT(int) _nc_mutex_trylock(pthread_mutex_t *);
extern NCURSES_EXPORT(int) _nc_mutex_unlock(pthread_mutex_t *);
@ -321,13 +323,22 @@ extern NCURSES_EXPORT(int) _nc_mutex_unlock(pthread_mutex_t *);
#define _nc_try_global(name) _nc_mutex_trylock(&_nc_globals.mutex_##name)
#define _nc_unlock_global(name) _nc_mutex_unlock(&_nc_globals.mutex_##name)
extern NCURSES_EXPORT(void) _nc_lock_window(WINDOW *);
extern NCURSES_EXPORT(void) _nc_unlock_window(WINDOW *);
extern NCURSES_EXPORT(void) _nc_lock_window(const WINDOW *);
extern NCURSES_EXPORT(void) _nc_unlock_window(const WINDOW *);
#else
#error POSIX threads requires --enable-reentrant option
#endif
#else
#if HAVE_NANOSLEEP
#undef HAVE_NANOSLEEP
#define HAVE_NANOSLEEP 0 /* nanosleep suspends all threads */
#endif
#else /* !USE_PTHREADS */
#define _nc_mutex_init(obj) /* nothing */
#define _nc_lock_global(name) /* nothing */
#define _nc_try_global(name) 0
#define _nc_unlock_global(name) /* nothing */
@ -335,10 +346,15 @@ extern NCURSES_EXPORT(void) _nc_unlock_window(WINDOW *);
#define _nc_lock_window(name) (void) TRUE
#define _nc_unlock_window(name) /* nothing */
#endif
#endif /* USE_PTHREADS */
#define _nc_lock_screen(name) /* nothing */
#define _nc_unlock_screen(name) /* nothing */
#if HAVE_GETTIMEOFDAY
# define PRECISE_GETTIME 1
# define TimeType struct timeval
#else
# define PRECISE_GETTIME 0
# define TimeType time_t
#endif
/*
* Definitions for color pairs
@ -552,6 +568,9 @@ typedef struct {
int tgetent_index;
long tgetent_sequence;
WINDOWLIST *_nc_windowlist;
#define _nc_windows _nc_globals._nc_windowlist
#if USE_HOME_TERMINFO
char *home_terminfo;
#endif
@ -583,11 +602,9 @@ typedef struct {
unsigned char *tracetry_buf;
size_t tracetry_used;
#ifndef USE_TERMLIB
char traceatr_color_buf[2][80];
int traceatr_color_sel;
int traceatr_color_last;
#endif /* USE_TERMLIB */
#endif /* TRACE */
@ -607,7 +624,7 @@ extern NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals;
#define N_RIPS 5
/*
* Global data which is swept up into a SCREEN when one is created.
* Global data which can be swept up into a SCREEN when one is created.
* It may be modified before the next SCREEN is created.
*/
typedef struct {
@ -823,12 +840,6 @@ struct screen {
* per screen basis.
*/
struct panelhook _panelHook;
/*
* Linked-list of all windows, to support '_nc_resizeall()' and
* '_nc_freeall()'
*/
WINDOWLIST *_nc_sp_windows;
#define _nc_windows SP->_nc_sp_windows
bool _sig_winch;
SCREEN *_next_screen;
@ -852,7 +863,7 @@ struct screen {
int _LINES;
int _COLS;
#ifdef TRACE
int _outchars;
long _outchars;
const char *_tputs_trace;
#endif
#endif
@ -1153,6 +1164,13 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
# endif
#endif
/*
* Standardize/simplify common loops
*/
#define each_screen(p) p = _nc_screen_chain; p != 0; p = (p)->_next_screen
#define each_window(p) p = _nc_windows; p != 0; p = (p)->next
#define each_ripoff(p) p = ripoff_stack; (p - ripoff_stack) < N_RIPS; ++p
/*
* Prefixes for call/return points of library function traces. We use these to
* instrument the public functions so that the traces can be easily transformed
@ -1221,7 +1239,7 @@ extern NCURSES_EXPORT(const char *) _nc_retrace_cptr (const char *);
extern NCURSES_EXPORT(int) _nc_retrace_int (int);
extern NCURSES_EXPORT(unsigned) _nc_retrace_unsigned (unsigned);
extern NCURSES_EXPORT(void *) _nc_retrace_void_ptr (void *);
extern NCURSES_EXPORT(void) _nc_fifo_dump (void);
extern NCURSES_EXPORT(void) _nc_fifo_dump (SCREEN *);
#if USE_REENTRANT
NCURSES_WRAPPED_VAR(long, _nc_outchars);
@ -1462,15 +1480,18 @@ extern NCURSES_EXPORT(char *) _nc_get_locale(void);
extern NCURSES_EXPORT(int) _nc_unicode_locale(void);
extern NCURSES_EXPORT(int) _nc_locale_breaks_acs(void);
extern NCURSES_EXPORT(int) _nc_setupterm(NCURSES_CONST char *, int, int *, bool);
extern NCURSES_EXPORT(void) _nc_get_screensize(int *, int *);
extern NCURSES_EXPORT(void) _nc_get_screensize(SCREEN *, int *, int *);
/* lib_tstp.c */
#if USE_SIGWINCH
extern NCURSES_EXPORT(int) _nc_handle_sigwinch(int);
extern NCURSES_EXPORT(int) _nc_handle_sigwinch(SCREEN *);
#else
#define _nc_handle_sigwinch(a) /* nothing */
#endif
/* lib_ungetch.c */
extern NCURSES_EXPORT(int) _nc_ungetch (SCREEN *, int);
/* lib_wacs.c */
#if USE_WIDEC_SUPPORT
extern NCURSES_EXPORT(void) _nc_init_wacs(void);
@ -1513,18 +1534,18 @@ extern NCURSES_EXPORT(int) _nc_access (const char *, int);
extern NCURSES_EXPORT(int) _nc_baudrate (int);
extern NCURSES_EXPORT(int) _nc_freewin (WINDOW *);
extern NCURSES_EXPORT(int) _nc_getenv_num (const char *);
extern NCURSES_EXPORT(int) _nc_keypad (bool);
extern NCURSES_EXPORT(int) _nc_keypad (SCREEN *, bool);
extern NCURSES_EXPORT(int) _nc_ospeed (int);
extern NCURSES_EXPORT(int) _nc_outch (int);
extern NCURSES_EXPORT(int) _nc_read_termcap_entry (const char *const, TERMTYPE *const);
extern NCURSES_EXPORT(int) _nc_setupscreen (int, int, FILE *, bool, int);
extern NCURSES_EXPORT(int) _nc_timed_wait(int, int, int * EVENTLIST_2nd(_nc_eventlist *));
extern NCURSES_EXPORT(int) _nc_timed_wait(SCREEN *, int, int, int * EVENTLIST_2nd(_nc_eventlist *));
extern NCURSES_EXPORT(void) _nc_do_color (short, short, bool, int (*)(int));
extern NCURSES_EXPORT(void) _nc_flush (void);
extern NCURSES_EXPORT(void) _nc_free_entry(ENTRY *, TERMTYPE *);
extern NCURSES_EXPORT(void) _nc_freeall (void);
extern NCURSES_EXPORT(void) _nc_hash_map (void);
extern NCURSES_EXPORT(void) _nc_init_keytry (void);
extern NCURSES_EXPORT(void) _nc_init_keytry (SCREEN *);
extern NCURSES_EXPORT(void) _nc_keep_tic_dir (const char *);
extern NCURSES_EXPORT(void) _nc_make_oldhash (int i);
extern NCURSES_EXPORT(void) _nc_scroll_oldhash (int n, int top, int bot);
@ -1556,7 +1577,7 @@ extern NCURSES_EXPORT(size_t) _nc_wcrtomb (char *, wchar_t, mbstate_t *);
#endif
#if USE_SIZECHANGE
extern NCURSES_EXPORT(void) _nc_update_screensize (void);
extern NCURSES_EXPORT(void) _nc_update_screensize (SCREEN *);
#endif
#if HAVE_RESIZETERM

View File

@ -34,21 +34,21 @@
/*
* Common macros for lib_getch.c, lib_ungetch.c
*
* $Id: fifo_defs.h,v 1.4 2002/03/16 20:47:50 tom Exp $
* $Id: fifo_defs.h,v 1.5 2008/05/03 20:08:16 tom Exp $
*/
#ifndef FIFO_DEFS_H
#define FIFO_DEFS_H 1
#define head SP->_fifohead
#define tail SP->_fifotail
#define head sp->_fifohead
#define tail sp->_fifotail
/* peek points to next uninterpreted character */
#define peek SP->_fifopeek
#define peek sp->_fifopeek
#define h_inc() { head == FIFO_SIZE-1 ? head = 0 : head++; if (head == tail) head = -1, tail = 0;}
#define h_dec() { head == 0 ? head = FIFO_SIZE-1 : head--; if (head == tail) tail = -1;}
#define t_inc() { tail == FIFO_SIZE-1 ? tail = 0 : tail++; if (tail == head) tail = -1;}
#define t_dec() { tail == 0 ? tail = FIFO_SIZE-1 : tail--; if (head == tail) fifo_clear();}
#define t_dec() { tail == 0 ? tail = FIFO_SIZE-1 : tail--; if (head == tail) fifo_clear(sp);}
#define p_inc() { peek == FIFO_SIZE-1 ? peek = 0 : peek++;}
#define cooked_key_in_fifo() ((head != -1) && (peek != head))

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 1999-2005,2006 Free Software Foundation, Inc. *
* Copyright (c) 1999-2006,2008 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@ -36,7 +36,7 @@
#include <term_entry.h>
MODULE_ID("$Id: init_keytry.c,v 1.10 2007/04/29 22:57:50 tom Exp $")
MODULE_ID("$Id: init_keytry.c,v 1.11 2008/05/03 23:09:15 tom Exp $")
/*
** _nc_init_keytry()
@ -64,19 +64,19 @@ _nc_tinfo_fkeysf(void)
#endif
NCURSES_EXPORT(void)
_nc_init_keytry(void)
_nc_init_keytry(SCREEN *sp)
{
size_t n;
/* The SP->_keytry value is initialized in newterm(), where the SP
/* The sp->_keytry value is initialized in newterm(), where the sp
* structure is created, because we can not tell where keypad() or
* mouse_activate() (which will call keyok()) are first called.
*/
if (SP != 0) {
if (sp != 0) {
for (n = 0; _nc_tinfo_fkeys[n].code; n++) {
if (_nc_tinfo_fkeys[n].offset < STRCOUNT) {
(void) _nc_add_to_try(&(SP->_keytry),
(void) _nc_add_to_try(&(sp->_keytry),
CUR Strings[_nc_tinfo_fkeys[n].offset],
_nc_tinfo_fkeys[n].code);
}
@ -88,7 +88,7 @@ _nc_init_keytry(void)
* names.
*/
{
TERMTYPE *tp = &(SP->_term->type);
TERMTYPE *tp = &(sp->_term->type);
for (n = STRCOUNT; n < NUM_STRINGS(tp); ++n) {
const char *name = ExtStrname(tp, n, strnames);
char *value = tp->Strings[n];
@ -96,7 +96,7 @@ _nc_init_keytry(void)
&& *name == 'k'
&& value != 0
&& key_defined(value) == 0) {
(void) _nc_add_to_try(&(SP->_keytry),
(void) _nc_add_to_try(&(sp->_keytry),
value,
n - STRCOUNT + KEY_MAX);
}
@ -104,7 +104,7 @@ _nc_init_keytry(void)
}
#endif
#ifdef TRACE
_nc_trace_tries(SP->_keytry);
_nc_trace_tries(sp->_keytry);
#endif
}
}

View File

@ -41,7 +41,7 @@
#include <curses.priv.h>
MODULE_ID("$Id: lib_data.c,v 1.39 2008/01/13 01:21:59 tom Exp $")
MODULE_ID("$Id: lib_data.c,v 1.43 2008/03/29 21:16:49 tom Exp $")
/*
* OS/2's native linker complains if we don't initialize public data when
@ -109,7 +109,7 @@ NCURSES_EXPORT_VAR(SCREEN *) SP = NULL; /* Some linkers require initialized data
#define CHARS_0s { '\0' }
#define TGETENT_0 { 0L, FALSE, NULL, NULL, NULL }
#define TGETENT_0s { TGETENT_0, TGETENT_0, TGETENT_0, TGETENT_0 }
#define TGETENT_0s { TGETENT_0, TGETENT_0, TGETENT_0, TGETENT_0 }
NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals = {
0, /* have_sigwinch */
@ -140,6 +140,8 @@ NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals = {
0, /* tgetent_index */
0, /* tgetent_sequence */
0, /* _nc_windowlist */
#if USE_HOME_TERMINFO
NULL, /* home_terminfo */
#endif
@ -171,11 +173,9 @@ NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals = {
NULL, /* tracetry_buf */
0, /* tracetry_used */
#ifndef USE_TERMLIB
{ CHARS_0s, CHARS_0s }, /* traceatr_color_buf */
0, /* traceatr_color_sel */
-1, /* traceatr_color_last */
#endif /* USE_TERMLIB */
#endif /* TRACE */
#ifdef USE_PTHREADS
@ -236,21 +236,59 @@ NCURSES_EXPORT_VAR(NCURSES_PRESCREEN) _nc_prescreen = {
/******************************************************************************/
#ifdef USE_PTHREADS
NCURSES_EXPORT(int)
_nc_mutex_lock(pthread_mutex_t *obj)
static void
init_global_mutexes(void)
{
static bool initialized = FALSE;
if (!initialized) {
initialized = TRUE;
_nc_mutex_init(&_nc_globals.mutex_set_SP);
_nc_mutex_init(&_nc_globals.mutex_use_screen);
_nc_mutex_init(&_nc_globals.mutex_use_window);
_nc_mutex_init(&_nc_globals.mutex_windowlist);
_nc_mutex_init(&_nc_globals.mutex_tst_tracef);
_nc_mutex_init(&_nc_globals.mutex_tracef);
}
}
/*
* Use recursive mutexes if we have them - they're part of Unix98.
* For the cases where we do not, _nc_mutex_trylock() is used to avoid a
* deadlock, at the expense of memory leaks and unexpected failures that
* may not be handled by typical clients.
*
* FIXME - need configure check for PTHREAD_MUTEX_RECURSIVE, define it to
* PTHREAD_MUTEX_NORMAL if not supported.
*/
NCURSES_EXPORT(void)
_nc_mutex_init(pthread_mutex_t * obj)
{
pthread_mutexattr_t recattr;
memset(&recattr, 0, sizeof(recattr));
pthread_mutexattr_settype(&recattr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init(obj, &recattr);
}
NCURSES_EXPORT(int)
_nc_mutex_lock(pthread_mutex_t * obj)
{
init_global_mutexes();
return pthread_mutex_lock(obj);
}
NCURSES_EXPORT(int)
_nc_mutex_trylock(pthread_mutex_t *obj)
_nc_mutex_trylock(pthread_mutex_t * obj)
{
init_global_mutexes();
return pthread_mutex_trylock(obj);
}
NCURSES_EXPORT(int)
_nc_mutex_unlock(pthread_mutex_t *obj)
_nc_mutex_unlock(pthread_mutex_t * obj)
{
init_global_mutexes();
return pthread_mutex_unlock(obj);
}
#endif /* USE_PTHREADS */

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. *
* Copyright (c) 1998-2005,2008 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@ -49,7 +49,7 @@
#endif
#endif
MODULE_ID("$Id: lib_napms.c,v 1.15 2005/04/03 13:58:14 tom Exp $")
MODULE_ID("$Id: lib_napms.c,v 1.17 2008/05/03 21:34:13 tom Exp $")
NCURSES_EXPORT(int)
napms(int ms)
@ -67,7 +67,7 @@ napms(int ms)
}
}
#else
_nc_timed_wait(0, ms, (int *) 0 EVENTLIST_2nd(0));
_nc_timed_wait(0, 0, ms, (int *) 0 EVENTLIST_2nd(0));
#endif
returnCode(OK);

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
* Copyright (c) 1998-2006,2008 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@ -43,7 +43,7 @@
#include <term.h>
MODULE_ID("$Id: lib_options.c,v 1.50 2006/12/30 16:03:27 tom Exp $")
MODULE_ID("$Id: lib_options.c,v 1.52 2008/05/03 23:09:20 tom Exp $")
NCURSES_EXPORT(int)
idlok(WINDOW *win, bool flag)
@ -126,7 +126,7 @@ keypad(WINDOW *win, bool flag)
if (win) {
win->_use_keypad = flag;
returnCode(_nc_keypad(flag));
returnCode(_nc_keypad(SP, flag));
} else
returnCode(ERR);
}
@ -220,7 +220,7 @@ typeahead(int fd)
#if NCURSES_EXT_FUNCS
static int
has_key_internal(int keycode, TRIES *tp)
has_key_internal(int keycode, TRIES * tp)
{
if (tp == 0)
return (FALSE);
@ -247,7 +247,7 @@ has_key(int keycode)
* the terminal state _before_ switching modes.
*/
NCURSES_EXPORT(int)
_nc_keypad(bool flag)
_nc_keypad(SCREEN *sp, bool flag)
{
if (flag && keypad_xmit) {
TPUTS_TRACE("keypad_xmit");
@ -259,12 +259,12 @@ _nc_keypad(bool flag)
_nc_flush();
}
if (SP != 0) {
if (flag && !SP->_tried) {
_nc_init_keytry();
SP->_tried = TRUE;
if (sp != 0) {
if (flag && !sp->_tried) {
_nc_init_keytry(sp);
sp->_tried = TRUE;
}
SP->_keypad_on = flag;
sp->_keypad_on = flag;
}
return (OK);
}

View File

@ -53,7 +53,7 @@
#include <term.h> /* lines, columns, cur_term */
MODULE_ID("$Id: lib_setup.c,v 1.102 2008/01/19 21:07:45 tom Exp $")
MODULE_ID("$Id: lib_setup.c,v 1.105 2008/05/03 22:41:42 tom Exp $")
/****************************************************************************
*
@ -154,23 +154,19 @@ set_tabsize(int value)
* If we have a pending SIGWINCH, set the flag in each screen.
*/
NCURSES_EXPORT(int)
_nc_handle_sigwinch(int update)
_nc_handle_sigwinch(SCREEN *sp)
{
SCREEN *scan;
(void) update; /* no longer used */
if (_nc_globals.have_sigwinch) {
_nc_globals.have_sigwinch = 0;
scan = _nc_screen_chain;
while (scan) {
for (each_screen(scan)) {
scan->_sig_winch = TRUE;
scan = scan->_next_screen;
}
}
return (SP ? SP->_sig_winch : 0);
return (sp ? sp->_sig_winch : 0);
}
#endif
@ -184,7 +180,7 @@ use_env(bool f)
}
NCURSES_EXPORT(void)
_nc_get_screensize(int *linep, int *colp)
_nc_get_screensize(SCREEN *sp, int *linep, int *colp)
/* Obtain lines/columns values from the environment and/or terminfo entry */
{
int my_tabsize;
@ -238,7 +234,7 @@ _nc_get_screensize(int *linep, int *colp)
* environment variable.
*/
if (*linep <= 0)
*linep = (SP != 0 && SP->_filtered) ? 1 : WINSIZE_ROWS(size);
*linep = (sp != 0 && sp->_filtered) ? 1 : WINSIZE_ROWS(size);
if (*colp <= 0)
*colp = WINSIZE_COLS(size);
}
@ -279,8 +275,8 @@ _nc_get_screensize(int *linep, int *colp)
my_tabsize = 8;
#if USE_REENTRANT
if (SP != 0)
SP->_TABSIZE = my_tabsize;
if (sp != 0)
sp->_TABSIZE = my_tabsize;
#else
TABSIZE = my_tabsize;
#endif
@ -289,25 +285,25 @@ _nc_get_screensize(int *linep, int *colp)
#if USE_SIZECHANGE
NCURSES_EXPORT(void)
_nc_update_screensize(void)
_nc_update_screensize(SCREEN *sp)
{
int old_lines = lines;
int new_lines;
int old_cols = columns;
int new_cols;
_nc_get_screensize(&new_lines, &new_cols);
_nc_get_screensize(sp, &new_lines, &new_cols);
/*
* See is_term_resized() and resizeterm().
* We're doing it this way because those functions belong to the upper
* ncurses library, while this resides in the lower terminfo library.
*/
if (SP != 0
&& SP->_resize != 0) {
if (sp != 0
&& sp->_resize != 0) {
if ((new_lines != old_lines) || (new_cols != old_cols))
SP->_resize(new_lines, new_cols);
SP->_sig_winch = FALSE;
sp->_resize(new_lines, new_cols);
sp->_sig_winch = FALSE;
}
}
#endif
@ -590,10 +586,11 @@ _nc_setupterm(NCURSES_CONST char *tname, int Filedes, int *errret, bool reuse)
* We should always check the screensize, just in case.
*/
#if USE_REENTRANT
_nc_get_screensize(SP ? &(SP->_LINES) : &(_nc_prescreen._LINES),
_nc_get_screensize(SP,
SP ? &(SP->_LINES) : &(_nc_prescreen._LINES),
SP ? &(SP->_COLS) : &(_nc_prescreen._COLS));
#else
_nc_get_screensize(&LINES, &COLS);
_nc_get_screensize(SP, &LINES, &COLS);
#endif
if (errret)

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
* Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@ -38,7 +38,7 @@
#include <curses.priv.h>
#include <term.h> /* cur_term */
MODULE_ID("$Id: lib_ttyflags.c,v 1.15 2007/05/26 18:54:25 tom Exp $")
MODULE_ID("$Id: lib_ttyflags.c,v 1.16 2008/05/03 22:39:03 tom Exp $")
NCURSES_EXPORT(int)
_nc_get_tty_mode(TTY * buf)
@ -147,7 +147,7 @@ reset_prog_mode(void)
if (_nc_set_tty_mode(&cur_term->Nttyb) == OK) {
if (SP) {
if (SP->_keypad_on)
_nc_keypad(TRUE);
_nc_keypad(SP, TRUE);
NC_BUFFERED(TRUE);
}
returnCode(OK);
@ -163,7 +163,7 @@ reset_shell_mode(void)
if (cur_term != 0) {
if (SP) {
_nc_keypad(FALSE);
_nc_keypad(SP, FALSE);
_nc_flush();
NC_BUFFERED(FALSE);
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 2007 Free Software Foundation, Inc. *
* Copyright (c) 2007,2008 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@ -32,10 +32,10 @@
#include <curses.priv.h>
MODULE_ID("$Id: use_screen.c,v 1.2 2007/09/08 21:46:48 tom Exp $")
MODULE_ID("$Id: use_screen.c,v 1.4 2008/03/29 21:19:58 tom Exp $")
NCURSES_EXPORT(int)
use_screen(SCREEN *screen, NCURSES_CALLBACK func, void *data)
use_screen(SCREEN *screen, NCURSES_SCREEN_CB func, void *data)
{
SCREEN *save_SP;
int code = OK;
@ -50,7 +50,7 @@ use_screen(SCREEN *screen, NCURSES_CALLBACK func, void *data)
save_SP = SP;
set_term(screen);
code = func(screen->_stdscr, data);
code = func(screen, data);
set_term(save_SP);
_nc_unlock_global(use_screen);

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
* Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@ -46,7 +46,7 @@
#include <ctype.h>
MODULE_ID("$Id: lib_trace.c,v 1.65 2007/09/29 21:47:46 tom Exp $")
MODULE_ID("$Id: lib_trace.c,v 1.66 2008/03/22 16:56:48 tom Exp $")
NCURSES_EXPORT_VAR(unsigned) _nc_tracing = 0; /* always define this */
@ -167,6 +167,18 @@ _nc_va_tracef(const char *fmt, va_list ap)
if (doit != 0) {
if (TraceFP == 0)
TraceFP = stderr;
#ifdef USE_PTHREADS
/*
* TRACE_ICALLS is "really" needed to show normal use with threaded
* applications, since anything can be running during a napms(),
* making it appear in the hierarchical trace as it other functions
* are being called.
*
* Rather than add the complication of a per-thread stack, just
* show the thread-id in each line of the trace.
*/
fprintf(TraceFP, "%#lx:", (long) pthread_self());
#endif
if (before || after) {
int n;
for (n = 1; n < TraceLevel; n++)

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
* Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@ -46,7 +46,7 @@
#define _POSIX_SOURCE
#endif
MODULE_ID("$Id: lib_tstp.c,v 1.36 2007/04/21 19:51:29 tom Exp $")
MODULE_ID("$Id: lib_tstp.c,v 1.37 2008/05/03 16:24:56 tom Exp $")
#if defined(SIGTSTP) && (HAVE_SIGACTION || HAVE_SIGVEC)
#define USE_SIGTSTP 1
@ -252,19 +252,17 @@ cleanup(int sig)
if (signal(sig, SIG_IGN) != SIG_ERR)
#endif
{
SCREEN *scan = _nc_screen_chain;
while (scan) {
if (SP != 0
&& SP->_ofp != 0
&& isatty(fileno(SP->_ofp))) {
SP->_cleanup = TRUE;
SP->_outch = _nc_outch;
SCREEN *scan;
for (each_screen(scan)) {
if (scan->_ofp != 0
&& isatty(fileno(scan->_ofp))) {
scan->_cleanup = TRUE;
scan->_outch = _nc_outch;
}
set_term(scan);
endwin();
if (SP)
SP->_endwin = FALSE; /* in case we have an atexit! */
scan = scan->_next_screen;
}
}
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
* Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@ -62,15 +62,7 @@
# endif
#endif
MODULE_ID("$Id: lib_twait.c,v 1.54 2007/08/11 16:32:48 tom Exp $")
#if HAVE_GETTIMEOFDAY
# define PRECISE_GETTIME 1
# define TimeType struct timeval
#else
# define PRECISE_GETTIME 0
# define TimeType time_t
#endif
MODULE_ID("$Id: lib_twait.c,v 1.57 2008/05/03 21:35:57 tom Exp $")
static long
_nc_gettime(TimeType * t0, bool first)
@ -145,7 +137,8 @@ _nc_eventlist_timeout(_nc_eventlist * evl)
* descriptors.
*/
NCURSES_EXPORT(int)
_nc_timed_wait(int mode,
_nc_timed_wait(SCREEN *sp,
int mode,
int milliseconds,
int *timeleft
EVENTLIST_2nd(_nc_eventlist * evl))
@ -207,12 +200,12 @@ _nc_timed_wait(int mode,
#endif
if (mode & 1) {
fds[count].fd = SP->_ifd;
fds[count].fd = sp->_ifd;
fds[count].events = POLLIN;
count++;
}
if ((mode & 2)
&& (fd = SP->_mouse_fd) >= 0) {
&& (fd = sp->_mouse_fd) >= 0) {
fds[count].fd = fd;
fds[count].events = POLLIN;
count++;
@ -315,11 +308,11 @@ _nc_timed_wait(int mode,
FD_ZERO(&set);
if (mode & 1) {
FD_SET(SP->_ifd, &set);
count = SP->_ifd + 1;
FD_SET(sp->_ifd, &set);
count = sp->_ifd + 1;
}
if ((mode & 2)
&& (fd = SP->_mouse_fd) >= 0) {
&& (fd = sp->_mouse_fd) >= 0) {
FD_SET(fd, &set);
count = max(fd, count) + 1;
}
@ -432,11 +425,11 @@ _nc_timed_wait(int mode,
result = 1; /* redundant, but simple */
#elif HAVE_SELECT
if ((mode & 2)
&& (fd = SP->_mouse_fd) >= 0
&& (fd = sp->_mouse_fd) >= 0
&& FD_ISSET(fd, &set))
result |= 2;
if ((mode & 1)
&& FD_ISSET(SP->_ifd, &set))
&& FD_ISSET(sp->_ifd, &set))
result |= 1;
#endif
} else

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
* Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@ -74,7 +74,7 @@
#include <ctype.h>
#include <term.h>
MODULE_ID("$Id: tty_update.c,v 1.243 2007/10/13 20:03:32 tom Exp $")
MODULE_ID("$Id: tty_update.c,v 1.245 2008/05/03 22:43:04 tom Exp $")
/*
* This define controls the line-breakout optimization. Every once in a
@ -645,7 +645,7 @@ doupdate(void)
SP->_fifohold--;
#if USE_SIZECHANGE
if (SP->_endwin || _nc_handle_sigwinch(FALSE)) {
if (SP->_endwin || _nc_handle_sigwinch(SP)) {
/*
* This is a transparent extension: XSI does not address it,
* and applications need not know that ncurses can do it.
@ -654,7 +654,7 @@ doupdate(void)
* (this can happen in an xterm, for example), and resize the
* ncurses data structures accordingly.
*/
_nc_update_screensize();
_nc_update_screensize(SP);
}
#endif

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
* Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@ -39,7 +39,7 @@
#include "termsort.c" /* this C file is generated */
#include <parametrized.h> /* so is this */
MODULE_ID("$Id: dump_entry.c,v 1.81 2007/08/25 20:05:35 tom Exp $")
MODULE_ID("$Id: dump_entry.c,v 1.82 2008/04/19 22:27:04 tom Exp $")
#define INDENT 8
#define DISCARD(string) string = ABSENT_STRING
@ -539,6 +539,10 @@ fmt_complex(char *src, int level)
params = FALSE;
percent = FALSE;
break;
case ' ':
strncpy_DYN(&tmpbuf, "\\s", 2);
++src;
continue;
default:
percent = FALSE;
break;