xref: /netbsd-src/lib/libform/internals.h (revision 5aefcfdc06931dd97e76246d2fe0302f7b3fe094)
1 /*	$NetBSD: internals.h,v 1.1 2000/12/17 12:04:30 blymn Exp $	*/
2 
3 /*-
4  * Copyright (c) 1998-1999 Brett Lymn
5  *                         (blymn@baea.com.au, brett_lymn@yahoo.com.au)
6  * All rights reserved.
7  *
8  * This code has been donated to The NetBSD Foundation by the Author.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. The name of the author may not be used to endorse or promote products
16  *    derived from this software withough specific prior written permission
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  *
29  *
30  */
31 
32 #include "form.h"
33 
34 #ifndef FORMI_INTERNALS_H
35 #define FORMI_INTERNALS_H 1
36 
37 /* direction definitions for _formi_pos_new_field */
38 #define _FORMI_BACKWARD 1
39 #define _FORMI_FORWARD  2
40 
41 /* define the default options for a form... */
42 #define DEFAULT_FORM_OPTS (O_VISIBLE | O_ACTIVE | O_PUBLIC | O_EDIT | \
43                            O_WRAP | O_BLANK | O_AUTOSKIP | O_NULLOK | \
44                            O_PASSOK | O_STATIC)
45 
46 /* definitions of the flags for the FIELDTYPE structure */
47 #define _TYPE_NO_FLAGS   0
48 #define _TYPE_HAS_ARGS   0x01
49 #define _TYPE_IS_LINKED  0x02
50 #define _TYPE_IS_BUILTIN 0x04
51 #define _TYPE_HAS_CHOICE 0x08
52 
53 typedef struct formi_type_link_struct formi_type_link;
54 
55 struct formi_type_link_struct
56 {
57 	FIELDTYPE *next;
58 	FIELDTYPE *prev;
59 };
60 
61 
62 struct _formi_page_struct
63 {
64 	int in_use;
65 	int first;
66 	int last;
67 	int top_left;
68 	int bottom_right;
69 };
70 
71 /* function prototypes */
72 unsigned
73 skip_blanks(char *, unsigned int);
74 int
75 _formi_add_char(FIELD *cur, unsigned pos, char c);
76 int
77 _formi_draw_page(FORM *form);
78 int
79 _formi_find_bol(const char *string, unsigned int offset);
80 int
81 _formi_find_eol(const char *string, unsigned int offset);
82 int
83 _formi_find_pages(FORM *form);
84 int
85 _formi_field_choice(FORM *form, int c);
86 int
87 _formi_manipulate_field(FORM *form, int c);
88 int
89 _formi_pos_first_field(FORM *form);
90 int
91 _formi_pos_new_field(FORM *form, unsigned direction, unsigned use_sorted);
92 void
93 _formi_sort_fields(FORM *form);
94 void
95 _formi_stitch_fields(FORM *form);
96 int
97 _formi_update_field(FORM *form, int old_field);
98 int
99 _formi_validate_field(FORM *form);
100 
101 #endif
102 
103 
104 
105