1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate * CDDL HEADER START
3*0Sstevel@tonic-gate *
4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance
7*0Sstevel@tonic-gate * with the License.
8*0Sstevel@tonic-gate *
9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate * and limitations under the License.
13*0Sstevel@tonic-gate *
14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate *
20*0Sstevel@tonic-gate * CDDL HEADER END
21*0Sstevel@tonic-gate */
22*0Sstevel@tonic-gate /* Copyright (c) 1988 AT&T */
23*0Sstevel@tonic-gate /* All Rights Reserved */
24*0Sstevel@tonic-gate
25*0Sstevel@tonic-gate
26*0Sstevel@tonic-gate /*
27*0Sstevel@tonic-gate * Copyright (c) 1997, by Sun Microsystems, Inc.
28*0Sstevel@tonic-gate * All rights reserved.
29*0Sstevel@tonic-gate */
30*0Sstevel@tonic-gate
31*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI"
32*0Sstevel@tonic-gate
33*0Sstevel@tonic-gate /*LINTLIBRARY*/
34*0Sstevel@tonic-gate
35*0Sstevel@tonic-gate #include <sys/types.h>
36*0Sstevel@tonic-gate #include <stdlib.h>
37*0Sstevel@tonic-gate #include "utility.h"
38*0Sstevel@tonic-gate
39*0Sstevel@tonic-gate /*
40*0Sstevel@tonic-gate * default field
41*0Sstevel@tonic-gate */
42*0Sstevel@tonic-gate
43*0Sstevel@tonic-gate static FIELD default_field =
44*0Sstevel@tonic-gate {
45*0Sstevel@tonic-gate 0, /* status */
46*0Sstevel@tonic-gate 0, /* rows */
47*0Sstevel@tonic-gate 0, /* cols */
48*0Sstevel@tonic-gate 0, /* frow */
49*0Sstevel@tonic-gate 0, /* fcol */
50*0Sstevel@tonic-gate 0, /* drows */
51*0Sstevel@tonic-gate 0, /* dcols */
52*0Sstevel@tonic-gate 0, /* maxgrow */
53*0Sstevel@tonic-gate 0, /* nrow */
54*0Sstevel@tonic-gate 0, /* nbuf */
55*0Sstevel@tonic-gate NO_JUSTIFICATION, /* just */
56*0Sstevel@tonic-gate 0, /* page */
57*0Sstevel@tonic-gate 0, /* index */
58*0Sstevel@tonic-gate ' ', /* pad */
59*0Sstevel@tonic-gate A_NORMAL, /* fore */
60*0Sstevel@tonic-gate A_NORMAL, /* back */
61*0Sstevel@tonic-gate O_VISIBLE |
62*0Sstevel@tonic-gate O_ACTIVE |
63*0Sstevel@tonic-gate O_PUBLIC |
64*0Sstevel@tonic-gate O_EDIT |
65*0Sstevel@tonic-gate O_WRAP |
66*0Sstevel@tonic-gate O_BLANK |
67*0Sstevel@tonic-gate O_AUTOSKIP |
68*0Sstevel@tonic-gate O_NULLOK |
69*0Sstevel@tonic-gate O_PASSOK |
70*0Sstevel@tonic-gate O_STATIC, /* opts */
71*0Sstevel@tonic-gate (FIELD *)0, /* snext */
72*0Sstevel@tonic-gate (FIELD *)0, /* sprev */
73*0Sstevel@tonic-gate (FIELD *)0, /* link */
74*0Sstevel@tonic-gate (FORM *)0, /* form */
75*0Sstevel@tonic-gate (FIELDTYPE *)0, /* type */
76*0Sstevel@tonic-gate (char *)0, /* arg */
77*0Sstevel@tonic-gate (char *)0, /* buf */
78*0Sstevel@tonic-gate (char *)0, /* usrptr */
79*0Sstevel@tonic-gate };
80*0Sstevel@tonic-gate
81*0Sstevel@tonic-gate FIELD * _DEFAULT_FIELD = &default_field;
82*0Sstevel@tonic-gate
83*0Sstevel@tonic-gate /*
84*0Sstevel@tonic-gate * MakeType
85*0Sstevel@tonic-gate */
86*0Sstevel@tonic-gate
87*0Sstevel@tonic-gate static int
MakeType(FIELD * f,va_list * ap)88*0Sstevel@tonic-gate MakeType(FIELD *f, va_list *ap)
89*0Sstevel@tonic-gate {
90*0Sstevel@tonic-gate int err = 0;
91*0Sstevel@tonic-gate
92*0Sstevel@tonic-gate f->arg = MakeArg(f, ap, &err); /* pick off type specific args */
93*0Sstevel@tonic-gate
94*0Sstevel@tonic-gate if (err) {
95*0Sstevel@tonic-gate FreeArg(f); /* release type specific args */
96*0Sstevel@tonic-gate f->type = (FIELDTYPE *)0;
97*0Sstevel@tonic-gate f->arg = (char *)0;
98*0Sstevel@tonic-gate return (FALSE);
99*0Sstevel@tonic-gate }
100*0Sstevel@tonic-gate IncrType(f->type); /* increment reference count */
101*0Sstevel@tonic-gate return (TRUE);
102*0Sstevel@tonic-gate }
103*0Sstevel@tonic-gate
104*0Sstevel@tonic-gate /*
105*0Sstevel@tonic-gate * CopyType
106*0Sstevel@tonic-gate */
107*0Sstevel@tonic-gate
108*0Sstevel@tonic-gate static int
CopyType(FIELD * f,FIELD * fsrc)109*0Sstevel@tonic-gate CopyType(FIELD *f, FIELD *fsrc)
110*0Sstevel@tonic-gate {
111*0Sstevel@tonic-gate int err = 0;
112*0Sstevel@tonic-gate
113*0Sstevel@tonic-gate f->type = fsrc->type; /* copy field type */
114*0Sstevel@tonic-gate f->arg = CopyArg(fsrc, &err); /* copy type specific info */
115*0Sstevel@tonic-gate
116*0Sstevel@tonic-gate if (err) {
117*0Sstevel@tonic-gate FreeArg(f); /* release type specific args */
118*0Sstevel@tonic-gate f->type = (FIELDTYPE *)0;
119*0Sstevel@tonic-gate f->arg = (char *)0;
120*0Sstevel@tonic-gate return (FALSE);
121*0Sstevel@tonic-gate }
122*0Sstevel@tonic-gate IncrType(f->type); /* increment reference count */
123*0Sstevel@tonic-gate return (TRUE);
124*0Sstevel@tonic-gate }
125*0Sstevel@tonic-gate
126*0Sstevel@tonic-gate /*
127*0Sstevel@tonic-gate * FreeType
128*0Sstevel@tonic-gate */
129*0Sstevel@tonic-gate
130*0Sstevel@tonic-gate static void
FreeType(FIELD * f)131*0Sstevel@tonic-gate FreeType(FIELD *f)
132*0Sstevel@tonic-gate {
133*0Sstevel@tonic-gate DecrType(f->type); /* decrement reference count */
134*0Sstevel@tonic-gate FreeArg(f); /* release type specific args */
135*0Sstevel@tonic-gate }
136*0Sstevel@tonic-gate
137*0Sstevel@tonic-gate /*
138*0Sstevel@tonic-gate * new_field
139*0Sstevel@tonic-gate */
140*0Sstevel@tonic-gate
141*0Sstevel@tonic-gate FIELD *
new_field(int rows,int cols,int frow,int fcol,int nrow,int nbuf)142*0Sstevel@tonic-gate new_field(int rows, int cols, int frow, int fcol, int nrow, int nbuf)
143*0Sstevel@tonic-gate
144*0Sstevel@tonic-gate /* int rows; number of visible rows */
145*0Sstevel@tonic-gate /* int cols; number of visible cols */
146*0Sstevel@tonic-gate /* int frow; first row relative to form origin */
147*0Sstevel@tonic-gate /* int fcol; first col relative to form origin */
148*0Sstevel@tonic-gate /* int nrow; number of off screen rows */
149*0Sstevel@tonic-gate /* int nbuf; number of additional buffers */
150*0Sstevel@tonic-gate {
151*0Sstevel@tonic-gate FIELD *f = (FIELD *) 0;
152*0Sstevel@tonic-gate int i, size;
153*0Sstevel@tonic-gate
154*0Sstevel@tonic-gate if (rows > 0 && cols > 0 && frow >= 0 && fcol >= 0 && nrow >= 0 &&
155*0Sstevel@tonic-gate nbuf >= 0 && Alloc(f, FIELD)) {
156*0Sstevel@tonic-gate *f = *_DEFAULT_FIELD;
157*0Sstevel@tonic-gate
158*0Sstevel@tonic-gate f->rows = rows;
159*0Sstevel@tonic-gate f->cols = cols;
160*0Sstevel@tonic-gate f->frow = frow;
161*0Sstevel@tonic-gate f->fcol = fcol;
162*0Sstevel@tonic-gate f->drows = rows + nrow;
163*0Sstevel@tonic-gate f->dcols = cols;
164*0Sstevel@tonic-gate f->nrow = nrow;
165*0Sstevel@tonic-gate f->nbuf = nbuf;
166*0Sstevel@tonic-gate f->link = f;
167*0Sstevel@tonic-gate
168*0Sstevel@tonic-gate if (CopyType(f, _DEFAULT_FIELD)) {
169*0Sstevel@tonic-gate size = TotalBuf(f);
170*0Sstevel@tonic-gate
171*0Sstevel@tonic-gate if (arrayAlloc(Buf(f), size, char)) {
172*0Sstevel@tonic-gate (void) memset(Buf(f), ' ', size);
173*0Sstevel@tonic-gate
174*0Sstevel@tonic-gate for (i = 0; i <= f->nbuf; ++i)
175*0Sstevel@tonic-gate *(Buffer(f, i + 1) - 1) = '\0';
176*0Sstevel@tonic-gate return (f);
177*0Sstevel@tonic-gate }
178*0Sstevel@tonic-gate }
179*0Sstevel@tonic-gate }
180*0Sstevel@tonic-gate (void) free_field(f);
181*0Sstevel@tonic-gate return ((FIELD *) 0);
182*0Sstevel@tonic-gate }
183*0Sstevel@tonic-gate
184*0Sstevel@tonic-gate /*
185*0Sstevel@tonic-gate * dup_field
186*0Sstevel@tonic-gate */
187*0Sstevel@tonic-gate
188*0Sstevel@tonic-gate FIELD *
dup_field(FIELD * field,int frow,int fcol)189*0Sstevel@tonic-gate dup_field(FIELD *field, int frow, int fcol)
190*0Sstevel@tonic-gate
191*0Sstevel@tonic-gate /* FIELD * field; field to duplicate */
192*0Sstevel@tonic-gate /* int frow; first row relative to form origin */
193*0Sstevel@tonic-gate /* int fcol; first col relative to form origin */
194*0Sstevel@tonic-gate {
195*0Sstevel@tonic-gate FIELD *f = (FIELD *) 0;
196*0Sstevel@tonic-gate int size;
197*0Sstevel@tonic-gate
198*0Sstevel@tonic-gate if (field && frow >= 0 && fcol >= 0 && Alloc(f, FIELD)) {
199*0Sstevel@tonic-gate *f = *_DEFAULT_FIELD;
200*0Sstevel@tonic-gate
201*0Sstevel@tonic-gate f->frow = frow;
202*0Sstevel@tonic-gate f->fcol = fcol;
203*0Sstevel@tonic-gate f->link = f;
204*0Sstevel@tonic-gate
205*0Sstevel@tonic-gate f->rows = field->rows;
206*0Sstevel@tonic-gate f->cols = field->cols;
207*0Sstevel@tonic-gate f->drows = field->drows;
208*0Sstevel@tonic-gate f->dcols = field->dcols;
209*0Sstevel@tonic-gate f->maxgrow = field->maxgrow;
210*0Sstevel@tonic-gate f->nrow = field->nrow;
211*0Sstevel@tonic-gate f->nbuf = field->nbuf;
212*0Sstevel@tonic-gate f->just = field->just;
213*0Sstevel@tonic-gate f->fore = field->fore;
214*0Sstevel@tonic-gate f->back = field->back;
215*0Sstevel@tonic-gate f->pad = field->pad;
216*0Sstevel@tonic-gate f->opts = field->opts;
217*0Sstevel@tonic-gate f->usrptr = field->usrptr;
218*0Sstevel@tonic-gate f->status = Status(field, GROWABLE);
219*0Sstevel@tonic-gate
220*0Sstevel@tonic-gate if (CopyType(f, field)) {
221*0Sstevel@tonic-gate size = TotalBuf(f);
222*0Sstevel@tonic-gate
223*0Sstevel@tonic-gate if (arrayAlloc(Buf(f), size, char)) {
224*0Sstevel@tonic-gate (void) memcpy(Buf(f), Buf(field), size);
225*0Sstevel@tonic-gate return (f);
226*0Sstevel@tonic-gate }
227*0Sstevel@tonic-gate }
228*0Sstevel@tonic-gate }
229*0Sstevel@tonic-gate (void) free_field(f);
230*0Sstevel@tonic-gate return ((FIELD *) 0);
231*0Sstevel@tonic-gate }
232*0Sstevel@tonic-gate
233*0Sstevel@tonic-gate /*
234*0Sstevel@tonic-gate * link_field
235*0Sstevel@tonic-gate */
236*0Sstevel@tonic-gate
237*0Sstevel@tonic-gate FIELD *
link_field(FIELD * field,int frow,int fcol)238*0Sstevel@tonic-gate link_field(FIELD *field, int frow, int fcol)
239*0Sstevel@tonic-gate
240*0Sstevel@tonic-gate /* FIELD * field; field to link to */
241*0Sstevel@tonic-gate /* int frow; first row relative to form origin */
242*0Sstevel@tonic-gate /* int fcol; first col relative to form origin */
243*0Sstevel@tonic-gate {
244*0Sstevel@tonic-gate FIELD *f = (FIELD *) 0;
245*0Sstevel@tonic-gate
246*0Sstevel@tonic-gate if (field && frow >= 0 && fcol >= 0 && Alloc(f, FIELD)) {
247*0Sstevel@tonic-gate *f = *_DEFAULT_FIELD;
248*0Sstevel@tonic-gate
249*0Sstevel@tonic-gate f->frow = frow;
250*0Sstevel@tonic-gate f->fcol = fcol;
251*0Sstevel@tonic-gate
252*0Sstevel@tonic-gate f->link = field->link;
253*0Sstevel@tonic-gate field->link = f; /* add field to linked list */
254*0Sstevel@tonic-gate
255*0Sstevel@tonic-gate f->buf = field->buf;
256*0Sstevel@tonic-gate f->rows = field->rows;
257*0Sstevel@tonic-gate f->cols = field->cols;
258*0Sstevel@tonic-gate f->drows = field->drows;
259*0Sstevel@tonic-gate f->dcols = field->dcols;
260*0Sstevel@tonic-gate f->maxgrow = field->maxgrow;
261*0Sstevel@tonic-gate f->nrow = field->nrow;
262*0Sstevel@tonic-gate f->nbuf = field->nbuf;
263*0Sstevel@tonic-gate f->just = field->just;
264*0Sstevel@tonic-gate f->fore = field->fore;
265*0Sstevel@tonic-gate f->back = field->back;
266*0Sstevel@tonic-gate f->pad = field->pad;
267*0Sstevel@tonic-gate f->opts = field->opts;
268*0Sstevel@tonic-gate f->usrptr = field->usrptr;
269*0Sstevel@tonic-gate f->status = Status(field, GROWABLE);
270*0Sstevel@tonic-gate
271*0Sstevel@tonic-gate if (CopyType(f, field))
272*0Sstevel@tonic-gate return (f);
273*0Sstevel@tonic-gate }
274*0Sstevel@tonic-gate (void) free_field(f);
275*0Sstevel@tonic-gate return ((FIELD *) 0);
276*0Sstevel@tonic-gate }
277*0Sstevel@tonic-gate
278*0Sstevel@tonic-gate /*
279*0Sstevel@tonic-gate * free_field
280*0Sstevel@tonic-gate */
281*0Sstevel@tonic-gate
282*0Sstevel@tonic-gate int
free_field(FIELD * f)283*0Sstevel@tonic-gate free_field(FIELD *f)
284*0Sstevel@tonic-gate {
285*0Sstevel@tonic-gate FIELD *p;
286*0Sstevel@tonic-gate
287*0Sstevel@tonic-gate if (!f)
288*0Sstevel@tonic-gate return (E_BAD_ARGUMENT);
289*0Sstevel@tonic-gate
290*0Sstevel@tonic-gate if (f->form)
291*0Sstevel@tonic-gate return (E_CONNECTED);
292*0Sstevel@tonic-gate
293*0Sstevel@tonic-gate if (f->link != f) { /* check for linked field */
294*0Sstevel@tonic-gate for (p = f->link; p->link != f; p = p->link)
295*0Sstevel@tonic-gate ;
296*0Sstevel@tonic-gate p->link = f->link; /* delete from list */
297*0Sstevel@tonic-gate } else
298*0Sstevel@tonic-gate Free(Buf(f)); /* free buffer space */
299*0Sstevel@tonic-gate
300*0Sstevel@tonic-gate FreeType(f);
301*0Sstevel@tonic-gate Free(f);
302*0Sstevel@tonic-gate return (E_OK);
303*0Sstevel@tonic-gate }
304*0Sstevel@tonic-gate
305*0Sstevel@tonic-gate /*
306*0Sstevel@tonic-gate * field_info
307*0Sstevel@tonic-gate */
308*0Sstevel@tonic-gate
309*0Sstevel@tonic-gate int
field_info(FIELD * f,int * rows,int * cols,int * frow,int * fcol,int * nrow,int * nbuf)310*0Sstevel@tonic-gate field_info(FIELD *f, int *rows, int *cols, int *frow, int *fcol,
311*0Sstevel@tonic-gate int *nrow, int *nbuf)
312*0Sstevel@tonic-gate
313*0Sstevel@tonic-gate /* FIELD *f; field whose information is wanted */
314*0Sstevel@tonic-gate /* int *rows; number of visible rows */
315*0Sstevel@tonic-gate /* int *cols; number of visible cols */
316*0Sstevel@tonic-gate /* int *frow; first row relative to form origin */
317*0Sstevel@tonic-gate /* int *fcol; first col relative to form origin */
318*0Sstevel@tonic-gate /* int *nrow; number of off screen rows */
319*0Sstevel@tonic-gate /* int *nbuf; number of additional buffers */
320*0Sstevel@tonic-gate {
321*0Sstevel@tonic-gate if (!f)
322*0Sstevel@tonic-gate return (E_BAD_ARGUMENT);
323*0Sstevel@tonic-gate
324*0Sstevel@tonic-gate *rows = f->rows;
325*0Sstevel@tonic-gate *cols = f->cols;
326*0Sstevel@tonic-gate *frow = f->frow;
327*0Sstevel@tonic-gate *fcol = f->fcol;
328*0Sstevel@tonic-gate *nrow = f->nrow;
329*0Sstevel@tonic-gate *nbuf = f->nbuf;
330*0Sstevel@tonic-gate return (E_OK);
331*0Sstevel@tonic-gate }
332*0Sstevel@tonic-gate
333*0Sstevel@tonic-gate /*
334*0Sstevel@tonic-gate * set_max_field
335*0Sstevel@tonic-gate */
336*0Sstevel@tonic-gate
337*0Sstevel@tonic-gate int
set_max_field(FIELD * f,int max)338*0Sstevel@tonic-gate set_max_field(FIELD *f, int max)
339*0Sstevel@tonic-gate {
340*0Sstevel@tonic-gate BOOLEAN onerow = OneRow(f);
341*0Sstevel@tonic-gate
342*0Sstevel@tonic-gate if (!f || max && ((onerow && f->dcols > max) ||
343*0Sstevel@tonic-gate (!onerow && f->drows > max)))
344*0Sstevel@tonic-gate return (E_BAD_ARGUMENT);
345*0Sstevel@tonic-gate
346*0Sstevel@tonic-gate f->maxgrow = max;
347*0Sstevel@tonic-gate Clr(f, GROWABLE);
348*0Sstevel@tonic-gate
349*0Sstevel@tonic-gate if (!Opt(f, O_STATIC) && ((!max || onerow && f->dcols < max) ||
350*0Sstevel@tonic-gate (!onerow && f->drows < max))) {
351*0Sstevel@tonic-gate Set(f, GROWABLE);
352*0Sstevel@tonic-gate }
353*0Sstevel@tonic-gate
354*0Sstevel@tonic-gate return (E_OK);
355*0Sstevel@tonic-gate }
356*0Sstevel@tonic-gate
357*0Sstevel@tonic-gate /*
358*0Sstevel@tonic-gate * dynamic_field_info
359*0Sstevel@tonic-gate */
360*0Sstevel@tonic-gate
361*0Sstevel@tonic-gate int
dynamic_field_info(FIELD * f,int * drows,int * dcols,int * max)362*0Sstevel@tonic-gate dynamic_field_info(FIELD *f, int *drows, int *dcols, int *max)
363*0Sstevel@tonic-gate
364*0Sstevel@tonic-gate /* FIELD *f; field whose information is wanted */
365*0Sstevel@tonic-gate /* int *drows; number of actual rows */
366*0Sstevel@tonic-gate /* int *dcols; number of actual cols */
367*0Sstevel@tonic-gate /* int *max; maximum growth allowable, else -1 */
368*0Sstevel@tonic-gate {
369*0Sstevel@tonic-gate if (!f)
370*0Sstevel@tonic-gate return (E_BAD_ARGUMENT);
371*0Sstevel@tonic-gate
372*0Sstevel@tonic-gate *drows = f->drows;
373*0Sstevel@tonic-gate *dcols = f->dcols;
374*0Sstevel@tonic-gate *max = f->maxgrow;
375*0Sstevel@tonic-gate return (E_OK);
376*0Sstevel@tonic-gate }
377*0Sstevel@tonic-gate
378*0Sstevel@tonic-gate /*
379*0Sstevel@tonic-gate * move_field
380*0Sstevel@tonic-gate */
381*0Sstevel@tonic-gate
382*0Sstevel@tonic-gate int
move_field(FIELD * f,int frow,int fcol)383*0Sstevel@tonic-gate move_field(FIELD *f, int frow, int fcol)
384*0Sstevel@tonic-gate
385*0Sstevel@tonic-gate /* FIELD *f; field to move */
386*0Sstevel@tonic-gate /* int frow; first row relative to form origin */
387*0Sstevel@tonic-gate /* int fcol; first col relative to form origin */
388*0Sstevel@tonic-gate {
389*0Sstevel@tonic-gate if (! f || frow < 0 || fcol < 0)
390*0Sstevel@tonic-gate return (E_BAD_ARGUMENT);
391*0Sstevel@tonic-gate
392*0Sstevel@tonic-gate if (f->form)
393*0Sstevel@tonic-gate return (E_CONNECTED);
394*0Sstevel@tonic-gate
395*0Sstevel@tonic-gate f->frow = frow;
396*0Sstevel@tonic-gate f->fcol = fcol;
397*0Sstevel@tonic-gate return (E_OK);
398*0Sstevel@tonic-gate }
399*0Sstevel@tonic-gate
400*0Sstevel@tonic-gate /*
401*0Sstevel@tonic-gate * set_field_type
402*0Sstevel@tonic-gate */
403*0Sstevel@tonic-gate
404*0Sstevel@tonic-gate int
set_field_type(FIELD * f,FIELDTYPE * ft,...)405*0Sstevel@tonic-gate set_field_type(FIELD *f, FIELDTYPE *ft, ...)
406*0Sstevel@tonic-gate {
407*0Sstevel@tonic-gate va_list ap;
408*0Sstevel@tonic-gate int v = E_SYSTEM_ERROR;
409*0Sstevel@tonic-gate
410*0Sstevel@tonic-gate va_start(ap, ft);
411*0Sstevel@tonic-gate f = Field(f);
412*0Sstevel@tonic-gate FreeType(f); /* free old type */
413*0Sstevel@tonic-gate f->type = ft;
414*0Sstevel@tonic-gate
415*0Sstevel@tonic-gate if (MakeType(f, &ap)) /* set up new type */
416*0Sstevel@tonic-gate v = E_OK;
417*0Sstevel@tonic-gate va_end(ap);
418*0Sstevel@tonic-gate return (v);
419*0Sstevel@tonic-gate }
420*0Sstevel@tonic-gate
421*0Sstevel@tonic-gate FIELDTYPE *
field_type(FIELD * f)422*0Sstevel@tonic-gate field_type(FIELD *f)
423*0Sstevel@tonic-gate {
424*0Sstevel@tonic-gate return (Field(f)->type);
425*0Sstevel@tonic-gate }
426*0Sstevel@tonic-gate
427*0Sstevel@tonic-gate char *
field_arg(FIELD * f)428*0Sstevel@tonic-gate field_arg(FIELD *f)
429*0Sstevel@tonic-gate {
430*0Sstevel@tonic-gate return (Field(f)->arg);
431*0Sstevel@tonic-gate }
432*0Sstevel@tonic-gate
433*0Sstevel@tonic-gate /*
434*0Sstevel@tonic-gate * set_new_page
435*0Sstevel@tonic-gate */
436*0Sstevel@tonic-gate
437*0Sstevel@tonic-gate int
set_new_page(FIELD * f,int flag)438*0Sstevel@tonic-gate set_new_page(FIELD *f, int flag)
439*0Sstevel@tonic-gate {
440*0Sstevel@tonic-gate f = Field(f);
441*0Sstevel@tonic-gate
442*0Sstevel@tonic-gate if (f->form)
443*0Sstevel@tonic-gate return (E_CONNECTED);
444*0Sstevel@tonic-gate
445*0Sstevel@tonic-gate if (flag)
446*0Sstevel@tonic-gate Set(f, NEW_PAGE);
447*0Sstevel@tonic-gate else
448*0Sstevel@tonic-gate Clr(f, NEW_PAGE);
449*0Sstevel@tonic-gate
450*0Sstevel@tonic-gate return (E_OK);
451*0Sstevel@tonic-gate }
452*0Sstevel@tonic-gate
453*0Sstevel@tonic-gate int
new_page(FIELD * f)454*0Sstevel@tonic-gate new_page(FIELD *f)
455*0Sstevel@tonic-gate {
456*0Sstevel@tonic-gate if (Status(Field(f), NEW_PAGE))
457*0Sstevel@tonic-gate return (TRUE);
458*0Sstevel@tonic-gate else
459*0Sstevel@tonic-gate return (FALSE);
460*0Sstevel@tonic-gate }
461