xref: /minix3/usr.bin/menuc/mdb.h (revision 525a267e81017258ec78fc0d6187a56590d0989d)
1*525a267eSThomas Cort /*	$NetBSD: mdb.h,v 1.9 2012/03/06 16:55:18 mbalmer Exp $	*/
2*525a267eSThomas Cort 
3*525a267eSThomas Cort /*
4*525a267eSThomas Cort  * Copyright 1997 Piermont Information Systems Inc.
5*525a267eSThomas Cort  * All rights reserved.
6*525a267eSThomas Cort  *
7*525a267eSThomas Cort  * Written by Philip A. Nelson for Piermont Information Systems Inc.
8*525a267eSThomas Cort  *
9*525a267eSThomas Cort  * Redistribution and use in source and binary forms, with or without
10*525a267eSThomas Cort  * modification, are permitted provided that the following conditions
11*525a267eSThomas Cort  * are met:
12*525a267eSThomas Cort  * 1. Redistributions of source code must retain the above copyright
13*525a267eSThomas Cort  *    notice, this list of conditions and the following disclaimer.
14*525a267eSThomas Cort  * 2. Redistributions in binary form must reproduce the above copyright
15*525a267eSThomas Cort  *    notice, this list of conditions and the following disclaimer in the
16*525a267eSThomas Cort  *    documentation and/or other materials provided with the distribution.
17*525a267eSThomas Cort  * 3. The name of Piermont Information Systems Inc. may not be used to endorse
18*525a267eSThomas Cort  *    or promote products derived from this software without specific prior
19*525a267eSThomas Cort  *    written permission.
20*525a267eSThomas Cort  *
21*525a267eSThomas Cort  * THIS SOFTWARE IS PROVIDED BY PIERMONT INFORMATION SYSTEMS INC. ``AS IS''
22*525a267eSThomas Cort  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23*525a267eSThomas Cort  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24*525a267eSThomas Cort  * ARE DISCLAIMED. IN NO EVENT SHALL PIERMONT INFORMATION SYSTEMS INC. BE
25*525a267eSThomas Cort  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26*525a267eSThomas Cort  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27*525a267eSThomas Cort  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28*525a267eSThomas Cort  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29*525a267eSThomas Cort  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30*525a267eSThomas Cort  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31*525a267eSThomas Cort  * THE POSSIBILITY OF SUCH DAMAGE.
32*525a267eSThomas Cort  *
33*525a267eSThomas Cort  */
34*525a267eSThomas Cort 
35*525a267eSThomas Cort /* mdb.h - definitions for the menu database. */
36*525a267eSThomas Cort 
37*525a267eSThomas Cort #ifndef MDB_H
38*525a267eSThomas Cort #define MDB_H
39*525a267eSThomas Cort 
40*525a267eSThomas Cort /* forward declaration */
41*525a267eSThomas Cort typedef struct menu_info menu_info;
42*525a267eSThomas Cort 
43*525a267eSThomas Cort /* The declarations for the balanced binary trees. */
44*525a267eSThomas Cort 
45*525a267eSThomas Cort typedef struct id_rec {
46*525a267eSThomas Cort 	/* The balanced binary tree fields. */
47*525a267eSThomas Cort 	char  *id;      /* The name. */
48*525a267eSThomas Cort 	short balance;  /* For the balanced tree. */
49*525a267eSThomas Cort 	struct id_rec *left, *right; /* Tree pointers. */
50*525a267eSThomas Cort 
51*525a267eSThomas Cort 	/* Other information fields. */
52*525a267eSThomas Cort 	menu_info *info;
53*525a267eSThomas Cort 	int menu_no;
54*525a267eSThomas Cort } id_rec;
55*525a267eSThomas Cort 
56*525a267eSThomas Cort 
57*525a267eSThomas Cort /* menu definitions records. */
58*525a267eSThomas Cort 
59*525a267eSThomas Cort typedef struct action {
60*525a267eSThomas Cort 	char *code;
61*525a267eSThomas Cort 	int   endwin;
62*525a267eSThomas Cort } action;
63*525a267eSThomas Cort 
64*525a267eSThomas Cort typedef struct optn_info {
65*525a267eSThomas Cort 	char *name;
66*525a267eSThomas Cort 	int   name_is_code;
67*525a267eSThomas Cort 	int   menu;
68*525a267eSThomas Cort 	int   issub;
69*525a267eSThomas Cort 	int   doexit;
70*525a267eSThomas Cort 	action optact;
71*525a267eSThomas Cort 	struct optn_info *next;
72*525a267eSThomas Cort } optn_info;
73*525a267eSThomas Cort 
74*525a267eSThomas Cort struct menu_info {
75*525a267eSThomas Cort 	char *title;
76*525a267eSThomas Cort 	char *helpstr;
77*525a267eSThomas Cort 	char *exitstr;
78*525a267eSThomas Cort 	int mopt;
79*525a267eSThomas Cort 	int y, x;
80*525a267eSThomas Cort 	int h, w;
81*525a267eSThomas Cort 	int numopt;
82*525a267eSThomas Cort 	int name_is_code;
83*525a267eSThomas Cort 	optn_info *optns;
84*525a267eSThomas Cort 	action postact;
85*525a267eSThomas Cort 	action exitact;
86*525a267eSThomas Cort };
87*525a267eSThomas Cort 
88*525a267eSThomas Cort /* defines for mopt */
89*525a267eSThomas Cort #define MC_NOEXITOPT 1
90*525a267eSThomas Cort #define MC_NOBOX 2
91*525a267eSThomas Cort #define MC_SCROLL 4
92*525a267eSThomas Cort #define MC_NOSHORTCUT 8
93*525a267eSThomas Cort #define MC_NOCLEAR 16
94*525a267eSThomas Cort #define MC_DFLTEXIT 32
95*525a267eSThomas Cort #define MC_ALWAYS_SCROLL 64
96*525a267eSThomas Cort #define MC_SUBMENU 128
97*525a267eSThomas Cort #define MC_VALID 0x10000
98*525a267eSThomas Cort #endif
99