ncurses 6.2 - patch 20200912
[ncurses.git] / form / frm_def.c
index 86500f239863f125c81c5178ac3c0896fd3d86ac..8661c0743ceb9da1cb2d331e6afb370ba1259404 100644 (file)
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright 2020 Thomas E. Dickey                                          *
+ * Copyright 1998-2010,2012 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +33,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_def.c,v 1.25 2010/01/23 21:14:36 tom Exp $")
+MODULE_ID("$Id: frm_def.c,v 1.28 2020/05/24 01:40:20 anonymous.maarten Exp $")
 
 /* this can't be readonly */
 static FORM default_form =
@@ -61,7 +62,7 @@ static FORM default_form =
   NULL                         /* fieldterm  */
 };
 
-NCURSES_EXPORT_VAR(FORM *) _nc_Default_Form = &default_form;
+FORM_EXPORT_VAR(FORM *) _nc_Default_Form = &default_form;
 \f
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -199,14 +200,14 @@ Connect_Fields(FORM *form, FIELD **fields)
   for (j = 0; j < field_cnt; j++)
     {
       if (j == 0)
-       pg->pmin = j;
+       pg->pmin = (short) j;
       else
        {
          if (fields[j]->status & _NEWPAGE)
            {
-             pg->pmax = j - 1;
+             pg->pmax = (short) (j - 1);
              pg++;
-             pg->pmin = j;
+             pg->pmin = (short) j;
            }
        }
 
@@ -214,14 +215,14 @@ Connect_Fields(FORM *form, FIELD **fields)
       maximum_col_in_field = fields[j]->fcol + fields[j]->cols;
 
       if (form->rows < maximum_row_in_field)
-       form->rows = maximum_row_in_field;
+       form->rows = (short) maximum_row_in_field;
       if (form->cols < maximum_col_in_field)
-       form->cols = maximum_col_in_field;
+       form->cols = (short) maximum_col_in_field;
     }
 
-  pg->pmax = field_cnt - 1;
-  form->maxfield = field_cnt;
-  form->maxpage = page_nr;
+  pg->pmax = (short) (field_cnt - 1);
+  form->maxfield = (short) field_cnt;
+  form->maxpage = (short) page_nr;
 
   /* Sort fields on form pages */
   for (page_nr = 0; page_nr < form->maxpage; page_nr++)
@@ -230,8 +231,8 @@ Connect_Fields(FORM *form, FIELD **fields)
 
       for (j = form->page[page_nr].pmin; j <= form->page[page_nr].pmax; j++)
        {
-         fields[j]->index = j;
-         fields[j]->page = page_nr;
+         fields[j]->index = (short) j;
+         fields[j]->page = (short) page_nr;
          fld = Insert_Field_By_Position(fields[j], fld);
        }
       if (fld)
@@ -294,7 +295,7 @@ Associate_Fields(FORM *form, FIELD **fields)
 |                    E_CONNECTED     - a field is already connected
 |                    E_SYSTEM_ERROR  - not enough memory
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FORM *)
+FORM_EXPORT(FORM *)
 NCURSES_SP_NAME(new_form) (NCURSES_SP_DCLx FIELD **fields)
 {
   int err = E_SYSTEM_ERROR;
@@ -343,7 +344,7 @@ NCURSES_SP_NAME(new_form) (NCURSES_SP_DCLx FIELD **fields)
 |                    E_SYSTEM_ERROR  - not enough memory
 +--------------------------------------------------------------------------*/
 #if NCURSES_SP_FUNCS
-NCURSES_EXPORT(FORM *)
+FORM_EXPORT(FORM *)
 new_form(FIELD **fields)
 {
   return NCURSES_SP_NAME(new_form) (CURRENT_SCREEN, fields);
@@ -360,7 +361,7 @@ new_form(FIELD **fields)
 |                    E_BAD_ARGUMENT - invalid form pointer
 |                    E_POSTED       - form is posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 free_form(FORM *form)
 {
   T((T_CALLED("free_form(%p)"), (void *)form));
@@ -391,7 +392,7 @@ free_form(FORM *form)
 |                    E_POSTED        - form is posted
 |                    E_SYSTEM_ERROR  - not enough memory
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_form_fields(FORM *form, FIELD **fields)
 {
   FIELD **old;
@@ -422,7 +423,7 @@ set_form_fields(FORM *form, FIELD **fields)
 |
 |   Return Values :  Pointer to field array
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FIELD **)
+FORM_EXPORT(FIELD **)
 form_fields(const FORM *form)
 {
   T((T_CALLED("form_field(%p)"), (const void *)form));
@@ -437,7 +438,7 @@ form_fields(const FORM *form)
 |
 |   Return Values :  Number of fields, -1 if none are defined
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 field_count(const FORM *form)
 {
   T((T_CALLED("field_count(%p)"), (const void *)form));