Reorganised the Unicode layer somewhat: moved luni_send and
[u/mdw/putty] / unix / uxucs.c
index ff8f3a1..fb0b36a 100644 (file)
  * are ISO8859-1.
  */
 
-void lpage_send(void *ldisc, int codepage, char *buf, int len, int interactive)
-{
-    ldisc_send(ldisc, buf, len, interactive);
-}
-
-void luni_send(void *ldisc, wchar_t * widebuf, int len, int interactive)
-{
-    static char *linebuffer = 0;
-    static int linesize = 0;
-    int ratio = (in_utf(term))?6:1;
-    int i;
-    char *p;
-
-    if (len * ratio > linesize) {
-       sfree(linebuffer);
-       linebuffer = smalloc(len * ratio * 2 * sizeof(wchar_t));
-       linesize = len * ratio * 2;
-    }
-
-    if (in_utf(term)) {
-       /* UTF is a simple algorithm */
-       for (p = linebuffer, i = 0; i < len; i++) {
-           wchar_t ch = widebuf[i];
-
-           if ((ch&0xF800) == 0xD800) ch = '.';
-
-           if (ch < 0x80) {
-               *p++ = (char) (ch);
-           } else if (ch < 0x800) {
-               *p++ = (0xC0 | (ch >> 6));
-               *p++ = (0x80 | (ch & 0x3F));
-           } else if (ch < 0x10000) {
-               *p++ = (0xE0 | (ch >> 12));
-               *p++ = (0x80 | ((ch >> 6) & 0x3F));
-               *p++ = (0x80 | (ch & 0x3F));
-           } else if (ch < 0x200000) {
-               *p++ = (0xF0 | (ch >> 18));
-               *p++ = (0x80 | ((ch >> 12) & 0x3F));
-               *p++ = (0x80 | ((ch >> 6) & 0x3F));
-               *p++ = (0x80 | (ch & 0x3F));
-           } else if (ch < 0x4000000) {
-               *p++ = (0xF8 | (ch >> 24));
-               *p++ = (0x80 | ((ch >> 18) & 0x3F));
-               *p++ = (0x80 | ((ch >> 12) & 0x3F));
-               *p++ = (0x80 | ((ch >> 6) & 0x3F));
-               *p++ = (0x80 | (ch & 0x3F));
-           } else {
-               *p++ = (0xFC | (ch >> 30));
-               *p++ = (0x80 | ((ch >> 24) & 0x3F));
-               *p++ = (0x80 | ((ch >> 18) & 0x3F));
-               *p++ = (0x80 | ((ch >> 12) & 0x3F));
-               *p++ = (0x80 | ((ch >> 6) & 0x3F));
-               *p++ = (0x80 | (ch & 0x3F));
-           }
-       }
-    } else {
-       for (p = linebuffer, i = 0; i < len; i++) {
-           wchar_t ch = widebuf[i];
-           if (ch < 0x100)
-               *p++ = (char) ch;
-           else
-               *p++ = '.';
-       }
-    }
-    if (p > linebuffer)
-       ldisc_send(ldisc, linebuffer, p - linebuffer, interactive);
-}
-
 int is_dbcs_leadbyte(int codepage, char byte)
 {
     return 0;                         /* we don't do DBCS */
@@ -109,7 +41,7 @@ int wc_to_mb(int codepage, int flags, wchar_t *wcstr, int wclen,
            if (defchr)
                *mbstr++ = *defchr;
            else
-               *mbstr++ = '\xBF';
+               *mbstr++ = '.';
            if (defused)
                *defused = 1;
        } else