qemacs-commit
[Top][All Lists]
Advanced

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

[Qemacs-commit] qemacs qe.h qe.c tty.c


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs qe.h qe.c tty.c
Date: Wed, 14 May 2014 17:40:54 +0000

CVSROOT:        /sources/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        14/05/14 17:40:54

Modified files:
        .              : qe.h qe.c tty.c 

Log message:
        improve utf-8 support
        
        * display non BMP code-points as utf-8 if not CONFIG_TINY

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.h?cvsroot=qemacs&r1=1.166&r2=1.167
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.c?cvsroot=qemacs&r1=1.170&r2=1.171
http://cvs.savannah.gnu.org/viewcvs/qemacs/tty.c?cvsroot=qemacs&r1=1.60&r2=1.61

Patches:
Index: qe.h
===================================================================
RCS file: /sources/qemacs/qemacs/qe.h,v
retrieving revision 1.166
retrieving revision 1.167
diff -u -b -r1.166 -r1.167
--- qe.h        1 May 2014 19:32:01 -0000       1.166
+++ qe.h        14 May 2014 17:40:53 -0000      1.167
@@ -1500,6 +1500,12 @@
     short dummy;  /* align, must be assigned for CRC */
 } TextFragment;
 
+#ifdef CONFIG_TINY
+#define MAX_UNICODE_DISPLAY  0xFFFF
+#else
+#define MAX_UNICODE_DISPLAY  0x10FFFF
+#endif
+
 #define MAX_WORD_SIZE 128
 #define NO_CURSOR 0x7fffffff
 

Index: qe.c
===================================================================
RCS file: /sources/qemacs/qemacs/qe.c,v
retrieving revision 1.170
retrieving revision 1.171
diff -u -b -r1.170 -r1.171
--- qe.c        14 May 2014 17:19:44 -0000      1.170
+++ qe.c        14 May 2014 17:40:53 -0000      1.171
@@ -3551,8 +3551,8 @@
             if ((c < ' ' && c != '\t') || c == 127) {
                 display_printf(ds, offset0, offset, "^%c", ('@' + c) & 127);
             } else
-            if (c >= 0x10000) {
-                /* currently, we cannot display these chars */
+            if (c > MAX_UNICODE_DISPLAY) {
+                /* display unsupported unicode code points as hex */
                 display_printf(ds, offset0, offset, "\\U%08x", c);
             } else
             if (c >= 256 && (s->qe_state->show_unicode == 1 || c == 0xfeff)) {

Index: tty.c
===================================================================
RCS file: /sources/qemacs/qemacs/tty.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -b -r1.60 -r1.61
--- tty.c       23 Mar 2014 01:11:34 -0000      1.60
+++ tty.c       14 May 2014 17:40:53 -0000      1.61
@@ -33,6 +33,17 @@
 
 #include "qe.h"
 
+#if MAX_UNICODE_DISPLAY > 0xFFFF
+typedef uint64_t TTYChar;
+#define TTYCHAR(ch,fg,bg)   ((uint32_t)(ch) | ((uint64_t)((fg) | ((bg) << 8)) 
<< 32))
+#define TTYCHAR2(ch,col)    ((uint32_t)(ch) | ((uint64_t)(col) << 32))
+#define TTYCHAR_GETCH(cc)   ((uint32_t)(cc))
+#define TTYCHAR_GETCOL(cc)  ((uint32_t)((cc) >> 32) & 0xFFFF)
+#define TTYCHAR_GETFG(cc)   ((uint32_t)((cc) >> 32) & 0xFF)
+#define TTYCHAR_GETBG(cc)   ((uint32_t)((cc) >> (32 + 8)) & 0xFF)
+#define TTYCHAR_DEFAULT     TTYCHAR(' ', 7, 0)
+#define TTYCHAR_NONE        0xFFFFFFFF
+#else
 typedef unsigned int TTYChar;
 #define TTYCHAR(ch,fg,bg)   ((ch) | ((fg) << 16) | ((bg) << 24))
 #define TTYCHAR2(ch,col)    ((ch) | ((col) << 16))
@@ -41,6 +52,8 @@
 #define TTYCHAR_GETFG(cc)   (((cc) >> 16) & 0xFF)
 #define TTYCHAR_GETBG(cc)   (((cc) >> 24) & 0xFF)
 #define TTYCHAR_DEFAULT     TTYCHAR(' ', 7, 0)
+#define TTYCHAR_NONE        0xFFFF
+#endif
 
 #if defined(CONFIG_UNLOCKIO)
 #  define TTY_PUTC(c,f)         putc_unlocked(c, f)
@@ -1046,7 +1059,7 @@
         ptr++;
         n = w - 1;
         while (n > 0) {
-            *ptr = TTYCHAR(0xFFFFF, fgcolor, TTYCHAR_GETBG(*ptr));
+            *ptr = TTYCHAR(TTYCHAR_NONE, fgcolor, TTYCHAR_GETBG(*ptr));
             ptr++;
             n--;
         }
@@ -1167,7 +1180,7 @@
                 ptr1[shadow] = cc;
                 ptr1++;
                 ch = TTYCHAR_GETCH(cc);
-                if (ch != 0xffff) {
+                if (ch != TTYCHAR_NONE) {
                     /* output attributes */
                   again:
                     if (bgcolor != (int)TTYCHAR_GETBG(cc)) {



reply via email to

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