/*
 * $Copyright:	$
 * Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989, 1990 
 * Sequent Computer Systems, Inc.   All rights reserved.
 *  
 * This software is furnished under a license and may be used
 * only in accordance with the terms of that license and with the
 * inclusion of the above copyright notice.   This software may not
 * be provided or otherwise made available to, or used by, any
 * other person.  No title to or ownership of the software is
 * hereby transferred."
 *
 */
/*	Copyright (c) 1984 AT&T	*/
/*	  All Rights Reserved  	*/

/*	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T	*/
/*	The copyright notice above does not evidence any   	*/
/*	actual or intended publication of such source code.	*/

/*
 * Copyright  (c) 1985 AT&T
 *	All Rights Reserved
 */
#ident	"$Header: fcustom.c 1.3 89/10/10 $@(#)vm.form:src/form/fcustom.c	1.3"

#include <stdio.h>
#include "wish.h"
#include	"token.h"
#include	"winp.h"
#include	"form.h"
#include "var_arrays.h"

form_id
form_custom(vid, flags, rows, cols, disp, ptr)
vt_id vid;
unsigned flags;
int rows, cols;
formfield (*disp)();
char *ptr;
{
	register int	num;
	register struct form	*f;

	/* find a free form structure */
	for (f = FORM_array, num = array_len(FORM_array); num > 0; f++, num--)
		if (!(f->flags & FORM_USED))
			break;
	if (num <= 0) {
		var_append(struct form, FORM_array, NULL);
		f = &FORM_array[array_len(FORM_array) - 1];
	}
	/* set up f */
	f->display = disp;
	f->argptr = ptr;
	f->flags = FORM_USED | FORM_DIRTY;
	f->vid = vid;
	f->rows = rows;
	f->cols = cols;

	return(f - FORM_array);
}
