]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/hashtest.c
ncurses 6.2 - patch 20200301
[ncurses.git] / test / hashtest.c
index 2e56d73cad38cb46ff3bf657fe6c654b94c0e0be..70d622874da90bc24eee5c93ed85605f054b2a29 100644 (file)
@@ -1,5 +1,6 @@
 /****************************************************************************
 /****************************************************************************
- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc.              *
+ * Copyright 2019,2020 Thomas E. Dickey                                     *
+ * Copyright 1998-2013,2017 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            *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -30,7 +31,7 @@
  *
  * Generate timing statistics for vertical-motion optimization.
  *
  *
  * Generate timing statistics for vertical-motion optimization.
  *
- * $Id: hashtest.c,v 1.30 2009/10/10 16:14:53 tom Exp $
+ * $Id: hashtest.c,v 1.36 2020/02/02 23:34:34 tom Exp $
  */
 
 #include <test.priv.h>
  */
 
 #include <test.priv.h>
@@ -54,7 +55,7 @@ cleanup(void)
     endwin();
 }
 
     endwin();
 }
 
-static RETSIGTYPE
+static void
 finish(int sig GCC_UNUSED)
 {
     cleanup();
 finish(int sig GCC_UNUSED)
 {
     cleanup();
@@ -82,20 +83,21 @@ genlines(int base)
     move(0, 0);
     for (i = 0; i < head_lines; i++)
        for (j = 0; j < COLS; j++)
     move(0, 0);
     for (i = 0; i < head_lines; i++)
        for (j = 0; j < COLS; j++)
-           addch(UChar((j % 8 == 0) ? ('A' + j / 8) : '-'));
+           AddCh(UChar((j % 8 == 0) ? ('A' + j / 8) : '-'));
 
     move(head_lines, 0);
     for (i = head_lines; i < LINES - foot_lines; i++) {
 
     move(head_lines, 0);
     for (i = head_lines; i < LINES - foot_lines; i++) {
-       chtype c = (base - LO_CHAR + i) % (HI_CHAR - LO_CHAR + 1) + LO_CHAR;
+       chtype c = (chtype) ((base - LO_CHAR + i) % (HI_CHAR - LO_CHAR + 1)
+                            + LO_CHAR);
        int hi = (extend_corner || (i < LINES - 1)) ? COLS : COLS - 1;
        for (j = 0; j < hi; j++)
        int hi = (extend_corner || (i < LINES - 1)) ? COLS : COLS - 1;
        for (j = 0; j < hi; j++)
-           addch(c);
+           AddCh(c);
     }
 
     for (i = LINES - foot_lines; i < LINES; i++) {
        move(i, 0);
        for (j = 0; j < (extend_corner ? COLS : COLS - 1); j++)
     }
 
     for (i = LINES - foot_lines; i < LINES; i++) {
        move(i, 0);
        for (j = 0; j < (extend_corner ? COLS : COLS - 1); j++)
-           addch(UChar((j % 8 == 0) ? ('A' + j / 8) : '-'));
+           AddCh(UChar((j % 8 == 0) ? ('A' + j / 8) : '-'));
     }
 
     scrollok(stdscr, TRUE);
     }
 
     scrollok(stdscr, TRUE);
@@ -221,12 +223,10 @@ main(int argc, char *argv[])
        test_optimize = TRUE;
     }
 #if USE_TRACE
        test_optimize = TRUE;
     }
 #if USE_TRACE
-    trace(TRACE_TIMES);
+    curses_trace(TRACE_TIMES);
 #endif
 
 #endif
 
-    CATCHALL(finish);          /* arrange interrupts to terminate */
-
-    (void) initscr();          /* initialize the curses library */
+    InitAndCatch(initscr(), finish);
     keypad(stdscr, TRUE);      /* enable keyboard mapping */
     (void) nonl();             /* tell curses not to do NL->CR/NL on output */
     (void) cbreak();           /* take input chars one at a time, no wait for \n */
     keypad(stdscr, TRUE);      /* enable keyboard mapping */
     (void) nonl();             /* tell curses not to do NL->CR/NL on output */
     (void) cbreak();           /* take input chars one at a time, no wait for \n */