]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - form/fld_def.c
ncurses 6.2 - patch 20210619
[ncurses.git] / form / fld_def.c
index 604e01895d8d2bafcf41476e6b9b94b3e964e042..51bdc648580043f01a1c4da5b1fd06714642b519 100644 (file)
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc.              *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 1998-2012,2014 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +33,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_def.c,v 1.39 2011/07/16 22:26:11 tom Exp $")
+MODULE_ID("$Id: fld_def.c,v 1.44 2021/03/27 23:49:53 tom Exp $")
 
 /* this can't be readonly */
 static FIELD default_field =
@@ -53,7 +54,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    */
@@ -65,7 +66,7 @@ static FIELD default_field =
   NCURSES_FIELD_EXTENSION
 };
 
-NCURSES_EXPORT_VAR(FIELD *) _nc_Default_Field = &default_field;
+FORM_EXPORT_VAR(FIELD *) _nc_Default_Field = &default_field;
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform
@@ -81,18 +82,17 @@ NCURSES_EXPORT_VAR(FIELD *) _nc_Default_Field = &default_field;
 |   Return Values :  Pointer to argument structure. Maybe NULL.
 |                    In case of an error in *err an error counter is increased.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(TypeArgument *)
+FORM_EXPORT(TypeArgument *)
 _nc_Make_Argument(const FIELDTYPE *typ, va_list *ap, int *err)
 {
   TypeArgument *res = (TypeArgument *)0;
-  TypeArgument *p;
 
   if (typ != 0 && (typ->status & _HAS_ARGS) != 0)
     {
       assert(err != 0 && ap != (va_list *)0);
       if ((typ->status & _LINKED_TYPE) != 0)
        {
-         p = typeMalloc(TypeArgument, 1);
+         TypeArgument *p = typeMalloc(TypeArgument, 1);
 
          if (p != 0)
            {
@@ -129,18 +129,17 @@ _nc_Make_Argument(const FIELDTYPE *typ, va_list *ap, int *err)
 |   Return Values :  Pointer to argument structure. Maybe NULL.
 |                    In case of an error in *err an error counter is increased.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(TypeArgument *)
+FORM_EXPORT(TypeArgument *)
 _nc_Copy_Argument(const FIELDTYPE *typ, const TypeArgument *argp, int *err)
 {
   TypeArgument *res = (TypeArgument *)0;
-  TypeArgument *p;
 
   if (typ != 0 && (typ->status & _HAS_ARGS) != 0)
     {
       assert(err != 0 && argp != 0);
       if ((typ->status & _LINKED_TYPE) != 0)
        {
-         p = typeMalloc(TypeArgument, 1);
+         TypeArgument *p = typeMalloc(TypeArgument, 1);
 
          if (p != 0)
            {
@@ -178,7 +177,7 @@ _nc_Copy_Argument(const FIELDTYPE *typ, const TypeArgument *argp, int *err)
 |
 |   Return Values :  -
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void)
+FORM_EXPORT(void)
 _nc_Free_Argument(const FIELDTYPE *typ, TypeArgument *argp)
 {
   if (typ != 0 && (typ->status & _HAS_ARGS) != 0)
@@ -211,7 +210,7 @@ _nc_Free_Argument(const FIELDTYPE *typ, TypeArgument *argp)
 |   Return Values :  TRUE       - copy worked
 |                    FALSE      - error occurred
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(bool)
+FORM_EXPORT(bool)
 _nc_Copy_Type(FIELD *dst, FIELD const *src)
 {
   int err = 0;
@@ -246,7 +245,7 @@ _nc_Copy_Type(FIELD *dst, FIELD const *src)
 |
 |   Return Values :  -
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void)
+FORM_EXPORT(void)
 _nc_Free_Type(FIELD *field)
 {
   assert(field != 0);
@@ -273,7 +272,7 @@ _nc_Free_Type(FIELD *field)
 |
 |   Return Values :  Pointer to the new field or NULL if failure.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FIELD *)
+FORM_EXPORT(FIELD *)
 new_field(int rows, int cols, int frow, int fcol, int nrow, int nbuf)
 {
   static const FIELD_CELL blank = BLANK;
@@ -294,14 +293,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 = rows;
-      New_Field->cols = cols;
+      New_Field->rows = (short)rows;
+      New_Field->cols = (short)cols;
       New_Field->drows = rows + nrow;
       New_Field->dcols = cols;
-      New_Field->frow = frow;
-      New_Field->fcol = fcol;
+      New_Field->frow = (short)frow;
+      New_Field->fcol = (short)fcol;
       New_Field->nrow = nrow;
-      New_Field->nbuf = nbuf;
+      New_Field->nbuf = (short)nbuf;
       New_Field->link = New_Field;
 
 #if USE_WIDEC_SUPPORT
@@ -353,7 +352,7 @@ new_field(int rows, int cols, int frow, int fcol, int nrow, int nbuf)
 |                    E_BAD_ARGUMENT - invalid field pointer
 |                    E_CONNECTED    - field is connected
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 free_field(FIELD *field)
 {
   T((T_CALLED("free_field(%p)"), (void *)field));