projects
/
u
/
mdw
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
The WinSock library is now loaded at run-time, which means we can
[u/mdw/putty]
/
unicode.c
diff --git
a/unicode.c
b/unicode.c
index
fdfa08d
..
1d5e66f
100644
(file)
--- a/
unicode.c
+++ b/
unicode.c
@@
-1,7
+1,3
@@
-#ifdef WINDOWS
-#include <windows.h>
-#endif
-
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
@@
-516,12
+512,12
@@
void init_ucs(Config *cfg, struct unicode_data *ucsdata)
if (DIRECT_FONT(ucsdata->unitab_line[i]))
continue;
if (!ucsdata->uni_tbl) {
if (DIRECT_FONT(ucsdata->unitab_line[i]))
continue;
if (!ucsdata->uni_tbl) {
- ucsdata->uni_tbl = s
malloc(256 * sizeof(char *)
);
+ ucsdata->uni_tbl = s
newn(256, char *
);
memset(ucsdata->uni_tbl, 0, 256 * sizeof(char *));
}
j = ((ucsdata->unitab_line[i] >> 8) & 0xFF);
if (!ucsdata->uni_tbl[j]) {
memset(ucsdata->uni_tbl, 0, 256 * sizeof(char *));
}
j = ((ucsdata->unitab_line[i] >> 8) & 0xFF);
if (!ucsdata->uni_tbl[j]) {
- ucsdata->uni_tbl[j] = s
malloc(256 * sizeof(char)
);
+ ucsdata->uni_tbl[j] = s
newn(256, char
);
memset(ucsdata->uni_tbl[j], 0, 256 * sizeof(char));
}
ucsdata->uni_tbl[j][ucsdata->unitab_line[i] & 0xFF] = i;
memset(ucsdata->uni_tbl[j], 0, 256 * sizeof(char));
}
ucsdata->uni_tbl[j][ucsdata->unitab_line[i] & 0xFF] = i;
@@
-560,11
+556,11
@@
void init_ucs(Config *cfg, struct unicode_data *ucsdata)
/* Last chance, if !unicode then try poorman links. */
if (cfg->vtmode != VT_UNICODE) {
/* Last chance, if !unicode then try poorman links. */
if (cfg->vtmode != VT_UNICODE) {
- static char poorman_scoacs[] =
+ static c
onst c
har poorman_scoacs[] =
"CueaaaaceeeiiiAAE**ooouuyOUc$YPsaiounNao?++**!<>###||||++||++++++--|-+||++--|-+----++++++++##||#aBTPEsyt******EN=+><++-=... n2* ";
"CueaaaaceeeiiiAAE**ooouuyOUc$YPsaiounNao?++**!<>###||||++||++++++--|-+||++--|-+----++++++++##||#aBTPEsyt******EN=+><++-=... n2* ";
- static char poorman_latin1[] =
+ static c
onst c
har poorman_latin1[] =
" !cL.Y|S\"Ca<--R~o+23'u|.,1o>///?AAAAAAACEEEEIIIIDNOOOOOxOUUUUYPBaaaaaaaceeeeiiiionooooo/ouuuuypy";
" !cL.Y|S\"Ca<--R~o+23'u|.,1o>///?AAAAAAACEEEEIIIIDNOOOOOxOUUUUYPBaaaaaaaceeeeiiiionooooo/ouuuuypy";
- static char poorman_vt100[] = "*#****o~**+++++-----++++|****L.";
+ static c
onst c
har poorman_vt100[] = "*#****o~**+++++-----++++|****L.";
for (i = 160; i < 256; i++)
if (!DIRECT_FONT(ucsdata->unitab_line[i]) &&
for (i = 160; i < 256; i++)
if (!DIRECT_FONT(ucsdata->unitab_line[i]) &&
@@
-603,7
+599,7
@@
static void link_font(WCHAR * line_tbl, WCHAR * font_tbl, WCHAR attr)
wchar_t xlat_uskbd2cyrllic(int ch)
{
wchar_t xlat_uskbd2cyrllic(int ch)
{
- static wchar_t cyrtab[] = {
+ static
const
wchar_t cyrtab[] = {
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23,
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23,
@@
-624,10
+620,10
@@
wchar_t xlat_uskbd2cyrllic(int ch)
return cyrtab[ch&0x7F];
}
return cyrtab[ch&0x7F];
}
-int check_compose
(int first, int second
)
+int check_compose
_internal(int first, int second, int recurse
)
{
{
- static struct {
+ static
const
struct {
char first, second;
wchar_t composed;
} composetbl[] = {
char first, second;
wchar_t composed;
} composetbl[] = {
@@
-961,7
+957,6
@@
int check_compose(int first, int second)
0, 0, 0}
}, *c;
0, 0, 0}
}, *c;
- static int recurse = 0;
int nc = -1;
for (c = composetbl; c->first; c++) {
int nc = -1;
for (c = composetbl; c->first; c++) {
@@
-970,17
+965,20
@@
int check_compose(int first, int second)
}
if (recurse == 0) {
}
if (recurse == 0) {
- recurse = 1;
- nc = check_compose(second, first);
+ nc = check_compose_internal(second, first, 1);
if (nc == -1)
if (nc == -1)
- nc = check_compose
(toupper(first), toupper(second)
);
+ nc = check_compose
_internal(toupper(first), toupper(second), 1
);
if (nc == -1)
if (nc == -1)
- nc = check_compose(toupper(second), toupper(first));
- recurse = 0;
+ nc = check_compose_internal(toupper(second), toupper(first), 1);
}
return nc;
}
}
return nc;
}
+int check_compose(int first, int second)
+{
+ return check_compose_internal(first, second, 0);
+}
+
int decode_codepage(char *cp_name)
{
char *s, *d;
int decode_codepage(char *cp_name)
{
char *s, *d;
@@
-1013,7
+1011,7
@@
int decode_codepage(char *cp_name)
* 1254 -> ISO 8859-9
* 1255 -> ISO 8859-8
* 1256 -> ISO 8859-6
* 1254 -> ISO 8859-9
* 1255 -> ISO 8859-8
* 1256 -> ISO 8859-6
- * 1257 -> ISO 8859-
4
+ * 1257 -> ISO 8859-
13 (changed from 8859-4 on advice of a Lithuanian)
*
* and for anything else, choose direct-to-font.
*/
*
* and for anything else, choose direct-to-font.
*/
@@
-1026,7
+1024,7
@@
int decode_codepage(char *cp_name)
case 1254: cp_name = "ISO-8859-9"; break;
case 1255: cp_name = "ISO-8859-8"; break;
case 1256: cp_name = "ISO-8859-6"; break;
case 1254: cp_name = "ISO-8859-9"; break;
case 1255: cp_name = "ISO-8859-8"; break;
case 1256: cp_name = "ISO-8859-6"; break;
- case 1257: cp_name = "ISO-8859-
4
"; break;
+ case 1257: cp_name = "ISO-8859-
13
"; break;
/* default: leave it blank, which will select -1, direct->font */
}
}
/* default: leave it blank, which will select -1, direct->font */
}
}
@@
-1092,7
+1090,7
@@
int decode_codepage(char *cp_name)
return codepage;
}
return codepage;
}
-char *cp_name(int codepage)
+c
onst c
har *cp_name(int codepage)
{
const struct cp_list_item *cpi, *cpno;
static char buf[32];
{
const struct cp_list_item *cpi, *cpno;
static char buf[32];
@@
-1132,7
+1130,7
@@
char *cp_name(int codepage)
* Return the nth code page in the list, for use in the GUI
* configurer.
*/
* Return the nth code page in the list, for use in the GUI
* configurer.
*/
-char *cp_enumerate(int index)
+c
onst c
har *cp_enumerate(int index)
{
if (index < 0 || index >= lenof(cp_list))
return NULL;
{
if (index < 0 || index >= lenof(cp_list))
return NULL;