1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 09:58:01 +00:00

Update for Unicode deglobalisations.

[originally from svn r2600]
This commit is contained in:
Ben Harris 2003-01-14 19:42:00 +00:00
parent 94fdeb2317
commit 1d92c2b783
4 changed files with 17 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $Id: mac.c,v 1.28 2003/01/14 19:09:24 ben Exp $ */ /* $Id: mac.c,v 1.29 2003/01/14 19:42:00 ben Exp $ */
/* /*
* Copyright (c) 1999 Ben Harris * Copyright (c) 1999 Ben Harris
* All rights reserved. * All rights reserved.
@ -215,7 +215,6 @@ static void mac_startup(void) {
LMSetCurDirStore(dirid); LMSetCurDirStore(dirid);
} }
} }
init_ucs();
} }
static void mac_eventloop(void) { static void mac_eventloop(void) {

View File

@ -53,6 +53,8 @@ typedef struct Session {
char *realhost; char *realhost;
/* Logging */ /* Logging */
void *logctx; void *logctx;
/* Unicode stuff */
struct unicode_data ucsdata;
/* Mac-specific elements */ /* Mac-specific elements */
short fontnum; short fontnum;
@ -98,7 +100,7 @@ extern OSErr get_putty_dir(Boolean makeit, short *pVRefNum, long *pDirID);
extern OSErr get_session_dir(Boolean makeit, short *pVRefNum, long *pDirID); extern OSErr get_session_dir(Boolean makeit, short *pVRefNum, long *pDirID);
extern void *open_settings_r_fsp(FSSpec *); extern void *open_settings_r_fsp(FSSpec *);
/* from macucs.c */ /* from macucs.c */
extern void init_ucs(void); extern void init_ucs(Session *);
/* from mtcpnet.c */ /* from mtcpnet.c */
extern OSErr mactcp_init(void); extern OSErr mactcp_init(void);
extern void mactcp_cleanup(void); extern void mactcp_cleanup(void);

View File

@ -1,4 +1,4 @@
/* $Id: macterm.c,v 1.48 2003/01/14 18:44:34 ben Exp $ */ /* $Id: macterm.c,v 1.49 2003/01/14 19:42:00 ben Exp $ */
/* /*
* Copyright (c) 1999 Simon Tatham * Copyright (c) 1999 Simon Tatham
* Copyright (c) 1999, 2002 Ben Harris * Copyright (c) 1999, 2002 Ben Harris
@ -152,6 +152,7 @@ void mac_startsession(Session *s)
{ {
char *errmsg; char *errmsg;
init_ucs(s);
/* XXX: Own storage management? */ /* XXX: Own storage management? */
if (HAVE_COLOR_QD()) if (HAVE_COLOR_QD())
s->window = GetNewCWindow(wTerminal, NULL, (WindowPtr)-1); s->window = GetNewCWindow(wTerminal, NULL, (WindowPtr)-1);
@ -159,7 +160,7 @@ void mac_startsession(Session *s)
s->window = GetNewWindow(wTerminal, NULL, (WindowPtr)-1); s->window = GetNewWindow(wTerminal, NULL, (WindowPtr)-1);
SetWRefCon(s->window, (long)s); SetWRefCon(s->window, (long)s);
s->scrollbar = GetNewControl(cVScroll, s->window); s->scrollbar = GetNewControl(cVScroll, s->window);
s->term = term_init(&s->cfg, s); s->term = term_init(&s->cfg, &s->ucsdata, s);
mac_initfont(s); mac_initfont(s);
mac_initpalette(s); mac_initpalette(s);

View File

@ -1,4 +1,4 @@
/* $Id: macucs.c,v 1.3 2003/01/02 23:39:53 ben Exp $ */ /* $Id: macucs.c,v 1.4 2003/01/14 19:42:00 ben Exp $ */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -54,7 +54,8 @@ int mb_to_wc(int codepage, int flags, char *mbstr, int mblen,
* to convert Unicode into the line character set. * to convert Unicode into the line character set.
*/ */
int wc_to_mb(int codepage, int flags, wchar_t *wcstr, int wclen, 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; int ret = 0;
if (defused) if (defused)
@ -75,18 +76,20 @@ int wc_to_mb(int codepage, int flags, wchar_t *wcstr, int wclen,
return ret; /* FIXME: check error codes! */ return ret; /* FIXME: check error codes! */
} }
void init_ucs(void) void init_ucs(Session *s)
{ {
int i; int i;
/* Find the line control characters. FIXME: this is not right. */ /* Find the line control characters. FIXME: this is not right. */
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
if (i < ' ' || (i >= 0x7F && i < 0xA0)) if (i < ' ' || (i >= 0x7F && i < 0xA0))
unitab_ctrl[i] = i; s->ucsdata.unitab_ctrl[i] = i;
else else
unitab_ctrl[i] = 0xFF; s->ucsdata.unitab_ctrl[i] = 0xFF;
for (i = 0; i < 256; i++) { for (i = 0; i < 256; i++) {
unitab_line[i] = unitab_scoacs[i] = i; s->ucsdata.unitab_line[i] = s->ucsdata.unitab_scoacs[i] = i;
unitab_xterm[i] = (i >= 0x5F && i < 0x7F) ? ((i+1) & 0x1F) : i; s->ucsdata.unitab_xterm[i] =
(i >= 0x5F && i < 0x7F) ? ((i+1) & 0x1F) : i;
} }
} }