/****************************************************************************
- * Copyright (c) 2005-2015,2016 Free Software Foundation, Inc. *
+ * Copyright (c) 2005-2017,2019 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 *
* authorization. *
****************************************************************************/
/*
- * $Id: demo_menus.c,v 1.62 2016/09/10 23:30:33 tom Exp $
+ * $Id: demo_menus.c,v 1.68 2019/08/17 21:45:32 tom Exp $
*
* Demonstrate a variety of functions from the menu library.
* Thomas Dickey - 2005/4/9
#ifdef NCURSES_VERSION
#ifdef TRACE
static unsigned save_trace = TRACE_ORDINARY | TRACE_CALLS;
-extern unsigned _nc_tracing;
static MENU *mpTrace;
#endif
-#else
-#undef TRACE
#endif
typedef enum {
static bool loaded_file = FALSE;
static char empty[1];
+
+#ifdef TRACE
static void failed(const char *s) GCC_NORETURN;
static void
endwin();
ExitProgram(EXIT_FAILURE);
}
+#endif
/* Common function to allow ^T to toggle trace-mode in the middle of a test
* so that trace-files can be made smaller.
int result = 0;
if (okMenuNo(number)) {
- int spc_desc, spc_rows, spc_cols;
-
+ int spc_rows;
#ifdef NCURSES_VERSION
+ int spc_desc, spc_cols;
menu_spacing(mpBanner, &spc_desc, &spc_rows, &spc_cols);
#else
spc_rows = 0;
static void
menu_destroy(MENU * m)
{
- int count;
-
Trace(("menu_destroy %p", (void *) m));
if (m != 0) {
ITEM **items = menu_items(m);
const char *blob = 0;
+ int count;
count = item_count(m);
Trace(("menu_destroy %p count %d", (void *) m, count));
&& (sb.st_mode & S_IFMT) == S_IFREG
&& sb.st_size != 0) {
size_t size = (size_t) sb.st_size;
- unsigned j, k;
char *blob = typeMalloc(char, size + 1);
MENU_DATA *list = typeCalloc(MENU_DATA, size + 1);
if (fp != 0) {
if (fread(blob, sizeof(char), size, fp) == size) {
bool mark = TRUE;
+ unsigned j, k;
for (j = k = 0; j < size; ++j) {
if (mark) {
list[k++].name = blob + j;
/* interactively set the trace level */
{
ITEM **ip;
- unsigned newtrace;
int result;
for (ip = menu_items(mpTrace); *ip; ip++) {
if (result == E_OK) {
if (update_trace_menu(mpTrace) || cmd == REQ_TOGGLE_ITEM) {
- newtrace = 0;
+ unsigned newtrace = 0;
for (ip = menu_items(mpTrace); *ip; ip++) {
if (item_value(*ip)) {
MENU_DATA *td = (MENU_DATA *) item_userptr(*ip);
}
}
-#ifdef KEY_RESIZE
+#if defined(KEY_RESIZE) && NCURSES_EXT_FUNCS
static void
resize_menu(MENU ** menu)
{
resize_menu(&mpTrace);
#endif
}
-#endif
+#endif /* defined(KEY_RESIZE) && NCURSES_EXT_FUNCS */
static void
show_status(int ch, MENU * menu)
case KEY_SRIGHT:
move_menus(last_menu, 0, 1);
continue;
-#ifdef KEY_RESIZE
+#if defined(KEY_RESIZE) && NCURSES_EXT_FUNCS
case KEY_RESIZE:
resize_menus(last_menu);
continue;