/****************************************************************************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_form_opts(FORM *form, Form_Options opts)39|40| Description : Turns on the named options and turns off all the41| remaining options for that form.42|43| Return Values : E_OK - success44| E_BAD_ARGUMENT - invalid options45+--------------------------------------------------------------------------*/46int set_form_opts(FORM * form, Form_Options opts)47{48opts &= ALL_FORM_OPTS;49if (opts & ~ALL_FORM_OPTS)50RETURN(E_BAD_ARGUMENT);51else52{53Normalize_Form( form )->opts = opts;54RETURN(E_OK);55}56}5758/*---------------------------------------------------------------------------59| Facility : libnform60| Function : Form_Options form_opts(const FORM *)61|62| Description : Retrieves the current form options.63|64| Return Values : The option flags.65+--------------------------------------------------------------------------*/66Form_Options form_opts(const FORM * form)67{68return (Normalize_Form(form)->opts & ALL_FORM_OPTS);69}7071/*---------------------------------------------------------------------------72| Facility : libnform73| Function : int form_opts_on(FORM *form, Form_Options opts)74|75| Description : Turns on the named options; no other options are76| changed.77|78| Return Values : E_OK - success79| E_BAD_ARGUMENT - invalid options80+--------------------------------------------------------------------------*/81int form_opts_on(FORM * form, Form_Options opts)82{83opts &= ALL_FORM_OPTS;84if (opts & ~ALL_FORM_OPTS)85RETURN(E_BAD_ARGUMENT);86else87{88Normalize_Form( form )->opts |= opts;89RETURN(E_OK);90}91}9293/*---------------------------------------------------------------------------94| Facility : libnform95| Function : int form_opts_off(FORM *form, Form_Options opts)96|97| Description : Turns off the named options; no other options are98| changed.99|100| Return Values : E_OK - success101| E_BAD_ARGUMENT - invalid options102+--------------------------------------------------------------------------*/103int form_opts_off(FORM * form, Form_Options opts)104{105opts &= ALL_FORM_OPTS;106if (opts & ~ALL_FORM_OPTS)107RETURN(E_BAD_ARGUMENT);108else109{110Normalize_Form(form)->opts &= ~opts;111RETURN(E_OK);112}113}114115/* frm_opts.c ends here */116117118