From: Thomas E. Dickey Date: Sat, 11 Apr 2009 22:39:24 +0000 (+0000) Subject: ncurses 5.7 - patch 20090411 X-Git-Tag: v5.8~97 X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=commitdiff_plain;h=fc79b49bd8a9c5e4db287514cdac46e1691cf48a ncurses 5.7 - patch 20090411 + continue integrating "sp-funcs" by Juergen Pfeifer (incomplete). This change finishes merging for menu and panel libraries, does part of the form library. --- diff --git a/NEWS b/NEWS index 4fd2b313..cfd83aa9 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.1379 2009/04/04 22:35:29 tom Exp $ +-- $Id: NEWS,v 1.1380 2009/04/11 22:00:37 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. +20090411 + + continue integrating "sp-funcs" by Juergen Pfeifer (incomplete). + This change finishes merging for menu and panel libraries, does + part of the form library. + 20090404 + suppress configure check for static/dynamic linker flags for gcc on Darwin (report by Nelson Beebe). diff --git a/dist.mk b/dist.mk index 59d6c2a1..f4ac795b 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.692 2009/04/04 18:57:01 tom Exp $ +# $Id: dist.mk,v 1.693 2009/04/11 20:38:16 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 = 20090404 +NCURSES_PATCH = 20090411 # 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_newftyp.c b/form/fld_newftyp.c index c2984b10..f101dce5 100644 --- a/form/fld_newftyp.c +++ b/form/fld_newftyp.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2004,2007 Free Software Foundation, Inc. * + * Copyright (c) 1998-2007,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 * @@ -32,9 +32,9 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_newftyp.c,v 1.15 2007/10/13 19:30:55 tom Exp $") +MODULE_ID("$Id: fld_newftyp.c,v 1.16 2009/04/11 21:27:33 tom Exp $") -static FIELDTYPE const default_fieldtype = +static FIELDTYPE default_fieldtype = { 0, /* status */ 0L, /* reference count */ @@ -49,7 +49,7 @@ static FIELDTYPE const default_fieldtype = NULL /* enumerate previous function */ }; -NCURSES_EXPORT_VAR(const FIELDTYPE *) +NCURSES_EXPORT_VAR(FIELDTYPE *) _nc_Default_FieldType = &default_fieldtype; /*--------------------------------------------------------------------------- diff --git a/form/form.priv.h b/form/form.priv.h index fea627d3..82a844fa 100644 --- a/form/form.priv.h +++ b/form/form.priv.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2006,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,7 +30,7 @@ * Author: Juergen Pfeifer, 1995,1997 * ****************************************************************************/ -/* $Id: form.priv.h,v 0.27 2008/09/08 20:29:05 tom Exp $ */ +/* $Id: form.priv.h,v 0.28 2009/04/11 21:27:04 tom Exp $ */ #ifndef FORM_PRIV_H #define FORM_PRIV_H 1 @@ -62,6 +62,13 @@ #include "form.h" + /*********************** + * Default objects * + ***********************/ +extern NCURSES_EXPORT_VAR(FORM *) _nc_Default_Form; +extern NCURSES_EXPORT_VAR(FIELD *) _nc_Default_Field; +extern NCURSES_EXPORT_VAR(FIELDTYPE *) _nc_Default_FieldType; + /* form status values */ #define _OVLMODE (0x04U) /* Form is in overlay mode */ #define _WINDOW_MODIFIED (0x10U) /* Current field window has been modified */ @@ -91,6 +98,11 @@ #define Normalize_Field(field) \ ((field) = (field != 0) ? (field) : _nc_Default_Field) +#if NCURSES_SP_FUNCS +#define Get_Form_Screen(form) \ + ((form)->win ? _nc_screen_of((form->win)):CURRENT_SCREEN) +#endif + /* Retrieve forms window */ #define Get_Form_Window(form) \ ((form)->sub?(form)->sub:((form)->win?(form)->win:stdscr)) @@ -144,8 +156,6 @@ TypeArgument; #define C_ZEROS '\0' -extern NCURSES_EXPORT_VAR(const FIELDTYPE *) _nc_Default_FieldType; - extern NCURSES_EXPORT(TypeArgument *) _nc_Make_Argument (const FIELDTYPE*, va_list*, int*); extern NCURSES_EXPORT(TypeArgument *) _nc_Copy_Argument (const FIELDTYPE*, const TypeArgument*, int*); extern NCURSES_EXPORT(void) _nc_Free_Argument (const FIELDTYPE*, TypeArgument*); @@ -176,8 +186,8 @@ extern NCURSES_EXPORT(wchar_t *) _nc_Widen_String(char *, int *); extern NCURSES_EXPORT(FIELD **) _nc_retrace_field_ptr (FIELD **); extern NCURSES_EXPORT(FIELD *) _nc_retrace_field (FIELD *); extern NCURSES_EXPORT(FIELDTYPE *) _nc_retrace_field_type (FIELDTYPE *); -extern NCURSES_EXPORT(FORM *) _nc_retrace_form (FORM *); -extern NCURSES_EXPORT(Form_Hook) _nc_retrace_form_hook (Form_Hook); +extern NCURSES_EXPORT(FORM *) _nc_retrace_form (FORM *); +extern NCURSES_EXPORT(Form_Hook) _nc_retrace_form_hook (Form_Hook); #else /* !TRACE */ diff --git a/form/frm_sub.c b/form/frm_sub.c index 6db0023d..3c34bcf3 100644 --- a/form/frm_sub.c +++ b/form/frm_sub.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 * @@ -27,12 +27,12 @@ ****************************************************************************/ /**************************************************************************** - * Author: Juergen Pfeifer, 1995,1997 * + * Author: Juergen Pfeifer, 1995-1997,2009 * ****************************************************************************/ #include "form.priv.h" -MODULE_ID("$Id: frm_sub.c,v 1.9 2004/12/11 22:13:39 tom Exp $") +MODULE_ID("$Id: frm_sub.c,v 1.10 2009/04/11 18:32:47 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -50,9 +50,18 @@ set_form_sub(FORM *form, WINDOW *win) if (form && (form->status & _POSTED)) RETURN(E_POSTED); + else + { +#if NCURSES_SP_FUNCS + FORM *f = Normalize_Form(form); - Normalize_Form(form)->sub = win; - RETURN(E_OK); + f->sub = win ? win : Get_Form_Screen(f)->_stdscr; + RETURN(E_OK); +#else + Normalize_Form(form)->sub = win; + RETURN(E_OK); +#endif + } } /*--------------------------------------------------------------------------- diff --git a/include/nc_panel.h b/include/nc_panel.h index 6578577e..ece95947 100644 --- a/include/nc_panel.h +++ b/include/nc_panel.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2000,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 * @@ -33,7 +33,7 @@ /* - * $Id: nc_panel.h,v 1.5 2008/08/04 18:26:46 tom Exp $ + * $Id: nc_panel.h,v 1.6 2009/04/11 21:17:57 tom Exp $ * * nc_panel.h * @@ -62,6 +62,10 @@ struct panelhook { /* Retrieve the panelhook of the current screen */ extern NCURSES_EXPORT(struct panelhook*) _nc_panelhook (void); +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(struct panelhook*) NCURSES_SP_NAME(_nc_panelhook) (SCREEN *); +#endif + #ifdef __cplusplus } #endif diff --git a/include/term_entry.h b/include/term_entry.h index fb875407..7b034cf9 100644 --- a/include/term_entry.h +++ b/include/term_entry.h @@ -32,7 +32,7 @@ * and: Thomas E. Dickey 1998-on * ****************************************************************************/ -/* $Id: term_entry.h,v 1.35 2008/08/16 16:16:03 tom Exp $ */ +/* $Id: term_entry.h,v 1.36 2008/11/16 00:19:59 juergen Exp $ */ /* * term_entry.h -- interface to entry-manipulation code @@ -81,7 +81,7 @@ ENTRY; #define EXT_NAMES(tp,i,limit,index,table) table[i] #endif -#define NUM_EXT_NAMES(tp) ((tp)->ext_Booleans + (tp)->ext_Numbers + (tp)->ext_Strings) +#define NUM_EXT_NAMES(tp) (unsigned) ((tp)->ext_Booleans + (tp)->ext_Numbers + (tp)->ext_Strings) #define for_each_boolean(n,tp) for(n = 0; n < NUM_BOOLEANS(tp); n++) #define for_each_number(n,tp) for(n = 0; n < NUM_NUMBERS(tp); n++) diff --git a/man/form_field_validation.3x b/man/form_field_validation.3x index 2da52efd..1778bacb 100644 --- a/man/form_field_validation.3x +++ b/man/form_field_validation.3x @@ -26,7 +26,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: form_field_validation.3x,v 1.16 2006/12/24 16:08:08 tom Exp $ +.\" $Id: form_field_validation.3x,v 1.17 2008/12/14 19:22:16 juergen Exp $ .TH form_field_validation 3X "" .SH NAME \fBform_field_validation\fR - data type validation for fields @@ -70,9 +70,7 @@ argument pointing to a string list; a fourth \fBint\fR flag argument to enable case-sensitivity; and a fifth \fBint\fR flag argument specifying whether a partial match must be a unique one (if this flag is off, a prefix matches the first of any set of more than one list elements with that prefix). Please notice -that the string list is not copied, only a reference to it is stored in the -field. So you should avoid using a list that lives in automatic variables -on the stack. +that the string list is copied. So you may use a list that lives in automatic variables on the stack. .TP 5 TYPE_INTEGER Integer data, parsable to an integer by \fBatoi(3)\fR. Requires a third diff --git a/menu/m_attribs.c b/menu/m_attribs.c index 1126ffb8..388d2de6 100644 --- a/menu/m_attribs.c +++ b/menu/m_attribs.c @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_attribs.c,v 1.14 2004/12/11 23:29:12 tom Exp $") +MODULE_ID("$Id: m_attribs.c,v 1.15 2008/11/16 00:19:59 juergen Exp $") /* Macro to redraw menu if it is posted and changed */ #define Refresh_Menu(menu) \ @@ -49,9 +49,9 @@ MODULE_ID("$Id: m_attribs.c,v 1.14 2004/12/11 23:29:12 tom Exp $") /* "Template" macro to generate a function to set a menus attribute */ #define GEN_MENU_ATTR_SET_FCT( name ) \ -NCURSES_IMPEXP int NCURSES_API set_menu_ ## name (MENU * menu, chtype attr)\ +NCURSES_IMPEXP int NCURSES_API set_menu_ ## name (MENU* menu, chtype attr) \ {\ - T((T_CALLED("set_menu_" #name "(%p,%s)"), menu, _traceattr(attr)));\ + T((T_CALLED("set_menu_" #name "(%p,%s)"), menu, _traceattr(attr))); \ if (!(attr==A_NORMAL || (attr & A_ATTRIBUTES)==attr))\ RETURN(E_BAD_ARGUMENT);\ if (menu && ( menu -> name != attr))\ @@ -140,4 +140,5 @@ GEN_MENU_ATTR_SET_FCT(grey) | Return Values : Attribute value +--------------------------------------------------------------------------*/ GEN_MENU_ATTR_GET_FCT(grey) + /* m_attribs.c ends here */ diff --git a/menu/m_new.c b/menu/m_new.c index c20c6651..6068dc61 100644 --- a/menu/m_new.c +++ b/menu/m_new.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2004,2006 Free Software Foundation, Inc. * + * Copyright (c) 1998-2006,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,11 +37,11 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_new.c,v 1.18 2006/11/04 19:04:06 tom Exp $") +MODULE_ID("$Id: m_new.c,v 1.19 2009/04/05 00:32:13 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu -| Function : MENU *new_menu(ITEM **items) +| Function : MENU* _nc_new_menu(SCREEN*, ITEM **items) | | Description : Creates a new menu connected to the item pointer | array items and returns a pointer to the new menu. @@ -51,18 +51,25 @@ MODULE_ID("$Id: m_new.c,v 1.18 2006/11/04 19:04:06 tom Exp $") | Return Values : NULL on error +--------------------------------------------------------------------------*/ NCURSES_EXPORT(MENU *) -new_menu(ITEM ** items) +NCURSES_SP_NAME(new_menu) (NCURSES_SP_DCLx ITEM ** items) { int err = E_SYSTEM_ERROR; MENU *menu = (MENU *) calloc(1, sizeof(MENU)); - T((T_CALLED("new_menu(%p)"), items)); + T((T_CALLED("new_menu(%p,%p)"), SP_PARM, items)); if (menu) { *menu = _nc_Default_Menu; menu->status = 0; menu->rows = menu->frows; menu->cols = menu->fcols; +#if NCURSES_SP_FUNCS + /* This ensures userwin and usersub are always non-null, + so we can derive always the SCREEN that this menu is + running on. */ + menu->userwin = SP_PARM->_stdscr; + menu->usersub = SP_PARM->_stdscr; +#endif if (items && *items) { if (!_nc_Connect_Items(menu, items)) @@ -71,6 +78,8 @@ new_menu(ITEM ** items) free(menu); menu = (MENU *) 0; } + else + err = E_OK; } } @@ -80,6 +89,25 @@ new_menu(ITEM ** items) returnMenu(menu); } +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : MENU *new_menu(ITEM **items) +| +| Description : Creates a new menu connected to the item pointer +| array items and returns a pointer to the new menu. +| The new menu is initialized with the values from the +| default menu. +| +| Return Values : NULL on error ++--------------------------------------------------------------------------*/ +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(MENU *) +new_menu(ITEM ** items) +{ + return NCURSES_SP_NAME(new_menu) (CURRENT_SCREEN, items); +} +#endif + /*--------------------------------------------------------------------------- | Facility : libnmenu | Function : int free_menu(MENU *menu) diff --git a/menu/m_pad.c b/menu/m_pad.c index 76083ba3..79659aa2 100644 --- a/menu/m_pad.c +++ b/menu/m_pad.c @@ -37,19 +37,19 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_pad.c,v 1.10 2004/12/25 21:40:58 tom Exp $") +MODULE_ID("$Id: m_pad.c,v 1.11 2009/02/07 23:11:44 tom Exp $") /* Macro to redraw menu if it is posted and changed */ #define Refresh_Menu(menu) \ if ( (menu) && ((menu)->status & _POSTED) )\ {\ _nc_Draw_Menu( menu );\ - _nc_Show_Menu( menu );\ + _nc_Show_Menu( menu ); \ } /*--------------------------------------------------------------------------- | Facility : libnmenu -| Function : int set_menu_pad(MENU *menu, int pad) +| Function : int set_menu_pad(MENU* menu, int pad) | | Description : Set the character to be used to separate the item name | from its description. This must be a printable diff --git a/menu/m_sub.c b/menu/m_sub.c index 82649c57..ae77f075 100644 --- a/menu/m_sub.c +++ b/menu/m_sub.c @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_sub.c,v 1.10 2004/12/25 21:38:31 tom Exp $") +MODULE_ID("$Id: m_sub.c,v 1.11 2009/04/05 00:35:51 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -57,8 +57,22 @@ set_menu_sub(MENU * menu, WINDOW *win) { if (menu->status & _POSTED) RETURN(E_POSTED); - menu->usersub = win; - _nc_Calculate_Item_Length_and_Width(menu); + else +#if NCURSES_SP_FUNCS + { + /* We ensure that usersub is never null. So even if a null + WINDOW parameter is passed, we store the SCREENS stdscr. + The only MENU that can have a null usersub is the static + _nc_default_Menu. + */ + SCREEN *sp = _nc_screen_of(menu->usersub); + + menu->usersub = win ? win : sp->_stdscr; + _nc_Calculate_Item_Length_and_Width(menu); + } +#else + menu->usersub = win; +#endif } else _nc_Default_Menu.usersub = win; @@ -68,7 +82,7 @@ set_menu_sub(MENU * menu, WINDOW *win) /*--------------------------------------------------------------------------- | Facility : libnmenu -| Function : WINDOW *menu_sub(const MENU *menu) +| Function : WINDOW* menu_sub(const MENU *menu) | | Description : Returns a pointer to the subwindow of the menu | diff --git a/menu/m_win.c b/menu/m_win.c index c3f857f7..28715416 100644 --- a/menu/m_win.c +++ b/menu/m_win.c @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_win.c,v 1.15 2004/12/25 21:39:20 tom Exp $") +MODULE_ID("$Id: m_win.c,v 1.16 2009/04/05 00:38:22 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -57,8 +57,22 @@ set_menu_win(MENU * menu, WINDOW *win) { if (menu->status & _POSTED) RETURN(E_POSTED); - menu->userwin = win; - _nc_Calculate_Item_Length_and_Width(menu); + else +#if NCURSES_SP_FUNCS + { + /* We ensure that userwin is never null. So even if a null + WINDOW parameter is passed, we store the SCREENS stdscr. + The only MENU that can have a null userwin is the static + _nc_default_Menu. + */ + SCREEN *sp = _nc_screen_of(menu->userwin); + + menu->userwin = win ? win : sp->_stdscr; + _nc_Calculate_Item_Length_and_Width(menu); + } +#else + menu->userwin = win; +#endif } else _nc_Default_Menu.userwin = win; @@ -68,7 +82,7 @@ set_menu_win(MENU * menu, WINDOW *win) /*--------------------------------------------------------------------------- | Facility : libnmenu -| Function : WINDOW *menu_win(const MENU *) +| Function : WINDOW* menu_win(const MENU*) | | Description : Returns pointer to the window of the menu | @@ -80,7 +94,7 @@ menu_win(const MENU * menu) const MENU *m = Normalize_Menu(menu); T((T_CALLED("menu_win(%p)"), menu)); - returnWin(m->userwin ? m->userwin : stdscr); + returnWin(Get_Menu_UserWin(m)); } /* m_win.c ends here */ diff --git a/menu/menu.h b/menu/menu.h index 84352eb5..4eeac018 100644 --- a/menu/menu.h +++ b/menu/menu.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2003,2007 Free Software Foundation, Inc. * + * Copyright (c) 1998-2007,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.h,v 1.19 2007/02/24 17:32:13 tom Exp $ */ +/* $Id: menu.h,v 1.20 2009/04/05 00:28:07 tom Exp $ */ #ifndef ETI_MENU #define ETI_MENU @@ -249,6 +249,10 @@ extern NCURSES_EXPORT(bool) item_visible (const ITEM *); extern NCURSES_EXPORT(void) menu_format (const MENU *,int *,int *); +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(MENU *) NCURSES_SP_NAME(new_menu) (SCREEN*, ITEM **); +#endif + #ifdef __cplusplus } #endif diff --git a/ncurses/base/lib_initscr.c b/ncurses/base/lib_initscr.c index b2fef0c1..334682fa 100644 --- a/ncurses/base/lib_initscr.c +++ b/ncurses/base/lib_initscr.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 * @@ -45,7 +45,7 @@ #include /* needed for ISC */ #endif -MODULE_ID("$Id: lib_initscr.c,v 1.38 2008/08/16 21:20:48 Werner.Fink Exp $") +MODULE_ID("$Id: lib_initscr.c,v 1.39 2009/02/14 20:55:49 tom Exp $") NCURSES_EXPORT(WINDOW *) initscr(void) @@ -90,7 +90,11 @@ initscr(void) } /* def_shell_mode - done in newterm/_nc_setupscreen */ +#if NCURSES_SP_FUNCS + NCURSES_SP_NAME(def_prog_mode) (CURRENT_SCREEN); +#else def_prog_mode(); +#endif } result = stdscr; _nc_unlock_global(curses); diff --git a/ncurses/base/nc_panel.c b/ncurses/base/nc_panel.c index 59bfbbe8..69b10bc0 100644 --- a/ncurses/base/nc_panel.c +++ b/ncurses/base/nc_panel.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2000,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 * @@ -32,10 +32,22 @@ #include -MODULE_ID("$Id: nc_panel.c,v 1.4 2000/12/10 02:43:28 tom Exp $") +MODULE_ID("$Id: nc_panel.c,v 1.5 2009/04/11 21:05:10 tom Exp $") +NCURSES_EXPORT(struct panelhook *) +NCURSES_SP_NAME(_nc_panelhook) (NCURSES_SP_DCL0) +{ + return (SP_PARM + ? &(SP_PARM->_panelHook) + : (CURRENT_SCREEN + ? &(CURRENT_SCREEN->_panelHook) + : 0)); +} + +#if NCURSES_SP_FUNCS NCURSES_EXPORT(struct panelhook *) _nc_panelhook(void) { - return (SP ? &(SP->_panelHook) : NULL); + return NCURSES_SP_NAME(_nc_panelhook) (CURRENT_SCREEN); } +#endif diff --git a/ncurses/tinfo/access.c b/ncurses/tinfo/access.c index ce8ccdac..08091aa4 100644 --- a/ncurses/tinfo/access.c +++ b/ncurses/tinfo/access.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. * + * Copyright (c) 1998-2007,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 * @@ -38,7 +38,7 @@ #include #include -MODULE_ID("$Id: access.c,v 1.14 2007/11/18 00:57:53 tom Exp $") +MODULE_ID("$Id: access.c,v 1.15 2009/04/05 00:03:10 tom Exp $") #define LOWERCASE(c) ((isalpha(UChar(c)) && isupper(UChar(c))) ? tolower(UChar(c)) : (c)) @@ -97,7 +97,7 @@ _nc_pathlast(const char *path) test = path; else test++; - return (test - path); + return (unsigned) (test - path); } NCURSES_EXPORT(char *) diff --git a/panel/p_above.c b/panel/p_above.c index 32495f62..58db0e60 100644 --- a/panel/p_above.c +++ b/panel/p_above.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2000,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 * @@ -29,24 +29,56 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1995 * * and: Eric S. Raymond * + * and: Juergen Pfeifer 1997-1999,2008 * ****************************************************************************/ /* p_above.c */ #include "panel.priv.h" -MODULE_ID("$Id: p_above.c,v 1.6 2005/02/19 16:44:57 tom Exp $") +MODULE_ID("$Id: p_above.c,v 1.7 2009/04/11 20:03:06 tom Exp $") + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(PANEL *) +ground_panel(SCREEN * sp) +{ + T((T_CALLED("ground_panel(%p)"), sp)); + if (sp) + { + struct panelhook *ph = NCURSES_SP_NAME(_nc_panelhook) (sp); + + if (_nc_bottom_panel) /* this is the pseudo panel */ + returnPanel(_nc_bottom_panel->above); + else + returnPanel(0); + } + else + { + if (0 == CURRENT_SCREEN) + returnPanel(0); + else + returnPanel(ground_panel(CURRENT_SCREEN)); + } +} +#endif NCURSES_EXPORT(PANEL *) panel_above(const PANEL * pan) { + PANEL *result; + T((T_CALLED("panel_above(%p)"), pan)); - if (!pan) + if (pan) + result = pan->above; + else { +#if NCURSES_SP_FUNCS + result = ground_panel(CURRENT_SCREEN); +#else /* if top and bottom are equal, we have no or only the pseudo panel; if not, we return the panel above the pseudo panel */ - returnPanel(EMPTY_STACK()? (PANEL *) 0 : _nc_bottom_panel->above); + result = EMPTY_STACK()? (PANEL *) 0 : _nc_bottom_panel->above; +#endif } - else - returnPanel(pan->above); + returnPanel(result); } diff --git a/panel/p_below.c b/panel/p_below.c index c4b24101..bf54ec59 100644 --- a/panel/p_below.c +++ b/panel/p_below.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2000,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 * @@ -29,26 +29,57 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1995 * * and: Eric S. Raymond * + * and: Juergen Pfeifer 1997-1999,2008 * ****************************************************************************/ /* p_below.c */ #include "panel.priv.h" -MODULE_ID("$Id: p_below.c,v 1.6 2005/02/19 16:45:10 tom Exp $") +MODULE_ID("$Id: p_below.c,v 1.7 2009/04/11 20:17:59 tom Exp $") +#if NCURSES_SP_FUNCS NCURSES_EXPORT(PANEL *) -panel_below(const PANEL * pan) +ceiling_panel(SCREEN * sp) { - T((T_CALLED("panel_below(%p)"), pan)); - if (!pan) + T((T_CALLED("ceiling_panel(%p)"), sp)); + if (sp) { + struct panelhook *ph = NCURSES_SP_NAME(_nc_panelhook) (sp); + /* if top and bottom are equal, we have no or only the pseudo panel */ returnPanel(EMPTY_STACK()? (PANEL *) 0 : _nc_top_panel); } else { + if (0 == CURRENT_SCREEN) + returnPanel(0); + else + returnPanel(ceiling_panel(CURRENT_SCREEN)); + } +} +#endif + +NCURSES_EXPORT(PANEL *) +panel_below(const PANEL * pan) +{ + PANEL *result; + + T((T_CALLED("panel_below(%p)"), pan)); + if (pan) + { + GetHook(pan); /* we must not return the pseudo panel */ - returnPanel(Is_Pseudo(pan->below) ? (PANEL *) 0 : pan->below); + result = Is_Pseudo(pan->below) ? (PANEL *) 0 : pan->below; + } + else + { +#if NCURSES_SP_FUNCS + result = ceiling_panel(CURRENT_SCREEN); +#else + /* if top and bottom are equal, we have no or only the pseudo panel */ + result = EMPTY_STACK()? (PANEL *) 0 : _nc_top_panel; +#endif } + returnPanel(result); } diff --git a/panel/p_bottom.c b/panel/p_bottom.c index b861fd9b..2a6a2add 100644 --- a/panel/p_bottom.c +++ b/panel/p_bottom.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2000,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 * @@ -29,6 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1995 * * and: Eric S. Raymond * + * and: Juergen Pfeifer 1997-1999,2008 * ****************************************************************************/ /* p_bottom.c @@ -36,7 +37,7 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_bottom.c,v 1.11 2005/02/19 16:38:16 tom Exp $") +MODULE_ID("$Id: p_bottom.c,v 1.12 2008/11/16 00:19:59 juergen Exp $") NCURSES_EXPORT(int) bottom_panel(PANEL * pan) @@ -46,6 +47,7 @@ bottom_panel(PANEL * pan) T((T_CALLED("bottom_panel(%p)"), pan)); if (pan) { + GetHook(pan); if (!Is_Bottom(pan)) { diff --git a/panel/p_delete.c b/panel/p_delete.c index 24ee26b4..011703f5 100644 --- a/panel/p_delete.c +++ b/panel/p_delete.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2000,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 * @@ -29,6 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1995 * * and: Eric S. Raymond * + * and: Juergen Pfeifer 1999,2008 * ****************************************************************************/ /* p_delete.c @@ -36,7 +37,7 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_delete.c,v 1.8 2005/02/19 16:38:45 tom Exp $") +MODULE_ID("$Id: p_delete.c,v 1.9 2009/04/11 18:58:36 tom Exp $") NCURSES_EXPORT(int) del_panel(PANEL * pan) @@ -47,8 +48,11 @@ del_panel(PANEL * pan) if (pan) { dBug(("--> del_panel %s", USER_PTR(pan->user))); - HIDE_PANEL(pan, err, OK); - free((void *)pan); + { + GetHook(pan); + HIDE_PANEL(pan, err, OK); + free((void *)pan); + } } else err = ERR; diff --git a/panel/p_hidden.c b/panel/p_hidden.c index 624c07da..39b01cee 100644 --- a/panel/p_hidden.c +++ b/panel/p_hidden.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2000,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 * @@ -29,6 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1995 * * and: Eric S. Raymond * + * and: Juergen Pfeifer 1997-1999,2008 * ****************************************************************************/ /* p_hidden.c @@ -36,13 +37,18 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_hidden.c,v 1.7 2005/02/19 16:39:17 tom Exp $") +MODULE_ID("$Id: p_hidden.c,v 1.8 2009/04/11 19:01:56 tom Exp $") NCURSES_EXPORT(int) panel_hidden(const PANEL * pan) { + int rc = ERR; + T((T_CALLED("panel_hidden(%p)"), pan)); - if (!pan) - returnCode(ERR); - returnCode(IS_LINKED(pan) ? FALSE : TRUE); + if (pan) + { + GetHook(pan); + rc = (IS_LINKED(pan) ? FALSE : TRUE); + } + returnCode(rc); } diff --git a/panel/p_hide.c b/panel/p_hide.c index 08d8853a..efcd00e4 100644 --- a/panel/p_hide.c +++ b/panel/p_hide.c @@ -36,23 +36,27 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_hide.c,v 1.9 2005/02/19 16:39:41 tom Exp $") +MODULE_ID("$Id: p_hide.c,v 1.10 2009/02/07 23:11:45 tom Exp $") NCURSES_EXPORT(int) hide_panel(register PANEL * pan) { - int err = OK; + int err = ERR; T((T_CALLED("hide_panel(%p)"), pan)); - if (!pan) - returnCode(ERR); - dBug(("--> hide_panel %s", USER_PTR(pan->user))); - dStack("", 1, pan); + if (pan) + { + GetHook(pan); - HIDE_PANEL(pan, err, ERR); + dBug(("--> hide_panel %s", USER_PTR(pan->user))); + dStack("", 1, pan); - dStack("", 9, pan); + HIDE_PANEL(pan, err, ERR); + err = OK; + + dStack("", 9, pan); + } returnCode(err); } diff --git a/panel/p_move.c b/panel/p_move.c index 3818e8cb..a06e86b1 100644 --- a/panel/p_move.c +++ b/panel/p_move.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2000,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 * @@ -29,6 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1995 * * and: Eric S. Raymond * + * and: Juergen Pfeifer 1997-1999,2009 * ****************************************************************************/ /* p_move.c @@ -36,21 +37,24 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_move.c,v 1.9 2005/02/19 16:46:49 tom Exp $") +MODULE_ID("$Id: p_move.c,v 1.10 2008/11/16 00:19:59 juergen Exp $") NCURSES_EXPORT(int) move_panel(PANEL * pan, int starty, int startx) { - T((T_CALLED("move_panel(%p,%d,%d)"), pan, starty, startx)); + int rc = ERR; - if (!pan) - returnCode(ERR); + T((T_CALLED("move_panel(%p,%d,%d)"), pan, starty, startx)); - if (IS_LINKED(pan)) + if (pan) { - Touchpan(pan); - PANEL_UPDATE(pan, (PANEL *) 0); + GetHook(pan); + if (IS_LINKED(pan)) + { + Touchpan(pan); + PANEL_UPDATE(pan, (PANEL *) 0); + } + rc = mvwin(pan->win, starty, startx); } - - returnCode(mvwin(pan->win, starty, startx)); + returnCode(rc); } diff --git a/panel/p_new.c b/panel/p_new.c index 27193168..5d9d5082 100644 --- a/panel/p_new.c +++ b/panel/p_new.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 * @@ -38,7 +38,7 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_new.c,v 1.10 2008/08/04 18:25:48 tom Exp $") +MODULE_ID("$Id: p_new.c,v 1.14 2009/04/11 20:43:04 tom Exp $") #ifdef TRACE static char *stdscr_id; @@ -50,20 +50,27 @@ static char *new_id; Establish the pseudo panel for stdscr if necessary. --------------------------------------------------------------------------*/ static PANEL * -root_panel(void) +root_panel(NCURSES_SP_DCL0) { +#if NCURSES_SP_FUNCS + struct panelhook *ph = NCURSES_SP_NAME(_nc_panelhook) (sp); + +#elif NO_LEAKS + struct panelhook *ph = _nc_panelhook(); +#endif + if (_nc_stdscr_pseudo_panel == (PANEL *) 0) { - assert(stdscr && !_nc_bottom_panel && !_nc_top_panel); + assert(SP_PARM && SP_PARM->_stdscr && !_nc_bottom_panel && !_nc_top_panel); #if NO_LEAKS - _nc_panelhook()->destroy = del_panel; + ph->destroy = del_panel; #endif _nc_stdscr_pseudo_panel = (PANEL *) malloc(sizeof(PANEL)); if (_nc_stdscr_pseudo_panel != 0) { PANEL *pan = _nc_stdscr_pseudo_panel; - WINDOW *win = stdscr; + WINDOW *win = SP_PARM->_stdscr; pan->win = win; pan->below = (PANEL *) 0; @@ -86,13 +93,15 @@ new_panel(WINDOW *win) { PANEL *pan = (PANEL *) 0; + GetWindowHook(win); + T((T_CALLED("new_panel(%p)"), win)); if (!win) returnPanel(pan); if (!_nc_stdscr_pseudo_panel) - (void)root_panel(); + (void)root_panel(NCURSES_SP_ARG); assert(_nc_stdscr_pseudo_panel); if (!(win->_flags & _ISPAD) && (pan = (PANEL *) malloc(sizeof(PANEL)))) diff --git a/panel/p_replace.c b/panel/p_replace.c index 5d0d295c..b4bf6f4a 100644 --- a/panel/p_replace.c +++ b/panel/p_replace.c @@ -36,23 +36,25 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_replace.c,v 1.9 2005/02/19 16:41:31 tom Exp $") +MODULE_ID("$Id: p_replace.c,v 1.10 2009/02/07 23:11:45 tom Exp $") NCURSES_EXPORT(int) replace_panel(PANEL * pan, WINDOW *win) { - T((T_CALLED("replace_panel(%p,%p)"), pan, win)); + int rc = ERR; - if (!pan) - returnCode(ERR); + T((T_CALLED("replace_panel(%p,%p)"), pan, win)); - if (IS_LINKED(pan)) + if (pan) { - Touchpan(pan); - PANEL_UPDATE(pan, (PANEL *) 0); + GetHook(pan); + if (IS_LINKED(pan)) + { + Touchpan(pan); + PANEL_UPDATE(pan, (PANEL *) 0); + } + pan->win = win; + rc = OK; } - - pan->win = win; - - returnCode(OK); + returnCode(rc); } diff --git a/panel/p_show.c b/panel/p_show.c index 35eee237..c517b4b1 100644 --- a/panel/p_show.c +++ b/panel/p_show.c @@ -36,34 +36,37 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_show.c,v 1.11 2005/02/19 16:42:02 tom Exp $") +MODULE_ID("$Id: p_show.c,v 1.12 2009/02/07 23:11:45 tom Exp $") NCURSES_EXPORT(int) show_panel(PANEL * pan) { - int err = OK; + int err = ERR; T((T_CALLED("show_panel(%p)"), pan)); - if (!pan) - returnCode(ERR); + if (pan) + { + GetHook(pan); - if (Is_Top(pan)) - returnCode(OK); + if (Is_Top(pan)) + returnCode(OK); - dBug(("--> show_panel %s", USER_PTR(pan->user))); + dBug(("--> show_panel %s", USER_PTR(pan->user))); - HIDE_PANEL(pan, err, OK); + HIDE_PANEL(pan, err, OK); - dStack("", 1, pan); - assert(_nc_bottom_panel == _nc_stdscr_pseudo_panel); + dStack("", 1, pan); + assert(_nc_bottom_panel == _nc_stdscr_pseudo_panel); - _nc_top_panel->above = pan; - pan->below = _nc_top_panel; - pan->above = (PANEL *) 0; - _nc_top_panel = pan; + _nc_top_panel->above = pan; + pan->below = _nc_top_panel; + pan->above = (PANEL *) 0; + _nc_top_panel = pan; - dStack("", 9, pan); + err = OK; - returnCode(OK); + dStack("", 9, pan); + } + returnCode(err); } diff --git a/panel/p_update.c b/panel/p_update.c index 59677181..d199e45a 100644 --- a/panel/p_update.c +++ b/panel/p_update.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2000,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 * @@ -29,6 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1995 * * and: Eric S. Raymond * + * and: Juergen Pfeifer 1997-1999,2008 * ****************************************************************************/ /* p_update.c @@ -36,28 +37,42 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_update.c,v 1.9 2005/02/19 16:49:47 tom Exp $") +MODULE_ID("$Id: p_update.c,v 1.10 2009/04/11 19:48:36 tom Exp $") NCURSES_EXPORT(void) -update_panels(void) +NCURSES_SP_NAME(update_panels) (NCURSES_SP_DCL0) { PANEL *pan; - T((T_CALLED("update_panels()"))); + T((T_CALLED("update_panels(%p)"), SP_PARM)); dBug(("--> update_panels")); - pan = _nc_bottom_panel; - while (pan && pan->above) - { - PANEL_UPDATE(pan, pan->above); - pan = pan->above; - } - pan = _nc_bottom_panel; - while (pan) + if (SP_PARM) { - Wnoutrefresh(pan); - pan = pan->above; + GetScreenHook(SP_PARM); + + pan = _nc_bottom_panel; + while (pan && pan->above) + { + PANEL_UPDATE(pan, pan->above); + pan = pan->above; + } + + pan = _nc_bottom_panel; + while (pan) + { + Wnoutrefresh(pan); + pan = pan->above; + } } returnVoid; } + +#if NCURSES_SP_FUNCS +NCURSES_EXPORT(void) +update_panels(void) +{ + NCURSES_SP_NAME(update_panels) (CURRENT_SCREEN); +} +#endif diff --git a/panel/panel.c b/panel/panel.c index 16a8083d..8ef39847 100644 --- a/panel/panel.c +++ b/panel/panel.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 * @@ -29,12 +29,14 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1995 * * and: Eric S. Raymond * + * and: Juergen Pfeifer 1996-1999,2008 * + * and: Thomas E. Dickey * ****************************************************************************/ /* panel.c -- implementation of panels library, some core routines */ #include "panel.priv.h" -MODULE_ID("$Id: panel.c,v 1.23 2005/02/19 18:04:31 tom Exp $") +MODULE_ID("$Id: panel.c,v 1.24 2009/04/11 21:29:10 tom Exp $") /*+------------------------------------------------------------------------- _nc_retrace_panel (pan) @@ -91,6 +93,8 @@ _nc_dStack(const char *fmt, int num, const PANEL * pan) { char s80[80]; + GetPanelHook(pan); + sprintf(s80, fmt, num, pan); _tracef("%s b=%s t=%s", s80, (_nc_bottom_panel) ? USER_PTR(_nc_bottom_panel->user) : "--", diff --git a/panel/panel.h b/panel/panel.h index 1e02091d..6ed2061d 100644 --- a/panel/panel.h +++ b/panel/panel.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2001,2006 Free Software Foundation, Inc. * + * Copyright (c) 1998-2006,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 * @@ -29,9 +29,10 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1995 * * and: Eric S. Raymond * + * and: Juergen Pfeifer 1996-1999,2008 * ****************************************************************************/ -/* $Id: panel.h,v 1.10 2006/05/27 19:49:40 tom Exp $ */ +/* $Id: panel.h,v 1.11 2009/04/11 19:50:40 tom Exp $ */ /* panel.h -- interface file for panels library */ @@ -68,6 +69,13 @@ extern NCURSES_EXPORT(int) move_panel (PANEL *, int, int); extern NCURSES_EXPORT(int) replace_panel (PANEL *,WINDOW *); extern NCURSES_EXPORT(int) panel_hidden (const PANEL *); +#if NCURSES_SP_FUNCS +extern NCURSES_EXPORT(PANEL *) ground_panel(SCREEN *); +extern NCURSES_EXPORT(PANEL *) ceiling_panel(SCREEN *); + +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(update_panels) (SCREEN*); +#endif + #if defined(__cplusplus) } #endif diff --git a/panel/panel.priv.h b/panel/panel.priv.h index 4fb8144e..ce4f9893 100644 --- a/panel/panel.priv.h +++ b/panel/panel.priv.h @@ -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 * @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ -/* $Id: panel.priv.h,v 1.22 2008/09/27 22:36:11 tom Exp $ */ +/* $Id: panel.priv.h,v 1.23 2009/04/11 20:33:55 tom Exp $ */ #ifndef NCURSES_PANEL_PRIV_H #define NCURSES_PANEL_PRIV_H 1 @@ -39,9 +39,11 @@ #include #include -#include "curses.priv.h" +struct screen; /* forward declaration */ + +#include "curses.priv.h" /* includes nc_panel.h */ #include "panel.h" -#include + #if USE_RCS_IDS # define MODULE_ID(id) static const char Ident[] = id; @@ -83,14 +85,38 @@ # define Touchline(pan,start,count) touchline((pan)->win,start,count) #endif +#if NCURSES_SP_FUNCS +#define GetScreenHook(sp) \ + struct panelhook* ph = NCURSES_SP_NAME(_nc_panelhook)(sp) +#define GetPanelHook(pan) \ + GetScreenHook(_nc_screen_of((pan)->win)) +#define GetWindowHook(win) \ + SCREEN* sp = _nc_screen_of(win); \ + GetScreenHook(sp) +#define GetHook(pan) SCREEN* sp = _nc_screen_of(pan->win); \ + GetScreenHook(sp) + +#define _nc_stdscr_pseudo_panel ((ph)->stdscr_pseudo_panel) +#define _nc_top_panel ((ph)->top_panel) +#define _nc_bottom_panel ((ph)->bottom_panel) + +#else /* !NCURSES_SP_FUNCS */ + +#define GetScreenHook(sp) /* nothing */ +#define GetPanelHook(pan) /* nothing */ +#define GetWindowHook(win) /* nothing */ +#define GetHook(pan) /* nothing */ + #define _nc_stdscr_pseudo_panel _nc_panelhook()->stdscr_pseudo_panel -#define _nc_top_panel _nc_panelhook()->top_panel -#define _nc_bottom_panel _nc_panelhook()->bottom_panel +#define _nc_top_panel _nc_panelhook()->top_panel +#define _nc_bottom_panel _nc_panelhook()->bottom_panel + +#endif /* NCURSES_SP_FUNCS */ -#define EMPTY_STACK() (_nc_top_panel==_nc_bottom_panel) -#define Is_Bottom(p) (((p)!=(PANEL*)0) && !EMPTY_STACK() && (_nc_bottom_panel->above==(p))) -#define Is_Top(p) (((p)!=(PANEL*)0) && !EMPTY_STACK() && (_nc_top_panel==(p))) -#define Is_Pseudo(p) ((p) && ((p)==_nc_bottom_panel)) +#define EMPTY_STACK() (_nc_top_panel == _nc_bottom_panel) +#define Is_Bottom(p) (((p) != (PANEL*)0) && !EMPTY_STACK() && (_nc_bottom_panel->above == (p))) +#define Is_Top(p) (((p) != (PANEL*)0) && !EMPTY_STACK() && (_nc_top_panel == (p))) +#define Is_Pseudo(p) (((p) != (PANEL*)0) && ((p) == _nc_bottom_panel)) /*+------------------------------------------------------------------------- IS_LINKED(pan) - check to see if panel is in the stack @@ -122,7 +148,7 @@ ix2 = (PENDX(pan1) < PENDX(pan2)) ? PENDX(pan1) : PENDX(pan2);\ iy1 = (PSTARTY(pan1) < PSTARTY(pan2)) ? PSTARTY(pan2) : PSTARTY(pan1);\ iy2 = (PENDY(pan1) < PENDY(pan2)) ? PENDY(pan1) : PENDY(pan2);\ - assert((ix1<=ix2) && (iy1<=iy2));\ + assert((ix1<=ix2) && (iy1<=iy2)) /*+------------------------------------------------------------------------- @@ -136,12 +162,12 @@ { PANEL* pan2 = ((panstart) ? (panstart) : _nc_bottom_panel);\ while(pan2) {\ if ((pan2 != pan) && PANELS_OVERLAPPED(pan,pan2)) {\ - int y,ix1,ix2,iy1,iy2;\ - COMPUTE_INTERSECTION(pan,pan2,ix1,ix2,iy1,iy2);\ + int y, ix1, ix2, iy1, iy2;\ + COMPUTE_INTERSECTION(pan, pan2, ix1, ix2, iy1, iy2);\ for(y = iy1; y <= iy2; y++) {\ if (is_linetouched(pan->win,y - PSTARTY(pan))) {\ struct ldat* line = &(pan2->win->_line[y - PSTARTY(pan2)]);\ - CHANGED_RANGE(line,ix1-PSTARTX(pan2),ix2-PSTARTX(pan2));\ + CHANGED_RANGE(line, ix1 - PSTARTX(pan2), ix2 - PSTARTX(pan2));\ }\ }\ }\ @@ -180,4 +206,9 @@ err = err_if_unlinked;\ } +#if NCURSES_SP_FUNCS +/* These may become later renamed and part of panel.h and the public API */ +extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_update_panels)(SCREEN*); +#endif + #endif /* NCURSES_PANEL_PRIV_H */