From: Thomas E. Dickey Date: Sat, 28 Feb 2009 23:06:36 +0000 (+0000) Subject: ncurses 5.7 - patch 20090228 X-Git-Tag: v5.8~102 X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=commitdiff_plain;h=b94faec6aab7c3613c1e7d217f6df6f42d929234 ncurses 5.7 - patch 20090228 + continue integrating "sp-funcs" by Juergen Pfeifer (incomplete). + modify declaration of cur_term when broken-linker is used, but enable-reentrant is not, to match pre-5.7 (report by Charles Wilson). --- diff --git a/NEWS b/NEWS index 2830d23c..fe62f4b3 100644 --- a/NEWS +++ b/NEWS @@ -25,7 +25,7 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: NEWS,v 1.1365 2009/02/22 02:05:30 tom Exp $ +-- $Id: NEWS,v 1.1367 2009/02/28 22:38:03 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. +20090228 + + continue integrating "sp-funcs" by Juergen Pfeifer (incomplete). + + modify declaration of cur_term when broken-linker is used, but + enable-reentrant is not, to match pre-5.7 (report by Charles Wilson). + 20090221 + continue integrating "sp-funcs" by Juergen Pfeifer (incomplete). diff --git a/dist.mk b/dist.mk index fe733c52..73758882 100644 --- a/dist.mk +++ b/dist.mk @@ -25,7 +25,7 @@ # use or other dealings in this Software without prior written # # authorization. # ############################################################################## -# $Id: dist.mk,v 1.687 2009/02/21 21:20:20 tom Exp $ +# $Id: dist.mk,v 1.688 2009/02/28 14:49:13 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 = 7 -NCURSES_PATCH = 20090221 +NCURSES_PATCH = 20090228 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/form/fld_def.c b/form/fld_def.c index 3559ba67..b8c69d30 100644 --- a/form/fld_def.c +++ b/form/fld_def.c @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_def.c,v 1.36 2007/10/13 19:29:58 tom Exp $") +MODULE_ID("$Id: fld_def.c,v 1.37 2009/02/28 19:00:51 juergen Exp $") /* this can't be readonly */ static FIELD default_field = @@ -252,8 +252,8 @@ _nc_Free_Type(FIELD *field) if (field->type != 0) { field->type->ref--; + _nc_Free_Argument(field->type, (TypeArgument *)(field->arg)); } - _nc_Free_Argument(field->type, (TypeArgument *)(field->arg)); } /*--------------------------------------------------------------------------- diff --git a/include/MKterm.h.awk.in b/include/MKterm.h.awk.in index 5fc20529..c0e826bf 100644 --- a/include/MKterm.h.awk.in +++ b/include/MKterm.h.awk.in @@ -1,7 +1,7 @@ # vile:awkmode BEGIN { print "/****************************************************************************" - print " * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *" + print " * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. *" print " * *" print " * Permission is hereby granted, free of charge, to any person obtaining a *" print " * copy of this software and associated documentation files (the *" @@ -34,7 +34,7 @@ BEGIN { print "/* and: Thomas E. Dickey 1995-on */" print "/****************************************************************************/" print "" - print "/* $Id: MKterm.h.awk.in,v 1.50 2008/05/24 23:13:59 tom Exp $ */" + print "/* $Id: MKterm.h.awk.in,v 1.53 2009/02/28 21:27:45 tom Exp $ */" print "" print "/*" print "** term.h -- Definition of struct term" @@ -228,8 +228,16 @@ END { print " char * _termname; /* used for termname() */" print "} TERMINAL;" print "" - print "#if @BROKEN_LINKER@ || @cf_cv_enable_reentrant@" + print "#if @BROKEN_LINKER@ && !@cf_cv_enable_reentrant@" + print "extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term;" + print "#elif @cf_cv_enable_reentrant@" print "NCURSES_WRAPPED_VAR(TERMINAL *, cur_term);" + print "#define cur_term NCURSES_PUBLIC_VAR(cur_term())" + print "#else" + print "extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term;" + print "#endif" + print "" + print "#if @BROKEN_LINKER@ || @cf_cv_enable_reentrant@" print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolnames);" print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolcodes);" print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolfnames);" @@ -240,7 +248,6 @@ END { print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strcodes);" print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strfnames);" print "" - print "#define cur_term NCURSES_PUBLIC_VAR(cur_term())" print "#define boolnames NCURSES_PUBLIC_VAR(boolnames())" print "#define boolcodes NCURSES_PUBLIC_VAR(boolcodes())" print "#define boolfnames NCURSES_PUBLIC_VAR(boolfnames())" @@ -253,8 +260,6 @@ END { print "" print "#else" print "" - print "extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term;" - print "" print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolnames[];" print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolcodes[];" print "extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolfnames[];" diff --git a/menu/m_cursor.c b/menu/m_cursor.c index 0293f907..77f9c759 100644 --- a/menu/m_cursor.c +++ b/menu/m_cursor.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * + * Copyright (c) 1998-2005,2009 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 * @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_cursor.c,v 1.20 2005/10/22 23:03:32 tom Exp $") +MODULE_ID("$Id: m_cursor.c,v 1.21 2009/02/28 21:02:46 juergen Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -90,7 +90,7 @@ pos_menu_cursor(const MENU * menu) if (E_OK == err) { - win = menu->userwin ? menu->userwin : stdscr; + win = Get_Menu_UserWin(menu); sub = menu->usersub ? menu->usersub : win; assert(win && sub); diff --git a/menu/m_driver.c b/menu/m_driver.c index d418e6a2..5b7a89e3 100644 --- a/menu/m_driver.c +++ b/menu/m_driver.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2005,2008 Free Software Foundation, Inc. * + * Copyright (c) 1998-2008,2009 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 * @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_driver.c,v 1.27 2008/08/03 22:08:22 tom Exp $") +MODULE_ID("$Id: m_driver.c,v 1.28 2009/02/28 21:02:46 juergen Exp $") /* Macros */ @@ -197,7 +197,7 @@ _nc_Match_Next_Character_In_Item_Name /*--------------------------------------------------------------------------- | Facility : libnmenu -| Function : int menu_driver(MENU *menu, int c) +| Function : int menu_driver(MENU* menu, int c) | | Description : Central dispatcher for the menu. Translates the logical | request 'c' into a menu action. diff --git a/menu/m_global.c b/menu/m_global.c index 28e836dd..267c8564 100644 --- a/menu/m_global.c +++ b/menu/m_global.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * + * Copyright (c) 1998-2005,2009 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 * @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_global.c,v 1.23 2005/12/31 21:51:52 tom Exp $") +MODULE_ID("$Id: m_global.c,v 1.24 2009/02/28 21:02:46 juergen Exp $") static char mark[] = "-"; /* *INDENT-OFF* */ @@ -496,7 +496,7 @@ _nc_Link_Items(MENU * menu) /*--------------------------------------------------------------------------- | Facility : libnmenu -| Function : void _nc_Show_Menu(const MENU *menu) +| Function : void _nc_Show_Menu(const MENU* menu) | | Description : Update the window that is associated with the menu | @@ -543,8 +543,10 @@ _nc_Show_Menu(const MENU * menu) | Return Values : - +--------------------------------------------------------------------------*/ NCURSES_EXPORT(void) - _nc_New_TopRow_and_CurrentItem - (MENU * menu, int new_toprow, ITEM * new_current_item) +_nc_New_TopRow_and_CurrentItem( + MENU * menu, + int new_toprow, + ITEM * new_current_item) { ITEM *cur_item; bool mterm_called = FALSE; diff --git a/menu/m_post.c b/menu/m_post.c index 657d0f18..6caac6a8 100644 --- a/menu/m_post.c +++ b/menu/m_post.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2009 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 * @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_post.c,v 1.26 2004/12/25 23:57:04 tom Exp $") +MODULE_ID("$Id: m_post.c,v 1.27 2009/02/28 21:02:46 juergen Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -255,7 +255,7 @@ _nc_Draw_Menu(const MENU * menu) /*--------------------------------------------------------------------------- | Facility : libnmenu -| Function : int post_menu(MENU *) +| Function : int post_menu(MENU* menu) | | Description : Post a menu to the screen. This makes it visible. | @@ -329,7 +329,7 @@ post_menu(MENU * menu) /*--------------------------------------------------------------------------- | Facility : libnmenu -| Function : int unpost_menu(MENU *) +| Function : int unpost_menu(MENU*) | | Description : Detach menu from screen | diff --git a/menu/menu.priv.h b/menu/menu.priv.h index 10d35375..99580a38 100644 --- a/menu/menu.priv.h +++ b/menu/menu.priv.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * + * Copyright (c) 1998-2005,2009 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 +30,7 @@ * Author: Juergen Pfeifer, 1995,1997 * ****************************************************************************/ -/* $Id: menu.priv.h,v 1.22 2005/01/16 01:02:23 tom Exp $ */ +/* $Id: menu.priv.h,v 1.23 2009/02/28 21:02:57 juergen Exp $ */ /*************************************************************************** * Module menu.priv.h * @@ -56,8 +56,12 @@ extern NCURSES_EXPORT_VAR(MENU) _nc_Default_Menu; /* Normalize menu to default if none was given */ #define Normalize_Menu( menu ) ((menu)=(menu)?(menu):&_nc_Default_Menu) +#define Get_Menu_Screen( menu ) (menu->userwin ? \ + _nc_screen_of(menu->userwin) : CURRENT_SCREEN) + /* Get the user defined (framing) window of the menu */ -#define Get_Menu_UserWin(menu) ((menu)->userwin ? (menu)->userwin : stdscr) +#define Get_Menu_UserWin(menu) ((menu)->userwin ? \ + (menu)->userwin : CURRENT_SCREEN->_stdscr) /* Normalize menu window */ #define Get_Menu_Window( menu ) \ diff --git a/misc/ncu-indent b/misc/ncu-indent index 862a108a..671f7574 100755 --- a/misc/ncu-indent +++ b/misc/ncu-indent @@ -26,7 +26,7 @@ #* sale, use or other dealings in this Software without prior written * #* authorization. * #****************************************************************************/ -# $Id: ncu-indent,v 1.17 2008/08/03 15:46:44 tom Exp $ +# $Id: ncu-indent,v 1.20 2009/02/21 20:56:23 tom Exp $ NOOP=no OPTS=' --blank-lines-after-procedures @@ -44,6 +44,8 @@ OPTS=' --swallow-optional-blank-lines --tab-size8 +-T NCURSES_SP_ARGx +-T NCURSES_SP_DCLx -T NCURSES_EXPORT_VAR -T NCURSES_INLINE -T SCREEN @@ -88,11 +90,12 @@ do mv "$name" "$save" sed \ -e '/EMPTY_MODULE(/s/)$/);/' \ + -e 's,\(MODULEID(\),//\1,' \ -e '/MODULE_ID(/s/)$/);/' \ -e 's,\\),//\1,' \ + -e 's,\(\.*;\),//\1,' \ "$save" >"$test" cp "$test" "$name" chmod u+w "$name" @@ -100,11 +103,12 @@ do ${INDENT_PROG-indent} -npro $OPTS "$name" sed \ -e '/EMPTY_MODULE(/s/);$/)/' \ + -e 's,//\(MODULEID(\),\1,' \ -e '/MODULE_ID(/s/);$/)/' \ -e 's,;[ ]*//GCC_NORETURN;, GCC_NORETURN;,' \ -e 's,;[ ]*//GCC_PRINTFLIKE(, GCC_PRINTFLIKE(,' \ -e 's,;[ ]*//GCC_SCANFLIKE(, GCC_SCANFLIKE(,' \ - -e 's,//\(\\),\1,' \ + -e 's,//\(\[ ]*\),\1,' \ "$name" >"$test" mv "$test" "$name" rm -f "${name}~" diff --git a/ncurses/base/lib_getch.c b/ncurses/base/lib_getch.c index 22173242..cfec16e6 100644 --- a/ncurses/base/lib_getch.c +++ b/ncurses/base/lib_getch.c @@ -42,7 +42,7 @@ #include -MODULE_ID("$Id: lib_getch.c,v 1.100 2009/02/15 00:36:00 tom Exp $") +MODULE_ID("$Id: lib_getch.c,v 1.101 2009/02/28 19:16:40 tom Exp $") #include @@ -94,9 +94,9 @@ _nc_use_meta(WINDOW *win) } #ifdef NCURSES_WGETCH_EVENTS -#define TWAIT_MASK 7 +#define TWAIT_MASK (TW_ANY | TW_EVENT) #else -#define TWAIT_MASK 3 +#define TWAIT_MASK TW_ANY #endif /* @@ -119,7 +119,7 @@ check_mouse_activity(SCREEN *sp, int delay EVENTLIST_2nd(_nc_eventlist * evl)) && (sp->_sysmouse_head < sp->_sysmouse_tail) && (rc == 0) && (errno == EINTR)) { - rc |= 2; + rc |= TW_MOUSE; } #endif return rc; @@ -183,7 +183,7 @@ fifo_push(SCREEN *sp EVENTLIST_2nd(_nc_eventlist * evl)) } else mask = 0; - if (mask & 4) { + if (mask & TW_EVENT) { T(("fifo_push: ungetch KEY_EVENT")); _nc_ungetch(sp, KEY_EVENT); return KEY_EVENT; @@ -195,7 +195,7 @@ fifo_push(SCREEN *sp EVENTLIST_2nd(_nc_eventlist * evl)) #endif #if USE_GPM_SUPPORT || USE_EMX_MOUSE - if ((sp->_mouse_fd >= 0) && (mask & 2)) { + if ((sp->_mouse_fd >= 0) && (mask & TW_MOUSE)) { sp->_mouse_event(sp); ch = KEY_MOUSE; n = 1; @@ -270,12 +270,12 @@ recur_wrefresh(WINDOW *win) { #ifdef USE_PTHREADS SCREEN *sp = _nc_screen_of(win); - if (_nc_use_pthreads && sp != SP) { + if (_nc_use_pthreads && sp != CURRENT_SCREEN) { SCREEN *save_SP; /* temporarily switch to the window's screen to check/refresh */ _nc_lock_global(curses); - save_SP = SP; + save_SP = CURRENT_SCREEN; _nc_set_screen(sp); recur_wrefresh(win); _nc_set_screen(save_SP); @@ -296,12 +296,12 @@ recur_wgetnstr(WINDOW *win, char *buf) if (sp != 0) { #ifdef USE_PTHREADS - if (_nc_use_pthreads && sp != SP) { + if (_nc_use_pthreads && sp != CURRENT_SCREEN) { SCREEN *save_SP; /* temporarily switch to the window's screen to get cooked input */ _nc_lock_global(curses); - save_SP = SP; + save_SP = CURRENT_SCREEN; _nc_set_screen(sp); rc = recur_wgetnstr(win, buf); _nc_set_screen(save_SP); @@ -412,7 +412,7 @@ _nc_wgetch(WINDOW *win, rc = check_mouse_activity(sp, delay EVENTLIST_2nd(evl)); #ifdef NCURSES_WGETCH_EVENTS - if (rc & 4) { + if (rc & TW_EVENT) { *result = KEY_EVENT; returnCode(KEY_CODE_YES); } @@ -437,7 +437,7 @@ _nc_wgetch(WINDOW *win, * increase the wait with mouseinterval(). */ int runcount = 0; - int rc; + int rc = 0; do { ch = kgetch(sp EVENTLIST_2nd(evl)); @@ -452,10 +452,10 @@ _nc_wgetch(WINDOW *win, (ch == KEY_MOUSE && (((rc = check_mouse_activity(sp, sp->_maxclick EVENTLIST_2nd(evl))) != 0 - && !(rc & 4)) + && !(rc & TW_EVENT)) || !sp->_mouse_parse(sp, runcount))); #ifdef NCURSES_WGETCH_EVENTS - if ((rc & 4) && !ch == KEY_EVENT) { + if ((rc & TW_EVENT) && !(ch == KEY_EVENT)) { _nc_ungetch(sp, ch); ch = KEY_EVENT; } @@ -655,7 +655,7 @@ kgetch(SCREEN *sp EVENTLIST_2nd(_nc_eventlist * evl)) TR(TRACE_IEVENT, ("waiting for rest of sequence")); rc = check_mouse_activity(sp, timeleft EVENTLIST_2nd(evl)); #ifdef NCURSES_WGETCH_EVENTS - if (rc & 4) { + if (rc & TW_EVENT) { TR(TRACE_IEVENT, ("interrupted by a user event")); /* FIXME Should have preserved remainder timeleft for reuse... */ peek = head; /* Restart interpreting later */ diff --git a/ncurses/base/lib_mouse.c b/ncurses/base/lib_mouse.c index d19189f7..c7af9ce2 100644 --- a/ncurses/base/lib_mouse.c +++ b/ncurses/base/lib_mouse.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. * + * Copyright (c) 1998-2008,2009 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 * @@ -79,9 +79,8 @@ #include -MODULE_ID("$Id: lib_mouse.c,v 1.104 2008/11/30 01:37:27 tom Exp $") +MODULE_ID("$Id: lib_mouse.c,v 1.105 2009/02/28 21:09:20 tom Exp $") -#include #include #if USE_GPM_SUPPORT @@ -150,7 +149,7 @@ make an error #define LIBGPM_SONAME "libgpm.so" #endif -#define GET_DLSYM(name) (my_##name = (TYPE_##name) dlsym(SP->_dlopen_gpm, #name)) +#define GET_DLSYM(name) (my_##name = (TYPE_##name) dlsym(SP_PARM->_dlopen_gpm, #name)) #endif /* USE_GPM_SUPPORT */ @@ -164,13 +163,13 @@ static void _nc_mouse_wrap(SCREEN *); #define LastEV(sp) ((sp)->_mouse_events + EV_MAX - 1) #undef NEXT -#define NEXT(ep) ((ep >= LastEV(sp)) \ - ? FirstEV(sp) \ +#define NEXT(ep) ((ep >= LastEV(SP_PARM)) \ + ? FirstEV(SP_PARM) \ : ep + 1) #undef PREV -#define PREV(ep) ((ep <= FirstEV(sp)) \ - ? LastEV(sp) \ +#define PREV(ep) ((ep <= FirstEV(SP_PARM)) \ + ? LastEV(SP_PARM) \ : ep - 1) #define IndexEV(sp, ep) (ep - FirstEV(sp)) @@ -340,7 +339,7 @@ sysmouse_server(SCREEN *sp) static void handle_sysmouse(int sig GCC_UNUSED) { - sysmouse_server(SP); + sysmouse_server(CURRENT_SCREEN); } #endif /* USE_SYSMOUSE */ @@ -359,7 +358,9 @@ enable_xterm_mouse(SCREEN *sp, int enable) #if USE_EMX_MOUSE sp->_emxmouse_activated = enable; #else - putp(TPARM_1(sp->_mouse_xtermcap, enable)); + NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_ARGx + "xterm-mouse", + TPARM_1(sp->_mouse_xtermcap, enable)); #endif sp->_mouse_active = enable; } @@ -398,7 +399,7 @@ allow_gpm_mouse(void) static void unload_gpm_library(SCREEN *sp) { - if (SP->_dlopen_gpm != 0) { + if (sp->_dlopen_gpm != 0) { T(("unload GPM library")); sp->_mouse_gpm_loaded = FALSE; sp->_mouse_fd = -1; @@ -943,7 +944,7 @@ mouse_activate(SCREEN *sp, bool on) switch (sp->_mouse_type) { case M_XTERM: #if NCURSES_EXT_FUNCS - keyok(KEY_MOUSE, on); + NCURSES_SP_NAME(keyok) (NCURSES_SP_ARGx KEY_MOUSE, on); #endif TPUTS_TRACE("xterm mouse initialization"); enable_xterm_mouse(sp, 1); @@ -995,7 +996,7 @@ mouse_activate(SCREEN *sp, bool on) return; } } - _nc_flush(); + NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_ARG); } /************************************************************************** @@ -1270,13 +1271,13 @@ _nc_mouse_resume(SCREEN *sp) * **************************************************************************/ -static int -_nc_getmouse(SCREEN *sp, MEVENT * aevent) +NCURSES_EXPORT(int) +NCURSES_SP_NAME(getmouse) (NCURSES_SP_DCLx MEVENT * aevent) { - T((T_CALLED("getmouse(%p)"), aevent)); + T((T_CALLED("getmouse(%p,%p)"), SP_PARM, aevent)); - if ((aevent != 0) && (sp != 0) && (sp->_mouse_type != M_NONE)) { - MEVENT *eventp = sp->_mouse_eventp; + if ((aevent != 0) && (SP_PARM != 0) && (SP_PARM->_mouse_type != M_NONE)) { + MEVENT *eventp = SP_PARM->_mouse_eventp; /* compute the current-event pointer */ MEVENT *prev = PREV(eventp); @@ -1284,8 +1285,8 @@ _nc_getmouse(SCREEN *sp, MEVENT * aevent) *aevent = *prev; TR(TRACE_IEVENT, ("getmouse: returning event %s from slot %ld", - _nc_tracemouse(sp, prev), - (long) IndexEV(sp, prev))); + _nc_tracemouse(SP_PARM, prev), + (long) IndexEV(SP_PARM, prev))); prev->id = INVALID_EVENT; /* so the queue slot becomes free */ returnCode(OK); @@ -1293,57 +1294,61 @@ _nc_getmouse(SCREEN *sp, MEVENT * aevent) returnCode(ERR); } +#if NCURSES_SP_FUNCS /* grab a copy of the current mouse event */ NCURSES_EXPORT(int) getmouse(MEVENT * aevent) { - return _nc_getmouse(SP, aevent); + return NCURSES_SP_NAME(getmouse) (CURRENT_SCREEN, aevent); } +#endif -static int -_nc_ungetmouse(SCREEN *sp, MEVENT * aevent) +NCURSES_EXPORT(int) +NCURSES_SP_NAME(ungetmouse) (NCURSES_SP_DCLx MEVENT * aevent) { int result = ERR; - T((T_CALLED("ungetmouse(%p)"), aevent)); + T((T_CALLED("ungetmouse(%p,%p)"), SP_PARM, aevent)); - if (aevent != 0 && sp != 0) { - MEVENT *eventp = sp->_mouse_eventp; + if (aevent != 0 && SP_PARM != 0) { + MEVENT *eventp = SP_PARM->_mouse_eventp; /* stick the given event in the next-free slot */ *eventp = *aevent; /* bump the next-free pointer into the circular list */ - sp->_mouse_eventp = NEXT(eventp); + SP_PARM->_mouse_eventp = NEXT(eventp); /* push back the notification event on the keyboard queue */ - result = _nc_ungetch(sp, KEY_MOUSE); + result = NCURSES_SP_NAME(ungetch) (NCURSES_SP_ARGx KEY_MOUSE); } returnCode(result); } +#if NCURSES_SP_FUNCS /* enqueue a synthesized mouse event to be seen by the next wgetch() */ NCURSES_EXPORT(int) ungetmouse(MEVENT * aevent) { - return _nc_ungetmouse(SP, aevent); + return NCURSES_SP_NAME(ungetmouse) (CURRENT_SCREEN, aevent); } +#endif NCURSES_EXPORT(mmask_t) -mousemask(mmask_t newmask, mmask_t * oldmask) +NCURSES_SP_NAME(mousemask) (NCURSES_SP_DCLx mmask_t newmask, mmask_t * oldmask) /* set the mouse event mask */ { mmask_t result = 0; - T((T_CALLED("mousemask(%#lx,%p)"), (unsigned long) newmask, oldmask)); + T((T_CALLED("mousemask(%p,%#lx,%p)"), SP_PARM, (unsigned long) newmask, oldmask)); - if (SP != 0) { + if (SP_PARM != 0) { if (oldmask) - *oldmask = SP->_mouse_mask; + *oldmask = SP_PARM->_mouse_mask; - if (newmask || SP->_mouse_initialized) { - _nc_mouse_init(SP); - if (SP->_mouse_type != M_NONE) { + if (newmask || SP_PARM->_mouse_initialized) { + _nc_mouse_init(SP_PARM); + if (SP_PARM->_mouse_type != M_NONE) { result = newmask & (REPORT_MOUSE_POSITION | BUTTON_ALT @@ -1355,15 +1360,23 @@ mousemask(mmask_t newmask, mmask_t * oldmask) | BUTTON_DOUBLE_CLICKED | BUTTON_TRIPLE_CLICKED); - mouse_activate(SP, (bool) (result != 0)); + mouse_activate(SP_PARM, (bool) (result != 0)); - SP->_mouse_mask = result; + SP_PARM->_mouse_mask = result; } } } returnBits(result); } +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(mmask_t) +mousemask(mmask_t newmask, mmask_t * oldmask) +{ + return NCURSES_SP_NAME(mousemask) (CURRENT_SCREEN, newmask, oldmask); +} +#endif + NCURSES_EXPORT(bool) wenclose(const WINDOW *win, int y, int x) /* check to see if given window encloses given screen location */ @@ -1383,17 +1396,17 @@ wenclose(const WINDOW *win, int y, int x) } NCURSES_EXPORT(int) -mouseinterval(int maxclick) +NCURSES_SP_NAME(mouseinterval) (NCURSES_SP_DCLx int maxclick) /* set the maximum mouse interval within which to recognize a click */ { int oldval; - T((T_CALLED("mouseinterval(%d)"), maxclick)); + T((T_CALLED("mouseinterval(%p,%d)"), SP_PARM, maxclick)); - if (SP != 0) { - oldval = SP->_maxclick; + if (SP_PARM != 0) { + oldval = SP_PARM->_maxclick; if (maxclick >= 0) - SP->_maxclick = maxclick; + SP_PARM->_maxclick = maxclick; } else { oldval = DEFAULT_MAXCLICK; } @@ -1401,19 +1414,35 @@ mouseinterval(int maxclick) returnCode(oldval); } +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +mouseinterval(int maxclick) +{ + return NCURSES_SP_NAME(mouseinterval) (CURRENT_SCREEN, maxclick); +} +#endif + /* This may be used by other routines to ask for the existence of mouse support */ NCURSES_EXPORT(bool) _nc_has_mouse(SCREEN *sp) { - return ((sp->_mouse_type == M_NONE) ? FALSE : TRUE); + return (((0 == sp) || (sp->_mouse_type == M_NONE)) ? FALSE : TRUE); +} + +NCURSES_EXPORT(bool) +NCURSES_SP_NAME(has_mouse) (NCURSES_SP_DCL0) +{ + return _nc_has_mouse(SP_PARM); } +#if NCURSES_SP_FUNCS NCURSES_EXPORT(bool) has_mouse(void) { - return _nc_has_mouse(SP); + return _nc_has_mouse(CURRENT_SCREEN); } +#endif NCURSES_EXPORT(bool) wmouse_trafo(const WINDOW *win, int *pY, int *pX, bool to_screen) diff --git a/ncurses/curses.priv.h b/ncurses/curses.priv.h index 20ca3623..95f66529 100644 --- a/ncurses/curses.priv.h +++ b/ncurses/curses.priv.h @@ -30,11 +30,12 @@ * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer * ****************************************************************************/ /* - * $Id: curses.priv.h,v 1.402 2009/02/21 22:54:34 tom Exp $ + * $Id: curses.priv.h,v 1.403 2009/02/28 20:55:48 tom Exp $ * * curses.priv.h * @@ -1628,6 +1629,8 @@ extern NCURSES_EXPORT(int) _nc_getenv_num (const char *); 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_putp(const char *, const char *); +extern NCURSES_EXPORT(int) _nc_putp_flush(const char *, const char *); 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 (SCREEN *, int, int, int * EVENTLIST_2nd(_nc_eventlist *)); @@ -1699,7 +1702,7 @@ extern NCURSES_EXPORT_VAR(int *) _nc_oldnums; #define NC_BUFFERED(flag) _nc_set_buffer(SP->_ofp, flag) -#define NC_OUTPUT ((SP != 0) ? SP->_ofp : stdout) +#define NC_OUTPUT ((SP_PARM != 0) ? SP_PARM->_ofp : stdout) /* * On systems with a broken linker, define 'SP' as a function to force the @@ -1763,6 +1766,7 @@ extern NCURSES_EXPORT(int) _nc_ripoffline (int line, int (*init)(WINDOW *,int)); /* * Exported entrypoints beyond the published API */ +#if NCURSES_SP_FUNCS extern NCURSES_EXPORT(WINDOW *) _nc_curscr_of(SCREEN*); extern NCURSES_EXPORT(WINDOW *) _nc_newscr_of(SCREEN*); extern NCURSES_EXPORT(WINDOW *) _nc_stdscr_of(SCREEN*); @@ -1794,6 +1798,10 @@ extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(_nc_is_term_resized)(SCREEN*,int extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_resize_term)(SCREEN*,int,int); extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_resizeterm)(SCREEN*,int,int); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_outch)(SCREEN*, int ch); +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_flush)(SCREEN*); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_putp)(SCREEN*, const char *, const char *); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_putp_flush)(SCREEN*, const char *, const char *); extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_tgetent)(SCREEN*,char*,const char *); extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_tputs)(SCREEN*,const char*,int,int(*)(SCREEN*, int)); extern NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_savetty)(SCREEN*); @@ -1813,6 +1821,14 @@ extern NCURSES_EXPORT(int) _nc_tinfo_mcprint(SCREEN*,char*,int); extern NCURSES_EXPORT(wchar_t *) NCURSES_SP_NAME(_nc_wunctrl)(SCREEN*, cchar_t *); #endif +/* FIXME - move these to curses.h.in */ +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(getmouse) (SCREEN*, MEVENT *); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(ungetmouse) (SCREEN*, MEVENT *); +extern NCURSES_EXPORT(mmask_t) NCURSES_SP_NAME(mousemask) (SCREEN*, mmask_t, mmask_t *); +extern NCURSES_EXPORT(int) NCURSES_SP_NAME(mouseinterval) (SCREEN*, int); +extern NCURSES_EXPORT(bool) NCURSES_SP_NAME(has_mouse) (SCREEN*); +#endif /* NCURSES_SP_FUNCS */ + #ifdef __cplusplus } #endif diff --git a/ncurses/tinfo/lib_cur_term.c b/ncurses/tinfo/lib_cur_term.c index 626578d5..64ff4c29 100644 --- a/ncurses/tinfo/lib_cur_term.c +++ b/ncurses/tinfo/lib_cur_term.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2003,2008 Free Software Foundation, Inc. * + * Copyright (c) 1998-2008,2009 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,12 +40,14 @@ #include /* TTY, cur_term */ #include /* ospeed */ -MODULE_ID("$Id: lib_cur_term.c,v 1.18 2008/08/16 19:22:55 tom Exp $") +MODULE_ID("$Id: lib_cur_term.c,v 1.19 2009/02/28 15:49:58 tom Exp $") #undef CUR #define CUR termp->type. -#if BROKEN_LINKER || USE_REENTRANT +#if BROKEN_LINKER && !USE_REENTRANT +NCURSES_EXPORT_VAR(TERMINAL *) cur_term = 0; +#elif BROKEN_LINKER || USE_REENTRANT NCURSES_EXPORT(TERMINAL *) NCURSES_PUBLIC_VAR(cur_term) (void) { diff --git a/ncurses/tinfo/lib_options.c b/ncurses/tinfo/lib_options.c index 82aa6d64..cfce6c94 100644 --- a/ncurses/tinfo/lib_options.c +++ b/ncurses/tinfo/lib_options.c @@ -44,7 +44,7 @@ #include -MODULE_ID("$Id: lib_options.c,v 1.59 2009/02/15 00:48:40 tom Exp $") +MODULE_ID("$Id: lib_options.c,v 1.60 2009/02/28 21:07:56 tom Exp $") static int _nc_curs_set(SCREEN *, int); static int _nc_meta(SCREEN *, bool); @@ -221,8 +221,9 @@ has_key(int keycode) #undef CUR #define CUR (sp->_term)->type. -static int -_nc_putp(const char *name GCC_UNUSED, const char *value) +NCURSES_EXPORT(int) +NCURSES_SP_NAME(_nc_putp) (NCURSES_SP_DCLx + const char *name GCC_UNUSED, const char *value) { int rc = ERR; @@ -233,8 +234,17 @@ _nc_putp(const char *name GCC_UNUSED, const char *value) return rc; } -static int -_nc_putp_flush(const char *name, const char *value) +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +_nc_putp(const char *name, const char *value) +{ + return NCURSES_SP_NAME(_nc_putp) (CURRENT_SCREEN, name, value); +} +#endif + +NCURSES_EXPORT(int) +NCURSES_SP_NAME(_nc_putp_flush) (NCURSES_SP_DCLx + const char *name, const char *value) { int rc = _nc_putp(name, value); if (rc != ERR) { @@ -243,6 +253,14 @@ _nc_putp_flush(const char *name, const char *value) return rc; } +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +_nc_putp_flush(const char *name, const char *value) +{ + return NCURSES_SP_NAME(_nc_putp_flush) (CURRENT_SCREEN, name, value); +} +#endif + /* Turn the keypad on/off * * Note: we flush the output because changing this mode causes some terminals @@ -262,12 +280,12 @@ _nc_keypad(SCREEN *sp, bool flag) * has wgetch() reading in more than one thread. putp() and below * may use SP explicitly. */ - if (_nc_use_pthreads && sp != SP) { + if (_nc_use_pthreads && sp != CURRENT_SCREEN) { SCREEN *save_sp; /* cannot use use_screen(), since that is not in tinfo library */ _nc_lock_global(curses); - save_sp = SP; + save_sp = CURRENT_SCREEN; _nc_set_screen(sp); rc = _nc_keypad(sp, flag); _nc_set_screen(save_sp); @@ -330,8 +348,8 @@ _nc_meta(SCREEN *sp, bool flag) /* Ok, we stay relaxed and don't signal an error if win is NULL */ - if (SP != 0) { - SP->_use_meta = flag; + if (sp != 0) { + sp->_use_meta = flag; if (flag) { _nc_putp("meta_on", meta_on); diff --git a/ncurses/tinfo/lib_tputs.c b/ncurses/tinfo/lib_tputs.c index 27e36136..0b12624e 100644 --- a/ncurses/tinfo/lib_tputs.c +++ b/ncurses/tinfo/lib_tputs.c @@ -47,7 +47,7 @@ #include /* ospeed */ #include -MODULE_ID("$Id: lib_tputs.c,v 1.67 2009/02/15 00:49:44 tom Exp $") +MODULE_ID("$Id: lib_tputs.c,v 1.68 2009/02/28 21:08:18 tom Exp $") NCURSES_EXPORT_VAR(char) PC = 0; /* used by termcap library */ NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed = 0; /* used by termcap library */ @@ -102,18 +102,26 @@ delay_output(int ms) #endif NCURSES_EXPORT(void) -_nc_flush(void) +NCURSES_SP_NAME(_nc_flush) (NCURSES_SP_DCL0) { (void) fflush(NC_OUTPUT); } +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(void) +_nc_flush(void) +{ + NCURSES_SP_NAME(_nc_flush) (CURRENT_SCREEN); +} +#endif + NCURSES_EXPORT(int) -_nc_outch(int ch) +NCURSES_SP_NAME(_nc_outch) (NCURSES_SP_DCLx int ch) { COUNT_OUTCHARS(1); - if (SP != 0 - && SP->_cleanup) { + if (SP_PARM != 0 + && SP_PARM->_cleanup) { char tmp = ch; /* * POSIX says write() is safe in a signal handler, but the @@ -126,6 +134,14 @@ _nc_outch(int ch) return OK; } +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(int) +_nc_outch(int ch) +{ + return NCURSES_SP_NAME(_nc_outch) (CURRENT_SCREEN, ch); +} +#endif + NCURSES_EXPORT(int) putp(const char *string) { diff --git a/ncurses/trace/lib_trace.c b/ncurses/trace/lib_trace.c index 743b1f64..0c733cd8 100644 --- a/ncurses/trace/lib_trace.c +++ b/ncurses/trace/lib_trace.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. * + * Copyright (c) 1998-2008,2009 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,6 +30,7 @@ * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * * and: Thomas E. Dickey 1996-on * + * and: Juergen Pfeifer * ****************************************************************************/ /* @@ -46,7 +47,7 @@ #include -MODULE_ID("$Id: lib_trace.c,v 1.71 2008/08/23 18:04:29 tom Exp $") +MODULE_ID("$Id: lib_trace.c,v 1.72 2009/02/28 20:37:37 tom Exp $") NCURSES_EXPORT_VAR(unsigned) _nc_tracing = 0; /* always define this */ @@ -56,26 +57,26 @@ NCURSES_EXPORT_VAR(unsigned) _nc_tracing = 0; /* always define this */ NCURSES_EXPORT(const char *) NCURSES_PUBLIC_VAR(_nc_tputs_trace) (void) { - return SP ? SP->_tputs_trace : _nc_prescreen._tputs_trace; + return CURRENT_SCREEN ? CURRENT_SCREEN->_tputs_trace : _nc_prescreen._tputs_trace; } NCURSES_EXPORT(long) NCURSES_PUBLIC_VAR(_nc_outchars) (void) { - return SP ? SP->_outchars : _nc_prescreen._outchars; + return CURRENT_SCREEN ? CURRENT_SCREEN->_outchars : _nc_prescreen._outchars; } NCURSES_EXPORT(void) _nc_set_tputs_trace(const char *s) { - if (SP) - SP->_tputs_trace = s; + if (CURRENT_SCREEN) + CURRENT_SCREEN->_tputs_trace = s; else _nc_prescreen._tputs_trace = s; } NCURSES_EXPORT(void) _nc_count_outchars(long increment) { - if (SP) - SP->_outchars += increment; + if (CURRENT_SCREEN) + CURRENT_SCREEN->_outchars += increment; else _nc_prescreen._outchars += increment; } diff --git a/ncurses/trace/lib_traceatr.c b/ncurses/trace/lib_traceatr.c index 45a03cea..50920f24 100644 --- a/ncurses/trace/lib_traceatr.c +++ b/ncurses/trace/lib_traceatr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. * + * Copyright (c) 1998-2008,2009 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,6 +30,7 @@ * Author: Thomas Dickey 1996-on * * and: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Juergen Pfeifer * ****************************************************************************/ /* @@ -39,7 +40,7 @@ #include #include /* acs_chars */ -MODULE_ID("$Id: lib_traceatr.c,v 1.63 2008/08/03 16:24:53 tom Exp $") +MODULE_ID("$Id: lib_traceatr.c,v 1.64 2009/02/28 21:10:20 tom Exp $") #define COLOR_OF(c) ((c < 0) ? "default" : (c > 7 ? color_of(c) : colors[c].name)) @@ -228,7 +229,7 @@ _nc_altcharset_name(attr_t attr, chtype ch) if ((attr & A_ALTCHARSET) && (acs_chars != 0)) { char *cp; char *found = 0; - const ALT_NAMES *sp; + const ALT_NAMES *strp; for (cp = acs_chars; cp[0] && cp[1]; cp += 2) { if (ChCharOf(cp[1]) == ChCharOf(ch)) { @@ -239,9 +240,9 @@ _nc_altcharset_name(attr_t attr, chtype ch) if (found != 0) { ch = ChCharOf(*found); - for (sp = names; sp->val; sp++) - if (sp->val == ch) { - result = sp->name; + for (strp = names; strp->val; strp++) + if (strp->val == ch) { + result = strp->name; break; } } @@ -260,7 +261,8 @@ _tracechtype2(int bufnum, chtype ch) if ((found = _nc_altcharset_name(ChAttrOf(ch), ch)) != 0) { (void) _nc_trace_bufcat(bufnum, found); } else - (void) _nc_trace_bufcat(bufnum, _nc_tracechar(SP, (int) ChCharOf(ch))); + (void) _nc_trace_bufcat(bufnum, _nc_tracechar(CURRENT_SCREEN, + (int) ChCharOf(ch))); if (ChAttrOf(ch) != A_NORMAL) { (void) _nc_trace_bufcat(bufnum, " | "); @@ -320,7 +322,7 @@ _tracecchar_t2(int bufnum, const cchar_t *ch) if (PUTC_ch != L'\0') { /* it could not be a multibyte sequence */ (void) _nc_trace_bufcat(bufnum, - _nc_tracechar(SP, + _nc_tracechar(CURRENT_SCREEN, UChar(ch->chars[PUTC_i]))); } break; @@ -329,7 +331,7 @@ _tracecchar_t2(int bufnum, const cchar_t *ch) if (n) (void) _nc_trace_bufcat(bufnum, ", "); (void) _nc_trace_bufcat(bufnum, - _nc_tracechar(SP, + _nc_tracechar(CURRENT_SCREEN, UChar(PUTC_buf[n]))); } } diff --git a/test/railroad.c b/test/railroad.c index 160823d4..72ff8670 100644 --- a/test/railroad.c +++ b/test/railroad.c @@ -29,7 +29,7 @@ /* * Author: Thomas E. Dickey - 2000 * - * $Id: railroad.c,v 1.16 2008/02/09 18:08:43 tom Exp $ + * $Id: railroad.c,v 1.17 2008/12/07 02:07:41 juergen Exp $ * * A simple demo of the termcap interface. */ @@ -82,7 +82,7 @@ Backup(void) } static void -ShowCursor(int flag) +MyShowCursor(int flag) { if (startC != 0 && finisC != 0) { tputs(flag ? startC : finisC, 1, outc); @@ -166,7 +166,7 @@ cleanup(void) { Underline(0); StandOut(0); - ShowCursor(1); + MyShowCursor(1); } static void @@ -214,14 +214,14 @@ railroad(char **args) startC = tgetstr("ve", &ap); finisC = tgetstr("vi", &ap); - ShowCursor(0); + MyShowCursor(0); CATCHALL(onsig); while (*args) { ShowSign(*args++); } - ShowCursor(1); + MyShowCursor(1); } }