summaryrefslogtreecommitdiffstats
path: root/contrib/ncurses/ncurses/tinfo
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ncurses/ncurses/tinfo')
-rw-r--r--contrib/ncurses/ncurses/tinfo/init_keytry.c18
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_data.c52
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_napms.c6
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_options.c20
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_setup.c37
-rw-r--r--contrib/ncurses/ncurses/tinfo/lib_ttyflags.c8
-rw-r--r--contrib/ncurses/ncurses/tinfo/use_screen.c8
7 files changed, 92 insertions, 57 deletions
diff --git a/contrib/ncurses/ncurses/tinfo/init_keytry.c b/contrib/ncurses/ncurses/tinfo/init_keytry.c
index d203210..d30d3ed 100644
--- a/contrib/ncurses/ncurses/tinfo/init_keytry.c
+++ b/contrib/ncurses/ncurses/tinfo/init_keytry.c
@@ -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
}
}
diff --git a/contrib/ncurses/ncurses/tinfo/lib_data.c b/contrib/ncurses/ncurses/tinfo/lib_data.c
index 21b854b..ba37e5d 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_data.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_data.c
@@ -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
+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)
+_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 */
diff --git a/contrib/ncurses/ncurses/tinfo/lib_napms.c b/contrib/ncurses/ncurses/tinfo/lib_napms.c
index 926afa8..417b3b4 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_napms.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_napms.c
@@ -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);
diff --git a/contrib/ncurses/ncurses/tinfo/lib_options.c b/contrib/ncurses/ncurses/tinfo/lib_options.c
index 5cdd1d4..98aae24 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_options.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_options.c
@@ -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);
}
diff --git a/contrib/ncurses/ncurses/tinfo/lib_setup.c b/contrib/ncurses/ncurses/tinfo/lib_setup.c
index a376fc6..08cb783 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_setup.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_setup.c
@@ -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)
diff --git a/contrib/ncurses/ncurses/tinfo/lib_ttyflags.c b/contrib/ncurses/ncurses/tinfo/lib_ttyflags.c
index 4cbbf50..2cb9fd6 100644
--- a/contrib/ncurses/ncurses/tinfo/lib_ttyflags.c
+++ b/contrib/ncurses/ncurses/tinfo/lib_ttyflags.c
@@ -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);
}
diff --git a/contrib/ncurses/ncurses/tinfo/use_screen.c b/contrib/ncurses/ncurses/tinfo/use_screen.c
index 27730b0..a4f34c0 100644
--- a/contrib/ncurses/ncurses/tinfo/use_screen.c
+++ b/contrib/ncurses/ncurses/tinfo/use_screen.c
@@ -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);
OpenPOWER on IntegriCloud