X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/2f9549c73d9193efb2db3719bfb8baeb7eb953b1..875e0b16f64f7b97171d58fe34ebcd57314eb739:/mac/macucs.c diff --git a/mac/macucs.c b/mac/macucs.c index 981bc40b..0601b9c8 100644 --- a/mac/macucs.c +++ b/mac/macucs.c @@ -1,4 +1,4 @@ -/* $Id: macucs.c,v 1.3 2003/01/02 23:39:53 ben Exp $ */ +/* $Id: macucs.c,v 1.6 2003/03/17 21:40:37 ben Exp $ */ #include #include @@ -54,7 +54,8 @@ int mb_to_wc(int codepage, int flags, char *mbstr, int mblen, * to convert Unicode into the line character set. */ int wc_to_mb(int codepage, int flags, wchar_t *wcstr, int wclen, - char *mbstr, int mblen, char *defchr, int *defused) + char *mbstr, int mblen, char *defchr, int *defused, + struct unicode_data *ucsdata) { int ret = 0; if (defused) @@ -75,18 +76,55 @@ int wc_to_mb(int codepage, int flags, wchar_t *wcstr, int wclen, return ret; /* FIXME: check error codes! */ } -void init_ucs(void) +/* Character conversion array, + * the xterm one has the four scanlines that have no unicode 2.0 + * equivalents mapped to their unicode 3.0 locations. + */ +static const wchar_t unitab_xterm_std[32] = { + 0x2666, 0x2592, 0x2409, 0x240c, 0x240d, 0x240a, 0x00b0, 0x00b1, + 0x2424, 0x240b, 0x2518, 0x2510, 0x250c, 0x2514, 0x253c, 0x23ba, + 0x23bb, 0x2500, 0x23bc, 0x23bd, 0x251c, 0x2524, 0x2534, 0x252c, + 0x2502, 0x2264, 0x2265, 0x03c0, 0x2260, 0x00a3, 0x00b7, 0x0020 +}; + +void init_ucs(Session *s) { int i; + /* Find the line control characters. FIXME: this is not right. */ for (i = 0; i < 256; i++) if (i < ' ' || (i >= 0x7F && i < 0xA0)) - unitab_ctrl[i] = i; + s->ucsdata.unitab_ctrl[i] = i; else - unitab_ctrl[i] = 0xFF; + s->ucsdata.unitab_ctrl[i] = 0xFF; - for (i = 0; i < 256; i++) { - unitab_line[i] = unitab_scoacs[i] = i; - unitab_xterm[i] = (i >= 0x5F && i < 0x7F) ? ((i+1) & 0x1F) : i; - } + for (i = 0; i < 256; i++) + s->ucsdata.unitab_line[i] = s->ucsdata.unitab_scoacs[i] = i; + + /* VT100 graphics - NB: Broken for non-ascii CP's */ + memcpy(s->ucsdata.unitab_xterm, s->ucsdata.unitab_line, + sizeof(s->ucsdata.unitab_xterm)); + memcpy(s->ucsdata.unitab_xterm + '`', unitab_xterm_std, + sizeof(unitab_xterm_std)); + s->ucsdata.unitab_xterm['_'] = ' '; + +} + +int decode_codepage(char *cp_name) +{ + + return 0; +} + +char *cp_enumerate (int index) +{ + + if (index == 0) return "ISO/IEC 8859-1"; + return NULL; +} + +char *cp_name(int codepage) +{ + + return "ISO/IEC 8859-1"; }