]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/dialog/dialog.h
bhnd(9): Fix a few mandoc related issues
[FreeBSD/FreeBSD.git] / contrib / dialog / dialog.h
1 /*
2  *  $Id: dialog.h,v 1.283 2018/06/19 22:52:11 tom Exp $
3  *
4  *  dialog.h -- common declarations for all dialog modules
5  *
6  *  Copyright 2000-2017,2018    Thomas E. Dickey
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU Lesser General Public License, version 2.1
10  *  as published by the Free Software Foundation.
11  *
12  *  This program is distributed in the hope that it will be useful, but
13  *  WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  *  Lesser General Public License for more details.
16  *
17  *  You should have received a copy of the GNU Lesser General Public
18  *  License along with this program; if not, write to
19  *      Free Software Foundation, Inc.
20  *      51 Franklin St., Fifth Floor
21  *      Boston, MA 02110, USA.
22  *
23  *  An earlier version of this program lists as authors
24  *      Savio Lam (lam836@cs.cuhk.hk)
25  */
26
27 #ifndef DIALOG_H_included
28 #define DIALOG_H_included 1
29 /* *INDENT-OFF* */
30
31 #include <dlg_config.h>
32
33 #ifdef __hpux
34 #define __HP_CURSES_COMPAT      /* workaround for getattrs, etc. */
35 #endif
36
37 #include <sys/types.h>
38 #include <fcntl.h>
39 #include <unistd.h>
40 #include <ctype.h>
41 #include <stdlib.h>
42 #include <stdarg.h>
43 #include <string.h>
44 #include <signal.h>     /* fork() etc. */
45 #include <math.h>       /* sqrt() */
46
47 /* header conflict with Solaris xpg4 versus <sys/regset.h> */
48 #if defined(ERR) && (ERR == 13)
49 #undef ERR
50 #endif
51
52 #if defined(HAVE_NCURSESW_NCURSES_H)
53 #include <ncursesw/ncurses.h>
54 #elif defined(HAVE_NCURSES_NCURSES_H)
55 #include <ncurses/ncurses.h>
56 #elif defined(HAVE_NCURSES_CURSES_H)
57 #include <ncurses/curses.h>
58 #elif defined(HAVE_NCURSES_H)
59 #include <ncurses.h>
60 #else
61 #include <curses.h>
62 #if defined(HAVE_UNCTRL_H)
63 #include <unctrl.h> /* most curses.h headers include this, some do not */
64 #endif
65 #endif
66
67 /* Solaris xpg4 renames these */
68 #ifndef KEY_MAX
69 #ifdef __KEY_MAX
70 #define KEY_MAX __KEY_MAX
71 #endif
72 #endif
73
74 #ifndef KEY_MIN
75 #ifdef __KEY_MIN
76 #define KEY_MIN __KEY_MIN
77 #endif
78 #endif
79
80 /* possible conflicts with <term.h> which may be included in <curses.h> */
81 #ifdef color_names
82 #undef color_names
83 #endif
84
85 #ifdef buttons
86 #undef buttons
87 #endif
88
89 #ifdef ENABLE_NLS
90 #include <libintl.h>
91 #include <langinfo.h>
92 #define _(s) dgettext(PACKAGE, s)
93 #else
94 #undef _
95 #define _(s) s
96 #endif
97
98 #ifndef GCC_PRINTFLIKE
99 #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
100 #endif
101
102 #ifndef GCC_NORETURN
103 #define GCC_NORETURN /*nothing*/
104 #endif
105
106 #ifndef GCC_UNUSED
107 #define GCC_UNUSED /*nothing*/
108 #endif
109
110 #ifndef HAVE_WGET_WCH
111 #undef USE_WIDE_CURSES
112 #endif
113
114 /*
115  * FIXME: a configure check would be useful
116  */
117 #ifdef __hpux
118 #undef ACS_UARROW
119 #undef ACS_DARROW
120 #undef ACS_BLOCK
121 #endif
122
123 /*
124  * Change these if you want
125  */
126 #define USE_SHADOW TRUE
127 #define USE_COLORS TRUE
128
129 #ifdef HAVE_COLOR
130 #define SCOLS   (COLS - (dialog_state.use_shadow ? SHADOW_COLS : 0))
131 #define SLINES  (LINES - (dialog_state.use_shadow ? SHADOW_ROWS : 0))
132 #else
133 #define SCOLS   COLS
134 #define SLINES  LINES
135 #endif
136
137 #define DLG_EXIT_ESC            255
138 #define DLG_EXIT_UNKNOWN        -2      /* never return this (internal use) */
139 #define DLG_EXIT_ERROR          -1      /* the shell sees this as 255 */
140 #define DLG_EXIT_OK             0
141 #define DLG_EXIT_CANCEL         1
142 #define DLG_EXIT_HELP           2
143 #define DLG_EXIT_EXTRA          3
144 #define DLG_EXIT_ITEM_HELP      4       /* actually DLG_EXIT_HELP */
145
146 #define DLG_CTRL(n)     ((n) & 0x1f)    /* CTRL is preferred, but conflicts */
147
148 #define CHR_HELP        DLG_CTRL('E')
149 #define CHR_BACKSPACE   DLG_CTRL('H')
150 #define CHR_REPAINT     DLG_CTRL('L')
151 #define CHR_KILL        DLG_CTRL('U')
152 #define CHR_LITERAL     DLG_CTRL('V')
153 #define CHR_DELETE      127
154 #define CHR_NEXT        DLG_CTRL('N')
155 #define CHR_PREVIOUS    DLG_CTRL('P')
156 #define CHR_TRACE       DLG_CTRL('T')
157 #define CHR_SPACE       ' '
158
159 #define ESC             27
160 #define TAB             DLG_CTRL('I')
161
162 #define MARGIN 1        /* width of the line drawn around each box */
163 #define GUTTER 2        /* minimum columns between name/description in menu */
164 #define SHADOW_ROWS 1   /* rows to reserve for window's shadow */
165 #define SHADOW_COLS 2   /* columns to reserve for window's shadow */
166 #define ARROWS_COL  5   /* distance from left margin to up/down arrows */
167
168 #define MAX_LEN 2048
169 #define BUF_SIZE (10L*1024)
170
171 #undef  MIN
172 #define MIN(x,y) ((x) < (y) ? (x) : (y))
173
174 #undef  MAX
175 #define MAX(x,y) ((x) > (y) ? (x) : (y))
176
177 #define DEFAULT_SEPARATE_STR "\t"
178 #define DEFAULT_ASPECT_RATIO 9
179 /* how many spaces is a tab long (default)? */
180 #define TAB_LEN 8
181 #define WTIMEOUT_VAL        10  /* minimum amount of time needed for curses */
182
183 #ifndef A_CHARTEXT
184 #define A_CHARTEXT 0xff
185 #endif
186
187 #define CharOf(ch)  ((ch) & 0xff)
188
189 #ifndef ACS_ULCORNER
190 #define ACS_ULCORNER '+'
191 #endif
192 #ifndef ACS_LLCORNER
193 #define ACS_LLCORNER '+'
194 #endif
195 #ifndef ACS_URCORNER
196 #define ACS_URCORNER '+'
197 #endif
198 #ifndef ACS_LRCORNER
199 #define ACS_LRCORNER '+'
200 #endif
201 #ifndef ACS_HLINE
202 #define ACS_HLINE '-'
203 #endif
204 #ifndef ACS_VLINE
205 #define ACS_VLINE '|'
206 #endif
207 #ifndef ACS_LTEE
208 #define ACS_LTEE '+'
209 #endif
210 #ifndef ACS_RTEE
211 #define ACS_RTEE '+'
212 #endif
213 #ifndef ACS_UARROW
214 #define ACS_UARROW '^'
215 #endif
216 #ifndef ACS_DARROW
217 #define ACS_DARROW 'v'
218 #endif
219 #ifndef ACS_BLOCK
220 #define ACS_BLOCK '#'
221 #endif
222
223 /* these definitions may work for antique versions of curses */
224 #ifndef HAVE_GETBEGYX
225 #undef  getbegyx
226 #define getbegyx(win,y,x)       (y = (win)?(win)->_begy:ERR, x = (win)?(win)->_begx:ERR)
227 #endif
228
229 #ifndef HAVE_GETMAXYX
230 #undef  getmaxyx
231 #define getmaxyx(win,y,x)       (y = (win)?(win)->_maxy:ERR, x = (win)?(win)->_maxx:ERR)
232 #endif
233
234 #ifndef HAVE_GETPARYX
235 #undef  getparyx
236 #define getparyx(win,y,x)       (y = (win)?(win)->_pary:ERR, x = (win)?(win)->_parx:ERR)
237 #endif
238
239 #if !defined(HAVE_WGETPARENT) && defined(HAVE_WINDOW__PARENT)
240 #undef  wgetparent
241 #define wgetparent(win)         ((win) ? (win)->_parent : 0)
242 #endif
243
244 #if !defined(HAVE_WSYNCUP)
245 #undef wsyncup
246 #define wsyncup(win) /* nothing */
247 #endif
248
249 #if !defined(HAVE_WCURSYNCUP)
250 #undef wcursyncup
251 #define wcursyncup(win) /* nothing */
252 #endif
253
254 #ifdef __cplusplus
255 extern "C" {
256 #endif
257
258 /* these definitions may be needed for bleeding-edge curses implementations */
259 #if !(defined(HAVE_GETBEGX) && defined(HAVE_GETBEGY))
260 #undef getbegx
261 #undef getbegy
262 #define getbegx(win) dlg_getbegx(win)
263 #define getbegy(win) dlg_getbegy(win)
264 extern int dlg_getbegx(WINDOW * /*win*/);
265 extern int dlg_getbegy(WINDOW * /*win*/);
266 #endif
267
268 #if !(defined(HAVE_GETCURX) && defined(HAVE_GETCURY))
269 #undef getcurx
270 #undef getcury
271 #define getcurx(win) dlg_getcurx(win)
272 #define getcury(win) dlg_getcury(win)
273 extern int dlg_getcurx(WINDOW * /*win*/);
274 extern int dlg_getcury(WINDOW * /*win*/);
275 #endif
276
277 #if !(defined(HAVE_GETMAXX) && defined(HAVE_GETMAXY))
278 #undef getmaxx
279 #undef getmaxy
280 #define getmaxx(win) dlg_getmaxx(win)
281 #define getmaxy(win) dlg_getmaxy(win)
282 extern int dlg_getmaxx(WINDOW * /*win*/);
283 extern int dlg_getmaxy(WINDOW * /*win*/);
284 #endif
285
286 #if !(defined(HAVE_GETPARX) && defined(HAVE_GETPARY))
287 #undef getparx
288 #undef getpary
289 #define getparx(win) dlg_getparx(win)
290 #define getpary(win) dlg_getpary(win)
291 extern int dlg_getparx(WINDOW * /*win*/);
292 extern int dlg_getpary(WINDOW * /*win*/);
293 #endif
294
295 #if !(defined(HAVE_WGETPARENT) && defined(HAVE_WINDOW__PARENT))
296 #undef wgetparent
297 #define wgetparent(win) dlg_wgetparent(win)
298 extern WINDOW * dlg_wgetparent(WINDOW * /*win*/);
299 #endif
300
301 /*
302  * This is a list of "old" names, which should be helpful in updating
303  * applications that use libdialog.  Starting with 2003/11/26, all exported
304  * symbols from libdialog have "dlg_" prefix, or "dialog_" prefix or "_dialog"
305  * suffix (or suffix "_dialog", e.g., init_dialog).
306  */
307 #ifdef __DIALOG_OLD_NAMES__
308 #define color_table                       dlg_color_table
309 #define attr_clear(win,h,w,a)             dlg_attr_clear(win,h,w,a)
310 #define auto_size(t,s,h,w,xl,mc)          dlg_auto_size(t,s,h,w,xl,mc)
311 #define auto_sizefile(t,f,h,w,xl,mc)      dlg_auto_sizefile(t,f,h,w,xl,mc)
312 #define beeping()                         dlg_beeping()
313 #define box_x_ordinate(w)                 dlg_box_x_ordinate(w)
314 #define box_y_ordinate(h)                 dlg_box_y_ordinate(h)
315 #define calc_listh(h,lh,in)               dlg_calc_listh(h,lh,in)
316 #define calc_listw(in,items,group)        dlg_calc_listw(in,items,group)
317 #define color_setup()                     dlg_color_setup()
318 #define create_rc(f)                      dlg_create_rc(f)
319 #define ctl_size(h,w)                     dlg_ctl_size(h,w)
320 #define del_window(win)                   dlg_del_window(win)
321 #define dialog_clear()                    dlg_clear()
322 #define draw_bottom_box(win)              dlg_draw_bottom_box(win)
323 #define draw_box(win,y,x,h,w,xc,bc)       dlg_draw_box(win,y,x,h,w,xc,bc)
324 #define draw_shadow(win,h,w,y,x)          dlg_draw_shadow(win,h,w,y,x)
325 #define draw_title(win,t)                 dlg_draw_title(win,t)
326 #define exiterr                           dlg_exiterr
327 #define killall_bg(n)                     dlg_killall_bg(n)
328 #define mouse_bigregion(y,x)              dlg_mouse_bigregion(y,x)
329 #define mouse_free_regions()              dlg_mouse_free_regions()
330 #define mouse_mkbigregion(y,x,h,w,n,ix,iy,m) dlg_mouse_mkbigregion(y,x,h,w,n,ix,iy,m)
331 #define mouse_mkregion(y,x,h,w,n)         dlg_mouse_mkregion(y,x,h,w,n)
332 #define mouse_region(y,x)                 dlg_mouse_region(y,x)
333 #define mouse_setbase(x,y)                dlg_mouse_setbase(x,y)
334 #define mouse_setcode(c)                  dlg_mouse_setcode(c)
335 #define mouse_wgetch(w,c)                 dlg_mouse_wgetch(w,c)
336 #define new_window(h,w,y,x)               dlg_new_window(h,w,y,x)
337 #define parse_rc()                        dlg_parse_rc()
338 #define print_autowrap(win,s,h,w)         dlg_print_autowrap(win,s,h,w)
339 #define print_size(h,w)                   dlg_print_size(h,w)
340 #define put_backtitle()                   dlg_put_backtitle()
341 #define strclone(cprompt)                 dlg_strclone(cprompt)
342 #define sub_window(win,h,w,y,x)           dlg_sub_window(win,h,w,y,x)
343 #define tab_correct_str(s)                dlg_tab_correct_str(s)
344 #endif
345
346 /*
347  * Attribute names
348  */
349 #define DIALOG_ATR(n)                 dlg_color_table[n].atr
350
351 #define screen_attr                   DIALOG_ATR(0)
352 #define shadow_attr                   DIALOG_ATR(1)
353 #define dialog_attr                   DIALOG_ATR(2)
354 #define title_attr                    DIALOG_ATR(3)
355 #define border_attr                   DIALOG_ATR(4)
356 #define button_active_attr            DIALOG_ATR(5)
357 #define button_inactive_attr          DIALOG_ATR(6)
358 #define button_key_active_attr        DIALOG_ATR(7)
359 #define button_key_inactive_attr      DIALOG_ATR(8)
360 #define button_label_active_attr      DIALOG_ATR(9)
361 #define button_label_inactive_attr    DIALOG_ATR(10)
362 #define inputbox_attr                 DIALOG_ATR(11)
363 #define inputbox_border_attr          DIALOG_ATR(12)
364 #define searchbox_attr                DIALOG_ATR(13)
365 #define searchbox_title_attr          DIALOG_ATR(14)
366 #define searchbox_border_attr         DIALOG_ATR(15)
367 #define position_indicator_attr       DIALOG_ATR(16)
368 #define menubox_attr                  DIALOG_ATR(17)
369 #define menubox_border_attr           DIALOG_ATR(18)
370 #define item_attr                     DIALOG_ATR(19)
371 #define item_selected_attr            DIALOG_ATR(20)
372 #define tag_attr                      DIALOG_ATR(21)
373 #define tag_selected_attr             DIALOG_ATR(22)
374 #define tag_key_attr                  DIALOG_ATR(23)
375 #define tag_key_selected_attr         DIALOG_ATR(24)
376 #define check_attr                    DIALOG_ATR(25)
377 #define check_selected_attr           DIALOG_ATR(26)
378 #define uarrow_attr                   DIALOG_ATR(27)
379 #define darrow_attr                   DIALOG_ATR(28)
380 #define itemhelp_attr                 DIALOG_ATR(29)
381 #define form_active_text_attr         DIALOG_ATR(30)
382 #define form_text_attr                DIALOG_ATR(31)
383 #define form_item_readonly_attr       DIALOG_ATR(32)
384 #define gauge_attr                    DIALOG_ATR(33)
385 #define border2_attr                  DIALOG_ATR(34)
386 #define inputbox_border2_attr         DIALOG_ATR(35)
387 #define searchbox_border2_attr        DIALOG_ATR(36)
388 #define menubox_border2_attr          DIALOG_ATR(37)
389
390 #define DLGK_max (KEY_MAX + 256)
391
392 /*
393  * Use attributes.
394  */
395 #ifdef PDCURSES
396 #define dlg_attrset(w,a)  (void) wattrset((w), (a))
397 #define dlg_attron(w,a)   (void) wattron((w), (a))
398 #define dlg_attroff(w,a)  (void) wattroff((w), (a))
399 #else
400 #define dlg_attrset(w,a)  (void) wattrset((w), (int)(a))
401 #define dlg_attron(w,a)   (void) wattron((w), (int)(a))
402 #define dlg_attroff(w,a)  (void) wattroff((w), (int)(a))
403 #endif
404
405 /*
406  * Callbacks are used to implement the "background" tailbox.
407  */
408 struct _dlg_callback;
409
410 typedef void (*DIALOG_FREEBACK) (struct _dlg_callback * /* p */);
411
412 typedef struct _dlg_callback {
413     struct _dlg_callback *next;
414     FILE *input;
415     WINDOW *win;
416     bool keep_bg;       /* keep in background, on exit */
417     bool bg_task;       /* true if this is background task */
418     bool (*handle_getc)(struct _dlg_callback *p, int ch, int fkey, int *result);
419     bool keep_win;      /* true to not erase window on exit */
420     /* data for dlg_add_callback_ref */
421     struct _dlg_callback **caller;
422     DIALOG_FREEBACK freeback;
423     /* 1.1-20110107 */
424     bool (*handle_input)(struct _dlg_callback *p);
425     bool input_ready;
426 } DIALOG_CALLBACK;
427
428 typedef struct _dlg_windows {
429     struct _dlg_windows *next;
430     WINDOW *normal;
431     WINDOW *shadow;
432 } DIALOG_WINDOWS;
433
434 /*
435  * Global variables, which are initialized as needed
436  */
437 typedef struct {
438     DIALOG_CALLBACK *getc_callbacks;
439     DIALOG_CALLBACK *getc_redirect;
440     DIALOG_WINDOWS *all_windows;
441     DIALOG_WINDOWS *all_subwindows;
442     FILE *output;               /* option "--output-fd fd" */
443     FILE *pipe_input;           /* used for gauge widget */
444     FILE *screen_output;        /* newterm(), etc. */
445     bool screen_initialized;
446     bool use_colors;            /* use colors by default? */
447     bool use_scrollbar;         /* option "--scrollbar" */
448     bool use_shadow;            /* shadow dialog boxes by default? */
449     bool visit_items;           /* option "--visit-items" */
450     char *separate_str;         /* option "--separate-widget string" */
451     int aspect_ratio;           /* option "--aspect ratio" */
452     int output_count;           /* # of widgets that may have done output */
453     int tab_len;                /* option "--tab-len n" */
454     /* 1.0-20070227 */
455     FILE *input;                /* option "--input-fd fd" */
456 #ifdef HAVE_DLG_TRACE
457     FILE *trace_output;         /* option "--trace file" */
458 #endif
459     /* 1.1-20110106 */
460     bool no_mouse;              /* option "--no-mouse" */
461     int visit_cols;             /* option "--visit-items" */
462     /* 1.2-20130922 */
463     bool finish_string;         /* caching optimization for gauge */
464     /* 1.2-20150125 */
465     bool plain_buttons;         /* true to suppress button-label highlight */
466     /* 1.3-20180610 */
467     bool text_only;             /* option "--print-text-only", etc. */
468     int text_height;
469     int text_width;
470 } DIALOG_STATE;
471
472 extern DIALOG_STATE dialog_state;
473
474 /*
475  * Global variables, which dialog resets before each widget
476  */
477 typedef struct {
478     bool beep_after_signal;     /* option "--beep-after" */
479     bool beep_signal;           /* option "--beep" */
480     bool begin_set;             /* option "--begin y x" was used */
481     bool cant_kill;             /* option "--no-kill" */
482     bool colors;                /* option "--colors" */
483     bool cr_wrap;               /* option "--cr-wrap" */
484     bool defaultno;             /* option "--defaultno" */
485     bool dlg_clear_screen;      /* option "--clear" */
486     bool extra_button;          /* option "--extra-button" */
487     bool help_button;           /* option "--help-button" */
488     bool help_status;           /* option "--help-status" */
489     bool input_menu;            /* menu vs inputmenu widget */
490     bool insecure;              /* option "--insecure" */
491     bool item_help;             /* option "--item-help" */
492     bool keep_window;           /* option "--keep-window" */
493     bool nocancel;              /* option "--no-cancel" */
494     bool nocollapse;            /* option "--no-collapse" */
495     bool print_siz;             /* option "--print-size" */
496     bool separate_output;       /* option "--separate-output" */
497     bool single_quoted;         /* option "--single-quoted" */
498     bool size_err;              /* option "--size-err" */
499     bool tab_correct;           /* option "--tab-correct" */
500     bool trim_whitespace;       /* option "--trim" */
501     char *backtitle;            /* option "--backtitle backtitle" */
502     char *cancel_label;         /* option "--cancel-label string" */
503     char *default_item;         /* option "--default-item string" */
504     char *exit_label;           /* option "--exit-label string" */
505     char *extra_label;          /* option "--extra-label string" */
506     char *help_label;           /* option "--help-label string" */
507     char *input_result;
508     char *no_label;             /* option "--no-label string" */
509     char *ok_label;             /* option "--ok-label string" */
510     char *title;                /* option "--title title" */
511     char *yes_label;            /* option "--yes-label string" */
512     int begin_x;                /* option "--begin y x" (second value) */
513     int begin_y;                /* option "--begin y x" (first value) */
514     int max_input;              /* option "--max-input size" */
515     int scale_factor;           /* RESERVED */
516     int sleep_secs;             /* option "--sleep secs" */
517     int timeout_secs;           /* option "--timeout secs" */
518     unsigned input_length;      /* nonzero if input_result is allocated */
519     /* 1.0-20051207 */
520     unsigned formitem_type;     /* DIALOG_FORMITEM.type in dialog_form() */
521     /* 1.1-20070227 */
522     bool keep_tite;             /* option "--keep-tite" */
523     bool ascii_lines;           /* option "--ascii-lines" */
524     bool no_lines;              /* option "--no-lines" */
525     /* 1.1-20070930 */
526     bool nook;                  /* option "--no-ok" */
527     /* 1.1-20080727 */
528     bool quoted;                /* option "--quoted" */
529     char *column_header;        /* RESERVED "--column-header" */
530     char *column_separator;     /* option "--column-separator" */
531     char *output_separator;     /* option "--output-separator" */
532     /* 1.1-20100118 */
533     char *date_format;          /* option "--date-format" */
534     char *time_format;          /* option "--time-format" */
535     /* 1.1-20110629 */
536     char *help_line;            /* option "--hline" */
537     char *help_file;            /* option "--hfile" */
538     bool in_helpfile;           /* flag to prevent recursion in --hfile */
539     bool no_nl_expand;          /* option "--no-nl-expand" */
540     /* 1.1-20120701 */
541     int default_button;         /* option "--default-button" (exit code) */
542     /* 1.1-20121218 */
543     bool no_tags;               /* option "--no-tags" */
544     bool no_items;              /* option "--no-items" */
545     /* 1.2-20130315 */
546     bool last_key;              /* option "--last-key" */
547     /* 1.2-20130902 */
548     bool help_tags;             /* option "--help-tags" */
549     /* 1.3-20160126 */
550     char *week_start;           /* option "--week-start" */
551     /* 1.3-20160206 */
552     bool iso_week;              /* option "--iso-week" */
553     /* 1.3-20170131 */
554     bool reorder;               /* option "--reorder" */
555 } DIALOG_VARS;
556
557 #define USE_ITEM_HELP(s)        (dialog_vars.item_help && (s) != 0)
558
559 /*
560  * Some settings change the number of data items per row which dialog reads
561  * from a script.
562  */
563 #define DLG__NO_ITEMS           (dialog_vars.no_items ? 0 : 1)
564 #define DLG__ITEM_HELP          (dialog_vars.item_help ? 1 : 0)
565
566 /*
567  * These are the total number of data items per row used for each widget type.
568  */
569 #define CHECKBOX_TAGS           (2 + DLG__ITEM_HELP + DLG__NO_ITEMS)
570 #define MENUBOX_TAGS            (1 + DLG__ITEM_HELP + DLG__NO_ITEMS)
571 #define FORMBOX_TAGS            (8 + DLG__ITEM_HELP)
572 #define MIXEDFORM_TAGS          (1 + FORMBOX_TAGS)
573 #define MIXEDGAUGE_TAGS         2
574 #define TREEVIEW_TAGS           (3 + DLG__ITEM_HELP + DLG__NO_ITEMS)
575
576 extern DIALOG_VARS dialog_vars;
577
578 #ifndef HAVE_TYPE_CHTYPE
579 #define chtype long
580 #endif
581
582 #ifndef isblank
583 #define isblank(c)       ((c) == ' ' || (c) == TAB)
584 #endif
585
586 #define UCH(ch)                 ((unsigned char)(ch))
587
588 #define assert_ptr(ptr,msg) if ((ptr) == 0) dlg_exiterr("cannot allocate memory in " msg)
589
590 #define dlg_malloc(t,n)    (t *) malloc((size_t)(n) * sizeof(t))
591 #define dlg_calloc(t,n)    (t *) calloc((size_t)(n), sizeof(t))
592 #define dlg_realloc(t,n,p) (t *) realloc((p), (n) * sizeof(t))
593
594 /*
595  * Table for attribute- and color-values.
596  */
597 typedef struct {
598     chtype atr;
599 #ifdef HAVE_COLOR
600     int fg;
601     int bg;
602     int hilite;
603 #endif
604 #ifdef HAVE_RC_FILE
605     const char *name;
606     const char *comment;
607 #endif
608 } DIALOG_COLORS;
609
610 extern DIALOG_COLORS dlg_color_table[];
611
612 /*
613  * Function prototypes
614  */
615 extern const char *dialog_version(void);
616
617 /* widgets, each in separate files */
618 extern int dialog_buildlist(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*list_height*/, int /*item_no*/, char ** /*items*/, int /*order_mode*/);
619 extern int dialog_calendar(const char * /*title*/, const char * /*subtitle*/, int /*height*/, int /*width*/, int /*day*/, int /*month*/, int /*year*/);
620 extern int dialog_checklist(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*list_height*/, int /*item_no*/, char ** /*items*/, int /*flag*/);
621 extern int dialog_dselect(const char * /*title*/, const char * /*path*/, int /*height*/, int /*width*/);
622 extern int dialog_editbox(const char * /*title*/, const char * /*file*/, int /*height*/, int /*width*/);
623 extern int dialog_form(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*form_height*/, int /*item_no*/, char ** /*items*/);
624 extern int dialog_fselect(const char * /*title*/, const char * /*path*/, int /*height*/, int /*width*/);
625 extern int dialog_gauge(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*percent*/);
626 extern int dialog_helpfile(const char * /*title*/, const char * /*file*/, int /*height*/, int /*width*/);
627 extern int dialog_inputbox(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, const char * /*init*/, const int /*password*/);
628 extern int dialog_menu(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*menu_height*/, int /*item_no*/, char ** /*items*/);
629 extern int dialog_mixedform(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*form_height*/, int /*item_no*/, char ** /*items*/);
630 extern int dialog_mixedgauge(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*percent*/, int /*item_no*/, char ** /*items*/);
631 extern int dialog_msgbox(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*pauseopt*/);
632 extern int dialog_pause(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*seconds*/);
633 extern int dialog_prgbox(const char * /*title*/, const char * /*cprompt*/, const char * /*command*/, int /*height*/, int /*width*/, int /*pauseopt*/);
634 extern int dialog_progressbox(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/);
635 extern int dialog_rangebox(const char * /*title*/, const char * /*file*/, int /*height*/, int /*width*/, int /*min_value*/, int /*max_value*/, int /*default_value*/);
636 extern int dialog_tailbox(const char * /*title*/, const char * /*file*/, int /*height*/, int /*width*/, int /*bg_task*/);
637 extern int dialog_textbox(const char * /*title*/, const char * /*file*/, int /*height*/, int /*width*/);
638 extern int dialog_timebox(const char * /*title*/, const char * /*subtitle*/, int /*height*/, int /*width*/, int /*hour*/, int /*minute*/, int /*second*/);
639 extern int dialog_treeview(const char * /*title*/, const char * /*subtitle*/, int /*height*/, int /*width*/, int /*list_height*/, int /*item_no*/, char ** /*items*/, int /*flag*/);
640 extern int dialog_yesno(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/);
641
642 /* some widgets have alternate entrypoints, to allow list manipulation */
643 typedef struct {
644     char *name;
645     char *text;
646     char *help;
647     int state;
648 } DIALOG_LISTITEM;
649
650 typedef struct {
651     unsigned type;              /* the field type (0=input, 1=password) */
652     char *name;                 /* the field label */
653     int name_len;               /* ...its length */
654     int name_y;                 /* ...its y-ordinate */
655     int name_x;                 /* ...its x-ordinate */
656     bool name_free;             /* ...true if .name can be freed */
657     char *text;                 /* the field contents */
658     int text_len;               /* ...its length on the screen */
659     int text_y;                 /* ...its y-ordinate */
660     int text_x;                 /* ...its x-ordinate */
661     int text_flen;              /* ...its length on screen, or 0 if no input allowed */
662     int text_ilen;              /* ...its limit on amount to be entered */
663     bool text_free;             /* ...true if .text can be freed */
664     char *help;                 /* help-message, if any */
665     bool help_free;             /* ...true if .help can be freed */
666 } DIALOG_FORMITEM;
667
668 typedef int (DIALOG_INPUTMENU) (DIALOG_LISTITEM * /*items*/, int /*current*/, char * /*newtext*/);
669
670 extern int dlg_checklist(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*list_height*/, int /*item_no*/, DIALOG_LISTITEM * /*items*/, const char * /*states*/, int /*flag*/, int * /*current_item*/);
671 extern int dlg_form(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*form_height*/, int /*item_no*/, DIALOG_FORMITEM * /*items*/, int * /*current_item*/);
672 extern int dlg_menu(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*menu_height*/, int /*item_no*/, DIALOG_LISTITEM * /*items*/, int * /*current_item*/, DIALOG_INPUTMENU /*rename_menu*/);
673 extern int dlg_progressbox(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*pauseopt*/, FILE * /* fp */);
674
675 /* argv.c */
676 extern char ** dlg_string_to_argv(char * /* blob */);
677 extern int dlg_count_argv(char ** /* argv */);
678 extern int dlg_eat_argv(int * /* argcp */, char *** /* argvp */, int /* start */, int /* count */);
679
680 /* arrows.c */
681 extern void dlg_draw_arrows(WINDOW * /*dialog*/, int /*top_arrow*/, int /*bottom_arrow*/, int /*x*/, int /*top*/, int /*bottom*/);
682 extern void dlg_draw_arrows2(WINDOW * /*dialog*/, int /*top_arrow*/, int /*bottom_arrow*/, int /*x*/, int /*top*/, int /*bottom*/, chtype /*attr*/, chtype /*borderattr*/);
683 extern void dlg_draw_helpline(WINDOW * /*dialog*/, bool /*decorations*/);
684 extern void dlg_draw_scrollbar(WINDOW * /*dialog*/, long /* first_data */, long /* this_data */, long /* next_data */, long /* total_data */, int /* left */, int /* right */, int /*top*/, int /*bottom*/, chtype /*attr*/, chtype /*borderattr*/);
685
686 /* buildlist.c */
687 extern int dlg_buildlist(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*list_height*/, int /*item_no*/, DIALOG_LISTITEM * /*items*/, const char * /*states*/, int /*order_mode*/, int * /*current_item*/);
688
689 /* buttons.c */
690 extern const char ** dlg_exit_label(void);
691 extern const char ** dlg_ok_label(void);
692 extern const char ** dlg_ok_labels(void);
693 extern const char ** dlg_yes_labels(void);
694 extern int dlg_button_count(const char ** /*labels*/);
695 extern int dlg_button_to_char(const char * /*label*/);
696 extern int dlg_button_x_step(const char ** /*labels*/, int /*limit*/, int * /*gap*/, int * /*margin*/, int * /*step*/);
697 extern int dlg_char_to_button(int /*ch*/, const char ** /*labels*/);
698 extern int dlg_exit_buttoncode(int /*button*/);
699 extern int dlg_match_char(int /*ch*/, const char * /*string*/);
700 extern int dlg_next_button(const char ** /*labels*/, int /*button*/);
701 extern int dlg_next_ok_buttonindex(int /*current*/, int /*extra*/);
702 extern int dlg_ok_buttoncode(int /*button*/);
703 extern int dlg_prev_button(const char ** /*labels*/, int /*button*/);
704 extern int dlg_prev_ok_buttonindex(int /*current*/, int /*extra*/);
705 extern int dlg_yes_buttoncode(int /*button*/);
706 extern void dlg_button_layout(const char ** /*labels*/, int * /*limit*/);
707 extern void dlg_button_sizes(const char ** /*labels*/, int /*vertical*/, int * /*longest*/, int * /*length*/);
708 extern void dlg_draw_buttons(WINDOW * /*win*/, int /*y*/, int /*x*/, const char ** /*labels*/, int /*selected*/, int /*vertical*/, int /*limit*/);
709
710 /* columns.c */
711 extern void dlg_align_columns(char ** /* target */, int  /* per_row */, int /* num_rows */);
712 extern void dlg_free_columns(char ** /* target */, int  /* per_row */, int /* num_rows */);
713
714 /* editbox.c */
715 extern int dlg_editbox(const char * /*title*/, char *** /*list*/, int * /*rows*/, int /*height*/, int /*width*/);
716
717 /* formbox.c */
718 extern int dlg_default_formitem(DIALOG_FORMITEM * /*items*/);
719 extern int dlg_ordinate(const char * /*s*/);
720 extern void dlg_free_formitems(DIALOG_FORMITEM * /*items*/);
721
722 /* guage.c */
723 extern void * dlg_allocate_gauge(const char * /* title */, const char * /* cprompt */, int /* height */, int /* width */, int /* percent */);
724 extern void * dlg_reallocate_gauge(void * /* objptr */, const char * /* title */, const char * /* cprompt */, int /* height */, int /* width */, int /* percent */);
725 extern void dlg_free_gauge(void * /* objptr */);
726 extern void dlg_update_gauge(void * /* objptr */, int /* percent */);
727
728 /* inputstr.c */
729 extern bool dlg_edit_string(char * /*string*/, int * /*offset*/, int /*key*/, int /*fkey*/, bool /*force*/);
730 extern const int * dlg_index_columns(const char * /*string*/);
731 extern const int * dlg_index_wchars(const char * /*string*/);
732 extern int dlg_count_columns(const char * /*string*/);
733 extern int dlg_count_wchars(const char * /*string*/);
734 extern int dlg_edit_offset(char * /*string*/, int /*offset*/, int /*x_last*/);
735 extern int dlg_find_index(const int * /*list*/, int  /*limit*/, int /*to_find*/);
736 extern int dlg_limit_columns(const char * /*string*/, int /*limit*/, int /*offset*/);
737 extern void dlg_finish_string(const char * /* string */);
738 extern void dlg_show_string(WINDOW * /*win*/, const char * /*string*/, int /*offset*/, chtype /*attr*/, int /*y_base*/, int /*x_base*/, int /*x_last*/, bool /*hidden*/, bool /*force*/);
739
740 /* menubox.c */
741 extern int dlg_dummy_menutext(DIALOG_LISTITEM * /*items*/, int /*current*/, char * /*newtext*/);
742 extern int dlg_renamed_menutext(DIALOG_LISTITEM * /*items*/, int /*current*/, char * /*newtext*/);
743
744 /* prgbox.c */
745 extern FILE * dlg_popen(const char * /*command */, const char * /*type */);
746
747 /* rc.c */
748 #ifdef HAVE_RC_FILE
749 extern int dlg_parse_rc(void);
750 extern void dlg_create_rc(const char * /*filename*/);
751 #endif
752
753 /* treeview.c */
754 extern int dlg_treeview(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*list_height*/, int /*item_no*/, DIALOG_LISTITEM * /*items*/, const char * /*states*/, int * /*depths*/, int /*flag*/, int * /*current_item*/);
755
756 /* ttysize.c */
757 extern int dlg_ttysize(int /* fd */, int * /* height */, int * /* width */);
758
759 /* ui_getc.c */
760 extern int dlg_getc(WINDOW * /*win*/, int * /*fkey*/);
761 extern int dlg_getc_callbacks(int /*ch*/, int /*fkey*/, int * /*result*/);
762 extern int dlg_last_getc(void);
763 extern void dlg_add_last_key(int /*mode*/);
764 extern void dlg_add_callback(DIALOG_CALLBACK * /*p*/);
765 extern void dlg_add_callback_ref(DIALOG_CALLBACK ** /*p*/, DIALOG_FREEBACK /* cleanup */);
766 extern void dlg_flush_getc(void);
767 extern void dlg_remove_callback(DIALOG_CALLBACK * /*p*/);
768 extern void dlg_killall_bg(int *retval);
769
770 /* util.c */
771 extern WINDOW * dlg_new_modal_window(WINDOW * /*parent*/, int /*height*/, int /*width*/, int /*y*/, int /*x*/);
772 extern WINDOW * dlg_new_window(int /*height*/, int /*width*/, int /*y*/, int /*x*/);
773 extern WINDOW * dlg_sub_window(WINDOW * /*win*/, int /*height*/, int /*width*/, int /*y*/, int /*x*/);
774 extern bool dlg_need_separator(void);
775 extern char * dlg_set_result(const char * /*string*/);
776 extern char * dlg_strclone(const char * /*cprompt*/);
777 extern char * dlg_strempty(void);
778 extern chtype dlg_asciibox(chtype /*ch*/);
779 extern chtype dlg_boxchar(chtype /*ch*/);
780 extern chtype dlg_get_attrs(WINDOW * /*win*/);
781 extern const char * dlg_print_line(WINDOW * /*win*/, chtype * /*attr*/, const char * /*prompt*/, int /*lm*/, int /*rm*/, int * /*x*/);
782 extern int dlg_box_x_ordinate(int /*width*/);
783 extern int dlg_box_y_ordinate(int /*height*/);
784 extern int dlg_calc_list_width(int /*item_no*/, DIALOG_LISTITEM * /*items*/);
785 extern int dlg_calc_listw(int /*item_no*/, char ** /*items*/, int /*group*/);
786 extern int dlg_check_scrolled(int /* key */, int /* last */, int /* page */, bool * /* show */, int * /* offset */);
787 extern int dlg_count_real_columns(const char * /*text*/);
788 extern int dlg_default_item(char ** /*items*/, int /*llen*/);
789 extern int dlg_default_listitem(DIALOG_LISTITEM * /*items*/);
790 extern int dlg_defaultno_button(void);
791 extern int dlg_default_button(void);
792 extern int dlg_max_input(int /*max_len*/);
793 extern int dlg_print_scrolled(WINDOW * /* win */, const char * /* prompt */, int /* offset */, int /* height */, int /* width */, int /* pauseopt */);
794 extern void dlg_add_help_formitem(int * /* result */, char ** /* tag */, DIALOG_FORMITEM * /* item */);
795 extern void dlg_add_help_listitem(int * /* result */, char ** /* tag */, DIALOG_LISTITEM * /* item */);
796 extern void dlg_add_quoted(char * /*string*/);
797 extern void dlg_add_result(const char * /*string*/);
798 extern void dlg_add_separator(void);
799 extern void dlg_add_string(char * /*string*/);
800 extern void dlg_attr_clear(WINDOW * /*win*/, int /*height*/, int /*width*/, chtype /*attr*/);
801 extern void dlg_auto_size(const char * /*title*/, const char * /*prompt*/, int * /*height*/, int * /*width*/, int /*boxlines*/, int /*mincols*/);
802 extern void dlg_auto_sizefile(const char * /*title*/, const char * /*file*/, int * /*height*/, int * /*width*/, int /*boxlines*/, int /*mincols*/);
803 extern void dlg_beeping(void);
804 extern void dlg_calc_listh(int * /*height*/, int * /*list_height*/, int /*item_no*/);
805 extern void dlg_clear(void);
806 extern void dlg_clr_result(void);
807 extern void dlg_ctl_size(int /*height*/, int /*width*/);
808 extern void dlg_del_window(WINDOW * /*win*/);
809 extern void dlg_does_output(void);
810 extern void dlg_draw_bottom_box(WINDOW * /*win*/);
811 extern void dlg_draw_bottom_box2(WINDOW * /*win*/, chtype /*on_left*/, chtype /*on_right*/, chtype /*on_inside*/);
812 extern void dlg_draw_box(WINDOW * /*win*/, int /*y*/, int /*x*/, int /*height*/, int /*width*/, chtype /*boxchar*/, chtype /*borderchar*/);
813 extern void dlg_draw_box2(WINDOW * /*win*/, int /*y*/, int /*x*/, int /*height*/, int /*width*/, chtype /*boxchar*/, chtype /*borderchar*/, chtype /*borderchar2*/);
814 extern void dlg_draw_title(WINDOW *win, const char *title);
815 extern void dlg_exit(int /*code*/) GCC_NORETURN;
816 extern void dlg_item_help(const char * /*txt*/);
817 extern void dlg_print_autowrap(WINDOW * /*win*/, const char * /*prompt*/, int /*height*/, int /*width*/);
818 extern void dlg_print_listitem(WINDOW * /*win*/, const char * /*text*/, int /*climit*/, bool /*first*/, int /*selected*/);
819 extern void dlg_print_size(int /*height*/, int /*width*/);
820 extern void dlg_print_text(WINDOW * /*win*/, const char * /*txt*/, int /*len*/, chtype * /*attr*/);
821 extern void dlg_put_backtitle(void);
822 extern void dlg_restore_vars(DIALOG_VARS * /* save */);
823 extern void dlg_save_vars(DIALOG_VARS * /* save */);
824 extern void dlg_set_focus(WINDOW * /*parent*/, WINDOW * /*win*/);
825 extern void dlg_tab_correct_str(char * /*prompt*/);
826 extern void dlg_trim_string(char * /*src*/);
827 extern void end_dialog(void);
828 extern void init_dialog(FILE * /*input*/, FILE * /*output*/);
829
830 extern void dlg_exiterr(const char *, ...) GCC_NORETURN GCC_PRINTFLIKE(1,2);
831
832 #ifdef HAVE_COLOR
833 extern chtype dlg_color_pair(int /*foreground*/, int /*background*/);
834 extern int dlg_color_count(void);
835 extern void dlg_color_setup(void);
836 extern void dlg_draw_shadow(WINDOW * /*win*/, int /*height*/, int /*width*/, int /*y*/, int /*x*/);
837 #endif
838
839 #ifdef HAVE_STRCASECMP
840 #define dlg_strcmp(a,b) strcasecmp(a,b)
841 #else
842 extern int dlg_strcmp(const char * /*a*/, const char * /*b*/);
843 #endif
844
845 #ifdef HAVE_DLG_TRACE
846 #define DLG_TRACE(params) dlg_trace_msg params
847 extern void dlg_trace_msg(const char *fmt, ...) GCC_PRINTFLIKE(1,2);
848 #define DLG_TRACE2S(name,value) dlg_trace_2s (name,value)
849 #define DLG_TRACE2N(name,value) dlg_trace_2n (name,value)
850 extern void dlg_trace_2s(const char * /*name*/, const char * /*value*/);
851 extern void dlg_trace_2n(const char * /*name*/, int /*value*/);
852 extern void dlg_trace_win(WINDOW * /*win*/);
853 extern void dlg_trace_chr(int /*ch*/, int /*fkey*/);
854 extern void dlg_trace(const char * /*fname*/);
855 #else
856 #define DLG_TRACE(params) /* nothing */
857 #define DLG_TRACE2S(name,value) /* nothing */
858 #define DLG_TRACE2N(name,value) /* nothing */
859 #define dlg_trace_win(win) /* nothing */
860 #define dlg_trace_chr(ch,fkey) /* nothing */
861 #define dlg_trace(fname) /* nothing */
862 #endif
863
864 #ifdef KEY_RESIZE
865 extern void dlg_move_window(WINDOW * /*win*/, int /*height*/, int /*width*/, int /*y*/, int /*x*/);
866 extern void dlg_will_resize(WINDOW * /*win*/);
867 #endif
868
869 /*
870  * Normally "enter" means "ok".  Use this macro to handle the explicit
871  * check for DLGK_ENTER:
872  */
873 #define dlg_enter_buttoncode(code) (dialog_vars.nook ? DLG_EXIT_OK : dlg_ok_buttoncode(code))
874
875 /*
876  * The following stuff is needed for mouse support
877  */
878 typedef struct mseRegion {
879     int x, y, X, Y, code;
880     int mode, step_x, step_y;
881     struct mseRegion *next;
882 } mseRegion;
883
884 #if defined(NCURSES_MOUSE_VERSION)
885
886 #define mouse_open() mousemask(BUTTON1_PRESSED, (mmask_t *) 0)
887 #define mouse_close() mousemask(0, (mmask_t *) 0)
888
889 extern mseRegion * dlg_mouse_mkregion (int /*y*/, int /*x*/, int /*height*/, int /*width*/, int /*code*/);
890 extern void dlg_mouse_free_regions (void);
891 extern void dlg_mouse_mkbigregion (int /*y*/, int /*x*/, int /*height*/, int /*width*/, int /*code*/, int /*step_x*/, int /*step_y*/, int /*mode*/);
892 extern void dlg_mouse_setbase (int /*x*/, int /*y*/);
893 extern void dlg_mouse_setcode (int /*code*/);
894
895 #define USE_MOUSE 1
896
897 #else
898
899 #define mouse_open() /*nothing*/
900 #define mouse_close() /*nothing*/
901 #define dlg_mouse_free_regions() /* nothing */
902 #define dlg_mouse_mkregion(y, x, height, width, code) /*nothing*/
903 #define dlg_mouse_mkbigregion(y, x, height, width, code, step_x, step_y, mode) /*nothing*/
904 #define dlg_mouse_setbase(x, y) /*nothing*/
905 #define dlg_mouse_setcode(c) /*nothing*/
906
907 #define USE_MOUSE 0
908
909 #endif
910
911 extern mseRegion *dlg_mouse_region (int /*y*/, int /*x*/);
912 extern mseRegion *dlg_mouse_bigregion (int /*y*/, int /*x*/);
913 extern int dlg_mouse_wgetch (WINDOW * /*win*/, int * /*fkey*/);
914 extern int dlg_mouse_wgetch_nowait (WINDOW * /*win*/, int * /*fkey*/);
915
916 #define mouse_mkbutton(y,x,len,code) dlg_mouse_mkregion(y,x,1,len,code);
917
918 /*
919  * This is the base for fictitious keys, which activate
920  * the buttons.
921  *
922  * Mouse-generated keys are the following:
923  *   -- the first 32 are used as numbers, in addition to '0'-'9'
924  *   -- uppercase chars are used to invoke the button (M_EVENT + 'O')
925  */
926 #define M_EVENT (DLGK_max + 1)
927
928 /*
929  * The `flag' parameter in checklist is used to select between
930  * radiolist and checklist
931  */
932 #define FLAG_CHECK 1
933 #define FLAG_RADIO 0
934
935 /*
936  * This is used only for debugging (FIXME: should have a separate header).
937  */
938 #ifdef NO_LEAKS
939 extern void _dlg_inputstr_leaks(void);
940 #if defined(NCURSES_VERSION) && defined(HAVE__NC_FREE_AND_EXIT)
941 extern void _nc_free_and_exit(int);     /* nc_alloc.h normally not installed */
942 #endif
943 #endif
944
945 #ifdef __cplusplus
946 }
947 #endif
948 /* *INDENT-ON* */
949
950 #endif /* DIALOG_H_included */