bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] light line draw aliases, clean up tests


From: Nick Black
Subject: Re: [PATCH] light line draw aliases, clean up tests
Date: Sat, 26 Oct 2019 23:31:55 -0400
User-agent: Mutt/1.12.2 (2019-09-21)

Thomas Dickey left as an exercise for the reader:
> > So I like these for orthogonality's sake if nothing else. If you
> > don't agree, I'd at least take the refactoring in
> > test/ncurses.c. Thanks!
> 
> sorry - the change to test/ncurses.c did not work :-(

Are you referring to a compile failure when compiling without
--enable-widec? If so, I fixed that up, my apologies (I thought
I'd sent this to the list). Apologies for wasting your time!

diff -ur ncurses-6.1-20191019/test/ncurses.c 
ncurses-6.1-20191019-dank/test/ncurses.c
--- ncurses-6.1-20191019/test/ncurses.c 2019-09-22 15:12:40.000000000 -0400
+++ ncurses-6.1-20191019-dank/test/ncurses.c    2019-10-25 17:58:29.345490200 
-0400
@@ -4067,17 +4067,40 @@
 
 #define MERGE_ATTR(wch) merge_wide_attr(&temp, wch, attr, pair)
 
+/*#define BOTH2(name) #name, &(name) */
+#define BOTH2(name) #name, MERGE_ATTR(name)
+
+#ifdef CURSES_WACS_ARRAY
+static int
+show_wacs_array(int repeat, attr_t attr, NCURSES_PAIRS_T pair)
+{
+    cchar_t temp;
+
+    int n = 0;
+    n |= show_1_wacs(n, repeat, BOTH2(WACS_GEQUAL));
+    n |= show_1_wacs(n, repeat, BOTH2(WACS_NEQUAL));
+    n |= show_1_wacs(n, repeat, BOTH2(WACS_LEQUAL));
+
+    n |= show_1_wacs(n, repeat, BOTH2(WACS_STERLING));
+    n |= show_1_wacs(n, repeat, BOTH2(WACS_PI));
+    n |= show_1_wacs(n, repeat, BOTH2(WACS_S1));
+    n |= show_1_wacs(n, repeat, BOTH2(WACS_S3));
+    n |= show_1_wacs(n, repeat, BOTH2(WACS_S7));
+    n |= show_1_wacs(n, repeat, BOTH2(WACS_S9));
+    return n;
+}
+#else
+#define show_wacs_array(repeat, attr, pair)
+#endif
+
 static void
 show_wacs_chars(int repeat, attr_t attr, NCURSES_PAIRS_T pair)
-/* display the wide-ACS character set */
+/* display the wide-ACS character set (aka the "light" box drawing chars) */
 {
     cchar_t temp;
 
     int n;
 
-/*#define BOTH2(name) #name, &(name) */
-#define BOTH2(name) #name, MERGE_ATTR(name)
-
     erase();
     attron(A_BOLD);
     MvAddStr(0, 20, "Display of the Wide-ACS Character Set");
@@ -4112,18 +4135,7 @@
     n = show_1_wacs(n, repeat, BOTH2(WACS_PLMINUS));
     n = show_1_wacs(n, repeat, BOTH2(WACS_PLUS));
 
-#ifdef CURSES_WACS_ARRAY
-    n = show_1_wacs(n, repeat, BOTH2(WACS_GEQUAL));
-    n = show_1_wacs(n, repeat, BOTH2(WACS_NEQUAL));
-    n = show_1_wacs(n, repeat, BOTH2(WACS_LEQUAL));
-
-    n = show_1_wacs(n, repeat, BOTH2(WACS_STERLING));
-    n = show_1_wacs(n, repeat, BOTH2(WACS_PI));
-    n = show_1_wacs(n, repeat, BOTH2(WACS_S1));
-    n = show_1_wacs(n, repeat, BOTH2(WACS_S3));
-    n = show_1_wacs(n, repeat, BOTH2(WACS_S7));
-    (void) show_1_wacs(n, repeat, BOTH2(WACS_S9));
-#endif
+    show_wacs_array(repeat, attr, pair);
 }
 
 #ifdef WACS_D_PLUS
@@ -4135,9 +4147,6 @@
 
     int n;
 
-/*#define BOTH2(name) #name, &(name) */
-#define BOTH2(name) #name, MERGE_ATTR(name)
-
     erase();
     attron(A_BOLD);
     MvAddStr(0, 20, "Display of the Wide-ACS Character Set");
@@ -4172,18 +4181,7 @@
     n = show_1_wacs(n, repeat, BOTH2(WACS_PLMINUS));
     n = show_1_wacs(n, repeat, BOTH2(WACS_D_PLUS));
 
-#ifdef CURSES_WACS_ARRAY
-    n = show_1_wacs(n, repeat, BOTH2(WACS_GEQUAL));
-    n = show_1_wacs(n, repeat, BOTH2(WACS_NEQUAL));
-    n = show_1_wacs(n, repeat, BOTH2(WACS_LEQUAL));
-
-    n = show_1_wacs(n, repeat, BOTH2(WACS_STERLING));
-    n = show_1_wacs(n, repeat, BOTH2(WACS_PI));
-    n = show_1_wacs(n, repeat, BOTH2(WACS_S1));
-    n = show_1_wacs(n, repeat, BOTH2(WACS_S3));
-    n = show_1_wacs(n, repeat, BOTH2(WACS_S7));
-    (void) show_1_wacs(n, repeat, BOTH2(WACS_S9));
-#endif
+    show_wacs_array(repeat, attr, pair);
 }
 #endif
 
@@ -4196,9 +4194,6 @@
 
     int n;
 
-/*#define BOTH2(name) #name, &(name) */
-#define BOTH2(name) #name, MERGE_ATTR(name)
-
     erase();
     attron(A_BOLD);
     MvAddStr(0, 20, "Display of the Wide-ACS Character Set");
@@ -4233,18 +4228,7 @@
     n = show_1_wacs(n, repeat, BOTH2(WACS_PLMINUS));
     n = show_1_wacs(n, repeat, BOTH2(WACS_T_PLUS));
 
-#ifdef CURSES_WACS_ARRAY
-    n = show_1_wacs(n, repeat, BOTH2(WACS_GEQUAL));
-    n = show_1_wacs(n, repeat, BOTH2(WACS_NEQUAL));
-    n = show_1_wacs(n, repeat, BOTH2(WACS_LEQUAL));
-
-    n = show_1_wacs(n, repeat, BOTH2(WACS_STERLING));
-    n = show_1_wacs(n, repeat, BOTH2(WACS_PI));
-    n = show_1_wacs(n, repeat, BOTH2(WACS_S1));
-    n = show_1_wacs(n, repeat, BOTH2(WACS_S3));
-    n = show_1_wacs(n, repeat, BOTH2(WACS_S7));
-    (void) show_1_wacs(n, repeat, BOTH2(WACS_S9));
-#endif
+    show_wacs_array(repeat, attr, pair);
 }
 #endif
 

-- 
nick black -=- https://www.nick-black.com
to make an apple pie from scratch,
you need first invent a universe.

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]