aboutsummaryrefslogtreecommitdiff
path: root/contrib/ncurses/form/frm_driver.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ncurses/form/frm_driver.c')
-rw-r--r--contrib/ncurses/form/frm_driver.c58
1 files changed, 36 insertions, 22 deletions
diff --git a/contrib/ncurses/form/frm_driver.c b/contrib/ncurses/form/frm_driver.c
index e609e191de2a..3a02a5daafbb 100644
--- a/contrib/ncurses/form/frm_driver.c
+++ b/contrib/ncurses/form/frm_driver.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc. *
+ * Copyright (c) 1998,2000 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 *
@@ -31,7 +31,7 @@
****************************************************************************/
#include "form.priv.h"
-MODULE_ID("$Id: frm_driver.c,v 1.35 1999/05/16 17:20:52 juergen Exp $")
+MODULE_ID("$Id: frm_driver.c,v 1.38 2001/03/25 02:07:50 juergen Exp $")
/*----------------------------------------------------------------------------
This is the core module of the form library. It contains the majority
@@ -516,7 +516,8 @@ static bool Field_Grown(FIELD * field, int amount)
return FALSE;
}
assert(form!=(FORM *)0);
- delwin(form->w);
+ if (form->w)
+ delwin(form->w);
form->w = new_window;
Set_Field_Window_Attributes(field,form->w);
werase(form->w);
@@ -558,8 +559,8 @@ static bool Field_Grown(FIELD * field, int amount)
| E_SYSTEM_ERROR - form has no current field or
| field-window
+--------------------------------------------------------------------------*/
-int
-_nc_Position_Form_Cursor(FORM * form)
+NCURSES_EXPORT(int)
+_nc_Position_Form_Cursor (FORM * form)
{
FIELD *field;
WINDOW *formwin;
@@ -599,8 +600,8 @@ _nc_Position_Form_Cursor(FORM * form)
| E_BAD_ARGUMENT - invalid form pointer
| E_SYSTEM_ERROR - general error
+--------------------------------------------------------------------------*/
-int
-_nc_Refresh_Current_Field(FORM * form)
+NCURSES_EXPORT(int)
+_nc_Refresh_Current_Field (FORM * form)
{
WINDOW *formwin;
FIELD *field;
@@ -957,7 +958,8 @@ static int Synchronize_Linked_Fields(FIELD * field)
| E_BAD_ARGUMENT - invalid field pointer
| E_SYSTEM_ERROR - some severe basic error
+--------------------------------------------------------------------------*/
-int _nc_Synchronize_Attributes(FIELD * field)
+NCURSES_EXPORT(int)
+_nc_Synchronize_Attributes (FIELD * field)
{
FORM *form;
int res = E_OK;
@@ -1015,8 +1017,9 @@ int _nc_Synchronize_Attributes(FIELD * field)
| E_BAD_ARGUMENT - invalid field pointer
| E_SYSTEM_ERROR - some severe basic error
+--------------------------------------------------------------------------*/
-int
-_nc_Synchronize_Options(FIELD *field, Field_Options newopts)
+NCURSES_EXPORT(int)
+_nc_Synchronize_Options
+(FIELD *field, Field_Options newopts)
{
Field_Options oldopts;
Field_Options changed_opts;
@@ -1113,8 +1116,9 @@ _nc_Synchronize_Options(FIELD *field, Field_Options newopts)
| E_BAD_ARGUMENT - invalid form or field pointer
| E_SYSTEM_ERROR - some severe basic error
+--------------------------------------------------------------------------*/
-int
-_nc_Set_Current_Field(FORM *form, FIELD *newfield)
+NCURSES_EXPORT(int)
+_nc_Set_Current_Field
+(FORM *form, FIELD *newfield)
{
FIELD *field;
WINDOW *new_window;
@@ -1159,6 +1163,7 @@ _nc_Set_Current_Field(FORM *form, FIELD *newfield)
}
}
delwin(form->w);
+ form->w = (WINDOW *)0;
}
field = newfield;
@@ -1173,7 +1178,11 @@ _nc_Set_Current_Field(FORM *form, FIELD *newfield)
return(E_SYSTEM_ERROR);
form->current = field;
+
+ if (form->w)
+ delwin(form->w);
form->w = new_window;
+
form->status &= ~_WINDOW_MODIFIED;
Set_Field_Window_Attributes(field,form->w);
@@ -2686,8 +2695,8 @@ static bool Check_Field(FIELDTYPE *typ, FIELD *field, TypeArgument *argp)
| Return Values : TRUE - field is valid
| FALSE - field is invalid
+--------------------------------------------------------------------------*/
-bool
-_nc_Internal_Validation(FORM *form)
+NCURSES_EXPORT(bool)
+_nc_Internal_Validation (FORM *form)
{
FIELD *field;
@@ -2776,8 +2785,8 @@ INLINE static FIELD *Next_Field_On_Page(FIELD * field)
|
| Return Values : Pointer to calculated field.
+--------------------------------------------------------------------------*/
-FIELD*
-_nc_First_Active_Field(FORM * form)
+NCURSES_EXPORT(FIELD*)
+_nc_First_Active_Field (FORM * form)
{
FIELD **last_on_page = &form->field[form->page[form->curpage].pmax];
FIELD *proposed = Next_Field_On_Page(*last_on_page);
@@ -3283,8 +3292,9 @@ static int FN_Down_Field(FORM * form)
| Return Values : E_OK - success
| != E_OK - error from subordinate call
+--------------------------------------------------------------------------*/
-int
-_nc_Set_Form_Page(FORM * form, int page, FIELD * field)
+NCURSES_EXPORT(int)
+_nc_Set_Form_Page
+(FORM * form, int page, FIELD * field)
{
int res = E_OK;
@@ -3637,7 +3647,8 @@ static const Binding_Info bindings[MAX_FORM_COMMAND - MIN_FORM_COMMAND + 1] =
| E_REQUEST_DENIED - request failed
| E_UNKNOWN_COMMAND - command not known
+--------------------------------------------------------------------------*/
-int form_driver(FORM * form, int c)
+NCURSES_EXPORT(int)
+form_driver (FORM * form, int c)
{
const Binding_Info* BI = (Binding_Info *)0;
int res = E_UNKNOWN_COMMAND;
@@ -3736,7 +3747,9 @@ int form_driver(FORM * form, int c)
| E_BAD_ARGUMENT - invalid argument
| E_SYSTEM_ERROR - system error
+--------------------------------------------------------------------------*/
-int set_field_buffer(FIELD * field, int buffer, const char * value)
+NCURSES_EXPORT(int)
+set_field_buffer
+(FIELD * field, int buffer, const char * value)
{
char *s, *p;
int res = E_OK;
@@ -3778,7 +3791,7 @@ int set_field_buffer(FIELD * field, int buffer, const char * value)
unsigned int i;
for(i=len; i<vlen; i++)
- if (!isprint(value[i]))
+ if (!isprint((unsigned char)value[i]))
RETURN(E_BAD_ARGUMENT);
}
len = vlen;
@@ -3832,7 +3845,8 @@ int set_field_buffer(FIELD * field, int buffer, const char * value)
|
| Return Values : Pointer to buffer or NULL if arguments were invalid.
+--------------------------------------------------------------------------*/
-char *field_buffer(const FIELD * field, int buffer)
+NCURSES_EXPORT(char *)
+field_buffer (const FIELD * field, int buffer)
{
if (field && (buffer >= 0) && (buffer <= field->nbuf))
return Address_Of_Nth_Buffer(field,buffer);