ncurses 6.2 - patch 20201017
[ncurses.git] / form / frm_page.c
index 354c9aea07ee31d3389e9cf4f6aa589ff9ac6c05..a4030a2b5f625dc6026bee9208e084697c14df75 100644 (file)
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2002,2003 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_page.c,v 1.8 2003/10/25 15:17:08 tom Exp $")
+MODULE_ID("$Id: frm_page.c,v 1.14 2020/05/24 01:40:20 anonymous.maarten Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -46,36 +47,38 @@ MODULE_ID("$Id: frm_page.c,v 1.8 2003/10/25 15:17:08 tom Exp $")
 |                    E_INVALID_FIELD   - current field can't be left
 |                    E_SYSTEM_ERROR    - system error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
-set_form_page (FORM * form, int page)
+FORM_EXPORT(int)
+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->curpage = (short)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);
                }
            }
@@ -93,10 +96,12 @@ set_form_page (FORM * form, int page)
 |   Return Values :  >= 0  : current page number
 |                    -1    : invalid form pointer
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
-form_page (const FORM * form)
+FORM_EXPORT(int)
+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 */