]> ncurses.scripts.mit.edu Git - ncurses.git/commitdiff
ncurses 5.6 - patch 20070908
authorThomas E. Dickey <dickey@invisible-island.net>
Sat, 8 Sep 2007 22:25:05 +0000 (22:25 +0000)
committerThomas E. Dickey <dickey@invisible-island.net>
Sat, 8 Sep 2007 22:25:05 +0000 (22:25 +0000)
+ add use_window() and use_screen() functions, to develop into support
  for threaded library (incomplete).
+ fix typos in man/curs_opaque.3x which kept the install script from
  creating symbolic links to two aliases created in 20070818 (report by
  Rong-En Fan).

MANIFEST
NEWS
dist.mk
include/curses.h.in
man/curs_opaque.3x
ncurses/base/lib_set_term.c
ncurses/base/use_window.c [new file with mode: 0644]
ncurses/curses.priv.h
ncurses/modules
ncurses/tinfo/lib_data.c
ncurses/tinfo/use_screen.c [new file with mode: 0644]

index 780e75f21e34eba10c77f0c1d13c3ffa796863d0..3923e0855616c93b4e1e08dcb3578631c732f73b 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
 ./ncurses/base/safe_sprintf.c
 ./ncurses/base/sigaction.c
 ./ncurses/base/tries.c
 ./ncurses/base/safe_sprintf.c
 ./ncurses/base/sigaction.c
 ./ncurses/base/tries.c
+./ncurses/base/use_window.c
 ./ncurses/base/version.c
 ./ncurses/base/vsscanf.c
 ./ncurses/base/wresize.c
 ./ncurses/base/version.c
 ./ncurses/base/vsscanf.c
 ./ncurses/base/wresize.c
 ./ncurses/tinfo/setbuf.c
 ./ncurses/tinfo/strings.c
 ./ncurses/tinfo/trim_sgr0.c
 ./ncurses/tinfo/setbuf.c
 ./ncurses/tinfo/strings.c
 ./ncurses/tinfo/trim_sgr0.c
+./ncurses/tinfo/use_screen.c
 ./ncurses/tinfo/write_entry.c
 ./ncurses/trace/README
 ./ncurses/trace/lib_trace.c
 ./ncurses/tinfo/write_entry.c
 ./ncurses/trace/README
 ./ncurses/trace/lib_trace.c
diff --git a/NEWS b/NEWS
index 0a9fe3affaa04a9e5a3df6555da7736ba08d9385..f9c3db4985e64ff240bf8e7b4ec48d887b9166d3 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -25,7 +25,7 @@
 -- sale, use or other dealings in this Software without prior written        --
 -- authorization.                                                            --
 -------------------------------------------------------------------------------
 -- sale, use or other dealings in this Software without prior written        --
 -- authorization.                                                            --
 -------------------------------------------------------------------------------
--- $Id: NEWS,v 1.1162 2007/09/02 00:01:06 tom Exp $
+-- $Id: NEWS,v 1.1166 2007/09/08 21:55:19 tom Exp $
 -------------------------------------------------------------------------------
 
 This is a log of changes that ncurses has gone through since Zeyd started
 -------------------------------------------------------------------------------
 
 This is a log of changes that ncurses has gone through since Zeyd started
@@ -45,6 +45,13 @@ 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.
 
 Changes through 1.9.9e did not credit all contributions;
 it is not possible to add this information.
 
+20070908
+       + add use_window() and use_screen() functions, to develop into support
+         for threaded library (incomplete).
+       + fix typos in man/curs_opaque.3x which kept the install script from
+         creating symbolic links to two aliases created in 20070818 (report by
+         Rong-En Fan).
+
 20070901
        + remove a spurious newline from output of html.m4, which caused links
          for Ada95 html to be incorrect for the files generated using m4.
 20070901
        + remove a spurious newline from output of html.m4, which caused links
          for Ada95 html to be incorrect for the files generated using m4.
diff --git a/dist.mk b/dist.mk
index f9d4a131bc6ca60ddd2d1207cf0bd29ec0823adf..705042348333fa9fb75459ce97c07ec199ac21cb 100644 (file)
--- a/dist.mk
+++ b/dist.mk
@@ -25,7 +25,7 @@
 # use or other dealings in this Software without prior written               #
 # authorization.                                                             #
 ##############################################################################
 # use or other dealings in this Software without prior written               #
 # authorization.                                                             #
 ##############################################################################
-# $Id: dist.mk,v 1.608 2007/08/25 13:46:49 tom Exp $
+# $Id: dist.mk,v 1.609 2007/09/08 18:37:50 tom Exp $
 # Makefile for creating ncurses distributions.
 #
 # This only needs to be used directly as a makefile by developers, but
 # 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
 # These define the major/minor/patch versions of ncurses.
 NCURSES_MAJOR = 5
 NCURSES_MINOR = 6
-NCURSES_PATCH = 20070825
+NCURSES_PATCH = 20070908
 
 # We don't append the patch to the version, since this only applies to releases
 VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
 
 # We don't append the patch to the version, since this only applies to releases
 VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
index 895b4ff473d96aa4870283646b55ac2525a7ae6d..4a06f16b623601c75a616123d3f31ca553e467db 100644 (file)
@@ -32,7 +32,7 @@
  *     and: Thomas E. Dickey                        1996-on                 *
  ****************************************************************************/
 
  *     and: Thomas E. Dickey                        1996-on                 *
  ****************************************************************************/
 
-/* $Id: curses.h.in,v 1.177 2007/08/18 18:35:01 tom Exp $ */
+/* $Id: curses.h.in,v 1.178 2007/09/08 21:24:55 tom Exp $ */
 
 #ifndef __NCURSES_H
 #define __NCURSES_H
 
 #ifndef __NCURSES_H
 #define __NCURSES_H
@@ -826,6 +826,7 @@ extern NCURSES_EXPORT(int) getpary (const WINDOW *);                        /* generated */
  * These functions are extensions - not in X/Open Curses.
  */
 #if @NCURSES_EXT_FUNCS@
  * These functions are extensions - not in X/Open Curses.
  */
 #if @NCURSES_EXT_FUNCS@
+typedef int (*NCURSES_CALLBACK)(WINDOW *, 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);
 extern NCURSES_EXPORT(bool) is_term_resized (int, int);
 extern NCURSES_EXPORT(char *) keybound (int, int);
 extern NCURSES_EXPORT(const char *) curses_version (void);
@@ -838,6 +839,8 @@ extern NCURSES_EXPORT(int) resizeterm (int, 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_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) wresize (WINDOW *, int, int);
 extern NCURSES_EXPORT(void) nofilter(void);
 
 extern NCURSES_EXPORT(int) wresize (WINDOW *, int, int);
 extern NCURSES_EXPORT(void) nofilter(void);
 
index d31d734e165a5692fc8a23fe10621d992e2f5cf2..6c9cfaa18a35164dfcd3250c7b1a7cc03310a48b 100644 (file)
@@ -26,7 +26,7 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: curs_opaque.3x,v 1.5 2007/08/18 18:14:52 tom Exp $
+.\" $Id: curs_opaque.3x,v 1.6 2007/09/08 18:49:13 tom Exp $
 .TH curs_opaque 3X ""
 .na
 .hy 0
 .TH curs_opaque 3X ""
 .na
 .hy 0
@@ -66,9 +66,9 @@
 .br
 \fBbool is_syncok(const WINDOW *win);\fR
 .br
 .br
 \fBbool is_syncok(const WINDOW *win);\fR
 .br
-\fBWINDOW * wgetparent (const WINDOW *win);\fR
+\fBWINDOW * wgetparent(const WINDOW *win);\fR
 .br
 .br
-\fBint wgetscrreg (const WINDOW *win, int *top, int *bottom);\fR
+\fBint wgetscrreg(const WINDOW *win, int *top, int *bottom);\fR
 .br
 .SH DESCRIPTION
 This implementation provides functions which return properties
 .br
 .SH DESCRIPTION
 This implementation provides functions which return properties
index 922df8a4609964a9990a6ca9b554c16f1c9c5952..2b1387ad7a027ddc217821f83bf3511067cc504c 100644 (file)
@@ -44,7 +44,7 @@
 #include <term.h>              /* cur_term */
 #include <tic.h>
 
 #include <term.h>              /* cur_term */
 #include <tic.h>
 
-MODULE_ID("$Id: lib_set_term.c,v 1.99 2007/09/01 21:36:25 tom Exp $")
+MODULE_ID("$Id: lib_set_term.c,v 1.100 2007/09/08 21:23:43 tom Exp $")
 
 NCURSES_EXPORT(SCREEN *)
 set_term(SCREEN *screenp)
 
 NCURSES_EXPORT(SCREEN *)
 set_term(SCREEN *screenp)
@@ -53,7 +53,7 @@ set_term(SCREEN *screenp)
 
     T((T_CALLED("set_term(%p)"), screenp));
 
 
     T((T_CALLED("set_term(%p)"), screenp));
 
-    _nc_lock_mutex(set_SP);
+    _nc_lock_global(set_SP);
 
     oldSP = SP;
     _nc_set_screen(screenp);
 
     oldSP = SP;
     _nc_set_screen(screenp);
@@ -67,7 +67,7 @@ set_term(SCREEN *screenp)
     COLOR_PAIRS = SP->_pair_count;
 #endif
 
     COLOR_PAIRS = SP->_pair_count;
 #endif
 
-    _nc_unlock_mutex(set_SP);
+    _nc_unlock_global(set_SP);
 
     T((T_RETURN("%p"), oldSP));
     return (oldSP);
 
     T((T_RETURN("%p"), oldSP));
     return (oldSP);
@@ -94,7 +94,7 @@ delscreen(SCREEN *sp)
 
     T((T_CALLED("delscreen(%p)"), sp));
 
 
     T((T_CALLED("delscreen(%p)"), sp));
 
-    _nc_lock_mutex(set_SP);
+    _nc_lock_global(set_SP);
     while (*scan) {
        if (*scan == sp) {
            *scan = sp->_next_screen;
     while (*scan) {
        if (*scan == sp) {
            *scan = sp->_next_screen;
@@ -168,7 +168,7 @@ delscreen(SCREEN *sp)
 #endif
        _nc_set_screen(0);
     }
 #endif
        _nc_set_screen(0);
     }
-    _nc_unlock_mutex(set_SP);
+    _nc_unlock_global(set_SP);
 
     returnVoid;
 }
 
     returnVoid;
 }
diff --git a/ncurses/base/use_window.c b/ncurses/base/use_window.c
new file mode 100644 (file)
index 0000000..5ef07c8
--- /dev/null
@@ -0,0 +1,47 @@
+/****************************************************************************
+ * Copyright (c) 2007 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.                                                           *
+ ****************************************************************************/
+
+/****************************************************************************
+ *     Author: Thomas E. Dickey                        2007                 *
+ ****************************************************************************/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: use_window.c,v 1.1 2007/09/08 21:35:33 tom Exp $")
+
+NCURSES_EXPORT(int)
+use_window(WINDOW *win, NCURSES_CALLBACK func, void *data)
+{
+    int code = OK;
+
+    T((T_CALLED("use_window(%p,%p,%p)"), win, func, data));
+    _nc_lock_window(win);
+    code = func(win, data);
+    _nc_unlock_window(win);
+    returnCode(code);
+}
index 6252973b27f43d756d0be0ac1da69bef3450a72f..973eb998e3fd8119840df419306f7eeadcf68d64 100644 (file)
@@ -34,7 +34,7 @@
 
 
 /*
 
 
 /*
- * $Id: curses.priv.h,v 1.338 2007/09/01 21:35:50 tom Exp $
+ * $Id: curses.priv.h,v 1.340 2007/09/08 21:44:40 tom Exp $
  *
  *     curses.priv.h
  *
  *
  *     curses.priv.h
  *
@@ -303,16 +303,22 @@ color_t;
 #ifdef USE_PTHREADS
 #if USE_REENTRANT
 #include <pthread.h>
 #ifdef USE_PTHREADS
 #if USE_REENTRANT
 #include <pthread.h>
-#define _nc_lock_mutex(name)   pthread_mutex_lock(&_nc_globals.mutex_##name)
-#define _nc_unlock_mutex(name) pthread_mutex_unlock(&_nc_globals.mutex_##name)
+#define _nc_lock_global(name)  pthread_mutex_lock(&_nc_globals.mutex_##name)
+#define _nc_unlock_global(name)        pthread_mutex_unlock(&_nc_globals.mutex_##name)
 #else
 #error POSIX threads requires --enable-reentrant option
 #endif
 #else
 #else
 #error POSIX threads requires --enable-reentrant option
 #endif
 #else
-#define _nc_lock_mutex(name)   /* nothing */
-#define _nc_unlock_mutex(name) /* nothing */
+#define _nc_lock_global(name)  /* nothing */
+#define _nc_unlock_global(name)        /* nothing */
 #endif
 
 #endif
 
+#define _nc_lock_screen(name)  /* nothing */
+#define _nc_unlock_screen(name)        /* nothing */
+
+#define _nc_lock_window(name)  /* nothing */
+#define _nc_unlock_window(name)        /* nothing */
+
 /*
  * Definitions for color pairs
  */
 /*
  * Definitions for color pairs
  */
@@ -552,6 +558,8 @@ typedef struct {
 
 #ifdef USE_PTHREADS
        pthread_mutex_t mutex_set_SP;
 
 #ifdef USE_PTHREADS
        pthread_mutex_t mutex_set_SP;
+       pthread_mutex_t mutex_use_screen;
+       pthread_mutex_t mutex_windowlist;
 #endif
 } NCURSES_GLOBALS;
 
 #endif
 } NCURSES_GLOBALS;
 
index 93bd348e382dce96960e3b08b327b728bcf20701..f28ef81a3b332081e9053dd53703e9a5821f8934 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: modules,v 1.110 2007/06/12 20:21:42 tom Exp $
+# $Id: modules,v 1.112 2007/09/08 22:03:34 tom Exp $
 ##############################################################################
 # Copyright (c) 1998-2006,2007 Free Software Foundation, Inc.                #
 #                                                                            #
 ##############################################################################
 # Copyright (c) 1998-2006,2007 Free Software Foundation, Inc.                #
 #                                                                            #
@@ -152,6 +152,8 @@ lib_dft_fgbg        lib             $(base)         ../include/term.h
 lib_print      lib             $(tinfo)        ../include/term.h
 resizeterm     lib             $(base)         ../include/term.h
 trace_xnames   lib             $(trace)        ../include/term.h $(INCDIR)/term_entry.h
 lib_print      lib             $(tinfo)        ../include/term.h
 resizeterm     lib             $(base)         ../include/term.h
 trace_xnames   lib             $(trace)        ../include/term.h $(INCDIR)/term_entry.h
+use_screen     lib             $(tinfo)
+use_window     lib             $(base)
 wresize                lib             $(base)         ../include/term.h
 
 # Support for termcap (and tic, etc.), which can be a separate library
 wresize                lib             $(base)         ../include/term.h
 
 # Support for termcap (and tic, etc.), which can be a separate library
index ce355ea782e614f0059e303ec1f357255daa0426..063a566f2abc27ec80c8cdb4dbc4945f9c7855cb 100644 (file)
@@ -41,7 +41,7 @@
 
 #include <curses.priv.h>
 
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_data.c,v 1.28 2007/09/01 21:35:54 tom Exp $")
+MODULE_ID("$Id: lib_data.c,v 1.30 2007/09/08 21:59:56 tom Exp $")
 
 /*
  * OS/2's native linker complains if we don't initialize public data when
 
 /*
  * OS/2's native linker complains if we don't initialize public data when
@@ -177,7 +177,9 @@ NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals = {
 
 #endif /* TRACE */
 #ifdef USE_PTHREADS
 
 #endif /* TRACE */
 #ifdef USE_PTHREADS
-    PTHREAD_MUTEX_INITIALIZER  /* mutex_set_SP */
+    PTHREAD_MUTEX_INITIALIZER, /* mutex_set_SP */
+    PTHREAD_MUTEX_INITIALIZER, /* mutex_use_screen */
+    PTHREAD_MUTEX_INITIALIZER, /* mutex_windowlist */
 #endif
 };
 
 #endif
 };
 
diff --git a/ncurses/tinfo/use_screen.c b/ncurses/tinfo/use_screen.c
new file mode 100644 (file)
index 0000000..1037e0b
--- /dev/null
@@ -0,0 +1,60 @@
+/****************************************************************************
+ * Copyright (c) 2007 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.                                                           *
+ ****************************************************************************/
+
+/****************************************************************************
+ *     Author: Thomas E. Dickey                        2007                 *
+ ****************************************************************************/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: use_screen.c,v 1.2 2007/09/08 21:46:48 tom Exp $")
+
+NCURSES_EXPORT(int)
+use_screen(SCREEN *screen, NCURSES_CALLBACK func, void *data)
+{
+    SCREEN *save_SP;
+    int code = OK;
+
+    T((T_CALLED("use_window(%p,%p,%p)"), screen, func, data));
+
+    /*
+     * FIXME - add a flag so a given thread can check if _it_ has already
+     * recurred through this point, return an error if so.
+     */
+    _nc_lock_global(use_screen);
+    save_SP = SP;
+    set_term(screen);
+
+    code = func(screen->_stdscr, data);
+
+    set_term(save_SP);
+    _nc_unlock_global(use_screen);
+    returnCode(code);
+
+    return 0;
+}