aboutsummaryrefslogtreecommitdiff
path: root/contrib/ncurses/form
diff options
context:
space:
mode:
authorRong-En Fan <rafan@FreeBSD.org>2007-12-30 11:08:14 +0000
committerRong-En Fan <rafan@FreeBSD.org>2007-12-30 11:08:14 +0000
commit5ca44d1c915a0e0c87f8f347e61f7bfa65d609af (patch)
tree319eb1471eaf8c0c9cfc606e7cb8987ca9167507 /contrib/ncurses/form
parent01b82453a3d0c6d76d4afc340c07cfc2be4a6b7a (diff)
downloadsrc-5ca44d1c915a0e0c87f8f347e61f7bfa65d609af.tar.gz
src-5ca44d1c915a0e0c87f8f347e61f7bfa65d609af.zip
Import ncurses 5.6-20071222 snapshot onto the vender branch
Notes
Notes: svn path=/vendor/ncurses/dist/; revision=174993
Diffstat (limited to 'contrib/ncurses/form')
-rw-r--r--contrib/ncurses/form/Makefile.in12
-rw-r--r--contrib/ncurses/form/fld_def.c13
-rw-r--r--contrib/ncurses/form/fld_dup.c7
-rw-r--r--contrib/ncurses/form/fld_ftlink.c7
-rw-r--r--contrib/ncurses/form/fld_link.c7
-rw-r--r--contrib/ncurses/form/fld_newftyp.c7
-rw-r--r--contrib/ncurses/form/frm_def.c10
-rw-r--r--contrib/ncurses/form/frm_driver.c131
-rw-r--r--contrib/ncurses/form/fty_alnum.c18
-rw-r--r--contrib/ncurses/form/fty_alpha.c18
-rw-r--r--contrib/ncurses/form/fty_enum.c14
-rw-r--r--contrib/ncurses/form/fty_int.c14
-rw-r--r--contrib/ncurses/form/fty_num.c14
-rw-r--r--contrib/ncurses/form/fty_regex.c19
-rw-r--r--contrib/ncurses/form/headers3
-rw-r--r--contrib/ncurses/form/modules8
16 files changed, 226 insertions, 76 deletions
diff --git a/contrib/ncurses/form/Makefile.in b/contrib/ncurses/form/Makefile.in
index 682f0a4afc76..2bf31e15f347 100644
--- a/contrib/ncurses/form/Makefile.in
+++ b/contrib/ncurses/form/Makefile.in
@@ -1,6 +1,6 @@
-# $Id: Makefile.in,v 1.42 2006/10/14 20:40:36 tom Exp $
+# $Id: Makefile.in,v 1.47 2007/04/28 14:56:11 tom Exp $
##############################################################################
-# Copyright (c) 1998-2004,2006 Free Software Foundation, Inc. #
+# Copyright (c) 1998-2006,2007 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"), #
@@ -27,7 +27,7 @@
# authorization. #
##############################################################################
#
-# Author: Thomas E. Dickey <dickey@clark.net> 1996,1997
+# Author: Thomas E. Dickey 1996-on
#
# Makefile for form source code.
#
@@ -91,7 +91,7 @@ CFLAGS_SHARED = $(CCFLAGS) @CC_SHARED_OPTS@
CFLAGS_DEFAULT = $(CFLAGS_@DFT_UPR_MODEL@)
-LINK = $(LIBTOOL_LINK) $(CC)
+LINK = $(LIBTOOL_LINK)
LDFLAGS = @LDFLAGS@ @LD_MODEL@ @LIBS@
SHLIB_DIRS = -L../lib
@@ -106,8 +106,6 @@ ABI_VERSION = @cf_cv_abi_version@
RANLIB = @LIB_PREP@
-IMPORT_LIB = @IMPORT_LIB@
-SHARED_LIB = @SHARED_LIB@
LIBRARIES = @LIBS_TO_MAKE@
LINT = @LINT@
@@ -126,7 +124,7 @@ sources : $(AUTO_SRC)
$(DESTDIR)$(bindir) \
$(DESTDIR)$(libdir) :
- sh $(srcdir)/../mkinstalldirs $@
+ sh $(srcdir)/../mkdirs.sh $@
# make copies to simplify include-paths while still keeping form's include
# file in this directory.
diff --git a/contrib/ncurses/form/fld_def.c b/contrib/ncurses/form/fld_def.c
index dc023795ac90..3559ba67241c 100644
--- a/contrib/ncurses/form/fld_def.c
+++ b/contrib/ncurses/form/fld_def.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2005,2007 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.33 2005/04/16 17:31:17 tom Exp $")
+MODULE_ID("$Id: fld_def.c,v 1.36 2007/10/13 19:29:58 tom Exp $")
/* this can't be readonly */
static FIELD default_field =
@@ -93,7 +93,7 @@ _nc_Make_Argument(const FIELDTYPE *typ, va_list *ap, int *err)
assert(err != 0 && ap != (va_list *)0);
if ((typ->status & _LINKED_TYPE) != 0)
{
- p = (TypeArgument *)malloc(sizeof(TypeArgument));
+ p = typeMalloc(TypeArgument, 1);
if (p != 0)
{
@@ -141,7 +141,7 @@ _nc_Copy_Argument(const FIELDTYPE *typ, const TypeArgument *argp, int *err)
assert(err != 0 && argp != 0);
if ((typ->status & _LINKED_TYPE) != 0)
{
- p = (TypeArgument *)malloc(sizeof(TypeArgument));
+ p = typeMalloc(TypeArgument, 1);
if (p != 0)
{
@@ -289,8 +289,9 @@ new_field(int rows, int cols, int frow, int fcol, int nrow, int nbuf)
nrow >= 0 &&
nbuf >= 0 &&
((err = E_SYSTEM_ERROR) != 0) && /* trick: this resets the default error */
- (New_Field = (FIELD *)malloc(sizeof(FIELD))) != 0)
+ (New_Field = typeMalloc(FIELD, 1)) != 0)
{
+ T((T_CREATE("field %p"), New_Field));
*New_Field = default_field;
New_Field->rows = rows;
New_Field->cols = cols;
@@ -304,7 +305,7 @@ new_field(int rows, int cols, int frow, int fcol, int nrow, int nbuf)
#if USE_WIDEC_SUPPORT
New_Field->working = newpad(1, Buffer_Length(New_Field) + 1);
- New_Field->expanded = (char **)calloc(1 + (unsigned)rows, sizeof(char *));
+ New_Field->expanded = typeCalloc(char *, 1 + (unsigned)nbuf);
#endif
if (_nc_Copy_Type(New_Field, &default_field))
diff --git a/contrib/ncurses/form/fld_dup.c b/contrib/ncurses/form/fld_dup.c
index 2ffcd3670581..bbc38a3eb715 100644
--- a/contrib/ncurses/form/fld_dup.c
+++ b/contrib/ncurses/form/fld_dup.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2004,2007 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_dup.c,v 1.10 2004/12/25 22:24:10 tom Exp $")
+MODULE_ID("$Id: fld_dup.c,v 1.12 2007/10/13 19:30:21 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnform
@@ -56,8 +56,9 @@ dup_field(FIELD *field, int frow, int fcol)
T((T_CALLED("dup_field(%p,%d,%d)"), field, frow, fcol));
if (field && (frow >= 0) && (fcol >= 0) &&
((err = E_SYSTEM_ERROR) != 0) && /* trick : this resets the default error */
- (New_Field = (FIELD *)malloc(sizeof(FIELD))))
+ (New_Field = typeMalloc(FIELD, 1)))
{
+ T((T_CREATE("field %p"), New_Field));
*New_Field = *_nc_Default_Field;
New_Field->frow = frow;
New_Field->fcol = fcol;
diff --git a/contrib/ncurses/form/fld_ftlink.c b/contrib/ncurses/form/fld_ftlink.c
index ce6014dbb81a..4ed2219262aa 100644
--- a/contrib/ncurses/form/fld_ftlink.c
+++ b/contrib/ncurses/form/fld_ftlink.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2004,2007 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_ftlink.c,v 1.11 2004/12/25 22:24:10 tom Exp $")
+MODULE_ID("$Id: fld_ftlink.c,v 1.13 2007/10/13 19:30:35 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnform
@@ -56,10 +56,11 @@ link_fieldtype(FIELDTYPE *type1, FIELDTYPE *type2)
T((T_CALLED("link_fieldtype(%p,%p)"), type1, type2));
if (type1 && type2)
{
- nftyp = (FIELDTYPE *)malloc(sizeof(FIELDTYPE));
+ nftyp = typeMalloc(FIELDTYPE, 1);
if (nftyp)
{
+ T((T_CREATE("fieldtype %p"), nftyp));
*nftyp = *_nc_Default_FieldType;
nftyp->status |= _LINKED_TYPE;
if ((type1->status & _HAS_ARGS) || (type2->status & _HAS_ARGS))
diff --git a/contrib/ncurses/form/fld_link.c b/contrib/ncurses/form/fld_link.c
index f15166401f9a..0aac7db78d12 100644
--- a/contrib/ncurses/form/fld_link.c
+++ b/contrib/ncurses/form/fld_link.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2004,2007 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_link.c,v 1.9 2004/12/25 22:24:10 tom Exp $")
+MODULE_ID("$Id: fld_link.c,v 1.11 2007/10/13 19:30:43 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnform
@@ -57,8 +57,9 @@ link_field(FIELD *field, int frow, int fcol)
T((T_CALLED("link_field(%p,%d,%d)"), field, frow, fcol));
if (field && (frow >= 0) && (fcol >= 0) &&
((err = E_SYSTEM_ERROR) != 0) && /* trick: this resets the default error */
- (New_Field = (FIELD *)malloc(sizeof(FIELD))))
+ (New_Field = typeMalloc(FIELD, 1)))
{
+ T((T_CREATE("field %p"), New_Field));
*New_Field = *_nc_Default_Field;
New_Field->frow = frow;
New_Field->fcol = fcol;
diff --git a/contrib/ncurses/form/fld_newftyp.c b/contrib/ncurses/form/fld_newftyp.c
index 235cd5f5e432..c2984b10e3c7 100644
--- a/contrib/ncurses/form/fld_newftyp.c
+++ b/contrib/ncurses/form/fld_newftyp.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2004,2007 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.13 2004/12/25 22:24:10 tom Exp $")
+MODULE_ID("$Id: fld_newftyp.c,v 1.15 2007/10/13 19:30:55 tom Exp $")
static FIELDTYPE const default_fieldtype =
{
@@ -76,10 +76,11 @@ new_fieldtype(bool (*const field_check) (FIELD *, const void *),
T((T_CALLED("new_fieldtype(%p,%p)"), field_check, char_check));
if ((field_check) || (char_check))
{
- nftyp = (FIELDTYPE *)malloc(sizeof(FIELDTYPE));
+ nftyp = typeMalloc(FIELDTYPE, 1);
if (nftyp)
{
+ T((T_CREATE("fieldtype %p"), nftyp));
*nftyp = default_fieldtype;
nftyp->fcheck = field_check;
nftyp->ccheck = char_check;
diff --git a/contrib/ncurses/form/frm_def.c b/contrib/ncurses/form/frm_def.c
index d15237e911e2..c2044a39dccd 100644
--- a/contrib/ncurses/form/frm_def.c
+++ b/contrib/ncurses/form/frm_def.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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_def.c,v 1.20 2006/11/04 16:57:15 tom Exp $")
+MODULE_ID("$Id: frm_def.c,v 1.22 2007/10/13 19:31:17 tom Exp $")
/* this can't be readonly */
static FORM default_form =
@@ -186,8 +186,9 @@ Connect_Fields(FORM *form, FIELD **fields)
RETURN(E_BAD_ARGUMENT);
/* allocate page structures */
- if ((pg = (_PAGE *) malloc(page_nr * sizeof(_PAGE))) != (_PAGE *) 0)
+ if ((pg = typeMalloc(_PAGE, page_nr)) != (_PAGE *) 0)
{
+ T((T_CREATE("_PAGE %p"), pg));
form->page = pg;
}
else
@@ -290,11 +291,12 @@ new_form(FIELD **fields)
{
int err = E_SYSTEM_ERROR;
- FORM *form = (FORM *)malloc(sizeof(FORM));
+ FORM *form = typeMalloc(FORM, 1);
T((T_CALLED("new_form(%p)"), fields));
if (form)
{
+ T((T_CREATE("form %p"), form));
*form = *_nc_Default_Form;
if ((err = Associate_Fields(form, fields)) != E_OK)
{
diff --git a/contrib/ncurses/form/frm_driver.c b/contrib/ncurses/form/frm_driver.c
index 354bace8b4f3..25928c5d108c 100644
--- a/contrib/ncurses/form/frm_driver.c
+++ b/contrib/ncurses/form/frm_driver.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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.76 2006/11/04 18:45:35 tom Exp $")
+MODULE_ID("$Id: frm_driver.c,v 1.85 2007/11/24 21:32:53 tom Exp $")
/*----------------------------------------------------------------------------
This is the core module of the form library. It contains the majority
@@ -262,7 +262,19 @@ wins_wchnstr(WINDOW *w, cchar_t *s, int n)
static int
fix_wchnstr(WINDOW *w, cchar_t *s, int n)
{
+ int x;
+
win_wchnstr(w, s, n);
+ /*
+ * This function is used to extract the text only from the window.
+ * Strip attributes and color from the string so they will not be added
+ * back when copying the string to the window.
+ */
+ for (x = 0; x < n; ++x)
+ {
+ RemAttr(s[x], A_ATTRIBUTES);
+ SetPair(s[x], 0);
+ }
return n;
}
@@ -651,6 +663,7 @@ Field_Grown(FIELD *field, int amount)
result = TRUE; /* allow sharing of recovery on failure */
+ T((T_CREATE("fieldcell %p"), newbuf));
field->buf = newbuf;
for (i = 0; i <= field->nbuf; i++)
{
@@ -724,6 +737,34 @@ Field_Grown(FIELD *field, int amount)
return (result);
}
+#ifdef NCURSES_MOUSE_VERSION
+/*---------------------------------------------------------------------------
+| Facility : libnform
+| Function : int Field_encloses(FIELD *field, int ry, int rx)
+|
+| Description : Check if the given coordinates lie within the given field.
+|
+| Return Values : E_OK - success
+| E_BAD_ARGUMENT - invalid form pointer
+| E_SYSTEM_ERROR - form has no current field or
+| field-window
++--------------------------------------------------------------------------*/
+static int
+Field_encloses(FIELD *field, int ry, int rx)
+{
+ T((T_CALLED("Field_encloses(%p)"), field));
+ if (field != 0
+ && field->frow <= ry
+ && (field->frow + field->rows) > ry
+ && field->fcol <= rx
+ && (field->fcol + field->cols) > rx)
+ {
+ RETURN(E_OK);
+ }
+ RETURN(E_INVALID_FIELD);
+}
+#endif
+
/*---------------------------------------------------------------------------
| Facility : libnform
| Function : int _nc_Position_Form_Cursor(FORM * form)
@@ -4149,6 +4190,83 @@ form_driver(FORM *form, int c)
res = (BI->cmd) (form);
}
}
+#ifdef NCURSES_MOUSE_VERSION
+ else if (KEY_MOUSE == c)
+ {
+ MEVENT event;
+ WINDOW *win = form->win ? form->win : stdscr;
+ WINDOW *sub = form->sub ? form->sub : win;
+
+ getmouse(&event);
+ if ((event.bstate & (BUTTON1_CLICKED |
+ BUTTON1_DOUBLE_CLICKED |
+ BUTTON1_TRIPLE_CLICKED))
+ && wenclose(win, event.y, event.x))
+ { /* we react only if the click was in the userwin, that means
+ * inside the form display area or at the decoration window.
+ */
+ int ry = event.y, rx = event.x; /* screen coordinates */
+
+ res = E_REQUEST_DENIED;
+ if (mouse_trafo(&ry, &rx, FALSE))
+ { /* rx, ry are now "curses" coordinates */
+ if (ry < sub->_begy)
+ { /* we clicked above the display region; this is
+ * interpreted as "scroll up" request
+ */
+ if (event.bstate & BUTTON1_CLICKED)
+ res = form_driver(form, REQ_PREV_FIELD);
+ else if (event.bstate & BUTTON1_DOUBLE_CLICKED)
+ res = form_driver(form, REQ_PREV_PAGE);
+ else if (event.bstate & BUTTON1_TRIPLE_CLICKED)
+ res = form_driver(form, REQ_FIRST_FIELD);
+ }
+ else if (ry > sub->_begy + sub->_maxy)
+ { /* we clicked below the display region; this is
+ * interpreted as "scroll down" request
+ */
+ if (event.bstate & BUTTON1_CLICKED)
+ res = form_driver(form, REQ_NEXT_FIELD);
+ else if (event.bstate & BUTTON1_DOUBLE_CLICKED)
+ res = form_driver(form, REQ_NEXT_PAGE);
+ else if (event.bstate & BUTTON1_TRIPLE_CLICKED)
+ res = form_driver(form, REQ_LAST_FIELD);
+ }
+ else if (wenclose(sub, event.y, event.x))
+ { /* Inside the area we try to find the hit item */
+ int i;
+
+ ry = event.y;
+ rx = event.x;
+ if (wmouse_trafo(sub, &ry, &rx, FALSE))
+ {
+ int min_field = form->page[form->curpage].pmin;
+ int max_field = form->page[form->curpage].pmax;
+
+ for (i = min_field; i <= max_field; ++i)
+ {
+ FIELD *field = form->field[i];
+
+ if (Field_Is_Selectable(field)
+ && Field_encloses(field, ry, rx) == E_OK)
+ {
+ res = _nc_Set_Current_Field(form, field);
+ if (res == E_OK)
+ res = _nc_Position_Form_Cursor(form);
+ if (res == E_OK
+ && (event.bstate & BUTTON1_DOUBLE_CLICKED))
+ res = E_UNKNOWN_COMMAND;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ else
+ res = E_REQUEST_DENIED;
+ }
+#endif /* NCURSES_MOUSE_VERSION */
else if (!(c & (~(int)MAX_REGULAR_CHARACTER)))
{
/*
@@ -4261,7 +4379,7 @@ set_field_buffer(FIELD *field, int buffer, const char *value)
wclear(field->working);
mvwaddstr(field->working, 0, 0, value);
- if ((widevalue = (FIELD_CELL *)calloc(len, sizeof(FIELD_CELL))) == 0)
+ if ((widevalue = typeCalloc(FIELD_CELL, len + 1)) == 0)
{
RETURN(E_SYSTEM_ERROR);
}
@@ -4341,10 +4459,7 @@ field_buffer(const FIELD *field, int buffer)
init_mb(state);
next = _nc_wcrtomb(0, data[n].chars[0], &state);
if (!isEILSEQ(next))
- {
- if (next != 0)
- need += next;
- }
+ need += next;
}
}
@@ -4358,7 +4473,7 @@ field_buffer(const FIELD *field, int buffer)
{
wclear(field->working);
mvwadd_wchnstr(field->working, 0, 0, data, size);
- mvwinnstr(field->working, 0, 0, result, (int)need + 1);
+ mvwinnstr(field->working, 0, 0, result, (int)need);
}
#else
result = Address_Of_Nth_Buffer(field, buffer);
diff --git a/contrib/ncurses/form/fty_alnum.c b/contrib/ncurses/form/fty_alnum.c
index c2d056b70acb..59dd2736e8ab 100644
--- a/contrib/ncurses/form/fty_alnum.c
+++ b/contrib/ncurses/form/fty_alnum.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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_alnum.c,v 1.19 2006/04/22 21:33:05 tom Exp $")
+MODULE_ID("$Id: fty_alnum.c,v 1.21 2007/10/13 19:31:52 tom Exp $")
#define thisARG alnumARG
@@ -55,10 +55,13 @@ thisARG;
static void *
Make_This_Type(va_list *ap)
{
- thisARG *argp = (thisARG *) malloc(sizeof(thisARG));
+ thisARG *argp = typeMalloc(thisARG, 1);
if (argp)
- argp->width = va_arg(*ap, int);
+ {
+ T((T_CREATE("thisARG %p"), argp));
+ argp->width = va_arg(*ap, int);
+ }
return ((void *)argp);
}
@@ -75,10 +78,13 @@ static void *
Copy_This_Type(const void *argp)
{
const thisARG *ap = (const thisARG *)argp;
- thisARG *result = (thisARG *) malloc(sizeof(thisARG));
+ thisARG *result = typeMalloc(thisARG, 1);
if (result)
- *result = *ap;
+ {
+ T((T_CREATE("thisARG %p"), result));
+ *result = *ap;
+ }
return ((void *)result);
}
diff --git a/contrib/ncurses/form/fty_alpha.c b/contrib/ncurses/form/fty_alpha.c
index bd7e000edf97..bd49544ffdb5 100644
--- a/contrib/ncurses/form/fty_alpha.c
+++ b/contrib/ncurses/form/fty_alpha.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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_alpha.c,v 1.21 2006/04/22 21:33:05 tom Exp $")
+MODULE_ID("$Id: fty_alpha.c,v 1.23 2007/10/13 19:32:09 tom Exp $")
#define thisARG alphaARG
@@ -55,10 +55,13 @@ thisARG;
static void *
Make_This_Type(va_list *ap)
{
- thisARG *argp = (thisARG *) malloc(sizeof(thisARG));
+ thisARG *argp = typeMalloc(thisARG, 1);
if (argp)
- argp->width = va_arg(*ap, int);
+ {
+ T((T_CREATE("thisARG %p"), argp));
+ argp->width = va_arg(*ap, int);
+ }
return ((void *)argp);
}
@@ -75,10 +78,13 @@ static void *
Copy_This_Type(const void *argp)
{
const thisARG *ap = (const thisARG *)argp;
- thisARG *result = (thisARG *) malloc(sizeof(thisARG));
+ thisARG *result = typeMalloc(thisARG, 1);
if (result)
- *result = *ap;
+ {
+ T((T_CREATE("thisARG %p"), result));
+ *result = *ap;
+ }
return ((void *)result);
}
diff --git a/contrib/ncurses/form/fty_enum.c b/contrib/ncurses/form/fty_enum.c
index 054cc4dc862d..c96a080db09d 100644
--- a/contrib/ncurses/form/fty_enum.c
+++ b/contrib/ncurses/form/fty_enum.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2004,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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_enum.c,v 1.20 2006/04/22 21:33:05 tom Exp $")
+MODULE_ID("$Id: fty_enum.c,v 1.22 2007/10/13 19:32:26 tom Exp $")
typedef struct
{
@@ -56,7 +56,7 @@ enumARG;
static void *
Make_Enum_Type(va_list *ap)
{
- enumARG *argp = (enumARG *)malloc(sizeof(enumARG));
+ enumARG *argp = typeMalloc(enumARG, 1);
if (argp)
{
@@ -64,6 +64,7 @@ Make_Enum_Type(va_list *ap)
char **kp = (char **)0;
int ccase, cunique;
+ T((T_CREATE("enumARG %p"), argp));
argp->kwds = va_arg(*ap, char **);
ccase = va_arg(*ap, int);
cunique = va_arg(*ap, int);
@@ -96,10 +97,13 @@ Copy_Enum_Type(const void *argp)
{
const enumARG *ap = (const enumARG *)argp;
- result = (enumARG *)malloc(sizeof(enumARG));
+ result = typeMalloc(enumARG, 1);
if (result)
- *result = *ap;
+ {
+ T((T_CREATE("enumARG %p"), result));
+ *result = *ap;
+ }
}
return (void *)result;
}
diff --git a/contrib/ncurses/form/fty_int.c b/contrib/ncurses/form/fty_int.c
index 13fef6272366..8a5367f74084 100644
--- a/contrib/ncurses/form/fty_int.c
+++ b/contrib/ncurses/form/fty_int.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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_int.c,v 1.20 2006/04/22 21:33:05 tom Exp $")
+MODULE_ID("$Id: fty_int.c,v 1.22 2007/10/13 19:32:40 tom Exp $")
#if USE_WIDEC_SUPPORT
#define isDigit(c) (iswdigit((wint_t)(c)) || isdigit(UChar(c)))
@@ -63,10 +63,11 @@ thisARG;
static void *
Make_This_Type(va_list *ap)
{
- thisARG *argp = (thisARG *) malloc(sizeof(thisARG));
+ thisARG *argp = typeMalloc(thisARG, 1);
if (argp)
{
+ T((T_CREATE("thisARG %p"), argp));
argp->precision = va_arg(*ap, int);
argp->low = va_arg(*ap, long);
argp->high = va_arg(*ap, long);
@@ -90,9 +91,12 @@ Copy_This_Type(const void *argp)
if (argp)
{
- result = (thisARG *) malloc(sizeof(thisARG));
+ result = typeMalloc(thisARG, 1);
if (result)
- *result = *ap;
+ {
+ T((T_CREATE("thisARG %p"), result));
+ *result = *ap;
+ }
}
return (void *)result;
}
diff --git a/contrib/ncurses/form/fty_num.c b/contrib/ncurses/form/fty_num.c
index cd09dfb001fe..e74e8e36fe25 100644
--- a/contrib/ncurses/form/fty_num.c
+++ b/contrib/ncurses/form/fty_num.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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_num.c,v 1.23 2006/04/22 21:33:05 tom Exp $")
+MODULE_ID("$Id: fty_num.c,v 1.25 2007/10/13 19:32:54 tom Exp $")
#if HAVE_LOCALE_H
#include <locale.h>
@@ -74,10 +74,11 @@ thisARG;
static void *
Make_This_Type(va_list *ap)
{
- thisARG *argn = (thisARG *) malloc(sizeof(thisARG));
+ thisARG *argn = typeMalloc(thisARG, 1);
if (argn)
{
+ T((T_CREATE("thisARG %p"), argn));
argn->precision = va_arg(*ap, int);
argn->low = va_arg(*ap, double);
argn->high = va_arg(*ap, double);
@@ -107,9 +108,12 @@ Copy_This_Type(const void *argp)
if (argp)
{
- result = (thisARG *) malloc(sizeof(thisARG));
+ result = typeMalloc(thisARG, 1);
if (result)
- *result = *ap;
+ {
+ T((T_CREATE("thisARG %p"), result));
+ *result = *ap;
+ }
}
return (void *)result;
}
diff --git a/contrib/ncurses/form/fty_regex.c b/contrib/ncurses/form/fty_regex.c
index 087ff11ec30c..247779f28c1d 100644
--- a/contrib/ncurses/form/fty_regex.c
+++ b/contrib/ncurses/form/fty_regex.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2004,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2007 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_regex.c,v 1.19 2006/04/22 21:33:05 tom Exp $")
+MODULE_ID("$Id: fty_regex.c,v 1.21 2007/10/13 19:33:50 tom Exp $")
#if HAVE_REGEX_H_FUNCS /* We prefer POSIX regex */
#include <regex.h>
@@ -105,15 +105,17 @@ Make_RegularExpression_Type(va_list *ap)
char *rx = va_arg(*ap, char *);
RegExp_Arg *preg;
- preg = (RegExp_Arg *)malloc(sizeof(RegExp_Arg));
+ preg = typeMalloc(RegExp_Arg, 1);
if (preg)
{
- if (((preg->pRegExp = (regex_t *) malloc(sizeof(regex_t))) != 0)
+ T((T_CREATE("RegExp_Arg %p"), preg));
+ if (((preg->pRegExp = typeMalloc(regex_t, 1)) != 0)
&& !regcomp(preg->pRegExp, rx,
(REG_EXTENDED | REG_NOSUB | REG_NEWLINE)))
{
- preg->refCount = (unsigned long *)malloc(sizeof(unsigned long));
+ T((T_CREATE("regex_t %p"), preg->pRegExp));
+ preg->refCount = typeMalloc(unsigned long, 1);
*(preg->refCount) = 1;
}
@@ -130,20 +132,21 @@ Make_RegularExpression_Type(va_list *ap)
char *rx = va_arg(*ap, char *);
RegExp_Arg *pArg;
- pArg = (RegExp_Arg *)malloc(sizeof(RegExp_Arg));
+ pArg = typeMalloc(RegExp_Arg, 1);
if (pArg)
{
int blen = RX_INCREMENT;
+ T((T_CREATE("RegExp_Arg %p"), pArg));
pArg->compiled_expression = NULL;
- pArg->refCount = (unsigned long *)malloc(sizeof(unsigned long));
+ pArg->refCount = typeMalloc(unsigned long, 1);
*(pArg->refCount) = 1;
do
{
- char *buf = (char *)malloc(blen);
+ char *buf = typeMalloc(char, blen);
if (buf)
{
diff --git a/contrib/ncurses/form/headers b/contrib/ncurses/form/headers
index f2267c8722c1..56d72f012238 100644
--- a/contrib/ncurses/form/headers
+++ b/contrib/ncurses/form/headers
@@ -1,5 +1,5 @@
##############################################################################
-# Copyright (c) 1998 Free Software Foundation, Inc. #
+# Copyright (c) 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"), #
@@ -29,3 +29,4 @@
# Author: Thomas E. Dickey <dickey@clark.net> 1996
#
$(srcdir)/form.h
+# vile:makemode
diff --git a/contrib/ncurses/form/modules b/contrib/ncurses/form/modules
index a11dade0ba55..89f9f9f54346 100644
--- a/contrib/ncurses/form/modules
+++ b/contrib/ncurses/form/modules
@@ -1,6 +1,6 @@
-# $Id: modules,v 1.14 2004/12/25 23:29:22 tom Exp $
+# $Id: modules,v 1.15 2006/12/24 00:52:58 tom Exp $
##############################################################################
-# Copyright (c) 1998,2004 Free Software Foundation, Inc. #
+# Copyright (c) 1998-2004,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"), #
@@ -27,7 +27,7 @@
# authorization. #
##############################################################################
#
-# Author: Thomas E. Dickey
+# Author: Thomas E. Dickey 1995-on
#
@ base
@@ -72,3 +72,5 @@ fty_int lib $(srcdir) $(FORM_PRIV_H)
fty_ipv4 lib $(srcdir) $(FORM_PRIV_H)
fty_num lib $(srcdir) $(FORM_PRIV_H)
fty_regex lib $(srcdir) $(FORM_PRIV_H)
+
+# vile:makemode