1*0a6a1f1dSLionel Sambuc /* $NetBSD: form.h,v 1.23 2015/09/07 15:50:49 joerg Exp $ */ 2a0e6850fSThomas Cort 3a0e6850fSThomas Cort /*- 4a0e6850fSThomas Cort * Copyright (c) 1998-1999 Brett Lymn 5a0e6850fSThomas Cort * (blymn@baea.com.au, brett_lymn@yahoo.com.au) 6a0e6850fSThomas Cort * All rights reserved. 7a0e6850fSThomas Cort * 8a0e6850fSThomas Cort * This code has been donated to The NetBSD Foundation by the Author. 9a0e6850fSThomas Cort * 10a0e6850fSThomas Cort * Redistribution and use in source and binary forms, with or without 11a0e6850fSThomas Cort * modification, are permitted provided that the following conditions 12a0e6850fSThomas Cort * are met: 13a0e6850fSThomas Cort * 1. Redistributions of source code must retain the above copyright 14a0e6850fSThomas Cort * notice, this list of conditions and the following disclaimer. 15a0e6850fSThomas Cort * 2. The name of the author may not be used to endorse or promote products 16a0e6850fSThomas Cort * derived from this software without specific prior written permission 17a0e6850fSThomas Cort * 18a0e6850fSThomas Cort * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19a0e6850fSThomas Cort * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20a0e6850fSThomas Cort * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21a0e6850fSThomas Cort * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22a0e6850fSThomas Cort * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23a0e6850fSThomas Cort * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24a0e6850fSThomas Cort * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25a0e6850fSThomas Cort * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26a0e6850fSThomas Cort * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27a0e6850fSThomas Cort * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28a0e6850fSThomas Cort * 29a0e6850fSThomas Cort * 30a0e6850fSThomas Cort */ 31a0e6850fSThomas Cort 32a0e6850fSThomas Cort #ifndef FORM_H 33a0e6850fSThomas Cort #define FORM_H 1 34a0e6850fSThomas Cort #include <sys/queue.h> 35a0e6850fSThomas Cort #include <stdarg.h> 36a0e6850fSThomas Cort #include <curses.h> 37a0e6850fSThomas Cort #include <eti.h> 38a0e6850fSThomas Cort 39a0e6850fSThomas Cort /* Define the types of field justification that can be used. */ 40a0e6850fSThomas Cort #define NO_JUSTIFICATION (0) 41a0e6850fSThomas Cort #define JUSTIFY_RIGHT (1) 42a0e6850fSThomas Cort #define JUSTIFY_LEFT (2) 43a0e6850fSThomas Cort #define JUSTIFY_CENTER (3) 44a0e6850fSThomas Cort 45a0e6850fSThomas Cort /* Define the max and min valid justification styles for range checking */ 46a0e6850fSThomas Cort #define MIN_JUST_STYLE NO_JUSTIFICATION 47a0e6850fSThomas Cort #define MAX_JUST_STYLE JUSTIFY_CENTER 48a0e6850fSThomas Cort 49a0e6850fSThomas Cort /* Options for the fields */ 50a0e6850fSThomas Cort typedef unsigned int Form_Options; 51a0e6850fSThomas Cort 52a0e6850fSThomas Cort /* form options */ 53a0e6850fSThomas Cort #define O_BS_OVERLOAD (0x001) 54a0e6850fSThomas Cort #define O_NL_OVERLOAD (0x002) 55a0e6850fSThomas Cort 56a0e6850fSThomas Cort /* field options */ 57a0e6850fSThomas Cort #define O_VISIBLE (0x001) /* Field is visible */ 58a0e6850fSThomas Cort #define O_ACTIVE (0x002) /* Field is active in the form */ 59a0e6850fSThomas Cort #define O_PUBLIC (0x004) /* The contents entered into the field is echoed */ 60a0e6850fSThomas Cort #define O_EDIT (0x008) /* Can edit the field */ 61a0e6850fSThomas Cort #define O_WRAP (0x010) /* The field contents can line wrap */ 62a0e6850fSThomas Cort #define O_BLANK (0x020) /* Blank the field on modification */ 63a0e6850fSThomas Cort #define O_AUTOSKIP (0x040) /* Skip to next field when current is full */ 64a0e6850fSThomas Cort #define O_NULLOK (0x080) /* Field is allowed to contain no data */ 65a0e6850fSThomas Cort #define O_STATIC (0x100) /* Field is not dynamic */ 66a0e6850fSThomas Cort #define O_PASSOK (0x200) /* An umodified field is OK */ 67a0e6850fSThomas Cort #define O_REFORMAT (0x400) /* Insert newlines at linebreaks on buffer get */ 68a0e6850fSThomas Cort 69a0e6850fSThomas Cort /* 70a0e6850fSThomas Cort * Form driver requests - be VERY careful about changing the ordering 71a0e6850fSThomas Cort * of the requests below. The form driver code depends on a particular 72a0e6850fSThomas Cort * order for the requests. 73a0e6850fSThomas Cort */ 74a0e6850fSThomas Cort #define REQ_MIN_REQUEST (KEY_MAX + 0x101) /* must equal value of the 75a0e6850fSThomas Cort first request */ 76a0e6850fSThomas Cort 77a0e6850fSThomas Cort #define REQ_NEXT_PAGE (KEY_MAX + 0x101) /* next page in form */ 78a0e6850fSThomas Cort #define REQ_PREV_PAGE (KEY_MAX + 0x102) /* previous page in form */ 79a0e6850fSThomas Cort #define REQ_FIRST_PAGE (KEY_MAX + 0x103) /* goto first page in form */ 80a0e6850fSThomas Cort #define REQ_LAST_PAGE (KEY_MAX + 0x104) /* goto last page in form */ 81a0e6850fSThomas Cort 82a0e6850fSThomas Cort #define REQ_NEXT_FIELD (KEY_MAX + 0x105) /* move to the next field */ 83a0e6850fSThomas Cort #define REQ_PREV_FIELD (KEY_MAX + 0x106) /* move to the previous field */ 84a0e6850fSThomas Cort #define REQ_FIRST_FIELD (KEY_MAX + 0x107) /* goto the first field */ 85a0e6850fSThomas Cort #define REQ_LAST_FIELD (KEY_MAX + 0x108) /* goto the last field */ 86a0e6850fSThomas Cort 87a0e6850fSThomas Cort #define REQ_SNEXT_FIELD (KEY_MAX + 0x109) /* move to the next field 88a0e6850fSThomas Cort in sorted order */ 89a0e6850fSThomas Cort #define REQ_SPREV_FIELD (KEY_MAX + 0x10a) /* move to the prev field 90a0e6850fSThomas Cort in sorted order */ 91a0e6850fSThomas Cort #define REQ_SFIRST_FIELD (KEY_MAX + 0x10b) /* move to the first 92a0e6850fSThomas Cort sorted field */ 93a0e6850fSThomas Cort #define REQ_SLAST_FIELD (KEY_MAX + 0x10c) /* move to the last sorted 94a0e6850fSThomas Cort field */ 95a0e6850fSThomas Cort 96a0e6850fSThomas Cort #define REQ_LEFT_FIELD (KEY_MAX + 0x10d) /* go left one field */ 97a0e6850fSThomas Cort #define REQ_RIGHT_FIELD (KEY_MAX + 0x10e) /* go right one field */ 98a0e6850fSThomas Cort #define REQ_UP_FIELD (KEY_MAX + 0x10f) /* go up one field */ 99a0e6850fSThomas Cort #define REQ_DOWN_FIELD (KEY_MAX + 0x110) /* go down one field */ 100a0e6850fSThomas Cort 101a0e6850fSThomas Cort #define REQ_NEXT_CHAR (KEY_MAX + 0x111) /* move to the next char 102a0e6850fSThomas Cort in field */ 103a0e6850fSThomas Cort #define REQ_PREV_CHAR (KEY_MAX + 0x112) /* move to the previous 104a0e6850fSThomas Cort char in field */ 105a0e6850fSThomas Cort #define REQ_NEXT_LINE (KEY_MAX + 0x113) /* go to the next line in 106a0e6850fSThomas Cort the field */ 107a0e6850fSThomas Cort #define REQ_PREV_LINE (KEY_MAX + 0x114) /* go to the previous line 108a0e6850fSThomas Cort in the field */ 109a0e6850fSThomas Cort #define REQ_NEXT_WORD (KEY_MAX + 0x115) /* go to the next word in 110a0e6850fSThomas Cort the field */ 111a0e6850fSThomas Cort #define REQ_PREV_WORD (KEY_MAX + 0x116) /* go to the previous word 112a0e6850fSThomas Cort in the field */ 113a0e6850fSThomas Cort #define REQ_BEG_FIELD (KEY_MAX + 0x117) /* go to the beginning of 114a0e6850fSThomas Cort the field */ 115a0e6850fSThomas Cort #define REQ_END_FIELD (KEY_MAX + 0x118) /* go to the end of the field */ 116a0e6850fSThomas Cort #define REQ_BEG_LINE (KEY_MAX + 0x119) /* go to the beginning of 117a0e6850fSThomas Cort the line */ 118a0e6850fSThomas Cort #define REQ_END_LINE (KEY_MAX + 0x11a) /* go to the end of the 119a0e6850fSThomas Cort line */ 120a0e6850fSThomas Cort #define REQ_LEFT_CHAR (KEY_MAX + 0x11b) /* move left in the field */ 121a0e6850fSThomas Cort #define REQ_RIGHT_CHAR (KEY_MAX + 0x11c) /* move right in the field */ 122a0e6850fSThomas Cort #define REQ_UP_CHAR (KEY_MAX + 0x11d) /* move up in the field */ 123a0e6850fSThomas Cort #define REQ_DOWN_CHAR (KEY_MAX + 0x11e) /* move down in the field */ 124a0e6850fSThomas Cort 125a0e6850fSThomas Cort #define REQ_NEW_LINE (KEY_MAX + 0x11f) /* insert/overlay a new line */ 126a0e6850fSThomas Cort #define REQ_INS_CHAR (KEY_MAX + 0x120) /* insert a blank char at 127a0e6850fSThomas Cort the cursor */ 128a0e6850fSThomas Cort #define REQ_INS_LINE (KEY_MAX + 0x121) /* insert a blank line at 129a0e6850fSThomas Cort the cursor */ 130a0e6850fSThomas Cort 131a0e6850fSThomas Cort #define REQ_DEL_CHAR (KEY_MAX + 0x122) /* delete the current character */ 132a0e6850fSThomas Cort #define REQ_DEL_PREV (KEY_MAX + 0x123) /* delete the character 133a0e6850fSThomas Cort before the current */ 134a0e6850fSThomas Cort #define REQ_DEL_LINE (KEY_MAX + 0x124) /* delete the current line */ 135a0e6850fSThomas Cort #define REQ_DEL_WORD (KEY_MAX + 0x125) /* delete the word at the cursor */ 136a0e6850fSThomas Cort #define REQ_CLR_EOL (KEY_MAX + 0x126) /* clear to the end of the line */ 137a0e6850fSThomas Cort #define REQ_CLR_EOF (KEY_MAX + 0x127) /* clear to the end of the field */ 138a0e6850fSThomas Cort #define REQ_CLR_FIELD (KEY_MAX + 0x128) /* clear the field */ 139a0e6850fSThomas Cort 140a0e6850fSThomas Cort #define REQ_OVL_MODE (KEY_MAX + 0x129) /* overlay mode */ 141a0e6850fSThomas Cort #define REQ_INS_MODE (KEY_MAX + 0x12a) /* insert mode */ 142a0e6850fSThomas Cort 143a0e6850fSThomas Cort #define REQ_SCR_FLINE (KEY_MAX + 0x12b) /* scroll field forward one line */ 144a0e6850fSThomas Cort #define REQ_SCR_BLINE (KEY_MAX + 0x12c) /* scroll field backward 145a0e6850fSThomas Cort one line */ 146a0e6850fSThomas Cort #define REQ_SCR_FPAGE (KEY_MAX + 0x12d) /* scroll field forward one page */ 147a0e6850fSThomas Cort #define REQ_SCR_BPAGE (KEY_MAX + 0x12e) /* scroll field backward 148a0e6850fSThomas Cort one page */ 149a0e6850fSThomas Cort #define REQ_SCR_FHPAGE (KEY_MAX + 0x12f) /* scroll field forward 150a0e6850fSThomas Cort half a page */ 151a0e6850fSThomas Cort #define REQ_SCR_BHPAGE (KEY_MAX + 0x130) /* scroll field backward 152a0e6850fSThomas Cort half a page */ 153a0e6850fSThomas Cort 154a0e6850fSThomas Cort #define REQ_SCR_FCHAR (KEY_MAX + 0x131) /* horizontal scroll 155a0e6850fSThomas Cort forward a character */ 156a0e6850fSThomas Cort #define REQ_SCR_BCHAR (KEY_MAX + 0x132) /* horizontal scroll 157a0e6850fSThomas Cort backward a character */ 158a0e6850fSThomas Cort #define REQ_SCR_HFLINE (KEY_MAX + 0x133) /* horizontal scroll 159a0e6850fSThomas Cort forward a line */ 160a0e6850fSThomas Cort #define REQ_SCR_HBLINE (KEY_MAX + 0x134) /* horizontal scroll 161a0e6850fSThomas Cort backward a line */ 162a0e6850fSThomas Cort #define REQ_SCR_HFHALF (KEY_MAX + 0x135) /* horizontal scroll 163a0e6850fSThomas Cort forward half a line */ 164a0e6850fSThomas Cort #define REQ_SCR_HBHALF (KEY_MAX + 0x136) /* horizontal scroll 165a0e6850fSThomas Cort backward half a line */ 166a0e6850fSThomas Cort 167a0e6850fSThomas Cort #define REQ_VALIDATION (KEY_MAX + 0x137) /* validate the field */ 168a0e6850fSThomas Cort #define REQ_PREV_CHOICE (KEY_MAX + 0x138) /* display previous field choice */ 169a0e6850fSThomas Cort #define REQ_NEXT_CHOICE (KEY_MAX + 0x139) /* display next field choice */ 170a0e6850fSThomas Cort 171a0e6850fSThomas Cort #define REQ_MAX_COMMAND (KEY_MAX + 0x139) /* must match the last 172a0e6850fSThomas Cort driver command */ 173a0e6850fSThomas Cort 174a0e6850fSThomas Cort /* The following defines are for ncurses compatibility */ 175a0e6850fSThomas Cort #define MIN_FORM_COMMAND REQ_MIN_REQUEST 176a0e6850fSThomas Cort #define MAX_FORM_COMMAND REQ_MAX_COMMAND 177a0e6850fSThomas Cort 178a0e6850fSThomas Cort 179a0e6850fSThomas Cort typedef struct _form_string { 180a0e6850fSThomas Cort size_t allocated; 181a0e6850fSThomas Cort unsigned int length; 182a0e6850fSThomas Cort char *string; 183a0e6850fSThomas Cort } FORM_STR; 184a0e6850fSThomas Cort 185a0e6850fSThomas Cort typedef struct _form_field FIELD; 186a0e6850fSThomas Cort typedef struct _form_struct FORM; 187a0e6850fSThomas Cort typedef struct _form_fieldtype FIELDTYPE; 188a0e6850fSThomas Cort 189a0e6850fSThomas Cort typedef struct _formi_page_struct _FORMI_PAGE_START; 190a0e6850fSThomas Cort typedef struct formi_type_link_struct _FORMI_TYPE_LINK; 191a0e6850fSThomas Cort typedef struct _formi_field_lines _FORMI_FIELD_LINES; 192a0e6850fSThomas Cort 193a0e6850fSThomas Cort 194a0e6850fSThomas Cort typedef void (*Form_Hook)(FORM *); 195a0e6850fSThomas Cort 196a0e6850fSThomas Cort /* definition of a field in the form */ 197a0e6850fSThomas Cort struct _form_field { 198a0e6850fSThomas Cort unsigned int rows; /* rows in the field */ 199a0e6850fSThomas Cort unsigned int cols; /* columns in the field */ 200a0e6850fSThomas Cort unsigned int drows; /* dynamic rows */ 201a0e6850fSThomas Cort unsigned int dcols; /* dynamic columns */ 202a0e6850fSThomas Cort unsigned int max; /* maximum growth */ 203a0e6850fSThomas Cort unsigned int form_row; /* starting row in the form subwindow */ 204a0e6850fSThomas Cort unsigned int form_col; /* starting column in the form subwindow */ 205a0e6850fSThomas Cort unsigned int nrows; /* number of off screen rows */ 206a0e6850fSThomas Cort int index; /* index of this field in form fields array. */ 207a0e6850fSThomas Cort int nbuf; /* number of buffers associated with this field */ 208a0e6850fSThomas Cort int buf0_status; /* set to true if buffer 0 has changed. */ 209a0e6850fSThomas Cort int justification; /* justification style of the field */ 210a0e6850fSThomas Cort int overlay; /* set to true if field is in overlay mode */ 211a0e6850fSThomas Cort _FORMI_FIELD_LINES *cur_line; /* pointer to the current line cursor 212a0e6850fSThomas Cort is on */ 213a0e6850fSThomas Cort unsigned int start_char; /* starting char in string (horiz scroll) */ 214a0e6850fSThomas Cort _FORMI_FIELD_LINES *start_line; /* start line in field (vert scroll) */ 215a0e6850fSThomas Cort unsigned int row_count; /* number of rows actually used in field */ 216a0e6850fSThomas Cort unsigned int row_xpos; /* char offset of cursor in field, not same 217a0e6850fSThomas Cort as cursor_xpos due to tab expansion */ 218a0e6850fSThomas Cort unsigned int cursor_xpos; /* x pos of cursor in field */ 219a0e6850fSThomas Cort unsigned int cursor_ypos; /* y pos of cursor in field */ 220a0e6850fSThomas Cort short page_break; /* start of a new page on the form if 1 */ 221a0e6850fSThomas Cort short page; /* number of the page this field is on */ 222a0e6850fSThomas Cort chtype fore; /* character attributes for the foreground */ 223a0e6850fSThomas Cort chtype back; /* character attributes for the background */ 224a0e6850fSThomas Cort int pad; /* padding character */ 225a0e6850fSThomas Cort Form_Options opts; /* options for the field */ 226a0e6850fSThomas Cort FORM *parent; /* the form this field is bound to, if any */ 227a0e6850fSThomas Cort FIELD *up; /* field above this one */ 228a0e6850fSThomas Cort FIELD *down; /* field below this one */ 229a0e6850fSThomas Cort FIELD *left; /* field to the left of this one */ 230a0e6850fSThomas Cort FIELD *right; /* field to the right of this one */ 231a0e6850fSThomas Cort void *userptr; /* user defined pointer. */ 232a0e6850fSThomas Cort FIELD *link; /* used if fields are linked */ 233a0e6850fSThomas Cort FIELDTYPE *type; /* type struct for the field */ 23484d9c625SLionel Sambuc TAILQ_ENTRY(_form_field) glue; /* tail queue glue for sorting fields */ 235a0e6850fSThomas Cort char *args; /* args for field type. */ 236a0e6850fSThomas Cort _FORMI_FIELD_LINES *alines; /* array of the starts and ends of lines */ 237a0e6850fSThomas Cort _FORMI_FIELD_LINES *free; /* list of lines available for reuse */ 238a0e6850fSThomas Cort FORM_STR *buffers; /* array of buffers for the field */ 239a0e6850fSThomas Cort }; 240a0e6850fSThomas Cort 241a0e6850fSThomas Cort /* define the types of fields we can have */ 242a0e6850fSThomas Cort extern FIELDTYPE *TYPE_ALNUM; 243a0e6850fSThomas Cort extern FIELDTYPE *TYPE_ALPHA; 244a0e6850fSThomas Cort extern FIELDTYPE *TYPE_ENUM; 245a0e6850fSThomas Cort extern FIELDTYPE *TYPE_INTEGER; 246a0e6850fSThomas Cort extern FIELDTYPE *TYPE_NUMERIC; 247a0e6850fSThomas Cort extern FIELDTYPE *TYPE_REGEXP; 248a0e6850fSThomas Cort extern FIELDTYPE *TYPE_IPV4; 249a0e6850fSThomas Cort extern FIELDTYPE *TYPE_IPV6; 250a0e6850fSThomas Cort extern FIELDTYPE *TYPE_USER; 251a0e6850fSThomas Cort 252a0e6850fSThomas Cort /* definition of a field type. */ 253a0e6850fSThomas Cort struct _form_fieldtype { 254a0e6850fSThomas Cort unsigned flags; /* status of the type */ 255a0e6850fSThomas Cort unsigned refcount; /* in use if > 0 */ 256a0e6850fSThomas Cort _FORMI_TYPE_LINK *link; /* set if this type is linked */ 257a0e6850fSThomas Cort 258a0e6850fSThomas Cort char * (*make_args)(va_list *); /* make the args for the type */ 259a0e6850fSThomas Cort char * (*copy_args)(char *); /* copy the args for the type */ 260a0e6850fSThomas Cort void (*free_args)(char *); /* free storage used by the args */ 261a0e6850fSThomas Cort int (*field_check)(FIELD *, char *); /* field validation routine */ 262a0e6850fSThomas Cort int (*char_check)(int, char *); /* char validation routine */ 263a0e6850fSThomas Cort int (*next_choice)(FIELD *, char *); /* function to select next 264a0e6850fSThomas Cort choice */ 265a0e6850fSThomas Cort int (*prev_choice)(FIELD *, char *); /* function to select prev 266a0e6850fSThomas Cort choice */ 267a0e6850fSThomas Cort }; 268a0e6850fSThomas Cort 269a0e6850fSThomas Cort /*definition of a form */ 270a0e6850fSThomas Cort 271a0e6850fSThomas Cort struct _form_struct { 272a0e6850fSThomas Cort int in_init; /* true if performing a init or term function */ 273a0e6850fSThomas Cort int posted; /* the form is posted */ 274a0e6850fSThomas Cort int wrap; /* wrap from last field to first field if true */ 275a0e6850fSThomas Cort WINDOW *win; /* window for the form */ 276a0e6850fSThomas Cort WINDOW *subwin; /* subwindow for the form */ 277a0e6850fSThomas Cort WINDOW *scrwin; /* this is the window to use for output */ 278a0e6850fSThomas Cort void *userptr; /* user defined pointer */ 279a0e6850fSThomas Cort Form_Options opts; /* options for the form */ 280a0e6850fSThomas Cort Form_Hook form_init; /* function called when form posted and 281a0e6850fSThomas Cort after page change */ 282a0e6850fSThomas Cort Form_Hook form_term; /* function called when form is unposted and 283a0e6850fSThomas Cort before page change */ 284a0e6850fSThomas Cort Form_Hook field_init; /* function called when form posted and after 285a0e6850fSThomas Cort current field changes */ 286a0e6850fSThomas Cort Form_Hook field_term; /* function called when form unposted and 287a0e6850fSThomas Cort before current field changes */ 288a0e6850fSThomas Cort int field_count; /* number of fields attached */ 289a0e6850fSThomas Cort int cur_field; /* current field */ 290a0e6850fSThomas Cort int page; /* current page of form */ 291a0e6850fSThomas Cort int max_page; /* number of pages in the form */ 292a0e6850fSThomas Cort _FORMI_PAGE_START *page_starts; /* dynamic array of fields that start 293a0e6850fSThomas Cort the pages */ 29484d9c625SLionel Sambuc TAILQ_HEAD(_formi_sort_head, _form_field) sorted_fields; /* sorted field 295a0e6850fSThomas Cort list */ 296a0e6850fSThomas Cort FIELD **fields; /* array of fields attached to this form. */ 297a0e6850fSThomas Cort }; 298a0e6850fSThomas Cort 299a0e6850fSThomas Cort /* Public function prototypes. */ 300a0e6850fSThomas Cort __BEGIN_DECLS 301a0e6850fSThomas Cort 302a0e6850fSThomas Cort FIELD *current_field(FORM *); 303a0e6850fSThomas Cort int data_ahead(FORM *); 304a0e6850fSThomas Cort int data_behind(FORM *); 305a0e6850fSThomas Cort FIELD *dup_field(FIELD *, int, int); 306a0e6850fSThomas Cort int dynamic_field_info(FIELD *, int *, int *, int *); 307a0e6850fSThomas Cort char *field_arg(FIELD *); 308a0e6850fSThomas Cort chtype field_back(FIELD *); 309a0e6850fSThomas Cort char *field_buffer(FIELD *, int); 310a0e6850fSThomas Cort int field_count(FORM *); 311a0e6850fSThomas Cort chtype field_fore(FIELD *); 312a0e6850fSThomas Cort int field_index(FIELD *); 313a0e6850fSThomas Cort int field_info(FIELD *, int *, int *, int *, int *, int *, int *); 314a0e6850fSThomas Cort Form_Hook field_init(FORM *); 315a0e6850fSThomas Cort int field_just(FIELD *); 316a0e6850fSThomas Cort Form_Options field_opts(FIELD *); 317a0e6850fSThomas Cort int field_opts_off(FIELD *, Form_Options); 318a0e6850fSThomas Cort int field_opts_on(FIELD *, Form_Options); 319a0e6850fSThomas Cort int field_pad(FIELD *); 320a0e6850fSThomas Cort int field_status(FIELD *); 321a0e6850fSThomas Cort Form_Hook field_term(FORM *); 322a0e6850fSThomas Cort FIELDTYPE *field_type(FIELD *); 323a0e6850fSThomas Cort void *field_userptr(FIELD *); 324a0e6850fSThomas Cort int form_driver(FORM *, int); 325a0e6850fSThomas Cort FIELD **form_fields(FORM *); 326a0e6850fSThomas Cort Form_Hook form_init(FORM *); 327a0e6850fSThomas Cort int form_max_page(FORM *); 328a0e6850fSThomas Cort Form_Options form_opts(FORM *); 329a0e6850fSThomas Cort int form_opts_off(FORM *, Form_Options); 330a0e6850fSThomas Cort int form_opts_on(FORM *, Form_Options); 331a0e6850fSThomas Cort int form_page(FORM *); 332a0e6850fSThomas Cort WINDOW *form_sub(FORM *); 333a0e6850fSThomas Cort Form_Hook form_term(FORM *); 334a0e6850fSThomas Cort void *form_userptr(FORM *); 335a0e6850fSThomas Cort WINDOW *form_win(FORM *); 336a0e6850fSThomas Cort int free_field(FIELD *); 337a0e6850fSThomas Cort int free_fieldtype(FIELDTYPE *); 338a0e6850fSThomas Cort int free_form(FORM *); 339a0e6850fSThomas Cort FIELD *link_field(FIELD *, int, int); 340a0e6850fSThomas Cort FIELDTYPE *link_fieldtype(FIELDTYPE *, FIELDTYPE *); 341a0e6850fSThomas Cort int move_field(FIELD *, int, int); 342a0e6850fSThomas Cort FIELD *new_field(int, int, int, int, int, int); 343a0e6850fSThomas Cort FIELDTYPE *new_fieldtype(int (* field_check)(FIELD *, char *), 344a0e6850fSThomas Cort int (* char_check)(int, char *)); 345a0e6850fSThomas Cort FORM *new_form(FIELD **); 346a0e6850fSThomas Cort int new_page(FIELD *); 347a0e6850fSThomas Cort int pos_form_cursor(FORM *); 348a0e6850fSThomas Cort int post_form(FORM *); 349a0e6850fSThomas Cort int scale_form(FORM *, int *, int *); 350a0e6850fSThomas Cort int set_current_field(FORM *, FIELD *); 351a0e6850fSThomas Cort int set_field_back(FIELD *, chtype); 352*0a6a1f1dSLionel Sambuc int set_field_buffer(FIELD *, int, const char *); 353a0e6850fSThomas Cort int set_field_fore(FIELD *, chtype); 354a0e6850fSThomas Cort int set_field_init(FORM *, Form_Hook); 355a0e6850fSThomas Cort int set_field_just(FIELD *, int); 356a0e6850fSThomas Cort int set_field_opts(FIELD *, Form_Options); 357a0e6850fSThomas Cort int set_field_pad(FIELD *, int); 358a0e6850fSThomas Cort int set_field_printf(FIELD *, int, char *, ...) __printflike(3, 4); 359a0e6850fSThomas Cort int set_field_status(FIELD *, int); 360a0e6850fSThomas Cort int set_field_term(FORM *, Form_Hook); 361a0e6850fSThomas Cort int set_field_type(FIELD *, FIELDTYPE *, ...); 362a0e6850fSThomas Cort int set_field_userptr(FIELD *, void *); 363a0e6850fSThomas Cort int set_fieldtype_arg(FIELDTYPE *, char *(*)(va_list *), 364a0e6850fSThomas Cort char *(*)(char *), 365a0e6850fSThomas Cort void (*)(char *)); 366a0e6850fSThomas Cort int set_fieldtype_choice(FIELDTYPE *, int (*)(FIELD *, char *), 367a0e6850fSThomas Cort int (*)(FIELD *, char *)); 368a0e6850fSThomas Cort int set_form_fields(FORM *, FIELD **); 369a0e6850fSThomas Cort int set_form_init(FORM *, Form_Hook); 370a0e6850fSThomas Cort int set_form_opts(FORM *, Form_Options); 371a0e6850fSThomas Cort int set_form_page(FORM *, int); 372a0e6850fSThomas Cort int set_form_sub(FORM *, WINDOW *); 373a0e6850fSThomas Cort int set_form_term(FORM *, Form_Hook); 374a0e6850fSThomas Cort int set_form_userptr(FORM *, void *); 375a0e6850fSThomas Cort int set_form_win(FORM *, WINDOW *); 376a0e6850fSThomas Cort int set_max_field(FIELD *, int); 377a0e6850fSThomas Cort int set_new_page(FIELD *, int); 378a0e6850fSThomas Cort int unpost_form(FORM *); 379a0e6850fSThomas Cort 380a0e6850fSThomas Cort __END_DECLS 381a0e6850fSThomas Cort 382a0e6850fSThomas Cort #endif /* FORM_H */ 383