ncurses 5.9 - patch 20130720
[ncurses.git] / form / frm_post.c
index 5f07ebb84c31abda56692f85ba30642528db6b4f..31568b2a6e1fc871e5b623954e4170fb902ec812 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc.                        *
+ * Copyright (c) 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            *
  ****************************************************************************/
 
 /****************************************************************************
- *   Author: Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> 1995,1997        *
+ *   Author:  Juergen Pfeifer, 1995,1997                                    *
  ****************************************************************************/
+
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_post.c,v 1.2 1998/02/11 12:13:44 tom Exp $")
+MODULE_ID("$Id: frm_post.c,v 1.11 2012/06/10 00:27:49 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -46,37 +47,40 @@ MODULE_ID("$Id: frm_post.c,v 1.2 1998/02/11 12:13:44 tom Exp $")
 |                    E_NO_ROOM         - form doesn't fit into subwindow
 |                    E_SYSTEM_ERROR    - system error
 +--------------------------------------------------------------------------*/
-int post_form(FORM * form)
+NCURSES_EXPORT(int)
+post_form(FORM *form)
 {
   WINDOW *formwin;
   int err;
   int page;
 
+  T((T_CALLED("post_form(%p)"), (void *)form));
+
   if (!form)
     RETURN(E_BAD_ARGUMENT);
 
-  if (form->status & _POSTED)   
+  if (form->status & _POSTED)
     RETURN(E_POSTED);
 
   if (!(form->field))
     RETURN(E_NOT_CONNECTED);
-  
+
   formwin = Get_Form_Window(form);
-  if ((form->cols > getmaxx(formwin)) || (form->rows > getmaxy(formwin))) 
+  if ((form->cols > getmaxx(formwin)) || (form->rows > getmaxy(formwin)))
     RETURN(E_NO_ROOM);
 
   /* reset form->curpage to an invald value. This forces Set_Form_Page
      to do the page initialization which is required by post_form.
-  */
+   */
   page = form->curpage;
   form->curpage = -1;
-  if ((err = _nc_Set_Form_Page(form,page,form->current))!=E_OK)
+  if ((err = _nc_Set_Form_Page(form, page, form->current)) != E_OK)
     RETURN(err);
 
-  form->status |= _POSTED;
+  SetStatus(form, _POSTED);
 
-  Call_Hook(form,forminit);
-  Call_Hook(form,fieldinit);
+  Call_Hook(form, forminit);
+  Call_Hook(form, fieldinit);
 
   _nc_Refresh_Current_Field(form);
   RETURN(E_OK);
@@ -93,24 +97,27 @@ int post_form(FORM * form)
 |                    E_NOT_POSTED    - form isn't posted
 |                    E_BAD_STATE     - called from a hook routine
 +--------------------------------------------------------------------------*/
-int unpost_form(FORM * form)
+NCURSES_EXPORT(int)
+unpost_form(FORM *form)
 {
+  T((T_CALLED("unpost_form(%p)"), (void *)form));
+
   if (!form)
     RETURN(E_BAD_ARGUMENT);
 
-  if (!(form->status & _POSTED)) 
+  if (!(form->status & _POSTED))
     RETURN(E_NOT_POSTED);
 
-  if (form->status & _IN_DRIVER) 
+  if (form->status & _IN_DRIVER)
     RETURN(E_BAD_STATE);
 
-  Call_Hook(form,fieldterm);
-  Call_Hook(form,formterm);
+  Call_Hook(form, fieldterm);
+  Call_Hook(form, formterm);
 
   werase(Get_Form_Window(form));
   delwin(form->w);
   form->w = (WINDOW *)0;
-  form->status &= ~_POSTED;
+  ClrStatus(form, _POSTED);
   RETURN(E_OK);
 }