encoding.c (screen-4.8.0) | : | encoding.c (screen-4.9.0) | ||
---|---|---|---|---|
skipping to change at line 46 | skipping to change at line 46 | |||
extern char *screenencodings; | extern char *screenencodings; | |||
#ifdef DW_CHARS | #ifdef DW_CHARS | |||
extern int cjkwidth; | extern int cjkwidth; | |||
#endif | #endif | |||
static int encmatch __P((char *, char *)); | static int encmatch __P((char *, char *)); | |||
# ifdef UTF8 | # ifdef UTF8 | |||
static int recode_char __P((int, int, int)); | static int recode_char __P((int, int, int)); | |||
static int recode_char_to_encoding __P((int, int)); | static int recode_char_to_encoding __P((int, int)); | |||
static void comb_tofront __P((int, int)); | static void comb_tofront __P((int)); | |||
# ifdef DW_CHARS | # ifdef DW_CHARS | |||
static int recode_char_dw __P((int, int *, int, int)); | static int recode_char_dw __P((int, int *, int, int)); | |||
static int recode_char_dw_to_encoding __P((int, int *, int)); | static int recode_char_dw_to_encoding __P((int, int *, int)); | |||
# endif | # endif | |||
# endif | # endif | |||
struct encoding { | struct encoding { | |||
char *name; | char *name; | |||
char *charsets; | char *charsets; | |||
int deffont; | int deffont; | |||
skipping to change at line 1263 | skipping to change at line 1263 | |||
{0x1F9AE, 0x1F9CA}, | {0x1F9AE, 0x1F9CA}, | |||
{0x1F9CD, 0x1F9FF}, | {0x1F9CD, 0x1F9FF}, | |||
{0x1FA70, 0x1FA73}, | {0x1FA70, 0x1FA73}, | |||
{0x1FA78, 0x1FA7A}, | {0x1FA78, 0x1FA7A}, | |||
{0x1FA80, 0x1FA82}, | {0x1FA80, 0x1FA82}, | |||
{0x1FA90, 0x1FA95}, | {0x1FA90, 0x1FA95}, | |||
{0x20000, 0x2FFFD}, | {0x20000, 0x2FFFD}, | |||
{0x30000, 0x3FFFD}, | {0x30000, 0x3FFFD}, | |||
}; | }; | |||
if (c >= 0xdf00 && c <= 0xdfff) | ||||
return 1; /* dw combining sequence */ | ||||
return ((bisearch(c, wide, sizeof(wide) / sizeof(struct interval) - 1)) || | return ((bisearch(c, wide, sizeof(wide) / sizeof(struct interval) - 1)) || | |||
(cjkwidth && | (cjkwidth && | |||
bisearch(c, ambiguous, | bisearch(c, ambiguous, | |||
sizeof(ambiguous) / sizeof(struct interval) - 1))); | sizeof(ambiguous) / sizeof(struct interval) - 1))); | |||
} | } | |||
#endif | #endif | |||
int | int | |||
utf8_iscomb(c) | utf8_iscomb(c) | |||
int c; | int c; | |||
skipping to change at line 1330 | skipping to change at line 1332 | |||
{ 0x10A38, 0x10A3A }, { 0x10A3F, 0x10A3F }, { 0x1D167, 0x1D169 }, | { 0x10A38, 0x10A3A }, { 0x10A3F, 0x10A3F }, { 0x1D167, 0x1D169 }, | |||
{ 0x1D173, 0x1D182 }, { 0x1D185, 0x1D18B }, { 0x1D1AA, 0x1D1AD }, | { 0x1D173, 0x1D182 }, { 0x1D185, 0x1D18B }, { 0x1D1AA, 0x1D1AD }, | |||
{ 0x1D242, 0x1D244 }, { 0xE0001, 0xE0001 }, { 0xE0020, 0xE007F }, | { 0x1D242, 0x1D244 }, { 0xE0001, 0xE0001 }, { 0xE0020, 0xE007F }, | |||
{ 0xE0100, 0xE01EF } | { 0xE0100, 0xE01EF } | |||
}; | }; | |||
return bisearch(c, combining, sizeof(combining) / sizeof(struct interval) - 1) ; | return bisearch(c, combining, sizeof(combining) / sizeof(struct interval) - 1) ; | |||
} | } | |||
static void | static void | |||
comb_tofront(root, i) | comb_tofront(i) | |||
int root, i; | int i; | |||
{ | { | |||
for (;;) | for (;;) | |||
{ | { | |||
int root = i >= 0x700 ? 0x801 : 0x800; | ||||
debug1("bring to front: %x\n", i); | debug1("bring to front: %x\n", i); | |||
combchars[combchars[i]->prev]->next = combchars[i]->next; | combchars[combchars[i]->prev]->next = combchars[i]->next; | |||
combchars[combchars[i]->next]->prev = combchars[i]->prev; | combchars[combchars[i]->next]->prev = combchars[i]->prev; | |||
combchars[i]->next = combchars[root]->next; | combchars[i]->next = combchars[root]->next; | |||
combchars[i]->prev = root; | combchars[i]->prev = root; | |||
combchars[combchars[root]->next]->prev = i; | combchars[combchars[root]->next]->prev = i; | |||
combchars[root]->next = i; | combchars[root]->next = i; | |||
i = combchars[i]->c1; | i = combchars[i]->c1; | |||
if (i < 0xd800 || i >= 0xe000) | if (i < 0xd800 || i >= 0xe000) | |||
return; | return; | |||
skipping to change at line 1396 | skipping to change at line 1399 | |||
{ | { | |||
if (!combchars[i]) | if (!combchars[i]) | |||
break; | break; | |||
if (combchars[i]->c1 == c1 && combchars[i]->c2 == c) | if (combchars[i]->c1 == c1 && combchars[i]->c2 == c) | |||
break; | break; | |||
} | } | |||
if (i == combchars[root]->c2) | if (i == combchars[root]->c2) | |||
{ | { | |||
/* full, recycle old entry */ | /* full, recycle old entry */ | |||
if (c1 >= 0xd800 && c1 < 0xe000) | if (c1 >= 0xd800 && c1 < 0xe000) | |||
comb_tofront(root, c1 - 0xd800); | comb_tofront(c1 - 0xd800); | |||
i = combchars[root]->prev; | i = combchars[root]->prev; | |||
if (c1 == i + 0xd800) | if (i == 0x800 || i == 0x801 || c1 == i + 0xd800) | |||
{ | { | |||
/* completely full, can't recycle */ | /* completely full, can't recycle */ | |||
debug("utf8_handle_comp: completely full!\n"); | debug("utf8_handle_comp: completely full!\n"); | |||
mc->image = '?'; | mc->image = '?'; | |||
mc->font = 0; | mc->font = 0; | |||
return; | return; | |||
} | } | |||
/* FIXME: delete old char from all buffers */ | /* FIXME: delete old char from all buffers */ | |||
} | } | |||
else if (!combchars[i]) | else if (!combchars[i]) | |||
skipping to change at line 1422 | skipping to change at line 1425 | |||
return; | return; | |||
combchars[i]->prev = i; | combchars[i]->prev = i; | |||
combchars[i]->next = i; | combchars[i]->next = i; | |||
} | } | |||
combchars[i]->c1 = c1; | combchars[i]->c1 = c1; | |||
combchars[i]->c2 = c; | combchars[i]->c2 = c; | |||
mc->image = i & 0xff; | mc->image = i & 0xff; | |||
mc->font = (i >> 8) + 0xd8; | mc->font = (i >> 8) + 0xd8; | |||
mc->fontx = 0; | mc->fontx = 0; | |||
debug3("combinig char %x %x -> %x\n", c1, c, i + 0xd800); | debug3("combinig char %x %x -> %x\n", c1, c, i + 0xd800); | |||
comb_tofront(root, i); | comb_tofront(i); | |||
} | } | |||
#else /* !UTF8 */ | #else /* !UTF8 */ | |||
void | void | |||
WinSwitchEncoding(p, encoding) | WinSwitchEncoding(p, encoding) | |||
struct win *p; | struct win *p; | |||
int encoding; | int encoding; | |||
{ | { | |||
p->w_encoding = encoding; | p->w_encoding = encoding; | |||
End of changes. 7 change blocks. | ||||
6 lines changed or deleted | 9 lines changed or added |