]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - form/fld_type.c
ncurses 6.2 - patch 20210925
[ncurses.git] / form / fld_type.c
index fd314f73364bcf71f8232084609b08a7aa7914bc..c557e053c00c502b077254e3f8c6328208d83589 100644 (file)
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc.                        *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 1998-2004,2010 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            *
  ****************************************************************************/
 
 /****************************************************************************
- *   Author: Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> 1995,1997        *
+ *   Author:  Juergen Pfeifer, 1995,1997                                    *
  ****************************************************************************/
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_type.c,v 1.7 1998/02/11 12:13:43 tom Exp $")
+MODULE_ID("$Id: fld_type.c,v 1.20 2021/06/17 21:20:30 tom Exp $")
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  int set_field_type(FIELD *field, FIELDTYPE *type,...)
-|   
+|
 |   Description   :  Associate the specified fieldtype with the field.
 |                    Certain field types take additional arguments. Look
 |                    at the spec of the field types !
@@ -45,30 +46,33 @@ MODULE_ID("$Id: fld_type.c,v 1.7 1998/02/11 12:13:43 tom Exp $")
 |   Return Values :  E_OK           - success
 |                    E_SYSTEM_ERROR - system error
 +--------------------------------------------------------------------------*/
-int set_field_type(FIELD *field,FIELDTYPE *type, ...)
+FORM_EXPORT(int)
+set_field_type(FIELD *field, FIELDTYPE *type, ...)
 {
   va_list ap;
   int res = E_SYSTEM_ERROR;
   int err = 0;
 
-  va_start(ap,type);
+  T((T_CALLED("set_field_type(%p,%p)"), (void *)field, (void *)type));
+
+  va_start(ap, type);
 
   Normalize_Field(field);
   _nc_Free_Type(field);
 
   field->type = type;
-  field->arg  = (void *)_nc_Make_Argument(field->type,&ap,&err);
+  field->arg = (void *)_nc_Make_Argument(field->type, &ap, &err);
 
   if (err)
     {
-      _nc_Free_Argument(field->type,(TypeArgument *)(field->arg));
+      _nc_Free_Argument(field->type, (TypeArgument *)(field->arg));
       field->type = (FIELDTYPE *)0;
-      field->arg  = (void *)0;
+      field->arg = (void *)0;
     }
   else
     {
       res = E_OK;
-      if (field->type) 
+      if (field->type)
        field->type->ref++;
     }
 
@@ -77,16 +81,18 @@ int set_field_type(FIELD *field,FIELDTYPE *type, ...)
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  FIELDTYPE *field_type(const FIELD *field)
-|   
+|
 |   Description   :  Retrieve the associated fieldtype for this field.
 |
 |   Return Values :  Pointer to fieldtype of NULL if none is defined.
 +--------------------------------------------------------------------------*/
-FIELDTYPE *field_type(const FIELD * field)
+FORM_EXPORT(FIELDTYPE *)
+field_type(const FIELD *field)
 {
-  return Normalize_Field(field)->type;
+  T((T_CALLED("field_type(%p)"), (const void *)field));
+  returnFieldType(Normalize_Field(field)->type);
 }
 
 /* fld_type.c ends here */