diff options
Diffstat (limited to 'form')
-rw-r--r-- | form/Makefile.in | 19 | ||||
-rw-r--r-- | form/f_trace.c | 7 | ||||
-rw-r--r-- | form/fld_arg.c | 13 | ||||
-rw-r--r-- | form/fld_attr.c | 6 | ||||
-rw-r--r-- | form/fld_current.c | 32 | ||||
-rw-r--r-- | form/fld_def.c | 16 | ||||
-rw-r--r-- | form/fld_ftchoice.c | 11 | ||||
-rw-r--r-- | form/fld_max.c | 13 | ||||
-rw-r--r-- | form/fld_newftyp.c | 13 | ||||
-rw-r--r-- | form/form.h | 53 | ||||
-rw-r--r-- | form/form.priv.h | 31 | ||||
-rw-r--r-- | form/frm_driver.c | 401 | ||||
-rw-r--r-- | form/frm_hook.c | 7 | ||||
-rw-r--r-- | form/frm_post.c | 14 | ||||
-rw-r--r-- | form/frm_req_name.c | 132 | ||||
-rw-r--r-- | form/fty_generic.c | 40 | ||||
-rw-r--r-- | form/fty_num.c | 8 | ||||
-rw-r--r-- | form/fty_regex.c | 16 | ||||
-rw-r--r-- | form/llib-lform | 87 | ||||
-rw-r--r-- | form/llib-lformt | 87 | ||||
-rw-r--r-- | form/llib-lformtw | 85 | ||||
-rw-r--r-- | form/llib-lformw | 87 |
22 files changed, 818 insertions, 360 deletions
diff --git a/form/Makefile.in b/form/Makefile.in index 2a8db8d54bd6..8db31ed4ad71 100644 --- a/form/Makefile.in +++ b/form/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.56 2013/08/04 20:23:20 tom Exp $ +# $Id: Makefile.in,v 1.64 2018/01/15 19:28:45 tom Exp $ ############################################################################## -# Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. # +# Copyright (c) 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 +42,7 @@ # turn off _all_ suffix rules; we'll generate our own .SUFFIXES: -SHELL = /bin/sh +SHELL = @SHELL@ VPATH = @srcdir@ THIS = Makefile @@ -51,6 +51,7 @@ o = .@OBJEXT@ MODEL = @DFT_LWR_MODEL@ DESTDIR = @DESTDIR@ +top_srcdir = @top_srcdir@ srcdir = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ @@ -61,7 +62,10 @@ includesubdir = @includesubdir@ INCLUDEDIR = $(DESTDIR)$(includedir)$(includesubdir) +PACKAGE = @PACKAGE@ + LIBTOOL = @LIBTOOL@ +LIBTOOL_OPTS = @LIBTOOL_OPTS@ @EXPORT_SYMS@ LIBTOOL_CLEAN = @LIB_CLEAN@ LIBTOOL_COMPILE = @LIB_COMPILE@ LIBTOOL_LINK = @LIB_LINK@ @@ -71,7 +75,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@ @@ -87,7 +91,7 @@ CC = @CC@ CPP = @CPP@ CFLAGS = @CFLAGS@ -CPPFLAGS = -I@top_srcdir@/ncurses -DHAVE_CONFIG_H @CPPFLAGS@ +CPPFLAGS = -I${top_srcdir}/ncurses -DHAVE_CONFIG_H @CPPFLAGS@ CCFLAGS = $(CPPFLAGS) $(CFLAGS) @@ -103,9 +107,11 @@ 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@ +VERSIONED_SYMS = @VERSIONED_SYMS@ MK_SHARED_LIB = @MK_SHARED_LIB@ NCURSES_MAJOR = @NCURSES_MAJOR@ @@ -162,6 +168,7 @@ clean :: mostlyclean distclean :: clean -rm -f Makefile + -rm -rf .libs *.dSYM realclean :: distclean diff --git a/form/f_trace.c b/form/f_trace.c index 6044e03c6e3a..7f7c84ee8979 100644 --- a/form/f_trace.c +++ b/form/f_trace.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2004,2010 Free Software Foundation, Inc. * + * Copyright (c) 2004-2016,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 * @@ -32,7 +32,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.4 2018/12/16 00:13:36 tom Exp $") NCURSES_EXPORT(FIELD **) _nc_retrace_field_ptr(FIELD **code) @@ -65,6 +65,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 001c1d157a00..de8feabafdf9 100644 --- a/form/fld_arg.c +++ b/form/fld_arg.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * + * Copyright (c) 1998-2016,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 * @@ -32,7 +32,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.15 2018/12/16 00:13:36 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -66,8 +66,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 0112f009ecd4..28001d3c91a1 100644 --- a/form/fld_attr.c +++ b/form/fld_attr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * + * Copyright (c) 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 +32,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.12 2016/01/23 21:32:00 tom Exp $") /*---------------------------------------------------------------------------- Field-Attribute manipulation routines @@ -42,7 +42,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 ef9ec007ecaf..efd5c2f95d8f 100644 --- a/form/fld_current.c +++ b/form/fld_current.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc. * + * Copyright (c) 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 +32,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.14 2016/10/29 22:30:10 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -76,7 +76,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 +104,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 681a3713e8c7..b18462f7b7f7 100644 --- a/form/fld_def.c +++ b/form/fld_def.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * + * Copyright (c) 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 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_def.c,v 1.40 2012/03/11 00:37:16 tom Exp $") +MODULE_ID("$Id: fld_def.c,v 1.41 2014/07/26 21:08:55 tom Exp $") /* this can't be readonly */ static FIELD default_field = @@ -53,7 +53,7 @@ static FIELD default_field = (int)' ', /* pad */ A_NORMAL, /* fore */ A_NORMAL, /* back */ - ALL_FIELD_OPTS, /* opts */ + STD_FIELD_OPTS, /* opts */ (FIELD *)0, /* snext */ (FIELD *)0, /* sprev */ (FIELD *)0, /* link */ @@ -294,14 +294,14 @@ new_field(int rows, int cols, int frow, int fcol, int nrow, int nbuf) { T((T_CREATE("field %p"), (void *)New_Field)); *New_Field = default_field; - New_Field->rows = (short) rows; - New_Field->cols = (short) cols; + New_Field->rows = (short)rows; + New_Field->cols = (short)cols; New_Field->drows = rows + nrow; New_Field->dcols = cols; - New_Field->frow = (short) frow; - New_Field->fcol = (short) fcol; + New_Field->frow = (short)frow; + New_Field->fcol = (short)fcol; New_Field->nrow = nrow; - New_Field->nbuf = (short) nbuf; + New_Field->nbuf = (short)nbuf; New_Field->link = New_Field; #if USE_WIDEC_SUPPORT diff --git a/form/fld_ftchoice.c b/form/fld_ftchoice.c index 090130678f95..897093a7adf1 100644 --- a/form/fld_ftchoice.c +++ b/form/fld_ftchoice.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * + * Copyright (c) 1998-2016,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 * @@ -32,7 +32,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.15 2018/12/16 00:14:26 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -51,7 +51,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_max.c b/form/fld_max.c index 6c7fe728bd98..510c3f1c9321 100644 --- a/form/fld_max.c +++ b/form/fld_max.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. * + * Copyright (c) 1998-2013,2019 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 +32,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.15 2019/01/26 22:18:08 Leon.Winter Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -57,11 +57,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_newftyp.c b/form/fld_newftyp.c index 4351aed6b3c8..a279a48bb2f5 100644 --- a/form/fld_newftyp.c +++ b/form/fld_newftyp.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * + * Copyright (c) 1998-2016,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 * @@ -32,7 +32,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.21 2018/12/16 00:14:22 tom Exp $") static FIELDTYPE default_fieldtype = { @@ -53,7 +53,7 @@ static FIELDTYPE default_fieldtype = }; NCURSES_EXPORT_VAR(FIELDTYPE *) -_nc_Default_FieldType = &default_fieldtype; + _nc_Default_FieldType = &default_fieldtype; /*--------------------------------------------------------------------------- | Facility : libnform @@ -76,7 +76,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/form.h b/form/form.h index f1a6635ec5e7..c34be75dc270 100644 --- a/form/form.h +++ b/form/form.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2009,2013 Free Software Foundation, Inc. * + * Copyright (c) 1998-2018,2019 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,10 +30,11 @@ * Author: Juergen Pfeifer, 1995,1997 * ****************************************************************************/ -/* $Id: form.h,v 0.23 2013/12/07 17:57:32 tom Exp $ */ +/* $Id: form.h,v 0.29 2019/01/19 21:26:13 Leon.Winter Exp $ */ #ifndef FORM_H #define FORM_H +/* *INDENT-OFF*/ #include <curses.h> #include <eti.h> @@ -57,18 +58,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 */ @@ -97,20 +104,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 */ @@ -135,14 +146,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 | */ @@ -178,7 +193,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 *); @@ -203,6 +220,10 @@ typedef void (*Form_Hook)(FORM *); #define O_NULLOK (0x0080U) #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) @@ -384,6 +405,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 *); @@ -421,5 +443,6 @@ extern NCURSES_EXPORT(FORM *) NCURSES_SP_NAME(new_form) (SCREEN*, FIELD **); #ifdef __cplusplus } #endif +/* *INDENT-ON*/ -#endif /* FORM_H */ +#endif /* FORM_H */ diff --git a/form/form.priv.h b/form/form.priv.h index 38dd8caa263e..c434dacc8d1f 100644 --- a/form/form.priv.h +++ b/form/form.priv.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2009,2012 Free Software Foundation, Inc. * + * Copyright (c) 1998-2018,2019 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 +30,15 @@ * Author: Juergen Pfeifer, 1995,1997 * ****************************************************************************/ -/* $Id: form.priv.h,v 0.33 2012/03/11 00:37:46 tom Exp $ */ +/* $Id: form.priv.h,v 0.44 2019/01/26 22:17:48 Leon.Winter 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 @@ -125,6 +128,8 @@ extern NCURSES_EXPORT_VAR(FIELDTYPE *) _nc_Default_FieldType; #define Single_Line_Field(field) \ (((field)->rows + (field)->nrow) == 1) +#define Field_Has_Option(f,o) ((((unsigned)(f)->opts) & o) != 0) + /* Logic to determine whether or not a field is selectable */ #define Field_Is_Selectable(f) (((unsigned)((f)->opts) & O_SELECTABLE)==O_SELECTABLE) #define Field_Is_Not_Selectable(f) (((unsigned)((f)->opts) & O_SELECTABLE)!=O_SELECTABLE) @@ -146,7 +151,7 @@ TypeArgument; O_NL_OVERLOAD |\ O_BS_OVERLOAD ) -#define ALL_FIELD_OPTS (Field_Options)( \ +#define STD_FIELD_OPTS (Field_Options)( \ O_VISIBLE |\ O_ACTIVE |\ O_PUBLIC |\ @@ -156,7 +161,14 @@ TypeArgument; O_AUTOSKIP|\ O_NULLOK |\ O_PASSOK |\ - O_STATIC ) + O_STATIC) + +#define ALL_FIELD_OPTS (Field_Options)( \ + STD_FIELD_OPTS |\ + O_DYNAMIC_JUSTIFY |\ + O_NO_LEFT_STRIP |\ + O_EDGE_INSERT_STAY |\ + O_INPUT_LIMIT) #define C_BLANK ' ' #define is_blank(c) ((c)==C_BLANK) @@ -177,6 +189,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); @@ -214,11 +227,11 @@ extern NCURSES_EXPORT(wchar_t *) _nc_Widen_String(char *, int *); #ifdef TRACE -#define returnField(code) TRACE_RETURN(code,field) -#define returnFieldPtr(code) TRACE_RETURN(code,field_ptr) -#define returnForm(code) TRACE_RETURN(code,form) -#define returnFieldType(code) TRACE_RETURN(code,field_type) -#define returnFormHook(code) TRACE_RETURN(code,form_hook) +#define returnField(code) TRACE_RETURN1(code,field) +#define returnFieldPtr(code) TRACE_RETURN1(code,field_ptr) +#define returnForm(code) TRACE_RETURN1(code,form) +#define returnFieldType(code) TRACE_RETURN1(code,field_type) +#define returnFormHook(code) TRACE_RETURN1(code,form_hook) extern NCURSES_EXPORT(FIELD **) _nc_retrace_field_ptr (FIELD **); extern NCURSES_EXPORT(FIELD *) _nc_retrace_field (FIELD *); diff --git a/form/frm_driver.c b/form/frm_driver.c index ed561bf1e9e5..123127b7db79 100644 --- a/form/frm_driver.c +++ b/form/frm_driver.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. * + * Copyright (c) 1998-2018,2019 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 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_driver.c,v 1.110 2014/02/10 00:42:48 tom Exp $") +MODULE_ID("$Id: frm_driver.c,v 1.128 2019/01/20 01:25:02 tom Exp $") /*---------------------------------------------------------------------------- This is the core module of the form library. It contains the majority @@ -99,9 +99,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) @@ -172,15 +172,16 @@ static int FE_Delete_Previous(FORM *); instead of a derived window because it contains invisible parts. This is true for non-public fields and for scrollable fields. */ #define Has_Invisible_Parts(field) \ - (!((unsigned)(field)->opts & O_PUBLIC) || \ + (!(Field_Has_Option(field, O_PUBLIC)) || \ Is_Scroll_Field(field)) /* Logic to decide whether or not a field needs justification */ #define Justification_Allowed(field) \ (((field)->just != NO_JUSTIFICATION) && \ (Single_Line_Field(field)) && \ - (((field)->dcols == (field)->cols) && \ - ((unsigned)(field)->opts & O_STATIC))) + ((Field_Has_Option(field, O_STATIC) && \ + ((field)->dcols == (field)->cols)) || \ + Field_Has_Option(field, O_DYNAMIC_JUSTIFY))) /* Logic to determine whether or not a dynamic field may still grow */ #define Growable(field) ((field)->status & _MAY_GROW) @@ -194,7 +195,7 @@ static int FE_Delete_Previous(FORM *); #define Field_Really_Appears(field) \ ((field->form) &&\ (field->form->status & _POSTED) &&\ - ((unsigned)field->opts & O_VISIBLE) &&\ + (Field_Has_Option(field, O_VISIBLE)) &&\ (field->page == field->form->curpage)) /* Logic to determine whether or not we are on the first position in the @@ -238,9 +239,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; @@ -256,11 +277,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; @@ -843,11 +866,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)); @@ -860,102 +885,105 @@ _nc_Refresh_Current_Field(FORM *form) field = form->current; formwin = Get_Form_Window(form); - if ((unsigned)field->opts & 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)); @@ -978,26 +1006,29 @@ 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) { - assert(win && (field->drows == 1) && (field->dcols == field->cols)); + assert(win && (field->drows == 1)); - switch (field->just) - { - case JUSTIFY_LEFT: - break; - case JUSTIFY_CENTER: - col = (field->cols - len) / 2; - break; - case JUSTIFY_RIGHT: - col = field->cols - len; - break; - default: - break; - } + if (field->cols - len >= 0) + switch (field->just) + { + case JUSTIFY_LEFT: + break; + case JUSTIFY_CENTER: + col = (field->cols - len) / 2; + break; + case JUSTIFY_RIGHT: + col = field->cols - len; + break; + default: + break; + } wmove(win, 0, col); myADDNSTR(win, bp, len); @@ -1019,9 +1050,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) @@ -1030,6 +1066,7 @@ Undo_Justification(FIELD *field, WINDOW *win) wmove(win, 0, 0); myADDNSTR(win, bp, len); } + wmove(win, y, x); } /*--------------------------------------------------------------------------- @@ -1111,7 +1148,7 @@ Display_Or_Erase_Field(FIELD *field, bool bEraseFlag) return E_SYSTEM_ERROR; else { - if ((unsigned)field->opts & O_VISIBLE) + if (Field_Has_Option(field, O_VISIBLE)) { Set_Field_Window_Attributes(field, win); } @@ -1124,7 +1161,7 @@ Display_Or_Erase_Field(FIELD *field, bool bEraseFlag) if (!bEraseFlag) { - if ((unsigned)field->opts & O_PUBLIC) + if (Field_Has_Option(field, O_PUBLIC)) { if (Justification_Allowed(field)) Perform_Justification(field, win); @@ -1170,7 +1207,7 @@ Synchronize_Field(FIELD *field) form->currow = form->curcol = form->toprow = form->begincol = 0; werase(form->w); - if (((unsigned)field->opts & O_PUBLIC) && Justification_Allowed(field)) + if ((Field_Has_Option(field, O_PUBLIC)) && Justification_Allowed(field)) Undo_Justification(field, form->w); else Buffer_To_Window(field, form->w); @@ -1256,7 +1293,7 @@ _nc_Synchronize_Attributes(FIELD *field) werase(form->w); wmove(form->w, form->currow, form->curcol); - if ((unsigned)field->opts & O_PUBLIC) + if (Field_Has_Option(field, O_PUBLIC)) { if (Justification_Allowed(field)) Undo_Justification(field, form->w); @@ -1269,7 +1306,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 */ @@ -1389,6 +1427,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, @@ -1409,7 +1498,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)) @@ -1423,34 +1512,10 @@ _nc_Set_Current_Field(FORM *form, FIELD *newfield) if ((field != newfield) || !(form->status & _POSTED)) { - if ((form->w) && - ((unsigned)field->opts & O_VISIBLE) && + if (field && (form->w) && + (Field_Has_Option(field, O_VISIBLE)) && (field->form->curpage == field->page)) - { - _nc_Refresh_Current_Field(form); - if ((unsigned)field->opts & 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); - wsyncup(form->w); - } - } - } - delwin(form->w); - form->w = (WINDOW *)0; - } + _nc_Unset_Current_Field(form); field = newfield; @@ -1998,7 +2063,7 @@ Vertical_Scrolling(int (*const fct) (FORM *), FORM *form) { res = fct(form); if (res == E_OK) - SetStatus(form, _NEWTOP); + SetStatus(form->current, _NEWTOP); } return (res); } @@ -2430,7 +2495,7 @@ Wrapping_Not_Necessary_Or_Wrapping_Ok(FORM *form) int result = E_REQUEST_DENIED; bool Last_Row = ((field->drows - 1) == form->currow); - if (((unsigned)field->opts & O_WRAP) && /* wrapping wanted */ + if ((Field_Has_Option(field, O_WRAP)) && /* wrapping wanted */ (!Single_Line_Field(field)) && /* must be multi-line */ (There_Is_No_Room_For_A_Char_In_Line(form)) && /* line is full */ (!Last_Row || Growable(field))) /* there are more lines */ @@ -3111,7 +3176,7 @@ Check_Field(FORM *form, FIELDTYPE *typ, FIELD *field, TypeArgument *argp) { if (typ) { - if ((unsigned)field->opts & O_NULLOK) + if (Field_Has_Option(field, O_NULLOK)) { FIELD_CELL *bp = field->buf; @@ -3168,7 +3233,7 @@ _nc_Internal_Validation(FORM *form) Synchronize_Buffer(form); if ((form->status & _FCHECK_REQUIRED) || - (!((unsigned)field->opts & O_PASSOK))) + (!(Field_Has_Option(field, O_PASSOK)))) { if (!Check_Field(form, field->type, field, (TypeArgument *)(field->arg))) return FALSE; @@ -3273,7 +3338,7 @@ _nc_First_Active_Field(FORM *form) do { field = (field == last_on_page) ? first : field + 1; - if (((unsigned)(*field)->opts & O_VISIBLE)) + if (Field_Has_Option(*field, O_VISIBLE)) break; } while (proposed != (*field)); @@ -4001,9 +4066,9 @@ Data_Entry_w(FORM *form, wchar_t c) int result = E_REQUEST_DENIED; T((T_CALLED("Data_Entry(%p,%s)"), (void *)form, _tracechtype((chtype)c))); - if (((unsigned)field->opts & O_EDIT) + if ((Field_Has_Option(field, O_EDIT)) #if FIX_FORM_INACTIVE_BUG - && ((unsigned)field->opts & O_ACTIVE) + && (Field_Has_Option(field, O_ACTIVE)) #endif ) { @@ -4011,9 +4076,9 @@ 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 (((unsigned)field->opts & O_BLANK) && + if ((Field_Has_Option(field, O_BLANK)) && First_Position_In_Current_Field(form) && !(form->status & _FCHECK_REQUIRED) && !(form->status & _WINDOW_MODIFIED)) @@ -4044,7 +4109,7 @@ Data_Entry_w(FORM *form, wchar_t c) ((field->dcols - 1) == form->curcol)); form->status |= _WINDOW_MODIFIED; - if (End_Of_Field && !Growable(field) && ((unsigned)field->opts & O_AUTOSKIP)) + if (End_Of_Field && !Growable(field) && (Field_Has_Option(field, O_AUTOSKIP))) result = Inter_Field_Navigation(FN_Next_Field, form); else { @@ -4088,13 +4153,13 @@ Data_Entry(FORM *form, int c) int result = E_REQUEST_DENIED; T((T_CALLED("Data_Entry(%p,%s)"), (void *)form, _tracechtype((chtype)c))); - if (((unsigned)field->opts & O_EDIT) + if ((Field_Has_Option(field, O_EDIT)) #if FIX_FORM_INACTIVE_BUG - && ((unsigned)field->opts & O_ACTIVE) + && (Field_Has_Option(field, O_ACTIVE)) #endif ) { - if (((unsigned)field->opts & O_BLANK) && + if ((Field_Has_Option(field, O_BLANK)) && First_Position_In_Current_Field(form) && !(form->status & _FCHECK_REQUIRED) && !(form->status & _WINDOW_MODIFIED)) @@ -4124,8 +4189,14 @@ 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) && ((unsigned)field->opts & O_AUTOSKIP)) + if (End_Of_Field && !Growable(field) && (Field_Has_Option(field, O_AUTOSKIP))) result = Inter_Field_Navigation(FN_Next_Field, form); else { @@ -4288,12 +4359,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); @@ -4493,7 +4566,7 @@ form_driver_w(FORM *form, int type, wchar_t c) const Binding_Info *BI = (Binding_Info *) 0; int res = E_UNKNOWN_COMMAND; - T((T_CALLED("form_driver(%p,%d)"), (void *)form, (int) c)); + T((T_CALLED("form_driver(%p,%d)"), (void *)form, (int)c)); if (!form) RETURN(E_BAD_ARGUMENT); @@ -4503,7 +4576,7 @@ form_driver_w(FORM *form, int type, wchar_t c) assert(form->page); - if (c == FIRST_ACTIVE_MAGIC) + if (c == (wchar_t)FIRST_ACTIVE_MAGIC) { form->current = _nc_First_Active_Field(form); RETURN(E_OK); @@ -4905,7 +4978,7 @@ _nc_Widen_String(char *source, int *lengthp) { if (pass) { - result[need] = source[passed]; + result[need] = (wchar_t)source[passed]; } ++need; ++passed; diff --git a/form/frm_hook.c b/form/frm_hook.c index 23850bfd1f8e..5f1f602f49db 100644 --- a/form/frm_hook.c +++ b/form/frm_hook.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * + * Copyright (c) 1998-2016,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 * @@ -32,13 +32,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.18 2018/12/16 00:13:36 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_post.c b/form/frm_post.c index 31568b2a6e1f..0a07ee7947bf 100644 --- a/form/frm_post.c +++ b/form/frm_post.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * + * Copyright (c) 1998-2012,2020 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 +32,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.12 2020/01/18 17:05:03 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 +69,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 +87,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 c24db1a8a924..5686b22202d1 100644 --- a/form/frm_req_name.c +++ b/form/frm_req_name.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2009,2012 Free Software Foundation, Inc. * + * Copyright (c) 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 +37,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.19 2015/04/04 17:11:46 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/fty_generic.c b/form/fty_generic.c index 429ceac44a05..83d18f0302ce 100644 --- a/form/fty_generic.c +++ b/form/fty_generic.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2008-2010,2012 Free Software Foundation, Inc. * + * Copyright (c) 2008-2018,2020 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 +34,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.9 2020/01/18 17:08:04 tom Exp $") /* * This is not a full implementation of a field type, but adds some @@ -55,15 +55,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 +89,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 +109,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 +145,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 +206,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 +264,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_num.c b/form/fty_num.c index 8cce43f83a17..d144ef4a9716 100644 --- a/form/fty_num.c +++ b/form/fty_num.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * + * Copyright (c) 1998-2012,2019 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 +34,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.31 2019/03/30 21:20:04 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 +96,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 7a42e7eee7f0..45ea1ab375ca 100644 --- a/form/fty_regex.c +++ b/form/fty_regex.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * + * Copyright (c) 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 * @@ -34,10 +34,17 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_regex.c,v 1.25 2012/10/27 20:12:53 tom Exp $") +MODULE_ID("$Id: fty_regex.c,v 1.27 2018/07/14 21:41:39 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 { @@ -113,7 +120,7 @@ Generic_RegularExpression_Type(void *arg MAYBE_UNUSED) if (rx) { - preg = typeMalloc(RegExp_Arg, 1); + preg = typeCalloc(RegExp_Arg, 1); if (preg) { @@ -264,6 +271,7 @@ Free_RegularExpression_Type(void *argp MAYBE_UNUSED) { free(ap->refCount); regfree(ap->pRegExp); + free(ap->pRegExp); } #elif HAVE_REGEXP_H_FUNCS | HAVE_REGEXPR_H_FUNCS if (ap->compiled_expression) diff --git a/form/llib-lform b/form/llib-lform index 2b6abdcd7c99..35941e975a93 100644 --- a/form/llib-lform +++ b/form/llib-lform @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2005,2010 Free Software Foundation, Inc. * + * Copyright (c) 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 +27,7 @@ ****************************************************************************/ /**************************************************************************** - * Author: Thomas E. Dickey 1996-2005,2010 * + * Author: Thomas E. Dickey 1996-on * ****************************************************************************/ /* LINTLIBRARY */ @@ -110,6 +110,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 +463,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 +684,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 +699,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 +725,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 +790,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 +825,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 +840,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 33de63cde975..6aab98dc0f64 100644 --- a/form/llib-lformt +++ b/form/llib-lformt @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2010 Free Software Foundation, Inc. * + * Copyright (c) 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 +27,7 @@ ****************************************************************************/ /**************************************************************************** - * Author: Thomas E. Dickey 2010 * + * Author: Thomas E. Dickey 2010-on * ****************************************************************************/ /* LINTLIBRARY */ @@ -110,6 +110,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 +463,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 +684,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 +699,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 +725,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 +790,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 +825,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 +840,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 6e9cd13f8070..5d853480e384 100644 --- a/form/llib-lformtw +++ b/form/llib-lformtw @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2010,2013 Free Software Foundation, Inc. * + * Copyright (c) 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 +110,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 +463,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 +697,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 +712,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 +738,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 +803,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 +838,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 +853,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 04cbe2b6e36c..db5db9ed2df8 100644 --- a/form/llib-lformw +++ b/form/llib-lformw @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2002-2010,2013 Free Software Foundation, Inc. * + * Copyright (c) 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 +27,7 @@ ****************************************************************************/ /**************************************************************************** - * Author: Thomas E. Dickey 2002-on * + * Author: Thomas E. Dickey 2002-on * ****************************************************************************/ /* LINTLIBRARY */ @@ -110,6 +110,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 +463,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 +697,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 +712,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 +738,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 +803,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 +838,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 +853,7 @@ RegExp_Arg; #undef TYPE_REGEXP FIELDTYPE *TYPE_REGEXP; + +#undef _nc_TYPE_REGEXP +FIELDTYPE *_nc_TYPE_REGEXP(void) + { return(*(FIELDTYPE **)0); } |