xref: /openbsd-src/lib/libform/form.h (revision c7ef0cfc17afcba97172c25e1e3a943e893bc632)
1*c7ef0cfcSnicm /*	$OpenBSD: form.h,v 1.9 2023/10/17 09:52:10 nicm Exp $	*/
202f2426aSmillert /****************************************************************************
3*c7ef0cfcSnicm  * Copyright 2018-2019-2020,2021 Thomas E. Dickey                           *
4*c7ef0cfcSnicm  * Copyright 1998-2016,2017 Free Software Foundation, Inc.                  *
502f2426aSmillert  *                                                                          *
602f2426aSmillert  * Permission is hereby granted, free of charge, to any person obtaining a  *
702f2426aSmillert  * copy of this software and associated documentation files (the            *
802f2426aSmillert  * "Software"), to deal in the Software without restriction, including      *
902f2426aSmillert  * without limitation the rights to use, copy, modify, merge, publish,      *
1002f2426aSmillert  * distribute, distribute with modifications, sublicense, and/or sell       *
1102f2426aSmillert  * copies of the Software, and to permit persons to whom the Software is    *
1202f2426aSmillert  * furnished to do so, subject to the following conditions:                 *
1302f2426aSmillert  *                                                                          *
1402f2426aSmillert  * The above copyright notice and this permission notice shall be included  *
1502f2426aSmillert  * in all copies or substantial portions of the Software.                   *
1602f2426aSmillert  *                                                                          *
1702f2426aSmillert  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
1802f2426aSmillert  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
1902f2426aSmillert  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
2002f2426aSmillert  * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
2102f2426aSmillert  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
2202f2426aSmillert  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
2302f2426aSmillert  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
2402f2426aSmillert  *                                                                          *
2502f2426aSmillert  * Except as contained in this notice, the name(s) of the above copyright   *
2602f2426aSmillert  * holders shall not be used in advertising or otherwise to promote the     *
2702f2426aSmillert  * sale, use or other dealings in this Software without prior written       *
2802f2426aSmillert  * authorization.                                                           *
2902f2426aSmillert  ****************************************************************************/
3002f2426aSmillert 
3102f2426aSmillert /****************************************************************************
3281d8c4e1Snicm  *   Author:  Juergen Pfeifer, 1995,1997                                    *
3302f2426aSmillert  ****************************************************************************/
34ae611fdaStholo 
35*c7ef0cfcSnicm /* $Id: form.h,v 1.9 2023/10/17 09:52:10 nicm Exp $ */
3681d8c4e1Snicm 
37ae611fdaStholo #ifndef FORM_H
38ae611fdaStholo #define FORM_H
39*c7ef0cfcSnicm /* *INDENT-OFF*/
40ae611fdaStholo 
41ae611fdaStholo #include <curses.h>
42ae611fdaStholo #include <eti.h>
43ae611fdaStholo 
44ae611fdaStholo #ifdef __cplusplus
45ae611fdaStholo   extern "C" {
46ae611fdaStholo #endif
47ae611fdaStholo 
48*c7ef0cfcSnicm #if defined(BUILDING_FORM)
49*c7ef0cfcSnicm # define FORM_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT
50*c7ef0cfcSnicm #else
51*c7ef0cfcSnicm # define FORM_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT
52*c7ef0cfcSnicm #endif
53*c7ef0cfcSnicm 
54*c7ef0cfcSnicm #define FORM_WRAPPED_VAR(type,name) extern FORM_IMPEXP type NCURSES_PUBLIC_VAR(name)(void)
55*c7ef0cfcSnicm 
56*c7ef0cfcSnicm #define FORM_EXPORT(type) FORM_IMPEXP type NCURSES_API
57*c7ef0cfcSnicm #define FORM_EXPORT_VAR(type) FORM_IMPEXP type
58*c7ef0cfcSnicm 
5981d8c4e1Snicm #ifndef FORM_PRIV_H
6081d8c4e1Snicm typedef void *FIELD_CELL;
6181d8c4e1Snicm #endif
6281d8c4e1Snicm 
6381d8c4e1Snicm #ifndef NCURSES_FIELD_INTERNALS
6481d8c4e1Snicm #define NCURSES_FIELD_INTERNALS /* nothing */
6581d8c4e1Snicm #endif
6681d8c4e1Snicm 
67ae611fdaStholo typedef int Form_Options;
68ae611fdaStholo typedef int Field_Options;
69ae611fdaStholo 
70ae611fdaStholo 	/**********
71ae611fdaStholo 	*  _PAGE  *
72ae611fdaStholo 	**********/
73ae611fdaStholo 
74*c7ef0cfcSnicm typedef struct pagenode
75*c7ef0cfcSnicm #if !NCURSES_OPAQUE_FORM
76*c7ef0cfcSnicm {
77ae611fdaStholo   short pmin;		/* index of first field on page			*/
78ae611fdaStholo   short pmax;		/* index of last field on page			*/
79ae611fdaStholo   short smin;		/* index of top leftmost field on page		*/
80ae611fdaStholo   short smax;		/* index of bottom rightmost field on page	*/
81*c7ef0cfcSnicm }
82*c7ef0cfcSnicm #endif /* !NCURSES_OPAQUE_FORM */
83*c7ef0cfcSnicm _PAGE;
84ae611fdaStholo 
85ae611fdaStholo 	/**********
86ae611fdaStholo 	*  FIELD  *
87ae611fdaStholo 	**********/
88ae611fdaStholo 
89*c7ef0cfcSnicm typedef struct fieldnode
90*c7ef0cfcSnicm #if 1			/* not yet: !NCURSES_OPAQUE_FORM */
91*c7ef0cfcSnicm {
92ae611fdaStholo   unsigned short	status;		/* flags			*/
93ae611fdaStholo   short			rows;		/* size in rows			*/
94ae611fdaStholo   short			cols;		/* size in cols			*/
95ae611fdaStholo   short			frow;		/* first row			*/
96ae611fdaStholo   short			fcol;		/* first col			*/
97ae611fdaStholo   int			drows;		/* dynamic rows			*/
98ae611fdaStholo   int			dcols;		/* dynamic cols			*/
99ae611fdaStholo   int			maxgrow;	/* maximum field growth		*/
10081d8c4e1Snicm   int			nrow;		/* off-screen rows		*/
101ae611fdaStholo   short			nbuf;		/* additional buffers		*/
102ae611fdaStholo   short			just;		/* justification		*/
103ae611fdaStholo   short			page;		/* page on form			*/
104ae611fdaStholo   short			index;		/* into form -> field		*/
105ae611fdaStholo   int			pad;		/* pad character		*/
106ae611fdaStholo   chtype		fore;		/* foreground attribute		*/
107ae611fdaStholo   chtype		back;		/* background attribute		*/
108ae611fdaStholo   Field_Options		opts;		/* options			*/
109ae611fdaStholo   struct fieldnode *	snext;		/* sorted order pointer		*/
110ae611fdaStholo   struct fieldnode *	sprev;		/* sorted order pointer		*/
111ae611fdaStholo   struct fieldnode *	link;		/* linked field chain		*/
112ae611fdaStholo   struct formnode *	form;		/* containing form		*/
113ae611fdaStholo   struct typenode *	type;		/* field type			*/
114ae611fdaStholo   void *		arg;		/* argument for type		*/
11581d8c4e1Snicm   FIELD_CELL *		buf;		/* field buffers		*/
1168d0fca71Smillert   void *		usrptr;		/* user pointer			*/
11781d8c4e1Snicm   /*
11881d8c4e1Snicm    * The wide-character configuration requires extra information.  Because
11981d8c4e1Snicm    * there are existing applications that manipulate the members of FIELD
120*c7ef0cfcSnicm    * directly, we cannot make the struct opaque, except by changing the ABI.
121*c7ef0cfcSnicm    * Offsets of members up to this point are the same in the narrow- and
122*c7ef0cfcSnicm    * wide-character configuration.  But note that the type of buf depends on
123*c7ef0cfcSnicm    * the configuration, and is made opaque for that reason.
12481d8c4e1Snicm    */
12581d8c4e1Snicm   NCURSES_FIELD_INTERNALS
126*c7ef0cfcSnicm }
127*c7ef0cfcSnicm #endif /* NCURSES_OPAQUE_FORM */
128*c7ef0cfcSnicm FIELD;
129ae611fdaStholo 
130ae611fdaStholo 
131ae611fdaStholo 	/*********
132ae611fdaStholo 	*  FORM  *
133ae611fdaStholo 	*********/
134ae611fdaStholo 
135*c7ef0cfcSnicm typedef struct formnode
136*c7ef0cfcSnicm #if 1			/* not yet: !NCURSES_OPAQUE_FORM */
137*c7ef0cfcSnicm {
138ae611fdaStholo   unsigned short	status;	  	/* flags			*/
139ae611fdaStholo   short			rows;		/* size in rows			*/
140ae611fdaStholo   short			cols;		/* size in cols			*/
141ae611fdaStholo   int			currow;		/* current row in field window	*/
142ae611fdaStholo   int			curcol;		/* current col in field window	*/
143ae611fdaStholo   int			toprow;		/* in scrollable field window	*/
144ae611fdaStholo   int			begincol;	/* in horiz. scrollable field	*/
145ae611fdaStholo   short			maxfield;	/* number of fields		*/
146ae611fdaStholo   short			maxpage;	/* number of pages		*/
147ae611fdaStholo   short			curpage;	/* index into page		*/
148ae611fdaStholo   Form_Options		opts;		/* options			*/
149ae611fdaStholo   WINDOW *		win;		/* window			*/
150ae611fdaStholo   WINDOW *		sub;		/* subwindow			*/
151ae611fdaStholo   WINDOW *		w;		/* window for current field	*/
152ae611fdaStholo   FIELD **		field;		/* field [maxfield]		*/
153ae611fdaStholo   FIELD *		current;	/* current field		*/
154ae611fdaStholo   _PAGE *		page;		/* page [maxpage]		*/
1558d0fca71Smillert   void *		usrptr;		/* user pointer			*/
156ae611fdaStholo 
157ae611fdaStholo   void			(*forminit)(struct formnode *);
158ae611fdaStholo   void			(*formterm)(struct formnode *);
159ae611fdaStholo   void			(*fieldinit)(struct formnode *);
160ae611fdaStholo   void			(*fieldterm)(struct formnode *);
161ae611fdaStholo 
162*c7ef0cfcSnicm }
163*c7ef0cfcSnicm #endif /* !NCURSES_OPAQUE_FORM */
164*c7ef0cfcSnicm FORM;
165*c7ef0cfcSnicm 
166*c7ef0cfcSnicm 
167*c7ef0cfcSnicm 	/**************
168*c7ef0cfcSnicm 	*  FIELDTYPE  *
169*c7ef0cfcSnicm 	**************/
170*c7ef0cfcSnicm 
171*c7ef0cfcSnicm typedef struct typenode
172*c7ef0cfcSnicm #if !NCURSES_OPAQUE_FORM
173*c7ef0cfcSnicm {
174*c7ef0cfcSnicm   unsigned short	status;			/* flags		    */
175*c7ef0cfcSnicm   long			ref;			/* reference count	    */
176*c7ef0cfcSnicm   struct typenode *	left;			/* ptr to operand for |     */
177*c7ef0cfcSnicm   struct typenode *	right;			/* ptr to operand for |     */
178*c7ef0cfcSnicm 
179*c7ef0cfcSnicm   void* (*makearg)(va_list *);			/* make fieldtype arg	    */
180*c7ef0cfcSnicm   void* (*copyarg)(const void *);		/* copy fieldtype arg 	    */
181*c7ef0cfcSnicm   void	(*freearg)(void *);			/* free fieldtype arg	    */
182*c7ef0cfcSnicm 
183*c7ef0cfcSnicm #if NCURSES_INTEROP_FUNCS
184*c7ef0cfcSnicm   union {
185*c7ef0cfcSnicm     bool (*ofcheck)(FIELD *,const void *);	/* field validation	    */
186*c7ef0cfcSnicm     bool (*gfcheck)(FORM*,FIELD *,const void*);	/* generic field validation */
187*c7ef0cfcSnicm   } fieldcheck;
188*c7ef0cfcSnicm   union {
189*c7ef0cfcSnicm     bool (*occheck)(int,const void *);		/* character validation     */
190*c7ef0cfcSnicm     bool (*gccheck)(int,FORM*,
191*c7ef0cfcSnicm 		    FIELD*,const void*);        /* generic char validation  */
192*c7ef0cfcSnicm   } charcheck;
193*c7ef0cfcSnicm   union {
194*c7ef0cfcSnicm     bool (*onext)(FIELD *,const void *);        /* enumerate next value     */
195*c7ef0cfcSnicm     bool (*gnext)(FORM*,FIELD*,const void*);    /* generic enumerate next   */
196*c7ef0cfcSnicm   } enum_next;
197*c7ef0cfcSnicm   union {
198*c7ef0cfcSnicm     bool (*oprev)(FIELD *,const void *);	/* enumerate prev value     */
199*c7ef0cfcSnicm     bool (*gprev)(FORM*,FIELD*,const void*);    /* generic enumerate prev   */
200*c7ef0cfcSnicm   } enum_prev;
201*c7ef0cfcSnicm   void* (*genericarg)(void*);                   /* Alternate Arg method     */
202*c7ef0cfcSnicm #else
203*c7ef0cfcSnicm   bool	(*fcheck)(FIELD *,const void *);	/* field validation	*/
204*c7ef0cfcSnicm   bool	(*ccheck)(int,const void *);		/* character validation */
205*c7ef0cfcSnicm 
206*c7ef0cfcSnicm   bool	(*next)(FIELD *,const void *);		/* enumerate next value */
207*c7ef0cfcSnicm   bool	(*prev)(FIELD *,const void *);		/* enumerate prev value */
208*c7ef0cfcSnicm #endif
209*c7ef0cfcSnicm }
210*c7ef0cfcSnicm #endif /* !NCURSES_OPAQUE_FORM */
211*c7ef0cfcSnicm FIELDTYPE;
212ae611fdaStholo 
213ae611fdaStholo typedef void (*Form_Hook)(FORM *);
214ae611fdaStholo 
215ae611fdaStholo 	/***************************
216ae611fdaStholo 	*  miscellaneous #defines  *
217ae611fdaStholo 	***************************/
218ae611fdaStholo 
219ae611fdaStholo /* field justification */
220ae611fdaStholo #define NO_JUSTIFICATION	(0)
221ae611fdaStholo #define JUSTIFY_LEFT		(1)
222ae611fdaStholo #define JUSTIFY_CENTER		(2)
223ae611fdaStholo #define JUSTIFY_RIGHT		(3)
224ae611fdaStholo 
225ae611fdaStholo /* field options */
22681d8c4e1Snicm #define O_VISIBLE		(0x0001U)
22781d8c4e1Snicm #define O_ACTIVE		(0x0002U)
22881d8c4e1Snicm #define O_PUBLIC		(0x0004U)
22981d8c4e1Snicm #define O_EDIT			(0x0008U)
23081d8c4e1Snicm #define O_WRAP			(0x0010U)
23181d8c4e1Snicm #define O_BLANK			(0x0020U)
23281d8c4e1Snicm #define O_AUTOSKIP		(0x0040U)
23381d8c4e1Snicm #define O_NULLOK		(0x0080U)
23481d8c4e1Snicm #define O_PASSOK		(0x0100U)
23581d8c4e1Snicm #define O_STATIC		(0x0200U)
236*c7ef0cfcSnicm #define O_DYNAMIC_JUSTIFY	(0x0400U)	/* ncurses extension	*/
237*c7ef0cfcSnicm #define O_NO_LEFT_STRIP		(0x0800U)	/* ncurses extension	*/
238*c7ef0cfcSnicm #define O_EDGE_INSERT_STAY      (0x1000U)	/* ncurses extension	*/
239*c7ef0cfcSnicm #define O_INPUT_LIMIT           (0x2000U)	/* ncurses extension	*/
240ae611fdaStholo 
241ae611fdaStholo /* form options */
24281d8c4e1Snicm #define O_NL_OVERLOAD		(0x0001U)
24381d8c4e1Snicm #define O_BS_OVERLOAD		(0x0002U)
244ae611fdaStholo 
245ae611fdaStholo /* form driver commands */
246ae611fdaStholo #define REQ_NEXT_PAGE	 (KEY_MAX + 1)	/* move to next page		*/
247ae611fdaStholo #define REQ_PREV_PAGE	 (KEY_MAX + 2)	/* move to previous page	*/
248ae611fdaStholo #define REQ_FIRST_PAGE	 (KEY_MAX + 3)	/* move to first page		*/
249ae611fdaStholo #define REQ_LAST_PAGE	 (KEY_MAX + 4)	/* move to last page		*/
250ae611fdaStholo 
251ae611fdaStholo #define REQ_NEXT_FIELD	 (KEY_MAX + 5)	/* move to next field		*/
252ae611fdaStholo #define REQ_PREV_FIELD	 (KEY_MAX + 6)	/* move to previous field	*/
253ae611fdaStholo #define REQ_FIRST_FIELD	 (KEY_MAX + 7)	/* move to first field		*/
254ae611fdaStholo #define REQ_LAST_FIELD	 (KEY_MAX + 8)	/* move to last field		*/
255ae611fdaStholo #define REQ_SNEXT_FIELD	 (KEY_MAX + 9)	/* move to sorted next field	*/
256ae611fdaStholo #define REQ_SPREV_FIELD	 (KEY_MAX + 10)	/* move to sorted prev field	*/
257ae611fdaStholo #define REQ_SFIRST_FIELD (KEY_MAX + 11)	/* move to sorted first field	*/
258ae611fdaStholo #define REQ_SLAST_FIELD	 (KEY_MAX + 12)	/* move to sorted last field	*/
259ae611fdaStholo #define REQ_LEFT_FIELD	 (KEY_MAX + 13)	/* move to left to field	*/
260ae611fdaStholo #define REQ_RIGHT_FIELD	 (KEY_MAX + 14)	/* move to right to field	*/
261ae611fdaStholo #define REQ_UP_FIELD	 (KEY_MAX + 15)	/* move to up to field		*/
262ae611fdaStholo #define REQ_DOWN_FIELD	 (KEY_MAX + 16)	/* move to down to field	*/
263ae611fdaStholo 
264ae611fdaStholo #define REQ_NEXT_CHAR	 (KEY_MAX + 17)	/* move to next char in field	*/
265ae611fdaStholo #define REQ_PREV_CHAR	 (KEY_MAX + 18)	/* move to prev char in field	*/
266ae611fdaStholo #define REQ_NEXT_LINE	 (KEY_MAX + 19)	/* move to next line in field	*/
267ae611fdaStholo #define REQ_PREV_LINE	 (KEY_MAX + 20)	/* move to prev line in field	*/
268ae611fdaStholo #define REQ_NEXT_WORD	 (KEY_MAX + 21)	/* move to next word in field	*/
269ae611fdaStholo #define REQ_PREV_WORD	 (KEY_MAX + 22)	/* move to prev word in field	*/
270ae611fdaStholo #define REQ_BEG_FIELD	 (KEY_MAX + 23)	/* move to first char in field	*/
271ae611fdaStholo #define REQ_END_FIELD	 (KEY_MAX + 24)	/* move after last char in fld	*/
272ae611fdaStholo #define REQ_BEG_LINE	 (KEY_MAX + 25)	/* move to beginning of line	*/
273ae611fdaStholo #define REQ_END_LINE	 (KEY_MAX + 26)	/* move after last char in line	*/
274ae611fdaStholo #define REQ_LEFT_CHAR	 (KEY_MAX + 27)	/* move left in field		*/
275ae611fdaStholo #define REQ_RIGHT_CHAR	 (KEY_MAX + 28)	/* move right in field		*/
276ae611fdaStholo #define REQ_UP_CHAR	 (KEY_MAX + 29)	/* move up in field		*/
277ae611fdaStholo #define REQ_DOWN_CHAR	 (KEY_MAX + 30)	/* move down in field		*/
278ae611fdaStholo 
279ae611fdaStholo #define REQ_NEW_LINE	 (KEY_MAX + 31)	/* insert/overlay new line	*/
280ae611fdaStholo #define REQ_INS_CHAR	 (KEY_MAX + 32)	/* insert blank char at cursor	*/
281ae611fdaStholo #define REQ_INS_LINE	 (KEY_MAX + 33)	/* insert blank line at cursor	*/
282ae611fdaStholo #define REQ_DEL_CHAR	 (KEY_MAX + 34)	/* delete char at cursor	*/
283ae611fdaStholo #define REQ_DEL_PREV	 (KEY_MAX + 35)	/* delete char before cursor	*/
284ae611fdaStholo #define REQ_DEL_LINE	 (KEY_MAX + 36)	/* delete line at cursor	*/
28581d8c4e1Snicm #define REQ_DEL_WORD	 (KEY_MAX + 37)	/* delete word at cursor	*/
286ae611fdaStholo #define REQ_CLR_EOL	 (KEY_MAX + 38)	/* clear to end of line		*/
287ae611fdaStholo #define REQ_CLR_EOF	 (KEY_MAX + 39)	/* clear to end of field	*/
288ae611fdaStholo #define REQ_CLR_FIELD	 (KEY_MAX + 40)	/* clear entire field		*/
289ae611fdaStholo #define REQ_OVL_MODE	 (KEY_MAX + 41)	/* begin overlay mode		*/
290ae611fdaStholo #define REQ_INS_MODE	 (KEY_MAX + 42)	/* begin insert mode		*/
291ae611fdaStholo #define REQ_SCR_FLINE	 (KEY_MAX + 43)	/* scroll field forward a line	*/
292ae611fdaStholo #define REQ_SCR_BLINE	 (KEY_MAX + 44)	/* scroll field backward a line	*/
293ae611fdaStholo #define REQ_SCR_FPAGE	 (KEY_MAX + 45)	/* scroll field forward a page	*/
294ae611fdaStholo #define REQ_SCR_BPAGE	 (KEY_MAX + 46)	/* scroll field backward a page	*/
295ae611fdaStholo #define REQ_SCR_FHPAGE	 (KEY_MAX + 47) /* scroll field forward	 half page */
296ae611fdaStholo #define REQ_SCR_BHPAGE	 (KEY_MAX + 48) /* scroll field backward half page */
297ae611fdaStholo #define REQ_SCR_FCHAR	 (KEY_MAX + 49) /* horizontal scroll char	*/
298ae611fdaStholo #define REQ_SCR_BCHAR	 (KEY_MAX + 50) /* horizontal scroll char	*/
299ae611fdaStholo #define REQ_SCR_HFLINE	 (KEY_MAX + 51) /* horizontal scroll line	*/
300ae611fdaStholo #define REQ_SCR_HBLINE	 (KEY_MAX + 52) /* horizontal scroll line	*/
301ae611fdaStholo #define REQ_SCR_HFHALF	 (KEY_MAX + 53) /* horizontal scroll half line	*/
302ae611fdaStholo #define REQ_SCR_HBHALF	 (KEY_MAX + 54) /* horizontal scroll half line	*/
303ae611fdaStholo 
304ae611fdaStholo #define REQ_VALIDATION	 (KEY_MAX + 55)	/* validate field		*/
305ae611fdaStholo #define REQ_NEXT_CHOICE	 (KEY_MAX + 56)	/* display next field choice	*/
306ae611fdaStholo #define REQ_PREV_CHOICE	 (KEY_MAX + 57)	/* display prev field choice	*/
307ae611fdaStholo 
308ae611fdaStholo #define MIN_FORM_COMMAND (KEY_MAX + 1)	/* used by form_driver		*/
309ae611fdaStholo #define MAX_FORM_COMMAND (KEY_MAX + 57)	/* used by form_driver		*/
310ae611fdaStholo 
3116cd90de4Smillert #if defined(MAX_COMMAND)
3126cd90de4Smillert #  if (MAX_FORM_COMMAND > MAX_COMMAND)
313ae611fdaStholo #    error Something is wrong -- MAX_FORM_COMMAND is greater than MAX_COMMAND
3146cd90de4Smillert #  elif (MAX_COMMAND != (KEY_MAX + 128))
3156cd90de4Smillert #    error Something is wrong -- MAX_COMMAND is already inconsistently defined.
3166cd90de4Smillert #  endif
3176cd90de4Smillert #else
3186cd90de4Smillert #  define MAX_COMMAND (KEY_MAX + 128)
319ae611fdaStholo #endif
320ae611fdaStholo 
321ae611fdaStholo 	/*************************
322ae611fdaStholo 	*  standard field types  *
323ae611fdaStholo 	*************************/
324*c7ef0cfcSnicm extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_ALPHA;
325*c7ef0cfcSnicm extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_ALNUM;
326*c7ef0cfcSnicm extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_ENUM;
327*c7ef0cfcSnicm extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_INTEGER;
328*c7ef0cfcSnicm extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_NUMERIC;
329*c7ef0cfcSnicm extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_REGEXP;
330ae611fdaStholo 
3316cd90de4Smillert 	/************************************
3326cd90de4Smillert 	*  built-in additional field types  *
3336cd90de4Smillert 	*  They are not defined in SVr4     *
3346cd90de4Smillert 	************************************/
335*c7ef0cfcSnicm extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_IPV4;      /* Internet IP Version 4 address */
336ae611fdaStholo 
337ae611fdaStholo 	/***********************
338ae611fdaStholo 	*  FIELDTYPE routines  *
339ae611fdaStholo 	***********************/
340*c7ef0cfcSnicm extern FORM_EXPORT(FIELDTYPE *) new_fieldtype (
341ae611fdaStholo 		    bool (* const field_check)(FIELD *,const void *),
34281d8c4e1Snicm 		    bool (* const char_check)(int,const void *));
343*c7ef0cfcSnicm extern FORM_EXPORT(FIELDTYPE *) link_fieldtype(
34481d8c4e1Snicm 		    FIELDTYPE *, FIELDTYPE *);
345ae611fdaStholo 
346*c7ef0cfcSnicm extern FORM_EXPORT(int)	free_fieldtype (FIELDTYPE *);
347*c7ef0cfcSnicm extern FORM_EXPORT(int)	set_fieldtype_arg (FIELDTYPE *,
348ae611fdaStholo 		    void * (* const make_arg)(va_list *),
349ae611fdaStholo 		    void * (* const copy_arg)(const void *),
35084af20ceSmillert 		    void (* const free_arg)(void *));
351*c7ef0cfcSnicm extern FORM_EXPORT(int)	 set_fieldtype_choice (FIELDTYPE *,
352ae611fdaStholo 		    bool (* const next_choice)(FIELD *,const void *),
353ae611fdaStholo 	      	    bool (* const prev_choice)(FIELD *,const void *));
354ae611fdaStholo 
355ae611fdaStholo 	/*******************
356ae611fdaStholo 	*  FIELD routines  *
357ae611fdaStholo 	*******************/
358*c7ef0cfcSnicm extern FORM_EXPORT(FIELD *)	new_field (int,int,int,int,int,int);
359*c7ef0cfcSnicm extern FORM_EXPORT(FIELD *)	dup_field (FIELD *,int,int);
360*c7ef0cfcSnicm extern FORM_EXPORT(FIELD *)	link_field (FIELD *,int,int);
361ae611fdaStholo 
362*c7ef0cfcSnicm extern FORM_EXPORT(int)	free_field (FIELD *);
363*c7ef0cfcSnicm extern FORM_EXPORT(int)	field_info (const FIELD *,int *,int *,int *,int *,int *,int *);
364*c7ef0cfcSnicm extern FORM_EXPORT(int)	dynamic_field_info (const FIELD *,int *,int *,int *);
365*c7ef0cfcSnicm extern FORM_EXPORT(int)	set_max_field ( FIELD *,int);
366*c7ef0cfcSnicm extern FORM_EXPORT(int)	move_field (FIELD *,int,int);
367*c7ef0cfcSnicm extern FORM_EXPORT(int)	set_field_type (FIELD *,FIELDTYPE *,...);
368*c7ef0cfcSnicm extern FORM_EXPORT(int)	set_new_page (FIELD *,bool);
369*c7ef0cfcSnicm extern FORM_EXPORT(int)	set_field_just (FIELD *,int);
370*c7ef0cfcSnicm extern FORM_EXPORT(int)	field_just (const FIELD *);
371*c7ef0cfcSnicm extern FORM_EXPORT(int)	set_field_fore (FIELD *,chtype);
372*c7ef0cfcSnicm extern FORM_EXPORT(int)	set_field_back (FIELD *,chtype);
373*c7ef0cfcSnicm extern FORM_EXPORT(int)	set_field_pad (FIELD *,int);
374*c7ef0cfcSnicm extern FORM_EXPORT(int)	field_pad (const FIELD *);
375*c7ef0cfcSnicm extern FORM_EXPORT(int)	set_field_buffer (FIELD *,int,const char *);
376*c7ef0cfcSnicm extern FORM_EXPORT(int)	set_field_status (FIELD *,bool);
377*c7ef0cfcSnicm extern FORM_EXPORT(int)	set_field_userptr (FIELD *, void *);
378*c7ef0cfcSnicm extern FORM_EXPORT(int)	set_field_opts (FIELD *,Field_Options);
379*c7ef0cfcSnicm extern FORM_EXPORT(int)	field_opts_on (FIELD *,Field_Options);
380*c7ef0cfcSnicm extern FORM_EXPORT(int)	field_opts_off (FIELD *,Field_Options);
381ae611fdaStholo 
382*c7ef0cfcSnicm extern FORM_EXPORT(chtype)	field_fore (const FIELD *);
383*c7ef0cfcSnicm extern FORM_EXPORT(chtype)	field_back (const FIELD *);
384ae611fdaStholo 
385*c7ef0cfcSnicm extern FORM_EXPORT(bool)	new_page (const FIELD *);
386*c7ef0cfcSnicm extern FORM_EXPORT(bool)	field_status (const FIELD *);
387ae611fdaStholo 
388*c7ef0cfcSnicm extern FORM_EXPORT(void *)	field_arg (const FIELD *);
3896cd90de4Smillert 
390*c7ef0cfcSnicm extern FORM_EXPORT(void *)	field_userptr (const FIELD *);
391ae611fdaStholo 
392*c7ef0cfcSnicm extern FORM_EXPORT(FIELDTYPE *)	field_type (const FIELD *);
393ae611fdaStholo 
394*c7ef0cfcSnicm extern FORM_EXPORT(char *)	field_buffer (const FIELD *,int);
395ae611fdaStholo 
396*c7ef0cfcSnicm extern FORM_EXPORT(Field_Options)	field_opts (const FIELD *);
397ae611fdaStholo 
398ae611fdaStholo 	/******************
399ae611fdaStholo 	*  FORM routines  *
400ae611fdaStholo 	******************/
401ae611fdaStholo 
402*c7ef0cfcSnicm extern FORM_EXPORT(FORM *)	new_form (FIELD **);
403ae611fdaStholo 
404*c7ef0cfcSnicm extern FORM_EXPORT(FIELD **)	form_fields (const FORM *);
405*c7ef0cfcSnicm extern FORM_EXPORT(FIELD *)	current_field (const FORM *);
406ae611fdaStholo 
407*c7ef0cfcSnicm extern FORM_EXPORT(WINDOW *)	form_win (const FORM *);
408*c7ef0cfcSnicm extern FORM_EXPORT(WINDOW *)	form_sub (const FORM *);
409ae611fdaStholo 
410*c7ef0cfcSnicm extern FORM_EXPORT(Form_Hook)	form_init (const FORM *);
411*c7ef0cfcSnicm extern FORM_EXPORT(Form_Hook)	form_term (const FORM *);
412*c7ef0cfcSnicm extern FORM_EXPORT(Form_Hook)	field_init (const FORM *);
413*c7ef0cfcSnicm extern FORM_EXPORT(Form_Hook)	field_term (const FORM *);
414ae611fdaStholo 
415*c7ef0cfcSnicm extern FORM_EXPORT(int)	free_form (FORM *);
416*c7ef0cfcSnicm extern FORM_EXPORT(int)	set_form_fields (FORM *,FIELD **);
417*c7ef0cfcSnicm extern FORM_EXPORT(int)	field_count (const FORM *);
418*c7ef0cfcSnicm extern FORM_EXPORT(int)	set_form_win (FORM *,WINDOW *);
419*c7ef0cfcSnicm extern FORM_EXPORT(int)	set_form_sub (FORM *,WINDOW *);
420*c7ef0cfcSnicm extern FORM_EXPORT(int)	set_current_field (FORM *,FIELD *);
421*c7ef0cfcSnicm extern FORM_EXPORT(int)	unfocus_current_field (FORM *);
422*c7ef0cfcSnicm extern FORM_EXPORT(int)	field_index (const FIELD *);
423*c7ef0cfcSnicm extern FORM_EXPORT(int)	set_form_page (FORM *,int);
424*c7ef0cfcSnicm extern FORM_EXPORT(int)	form_page (const FORM *);
425*c7ef0cfcSnicm extern FORM_EXPORT(int)	scale_form (const FORM *,int *,int *);
426*c7ef0cfcSnicm extern FORM_EXPORT(int)	set_form_init (FORM *,Form_Hook);
427*c7ef0cfcSnicm extern FORM_EXPORT(int)	set_form_term (FORM *,Form_Hook);
428*c7ef0cfcSnicm extern FORM_EXPORT(int)	set_field_init (FORM *,Form_Hook);
429*c7ef0cfcSnicm extern FORM_EXPORT(int)	set_field_term (FORM *,Form_Hook);
430*c7ef0cfcSnicm extern FORM_EXPORT(int)	post_form (FORM *);
431*c7ef0cfcSnicm extern FORM_EXPORT(int)	unpost_form (FORM *);
432*c7ef0cfcSnicm extern FORM_EXPORT(int)	pos_form_cursor (FORM *);
433*c7ef0cfcSnicm extern FORM_EXPORT(int)	form_driver (FORM *,int);
434*c7ef0cfcSnicm # if NCURSES_WIDECHAR
435*c7ef0cfcSnicm extern FORM_EXPORT(int)	form_driver_w (FORM *,int,wchar_t);
436*c7ef0cfcSnicm # endif
437*c7ef0cfcSnicm extern FORM_EXPORT(int)	set_form_userptr (FORM *,void *);
438*c7ef0cfcSnicm extern FORM_EXPORT(int)	set_form_opts (FORM *,Form_Options);
439*c7ef0cfcSnicm extern FORM_EXPORT(int)	form_opts_on (FORM *,Form_Options);
440*c7ef0cfcSnicm extern FORM_EXPORT(int)	form_opts_off (FORM *,Form_Options);
441*c7ef0cfcSnicm extern FORM_EXPORT(int)	form_request_by_name (const char *);
4426cd90de4Smillert 
443*c7ef0cfcSnicm extern FORM_EXPORT(const char *)	form_request_name (int);
444ae611fdaStholo 
445*c7ef0cfcSnicm extern FORM_EXPORT(void *)	form_userptr (const FORM *);
446ae611fdaStholo 
447*c7ef0cfcSnicm extern FORM_EXPORT(Form_Options)	form_opts (const FORM *);
44884af20ceSmillert 
449*c7ef0cfcSnicm extern FORM_EXPORT(bool)	data_ahead (const FORM *);
450*c7ef0cfcSnicm extern FORM_EXPORT(bool)	data_behind (const FORM *);
451*c7ef0cfcSnicm 
452*c7ef0cfcSnicm #if NCURSES_SP_FUNCS
453*c7ef0cfcSnicm extern FORM_EXPORT(FORM *)	NCURSES_SP_NAME(new_form) (SCREEN*, FIELD **);
454*c7ef0cfcSnicm #endif
455ae611fdaStholo 
456ae611fdaStholo #ifdef __cplusplus
457ae611fdaStholo   }
458ae611fdaStholo #endif
459*c7ef0cfcSnicm /* *INDENT-ON*/
460ae611fdaStholo 
461ae611fdaStholo #endif /* FORM_H */
462