Update for Unicode deglobalisations.

[originally from svn r2600]
This commit is contained in:
Ben Harris 2003-01-14 19:42:00 +00:00
Родитель 94fdeb2317
Коммит 1d92c2b783
4 изменённых файлов: 17 добавлений и 12 удалений

Просмотреть файл

@ -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
* All rights reserved.
@ -215,7 +215,6 @@ static void mac_startup(void) {
LMSetCurDirStore(dirid);
}
}
init_ucs();
}
static void mac_eventloop(void) {

Просмотреть файл

@ -53,6 +53,8 @@ typedef struct Session {
char *realhost;
/* Logging */
void *logctx;
/* Unicode stuff */
struct unicode_data ucsdata;
/* Mac-specific elements */
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 void *open_settings_r_fsp(FSSpec *);
/* from macucs.c */
extern void init_ucs(void);
extern void init_ucs(Session *);
/* from mtcpnet.c */
extern OSErr mactcp_init(void);
extern void mactcp_cleanup(void);

Просмотреть файл

@ -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, 2002 Ben Harris
@ -152,6 +152,7 @@ void mac_startsession(Session *s)
{
char *errmsg;
init_ucs(s);
/* XXX: Own storage management? */
if (HAVE_COLOR_QD())
s->window = GetNewCWindow(wTerminal, NULL, (WindowPtr)-1);
@ -159,7 +160,7 @@ void mac_startsession(Session *s)
s->window = GetNewWindow(wTerminal, NULL, (WindowPtr)-1);
SetWRefCon(s->window, (long)s);
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_initpalette(s);

Просмотреть файл

@ -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 <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.
*/
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,20 @@ int wc_to_mb(int codepage, int flags, wchar_t *wcstr, int wclen,
return ret; /* FIXME: check error codes! */
}
void init_ucs(void)
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;
s->ucsdata.unitab_line[i] = s->ucsdata.unitab_scoacs[i] = i;
s->ucsdata.unitab_xterm[i] =
(i >= 0x5F && i < 0x7F) ? ((i+1) & 0x1F) : i;
}
}