X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Ftest_add_wchstr.c;h=e2c8b6677faa3513ae537fc5f0e7de45d7eaf818;hp=58ff87d5af212b0e9a1517ad63a76222ab1404eb;hb=f3ec084eb66ba14feb6357b674fb85dd474933d8;hpb=a924c24b2535cccdc0f5f991cd8ddcadcfa1f0d2 diff --git a/test/test_add_wchstr.c b/test/test_add_wchstr.c index 58ff87d5..e2c8b667 100644 --- a/test/test_add_wchstr.c +++ b/test/test_add_wchstr.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 2009-2016,2017 Free Software Foundation, Inc. * + * Copyright 2020 Thomas E. Dickey * + * Copyright 2009-2016,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 * @@ -26,7 +27,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: test_add_wchstr.c,v 1.23 2017/04/08 23:10:35 tom Exp $ + * $Id: test_add_wchstr.c,v 1.27 2020/02/02 23:34:34 tom Exp $ * * Demonstrate the waddwchstr() and wadd_wch functions. * Thomas Dickey - 2009/9/12 @@ -48,18 +49,24 @@ #define WIDE_LINEDATA #include +#undef AddCh #undef MvAddCh #undef MvAddStr #undef MvWAddCh +#undef MvWAddChStr #undef MvWAddStr +#undef WAddCh -/* definitions to make it simpler to compare with test_addstr.c */ +/* + * redefinitions to simplify comparison between test_*str programs + */ #define AddNStr add_wchnstr #define AddStr add_wchstr #define MvAddNStr (void) mvadd_wchnstr #define MvAddStr (void) mvadd_wchstr #define MvWAddNStr (void) mvwadd_wchnstr #define MvWAddStr (void) mvwadd_wchstr +#define MvWAddChStr(w,y,x,s) (void) mvwadd_wchstr((w),(y),(x),(s)) #define WAddNStr wadd_wchnstr #define WAddStr wadd_wchstr @@ -291,7 +298,7 @@ AddCh(chtype ch) #define LEN(n) ((length - (n) > n_opt) ? n_opt : (length - (n))) static void -test_add_wchstr(int level) +recursive_test(int level) { static bool first = TRUE; @@ -306,8 +313,12 @@ test_add_wchstr(int level) WINDOW *work = 0; WINDOW *show = 0; int margin = (2 * MY_TABSIZE) - 1; - Options option = ((m_opt ? oMove : oDefault) - | ((w_opt || (level > 0)) ? oWindow : oDefault)); + Options option = (Options) ((unsigned) (m_opt + ? oMove + : oDefault) + | (unsigned) ((w_opt || (level > 0)) + ? oWindow + : oDefault)); if (first) { static char cmd[80]; @@ -352,8 +363,8 @@ test_add_wchstr(int level) MvWVLine(work, row, margin + 1, ACS_VLINE, limit - 2); limit /= 2; - (void) mvwadd_wchstr(work, 1, 2, ChStr("String")); - (void) mvwadd_wchstr(work, limit + 1, 2, ChStr("Chars")); + MvWAddChStr(work, 1, 2, ChStr("String")); + MvWAddChStr(work, limit + 1, 2, ChStr("Chars")); wnoutrefresh(work); buffer[length = 0] = '\0'; @@ -370,7 +381,7 @@ test_add_wchstr(int level) wmove(work, row, margin + 1); switch (ch) { case key_RECUR: - test_add_wchstr(level + 1); + recursive_test(level + 1); if (look) touchwin(look); @@ -583,7 +594,7 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) if (optind < argc) usage(); - test_add_wchstr(0); + recursive_test(0); endwin(); #if NO_LEAKS free(temp_buffer);