ncurses 6.2 - patch 20210508
[ncurses.git] / form / frm_page.c
index a91460c06c6340a89d663d0c46a38c65e1c67478..a4030a2b5f625dc6026bee9208e084697c14df75 100644 (file)
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998 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            *
  ****************************************************************************/
 
 /****************************************************************************
- *   Author: Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> 1995,1997        *
+ *   Author:  Juergen Pfeifer, 1995,1997                                    *
  ****************************************************************************/
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_page.c,v 1.3 1998/02/11 12:13:44 tom Exp $")
+MODULE_ID("$Id: frm_page.c,v 1.14 2020/05/24 01:40:20 anonymous.maarten Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform  
@@ -46,35 +47,38 @@ MODULE_ID("$Id: frm_page.c,v 1.3 1998/02/11 12:13:44 tom Exp $")
 |                    E_INVALID_FIELD   - current field can't be left
 |                    E_SYSTEM_ERROR    - system error
 +--------------------------------------------------------------------------*/
-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);
                }
            }
@@ -92,9 +96,12 @@ int set_form_page(FORM * form, int page)
 |   Return Values :  >= 0  : current page number
 |                    -1    : invalid form pointer
 +--------------------------------------------------------------------------*/
-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 */