1999-08-24 01:06:48 +00:00
|
|
|
/****************************************************************************
|
2020-02-19 16:58:06 +00:00
|
|
|
* Copyright 2020 Thomas E. Dickey *
|
|
|
|
* Copyright 1998-2012,2014 Free Software Foundation, Inc. *
|
1999-08-24 01:06:48 +00:00
|
|
|
* *
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a *
|
|
|
|
* copy of this software and associated documentation files (the *
|
|
|
|
* "Software"), to deal in the Software without restriction, including *
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish, *
|
|
|
|
* distribute, distribute with modifications, sublicense, and/or sell *
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is *
|
|
|
|
* furnished to do so, subject to the following conditions: *
|
|
|
|
* *
|
|
|
|
* The above copyright notice and this permission notice shall be included *
|
|
|
|
* in all copies or substantial portions of the Software. *
|
|
|
|
* *
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
|
|
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
|
|
|
|
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
|
|
|
|
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
|
|
|
|
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
|
|
|
|
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
|
|
|
* *
|
|
|
|
* Except as contained in this notice, the name(s) of the above copyright *
|
|
|
|
* holders shall not be used in advertising or otherwise to promote the *
|
|
|
|
* sale, use or other dealings in this Software without prior written *
|
|
|
|
* authorization. *
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
2007-01-20 07:32:02 +00:00
|
|
|
* Author: Juergen Pfeifer, 1995,1997 *
|
1999-08-24 01:06:48 +00:00
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include "form.priv.h"
|
|
|
|
|
2020-02-19 16:58:06 +00:00
|
|
|
MODULE_ID("$Id: fld_def.c,v 1.42 2020/02/02 23:34:34 tom Exp $")
|
1999-08-24 01:06:48 +00:00
|
|
|
|
|
|
|
/* this can't be readonly */
|
2007-01-20 07:32:02 +00:00
|
|
|
static FIELD default_field =
|
|
|
|
{
|
|
|
|
0, /* status */
|
|
|
|
0, /* rows */
|
|
|
|
0, /* cols */
|
|
|
|
0, /* frow */
|
|
|
|
0, /* fcol */
|
|
|
|
0, /* drows */
|
|
|
|
0, /* dcols */
|
|
|
|
0, /* maxgrow */
|
|
|
|
0, /* nrow */
|
|
|
|
0, /* nbuf */
|
|
|
|
NO_JUSTIFICATION, /* just */
|
|
|
|
0, /* page */
|
|
|
|
0, /* index */
|
|
|
|
(int)' ', /* pad */
|
|
|
|
A_NORMAL, /* fore */
|
|
|
|
A_NORMAL, /* back */
|
2020-02-07 08:36:41 +00:00
|
|
|
STD_FIELD_OPTS, /* opts */
|
2007-01-20 07:32:02 +00:00
|
|
|
(FIELD *)0, /* snext */
|
|
|
|
(FIELD *)0, /* sprev */
|
|
|
|
(FIELD *)0, /* link */
|
|
|
|
(FORM *)0, /* form */
|
|
|
|
(FIELDTYPE *)0, /* type */
|
|
|
|
(char *)0, /* arg */
|
|
|
|
(FIELD_CELL *)0, /* buf */
|
|
|
|
(char *)0 /* usrptr */
|
|
|
|
NCURSES_FIELD_EXTENSION
|
1999-08-24 01:06:48 +00:00
|
|
|
};
|
|
|
|
|
2014-03-01 00:40:26 +00:00
|
|
|
NCURSES_EXPORT_VAR(FIELD *) _nc_Default_Field = &default_field;
|
2007-01-20 07:32:02 +00:00
|
|
|
|
1999-08-24 01:06:48 +00:00
|
|
|
/*---------------------------------------------------------------------------
|
2007-01-20 07:32:02 +00:00
|
|
|
| Facility : libnform
|
1999-08-24 01:06:48 +00:00
|
|
|
| Function : TypeArgument *_nc_Make_Argument(
|
|
|
|
| const FIELDTYPE *typ,
|
|
|
|
| va_list *ap,
|
|
|
|
| int *err )
|
2007-01-20 07:32:02 +00:00
|
|
|
|
|
1999-08-24 01:06:48 +00:00
|
|
|
| Description : Create an argument structure for the specified type.
|
2007-01-20 07:32:02 +00:00
|
|
|
| Use the type-dependent argument list to construct
|
1999-08-24 01:06:48 +00:00
|
|
|
| it.
|
|
|
|
|
|
|
|
|
| Return Values : Pointer to argument structure. Maybe NULL.
|
2007-01-20 07:32:02 +00:00
|
|
|
| In case of an error in *err an error counter is increased.
|
1999-08-24 01:06:48 +00:00
|
|
|
+--------------------------------------------------------------------------*/
|
2007-01-20 07:32:02 +00:00
|
|
|
NCURSES_EXPORT(TypeArgument *)
|
|
|
|
_nc_Make_Argument(const FIELDTYPE *typ, va_list *ap, int *err)
|
1999-08-24 01:06:48 +00:00
|
|
|
{
|
2007-01-20 07:32:02 +00:00
|
|
|
TypeArgument *res = (TypeArgument *)0;
|
1999-08-24 01:06:48 +00:00
|
|
|
TypeArgument *p;
|
|
|
|
|
2007-01-20 07:32:02 +00:00
|
|
|
if (typ != 0 && (typ->status & _HAS_ARGS) != 0)
|
1999-08-24 01:06:48 +00:00
|
|
|
{
|
2007-01-20 07:32:02 +00:00
|
|
|
assert(err != 0 && ap != (va_list *)0);
|
|
|
|
if ((typ->status & _LINKED_TYPE) != 0)
|
1999-08-24 01:06:48 +00:00
|
|
|
{
|
2007-12-30 11:08:14 +00:00
|
|
|
p = typeMalloc(TypeArgument, 1);
|
2007-01-20 07:32:02 +00:00
|
|
|
|
|
|
|
if (p != 0)
|
1999-08-24 01:06:48 +00:00
|
|
|
{
|
2007-01-20 07:32:02 +00:00
|
|
|
p->left = _nc_Make_Argument(typ->left, ap, err);
|
|
|
|
p->right = _nc_Make_Argument(typ->right, ap, err);
|
1999-08-24 01:06:48 +00:00
|
|
|
return p;
|
|
|
|
}
|
|
|
|
else
|
2007-01-20 07:32:02 +00:00
|
|
|
{
|
|
|
|
*err += 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
1999-08-24 01:06:48 +00:00
|
|
|
{
|
2007-01-20 07:32:02 +00:00
|
|
|
assert(typ->makearg != (void *)0);
|
|
|
|
if (!(res = (TypeArgument *)typ->makearg(ap)))
|
|
|
|
{
|
|
|
|
*err += 1;
|
|
|
|
}
|
1999-08-24 01:06:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------
|
2007-01-20 07:32:02 +00:00
|
|
|
| Facility : libnform
|
1999-08-24 01:06:48 +00:00
|
|
|
| Function : TypeArgument *_nc_Copy_Argument(const FIELDTYPE *typ,
|
|
|
|
| const TypeArgument *argp,
|
|
|
|
| int *err )
|
2007-01-20 07:32:02 +00:00
|
|
|
|
|
|
|
|
| Description : Create a copy of an argument structure for the specified
|
1999-08-24 01:06:48 +00:00
|
|
|
| type.
|
|
|
|
|
|
|
|
|
| Return Values : Pointer to argument structure. Maybe NULL.
|
2007-01-20 07:32:02 +00:00
|
|
|
| In case of an error in *err an error counter is increased.
|
1999-08-24 01:06:48 +00:00
|
|
|
+--------------------------------------------------------------------------*/
|
2007-01-20 07:32:02 +00:00
|
|
|
NCURSES_EXPORT(TypeArgument *)
|
|
|
|
_nc_Copy_Argument(const FIELDTYPE *typ, const TypeArgument *argp, int *err)
|
1999-08-24 01:06:48 +00:00
|
|
|
{
|
|
|
|
TypeArgument *res = (TypeArgument *)0;
|
|
|
|
TypeArgument *p;
|
|
|
|
|
2007-01-20 07:32:02 +00:00
|
|
|
if (typ != 0 && (typ->status & _HAS_ARGS) != 0)
|
1999-08-24 01:06:48 +00:00
|
|
|
{
|
2007-01-20 07:32:02 +00:00
|
|
|
assert(err != 0 && argp != 0);
|
|
|
|
if ((typ->status & _LINKED_TYPE) != 0)
|
1999-08-24 01:06:48 +00:00
|
|
|
{
|
2007-12-30 11:08:14 +00:00
|
|
|
p = typeMalloc(TypeArgument, 1);
|
2007-01-20 07:32:02 +00:00
|
|
|
|
|
|
|
if (p != 0)
|
1999-08-24 01:06:48 +00:00
|
|
|
{
|
2007-01-20 07:32:02 +00:00
|
|
|
p->left = _nc_Copy_Argument(typ, argp->left, err);
|
|
|
|
p->right = _nc_Copy_Argument(typ, argp->right, err);
|
1999-08-24 01:06:48 +00:00
|
|
|
return p;
|
|
|
|
}
|
|
|
|
*err += 1;
|
2007-01-20 07:32:02 +00:00
|
|
|
}
|
|
|
|
else
|
1999-08-24 01:06:48 +00:00
|
|
|
{
|
2007-01-20 07:32:02 +00:00
|
|
|
if (typ->copyarg != (void *)0)
|
1999-08-24 01:06:48 +00:00
|
|
|
{
|
2007-01-20 07:32:02 +00:00
|
|
|
if (!(res = (TypeArgument *)(typ->copyarg((const void *)argp))))
|
|
|
|
{
|
|
|
|
*err += 1;
|
|
|
|
}
|
1999-08-24 01:06:48 +00:00
|
|
|
}
|
|
|
|
else
|
2007-01-20 07:32:02 +00:00
|
|
|
{
|
|
|
|
res = (TypeArgument *)argp;
|
|
|
|
}
|
1999-08-24 01:06:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------
|
2007-01-20 07:32:02 +00:00
|
|
|
| Facility : libnform
|
1999-08-24 01:06:48 +00:00
|
|
|
| Function : void _nc_Free_Argument(const FIELDTYPE *typ,
|
|
|
|
| TypeArgument * argp )
|
2007-01-20 07:32:02 +00:00
|
|
|
|
|
1999-08-24 01:06:48 +00:00
|
|
|
| Description : Release memory associated with the argument structure
|
|
|
|
| for the given fieldtype.
|
|
|
|
|
|
|
|
|
| Return Values : -
|
|
|
|
+--------------------------------------------------------------------------*/
|
2001-05-17 08:21:06 +00:00
|
|
|
NCURSES_EXPORT(void)
|
2007-01-20 07:32:02 +00:00
|
|
|
_nc_Free_Argument(const FIELDTYPE *typ, TypeArgument *argp)
|
1999-08-24 01:06:48 +00:00
|
|
|
{
|
2007-01-20 07:32:02 +00:00
|
|
|
if (typ != 0 && (typ->status & _HAS_ARGS) != 0)
|
1999-08-24 01:06:48 +00:00
|
|
|
{
|
2007-01-20 07:32:02 +00:00
|
|
|
if ((typ->status & _LINKED_TYPE) != 0)
|
|
|
|
{
|
2014-03-01 00:40:26 +00:00
|
|
|
if (argp != 0)
|
|
|
|
{
|
|
|
|
_nc_Free_Argument(typ->left, argp->left);
|
|
|
|
_nc_Free_Argument(typ->right, argp->right);
|
|
|
|
free(argp);
|
|
|
|
}
|
2007-01-20 07:32:02 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (typ->freearg != (void *)0)
|
|
|
|
{
|
|
|
|
typ->freearg((void *)argp);
|
|
|
|
}
|
|
|
|
}
|
1999-08-24 01:06:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------
|
2007-01-20 07:32:02 +00:00
|
|
|
| Facility : libnform
|
1999-08-24 01:06:48 +00:00
|
|
|
| Function : bool _nc_Copy_Type( FIELD *dst, FIELD const *src )
|
2007-01-20 07:32:02 +00:00
|
|
|
|
|
1999-08-24 01:06:48 +00:00
|
|
|
| Description : Copy argument structure of field src to field dst
|
|
|
|
|
|
|
|
|
| Return Values : TRUE - copy worked
|
2007-01-20 07:32:02 +00:00
|
|
|
| FALSE - error occurred
|
1999-08-24 01:06:48 +00:00
|
|
|
+--------------------------------------------------------------------------*/
|
2001-05-17 08:21:06 +00:00
|
|
|
NCURSES_EXPORT(bool)
|
2007-01-20 07:32:02 +00:00
|
|
|
_nc_Copy_Type(FIELD *dst, FIELD const *src)
|
1999-08-24 01:06:48 +00:00
|
|
|
{
|
|
|
|
int err = 0;
|
|
|
|
|
2007-01-20 07:32:02 +00:00
|
|
|
assert(dst != 0 && src != 0);
|
1999-08-24 01:06:48 +00:00
|
|
|
|
|
|
|
dst->type = src->type;
|
2007-01-20 07:32:02 +00:00
|
|
|
dst->arg = (void *)_nc_Copy_Argument(src->type, (TypeArgument *)(src->arg), &err);
|
1999-08-24 01:06:48 +00:00
|
|
|
|
2007-01-20 07:32:02 +00:00
|
|
|
if (err != 0)
|
1999-08-24 01:06:48 +00:00
|
|
|
{
|
2007-01-20 07:32:02 +00:00
|
|
|
_nc_Free_Argument(dst->type, (TypeArgument *)(dst->arg));
|
1999-08-24 01:06:48 +00:00
|
|
|
dst->type = (FIELDTYPE *)0;
|
2007-01-20 07:32:02 +00:00
|
|
|
dst->arg = (void *)0;
|
1999-08-24 01:06:48 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-01-20 07:32:02 +00:00
|
|
|
if (dst->type != 0)
|
|
|
|
{
|
|
|
|
dst->type->ref++;
|
|
|
|
}
|
1999-08-24 01:06:48 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------
|
2007-01-20 07:32:02 +00:00
|
|
|
| Facility : libnform
|
1999-08-24 01:06:48 +00:00
|
|
|
| Function : void _nc_Free_Type( FIELD *field )
|
2007-01-20 07:32:02 +00:00
|
|
|
|
|
1999-08-24 01:06:48 +00:00
|
|
|
| Description : Release Argument structure for this field
|
|
|
|
|
|
|
|
|
| Return Values : -
|
|
|
|
+--------------------------------------------------------------------------*/
|
2001-05-17 08:21:06 +00:00
|
|
|
NCURSES_EXPORT(void)
|
2007-01-20 07:32:02 +00:00
|
|
|
_nc_Free_Type(FIELD *field)
|
1999-08-24 01:06:48 +00:00
|
|
|
{
|
2007-01-20 07:32:02 +00:00
|
|
|
assert(field != 0);
|
|
|
|
if (field->type != 0)
|
|
|
|
{
|
|
|
|
field->type->ref--;
|
2014-02-28 19:18:07 +00:00
|
|
|
_nc_Free_Argument(field->type, (TypeArgument *)(field->arg));
|
2007-01-20 07:32:02 +00:00
|
|
|
}
|
1999-08-24 01:06:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------
|
2007-01-20 07:32:02 +00:00
|
|
|
| Facility : libnform
|
|
|
|
| Function : FIELD *new_field( int rows, int cols,
|
1999-08-24 01:06:48 +00:00
|
|
|
| int frow, int fcol,
|
|
|
|
| int nrow, int nbuf )
|
2007-01-20 07:32:02 +00:00
|
|
|
|
|
1999-08-24 01:06:48 +00:00
|
|
|
| Description : Create a new field with this many 'rows' and 'cols',
|
|
|
|
| starting at 'frow/fcol' in the subwindow of the form.
|
|
|
|
| Allocate 'nrow' off-screen rows and 'nbuf' additional
|
|
|
|
| buffers. If an error occurs, errno is set to
|
2007-01-20 07:32:02 +00:00
|
|
|
|
|
1999-08-24 01:06:48 +00:00
|
|
|
| E_BAD_ARGUMENT - invalid argument
|
|
|
|
| E_SYSTEM_ERROR - system error
|
|
|
|
|
|
|
|
|
| Return Values : Pointer to the new field or NULL if failure.
|
|
|
|
+--------------------------------------------------------------------------*/
|
2001-05-17 08:21:06 +00:00
|
|
|
NCURSES_EXPORT(FIELD *)
|
2007-01-20 07:32:02 +00:00
|
|
|
new_field(int rows, int cols, int frow, int fcol, int nrow, int nbuf)
|
1999-08-24 01:06:48 +00:00
|
|
|
{
|
2007-01-20 07:32:02 +00:00
|
|
|
static const FIELD_CELL blank = BLANK;
|
|
|
|
static const FIELD_CELL zeros = ZEROS;
|
|
|
|
|
1999-08-24 01:06:48 +00:00
|
|
|
FIELD *New_Field = (FIELD *)0;
|
|
|
|
int err = E_BAD_ARGUMENT;
|
|
|
|
|
2007-01-20 07:32:02 +00:00
|
|
|
T((T_CALLED("new_field(%d,%d,%d,%d,%d,%d)"), rows, cols, frow, fcol, nrow, nbuf));
|
|
|
|
if (rows > 0 &&
|
|
|
|
cols > 0 &&
|
|
|
|
frow >= 0 &&
|
|
|
|
fcol >= 0 &&
|
|
|
|
nrow >= 0 &&
|
|
|
|
nbuf >= 0 &&
|
|
|
|
((err = E_SYSTEM_ERROR) != 0) && /* trick: this resets the default error */
|
2007-12-30 11:08:14 +00:00
|
|
|
(New_Field = typeMalloc(FIELD, 1)) != 0)
|
1999-08-24 01:06:48 +00:00
|
|
|
{
|
2014-02-28 19:18:07 +00:00
|
|
|
T((T_CREATE("field %p"), (void *)New_Field));
|
2007-01-20 07:32:02 +00:00
|
|
|
*New_Field = default_field;
|
2020-02-07 08:36:41 +00:00
|
|
|
New_Field->rows = (short)rows;
|
|
|
|
New_Field->cols = (short)cols;
|
1999-08-24 01:06:48 +00:00
|
|
|
New_Field->drows = rows + nrow;
|
|
|
|
New_Field->dcols = cols;
|
2020-02-07 08:36:41 +00:00
|
|
|
New_Field->frow = (short)frow;
|
|
|
|
New_Field->fcol = (short)fcol;
|
2007-01-20 07:32:02 +00:00
|
|
|
New_Field->nrow = nrow;
|
2020-02-07 08:36:41 +00:00
|
|
|
New_Field->nbuf = (short)nbuf;
|
2007-01-20 07:32:02 +00:00
|
|
|
New_Field->link = New_Field;
|
|
|
|
|
|
|
|
#if USE_WIDEC_SUPPORT
|
|
|
|
New_Field->working = newpad(1, Buffer_Length(New_Field) + 1);
|
2007-12-30 11:08:14 +00:00
|
|
|
New_Field->expanded = typeCalloc(char *, 1 + (unsigned)nbuf);
|
2007-01-20 07:32:02 +00:00
|
|
|
#endif
|
1999-08-24 01:06:48 +00:00
|
|
|
|
2007-01-20 07:32:02 +00:00
|
|
|
if (_nc_Copy_Type(New_Field, &default_field))
|
1999-08-24 01:06:48 +00:00
|
|
|
{
|
|
|
|
size_t len;
|
|
|
|
|
|
|
|
len = Total_Buffer_Size(New_Field);
|
2007-01-20 07:32:02 +00:00
|
|
|
if ((New_Field->buf = (FIELD_CELL *)malloc(len)))
|
1999-08-24 01:06:48 +00:00
|
|
|
{
|
|
|
|
/* Prefill buffers with blanks and insert terminating zeroes
|
2007-01-20 07:32:02 +00:00
|
|
|
between buffers */
|
|
|
|
int i, j;
|
|
|
|
int cells = Buffer_Length(New_Field);
|
1999-08-24 01:06:48 +00:00
|
|
|
|
2007-01-20 07:32:02 +00:00
|
|
|
for (i = 0; i <= New_Field->nbuf; i++)
|
1999-08-24 01:06:48 +00:00
|
|
|
{
|
2007-01-20 07:32:02 +00:00
|
|
|
FIELD_CELL *buffer = &(New_Field->buf[(cells + 1) * i]);
|
|
|
|
|
|
|
|
for (j = 0; j < cells; ++j)
|
|
|
|
{
|
|
|
|
buffer[j] = blank;
|
|
|
|
}
|
|
|
|
buffer[j] = zeros;
|
1999-08-24 01:06:48 +00:00
|
|
|
}
|
2007-01-20 07:32:02 +00:00
|
|
|
returnField(New_Field);
|
1999-08-24 01:06:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-01-20 07:32:02 +00:00
|
|
|
if (New_Field)
|
1999-08-24 01:06:48 +00:00
|
|
|
free_field(New_Field);
|
2007-01-20 07:32:02 +00:00
|
|
|
|
|
|
|
SET_ERROR(err);
|
|
|
|
returnField((FIELD *)0);
|
1999-08-24 01:06:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------
|
2007-01-20 07:32:02 +00:00
|
|
|
| Facility : libnform
|
1999-08-24 01:06:48 +00:00
|
|
|
| Function : int free_field( FIELD *field )
|
2007-01-20 07:32:02 +00:00
|
|
|
|
|
1999-08-24 01:06:48 +00:00
|
|
|
| Description : Frees the storage allocated for the field.
|
|
|
|
|
|
|
|
|
| Return Values : E_OK - success
|
|
|
|
| E_BAD_ARGUMENT - invalid field pointer
|
|
|
|
| E_CONNECTED - field is connected
|
|
|
|
+--------------------------------------------------------------------------*/
|
2001-05-17 08:21:06 +00:00
|
|
|
NCURSES_EXPORT(int)
|
2007-01-20 07:32:02 +00:00
|
|
|
free_field(FIELD *field)
|
1999-08-24 01:06:48 +00:00
|
|
|
{
|
2014-02-28 19:18:07 +00:00
|
|
|
T((T_CALLED("free_field(%p)"), (void *)field));
|
2007-01-20 07:32:02 +00:00
|
|
|
if (!field)
|
1999-08-24 01:06:48 +00:00
|
|
|
{
|
2007-01-20 07:32:02 +00:00
|
|
|
RETURN(E_BAD_ARGUMENT);
|
|
|
|
}
|
|
|
|
else if (field->form != 0)
|
|
|
|
{
|
|
|
|
RETURN(E_CONNECTED);
|
|
|
|
}
|
|
|
|
else if (field == field->link)
|
|
|
|
{
|
|
|
|
if (field->buf != 0)
|
1999-08-24 01:06:48 +00:00
|
|
|
free(field->buf);
|
|
|
|
}
|
2007-01-20 07:32:02 +00:00
|
|
|
else
|
1999-08-24 01:06:48 +00:00
|
|
|
{
|
|
|
|
FIELD *f;
|
|
|
|
|
2007-01-20 07:32:02 +00:00
|
|
|
for (f = field; f->link != field; f = f->link)
|
|
|
|
{
|
|
|
|
}
|
1999-08-24 01:06:48 +00:00
|
|
|
f->link = field->link;
|
|
|
|
}
|
|
|
|
_nc_Free_Type(field);
|
2007-01-20 07:32:02 +00:00
|
|
|
#if USE_WIDEC_SUPPORT
|
|
|
|
if (field->expanded != 0)
|
|
|
|
{
|
|
|
|
int n;
|
|
|
|
|
|
|
|
for (n = 0; n <= field->nbuf; ++n)
|
|
|
|
{
|
|
|
|
FreeIfNeeded(field->expanded[n]);
|
|
|
|
}
|
|
|
|
free(field->expanded);
|
|
|
|
(void)delwin(field->working);
|
|
|
|
}
|
|
|
|
#endif
|
1999-08-24 01:06:48 +00:00
|
|
|
free(field);
|
|
|
|
RETURN(E_OK);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* fld_def.c ends here */
|