diff options
Diffstat (limited to 'form')
51 files changed, 854 insertions, 380 deletions
diff --git a/form/Makefile.in b/form/Makefile.in index e5680cd..3e5be8d 100644 --- a/form/Makefile.in +++ b/form/Makefile.in @@ -1,6 +1,7 @@ -# $Id: Makefile.in,v 1.60 2014/12/20 20:27:55 tom Exp $ +# $Id: Makefile.in,v 1.65 2020/02/02 23:34:34 tom Exp $ ############################################################################## -# Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. # +# Copyright 2020 Thomas E. Dickey # +# Copyright 1998-2015,2018 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 "Software"), # @@ -42,7 +43,7 @@ # turn off _all_ suffix rules; we'll generate our own .SUFFIXES: -SHELL = /bin/sh +SHELL = @SHELL@ VPATH = @srcdir@ THIS = Makefile @@ -75,7 +76,7 @@ LT_UNDEF = @LT_UNDEF@ INSTALL = @INSTALL@ INSTALL_LIB = @INSTALL@ @INSTALL_LIB@ -INSTALL_PROG = @INSTALL_PROGRAM@ +INSTALL_PROG = @INSTALL_PROGRAM@ @INSTALL_OPT_S@ INSTALL_DATA = @INSTALL_DATA@ AR = @AR@ @@ -107,7 +108,7 @@ LINK = $(LIBTOOL_LINK) LDFLAGS = @LDFLAGS@ @LD_MODEL@ @LIBS@ SHLIB_DIRS = -L../lib -SHLIB_LIST = $(SHLIB_DIRS) -lncurses@LIB_SUFFIX@ @SHLIB_LIST@ +SHLIB_LIST = $(SHLIB_DIRS) -lncurses@USE_LIB_SUFFIX@ @SHLIB_LIST@ RPATH_LIST = @RPATH_LIST@ RESULTING_SYMS = @RESULTING_SYMS@ @@ -168,6 +169,7 @@ clean :: mostlyclean distclean :: clean -rm -f Makefile + -rm -rf .libs *.dSYM realclean :: distclean diff --git a/form/READ.ME b/form/READ.ME index da86bf6..0cefd57 100644 --- a/form/READ.ME +++ b/form/READ.ME @@ -1,5 +1,6 @@ ------------------------------------------------------------------------------- --- Copyright (c) 1998-2003,2006 Free Software Foundation, Inc. -- +-- Copyright 2020 Thomas E. Dickey -- +-- Copyright 1998-2003,2006 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 -- @@ -25,7 +26,7 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: READ.ME,v 0.7 2006/04/22 23:13:05 tom Exp $ +-- $Id: READ.ME,v 0.8 2020/02/02 23:34:34 tom Exp $ ------------------------------------------------------------------------------- This is a clone of the form library that is available with typical diff --git a/form/f_trace.c b/form/f_trace.c index 6044e03..d24708c 100644 --- a/form/f_trace.c +++ b/form/f_trace.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 2004,2010 Free Software Foundation, Inc. * + * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 2004-2010,2016 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 * @@ -32,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: f_trace.c,v 1.2 2010/01/23 21:14:36 tom Exp $") +MODULE_ID("$Id: f_trace.c,v 1.5 2020/02/02 23:34:34 tom Exp $") NCURSES_EXPORT(FIELD **) _nc_retrace_field_ptr(FIELD **code) @@ -65,6 +66,7 @@ _nc_retrace_form(FORM *code) NCURSES_EXPORT(Form_Hook) _nc_retrace_form_hook(Form_Hook code) { - T((T_RETURN("%p"), code)); + TR_FUNC_BFR(1); + T((T_RETURN("%s"), TR_FUNC_ARG(0, code))); return code; } diff --git a/form/fld_arg.c b/form/fld_arg.c index 001c1d1..e7555f6 100644 --- a/form/fld_arg.c +++ b/form/fld_arg.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * + * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 1998-2012,2016 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 * @@ -32,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_arg.c,v 1.13 2012/06/10 00:27:49 tom Exp $") +MODULE_ID("$Id: fld_arg.c,v 1.16 2020/02/02 23:34:34 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -66,8 +67,13 @@ set_fieldtype_arg(FIELDTYPE *typ, void *(*const copy_arg)(const void *), void (*const free_arg) (void *)) { - T((T_CALLED("set_fieldtype_arg(%p,%p,%p,%p)"), - (void *)typ, make_arg, copy_arg, free_arg)); + TR_FUNC_BFR(3); + + T((T_CALLED("set_fieldtype_arg(%p,%s,%s,%s)"), + (void *)typ, + TR_FUNC_ARG(0, make_arg), + TR_FUNC_ARG(1, copy_arg), + TR_FUNC_ARG(2, free_arg))); if (typ != 0 && make_arg != (void *)0) { diff --git a/form/fld_attr.c b/form/fld_attr.c index 0112f00..50e2c73 100644 --- a/form/fld_attr.c +++ b/form/fld_attr.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2010,2016 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 * @@ -32,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_attr.c,v 1.11 2010/01/23 21:12:08 tom Exp $") +MODULE_ID("$Id: fld_attr.c,v 1.13 2020/02/02 23:34:34 tom Exp $") /*---------------------------------------------------------------------------- Field-Attribute manipulation routines @@ -42,7 +43,7 @@ MODULE_ID("$Id: fld_attr.c,v 1.11 2010/01/23 21:12:08 tom Exp $") NCURSES_IMPEXP int NCURSES_API set_field_ ## name (FIELD * field, chtype attr)\ {\ int res = E_BAD_ARGUMENT;\ - T((T_CALLED("set_field_" #name "(%p,%s)"), field, _traceattr(attr)));\ + T((T_CALLED("set_field_" #name "(%p,%s)"), (void *)field, _traceattr(attr)));\ if ( attr==A_NORMAL || ((attr & A_ATTRIBUTES)==attr) )\ {\ Normalize_Field( field );\ diff --git a/form/fld_current.c b/form/fld_current.c index ef9ec00..75e68ed 100644 --- a/form/fld_current.c +++ b/form/fld_current.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2010,2016 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 * @@ -32,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_current.c,v 1.12 2010/01/23 21:14:35 tom Exp $") +MODULE_ID("$Id: fld_current.c,v 1.15 2020/02/02 23:34:34 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -76,7 +77,7 @@ set_current_field(FORM *form, FIELD *field) { if (form->current != field) { - if (!_nc_Internal_Validation(form)) + if (form->current && !_nc_Internal_Validation(form)) { err = E_INVALID_FIELD; } @@ -104,6 +105,32 @@ set_current_field(FORM *form, FIELD *field) /*--------------------------------------------------------------------------- | Facility : libnform +| Function : int unfocus_current_field(FORM * form) +| +| Description : Removes focus from the current field. +| +| Return Values : E_OK - success +| E_BAD_ARGUMENT - invalid form pointer +| E_REQUEST_DENIED - there is no current field to unfocus ++--------------------------------------------------------------------------*/ +NCURSES_EXPORT(int) +unfocus_current_field(FORM *const form) +{ + T((T_CALLED("unfocus_current_field(%p)"), (const void *)form)); + if (form == 0) + { + RETURN(E_BAD_ARGUMENT); + } + else if (form->current == 0) + { + RETURN(E_REQUEST_DENIED); + } + _nc_Unset_Current_Field(form); + RETURN(E_OK); +} + +/*--------------------------------------------------------------------------- +| Facility : libnform | Function : FIELD *current_field(const FORM * form) | | Description : Return the current field. diff --git a/form/fld_def.c b/form/fld_def.c index b18462f..e529b3c 100644 --- a/form/fld_def.c +++ b/form/fld_def.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2012,2014 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2012,2014 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 * @@ -32,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_def.c,v 1.41 2014/07/26 21:08:55 tom Exp $") +MODULE_ID("$Id: fld_def.c,v 1.42 2020/02/02 23:34:34 tom Exp $") /* this can't be readonly */ static FIELD default_field = diff --git a/form/fld_dup.c b/form/fld_dup.c index 2df40ee..9859a09 100644 --- a/form/fld_dup.c +++ b/form/fld_dup.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2010,2012 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 * @@ -32,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_dup.c,v 1.14 2012/03/11 00:37:16 tom Exp $") +MODULE_ID("$Id: fld_dup.c,v 1.15 2020/02/02 23:34:34 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/form/fld_ftchoice.c b/form/fld_ftchoice.c index 0901306..5dc5f4a 100644 --- a/form/fld_ftchoice.c +++ b/form/fld_ftchoice.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * + * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 1998-2012,2016 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 * @@ -32,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_ftchoice.c,v 1.13 2012/06/10 00:27:49 tom Exp $") +MODULE_ID("$Id: fld_ftchoice.c,v 1.16 2020/02/02 23:34:34 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -51,7 +52,12 @@ set_fieldtype_choice(FIELDTYPE *typ, bool (*const next_choice) (FIELD *, const void *), bool (*const prev_choice) (FIELD *, const void *)) { - T((T_CALLED("set_fieldtype_choice(%p,%p,%p)"), (void *)typ, next_choice, prev_choice)); + TR_FUNC_BFR(2); + + T((T_CALLED("set_fieldtype_choice(%p,%s,%s)"), + (void *)typ, + TR_FUNC_ARG(0, next_choice), + TR_FUNC_ARG(1, prev_choice))); if (!typ || !next_choice || !prev_choice) RETURN(E_BAD_ARGUMENT); diff --git a/form/fld_ftlink.c b/form/fld_ftlink.c index e7b1440..afa488b 100644 --- a/form/fld_ftlink.c +++ b/form/fld_ftlink.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2010,2012 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 * @@ -32,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_ftlink.c,v 1.15 2012/06/10 00:27:49 tom Exp $") +MODULE_ID("$Id: fld_ftlink.c,v 1.16 2020/02/02 23:34:34 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/form/fld_info.c b/form/fld_info.c index 13fe8e7..9963b5b 100644 --- a/form/fld_info.c +++ b/form/fld_info.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2004,2010 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 * @@ -32,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_info.c,v 1.11 2010/01/23 21:14:35 tom Exp $") +MODULE_ID("$Id: fld_info.c,v 1.12 2020/02/02 23:34:34 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/form/fld_just.c b/form/fld_just.c index dea20b7..8097019 100644 --- a/form/fld_just.c +++ b/form/fld_just.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2010,2012 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 * @@ -32,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_just.c,v 1.13 2012/03/11 00:37:16 tom Exp $") +MODULE_ID("$Id: fld_just.c,v 1.14 2020/02/02 23:34:34 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/form/fld_link.c b/form/fld_link.c index b6c4768..cb67ac0 100644 --- a/form/fld_link.c +++ b/form/fld_link.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2010,2012 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 * @@ -32,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_link.c,v 1.13 2012/03/11 00:37:16 tom Exp $") +MODULE_ID("$Id: fld_link.c,v 1.14 2020/02/02 23:34:34 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/form/fld_max.c b/form/fld_max.c index 6c7fe72..7d0e146 100644 --- a/form/fld_max.c +++ b/form/fld_max.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * + * Copyright 2019,2020 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 * @@ -32,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_max.c,v 1.13 2013/08/24 22:59:28 tom Exp $") +MODULE_ID("$Id: fld_max.c,v 1.16 2020/02/02 23:34:34 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -57,11 +58,16 @@ set_max_field(FIELD *field, int maxgrow) if (maxgrow > 0) { - if ((single_line_field && (maxgrow < field->dcols)) || - (!single_line_field && (maxgrow < field->drows))) + if (((single_line_field && (maxgrow < field->dcols)) || + (!single_line_field && (maxgrow < field->drows))) && + !Field_Has_Option(field, O_INPUT_LIMIT)) RETURN(E_BAD_ARGUMENT); } field->maxgrow = maxgrow; + /* shrink */ + if (maxgrow > 0 && Field_Has_Option(field, O_INPUT_LIMIT) && + field->dcols > maxgrow) + field->dcols = maxgrow; ClrStatus(field, _MAY_GROW); if (!((unsigned)field->opts & O_STATIC)) { diff --git a/form/fld_move.c b/form/fld_move.c index 99f5490..0d6692f 100644 --- a/form/fld_move.c +++ b/form/fld_move.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2010,2012 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 * @@ -32,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_move.c,v 1.11 2012/03/11 00:37:16 tom Exp $") +MODULE_ID("$Id: fld_move.c,v 1.12 2020/02/02 23:34:34 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/form/fld_newftyp.c b/form/fld_newftyp.c index 4351aed..18a7c07 100644 --- a/form/fld_newftyp.c +++ b/form/fld_newftyp.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * + * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 1998-2010,2016 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 * @@ -32,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_newftyp.c,v 1.19 2010/01/23 21:14:36 tom Exp $") +MODULE_ID("$Id: fld_newftyp.c,v 1.22 2020/02/02 23:34:34 tom Exp $") static FIELDTYPE default_fieldtype = { @@ -53,7 +54,7 @@ static FIELDTYPE default_fieldtype = }; NCURSES_EXPORT_VAR(FIELDTYPE *) -_nc_Default_FieldType = &default_fieldtype; + _nc_Default_FieldType = &default_fieldtype; /*--------------------------------------------------------------------------- | Facility : libnform @@ -76,7 +77,12 @@ new_fieldtype(bool (*const field_check) (FIELD *, const void *), { FIELDTYPE *nftyp = (FIELDTYPE *)0; - T((T_CALLED("new_fieldtype(%p,%p)"), field_check, char_check)); + TR_FUNC_BFR(2); + + T((T_CALLED("new_fieldtype(%s,%s)"), + TR_FUNC_ARG(0, field_check), + TR_FUNC_ARG(1, char_check))); + if ((field_check) || (char_check)) { nftyp = typeMalloc(FIELDTYPE, 1); diff --git a/form/fld_opts.c b/form/fld_opts.c index a52f1e2..fee5804 100644 --- a/form/fld_opts.c +++ b/form/fld_opts.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2004,2010 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 * @@ -32,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_opts.c,v 1.12 2010/01/23 21:14:36 tom Exp $") +MODULE_ID("$Id: fld_opts.c,v 1.13 2020/02/02 23:34:34 tom Exp $") /*---------------------------------------------------------------------------- Field-Options manipulation routines diff --git a/form/fld_pad.c b/form/fld_pad.c index 4f8ff1f..b6d59e2 100644 --- a/form/fld_pad.c +++ b/form/fld_pad.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2004,2010 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 * @@ -32,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_pad.c,v 1.10 2010/01/23 21:14:36 tom Exp $") +MODULE_ID("$Id: fld_pad.c,v 1.11 2020/02/02 23:34:34 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/form/fld_page.c b/form/fld_page.c index bcce4cf..c6fb37c 100644 --- a/form/fld_page.c +++ b/form/fld_page.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2010,2012 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 * @@ -32,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_page.c,v 1.12 2012/06/10 00:12:47 tom Exp $") +MODULE_ID("$Id: fld_page.c,v 1.13 2020/02/02 23:34:34 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/form/fld_stat.c b/form/fld_stat.c index 9bbe76e..487a21d 100644 --- a/form/fld_stat.c +++ b/form/fld_stat.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2010,2012 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 * @@ -32,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_stat.c,v 1.14 2012/06/10 00:13:09 tom Exp $") +MODULE_ID("$Id: fld_stat.c,v 1.15 2020/02/02 23:34:34 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/form/fld_type.c b/form/fld_type.c index 0b35b7e..a445fa4 100644 --- a/form/fld_type.c +++ b/form/fld_type.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2004,2010 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 * @@ -32,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_type.c,v 1.16 2010/01/23 21:14:36 tom Exp $") +MODULE_ID("$Id: fld_type.c,v 1.17 2020/02/02 23:34:34 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/form/fld_user.c b/form/fld_user.c index 30bcf7a..5cd165c 100644 --- a/form/fld_user.c +++ b/form/fld_user.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2004,2010 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 * @@ -32,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_user.c,v 1.16 2010/01/23 21:14:36 tom Exp $") +MODULE_ID("$Id: fld_user.c,v 1.17 2020/02/02 23:34:34 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/form/form.h b/form/form.h index 09856dc..dabe676 100644 --- a/form/form.h +++ b/form/form.h @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * + * Copyright 2018-2019,2020 Thomas E. Dickey * + * Copyright 1998-2016,2017 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 * @@ -30,7 +31,7 @@ * Author: Juergen Pfeifer, 1995,1997 * ****************************************************************************/ -/* $Id: form.h,v 0.24 2014/07/26 20:52:28 tom Exp $ */ +/* $Id: form.h,v 0.30 2020/02/02 23:34:34 tom Exp $ */ #ifndef FORM_H #define FORM_H @@ -58,18 +59,24 @@ typedef int Field_Options; * _PAGE * **********/ -typedef struct { +typedef struct pagenode +#if !NCURSES_OPAQUE_FORM +{ short pmin; /* index of first field on page */ short pmax; /* index of last field on page */ short smin; /* index of top leftmost field on page */ short smax; /* index of bottom rightmost field on page */ -} _PAGE; +} +#endif /* !NCURSES_OPAQUE_FORM */ +_PAGE; /********** * FIELD * **********/ -typedef struct fieldnode { +typedef struct fieldnode +#if 1 /* not yet: !NCURSES_OPAQUE_FORM */ +{ unsigned short status; /* flags */ short rows; /* size in rows */ short cols; /* size in cols */ @@ -98,20 +105,24 @@ typedef struct fieldnode { /* * The wide-character configuration requires extra information. Because * there are existing applications that manipulate the members of FIELD - * directly, we cannot make the struct opaque. Offsets of members up to - * this point are the same in the narrow- and wide-character configuration. - * But note that the type of buf depends on the configuration, and is made - * opaque for that reason. + * directly, we cannot make the struct opaque, except by changing the ABI. + * Offsets of members up to this point are the same in the narrow- and + * wide-character configuration. But note that the type of buf depends on + * the configuration, and is made opaque for that reason. */ NCURSES_FIELD_INTERNALS -} FIELD; +} +#endif /* NCURSES_OPAQUE_FORM */ +FIELD; /********* * FORM * *********/ -typedef struct formnode { +typedef struct formnode +#if 1 /* not yet: !NCURSES_OPAQUE_FORM */ +{ unsigned short status; /* flags */ short rows; /* size in rows */ short cols; /* size in cols */ @@ -136,14 +147,18 @@ typedef struct formnode { void (*fieldinit)(struct formnode *); void (*fieldterm)(struct formnode *); -} FORM; +} +#endif /* !NCURSES_OPAQUE_FORM */ +FORM; /************** * FIELDTYPE * **************/ -typedef struct typenode { +typedef struct typenode +#if !NCURSES_OPAQUE_FORM +{ unsigned short status; /* flags */ long ref; /* reference count */ struct typenode * left; /* ptr to operand for | */ @@ -179,7 +194,9 @@ typedef struct typenode { bool (*next)(FIELD *,const void *); /* enumerate next value */ bool (*prev)(FIELD *,const void *); /* enumerate prev value */ #endif -} FIELDTYPE; +} +#endif /* !NCURSES_OPAQUE_FORM */ +FIELDTYPE; typedef void (*Form_Hook)(FORM *); @@ -205,6 +222,9 @@ typedef void (*Form_Hook)(FORM *); #define O_PASSOK (0x0100U) #define O_STATIC (0x0200U) #define O_DYNAMIC_JUSTIFY (0x0400U) /* ncurses extension */ +#define O_NO_LEFT_STRIP (0x0800U) /* ncurses extension */ +#define O_EDGE_INSERT_STAY (0x1000U) /* ncurses extension */ +#define O_INPUT_LIMIT (0x2000U) /* ncurses extension */ /* form options */ #define O_NL_OVERLOAD (0x0001U) @@ -386,6 +406,7 @@ extern NCURSES_EXPORT(int) field_count (const FORM *); extern NCURSES_EXPORT(int) set_form_win (FORM *,WINDOW *); extern NCURSES_EXPORT(int) set_form_sub (FORM *,WINDOW *); extern NCURSES_EXPORT(int) set_current_field (FORM *,FIELD *); +extern NCURSES_EXPORT(int) unfocus_current_field (FORM *); extern NCURSES_EXPORT(int) field_index (const FIELD *); extern NCURSES_EXPORT(int) set_form_page (FORM *,int); extern NCURSES_EXPORT(int) form_page (const FORM *); diff --git a/form/form.priv.h b/form/form.priv.h index 4d1dfe7..53c717c 100644 --- a/form/form.priv.h +++ b/form/form.priv.h @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2012,2014 Free Software Foundation, Inc. * + * Copyright 2018-2019,2020 Thomas E. Dickey * + * Copyright 1998-2016,2017 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 * @@ -30,12 +31,15 @@ * Author: Juergen Pfeifer, 1995,1997 * ****************************************************************************/ -/* $Id: form.priv.h,v 0.38 2014/11/01 13:56:14 tom Exp $ */ +/* $Id: form.priv.h,v 0.45 2020/02/02 23:34:34 tom Exp $ */ #ifndef FORM_PRIV_H #define FORM_PRIV_H 1 /* *INDENT-OFF*/ #include "curses.priv.h" + +#define NCURSES_OPAQUE_FORM 0 + #include "mf_common.h" #if USE_WIDEC_SUPPORT @@ -162,7 +166,10 @@ TypeArgument; #define ALL_FIELD_OPTS (Field_Options)( \ STD_FIELD_OPTS |\ - O_DYNAMIC_JUSTIFY) + O_DYNAMIC_JUSTIFY |\ + O_NO_LEFT_STRIP |\ + O_EDGE_INSERT_STAY |\ + O_INPUT_LIMIT) #define C_BLANK ' ' #define is_blank(c) ((c)==C_BLANK) @@ -183,6 +190,7 @@ extern NCURSES_EXPORT(FIELD *) _nc_First_Active_Field (FORM*); extern NCURSES_EXPORT(bool) _nc_Internal_Validation (FORM*); extern NCURSES_EXPORT(int) _nc_Set_Current_Field (FORM*, FIELD*); extern NCURSES_EXPORT(int) _nc_Position_Form_Cursor (FORM*); +extern NCURSES_EXPORT(void) _nc_Unset_Current_Field(FORM *form); #if NCURSES_INTEROP_FUNCS extern NCURSES_EXPORT(FIELDTYPE *) _nc_TYPE_INTEGER(void); diff --git a/form/frm_cursor.c b/form/frm_cursor.c index 7a4cd16..8ff42bf 100644 --- a/form/frm_cursor.c +++ b/form/frm_cursor.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2004,2010 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 * @@ -32,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_cursor.c,v 1.10 2010/01/23 21:14:36 tom Exp $") +MODULE_ID("$Id: frm_cursor.c,v 1.11 2020/02/02 23:34:34 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/form/frm_data.c b/form/frm_data.c index a936060..5c3b2a0 100644 --- a/form/frm_data.c +++ b/form/frm_data.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2013 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2010,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 * @@ -32,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_data.c,v 1.16 2013/08/24 22:44:05 tom Exp $") +MODULE_ID("$Id: frm_data.c,v 1.17 2020/02/02 23:34:34 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/form/frm_def.c b/form/frm_def.c index fd7b56a..0722d51 100644 --- a/form/frm_def.c +++ b/form/frm_def.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2010,2012 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 * @@ -32,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_def.c,v 1.26 2012/03/11 00:37:16 tom Exp $") +MODULE_ID("$Id: frm_def.c,v 1.27 2020/02/02 23:34:34 tom Exp $") /* this can't be readonly */ static FORM default_form = diff --git a/form/frm_driver.c b/form/frm_driver.c index eebde42..b9f91e1 100644 --- a/form/frm_driver.c +++ b/form/frm_driver.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * + * Copyright 2018-2019,2020 Thomas E. Dickey * + * Copyright 1998-2016,2017 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 * @@ -32,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_driver.c,v 1.115 2014/09/25 21:55:24 tom Exp $") +MODULE_ID("$Id: frm_driver.c,v 1.129 2020/02/02 23:34:34 tom Exp $") /*---------------------------------------------------------------------------- This is the core module of the form library. It contains the majority @@ -99,9 +100,9 @@ Perhaps at some time we will make this configurable at runtime. #define GROW_IF_NAVIGATE (1) #if USE_WIDEC_SUPPORT -#define myADDNSTR(w, s, n) wadd_wchnstr(w, s, n) -#define myINSNSTR(w, s, n) wins_wchnstr(w, s, n) -#define myINNSTR(w, s, n) fix_wchnstr(w, s, n) +#define myADDNSTR(w, s, n) wide_waddnstr(w, s, n) +#define myINSNSTR(w, s, n) wide_winsnstr(w, s, n) +#define myINNSTR(w, s, n) wide_winnstr(w, s, n) #define myWCWIDTH(w, y, x) cell_width(w, y, x) #else #define myADDNSTR(w, s, n) waddnstr(w, s, n) @@ -239,9 +240,29 @@ check_pos(FORM *form, int lineno) Wide-character special functions --------------------------------------------------------------------------*/ #if USE_WIDEC_SUPPORT -/* like winsnstr */ +/* add like waddnstr, but using cchar_t* rather than char* + */ +static int +wide_waddnstr(WINDOW *w, const cchar_t *s, int n) +{ + int rc = OK; + + while (n-- > 0) + { + if ((rc = wadd_wch(w, s)) != OK) + break; + ++s; + } + return rc; +} + +/* insert like winsnstr, but using cchar_t* rather than char* + * + * X/Open Curses has no close equivalent; inserts are done only with wchar_t + * strings. + */ static int -wins_wchnstr(WINDOW *w, cchar_t *s, int n) +wide_winsnstr(WINDOW *w, const cchar_t *s, int n) { int code = ERR; int y, x; @@ -257,11 +278,13 @@ wins_wchnstr(WINDOW *w, cchar_t *s, int n) return code; } -/* win_wchnstr is inconsistent with winnstr, since it returns OK rather than - * the number of items transferred. +/* retrieve like winnstr, but using cchar_t*, rather than char*. + * + * X/Open Curses' closest equivalent, win_wchnstr(), is inconsistent with + * winnstr(), since it returns OK rather than the number of items transferred. */ static int -fix_wchnstr(WINDOW *w, cchar_t *s, int n) +wide_winnstr(WINDOW *w, cchar_t *s, int n) { int x; @@ -844,11 +867,13 @@ _nc_Position_Form_Cursor(FORM *form) | E_BAD_ARGUMENT - invalid form pointer | E_SYSTEM_ERROR - general error +--------------------------------------------------------------------------*/ +static bool move_after_insert = TRUE; NCURSES_EXPORT(int) _nc_Refresh_Current_Field(FORM *form) { WINDOW *formwin; FIELD *field; + bool is_public; T((T_CALLED("_nc_Refresh_Current_Field(%p)"), (void *)form)); @@ -861,102 +886,105 @@ _nc_Refresh_Current_Field(FORM *form) field = form->current; formwin = Get_Form_Window(form); - if (Field_Has_Option(field, O_PUBLIC)) + is_public = Field_Has_Option(field, O_PUBLIC); + + if (Is_Scroll_Field(field)) { - if (Is_Scroll_Field(field)) + /* Again, in this case the fieldwin isn't derived from formwin, + so we have to perform a copy operation. */ + if (Single_Line_Field(field)) { - /* Again, in this case the fieldwin isn't derived from formwin, - so we have to perform a copy operation. */ - if (Single_Line_Field(field)) - { - /* horizontal scrolling */ - if (form->curcol < form->begincol) - form->begincol = form->curcol; - else - { - if (form->curcol >= (form->begincol + field->cols)) - form->begincol = form->curcol - field->cols + 1; - } - copywin(form->w, - formwin, - 0, - form->begincol, - field->frow, - field->fcol, - field->frow, - field->cols + field->fcol - 1, - 0); - } + /* horizontal scrolling */ + if (form->curcol < form->begincol) + form->begincol = form->curcol; else { - /* A multi-line, i.e. vertical scrolling field */ - int row_after_bottom, first_modified_row, first_unmodified_row; + if (form->curcol >= (form->begincol + field->cols)) + form->begincol = form->curcol - field->cols + + (move_after_insert ? 1 : 0); + } + if (is_public) + copywin(form->w, + formwin, + 0, + form->begincol, + field->frow, + field->fcol, + field->frow, + field->cols + field->fcol - 1, + 0); + } + else + { + /* A multi-line, i.e. vertical scrolling field */ + int row_after_bottom, first_modified_row, first_unmodified_row; - if (field->drows > field->rows) + if (field->drows > field->rows) + { + row_after_bottom = form->toprow + field->rows; + if (form->currow < form->toprow) { - row_after_bottom = form->toprow + field->rows; - if (form->currow < form->toprow) - { - form->toprow = form->currow; - SetStatus(field, _NEWTOP); - } - if (form->currow >= row_after_bottom) - { - form->toprow = form->currow - field->rows + 1; - SetStatus(field, _NEWTOP); - } - if (field->status & _NEWTOP) - { - /* means we have to copy whole range */ - first_modified_row = form->toprow; - first_unmodified_row = first_modified_row + field->rows; - ClrStatus(field, _NEWTOP); - } - else - { - /* we try to optimize : finding the range of touched - lines */ - first_modified_row = form->toprow; - while (first_modified_row < row_after_bottom) - { - if (is_linetouched(form->w, first_modified_row)) - break; - first_modified_row++; - } - first_unmodified_row = first_modified_row; - while (first_unmodified_row < row_after_bottom) - { - if (!is_linetouched(form->w, first_unmodified_row)) - break; - first_unmodified_row++; - } - } + form->toprow = form->currow; + SetStatus(field, _NEWTOP); } - else + if (form->currow >= row_after_bottom) { + form->toprow = form->currow - field->rows + 1; + SetStatus(field, _NEWTOP); + } + if (field->status & _NEWTOP) + { + /* means we have to copy whole range */ first_modified_row = form->toprow; first_unmodified_row = first_modified_row + field->rows; + ClrStatus(field, _NEWTOP); + } + else + { + /* we try to optimize : finding the range of touched + lines */ + first_modified_row = form->toprow; + while (first_modified_row < row_after_bottom) + { + if (is_linetouched(form->w, first_modified_row)) + break; + first_modified_row++; + } + first_unmodified_row = first_modified_row; + while (first_unmodified_row < row_after_bottom) + { + if (!is_linetouched(form->w, first_unmodified_row)) + break; + first_unmodified_row++; + } } - if (first_unmodified_row != first_modified_row) - copywin(form->w, - formwin, - first_modified_row, - 0, - field->frow + first_modified_row - form->toprow, - field->fcol, - field->frow + first_unmodified_row - form->toprow - 1, - field->cols + field->fcol - 1, - 0); } - wsyncup(formwin); - } - else - { - /* if the field-window is simply a derived window, i.e. contains no - * invisible parts, the whole thing is trivial - */ - wsyncup(form->w); + else + { + first_modified_row = form->toprow; + first_unmodified_row = first_modified_row + field->rows; + } + if (first_unmodified_row != first_modified_row && is_public) + copywin(form->w, + formwin, + first_modified_row, + 0, + field->frow + first_modified_row - form->toprow, + field->fcol, + field->frow + first_unmodified_row - form->toprow - 1, + field->cols + field->fcol - 1, + 0); } + if (is_public) + wsyncup(formwin); + } + else + { + /* if the field-window is simply a derived window, i.e. contains no + * invisible parts, the whole thing is trivial + */ + if (is_public) + wsyncup(form->w); } untouchwin(form->w); returnCode(_nc_Position_Form_Cursor(form)); @@ -979,7 +1007,9 @@ Perform_Justification(FIELD *field, WINDOW *win) int len; int col = 0; - bp = Get_Start_Of_Data(field->buf, Buffer_Length(field)); + bp = (Field_Has_Option(field, O_NO_LEFT_STRIP) + ? field->buf + : Get_Start_Of_Data(field->buf, Buffer_Length(field))); len = (int)(After_End_Of_Data(field->buf, Buffer_Length(field)) - bp); if (len > 0) @@ -1021,9 +1051,14 @@ static void Undo_Justification(FIELD *field, WINDOW *win) { FIELD_CELL *bp; + int y, x; int len; - bp = Get_Start_Of_Data(field->buf, Buffer_Length(field)); + getyx(win, y, x); + + bp = (Field_Has_Option(field, O_NO_LEFT_STRIP) + ? field->buf + : Get_Start_Of_Data(field->buf, Buffer_Length(field))); len = (int)(After_End_Of_Data(field->buf, Buffer_Length(field)) - bp); if (len > 0) @@ -1032,6 +1067,7 @@ Undo_Justification(FIELD *field, WINDOW *win) wmove(win, 0, 0); myADDNSTR(win, bp, len); } + wmove(win, y, x); } /*--------------------------------------------------------------------------- @@ -1271,7 +1307,8 @@ _nc_Synchronize_Attributes(FIELD *field) copywin(form->w, formwin, 0, 0, field->frow, field->fcol, - field->rows - 1, field->cols - 1, 0); + field->frow + field->rows - 1, + field->fcol + field->cols - 1, 0); wsyncup(formwin); Buffer_To_Window(field, form->w); SetStatus(field, _NEWTOP); /* fake refresh to paint all */ @@ -1391,6 +1428,57 @@ _nc_Synchronize_Options(FIELD *field, Field_Options newopts) returnCode(res); } +/* + * Removes the focus from the current field of the form. + */ +void +_nc_Unset_Current_Field(FORM *form) +{ + FIELD *field = form->current; + + _nc_Refresh_Current_Field(form); + if (Field_Has_Option(field, O_PUBLIC)) + { + if (field->drows > field->rows) + { + if (form->toprow == 0) + ClrStatus(field, _NEWTOP); + else + SetStatus(field, _NEWTOP); + } + else + { + if (Justification_Allowed(field)) + { + Window_To_Buffer(form, field); + werase(form->w); + Perform_Justification(field, form->w); + if (Field_Has_Option(field, O_DYNAMIC_JUSTIFY) && + (form->w->_parent == 0)) + { + copywin(form->w, + Get_Form_Window(form), + 0, + 0, + field->frow, + field->fcol, + field->frow, + field->cols + field->fcol - 1, + 0); + wsyncup(Get_Form_Window(form)); + } + else + { + wsyncup(form->w); + } + } + } + } + delwin(form->w); + form->w = (WINDOW *)0; + form->current = 0; +} + /*--------------------------------------------------------------------------- | Facility : libnform | Function : int _nc_Set_Current_Field(FORM * form, @@ -1411,7 +1499,7 @@ _nc_Set_Current_Field(FORM *form, FIELD *newfield) T((T_CALLED("_nc_Set_Current_Field(%p,%p)"), (void *)form, (void *)newfield)); - if (!form || !newfield || !form->current || (newfield->form != form)) + if (!form || !newfield || (newfield->form != form)) returnCode(E_BAD_ARGUMENT); if ((form->status & _IN_DRIVER)) @@ -1425,51 +1513,10 @@ _nc_Set_Current_Field(FORM *form, FIELD *newfield) if ((field != newfield) || !(form->status & _POSTED)) { - if ((form->w) && + if (field && (form->w) && (Field_Has_Option(field, O_VISIBLE)) && (field->form->curpage == field->page)) - { - _nc_Refresh_Current_Field(form); - if (Field_Has_Option(field, O_PUBLIC)) - { - if (field->drows > field->rows) - { - if (form->toprow == 0) - ClrStatus(field, _NEWTOP); - else - SetStatus(field, _NEWTOP); - } - else - { - if (Justification_Allowed(field)) - { - Window_To_Buffer(form, field); - werase(form->w); - Perform_Justification(field, form->w); - if (Field_Has_Option(field, O_DYNAMIC_JUSTIFY) && - (form->w->_parent == 0)) - { - copywin(form->w, - Get_Form_Window(form), - 0, - 0, - field->frow, - field->fcol, - field->frow, - field->cols + field->fcol - 1, - 0); - wsyncup(Get_Form_Window(form)); - } - else - { - wsyncup(form->w); - } - } - } - } - delwin(form->w); - form->w = (WINDOW *)0; - } + _nc_Unset_Current_Field(form); field = newfield; @@ -4030,7 +4077,7 @@ Data_Entry_w(FORM *form, wchar_t c) cchar_t temp_ch; given[0] = c; - given[1] = 1; + given[1] = 0; setcchar(&temp_ch, given, 0, 0, (void *)0); if ((Field_Has_Option(field, O_BLANK)) && First_Position_In_Current_Field(form) && @@ -4143,6 +4190,12 @@ Data_Entry(FORM *form, int c) bool End_Of_Field = (((field->drows - 1) == form->currow) && ((field->dcols - 1) == form->curcol)); + if (Field_Has_Option(field, O_EDGE_INSERT_STAY)) + move_after_insert = !!(form->curcol + - form->begincol + - field->cols + + 1); + SetStatus(form, _WINDOW_MODIFIED); if (End_Of_Field && !Growable(field) && (Field_Has_Option(field, O_AUTOSKIP))) result = Inter_Field_Navigation(FN_Next_Field, form); @@ -4307,12 +4360,14 @@ form_driver(FORM *form, int c) const Binding_Info *BI = (Binding_Info *) 0; int res = E_UNKNOWN_COMMAND; + move_after_insert = TRUE; + T((T_CALLED("form_driver(%p,%d)"), (void *)form, c)); if (!form) RETURN(E_BAD_ARGUMENT); - if (!(form->field)) + if (!(form->field) || !(form->current)) RETURN(E_NOT_CONNECTED); assert(form->page); diff --git a/form/frm_hook.c b/form/frm_hook.c index 23850bf..3051cdd 100644 --- a/form/frm_hook.c +++ b/form/frm_hook.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * + * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 1998-2012,2016 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 * @@ -32,13 +33,14 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_hook.c,v 1.16 2012/03/11 00:37:16 tom Exp $") +MODULE_ID("$Id: frm_hook.c,v 1.19 2020/02/02 23:34:34 tom Exp $") /* "Template" macro to generate function to set application specific hook */ #define GEN_HOOK_SET_FUNCTION( typ, name ) \ NCURSES_IMPEXP int NCURSES_API set_ ## typ ## _ ## name (FORM *form, Form_Hook func)\ {\ - T((T_CALLED("set_" #typ"_"#name"(%p,%p)"), (void *) form, func));\ + TR_FUNC_BFR(1); \ + T((T_CALLED("set_" #typ"_"#name"(%p,%s)"), (void *) form, TR_FUNC_ARG(0, func)));\ (Normalize_Form( form ) -> typ ## name) = func ;\ RETURN(E_OK);\ } diff --git a/form/frm_opts.c b/form/frm_opts.c index 42d6267..18ab293 100644 --- a/form/frm_opts.c +++ b/form/frm_opts.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * + * Copyright 2020 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 * @@ -32,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_opts.c,v 1.17 2013/08/24 22:58:47 tom Exp $") +MODULE_ID("$Id: frm_opts.c,v 1.18 2020/02/02 23:34:34 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/form/frm_page.c b/form/frm_page.c index 13520da..c8569ee 100644 --- a/form/frm_page.c +++ b/form/frm_page.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2010,2012 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 * @@ -32,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_page.c,v 1.12 2012/06/10 00:28:04 tom Exp $") +MODULE_ID("$Id: frm_page.c,v 1.13 2020/02/02 23:34:34 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/form/frm_post.c b/form/frm_post.c index 31568b2..2f1ad81 100644 --- a/form/frm_post.c +++ b/form/frm_post.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2010,2012 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 * @@ -32,12 +33,12 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_post.c,v 1.11 2012/06/10 00:27:49 tom Exp $") +MODULE_ID("$Id: frm_post.c,v 1.13 2020/02/02 23:34:34 tom Exp $") /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : int post_form(FORM * form) -| +| | Description : Writes the form into its associated subwindow. | | Return Values : E_OK - success @@ -69,7 +70,7 @@ post_form(FORM *form) if ((form->cols > getmaxx(formwin)) || (form->rows > getmaxy(formwin))) RETURN(E_NO_ROOM); - /* reset form->curpage to an invald value. This forces Set_Form_Page + /* reset form->curpage to an invalid value. This forces Set_Form_Page to do the page initialization which is required by post_form. */ page = form->curpage; @@ -87,9 +88,9 @@ post_form(FORM *form) } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : int unpost_form(FORM * form) -| +| | Description : Erase form from its associated subwindow. | | Return Values : E_OK - success diff --git a/form/frm_req_name.c b/form/frm_req_name.c index c24db1a..1e56c3d 100644 --- a/form/frm_req_name.c +++ b/form/frm_req_name.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2009,2012 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2012,2015 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 * @@ -37,73 +38,77 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_req_name.c,v 1.18 2012/07/21 23:17:23 tom Exp $") +MODULE_ID("$Id: frm_req_name.c,v 1.20 2020/02/02 23:34:34 tom Exp $") -static const char *request_names[MAX_FORM_COMMAND - MIN_FORM_COMMAND + 1] = +#define DATA(s) { s } + +static const char request_names[MAX_FORM_COMMAND - MIN_FORM_COMMAND + 1][13] = { - "NEXT_PAGE", - "PREV_PAGE", - "FIRST_PAGE", - "LAST_PAGE", - - "NEXT_FIELD", - "PREV_FIELD", - "FIRST_FIELD", - "LAST_FIELD", - "SNEXT_FIELD", - "SPREV_FIELD", - "SFIRST_FIELD", - "SLAST_FIELD", - "LEFT_FIELD", - "RIGHT_FIELD", - "UP_FIELD", - "DOWN_FIELD", - - "NEXT_CHAR", - "PREV_CHAR", - "NEXT_LINE", - "PREV_LINE", - "NEXT_WORD", - "PREV_WORD", - "BEG_FIELD", - "END_FIELD", - "BEG_LINE", - "END_LINE", - "LEFT_CHAR", - "RIGHT_CHAR", - "UP_CHAR", - "DOWN_CHAR", - - "NEW_LINE", - "INS_CHAR", - "INS_LINE", - "DEL_CHAR", - "DEL_PREV", - "DEL_LINE", - "DEL_WORD", - "CLR_EOL", - "CLR_EOF", - "CLR_FIELD", - "OVL_MODE", - "INS_MODE", - "SCR_FLINE", - "SCR_BLINE", - "SCR_FPAGE", - "SCR_BPAGE", - "SCR_FHPAGE", - "SCR_BHPAGE", - "SCR_FCHAR", - "SCR_BCHAR", - "SCR_HFLINE", - "SCR_HBLINE", - "SCR_HFHALF", - "SCR_HBHALF", - - "VALIDATION", - "NEXT_CHOICE", - "PREV_CHOICE" + DATA("NEXT_PAGE"), + DATA("PREV_PAGE"), + DATA("FIRST_PAGE"), + DATA("LAST_PAGE"), + + DATA("NEXT_FIELD"), + DATA("PREV_FIELD"), + DATA("FIRST_FIELD"), + DATA("LAST_FIELD"), + DATA("SNEXT_FIELD"), + DATA("SPREV_FIELD"), + DATA("SFIRST_FIELD"), + DATA("SLAST_FIELD"), + DATA("LEFT_FIELD"), + DATA("RIGHT_FIELD"), + DATA("UP_FIELD"), + DATA("DOWN_FIELD"), + + DATA("NEXT_CHAR"), + DATA("PREV_CHAR"), + DATA("NEXT_LINE"), + DATA("PREV_LINE"), + DATA("NEXT_WORD"), + DATA("PREV_WORD"), + DATA("BEG_FIELD"), + DATA("END_FIELD"), + DATA("BEG_LINE"), + DATA("END_LINE"), + DATA("LEFT_CHAR"), + DATA("RIGHT_CHAR"), + DATA("UP_CHAR"), + DATA("DOWN_CHAR"), + + DATA("NEW_LINE"), + DATA("INS_CHAR"), + DATA("INS_LINE"), + DATA("DEL_CHAR"), + DATA("DEL_PREV"), + DATA("DEL_LINE"), + DATA("DEL_WORD"), + DATA("CLR_EOL"), + DATA("CLR_EOF"), + DATA("CLR_FIELD"), + DATA("OVL_MODE"), + DATA("INS_MODE"), + DATA("SCR_FLINE"), + DATA("SCR_BLINE"), + DATA("SCR_FPAGE"), + DATA("SCR_BPAGE"), + DATA("SCR_FHPAGE"), + DATA("SCR_BHPAGE"), + DATA("SCR_FCHAR"), + DATA("SCR_BCHAR"), + DATA("SCR_HFLINE"), + DATA("SCR_HBLINE"), + DATA("SCR_HFHALF"), + DATA("SCR_HBHALF"), + + DATA("VALIDATION"), + DATA("NEXT_CHOICE"), + DATA("PREV_CHOICE") }; +#undef DATA + #define A_SIZE (sizeof(request_names)/sizeof(request_names[0])) /*--------------------------------------------------------------------------- diff --git a/form/frm_scale.c b/form/frm_scale.c index 27e154e..34c3611 100644 --- a/form/frm_scale.c +++ b/form/frm_scale.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2004,2010 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 * @@ -32,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_scale.c,v 1.10 2010/01/23 21:14:36 tom Exp $") +MODULE_ID("$Id: frm_scale.c,v 1.11 2020/02/02 23:34:34 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/form/frm_sub.c b/form/frm_sub.c index 1ab131a..9621e30 100644 --- a/form/frm_sub.c +++ b/form/frm_sub.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2009,2010 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 * @@ -32,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_sub.c,v 1.12 2010/01/23 21:14:36 tom Exp $") +MODULE_ID("$Id: frm_sub.c,v 1.13 2020/02/02 23:34:34 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/form/frm_user.c b/form/frm_user.c index 1375b5e..e1210f2 100644 --- a/form/frm_user.c +++ b/form/frm_user.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2004,2010 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 * @@ -32,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_user.c,v 1.15 2010/01/23 21:14:36 tom Exp $") +MODULE_ID("$Id: frm_user.c,v 1.16 2020/02/02 23:34:34 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/form/frm_win.c b/form/frm_win.c index a65cc59..b7d1272 100644 --- a/form/frm_win.c +++ b/form/frm_win.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2009,2010 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 * @@ -32,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_win.c,v 1.16 2010/01/23 21:14:36 tom Exp $") +MODULE_ID("$Id: frm_win.c,v 1.17 2020/02/02 23:34:34 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/form/fty_alnum.c b/form/fty_alnum.c index cda23dc..a2ca351 100644 --- a/form/fty_alnum.c +++ b/form/fty_alnum.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2009,2010 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 * @@ -34,7 +35,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_alnum.c,v 1.24 2010/01/23 21:14:36 tom Exp $") +MODULE_ID("$Id: fty_alnum.c,v 1.25 2020/02/02 23:34:34 tom Exp $") #define thisARG alnumARG diff --git a/form/fty_alpha.c b/form/fty_alpha.c index 917a9e0..7dec23f 100644 --- a/form/fty_alpha.c +++ b/form/fty_alpha.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2009,2010 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 * @@ -34,7 +35,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_alpha.c,v 1.26 2010/01/23 21:14:36 tom Exp $") +MODULE_ID("$Id: fty_alpha.c,v 1.27 2020/02/02 23:34:34 tom Exp $") #define thisARG alphaARG diff --git a/form/fty_enum.c b/form/fty_enum.c index d335164..71978e3 100644 --- a/form/fty_enum.c +++ b/form/fty_enum.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2009,2010 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 * @@ -34,7 +35,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_enum.c,v 1.26 2010/05/01 21:11:07 tom Exp $") +MODULE_ID("$Id: fty_enum.c,v 1.27 2020/02/02 23:34:34 tom Exp $") typedef struct { diff --git a/form/fty_generic.c b/form/fty_generic.c index 429ceac..159d305 100644 --- a/form/fty_generic.c +++ b/form/fty_generic.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 2008-2010,2012 Free Software Foundation, Inc. * + * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 2008-2012,2016 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 * @@ -34,7 +35,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_generic.c,v 1.6 2012/06/10 00:27:49 tom Exp $") +MODULE_ID("$Id: fty_generic.c,v 1.10 2020/02/02 23:34:34 tom Exp $") /* * This is not a full implementation of a field type, but adds some @@ -55,15 +56,15 @@ MODULE_ID("$Id: fty_generic.c,v 1.6 2012/06/10 00:27:49 tom Exp $") * fieldtype they register with the forms library using this call. * * For that purpose we have extended the fieldtype struc by a new element - * that gets the arguments from a single struct passed by the caller. - * + * that gets the arguments from a single struct passed by the caller. + * */ #if NCURSES_INTEROP_FUNCS /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static void *Generic_This_Type( void * arg ) -| +| | Description : We interpret the passed arg just as a handle the | calling language uses to keep track of its allocated | argument structures. We can simply copy it back. @@ -89,7 +90,7 @@ Generic_This_Type(void *arg) | write a field_check and a char_check function and give | them as input to this call. A callback to allow the | release of the allocated memory must also be provided. -| For generic field types, we provide some more +| For generic field types, we provide some more | information about the field as parameters. | | If an error occurs, errno is set to @@ -109,8 +110,14 @@ _nc_generic_fieldtype(bool (*const field_check) (FORM *, FIELD *, const void *), int code = E_SYSTEM_ERROR; FIELDTYPE *res = (FIELDTYPE *)0; - T((T_CALLED("_nc_generic_fieldtype(%p,%p,%p,%p,%p)"), - field_check, char_check, next, prev, freecallback)); + TR_FUNC_BFR(5); + + T((T_CALLED("_nc_generic_fieldtype(%s,%s,%s,%s,%s)"), + TR_FUNC_ARG(0, field_check), + TR_FUNC_ARG(1, char_check), + TR_FUNC_ARG(2, next), + TR_FUNC_ARG(3, prev), + TR_FUNC_ARG(4, freecallback))); if (field_check || char_check) { @@ -139,16 +146,16 @@ _nc_generic_fieldtype(bool (*const field_check) (FORM *, FIELD *, const void *), } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static TypeArgument *GenericArgument( | const FIELDTYPE* typ, | int (*argiterator)(void**), | int* err) -| +| | Description : The iterator callback must browse through all fieldtype | parameters that have an argument associated with the | type. The iterator returns 1 if the operation to get -| the next element was successfull, 0 otherwise. If the +| the next element was successful, 0 otherwise. If the | iterator could move to the next argument, it fills | the void* pointer representing the argument into the | location provided as argument to the iterator. @@ -200,14 +207,14 @@ GenericArgument(const FIELDTYPE *typ, } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : int _nc_set_generic_fieldtype( | FIELD* field, | FIELDTYPE* ftyp, | int (*argiterator)(void**)) -| +| | Description : Assign the fieldtype to the field and use the iterator -| mechanism to get the arguments when a check is +| mechanism to get the arguments when a check is | performed. | | Return Values : E_OK if all went well @@ -258,11 +265,11 @@ _nc_set_generic_fieldtype(FIELD *field, } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : WINDOW* _nc_form_cursor( | FORM* form, | int *pRow, int *pCol) -| +| | Description : Get the current position of the form cursor position | We also return the field window | diff --git a/form/fty_int.c b/form/fty_int.c index 1e43874..7105640 100644 --- a/form/fty_int.c +++ b/form/fty_int.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2010,2012 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 * @@ -34,7 +35,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_int.c,v 1.26 2012/02/23 10:02:15 tom Exp $") +MODULE_ID("$Id: fty_int.c,v 1.27 2020/02/02 23:34:34 tom Exp $") #if USE_WIDEC_SUPPORT #define isDigit(c) (iswdigit((wint_t)(c)) || isdigit(UChar(c))) diff --git a/form/fty_ipv4.c b/form/fty_ipv4.c index 8dc04f8..3713377 100644 --- a/form/fty_ipv4.c +++ b/form/fty_ipv4.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2006,2009 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2006,2009 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 * @@ -34,7 +35,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_ipv4.c,v 1.10 2009/11/07 20:17:58 tom Exp $") +MODULE_ID("$Id: fty_ipv4.c,v 1.11 2020/02/02 23:34:34 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform diff --git a/form/fty_num.c b/form/fty_num.c index 8cce43f..b4dfeb9 100644 --- a/form/fty_num.c +++ b/form/fty_num.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * + * Copyright 2019,2020 Thomas E. Dickey * + * Copyright 1998-2010,2012 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 * @@ -34,13 +35,13 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_num.c,v 1.29 2012/02/23 10:02:15 tom Exp $") +MODULE_ID("$Id: fty_num.c,v 1.32 2020/02/02 23:34:34 tom Exp $") #if HAVE_LOCALE_H #include <locale.h> #endif -#if HAVE_LOCALE_H +#if HAVE_LOCALE_H && HAVE_LOCALECONV #define isDecimalPoint(c) ((c) == ((L && L->decimal_point) ? *(L->decimal_point) : '.')) #else #define isDecimalPoint(c) ((c) == '.') @@ -96,7 +97,7 @@ Generic_This_Type(void *arg) argn->low = args->low; argn->high = args->high; -#if HAVE_LOCALE_H +#if HAVE_LOCALE_H && HAVE_LOCALECONV argn->L = localeconv(); #else argn->L = NULL; diff --git a/form/fty_regex.c b/form/fty_regex.c index 194a52e..da0ef08 100644 --- a/form/fty_regex.c +++ b/form/fty_regex.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2012,2015 Free Software Foundation, Inc. * + * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 1998-2012,2015 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 * @@ -34,10 +35,17 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_regex.c,v 1.26 2015/01/10 17:10:25 tom Exp $") +MODULE_ID("$Id: fty_regex.c,v 1.28 2020/02/02 23:34:34 tom Exp $") -#if HAVE_REGEX_H_FUNCS /* We prefer POSIX regex */ +#if HAVE_REGEX_H_FUNCS || HAVE_LIB_PCRE2 /* We prefer POSIX regex */ + +#if HAVE_PCRE2_POSIX_H +#include <pcre2-posix.h> +#elif HAVE_PCREPOSIX_H +#include <pcreposix.h> +#else #include <regex.h> +#endif typedef struct { diff --git a/form/headers b/form/headers index 56d72f0..0969e3f 100644 --- a/form/headers +++ b/form/headers @@ -1,5 +1,6 @@ ############################################################################## -# Copyright (c) 1998,2006 Free Software Foundation, Inc. # +# Copyright 2020 Thomas E. Dickey # +# Copyright 1998,2006 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 "Software"), # diff --git a/form/llib-lform b/form/llib-lform index 2b6abdc..b7f2acb 100644 --- a/form/llib-lform +++ b/form/llib-lform @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2005,2010 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 1998-2015,2017 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,7 +28,7 @@ ****************************************************************************/ /**************************************************************************** - * Author: Thomas E. Dickey 1996-2005,2010 * + * Author: Thomas E. Dickey 1996-on * ****************************************************************************/ /* LINTLIBRARY */ @@ -110,6 +111,11 @@ int set_current_field( FIELD *field) { return(*(int *)0); } +#undef unfocus_current_field +int unfocus_current_field( + FORM *const form) + { return(*(int *)0); } + #undef current_field FIELD *current_field( const FORM *form) @@ -458,6 +464,11 @@ int _nc_Synchronize_Options( Field_Options newopts) { return(*(int *)0); } +#undef _nc_Unset_Current_Field +void _nc_Unset_Current_Field( + FORM *form) + { /* void */ } + #undef _nc_Set_Current_Field int _nc_Set_Current_Field( FORM *form, @@ -674,6 +685,10 @@ alnumARG; #undef TYPE_ALNUM FIELDTYPE *TYPE_ALNUM; +#undef _nc_TYPE_ALNUM +FIELDTYPE *_nc_TYPE_ALNUM(void) + { return(*(FIELDTYPE **)0); } + /* ./fty_alpha.c */ typedef struct @@ -685,6 +700,10 @@ alphaARG; #undef TYPE_ALPHA FIELDTYPE *TYPE_ALPHA; +#undef _nc_TYPE_ALPHA +FIELDTYPE *_nc_TYPE_ALPHA(void) + { return(*(FIELDTYPE **)0); } + /* ./fty_enum.c */ typedef struct @@ -707,11 +726,49 @@ enumParams; #undef TYPE_ENUM FIELDTYPE *TYPE_ENUM; +#undef _nc_TYPE_ENUM +FIELDTYPE *_nc_TYPE_ENUM(void) + { return(*(FIELDTYPE **)0); } + /* ./fty_generic.c */ -#undef _nc_fty_generic -void _nc_fty_generic(void) - { /* void */ } +#undef _nc_generic_fieldtype +FIELDTYPE *_nc_generic_fieldtype( + NCURSES_BOOL (*const field_check)( + FORM *p1, + FIELD *p2, + const void *p3), + NCURSES_BOOL (*const char_check)( + int p1, + FORM *p2, + FIELD *p3, + const void *p4), + NCURSES_BOOL (*const next)( + FORM *p1, + FIELD *p2, + const void *p3), + NCURSES_BOOL (*const prev)( + FORM *p1, + FIELD *p2, + const void *p3), + void (*freecallback)( + void *p1)) + { return(*(FIELDTYPE **)0); } + +#undef _nc_set_generic_fieldtype +int _nc_set_generic_fieldtype( + FIELD *field, + FIELDTYPE *ftyp, + int (*argiterator)( + void **p1)) + { return(*(int *)0); } + +#undef _nc_form_cursor +WINDOW *_nc_form_cursor( + const FORM *form, + int *pRow, + int *pCol) + { return(*(WINDOW **)0); } /* ./fty_int.c */ @@ -734,13 +791,20 @@ integerPARM; #undef TYPE_INTEGER FIELDTYPE *TYPE_INTEGER; +#undef _nc_TYPE_INTEGER +FIELDTYPE *_nc_TYPE_INTEGER(void) + { return(*(FIELDTYPE **)0); } + /* ./fty_ipv4.c */ + #undef TYPE_IPV4 FIELDTYPE *TYPE_IPV4; -/* ./fty_num.c */ +#undef _nc_TYPE_IPV4 +FIELDTYPE *_nc_TYPE_IPV4(void) + { return(*(FIELDTYPE **)0); } -#include <locale.h> +/* ./fty_num.c */ typedef struct { @@ -762,9 +826,11 @@ thisPARM; #undef TYPE_NUMERIC FIELDTYPE *TYPE_NUMERIC; -/* ./fty_regex.c */ +#undef _nc_TYPE_NUMERIC +FIELDTYPE *_nc_TYPE_NUMERIC(void) + { return(*(FIELDTYPE **)0); } -#include <regex.h> +/* ./fty_regex.c */ typedef struct { @@ -775,3 +841,7 @@ RegExp_Arg; #undef TYPE_REGEXP FIELDTYPE *TYPE_REGEXP; + +#undef _nc_TYPE_REGEXP +FIELDTYPE *_nc_TYPE_REGEXP(void) + { return(*(FIELDTYPE **)0); } diff --git a/form/llib-lformt b/form/llib-lformt index 33de63c..6460016 100644 --- a/form/llib-lformt +++ b/form/llib-lformt @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 2010 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 2010-2015,2017 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,7 +28,7 @@ ****************************************************************************/ /**************************************************************************** - * Author: Thomas E. Dickey 2010 * + * Author: Thomas E. Dickey 2010-on * ****************************************************************************/ /* LINTLIBRARY */ @@ -110,6 +111,11 @@ int set_current_field( FIELD *field) { return(*(int *)0); } +#undef unfocus_current_field +int unfocus_current_field( + FORM *const form) + { return(*(int *)0); } + #undef current_field FIELD *current_field( const FORM *form) @@ -458,6 +464,11 @@ int _nc_Synchronize_Options( Field_Options newopts) { return(*(int *)0); } +#undef _nc_Unset_Current_Field +void _nc_Unset_Current_Field( + FORM *form) + { /* void */ } + #undef _nc_Set_Current_Field int _nc_Set_Current_Field( FORM *form, @@ -674,6 +685,10 @@ alnumARG; #undef TYPE_ALNUM FIELDTYPE *TYPE_ALNUM; +#undef _nc_TYPE_ALNUM +FIELDTYPE *_nc_TYPE_ALNUM(void) + { return(*(FIELDTYPE **)0); } + /* ./fty_alpha.c */ typedef struct @@ -685,6 +700,10 @@ alphaARG; #undef TYPE_ALPHA FIELDTYPE *TYPE_ALPHA; +#undef _nc_TYPE_ALPHA +FIELDTYPE *_nc_TYPE_ALPHA(void) + { return(*(FIELDTYPE **)0); } + /* ./fty_enum.c */ typedef struct @@ -707,11 +726,49 @@ enumParams; #undef TYPE_ENUM FIELDTYPE *TYPE_ENUM; +#undef _nc_TYPE_ENUM +FIELDTYPE *_nc_TYPE_ENUM(void) + { return(*(FIELDTYPE **)0); } + /* ./fty_generic.c */ -#undef _nc_fty_generic -void _nc_fty_generic(void) - { /* void */ } +#undef _nc_generic_fieldtype +FIELDTYPE *_nc_generic_fieldtype( + NCURSES_BOOL (*const field_check)( + FORM *p1, + FIELD *p2, + const void *p3), + NCURSES_BOOL (*const char_check)( + int p1, + FORM *p2, + FIELD *p3, + const void *p4), + NCURSES_BOOL (*const next)( + FORM *p1, + FIELD *p2, + const void *p3), + NCURSES_BOOL (*const prev)( + FORM *p1, + FIELD *p2, + const void *p3), + void (*freecallback)( + void *p1)) + { return(*(FIELDTYPE **)0); } + +#undef _nc_set_generic_fieldtype +int _nc_set_generic_fieldtype( + FIELD *field, + FIELDTYPE *ftyp, + int (*argiterator)( + void **p1)) + { return(*(int *)0); } + +#undef _nc_form_cursor +WINDOW *_nc_form_cursor( + const FORM *form, + int *pRow, + int *pCol) + { return(*(WINDOW **)0); } /* ./fty_int.c */ @@ -734,13 +791,20 @@ integerPARM; #undef TYPE_INTEGER FIELDTYPE *TYPE_INTEGER; +#undef _nc_TYPE_INTEGER +FIELDTYPE *_nc_TYPE_INTEGER(void) + { return(*(FIELDTYPE **)0); } + /* ./fty_ipv4.c */ + #undef TYPE_IPV4 FIELDTYPE *TYPE_IPV4; -/* ./fty_num.c */ +#undef _nc_TYPE_IPV4 +FIELDTYPE *_nc_TYPE_IPV4(void) + { return(*(FIELDTYPE **)0); } -#include <locale.h> +/* ./fty_num.c */ typedef struct { @@ -762,9 +826,11 @@ thisPARM; #undef TYPE_NUMERIC FIELDTYPE *TYPE_NUMERIC; -/* ./fty_regex.c */ +#undef _nc_TYPE_NUMERIC +FIELDTYPE *_nc_TYPE_NUMERIC(void) + { return(*(FIELDTYPE **)0); } -#include <regex.h> +/* ./fty_regex.c */ typedef struct { @@ -775,3 +841,7 @@ RegExp_Arg; #undef TYPE_REGEXP FIELDTYPE *TYPE_REGEXP; + +#undef _nc_TYPE_REGEXP +FIELDTYPE *_nc_TYPE_REGEXP(void) + { return(*(FIELDTYPE **)0); } diff --git a/form/llib-lformtw b/form/llib-lformtw index 6e9cd13..a24dd1a 100644 --- a/form/llib-lformtw +++ b/form/llib-lformtw @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 2010,2013 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 2010-2015,2017 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 * @@ -110,6 +111,11 @@ int set_current_field( FIELD *field) { return(*(int *)0); } +#undef unfocus_current_field +int unfocus_current_field( + FORM *const form) + { return(*(int *)0); } + #undef current_field FIELD *current_field( const FORM *form) @@ -458,6 +464,11 @@ int _nc_Synchronize_Options( Field_Options newopts) { return(*(int *)0); } +#undef _nc_Unset_Current_Field +void _nc_Unset_Current_Field( + FORM *form) + { /* void */ } + #undef _nc_Set_Current_Field int _nc_Set_Current_Field( FORM *form, @@ -687,6 +698,10 @@ alnumARG; #undef TYPE_ALNUM FIELDTYPE *TYPE_ALNUM; +#undef _nc_TYPE_ALNUM +FIELDTYPE *_nc_TYPE_ALNUM(void) + { return(*(FIELDTYPE **)0); } + /* ./fty_alpha.c */ typedef struct @@ -698,6 +713,10 @@ alphaARG; #undef TYPE_ALPHA FIELDTYPE *TYPE_ALPHA; +#undef _nc_TYPE_ALPHA +FIELDTYPE *_nc_TYPE_ALPHA(void) + { return(*(FIELDTYPE **)0); } + /* ./fty_enum.c */ typedef struct @@ -720,11 +739,49 @@ enumParams; #undef TYPE_ENUM FIELDTYPE *TYPE_ENUM; +#undef _nc_TYPE_ENUM +FIELDTYPE *_nc_TYPE_ENUM(void) + { return(*(FIELDTYPE **)0); } + /* ./fty_generic.c */ -#undef _nc_fty_generic -void _nc_fty_generic(void) - { /* void */ } +#undef _nc_generic_fieldtype +FIELDTYPE *_nc_generic_fieldtype( + NCURSES_BOOL (*const field_check)( + FORM *p1, + FIELD *p2, + const void *p3), + NCURSES_BOOL (*const char_check)( + int p1, + FORM *p2, + FIELD *p3, + const void *p4), + NCURSES_BOOL (*const next)( + FORM *p1, + FIELD *p2, + const void *p3), + NCURSES_BOOL (*const prev)( + FORM *p1, + FIELD *p2, + const void *p3), + void (*freecallback)( + void *p1)) + { return(*(FIELDTYPE **)0); } + +#undef _nc_set_generic_fieldtype +int _nc_set_generic_fieldtype( + FIELD *field, + FIELDTYPE *ftyp, + int (*argiterator)( + void **p1)) + { return(*(int *)0); } + +#undef _nc_form_cursor +WINDOW *_nc_form_cursor( + const FORM *form, + int *pRow, + int *pCol) + { return(*(WINDOW **)0); } /* ./fty_int.c */ @@ -747,13 +804,20 @@ integerPARM; #undef TYPE_INTEGER FIELDTYPE *TYPE_INTEGER; +#undef _nc_TYPE_INTEGER +FIELDTYPE *_nc_TYPE_INTEGER(void) + { return(*(FIELDTYPE **)0); } + /* ./fty_ipv4.c */ + #undef TYPE_IPV4 FIELDTYPE *TYPE_IPV4; -/* ./fty_num.c */ +#undef _nc_TYPE_IPV4 +FIELDTYPE *_nc_TYPE_IPV4(void) + { return(*(FIELDTYPE **)0); } -#include <locale.h> +/* ./fty_num.c */ typedef struct { @@ -775,9 +839,11 @@ thisPARM; #undef TYPE_NUMERIC FIELDTYPE *TYPE_NUMERIC; -/* ./fty_regex.c */ +#undef _nc_TYPE_NUMERIC +FIELDTYPE *_nc_TYPE_NUMERIC(void) + { return(*(FIELDTYPE **)0); } -#include <regex.h> +/* ./fty_regex.c */ typedef struct { @@ -788,3 +854,7 @@ RegExp_Arg; #undef TYPE_REGEXP FIELDTYPE *TYPE_REGEXP; + +#undef _nc_TYPE_REGEXP +FIELDTYPE *_nc_TYPE_REGEXP(void) + { return(*(FIELDTYPE **)0); } diff --git a/form/llib-lformw b/form/llib-lformw index 04cbe2b..de4900d 100644 --- a/form/llib-lformw +++ b/form/llib-lformw @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 2002-2010,2013 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 2002-2015,2017 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,7 +28,7 @@ ****************************************************************************/ /**************************************************************************** - * Author: Thomas E. Dickey 2002-on * + * Author: Thomas E. Dickey 2002-on * ****************************************************************************/ /* LINTLIBRARY */ @@ -110,6 +111,11 @@ int set_current_field( FIELD *field) { return(*(int *)0); } +#undef unfocus_current_field +int unfocus_current_field( + FORM *const form) + { return(*(int *)0); } + #undef current_field FIELD *current_field( const FORM *form) @@ -458,6 +464,11 @@ int _nc_Synchronize_Options( Field_Options newopts) { return(*(int *)0); } +#undef _nc_Unset_Current_Field +void _nc_Unset_Current_Field( + FORM *form) + { /* void */ } + #undef _nc_Set_Current_Field int _nc_Set_Current_Field( FORM *form, @@ -687,6 +698,10 @@ alnumARG; #undef TYPE_ALNUM FIELDTYPE *TYPE_ALNUM; +#undef _nc_TYPE_ALNUM +FIELDTYPE *_nc_TYPE_ALNUM(void) + { return(*(FIELDTYPE **)0); } + /* ./fty_alpha.c */ typedef struct @@ -698,6 +713,10 @@ alphaARG; #undef TYPE_ALPHA FIELDTYPE *TYPE_ALPHA; +#undef _nc_TYPE_ALPHA +FIELDTYPE *_nc_TYPE_ALPHA(void) + { return(*(FIELDTYPE **)0); } + /* ./fty_enum.c */ typedef struct @@ -720,11 +739,49 @@ enumParams; #undef TYPE_ENUM FIELDTYPE *TYPE_ENUM; +#undef _nc_TYPE_ENUM +FIELDTYPE *_nc_TYPE_ENUM(void) + { return(*(FIELDTYPE **)0); } + /* ./fty_generic.c */ -#undef _nc_fty_generic -void _nc_fty_generic(void) - { /* void */ } +#undef _nc_generic_fieldtype +FIELDTYPE *_nc_generic_fieldtype( + NCURSES_BOOL (*const field_check)( + FORM *p1, + FIELD *p2, + const void *p3), + NCURSES_BOOL (*const char_check)( + int p1, + FORM *p2, + FIELD *p3, + const void *p4), + NCURSES_BOOL (*const next)( + FORM *p1, + FIELD *p2, + const void *p3), + NCURSES_BOOL (*const prev)( + FORM *p1, + FIELD *p2, + const void *p3), + void (*freecallback)( + void *p1)) + { return(*(FIELDTYPE **)0); } + +#undef _nc_set_generic_fieldtype +int _nc_set_generic_fieldtype( + FIELD *field, + FIELDTYPE *ftyp, + int (*argiterator)( + void **p1)) + { return(*(int *)0); } + +#undef _nc_form_cursor +WINDOW *_nc_form_cursor( + const FORM *form, + int *pRow, + int *pCol) + { return(*(WINDOW **)0); } /* ./fty_int.c */ @@ -747,13 +804,20 @@ integerPARM; #undef TYPE_INTEGER FIELDTYPE *TYPE_INTEGER; +#undef _nc_TYPE_INTEGER +FIELDTYPE *_nc_TYPE_INTEGER(void) + { return(*(FIELDTYPE **)0); } + /* ./fty_ipv4.c */ + #undef TYPE_IPV4 FIELDTYPE *TYPE_IPV4; -/* ./fty_num.c */ +#undef _nc_TYPE_IPV4 +FIELDTYPE *_nc_TYPE_IPV4(void) + { return(*(FIELDTYPE **)0); } -#include <locale.h> +/* ./fty_num.c */ typedef struct { @@ -775,9 +839,11 @@ thisPARM; #undef TYPE_NUMERIC FIELDTYPE *TYPE_NUMERIC; -/* ./fty_regex.c */ +#undef _nc_TYPE_NUMERIC +FIELDTYPE *_nc_TYPE_NUMERIC(void) + { return(*(FIELDTYPE **)0); } -#include <regex.h> +/* ./fty_regex.c */ typedef struct { @@ -788,3 +854,7 @@ RegExp_Arg; #undef TYPE_REGEXP FIELDTYPE *TYPE_REGEXP; + +#undef _nc_TYPE_REGEXP +FIELDTYPE *_nc_TYPE_REGEXP(void) + { return(*(FIELDTYPE **)0); } diff --git a/form/modules b/form/modules index 205356b..47a3ddf 100644 --- a/form/modules +++ b/form/modules @@ -1,6 +1,7 @@ -# $Id: modules,v 1.17 2010/01/23 16:26:37 tom Exp $ +# $Id: modules,v 1.18 2020/02/02 23:34:34 tom Exp $ ############################################################################## -# Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. # +# Copyright 2020 Thomas E. Dickey # +# Copyright 1998-2008,2010 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 "Software"), # |