diff options
Diffstat (limited to 'menu')
| -rw-r--r-- | menu/Makefile.in | 28 | ||||
| -rw-r--r-- | menu/m_driver.c | 14 | ||||
| -rw-r--r-- | menu/m_global.c | 14 | ||||
| -rw-r--r-- | menu/m_item_new.c | 14 | ||||
| -rw-r--r-- | menu/m_item_vis.c | 6 | ||||
| -rw-r--r-- | menu/m_pattern.c | 6 | ||||
| -rw-r--r-- | menu/m_post.c | 42 | ||||
| -rw-r--r-- | menu/m_req_name.c | 6 | ||||
| -rw-r--r-- | menu/menu.priv.h | 7 | ||||
| -rw-r--r-- | menu/mf_common.h | 8 |
10 files changed, 78 insertions, 67 deletions
diff --git a/menu/Makefile.in b/menu/Makefile.in index b623bf0eed82..5f96e76f944c 100644 --- a/menu/Makefile.in +++ b/menu/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.71 2021/07/03 15:45:33 tom Exp $ +# $Id: Makefile.in,v 1.76 2025/10/25 17:59:51 tom Exp $ ############################################################################## -# Copyright 2020,2021 Thomas E. Dickey # +# Copyright 2020-2024,2025 Thomas E. Dickey # # Copyright 1998-2015,2018 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -47,11 +47,14 @@ SHELL = @SHELL@ VPATH = @srcdir@ THIS = Makefile +@SET_MAKE@ +@SET_DESTDIR@ +TOP_MFLAGS = DESTDIR="$(DESTDIR)" RPATH_LIST="$(RPATH_LIST)" + x = @EXEEXT@ o = .@OBJEXT@ MODEL = @DFT_LWR_MODEL@ -DESTDIR = @DESTDIR@ top_srcdir = @top_srcdir@ srcdir = @srcdir@ prefix = @prefix@ @@ -61,7 +64,9 @@ libdir = @libdir@ includedir = @includedir@ includesubdir = @includesubdir@ -INCLUDEDIR = $(DESTDIR)$(includedir)$(includesubdir) +INCLUDEDIR = $(DESTDIR)$(includedir@MERGE_PREFIX@)$(includesubdir) +BINDIR = $(DESTDIR)$(bindir@MERGE_PREFIX@) +LIBDIR = $(DESTDIR)$(libdir@MERGE_PREFIX@) PACKAGE = @PACKAGE@ @@ -110,7 +115,7 @@ LINK = $(LIBTOOL_LINK) LDFLAGS = @LDFLAGS@ @LD_MODEL@ @LIBS@ SHLIB_DIRS = -L../lib -SHLIB_LIST = $(SHLIB_DIRS) -lncurses@USE_LIB_SUFFIX@ @SHLIB_LIST@ +SHLIB_LIST = $(SHLIB_DIRS) -lncurses@ABI_SUFFIX@ @SHLIB_LIST@ RPATH_LIST = @RPATH_LIST@ RESULTING_SYMS = @RESULTING_SYMS@ @@ -153,10 +158,13 @@ all \ libs \ install :: $(AUTO_SRC) $(LIBRARIES) +check :: + @echo "no unit-test implemented" + sources : $(AUTO_SRC) -$(DESTDIR)$(bindir) \ -$(DESTDIR)$(libdir) : +$(BINDIR) \ +$(LIBDIR) : mkdir -p $@ # make copies to simplify include-paths while still keeping menu's include @@ -207,6 +215,12 @@ distclean :: clean realclean :: distclean +# These rules are used to allow "make -n" to work on a clean directory-tree +../include/curses.h \ +../include/ncurses_def.h \ +../include/term.h : + ( cd ../include && $(MAKE) $(TOP_MFLAGS) ) + ############################################################################### # The remainder of this file is automatically generated during configuration ############################################################################### diff --git a/menu/m_driver.c b/menu/m_driver.c index cf2ef2fe05c6..168eeede08ee 100644 --- a/menu/m_driver.c +++ b/menu/m_driver.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2021,2024 Thomas E. Dickey * * Copyright 1998-2012,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -38,7 +38,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_driver.c,v 1.37 2021/03/27 23:46:29 tom Exp $") +MODULE_ID("$Id: m_driver.c,v 1.39 2024/12/07 22:01:57 tom Exp $") /* Macros */ @@ -307,7 +307,7 @@ menu_driver(MENU *menu, int c) else { my_top_row += rdiff; - while (rdiff-- > 0 && item != 0 && item->down != 0) + while (rdiff-- > 0 && item != NULL && item->down != NULL) item = item->down; } break; @@ -320,7 +320,7 @@ menu_driver(MENU *menu, int c) else { my_top_row -= rdiff; - while (rdiff-- > 0 && item != 0 && item->up != 0) + while (rdiff-- > 0 && item != NULL && item->up != NULL) item = item->up; } break; @@ -449,7 +449,7 @@ menu_driver(MENU *menu, int c) else if (KEY_MOUSE == c) { MEVENT event; - WINDOW *uwin = Get_Menu_UserWin(menu); + const WINDOW *uwin = Get_Menu_UserWin(menu); getmouse(&event); if ((event.bstate & (BUTTON1_CLICKED | @@ -459,7 +459,7 @@ menu_driver(MENU *menu, int c) { /* we react only if the click was in the userwin, that means * inside the menu display area or at the decoration window. */ - WINDOW *sub = Get_Menu_Window(menu); + const WINDOW *sub = Get_Menu_Window(menu); int ry = event.y, rx = event.x; /* screen coordinates */ result = E_REQUEST_DENIED; @@ -548,7 +548,7 @@ menu_driver(MENU *menu, int c) result = E_UNKNOWN_COMMAND; } - if (item == 0) + if (item == NULL) { result = E_BAD_STATE; } diff --git a/menu/m_global.c b/menu/m_global.c index 4bc8ef8fc8c1..f50b2c805a14 100644 --- a/menu/m_global.c +++ b/menu/m_global.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020-2021,2023 Thomas E. Dickey * + * Copyright 2020-2023,2024 Thomas E. Dickey * * Copyright 1998-2012,2014 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -38,7 +38,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_global.c,v 1.34 2023/09/16 16:39:26 tom Exp $") +MODULE_ID("$Id: m_global.c,v 1.35 2024/12/07 23:02:27 tom Exp $") static char mark[] = "-"; /* *INDENT-OFF* */ @@ -256,13 +256,13 @@ _nc_Calculate_Text_Width(const TEXT *item /*FIXME: limit length */ ) int result = item->length; T((T_CALLED("_nc_menu_text_width(%p)"), (const void *)item)); - if (result != 0 && item->str != 0) + if (result != 0 && item->str != NULL) { - int count = (int)mbstowcs(0, item->str, 0); - wchar_t *temp = 0; + int count = (int)mbstowcs(NULL, item->str, 0); + wchar_t *temp = NULL; if (count > 0 - && (temp = typeMalloc(wchar_t, 2 + count)) != 0) + && (temp = typeMalloc(wchar_t, 2 + count)) != NULL) { int n; @@ -296,7 +296,7 @@ calculate_actual_width(MENU *menu, bool name) assert(menu && menu->items); - if (menu->items != 0) + if (menu->items != NULL) { ITEM **items; diff --git a/menu/m_item_new.c b/menu/m_item_new.c index 28b71caf5b07..1af18a2fcce2 100644 --- a/menu/m_item_new.c +++ b/menu/m_item_new.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020-2021 Thomas E. Dickey * + * Copyright 2020-2021,2024 Thomas E. Dickey * * Copyright 1998-2010,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -45,7 +45,7 @@ #endif #endif -MODULE_ID("$Id: m_item_new.c,v 1.38 2021/06/17 21:26:02 tom Exp $") +MODULE_ID("$Id: m_item_new.c,v 1.40 2024/12/07 22:01:57 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -60,16 +60,16 @@ MODULE_ID("$Id: m_item_new.c,v 1.38 2021/06/17 21:26:02 tom Exp $") static bool Is_Printable_String(const char *s) { - int result = TRUE; + bool result = TRUE; #if USE_WIDEC_SUPPORT - int count = (int)mbstowcs(0, s, 0); - wchar_t *temp = 0; + int count = (int)mbstowcs(NULL, s, 0); + wchar_t *temp = NULL; assert(s); if (count > 0 - && (temp = typeCalloc(wchar_t, (2 + (unsigned)count))) != 0) + && (temp = typeCalloc(wchar_t, (2 + (unsigned)count))) != NULL) { int n; @@ -231,7 +231,7 @@ set_menu_mark(MENU *menu, const char *mark) else { menu->mark = old_mark; - menu->marklen = (short)((old_mark != 0) ? strlen(old_mark) : 0); + menu->marklen = (short)((old_mark != NULL) ? strlen(old_mark) : 0); RETURN(E_SYSTEM_ERROR); } } diff --git a/menu/m_item_vis.c b/menu/m_item_vis.c index 9ae4fdb0a689..5471cad9c0ec 100644 --- a/menu/m_item_vis.c +++ b/menu/m_item_vis.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2021,2024 Thomas E. Dickey * * Copyright 1998-2004,2010 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -38,7 +38,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_item_vis.c,v 1.20 2021/06/17 21:20:30 tom Exp $") +MODULE_ID("$Id: m_item_vis.c,v 1.21 2024/07/27 18:14:09 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -53,7 +53,7 @@ MODULE_ID("$Id: m_item_vis.c,v 1.20 2021/06/17 21:20:30 tom Exp $") MENU_EXPORT(bool) item_visible(const ITEM *item) { - MENU *menu; + const MENU *menu; T((T_CALLED("item_visible(%p)"), (const void *)item)); if (item && diff --git a/menu/m_pattern.c b/menu/m_pattern.c index 6fbef236f2e6..5eb6119f842c 100644 --- a/menu/m_pattern.c +++ b/menu/m_pattern.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2021,2024 Thomas E. Dickey * * Copyright 1998-2006,2010 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -38,7 +38,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_pattern.c,v 1.20 2021/06/17 21:20:30 tom Exp $") +MODULE_ID("$Id: m_pattern.c,v 1.21 2024/12/07 23:00:37 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -57,7 +57,7 @@ menu_pattern(const MENU *menu) static char empty[] = ""; T((T_CALLED("menu_pattern(%p)"), (const void *)menu)); - returnPtr(menu ? (menu->pattern ? menu->pattern : empty) : 0); + returnPtr(menu ? (menu->pattern ? menu->pattern : empty) : NULL); } /*--------------------------------------------------------------------------- diff --git a/menu/m_post.c b/menu/m_post.c index cb80230433d5..1e4ce7cf46d6 100644 --- a/menu/m_post.c +++ b/menu/m_post.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020-2021,2022 Thomas E. Dickey * + * Copyright 2020-2022,2024 Thomas E. Dickey * * Copyright 1998-2010,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -38,7 +38,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_post.c,v 1.38 2022/09/24 09:38:44 tom Exp $") +MODULE_ID("$Id: m_post.c,v 1.41 2024/07/27 18:08:59 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -67,7 +67,7 @@ _nc_Post_Item(const MENU *menu, const ITEM *item) - it is a onevalued menu and it is the current item - or it has a selection value */ - wattron(menu->win, (int)menu->back); + wattr_on(menu->win, menu->back, NULL); if (item->value || (item == menu->curitem)) { if (menu->marklen) @@ -79,13 +79,13 @@ _nc_Post_Item(const MENU *menu, const ITEM *item) item. */ if (!(menu->opt & O_ONEVALUE) && item->value && item != menu->curitem) { - wattron(menu->win, (int)menu->fore); + wattr_on(menu->win, menu->fore, NULL); isfore = TRUE; } waddstr(menu->win, menu->mark); if (isfore) { - wattron(menu->win, (int)menu->fore); + wattr_on(menu->win, menu->fore, NULL); isfore = FALSE; } } @@ -93,7 +93,7 @@ _nc_Post_Item(const MENU *menu, const ITEM *item) else /* otherwise we have to wipe out the marker area */ for (ch = ' ', i = menu->marklen; i > 0; i--) waddch(menu->win, ch); - wattroff(menu->win, (int)menu->back); + wattr_off(menu->win, menu->back, NULL); count += menu->marklen; /* First we have to calculate the attribute depending on selectability @@ -101,19 +101,19 @@ _nc_Post_Item(const MENU *menu, const ITEM *item) */ if (!(item->opt & O_SELECTABLE)) { - wattron(menu->win, (int)menu->grey); + wattr_on(menu->win, menu->grey, NULL); isgrey = TRUE; } else { if (item->value || item == menu->curitem) { - wattron(menu->win, (int)menu->fore); + wattr_on(menu->win, menu->fore, NULL); isfore = TRUE; } else { - wattron(menu->win, (int)menu->back); + wattr_on(menu->win, menu->back, NULL); isback = TRUE; } } @@ -159,10 +159,10 @@ _nc_Post_Item(const MENU *menu, const ITEM *item) assert(cx >= 0 && cy >= 0); getyx(menu->win, ncy, ncx); if (isgrey) - wattroff(menu->win, (int)menu->grey); + wattr_off(menu->win, menu->grey, NULL); else if (isfore) - wattroff(menu->win, (int)menu->fore); - wattron(menu->win, (int)menu->back); + wattr_off(menu->win, menu->fore, NULL); + wattr_on(menu->win, menu->back, NULL); for (j = 1; j < menu->spc_rows; j++) { if ((item_y + j) < getmaxy(menu->win)) @@ -176,17 +176,17 @@ _nc_Post_Item(const MENU *menu, const ITEM *item) } wmove(menu->win, ncy, ncx); if (!isback) - wattroff(menu->win, (int)menu->back); + wattr_off(menu->win, menu->back, NULL); } } /* Remove attributes */ if (isfore) - wattroff(menu->win, (int)menu->fore); + wattr_off(menu->win, menu->fore, NULL); if (isback) - wattroff(menu->win, (int)menu->back); + wattr_off(menu->win, menu->back, NULL); if (isgrey) - wattroff(menu->win, (int)menu->grey); + wattr_off(menu->win, menu->grey, NULL); } /*--------------------------------------------------------------------------- @@ -201,7 +201,7 @@ MENU_EXPORT(void) _nc_Draw_Menu(const MENU *menu) { ITEM *item = menu->items[0]; - ITEM *lastvert; + const ITEM *lastvert; ITEM *hitem; chtype s_bkgd; @@ -220,7 +220,7 @@ _nc_Draw_Menu(const MENU *menu) do { - ITEM *lasthor; + const ITEM *lasthor; wmove(menu->win, y, 0); @@ -231,7 +231,7 @@ _nc_Draw_Menu(const MENU *menu) { _nc_Post_Item(menu, hitem); - wattron(menu->win, (int)menu->back); + wattr_on(menu->win, menu->back, NULL); if (((hitem = hitem->right) != lasthor) && hitem) { int i, j, cy, cx; @@ -250,7 +250,7 @@ _nc_Draw_Menu(const MENU *menu) } } while (hitem && (hitem != lasthor)); - wattroff(menu->win, (int)menu->back); + wattr_off(menu->win, menu->back, NULL); item = item->down; y += menu->spc_rows; @@ -291,7 +291,7 @@ post_menu(MENU *menu) { int h = 1 + menu->spc_rows * (menu->rows - 1); - WINDOW *win = Get_Menu_Window(menu); + const WINDOW *win = Get_Menu_Window(menu); int maxy = getmaxy(win); if ((menu->win = newpad(h, menu->width))) diff --git a/menu/m_req_name.c b/menu/m_req_name.c index c72116fa4aff..d4af02d0dccf 100644 --- a/menu/m_req_name.c +++ b/menu/m_req_name.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2021,2024 Thomas E. Dickey * * Copyright 1998-2012,2015 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -38,7 +38,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_req_name.c,v 1.27 2021/06/17 21:11:08 tom Exp $") +MODULE_ID("$Id: m_req_name.c,v 1.28 2024/12/07 23:00:37 tom Exp $") #define DATA(s) { s } @@ -106,7 +106,7 @@ menu_request_by_name(const char *str) T((T_CALLED("menu_request_by_name(%s)"), _nc_visbuf(str))); - if (str != 0 && (i = strlen(str)) != 0) + if (str != NULL && (i = strlen(str)) != 0) { char buf[16]; diff --git a/menu/menu.priv.h b/menu/menu.priv.h index 0bc6147e07d9..e464a7c991d4 100644 --- a/menu/menu.priv.h +++ b/menu/menu.priv.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -31,7 +31,7 @@ * Author: Juergen Pfeifer, 1995,1997 * ****************************************************************************/ -/* $Id: menu.priv.h,v 1.29 2020/05/24 01:40:20 anonymous.maarten Exp $ */ +/* $Id: menu.priv.h,v 1.30 2024/08/03 15:41:22 tom Exp $ */ /*************************************************************************** * Module menu.priv.h * @@ -61,9 +61,6 @@ extern MENU_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 : CURRENT_SCREEN->_stdscr) diff --git a/menu/mf_common.h b/menu/mf_common.h index fcbd565c5a2f..c54e8cdf74fa 100644 --- a/menu/mf_common.h +++ b/menu/mf_common.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2024 Thomas E. Dickey * * Copyright 1998-2005,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -31,7 +31,7 @@ * Author: Juergen Pfeifer, 1995,1997 * ****************************************************************************/ -/* $Id: mf_common.h,v 0.25 2020/02/02 23:34:34 tom Exp $ */ +/* $Id: mf_common.h,v 0.27 2024/12/07 22:01:18 tom Exp $ */ /* Common internal header for menu and form library */ @@ -64,7 +64,7 @@ extern int errno; #if USE_RCS_IDS #define MODULE_ID(id) static const char Ident[] = id; #else -#define MODULE_ID(id) /*nothing */ +#define MODULE_ID(id) /* nothing */ #endif /* Maximum regular 8-bit character code */ @@ -88,7 +88,7 @@ extern int errno; /* Call object hook */ #define Call_Hook( object, handler ) \ - if ( (object) != 0 && ((object)->handler) != (void *) 0 )\ + if ( (object) != NULL && ((object)->handler) != (void *) 0 )\ {\ SetStatus(object, _IN_DRIVER);\ (object)->handler(object);\ |
