]> ncurses.scripts.mit.edu Git - ncurses.git/commitdiff
ncurses 5.9 - patch 20120903
authorThomas E. Dickey <dickey@invisible-island.net>
Mon, 3 Sep 2012 22:21:48 +0000 (22:21 +0000)
committerThomas E. Dickey <dickey@invisible-island.net>
Mon, 3 Sep 2012 22:21:48 +0000 (22:21 +0000)
+ simplify varargs logic in lib_printw.c; va_copy is no longer needed
  there.
+ modifications for mingw port to make wide-character display usable.

NEWS
dist.mk
ncurses/base/lib_printw.c
ncurses/tinfo/lib_setup.c
ncurses/win32con/win_driver.c
package/debian/changelog
package/ncurses.spec

diff --git a/NEWS b/NEWS
index 6edf990a26501a0103b25b7942dd1bfa3ee6f602..5c328a3dfe00619a615ef63a6215b403d58e7972 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -25,7 +25,7 @@
 -- sale, use or other dealings in this Software without prior written        --
 -- authorization.                                                            --
 -------------------------------------------------------------------------------
--- $Id: NEWS,v 1.1950 2012/09/02 16:59:41 tom Exp $
+-- $Id: NEWS,v 1.1952 2012/09/03 17:59:39 tom Exp $
 -------------------------------------------------------------------------------
 
 This is a log of changes that ncurses has gone through since Zeyd started
@@ -45,6 +45,11 @@ See the AUTHORS file for the corresponding full names.
 Changes through 1.9.9e did not credit all contributions;
 it is not possible to add this information.
 
+20120903
+       + simplify varargs logic in lib_printw.c; va_copy is no longer needed
+         there.
+       + modifications for mingw port to make wide-character display usable.
+
 20120902
        + regenerate configure script (report by Sven Joachim, cf: 20120901).
 
diff --git a/dist.mk b/dist.mk
index dadfee81b3d1d64b9a3335931da0897f9c2d6df5..0c68bb09f4d028ab0ce682615835785a5106cd8b 100644 (file)
--- a/dist.mk
+++ b/dist.mk
@@ -25,7 +25,7 @@
 # use or other dealings in this Software without prior written               #
 # authorization.                                                             #
 ##############################################################################
-# $Id: dist.mk,v 1.890 2012/09/02 16:58:18 tom Exp $
+# $Id: dist.mk,v 1.891 2012/09/03 12:47:40 tom Exp $
 # Makefile for creating ncurses distributions.
 #
 # This only needs to be used directly as a makefile by developers, but
@@ -37,7 +37,7 @@ SHELL = /bin/sh
 # These define the major/minor/patch versions of ncurses.
 NCURSES_MAJOR = 5
 NCURSES_MINOR = 9
-NCURSES_PATCH = 20120902
+NCURSES_PATCH = 20120903
 
 # We don't append the patch to the version, since this only applies to releases
 VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
index 3064c260f10376d6e9cc6c16f838195ec61d7b86..56528f6bc7a7c050153701ed0d906e26e0890f38 100644 (file)
@@ -27,7 +27,7 @@
  ****************************************************************************/
 
 /****************************************************************************
- *  Author: Thomas E. Dickey <dickey@clark.net> 1997                        *
+ *  Author: Thomas E. Dickey            1997-on                             *
  ****************************************************************************/
 
 /*
@@ -39,7 +39,7 @@
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_printw.c,v 1.22 2012/03/10 20:47:33 tom Exp $")
+MODULE_ID("$Id: lib_printw.c,v 1.23 2012/09/03 17:55:28 tom Exp $")
 
 NCURSES_EXPORT(int)
 printw(const char *fmt,...)
@@ -49,11 +49,10 @@ printw(const char *fmt,...)
 
 #ifdef TRACE
     va_list argq;
-    begin_va_copy(argq, argp);
     va_start(argq, fmt);
     T((T_CALLED("printw(%s%s)"),
        _nc_visbuf(fmt), _nc_varargs(fmt, argq)));
-    end_va_copy(argq);
+    va_end(argq);
 #endif
 
     va_start(argp, fmt);
@@ -71,11 +70,10 @@ wprintw(WINDOW *win, const char *fmt,...)
 
 #ifdef TRACE
     va_list argq;
-    begin_va_copy(argq, argp);
     va_start(argq, fmt);
     T((T_CALLED("wprintw(%p,%s%s)"),
        (void *) win, _nc_visbuf(fmt), _nc_varargs(fmt, argq)));
-    end_va_copy(argq);
+    va_end(argq);
 #endif
 
     va_start(argp, fmt);
@@ -93,11 +91,10 @@ mvprintw(int y, int x, const char *fmt,...)
 
 #ifdef TRACE
     va_list argq;
-    begin_va_copy(argq, argp);
     va_start(argq, fmt);
     T((T_CALLED("mvprintw(%d,%d,%s%s)"),
        y, x, _nc_visbuf(fmt), _nc_varargs(fmt, argq)));
-    end_va_copy(argq);
+    va_end(argq);
 #endif
 
     if ((code = move(y, x)) != ERR) {
@@ -116,11 +113,10 @@ mvwprintw(WINDOW *win, int y, int x, const char *fmt,...)
 
 #ifdef TRACE
     va_list argq;
-    begin_va_copy(argq, argp);
     va_start(argq, fmt);
     T((T_CALLED("mvwprintw(%d,%d,%p,%s%s)"),
        y, x, (void *) win, _nc_visbuf(fmt), _nc_varargs(fmt, argq)));
-    end_va_copy(argq);
+    va_end(argq);
 #endif
 
     if ((code = wmove(win, y, x)) != ERR) {
index eb0bffb1654a6c0dc0325469d674f197cac63615..51030b6b4f03069c280ccb85bd4aa63301979012 100644 (file)
@@ -48,7 +48,7 @@
 #include <locale.h>
 #endif
 
-MODULE_ID("$Id: lib_setup.c,v 1.148 2012/07/21 18:05:41 tom Exp $")
+MODULE_ID("$Id: lib_setup.c,v 1.149 2012/09/03 16:19:14 tom Exp $")
 
 /****************************************************************************
  *
@@ -546,7 +546,9 @@ NCURSES_EXPORT(int)
 _nc_unicode_locale(void)
 {
     int result = 0;
-#if HAVE_LANGINFO_CODESET
+#if defined(__MINGW32__) && USE_WIDEC_SUPPORT
+    result = 1;
+#elif HAVE_LANGINFO_CODESET
     char *env = nl_langinfo(CODESET);
     result = !strcmp(env, "UTF-8");
     T(("_nc_unicode_locale(%s) ->%d", env, result));
index 9122513ab5b06a26e965daa4bd552e3c541111f5..afc1a16815b7ccb83a4bbb8f4ba3bd0650271ba4 100644 (file)
@@ -38,7 +38,7 @@
 #include <curses.priv.h>
 #define CUR my_term.type.
 
-MODULE_ID("$Id: win_driver.c,v 1.11 2012/02/18 20:28:25 tom Exp $")
+MODULE_ID("$Id: win_driver.c,v 1.13 2012/09/03 16:20:24 tom Exp $")
 
 #define WINMAGIC NCDRV_MAGIC(NCDRV_WINCONSOLE)
 
@@ -102,7 +102,7 @@ MapColor(bool fore, int color)
 }
 
 static WORD
-MapAttr(TERMINAL_CONTROL_BLOCK * TCB, WORD res, chtype ch)
+MapAttr(TERMINAL_CONTROL_BLOCK * TCB, WORD res, attr_t ch)
 {
     if (ch & A_COLOR) {
        int p;
@@ -134,8 +134,67 @@ MapAttr(TERMINAL_CONTROL_BLOCK * TCB, WORD res, chtype ch)
     return res;
 }
 
+#if USE_WIDEC_SUPPORT
+/*
+ * TODO: support surrogate pairs
+ * TODO: support combining characters
+ * TODO: support acsc
+ * TODO: check wcwidth of base character, fill if needed for double-width
+ * TODO: _nc_wacs should be part of sp.
+ */
 static BOOL
-con_write(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, chtype *str, int n)
+con_write16(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, cchar_t *str, int n)
+{
+    CHAR_INFO ci[n];
+    COORD loc, siz;
+    SMALL_RECT rec;
+    int i;
+    cchar_t ch;
+    SCREEN *sp;
+
+    AssertTCB();
+
+    if (TCB == 0 || InvalidConsoleHandle(TCB->hdl))
+       return FALSE;
+
+    SetSP();
+
+    for (i = 0; i < n; i++) {
+       ch = str[i];
+       ci[i].Char.UnicodeChar = CharOf(ch);
+       ci[i].Attributes = MapAttr(TCB,
+                                  PropOf(TCB)->SBI.wAttributes,
+                                  AttrOf(ch));
+       if (AttrOf(ch) & A_ALTCHARSET) {
+           if (_nc_wacs) {
+               int which = CharOf(ch);
+               if (which > 0
+                   && which < ACS_LEN
+                   && CharOf(_nc_wacs[which]) != 0) {
+                   ci[i].Char.UnicodeChar = CharOf(_nc_wacs[which]);
+               } else {
+                   ci[i].Char.UnicodeChar = ' ';
+               }
+           }
+       }
+    }
+
+    loc.X = (short) 0;
+    loc.Y = (short) 0;
+    siz.X = (short) n;
+    siz.Y = 1;
+
+    rec.Left = (short) x;
+    rec.Top = (short) y;
+    rec.Right = (short) (x + n - 1);
+    rec.Bottom = rec.Top;
+
+    return WriteConsoleOutputW(TCB->hdl, ci, siz, loc, &rec);
+}
+#define con_write(tcb, y, x, str, n) con_write16(tcb, y, x, str, n)
+#else
+static BOOL
+con_write8(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, chtype *str, int n)
 {
     CHAR_INFO ci[n];
     COORD loc, siz;
@@ -176,6 +235,8 @@ con_write(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, chtype *str, int n)
 
     return WriteConsoleOutput(TCB->hdl, ci, siz, loc, &rec);
 }
+#define con_write(tcb, y, x, str, n) con_write8(tcb, y, x, str, n)
+#endif
 
 #define MARK_NOCHANGE(win,row) \
                win->_line[row].firstchar = _NOCHANGE; \
@@ -196,16 +257,27 @@ drv_doupdate(TERMINAL_CONTROL_BLOCK * TCB)
 
     if ((CurScreen(sp)->_clear || NewScreen(sp)->_clear)) {
        int x;
+#if USE_WIDEC_SUPPORT
+       cchar_t empty[Width];
+       wchar_t blank[2] =
+       {
+           L' ', L'\0'
+       };
+
+       for (x = 0; x < Width; x++)
+           setcchar(&empty[x], blank, 0, 0, 0);
+#else
        chtype empty[Width];
 
        for (x = 0; x < Width; x++)
            empty[x] = ' ';
+#endif
 
        for (y = 0; y < nonempty; y++) {
            con_write(TCB, y, 0, empty, Width);
            memcpy(empty,
                   CurScreen(sp)->_line[y].text,
-                  Width * sizeof(chtype));
+                  Width * sizeof(empty[0]));
        }
        CurScreen(sp)->_clear = FALSE;
        NewScreen(sp)->_clear = FALSE;
@@ -218,13 +290,13 @@ drv_doupdate(TERMINAL_CONTROL_BLOCK * TCB)
            x1 = NewScreen(sp)->_line[y].lastchar;
            n = x1 - x0 + 1;
            if (n > 0) {
-               memcpy(CurScreen(sp)->_line[y].text + x0,
-                      NewScreen(sp)->_line[y].text + x0,
-                      n * sizeof(chtype));
+               memcpy(&CurScreen(sp)->_line[y].text[x0],
+                      &NewScreen(sp)->_line[y].text[x0],
+                      n * sizeof(CurScreen(sp)->_line[y].text[x0]));
                con_write(TCB,
                          y,
                          x0,
-                         ((chtype *) CurScreen(sp)->_line[y].text) + x0, n);
+                         &CurScreen(sp)->_line[y].text[x0], n);
 
                /* mark line changed successfully */
                if (y <= NewScreen(sp)->_maxy) {
index 726b844fca8f03f1b9860fb8ae6806cb6706c9cd..90f22122dcbf8af85f320f5df2d27363269a1f97 100644 (file)
@@ -1,8 +1,8 @@
-ncurses6 (5.9-20120902) unstable; urgency=low
+ncurses6 (5.9-20120903) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey <dickey@invisible-island.net>  Sun, 02 Sep 2012 12:58:41 -0400
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Mon, 03 Sep 2012 08:47:49 -0400
 
 ncurses6 (5.9-20120608) unstable; urgency=low
 
index 654ffa9937a9398730b64951f797c974de499d97..cb377fee811831938de8c590b7447f971000c937 100644 (file)
@@ -1,7 +1,7 @@
 Summary: shared libraries for terminal handling
 Name: ncurses6
 Release: 5.9
-Version: 20120902
+Version: 20120903
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{release}-%{version}.tgz