ncurses 5.6 - patch 20080119

+ fixes to build with --disable-ext-funcs
+ add manpage for use_window and use_screen.
+ add set_tabsize() and set_escdelay() functions.
This commit is contained in:
Thomas E. Dickey 2008-01-20 00:51:10 +00:00
parent c4d90db4f4
commit 25358bc041
17 changed files with 3724 additions and 40 deletions

View File

@ -571,6 +571,7 @@
./man/curs_termattrs.3x
./man/curs_termcap.3x
./man/curs_terminfo.3x
./man/curs_threads.3x
./man/curs_touch.3x
./man/curs_trace.3x
./man/curs_util.3x
@ -810,6 +811,7 @@
./ncurses/curses.priv.h
./ncurses/fifo_defs.h
./ncurses/llib-lncurses
./ncurses/llib-lncursest
./ncurses/llib-lncursesw
./ncurses/modules
./ncurses/tinfo/MKcaptab.awk

7
NEWS
View File

@ -25,7 +25,7 @@
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
-- $Id: NEWS,v 1.1197 2008/01/13 01:05:34 tom Exp $
-- $Id: NEWS,v 1.1199 2008/01/19 21:10:02 tom Exp $
-------------------------------------------------------------------------------
This is a log of changes that ncurses has gone through since Zeyd started
@ -45,6 +45,11 @@ 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.
20080119
+ fixes to build with --disable-ext-funcs
+ add manpage for use_window and use_screen.
+ add set_tabsize() and set_escdelay() functions.
20080112
+ remove recursive-mutex definitions, finish threading demo for worm.c
+ remove a redundant adjustment of lines in resizeterm.c's

View File

@ -1,6 +1,7 @@
// * This makes emacs happy -*-Mode: C++;-*-
// vile:cppmode
/****************************************************************************
* 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 *
@ -30,7 +31,7 @@
#ifndef NCURSES_CURSESW_H_incl
#define NCURSES_CURSESW_H_incl 1
// $Id: cursesw.h,v 1.47 2007/12/16 00:21:05 tom Exp $
// $Id: cursesw.h,v 1.48 2008/01/19 21:09:10 tom Exp $
#include <etip.h>
@ -1333,7 +1334,7 @@ public:
// -------------------------------------------------------------------------
// Extended functions
// -------------------------------------------------------------------------
#ifdef NCURSES_EXT_FUNCS
#if defined(NCURSES_EXT_FUNCS) && (NCURSES_EXT_FUNCS != 0)
int wresize(int newLines, int newColumns) {
return ::wresize(w, newLines, newColumns); }
#endif

View File

@ -25,7 +25,7 @@
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
# $Id: dist.mk,v 1.624 2008/01/12 16:01:48 tom Exp $
# $Id: dist.mk,v 1.625 2008/01/19 18:22:11 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 = 20080112
NCURSES_PATCH = 20080119
# We don't append the patch to the version, since this only applies to releases
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)

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 "form.priv.h"
MODULE_ID("$Id: frm_driver.c,v 1.85 2007/11/24 21:32:53 tom Exp $")
MODULE_ID("$Id: frm_driver.c,v 1.86 2008/01/19 20:11:03 tom Exp $")
/*----------------------------------------------------------------------------
This is the core module of the form library. It contains the majority
@ -676,7 +676,7 @@ Field_Grown(FIELD *field, int amount)
new_bp[new_buflen] = myZEROS;
}
#if USE_WIDEC_SUPPORT
#if USE_WIDEC_SUPPORT && NCURSES_EXT_FUNCS
if (wresize(field->working, 1, Buffer_Length(field) + 1) == ERR)
result = FALSE;
#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 *
@ -32,7 +32,7 @@
* and: Thomas E. Dickey 1996-on *
****************************************************************************/
/* $Id: curses.h.in,v 1.181 2007/11/18 00:32:03 tom Exp $ */
/* $Id: curses.h.in,v 1.183 2008/01/19 20:03:48 tom Exp $ */
#ifndef __NCURSES_H
#define __NCURSES_H
@ -827,7 +827,6 @@ extern NCURSES_EXPORT(int) getpary (const WINDOW *); /* generated */
/*
* These functions are extensions - not in X/Open Curses.
*/
#undef NCURSES_EXT_FUNCS
#if @NCURSES_EXT_FUNCS@
#undef NCURSES_EXT_FUNCS
#define NCURSES_EXT_FUNCS @NCURSES_PATCH@
@ -841,6 +840,8 @@ extern NCURSES_EXPORT(int) key_defined (const char *);
extern NCURSES_EXPORT(int) keyok (int, bool);
extern NCURSES_EXPORT(int) resize_term (int, int);
extern NCURSES_EXPORT(int) resizeterm (int, int);
extern NCURSES_EXPORT(int) set_escdelay (int);
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);

113
man/curs_threads.3x Normal file
View File

@ -0,0 +1,113 @@
.\"***************************************************************************
.\" Copyright (c) 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 *
.\" "Software"), to deal in the Software without restriction, including *
.\" without limitation the rights to use, copy, modify, merge, publish, *
.\" distribute, distribute with modifications, sublicense, and/or sell *
.\" copies of the Software, and to permit persons to whom the Software is *
.\" furnished to do so, subject to the following conditions: *
.\" *
.\" The above copyright notice and this permission notice shall be included *
.\" in all copies or substantial portions of the Software. *
.\" *
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
.\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
.\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
.\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
.\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
.\" *
.\" Except as contained in this notice, the name(s) of the above copyright *
.\" holders shall not be used in advertising or otherwise to promote the *
.\" sale, use or other dealings in this Software without prior written *
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: curs_threads.3x,v 1.4 2008/01/19 23:29:24 tom Exp $
.TH curs_threads 3X ""
.na
.hy 0
.SH NAME
\fBuse_screen\fR,
\fBuse_window\fR - \fBcurses\fR thread support
.ad
.hy
.SH SYNOPSIS
\fB#include <curses.h>\fR
.sp
\fBtypedef int (*NCURSES_CALLBACK)(WINDOW *, 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
.br
\fBint use_window(WINDOW *win, NCURSES_CALLBACK func, void *data);\fR
.br
.SH DESCRIPTION
This implementation can be configured to provide rudimentary support
for multi-threaded applications.
This makes a different set of libraries, e.g., \fIlibncursest\fP since
the binary interfaces are different.
.PP
Rather than modify the interfaces to pass a thread specifier to
each function, it adds a few functions which can be used in any
configuration which hide the mutex's needed to prevent concurrent
use of the global variables when configured for threading.
.PP
In addition to forcing access to members of the \fBWINDOW\fP structure
to be via functions (see \fBcurs_opaque\fP(3x)),
it makes functions of the common global variables,
e.g.,
COLORS,
COLOR_PAIRS,
COLS,
ESCDELAY,
LINES,
TABSIZE
curscr,
newscr and
ttytype.
Those variables are maintained as read-only values, stored in the \fBSCREEN\fP
structure.
.PP
Even this is not enough to make a thread-safe application using curses.
A multi-threaded application would be expected to have threads updating
separate windows (within the same device),
or updating on separate screens (on different devices).
Also, a few of the global variables are considered writable by some
applications.
The functions described here address these special situations.
.PP
The ESCDELAY and TABSIZE global variables are modified by some applications.
To modify them in any configuration,
use the \fBset_escdelay\fP or \fBset_tabsize\fP functions.
Other global variables are not modifiable.
.PP
The \fBuse_window\fP and \fBuse_screen\fP functions provide coarse
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.
.SH RETURN VALUE
These functions all return TRUE or FALSE, except as noted.
.SH NOTES
Both a macro and a function are provided for each name.
.SH PORTABILITY
These routines are specific to ncurses.
They were not supported on Version 7, BSD or System V implementations.
It is recommended that any code depending on ncurses extensions
be conditioned using NCURSES_VERSION.
.SH SEE ALSO
\fBcurses\fR(3X),
\fBcurs_opaque\fR(3X)
.\"#
.\"# The following sets edit modes for GNU EMACS
.\"# Local Variables:
.\"# mode:nroff
.\"# fill-column:79
.\"# End:

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 "Software"), #
@ -25,7 +25,7 @@
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
# $Id: man_db.renames,v 0.39 2007/04/07 23:06:31 tom Exp $
# $Id: man_db.renames,v 0.40 2008/01/19 18:28:50 tom Exp $
# Manual-page renamings for the man_db program
#
# Files:
@ -84,6 +84,7 @@ curs_slk.3x slk.3ncurses
curs_termattrs.3x termattrs.3ncurses
curs_termcap.3x termcap.3ncurses
curs_terminfo.3x terminfo.3ncurses
curs_threads.3x threads.3ncurses
curs_touch.3x touch.3ncurses
curs_trace.3x trace.3ncurses
curs_util.3x util.3ncurses
@ -116,9 +117,9 @@ form_userptr.3x userptr.3form
form_win.3x win.3form
infocmp.1m infocmp.1
infotocap.1m infotocap.1
key_defined.3x key_defined.3ncurses
keybound.3x keybound.3ncurses
keyok.3x keyok.3ncurses
key_defined.3x key_defined.3ncurses
legacy_coding.3x legacy_coding.3ncurses
menu.3x menu.3menu
menu_attributes.3x attributes.3menu

View File

@ -1,6 +1,6 @@
# $Id: manlinks.sed,v 1.12 2003/12/20 13:17:56 tom Exp $
# $Id: manlinks.sed,v 1.13 2008/01/19 23:31:17 tom Exp $
##############################################################################
# Copyright (c) 2000-2002,2003 Free Software Foundation, Inc. #
# Copyright (c) 2000-2003,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 "Software"), #
@ -35,6 +35,7 @@
/\.\\"/d
/^\.br/d
/^\.sp/d
/typedef/d
s/^\.IX//
s/\\f.//g
s/[:,]/ /g

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 *
@ -41,7 +41,7 @@
#include <curses.priv.h>
MODULE_ID("$Id: lib_getch.c,v 1.80 2007/09/29 20:39:34 tom Exp $")
MODULE_ID("$Id: lib_getch.c,v 1.82 2008/01/19 21:07:30 tom Exp $")
#include <fifo_defs.h>
@ -56,6 +56,24 @@ NCURSES_EXPORT_VAR(int)
ESCDELAY = 1000; /* max interval betw. chars in funkeys, in millisecs */
#endif
#if NCURSES_EXT_FUNCS
NCURSES_EXPORT(int)
set_escdelay(int value)
{
int code = OK;
#if USE_REENTRANT
if (SP) {
SP->_ESCDELAY = value;
} else {
code = ERR;
}
#else
ESCDELAY = value;
#endif
return code;
}
#endif
#ifdef NCURSES_WGETCH_EVENTS
#define TWAIT_MASK 7
#else

3493
ncurses/llib-lncursest Normal file

File diff suppressed because it is too large Load Diff

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 *
@ -53,7 +53,7 @@
#include <term.h> /* lines, columns, cur_term */
MODULE_ID("$Id: lib_setup.c,v 1.100 2007/09/01 20:58:26 tom Exp $")
MODULE_ID("$Id: lib_setup.c,v 1.102 2008/01/19 21:07:45 tom Exp $")
/****************************************************************************
*
@ -99,6 +99,9 @@ MODULE_ID("$Id: lib_setup.c,v 1.100 2007/09/01 20:58:26 tom Exp $")
# endif
#endif
/*
* Wrap global variables in this module.
*/
#if USE_REENTRANT
NCURSES_EXPORT(char *)
NCURSES_PUBLIC_VAR(ttytype) (void)
@ -128,6 +131,24 @@ NCURSES_EXPORT_VAR(int) COLS = 0;
NCURSES_EXPORT_VAR(int) TABSIZE = 0;
#endif
#if NCURSES_EXT_FUNCS
NCURSES_EXPORT(int)
set_tabsize(int value)
{
int code = OK;
#if USE_REENTRANT
if (SP) {
SP->_TABSIZE = value;
} else {
code = ERR;
}
#else
TABSIZE = value;
#endif
return code;
}
#endif
#if USE_SIGWINCH
/*
* If we have a pending SIGWINCH, set the flag in each screen.

View File

@ -42,7 +42,7 @@
#include <dump_entry.h>
MODULE_ID("$Id: infocmp.c,v 1.95 2008/01/05 20:53:20 tom Exp $")
MODULE_ID("$Id: infocmp.c,v 1.96 2008/01/19 21:08:07 tom Exp $")
#define L_CURL "{"
#define R_CURL "}"
@ -1215,6 +1215,8 @@ dump_termtype(TERMTYPE *term)
NUM_STRINGS(term) - STRCOUNT);
(void) printf("#endif /* NCURSES_XNAMES */\n");
#else
(void) term;
#endif /* NCURSES_XNAMES */
(void) printf("\t%s\n", R_CURL);
}

View File

@ -40,7 +40,7 @@ AUTHOR
Author: Eric S. Raymond <esr@snark.thyrsus.com> 1993
Thomas E. Dickey (beginning revision 1.27 in 1996).
$Id: ncurses.c,v 1.298 2008/01/12 23:06:58 tom Exp $
$Id: ncurses.c,v 1.300 2008/01/19 23:10:59 tom Exp $
***************************************************************************/
@ -608,7 +608,7 @@ remember_boxes(unsigned level, WINDOW *txt_win, WINDOW *box_win)
winstack[level].frame = box_win;
}
#if USE_SOFTKEYS && (NCURSES_VERSION_PATCH < 20071229)
#if USE_SOFTKEYS && (NCURSES_VERSION_PATCH < 20071229) && NCURSES_EXT_FUNCS
static void
slk_repaint(void)
{
@ -850,7 +850,7 @@ getch_test(void)
* For wget_wch_test(), we create pairs of windows - one for a box, one for text.
* Resize both and paint the box in the parent.
*/
#ifdef KEY_RESIZE
#if defined(KEY_RESIZE) && HAVE_WRESIZE
static void
resize_wide_boxes(unsigned level, WINDOW *win)
{
@ -1024,7 +1024,7 @@ wget_wch_test(unsigned level, WINDOW *win, int delay)
} else
#endif /* NCURSES_MOUSE_VERSION */
if (code == KEY_CODE_YES) {
#ifdef KEY_RESIZE
#if defined(KEY_RESIZE) && HAVE_WRESIZE
if (c == KEY_RESIZE) {
resize_wide_boxes(level, win);
}
@ -3395,9 +3395,12 @@ FRAME
};
#if defined(NCURSES_VERSION)
#if NCURSES_VERSION_PATCH < 20070331
#if (NCURSES_VERSION_PATCH < 20070331) && NCURSES_EXT_FUNCS
#define is_keypad(win) (win)->_use_keypad
#define is_scrollok(win) (win)->_scroll
#elif !defined(is_keypad)
#define is_keypad(win) FALSE
#define is_scrollok(win) FALSE
#endif
#else
#define is_keypad(win) FALSE
@ -3684,7 +3687,7 @@ static void
acs_and_scroll(void)
/* Demonstrate windows */
{
int c, i;
int c;
FRAME *current = (FRAME *) 0, *neww;
WINDOW *usescr = stdscr;
#if HAVE_PUTWIN && HAVE_GETWIN
@ -3797,7 +3800,7 @@ acs_and_scroll(void)
case CTRL('X'): /* resize window */
if (current) {
pair *tmp, ul, lr;
int mx, my;
int i, mx, my;
move(0, 0);
clrtoeol();

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 *
@ -26,7 +26,7 @@
* authorization. *
****************************************************************************/
/*
* $Id: test_opaque.c,v 1.4 2007/08/18 17:51:51 tom Exp $
* $Id: test_opaque.c,v 1.5 2008/01/19 21:01:36 tom Exp $
*
* Author: Thomas E Dickey
*
@ -51,6 +51,8 @@
#define BASE_Y 6
#define MAX_COLS 1024
#if defined(NCURSES_VERSION_PATCH) && (NCURSES_VERSION_PATCH >= 20070818) && NCURSES_EXT_FUNCS
static bool
Quit(int ch)
{
@ -321,7 +323,7 @@ test_opaque(int level, char **argv, WINDOW *stswin)
break;
case ' ':
bool_funcs[active].func(txtwin,
!bool_funcs[active].func(txtwin, -1));
!bool_funcs[active].func(txtwin, -1));
break;
default:
beep();
@ -419,3 +421,11 @@ main(int argc, char *argv[])
endwin();
ExitProgram(EXIT_SUCCESS);
}
#else
int
main(void)
{
printf("This program requires the ncurses library\n");
ExitProgram(EXIT_FAILURE);
}
#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 *
@ -50,7 +50,7 @@
* scroll operation worked, and the refresh() code only had to do a
* partial repaint.
*
* $Id: view.c,v 1.66 2007/07/21 17:41:55 tom Exp $
* $Id: view.c,v 1.67 2008/01/19 21:01:21 tom Exp $
*/
#include <test.priv.h>
@ -512,6 +512,7 @@ show_all(const char *tag)
i = strlen(temp);
sprintf(temp + i, "view %.*s", (int) (sizeof(temp) - 7 - i), fname);
#else
(void) tag;
sprintf(temp, "view %.*s", (int) sizeof(temp) - 7, fname);
#endif
move(0, 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 *
@ -61,7 +61,7 @@ Options:
traces will be dumped. The program stops and waits for one character of
input at the beginning and end of the interval.
$Id: worm.c,v 1.51 2008/01/13 01:03:23 tom Exp $
$Id: worm.c,v 1.53 2008/01/19 20:56:38 tom Exp $
*/
#include <test.priv.h>
@ -307,7 +307,7 @@ draw_worm(WINDOW *win, void *data)
return done;
}
#if !defined(NCURSES_VERSION_PATCH) || (NCURSES_VERSION_PATCH < 20070915)
#if !defined(NCURSES_VERSION_PATCH) || (NCURSES_VERSION_PATCH < 20070915) || !NCURSES_EXT_FUNCS
static int
use_window(WINDOW *win, int (*func) (WINDOW *, void *), void *data)
{
@ -362,6 +362,18 @@ draw_all_worms(void)
return done;
}
static int
get_input(void)
{
int ch;
#ifdef USE_PTHREADS
ch = use_window(stdscr, (NCURSES_CALLBACK) wgetch, stdscr);
#else
ch = getch();
#endif
return ch;
}
int
main(int argc, char *argv[])
{
@ -504,15 +516,15 @@ main(int argc, char *argv[])
int ch;
++sequence;
if ((ch = getch()) > 0) {
if ((ch = get_input()) > 0) {
#ifdef TRACE
if (trace_start || trace_end) {
if (generation == trace_start) {
trace(TRACE_CALLS);
getch();
get_input();
} else if (generation == trace_end) {
trace(0);
getch();
get_input();
}
generation++;