ncurses 5.9 - patch 20111022
[ncurses.git] / form / frm_page.c
index 354c9aea07ee31d3389e9cf4f6aa589ff9ac6c05..5a76ca99579363a881753e36010af9ef6695e14f 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc.              *
+ * Copyright (c) 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            *
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_page.c,v 1.8 2003/10/25 15:17:08 tom Exp $")
+MODULE_ID("$Id: frm_page.c,v 1.11 2010/01/23 21:14:36 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -47,35 +47,37 @@ MODULE_ID("$Id: frm_page.c,v 1.8 2003/10/25 15:17:08 tom Exp $")
 |                    E_SYSTEM_ERROR    - system error
 +--------------------------------------------------------------------------*/
 NCURSES_EXPORT(int)
-set_form_page (FORM * form, int page)
+set_form_page(FORM *form, int page)
 {
   int err = E_OK;
 
-  if ( !form || (page<0) || (page>=form->maxpage) )
+  T((T_CALLED("set_form_page(%p,%d)"), (void *)form, page));
+
+  if (!form || (page < 0) || (page >= form->maxpage))
     RETURN(E_BAD_ARGUMENT);
 
   if (!(form->status & _POSTED))
     {
       form->curpage = page;
       form->current = _nc_First_Active_Field(form);
-  }
+    }
   else
     {
-      if (form->status & _IN_DRIVER) 
+      if (form->status & _IN_DRIVER)
        err = E_BAD_STATE;
       else
        {
          if (form->curpage != page)
            {
-             if (!_nc_Internal_Validation(form)) 
+             if (!_nc_Internal_Validation(form))
                err = E_INVALID_FIELD;
              else
                {
-                 Call_Hook(form,fieldterm);
-                 Call_Hook(form,formterm);
-                 err = _nc_Set_Form_Page(form,page,(FIELD *)0);
-                 Call_Hook(form,forminit);
-                 Call_Hook(form,fieldinit);
+                 Call_Hook(form, fieldterm);
+                 Call_Hook(form, formterm);
+                 err = _nc_Set_Form_Page(form, page, (FIELD *)0);
+                 Call_Hook(form, forminit);
+                 Call_Hook(form, fieldinit);
                  _nc_Refresh_Current_Field(form);
                }
            }
@@ -94,9 +96,11 @@ set_form_page (FORM * form, int page)
 |                    -1    : invalid form pointer
 +--------------------------------------------------------------------------*/
 NCURSES_EXPORT(int)
-form_page (const FORM * form)
+form_page(const FORM *form)
 {
-  return Normalize_Form(form)->curpage;
+  T((T_CALLED("form_page(%p)"), (const void *)form));
+
+  returnCode(Normalize_Form(form)->curpage);
 }
 
 /* frm_page.c ends here */