]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - menu/m_spacing.c
ncurses 6.2 - patch 20200613
[ncurses.git] / menu / m_spacing.c
index 1d035ab052d9540d65123b3daa1b0db163fa8db6..9bb746a0810b284c465e76ea3a2cea3937715362 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            *
@@ -27,7 +28,7 @@
  ****************************************************************************/
 
 /****************************************************************************
- *   Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997            *
+ *   Author:  Juergen Pfeifer, 1995,1997                                    *
  ****************************************************************************/
 
 /***************************************************************************
@@ -37,7 +38,7 @@
 
 #include "menu.priv.h"
 
-MODULE_ID("$Id: m_spacing.c,v 1.11 1999/05/16 17:28:09 juergen Exp $")
+MODULE_ID("$Id: m_spacing.c,v 1.20 2020/02/02 23:34:34 tom Exp $")
 
 #define MAX_SPC_DESC ((TABSIZE) ? (TABSIZE) : 8)
 #define MAX_SPC_COLS ((TABSIZE) ? (TABSIZE) : 8)
@@ -47,13 +48,18 @@ MODULE_ID("$Id: m_spacing.c,v 1.11 1999/05/16 17:28:09 juergen Exp $")
 |   Facility      :  libnmenu
 |   Function      :  int set_menu_spacing(MENU *menu,int desc, int r, int c);
 |
-|   Description   :  Set the spacing between entried
+|   Description   :  Set the spacing between entries
 |
 |   Return Values :  E_OK                 - on success
 +--------------------------------------------------------------------------*/
-int set_menu_spacing(MENU *menu, int s_desc, int s_row, int s_col )
+NCURSES_EXPORT(int)
+set_menu_spacing(MENU * menu, int s_desc, int s_row, int s_col)
 {
-  MENU *m; /* split for ATAC workaround */
+  MENU *m;                     /* split for ATAC workaround */
+
+  T((T_CALLED("set_menu_spacing(%p,%d,%d,%d)"),
+     (void *)menu, s_desc, s_row, s_col));
+
   m = Normalize_Menu(menu);
 
   assert(m);
@@ -61,19 +67,18 @@ int set_menu_spacing(MENU *menu, int s_desc, int s_row, int s_col )
     RETURN(E_POSTED);
 
   if (((s_desc < 0) || (s_desc > MAX_SPC_DESC)) ||
-      ((s_row  < 0) || (s_row  > MAX_SPC_ROWS)) ||
-      ((s_col  < 0) || (s_col  > MAX_SPC_COLS)))
+      ((s_row < 0) || (s_row > MAX_SPC_ROWS)) ||
+      ((s_col < 0) || (s_col > MAX_SPC_COLS)))
     RETURN(E_BAD_ARGUMENT);
 
-  m->spc_desc = s_desc ? s_desc : 1;
-  m->spc_rows = s_row  ? s_row  : 1;
-  m->spc_cols = s_col  ? s_col  : 1;
+  m->spc_desc = (short)(s_desc ? s_desc : 1);
+  m->spc_rows = (short)(s_row ? s_row : 1);
+  m->spc_cols = (short)(s_col ? s_col : 1);
   _nc_Calculate_Item_Length_and_Width(m);
 
   RETURN(E_OK);
 }
 
-
 /*---------------------------------------------------------------------------
 |   Facility      :  libnmenu
 |   Function      :  int menu_spacing (const MENU *,int *,int *,int *);
@@ -82,15 +87,26 @@ int set_menu_spacing(MENU *menu, int s_desc, int s_row, int s_col )
 |
 |   Return Values :  E_OK             - on success
 +--------------------------------------------------------------------------*/
-int menu_spacing( const MENU *menu, int* s_desc, int* s_row, int* s_col)
+NCURSES_EXPORT(int)
+menu_spacing(const MENU * menu, int *s_desc, int *s_row, int *s_col)
 {
-  const MENU *m; /* split for ATAC workaround */
+  const MENU *m;               /* split for ATAC workaround */
+
+  T((T_CALLED("menu_spacing(%p,%p,%p,%p)"),
+     (const void *)menu,
+     (void *)s_desc,
+     (void *)s_row,
+     (void *)s_col));
+
   m = Normalize_Menu(menu);
 
   assert(m);
-  if (s_desc) *s_desc = m->spc_desc;
-  if (s_row)  *s_row  = m->spc_rows;
-  if (s_col)  *s_col  = m->spc_cols;
+  if (s_desc)
+    *s_desc = m->spc_desc;
+  if (s_row)
+    *s_row = m->spc_rows;
+  if (s_col)
+    *s_col = m->spc_cols;
 
   RETURN(E_OK);
 }