SOURCES: twin-utf8.patch (NEW) - UTF-8 support

witekfl witekfl at pld-linux.org
Wed Oct 3 15:02:09 CEST 2007


Author: witekfl                      Date: Wed Oct  3 13:02:09 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- UTF-8 support

---- Files affected:
SOURCES:
   twin-utf8.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/twin-utf8.patch
diff -u /dev/null SOURCES/twin-utf8.patch:1.1
--- /dev/null	Wed Oct  3 15:02:09 2007
+++ SOURCES/twin-utf8.patch	Wed Oct  3 15:02:04 2007
@@ -0,0 +1,145 @@
+--- twin-0.5.1/server/HW/hw_tty.c.old	2007-10-03 11:11:00.000000000 +0200
++++ twin-0.5.1/server/HW/hw_tty.c	2007-10-03 14:12:44.000000000 +0200
+@@ -476,6 +476,10 @@
+ 	tty_UTF_16_to_charset = Tutf_UTF_16_to_charset_function(tty_charset);
+ 	tty_charset_to_UTF_16 = Tutf_charset_to_UTF_16_array(tty_charset);
+     }
++    if (tty_charset_to_UTF_16 == Tutf_UTF_8_to_UTF_16) {
++    	tty_can_utf8 = TRUE;
++    	utf8used = TRUE;
++    }
+ #else
+     if (charset) {
+ 	FreeMem(charset);
+--- twin-0.5.1/server/tty.c.old	2003-05-31 09:52:10.000000000 +0200
++++ twin-0.5.1/server/tty.c	2007-10-03 14:13:25.000000000 +0200
+@@ -1493,7 +1493,7 @@
+ 	return;
+     
+     common(Window);
+-    
++
+     while (!(*Flags & TTY_STOPPED) && Len) {
+ 	c = *AsciiSeq++;
+ 	Len--;
+--- twin-0.5.1/server/methods.c.old	2007-10-03 14:05:31.000000000 +0200
++++ twin-0.5.1/server/methods.c	2007-10-03 14:21:59.000000000 +0200
+@@ -25,6 +25,9 @@
+ #include "hw.h"
+ #include "hw_multi.h"
+ 
++#include <langinfo.h>
++#include <strings.h>
++
+ #include <Tw/Tw.h>
+ #include <Tw/Twstat.h>
+ #include <Tw/Twstat_defs.h>
+@@ -931,7 +934,8 @@
+ #endif	
+     Data->G1 = Data->saveG1 = GRAF_MAP;
+ 
+-    Data->utf = Data->utf_count = Data->utf_char = 0;
++    Data->utf_count = Data->utf_char = 0;
++    Data->utf = !strcasecmp(nl_langinfo(CODESET), "UTF-8");
+ #ifdef CONF__UNICODE
+     Data->InvCharset = Tutf_UTF_16_to_ISO_8859_1;
+ #endif
+--- twin-0.5.1/server/main.c.old	2007-10-03 14:30:24.000000000 +0200
++++ twin-0.5.1/server/main.c	2007-10-03 14:33:01.000000000 +0200
+@@ -16,6 +16,7 @@
+  *
+  */
+ 
++#include <locale.h>
+ #include <signal.h>
+ 
+ #include "twin.h"
+@@ -288,7 +289,8 @@
+     fd_set read_fds, write_fds, *pwrite_fds;
+     struct timeval sel_timeout, *this_timeout;
+     int num_fds;
+-    
++
++    setlocale(LC_ALL, "");    
+     DropPrivileges();
+ 
+     main_argv_usable_len = ComputeUsableLenArgv(main_argv = (byte **)argv);
+--- twin-0.5.1/libs/libTutf/libTutf.c.old	2007-10-03 10:56:31.000000000 +0200
++++ twin-0.5.1/libs/libTutf/libTutf.c	2007-10-03 12:41:36.000000000 +0200
+@@ -205,6 +205,7 @@
+ #include "template.c"
+ #undef TEMPLATE
+ 
++#include "utf_8.c"
+ 
+ #define _NLIST(EL) \
+ 	EL(T_MAP(ASCII)) \
+@@ -224,9 +225,11 @@
+ 	EL(T_MAP(UTF_16)) _NLIST(EL)
+ 
+ typedef enum {
++    	
+ #define DECL_TYPE(x) T_CAT(T_ID_,x) ,
+     _LIST(DECL_TYPE)
+ #undef DECL_TYPE
++    T_ID_UTF_8,
+ } id_e;
+ 
+ #define DECL_NAME(ch) static byte *T_CAT(names_,ch) [] = { T_CAT(T_NAME_,ch), T_CAT(T_ALIASES_,ch), NULL };
+@@ -244,6 +247,7 @@
+ static Tutf_struct Tutf_structs[] = {
+     { T_CAT(names_,UTF_16), NULL, NULL },
+     _NLIST(DECL_CH)
++    { names_UTF_8, Tutf_UTF_8_to_UTF_16, Tutf_UTF_16_to_UTF_8 },
+     { NULL }
+ };
+ 
+--- /dev/null	2007-10-03 09:29:12.396354042 +0200
++++ twin-0.5.1/libs/libTutf/utf_8.c	2007-10-03 14:48:36.000000000 +0200
+@@ -0,0 +1,26 @@
++byte *names_UTF_8[] = { "UTF-8", "UTF8", NULL };
++
++/* fake */
++hwfont Tutf_UTF_8_to_UTF_16[0x100] = {
++ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
++ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
++ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
++ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
++ 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
++ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
++ 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
++ 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
++ 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
++ 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
++ 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
++ 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
++ 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
++ 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
++ 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
++ 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
++};
++
++hwfont Tutf_UTF_16_to_UTF_8(hwfont c)
++{
++    return c;
++}
+--- twin-0.5.1/include/Tutf/Tutf.h.old	2007-10-03 10:40:14.000000000 +0200
++++ twin-0.5.1/include/Tutf/Tutf.h	2007-10-03 10:42:38.000000000 +0200
+@@ -423,6 +423,8 @@
+ hwfont Tutf_UTF_16_to_ISO_8859_15(hwfont c);
+ hwfont Tutf_UTF_16_to_ISO_8859_16(hwfont c);
+ 
++hwfont Tutf_UTF_16_to_UTF_8(hwfont c);
++
+ hwfont Tutf_UTF_16_to_CP437(hwfont c);
+ hwfont Tutf_UTF_16_to_CP737(hwfont c);
+ hwfont Tutf_UTF_16_to_CP775(hwfont c);
+@@ -469,6 +471,8 @@
+ extern hwfont Tutf_ISO_8859_15_to_UTF_16[0x100];
+ extern hwfont Tutf_ISO_8859_16_to_UTF_16[0x100];
+ 
++extern hwfont Tutf_UTF_8_to_UTF_16[0x100];
++
+ extern hwfont Tutf_CP437_to_UTF_16[0x100];
+ extern hwfont Tutf_CP737_to_UTF_16[0x100];
+ extern hwfont Tutf_CP775_to_UTF_16[0x100];
================================================================


More information about the pld-cvs-commit mailing list