Line discipline module now uses dynamically allocated data. Also
[u/mdw/putty] / unicode.c
index f8cd3b5..19a2e1d 100644 (file)
--- a/unicode.c
+++ b/unicode.c
@@ -8,6 +8,7 @@
 
 #include <time.h>
 #include "putty.h"
+#include "terminal.h"
 #include "misc.h"
 
 /* Character conversion arrays; they are usually taken from windows,
@@ -597,14 +598,14 @@ static void link_font(WCHAR * line_tbl, WCHAR * font_tbl, WCHAR attr)
     }
 }
 
-void lpage_send(int codepage, char *buf, int len, int interactive)
+void lpage_send(void *ldisc, int codepage, char *buf, int len, int interactive)
 {
     static wchar_t *widebuffer = 0;
     static int widesize = 0;
     int wclen;
 
     if (codepage < 0) {
-       ldisc_send(buf, len, interactive);
+       ldisc_send(ldisc, buf, len, interactive);
        return;
     }
 
@@ -615,14 +616,14 @@ void lpage_send(int codepage, char *buf, int len, int interactive)
     }
 
     wclen = mb_to_wc(codepage, 0, buf, len, widebuffer, widesize);
-    luni_send(widebuffer, wclen, interactive);
+    luni_send(ldisc, widebuffer, wclen, interactive);
 }
 
-void luni_send(wchar_t * widebuf, int len, int 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)?3:1;
+    int ratio = (in_utf(term))?3:1;
     int i;
     char *p;
 
@@ -632,7 +633,7 @@ void luni_send(wchar_t * widebuf, int len, int interactive)
        linesize = len * ratio * 2;
     }
 
-    if (in_utf) {
+    if (in_utf(term)) {
        /* UTF is a simple algorithm */
        for (p = linebuffer, i = 0; i < len; i++) {
            wchar_t ch = widebuf[i];
@@ -676,7 +677,7 @@ void luni_send(wchar_t * widebuf, int len, int interactive)
        }
     }
     if (p > linebuffer)
-       ldisc_send(linebuffer, p - linebuffer, interactive);
+       ldisc_send(ldisc, linebuffer, p - linebuffer, interactive);
 }
 
 wchar_t xlat_uskbd2cyrllic(int ch)