/****************************************************************************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****************************************************************************/31#include "form.priv.h"3233MODULE_ID("$Id$")3435/*----------------------------------------------------------------------------36Field-Options manipulation routines37--------------------------------------------------------------------------*/3839/*---------------------------------------------------------------------------40| Facility : libnform41| Function : int set_field_opts(FIELD *field, Field_Options opts)42|43| Description : Turns on the named options for this field and turns44| off all the remaining options.45|46| Return Values : E_OK - success47| E_CURRENT - the field is the current field48| E_BAD_ARGUMENT - invalid options49| E_SYSTEM_ERROR - system error50+--------------------------------------------------------------------------*/51int set_field_opts(FIELD * field, Field_Options opts)52{53int res = E_BAD_ARGUMENT;54opts &= ALL_FIELD_OPTS;55if (!(opts & ~ALL_FIELD_OPTS))56res = _nc_Synchronize_Options( Normalize_Field(field), opts );57RETURN(res);58}5960/*---------------------------------------------------------------------------61| Facility : libnform62| Function : Field_Options field_opts(const FIELD *field)63|64| Description : Retrieve the fields options.65|66| Return Values : The options.67+--------------------------------------------------------------------------*/68Field_Options field_opts(const FIELD * field)69{70return ALL_FIELD_OPTS & Normalize_Field( field )->opts;71}7273/*---------------------------------------------------------------------------74| Facility : libnform75| Function : int field_opts_on(FIELD *field, Field_Options opts)76|77| Description : Turns on the named options for this field and all the78| remaining options are unchanged.79|80| Return Values : E_OK - success81| E_CURRENT - the field is the current field82| E_BAD_ARGUMENT - invalid options83| E_SYSTEM_ERROR - system error84+--------------------------------------------------------------------------*/85int field_opts_on(FIELD * field, Field_Options opts)86{87int res = E_BAD_ARGUMENT;8889opts &= ALL_FIELD_OPTS;90if (!(opts & ~ALL_FIELD_OPTS))91{92Normalize_Field( field );93res = _nc_Synchronize_Options( field, field->opts | opts );94}95RETURN(res);96}9798/*---------------------------------------------------------------------------99| Facility : libnform100| Function : int field_opts_off(FIELD *field, Field_Options opts)101|102| Description : Turns off the named options for this field and all the103| remaining options are unchanged.104|105| Return Values : E_OK - success106| E_CURRENT - the field is the current field107| E_BAD_ARGUMENT - invalid options108| E_SYSTEM_ERROR - system error109+--------------------------------------------------------------------------*/110int field_opts_off(FIELD * field, Field_Options opts)111{112int res = E_BAD_ARGUMENT;113114opts &= ALL_FIELD_OPTS;115if (!(opts & ~ALL_FIELD_OPTS))116{117Normalize_Field( field );118res = _nc_Synchronize_Options( field, field->opts & ~opts );119}120RETURN(res);121}122123/* fld_opts.c ends here */124125126