X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=form%2Ffrm_opts.c;h=62e2bebdc4310a1bc97e46051809ca765ed0d087;hp=f534d4d5d78da7aaeac2c4ad7084021a343a9468;hb=f6b436c4fb50275df43ea10ba9c744fe195a327d;hpb=661078ddbde3ce0f3b06e95642fbb9b5fef7dca1 diff --git a/form/frm_opts.c b/form/frm_opts.c index f534d4d5..62e2bebd 100644 --- a/form/frm_opts.c +++ b/form/frm_opts.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 1998-2012,2013 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,81 +28,95 @@ ****************************************************************************/ /**************************************************************************** - * Author: Juergen Pfeifer 1995,1997 * + * Author: Juergen Pfeifer, 1995,1997 * ****************************************************************************/ #include "form.priv.h" -MODULE_ID("$Id: frm_opts.c,v 1.4 1998/02/11 12:13:43 tom Exp $") +MODULE_ID("$Id: frm_opts.c,v 1.21 2021/06/17 21:20:30 tom Exp $") /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : int set_form_opts(FORM *form, Form_Options opts) -| +| | Description : Turns on the named options and turns off all the | remaining options for that form. | | Return Values : E_OK - success | E_BAD_ARGUMENT - invalid options +--------------------------------------------------------------------------*/ -int set_form_opts(FORM * form, Form_Options opts) +FORM_EXPORT(int) +set_form_opts(FORM *form, Form_Options opts) { - if (opts & ~ALL_FORM_OPTS) + T((T_CALLED("set_form_opts(%p,%d)"), (void *)form, opts)); + + opts &= (Form_Options)ALL_FORM_OPTS; + if ((unsigned)opts & ~ALL_FORM_OPTS) RETURN(E_BAD_ARGUMENT); else { - Normalize_Form( form )->opts = opts; + Normalize_Form(form)->opts = opts; RETURN(E_OK); } } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : Form_Options form_opts(const FORM *) -| +| | Description : Retrieves the current form options. | | Return Values : The option flags. +--------------------------------------------------------------------------*/ -Form_Options form_opts(const FORM * form) +FORM_EXPORT(Form_Options) +form_opts(const FORM *form) { - return (Normalize_Form(form)->opts & ALL_FORM_OPTS); + T((T_CALLED("form_opts(%p)"), (const void *)form)); + returnCode((Form_Options)((unsigned)Normalize_Form(form)->opts & ALL_FORM_OPTS)); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : int form_opts_on(FORM *form, Form_Options opts) -| -| Description : Turns on the named options; no other options are +| +| Description : Turns on the named options; no other options are | changed. | -| Return Values : E_OK - success +| Return Values : E_OK - success | E_BAD_ARGUMENT - invalid options +--------------------------------------------------------------------------*/ -int form_opts_on(FORM * form, Form_Options opts) +FORM_EXPORT(int) +form_opts_on(FORM *form, Form_Options opts) { - if (opts & ~ALL_FORM_OPTS) + T((T_CALLED("form_opts_on(%p,%d)"), (void *)form, opts)); + + opts &= (Form_Options)ALL_FORM_OPTS; + if ((unsigned)opts & ~ALL_FORM_OPTS) RETURN(E_BAD_ARGUMENT); else { - Normalize_Form( form )->opts |= opts; + Normalize_Form(form)->opts |= opts; RETURN(E_OK); } } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : int form_opts_off(FORM *form, Form_Options opts) -| -| Description : Turns off the named options; no other options are +| +| Description : Turns off the named options; no other options are | changed. | -| Return Values : E_OK - success +| Return Values : E_OK - success | E_BAD_ARGUMENT - invalid options +--------------------------------------------------------------------------*/ -int form_opts_off(FORM * form, Form_Options opts) +FORM_EXPORT(int) +form_opts_off(FORM *form, Form_Options opts) { - if (opts & ~ALL_FORM_OPTS) + T((T_CALLED("form_opts_off(%p,%d)"), (void *)form, opts)); + + opts &= (Form_Options)ALL_FORM_OPTS; + if ((unsigned)opts & ~ALL_FORM_OPTS) RETURN(E_BAD_ARGUMENT); else {