/****************************************************************************1* Copyright (c) 1998 Free Software Foundation, Inc. *2* *3* Permission is hereby granted, free of charge, to any person obtaining a *4* copy of this software and associated documentation files (the *5* "Software"), to deal in the Software without restriction, including *6* without limitation the rights to use, copy, modify, merge, publish, *7* distribute, distribute with modifications, sublicense, and/or sell *8* copies of the Software, and to permit persons to whom the Software is *9* furnished to do so, subject to the following conditions: *10* *11* The above copyright notice and this permission notice shall be included *12* in all copies or substantial portions of the Software. *13* *14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *15* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *16* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *17* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *18* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *19* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *20* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *21* *22* Except as contained in this notice, the name(s) of the above copyright *23* holders shall not be used in advertising or otherwise to promote the *24* sale, use or other dealings in this Software without prior written *25* authorization. *26****************************************************************************/2728/****************************************************************************29* Author: Juergen Pfeifer <[email protected]> 1995,1997 *30****************************************************************************/3132#include "form.priv.h"3334MODULE_ID("$Id$")3536/*---------------------------------------------------------------------------37| Facility : libnform38| Function : int set_fieldtype_arg(39| FIELDTYPE *typ,40| void * (* const make_arg)(va_list *),41| void * (* const copy_arg)(const void *),42| void (* const free_arg)(void *) )43|44| Description : Connects to the type additional arguments necessary45| for a set_field_type call. The various function pointer46| arguments are:47| make_arg : allocates a structure for the field48| specific parameters.49| copy_arg : duplicate the structure created by50| make_arg51| free_arg : Release the memory allocated by make_arg52| or copy_arg53|54| At least make_arg must be non-NULL.55| You may pass NULL for copy_arg and free_arg if your56| make_arg function doesn't allocate memory and your57| arg fits into the storage for a (void*).58|59| Return Values : E_OK - success60| E_BAD_ARGUMENT - invalid argument61+--------------------------------------------------------------------------*/62int set_fieldtype_arg(FIELDTYPE * typ,63void * (* const make_arg)(va_list *),64void * (* const copy_arg)(const void *),65void (* const free_arg)(void *))66{67if ( !typ || !make_arg )68RETURN(E_BAD_ARGUMENT);6970typ->status |= _HAS_ARGS;71typ->makearg = make_arg;72typ->copyarg = copy_arg;73typ->freearg = free_arg;74RETURN(E_OK);75}7677/*---------------------------------------------------------------------------78| Facility : libnform79| Function : void *field_arg(const FIELD *field)80|81| Description : Retrieve pointer to the fields argument structure.82|83| Return Values : Pointer to structure or NULL if none is defined.84+--------------------------------------------------------------------------*/85void *field_arg(const FIELD * field)86{87return Normalize_Field(field)->arg;88}8990/* fld_arg.c ends here */919293