Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 80401
Collapse All | Expand All

(-)links-2.1pre17-orig/charsets.c (-1 / +17 lines)
Lines 92-98 Link Here
92
#define U_EQUAL(a, b) (a).x == (b)
92
#define U_EQUAL(a, b) (a).x == (b)
93
#define U_ABOVE(a, b) (a).x > (b)
93
#define U_ABOVE(a, b) (a).x > (b)
94
94
95
static inline unsigned char *u2cp(int u, int to)
95
unsigned char *u2cp(int u, int to)
96
{
96
{
97
	int j, s;
97
	int j, s;
98
	if (u < 128) return strings[u];
98
	if (u < 128) return strings[u];
Lines 152-157 Link Here
152
	return utf_buffer;
152
	return utf_buffer;
153
}
153
}
154
154
155
/* this slow and ugly code is used by the terminal utf_8_io */
156
unsigned char *cp2utf_8(int from, int c)
157
{
158
	int j;
159
160
	if (codepages[from].table == table_utf_8) return strings[c];
161
	for (j = 0; codepages[from].table[j].c; j++) {
162
		if (codepages[from].table[j].c == c)
163
		{
164
			return encode_utf_8(codepages[from].table[j].u);
165
		}
166
	}
167
	if (c < 128) return strings[c];
168
	return encode_utf_8(UCS_NO_CHAR);
169
}
170
155
void add_utf_8(struct conv_table *ct, int u, unsigned char *str)
171
void add_utf_8(struct conv_table *ct, int u, unsigned char *str)
156
{
172
{
157
	unsigned char *p = encode_utf_8(u);
173
	unsigned char *p = encode_utf_8(u);
(-)links-2.1pre17-orig/default.c (+14 lines)
Lines 720-725 Link Here
720
	}
720
	}
721
}
721
}
722
722
723
/* terminal NAME(str) MODE(0-3) M11_HACK(0-1) BLOCK_CURSOR.RESTRICT_852.COL(0-7) CHARSET(str) [ UTF_8_IO("utf-8") ]*/
723
unsigned char *term_rd(struct option *o, unsigned char *c)
724
unsigned char *term_rd(struct option *o, unsigned char *c)
724
{
725
{
725
	struct term_spec *ts;
726
	struct term_spec *ts;
Lines 730-735 Link Here
730
		mem_free(w);
731
		mem_free(w);
731
		goto end;
732
		goto end;
732
	}
733
	}
734
        ts->utf_8_io = 0;
733
	mem_free(w);
735
	mem_free(w);
734
	if (!(w = get_token(&c))) goto err;
736
	if (!(w = get_token(&c))) goto err;
735
	if (strlen(w) != 1 || w[0] < '0' || w[0] > '4') goto err_f;
737
	if (strlen(w) != 1 || w[0] < '0' || w[0] > '4') goto err_f;
Lines 750-755 Link Here
750
	if ((i = get_cp_index(w)) == -1 || is_cp_special(i)) goto err_f;
752
	if ((i = get_cp_index(w)) == -1 || is_cp_special(i)) goto err_f;
751
	ts->charset = i;
753
	ts->charset = i;
752
	mem_free(w);
754
	mem_free(w);
755
	if (!(w = get_token(&c))) goto end;
756
	if (!(strcasecmp(w, "utf-8"))) ts->utf_8_io = 1;
757
	mem_free(w);
753
	end:
758
	end:
754
	return NULL;
759
	return NULL;
755
	err_f:
760
	err_f:
Lines 758-763 Link Here
758
	return "Error reading terminal specification";
763
	return "Error reading terminal specification";
759
}
764
}
760
765
766
/* terminal2 NAME(str) MODE(0-3) M11_HACK(0-1) RESTRICT_852(0-1) COL(0-1) CHARSET(str) [ UTF_8_IO("utf-8") ]*/
761
unsigned char *term2_rd(struct option *o, unsigned char *c)
767
unsigned char *term2_rd(struct option *o, unsigned char *c)
762
{
768
{
763
	struct term_spec *ts;
769
	struct term_spec *ts;
Lines 768-773 Link Here
768
		mem_free(w);
774
		mem_free(w);
769
		goto end;
775
		goto end;
770
	}
776
	}
777
        ts->utf_8_io = 0;
771
	mem_free(w);
778
	mem_free(w);
772
	if (!(w = get_token(&c))) goto err;
779
	if (!(w = get_token(&c))) goto err;
773
	if (strlen(w) != 1 || w[0] < '0' || w[0] > '3') goto err_f;
780
	if (strlen(w) != 1 || w[0] < '0' || w[0] > '3') goto err_f;
Lines 789-794 Link Here
789
	if ((i = get_cp_index(w)) == -1 || is_cp_special(i)) goto err_f;
796
	if ((i = get_cp_index(w)) == -1 || is_cp_special(i)) goto err_f;
790
	ts->charset = i;
797
	ts->charset = i;
791
	mem_free(w);
798
	mem_free(w);
799
	if (!(w = get_token(&c))) goto end;
800
	if (!(strcasecmp(w, "utf-8"))) ts->utf_8_io = 1;
801
	mem_free(w);
792
	end:
802
	end:
793
	return NULL;
803
	return NULL;
794
	err_f:
804
	err_f:
Lines 811-816 Link Here
811
		add_num_to_str(s, l, !!ts->col + !!ts->restrict_852 * 2 + !!ts->block_cursor * 4);
821
		add_num_to_str(s, l, !!ts->col + !!ts->restrict_852 * 2 + !!ts->block_cursor * 4);
812
		add_to_str(s, l, " ");
822
		add_to_str(s, l, " ");
813
		add_to_str(s, l, get_cp_mime_name(ts->charset));
823
		add_to_str(s, l, get_cp_mime_name(ts->charset));
824
                if (ts->utf_8_io)
825
                {
826
                    add_to_str(s, l, " utf-8");
827
                }
814
	}
828
	}
815
}
829
}
816
830
(-)links-2.1pre17-orig/intl/belarusian.lng (+1 lines)
Lines 506-508 Link Here
506
T_HK_COPY_URL_LOCATION, NULL,
506
T_HK_COPY_URL_LOCATION, NULL,
507
T_HK_BLOCK_URL, NULL,
507
T_HK_BLOCK_URL, NULL,
508
T_HK_BLOCK_LIST, NULL,
508
T_HK_BLOCK_LIST, NULL,
509
T_UTF_8_IO, "UTF-8 I/O",
(-)links-2.1pre17-orig/intl/brazilian_portuguese.lng (+1 lines)
Lines 506-508 Link Here
506
T_HK_COPY_URL_LOCATION, NULL,
506
T_HK_COPY_URL_LOCATION, NULL,
507
T_HK_BLOCK_URL, NULL,
507
T_HK_BLOCK_URL, NULL,
508
T_HK_BLOCK_LIST, NULL,
508
T_HK_BLOCK_LIST, NULL,
509
T_UTF_8_IO, "UTF-8 I/O",
(-)links-2.1pre17-orig/intl/bulgarian.lng (+1 lines)
Lines 506-508 Link Here
506
T_HK_COPY_URL_LOCATION, NULL,
506
T_HK_COPY_URL_LOCATION, NULL,
507
T_HK_BLOCK_URL, NULL,
507
T_HK_BLOCK_URL, NULL,
508
T_HK_BLOCK_LIST, NULL,
508
T_HK_BLOCK_LIST, NULL,
509
T_UTF_8_IO, "UTF-8 I/O",
(-)links-2.1pre17-orig/intl/catalan.lng (+1 lines)
Lines 506-508 Link Here
506
T_HK_COPY_URL_LOCATION, NULL,
506
T_HK_COPY_URL_LOCATION, NULL,
507
T_HK_BLOCK_URL, NULL,
507
T_HK_BLOCK_URL, NULL,
508
T_HK_BLOCK_LIST, NULL,
508
T_HK_BLOCK_LIST, NULL,
509
T_UTF_8_IO, "UTF-8 I/O",
(-)links-2.1pre17-orig/intl/croatian.lng (+1 lines)
Lines 506-508 Link Here
506
T_HK_COPY_URL_LOCATION, NULL,
506
T_HK_COPY_URL_LOCATION, NULL,
507
T_HK_BLOCK_URL, NULL,
507
T_HK_BLOCK_URL, NULL,
508
T_HK_BLOCK_LIST, NULL,
508
T_HK_BLOCK_LIST, NULL,
509
T_UTF_8_IO, "UTF-8 I/O",
(-)links-2.1pre17-orig/intl/czech.lng (+1 lines)
Lines 506-508 Link Here
506
T_HK_COPY_URL_LOCATION, "C",
506
T_HK_COPY_URL_LOCATION, "C",
507
T_HK_BLOCK_URL, "B",
507
T_HK_BLOCK_URL, "B",
508
T_HK_BLOCK_LIST, "B",
508
T_HK_BLOCK_LIST, "B",
509
T_UTF_8_IO, "UTF-8 I/O",
(-)links-2.1pre17-orig/intl/danish.lng (+1 lines)
Lines 506-508 Link Here
506
T_HK_COPY_URL_LOCATION, NULL,
506
T_HK_COPY_URL_LOCATION, NULL,
507
T_HK_BLOCK_URL, NULL,
507
T_HK_BLOCK_URL, NULL,
508
T_HK_BLOCK_LIST, NULL,
508
T_HK_BLOCK_LIST, NULL,
509
T_UTF_8_IO, "UTF-8 I/O",
(-)links-2.1pre17-orig/intl/dutch.lng (+1 lines)
Lines 506-508 Link Here
506
T_HK_COPY_URL_LOCATION, NULL,
506
T_HK_COPY_URL_LOCATION, NULL,
507
T_HK_BLOCK_URL, NULL,
507
T_HK_BLOCK_URL, NULL,
508
T_HK_BLOCK_LIST, NULL,
508
T_HK_BLOCK_LIST, NULL,
509
T_UTF_8_IO, "UTF-8 I/O",
(-)links-2.1pre17-orig/intl/english.lng (+1 lines)
Lines 506-508 Link Here
506
T_HK_COPY_URL_LOCATION, "C",
506
T_HK_COPY_URL_LOCATION, "C",
507
T_HK_BLOCK_URL, "B",
507
T_HK_BLOCK_URL, "B",
508
T_HK_BLOCK_LIST, "B",
508
T_HK_BLOCK_LIST, "B",
509
T_UTF_8_IO, "UTF-8 I/O",
(-)links-2.1pre17-orig/intl/estonian.lng (+1 lines)
Lines 506-508 Link Here
506
T_HK_COPY_URL_LOCATION, NULL,
506
T_HK_COPY_URL_LOCATION, NULL,
507
T_HK_BLOCK_URL, NULL,
507
T_HK_BLOCK_URL, NULL,
508
T_HK_BLOCK_LIST, NULL,
508
T_HK_BLOCK_LIST, NULL,
509
T_UTF_8_IO, "UTF-8 I/O",
(-)links-2.1pre17-orig/intl/finnish.lng (+1 lines)
Lines 506-508 Link Here
506
T_HK_COPY_URL_LOCATION, "U",
506
T_HK_COPY_URL_LOCATION, "U",
507
T_HK_BLOCK_URL, NULL,
507
T_HK_BLOCK_URL, NULL,
508
T_HK_BLOCK_LIST, NULL,
508
T_HK_BLOCK_LIST, NULL,
509
T_UTF_8_IO, "UTF-8 I/O",
(-)links-2.1pre17-orig/intl/french.lng (+1 lines)
Lines 506-508 Link Here
506
T_HK_COPY_URL_LOCATION, NULL,
506
T_HK_COPY_URL_LOCATION, NULL,
507
T_HK_BLOCK_URL, NULL,
507
T_HK_BLOCK_URL, NULL,
508
T_HK_BLOCK_LIST, NULL,
508
T_HK_BLOCK_LIST, NULL,
509
T_UTF_8_IO, "UTF-8 I/O",
(-)links-2.1pre17-orig/intl/galician.lng (+1 lines)
Lines 506-508 Link Here
506
T_HK_COPY_URL_LOCATION, NULL,
506
T_HK_COPY_URL_LOCATION, NULL,
507
T_HK_BLOCK_URL, NULL,
507
T_HK_BLOCK_URL, NULL,
508
T_HK_BLOCK_LIST, NULL,
508
T_HK_BLOCK_LIST, NULL,
509
T_UTF_8_IO, "UTF-8 I/O",
(-)links-2.1pre17-orig/intl/german.lng (+1 lines)
Lines 506-508 Link Here
506
T_HK_COPY_URL_LOCATION, "U",
506
T_HK_COPY_URL_LOCATION, "U",
507
T_HK_BLOCK_URL, NULL,
507
T_HK_BLOCK_URL, NULL,
508
T_HK_BLOCK_LIST, NULL,
508
T_HK_BLOCK_LIST, NULL,
509
T_UTF_8_IO, "UTF-8 I/O",
(-)links-2.1pre17-orig/intl/greek.lng (+1 lines)
Lines 506-508 Link Here
506
T_HK_COPY_URL_LOCATION, NULL,
506
T_HK_COPY_URL_LOCATION, NULL,
507
T_HK_BLOCK_URL, NULL,
507
T_HK_BLOCK_URL, NULL,
508
T_HK_BLOCK_LIST, NULL,
508
T_HK_BLOCK_LIST, NULL,
509
T_UTF_8_IO, "UTF-8 I/O",
(-)links-2.1pre17-orig/intl/hungarian.lng (+1 lines)
Lines 506-508 Link Here
506
T_HK_COPY_URL_LOCATION, NULL,
506
T_HK_COPY_URL_LOCATION, NULL,
507
T_HK_BLOCK_URL, NULL,
507
T_HK_BLOCK_URL, NULL,
508
T_HK_BLOCK_LIST, NULL,
508
T_HK_BLOCK_LIST, NULL,
509
T_UTF_8_IO, "UTF-8 I/O",
(-)links-2.1pre17-orig/intl/icelandic.lng (+1 lines)
Lines 506-508 Link Here
506
T_HK_COPY_URL_LOCATION, NULL,
506
T_HK_COPY_URL_LOCATION, NULL,
507
T_HK_BLOCK_URL, NULL,
507
T_HK_BLOCK_URL, NULL,
508
T_HK_BLOCK_LIST, NULL,
508
T_HK_BLOCK_LIST, NULL,
509
T_UTF_8_IO, "UTF-8 I/O",
(-)links-2.1pre17-orig/intl/indonesian.lng (+1 lines)
Lines 506-508 Link Here
506
T_HK_COPY_URL_LOCATION, NULL,
506
T_HK_COPY_URL_LOCATION, NULL,
507
T_HK_BLOCK_URL, NULL,
507
T_HK_BLOCK_URL, NULL,
508
T_HK_BLOCK_LIST, NULL,
508
T_HK_BLOCK_LIST, NULL,
509
T_UTF_8_IO, "UTF-8 I/O",
(-)links-2.1pre17-orig/intl/italian.lng (+1 lines)
Lines 506-508 Link Here
506
T_HK_COPY_URL_LOCATION, NULL,
506
T_HK_COPY_URL_LOCATION, NULL,
507
T_HK_BLOCK_URL, NULL,
507
T_HK_BLOCK_URL, NULL,
508
T_HK_BLOCK_LIST, NULL,
508
T_HK_BLOCK_LIST, NULL,
509
T_UTF_8_IO, "UTF-8 I/O",
(-)links-2.1pre17-orig/intl/lithuanian.lng (+1 lines)
Lines 506-508 Link Here
506
T_HK_COPY_URL_LOCATION, NULL,
506
T_HK_COPY_URL_LOCATION, NULL,
507
T_HK_BLOCK_URL, NULL,
507
T_HK_BLOCK_URL, NULL,
508
T_HK_BLOCK_LIST, NULL,
508
T_HK_BLOCK_LIST, NULL,
509
T_UTF_8_IO, "UTF-8 I/O",
(-)links-2.1pre17-orig/intl/norwegian.lng (+1 lines)
Lines 506-508 Link Here
506
T_HK_COPY_URL_LOCATION, NULL,
506
T_HK_COPY_URL_LOCATION, NULL,
507
T_HK_BLOCK_URL, NULL,
507
T_HK_BLOCK_URL, NULL,
508
T_HK_BLOCK_LIST, NULL,
508
T_HK_BLOCK_LIST, NULL,
509
T_UTF_8_IO, "UTF-8 I/O",
(-)links-2.1pre17-orig/intl/polish.lng (+1 lines)
Lines 506-508 Link Here
506
T_HK_COPY_URL_LOCATION, NULL,
506
T_HK_COPY_URL_LOCATION, NULL,
507
T_HK_BLOCK_URL, NULL,
507
T_HK_BLOCK_URL, NULL,
508
T_HK_BLOCK_LIST, NULL,
508
T_HK_BLOCK_LIST, NULL,
509
T_UTF_8_IO, "UTF-8 I/O",
(-)links-2.1pre17-orig/intl/portuguese.lng (+1 lines)
Lines 506-508 Link Here
506
T_HK_COPY_URL_LOCATION, NULL,
506
T_HK_COPY_URL_LOCATION, NULL,
507
T_HK_BLOCK_URL, NULL,
507
T_HK_BLOCK_URL, NULL,
508
T_HK_BLOCK_LIST, NULL,
508
T_HK_BLOCK_LIST, NULL,
509
T_UTF_8_IO, "UTF-8 I/O",
(-)links-2.1pre17-orig/intl/romanian.lng (+1 lines)
Lines 506-508 Link Here
506
T_HK_COPY_URL_LOCATION, NULL,
506
T_HK_COPY_URL_LOCATION, NULL,
507
T_HK_BLOCK_URL, NULL,
507
T_HK_BLOCK_URL, NULL,
508
T_HK_BLOCK_LIST, NULL,
508
T_HK_BLOCK_LIST, NULL,
509
T_UTF_8_IO, "UTF-8 I/O",
(-)links-2.1pre17-orig/intl/russian.lng (+1 lines)
Lines 506-508 Link Here
506
T_HK_COPY_URL_LOCATION, NULL,
506
T_HK_COPY_URL_LOCATION, NULL,
507
T_HK_BLOCK_URL, NULL,
507
T_HK_BLOCK_URL, NULL,
508
T_HK_BLOCK_LIST, NULL,
508
T_HK_BLOCK_LIST, NULL,
509
T_UTF_8_IO, "UTF-8 I/O",
(-)links-2.1pre17-orig/intl/serbian.lng (+1 lines)
Lines 506-508 Link Here
506
T_HK_COPY_URL_LOCATION, "â",
506
T_HK_COPY_URL_LOCATION, "â",
507
T_HK_BLOCK_URL, NULL,
507
T_HK_BLOCK_URL, NULL,
508
T_HK_BLOCK_LIST, NULL,
508
T_HK_BLOCK_LIST, NULL,
509
T_UTF_8_IO, "UTF-8 I/O",
(-)links-2.1pre17-orig/intl/slovak.lng (+1 lines)
Lines 506-508 Link Here
506
T_HK_COPY_URL_LOCATION, NULL,
506
T_HK_COPY_URL_LOCATION, NULL,
507
T_HK_BLOCK_URL, NULL,
507
T_HK_BLOCK_URL, NULL,
508
T_HK_BLOCK_LIST, NULL,
508
T_HK_BLOCK_LIST, NULL,
509
T_UTF_8_IO, "UTF-8 I/O",
(-)links-2.1pre17-orig/intl/spanish.lng (+1 lines)
Lines 506-508 Link Here
506
T_HK_COPY_URL_LOCATION, NULL,
506
T_HK_COPY_URL_LOCATION, NULL,
507
T_HK_BLOCK_URL, NULL,
507
T_HK_BLOCK_URL, NULL,
508
T_HK_BLOCK_LIST, NULL,
508
T_HK_BLOCK_LIST, NULL,
509
T_UTF_8_IO, "UTF-8 I/O",
(-)links-2.1pre17-orig/intl/swedish.lng (+1 lines)
Lines 506-508 Link Here
506
T_HK_COPY_URL_LOCATION, NULL,
506
T_HK_COPY_URL_LOCATION, NULL,
507
T_HK_BLOCK_URL, NULL,
507
T_HK_BLOCK_URL, NULL,
508
T_HK_BLOCK_LIST, NULL,
508
T_HK_BLOCK_LIST, NULL,
509
T_UTF_8_IO, "UTF-8 I/O",
(-)links-2.1pre17-orig/intl/turkish.lng (+1 lines)
Lines 506-508 Link Here
506
T_HK_COPY_URL_LOCATION, NULL,
506
T_HK_COPY_URL_LOCATION, NULL,
507
T_HK_BLOCK_URL, NULL,
507
T_HK_BLOCK_URL, NULL,
508
T_HK_BLOCK_LIST, NULL,
508
T_HK_BLOCK_LIST, NULL,
509
T_UTF_8_IO, "UTF-8 I/O",
(-)links-2.1pre17-orig/intl/ukrainian.lng (+1 lines)
Lines 506-508 Link Here
506
T_HK_COPY_URL_LOCATION, NULL,
506
T_HK_COPY_URL_LOCATION, NULL,
507
T_HK_BLOCK_URL, NULL,
507
T_HK_BLOCK_URL, NULL,
508
T_HK_BLOCK_LIST, NULL,
508
T_HK_BLOCK_LIST, NULL,
509
T_UTF_8_IO, "UTF-8 I/O",
(-)links-2.1pre17-orig/intl/upper_sorbian.lng (+1 lines)
Lines 506-508 Link Here
506
T_HK_COPY_URL_LOCATION, NULL,
506
T_HK_COPY_URL_LOCATION, NULL,
507
T_HK_BLOCK_URL, NULL,
507
T_HK_BLOCK_URL, NULL,
508
T_HK_BLOCK_LIST, NULL,
508
T_HK_BLOCK_LIST, NULL,
509
T_UTF_8_IO, "UTF-8 I/O",
(-)links-2.1pre17-orig/links.h (+11 lines)
Lines 1840-1845 Link Here
1840
#ifdef G
1840
#ifdef G
1841
	struct graphics_device *dev;
1841
	struct graphics_device *dev;
1842
#endif
1842
#endif
1843
	struct {
1844
		int ucs;
1845
		int len;
1846
		int min;
1847
	} utf_8;
1843
};
1848
};
1844
1849
1845
struct term_spec {
1850
struct term_spec {
Lines 1848-1853 Link Here
1848
	unsigned char term[MAX_TERM_LEN];
1853
	unsigned char term[MAX_TERM_LEN];
1849
	int mode;
1854
	int mode;
1850
	int m11_hack;
1855
	int m11_hack;
1856
	int utf_8_io;
1851
	int restrict_852;
1857
	int restrict_852;
1852
	int block_cursor;
1858
	int block_cursor;
1853
	int col;
1859
	int col;
Lines 3337-3342 Link Here
3337
3343
3338
/* charsets.c */
3344
/* charsets.c */
3339
3345
3346
/* UCS/Unicode replacement character */
3347
#define UCS_NO_CHAR 0xFFFD
3348
3340
#include "codepage.h"
3349
#include "codepage.h"
3341
3350
3342
extern int utf8_table;
3351
extern int utf8_table;
Lines 3359-3364 Link Here
3359
void free_conv_table(void);
3368
void free_conv_table(void);
3360
unsigned char *encode_utf_8(int);
3369
unsigned char *encode_utf_8(int);
3361
int cp2u(unsigned char, int);
3370
int cp2u(unsigned char, int);
3371
unsigned char *cp2utf_8(int, int);
3372
unsigned char *u2cp(int, int);
3362
3373
3363
#ifdef G
3374
#ifdef G
3364
int get_utf_8(unsigned char **p);
3375
int get_utf_8(unsigned char **p);
(-)links-2.1pre17-orig/menu.c (-10 / +14 lines)
Lines 534-547 Link Here
534
	cls_redraw_all_terminals();
534
	cls_redraw_all_terminals();
535
}
535
}
536
536
537
unsigned char *td_labels[] = { TEXT(T_NO_FRAMES), TEXT(T_VT_100_FRAMES), TEXT(T_LINUX_OR_OS2_FRAMES), TEXT(T_KOI8R_FRAMES), TEXT(T_FREEBSD_FRAMES), TEXT(T_USE_11M), TEXT(T_RESTRICT_FRAMES_IN_CP850_852), TEXT(T_BLOCK_CURSOR), TEXT(T_COLOR), TEXT(T_BRAILLE_TERMINAL), NULL };
537
unsigned char *td_labels[] = { TEXT(T_NO_FRAMES), TEXT(T_VT_100_FRAMES), TEXT(T_LINUX_OR_OS2_FRAMES), TEXT(T_KOI8R_FRAMES), TEXT(T_FREEBSD_FRAMES), TEXT(T_USE_11M), TEXT(T_RESTRICT_FRAMES_IN_CP850_852), TEXT(T_BLOCK_CURSOR), TEXT(T_COLOR), TEXT(T_BRAILLE_TERMINAL), TEXT(T_UTF_8_IO), NULL };
538
538
539
void terminal_options(struct terminal *term, void *xxx, struct session *ses)
539
void terminal_options(struct terminal *term, void *xxx, struct session *ses)
540
{
540
{
541
	struct dialog *d;
541
	struct dialog *d;
542
	struct term_spec *ts = new_term_spec(term->term);
542
	struct term_spec *ts = new_term_spec(term->term);
543
	if (!ts) return;
543
	if (!ts) return;
544
	d = mem_calloc(sizeof(struct dialog) + 12 * sizeof(struct dialog_item));
544
	d = mem_calloc(sizeof(struct dialog) + 14 * sizeof(struct dialog_item));
545
	d->title = TEXT(T_TERMINAL_OPTIONS);
545
	d->title = TEXT(T_TERMINAL_OPTIONS);
546
	d->fn = checkbox_list_fn;
546
	d->fn = checkbox_list_fn;
547
	d->udata = td_labels;
547
	d->udata = td_labels;
Lines 591-605 Link Here
591
	d->items[9].gid = 0;
591
	d->items[9].gid = 0;
592
	d->items[9].dlen = sizeof(int);
592
	d->items[9].dlen = sizeof(int);
593
	d->items[9].data = (void *)&ts->braille;
593
	d->items[9].data = (void *)&ts->braille;
594
	d->items[10].type = D_BUTTON;
594
	d->items[10].type = D_CHECKBOX;
595
	d->items[10].gid = B_ENTER;
595
	d->items[10].gid = 0;
596
	d->items[10].fn = ok_dialog;
596
	d->items[10].dlen = sizeof(int);
597
	d->items[10].text = TEXT(T_OK);
597
	d->items[10].data = (void *)&ts->utf_8_io;
598
	d->items[11].type = D_BUTTON;
598
	d->items[11].type = D_BUTTON;
599
	d->items[11].gid = B_ESC;
599
	d->items[11].gid = B_ENTER;
600
	d->items[11].fn = cancel_dialog;
600
	d->items[11].fn = ok_dialog;
601
	d->items[11].text = TEXT(T_CANCEL);
601
	d->items[11].text = TEXT(T_OK);
602
	d->items[12].type = D_END;
602
	d->items[12].type = D_BUTTON;
603
	d->items[12].gid = B_ESC;
604
	d->items[12].fn = cancel_dialog;
605
	d->items[12].text = TEXT(T_CANCEL);
606
	d->items[13].type = D_END;
603
	do_dialog(term, d, getml(d, NULL));
607
	do_dialog(term, d, getml(d, NULL));
604
}
608
}
605
609
(-)links-2.1pre17-orig/terminal.c (-4 / +79 lines)
Lines 690-695 Link Here
690
690
691
#endif
691
#endif
692
692
693
static inline void term_send_event(struct terminal *term, struct event *ev)
694
{
695
	((struct window *)&term->windows)->next->handler(term->windows.next, ev, 0);
696
}
697
698
static inline void term_send_ucs(struct terminal *term, struct event *ev, int u)
699
{
700
	unsigned char *recoded;
701
702
	if (u == 0xA0) u = ' ';
703
	recoded = u2cp(u, term->spec->charset);
704
	if (! recoded) recoded = "*";
705
	while (*recoded) {
706
		ev->x = *recoded;
707
		term_send_event(term, ev);
708
		recoded ++;
709
	}
710
}
711
693
void in_term(struct terminal *term)
712
void in_term(struct terminal *term)
694
{
713
{
695
	struct event *ev;
714
	struct event *ev;
Lines 749-755 Link Here
749
			goto send_redraw;
768
			goto send_redraw;
750
		}
769
		}
751
		else if (ev->ev == EV_KBD && ev->x == KBD_CTRL_C) ((struct window *)&term->windows)->prev->handler(term->windows.prev, ev, 0);
770
		else if (ev->ev == EV_KBD && ev->x == KBD_CTRL_C) ((struct window *)&term->windows)->prev->handler(term->windows.prev, ev, 0);
752
		else ((struct window *)&term->windows)->next->handler(term->windows.next, ev, 0);
771
		else if (ev->ev == EV_KBD) {
772
			if (term->utf_8.len) {
773
				if ((ev->x & 0xC0) == 0x80 && term->spec->utf_8_io) {
774
					term->utf_8.ucs <<= 6;
775
					term->utf_8.ucs |= ev->x & 0x3F;
776
					if (! --term->utf_8.len) {
777
						int u = term->utf_8.ucs;
778
779
						if (u < term->utf_8.min) u = UCS_NO_CHAR;
780
						term_send_ucs(term, ev, u);
781
					}
782
					goto mm;
783
				} else {
784
					term->utf_8.len = 0;
785
					term_send_ucs(term, ev, UCS_NO_CHAR);
786
				}
787
			}
788
			if (ev->x < 0x80 || ev->x > 0xFF || ! term->spec->utf_8_io) {
789
				term_send_event(term, ev);
790
				goto mm;
791
			} else if ((ev->x & 0xC0) == 0xC0 && (ev->x & 0xFE) != 0xFE) {
792
				int mask, len = 0, cov = 0x80;
793
794
				for (mask = 0x80; ev->x & mask; mask >>= 1) {
795
					len++;
796
					term->utf_8.min = cov;
797
					cov = 1 << (1 + 5 * len);
798
				}
799
				term->utf_8.len = len - 1;
800
				term->utf_8.ucs = ev->x & (mask - 1);
801
				goto mm;
802
			}
803
			term_send_ucs(term, ev, UCS_NO_CHAR);
804
		} else term_send_event(term, ev);
753
	}
805
	}
754
	if (ev->ev == EV_ABORT) {
806
	if (ev->ev == EV_ABORT) {
755
		destroy_terminal(term);
807
		destroy_terminal(term);
Lines 769-774 Link Here
769
821
770
unsigned char frame_dumb[48] =	"   ||||++||++++++--|-+||++--|-+----++++++++     ";
822
unsigned char frame_dumb[48] =	"   ||||++||++++++--|-+||++--|-+----++++++++     ";
771
unsigned char frame_vt100[48] =	"aaaxuuukkuxkjjjkmvwtqnttmlvwtqnvvwwmmllnnjla    ";
823
unsigned char frame_vt100[48] =	"aaaxuuukkuxkjjjkmvwtqnttmlvwtqnvvwwmmllnnjla    ";
824
unsigned char frame_vt100_u[48] = {
825
	177,177,177,179,180,180,180,191,
826
	191,180,179,191,217,217,217,191,
827
	192,193,194,195,196,197,195,195,
828
	192,218,193,194,195,196,197,193,
829
	193,194,194,192,192,218,218,197,
830
	197,217,218,177, 32, 32, 32, 32
831
};
772
unsigned char frame_koi[48] = {
832
unsigned char frame_koi[48] = {
773
	144,145,146,129,135,178,180,167,
833
	144,145,146,129,135,178,180,167,
774
	166,181,161,168,174,173,172,131,
834
	166,181,161,168,174,173,172,131,
Lines 800-806 Link Here
800
	unsigned char c = ch & 0xff;							\
860
	unsigned char c = ch & 0xff;							\
801
	unsigned char A = ch >> 8 & 0x7f;						\
861
	unsigned char A = ch >> 8 & 0x7f;						\
802
	if (s->mode == TERM_LINUX) {							\
862
	if (s->mode == TERM_LINUX) {							\
803
		if (s->m11_hack) {							\
863
		if (s->m11_hack && !s->utf_8_io) {							\
804
			if ((int)(ch >> 15) != mode) {					\
864
			if ((int)(ch >> 15) != mode) {					\
805
				if (!(mode = ch >> 15)) add_to_str(&a, &l, "\033[10m");	\
865
				if (!(mode = ch >> 15)) add_to_str(&a, &l, "\033[10m");	\
806
				else add_to_str(&a, &l, "\033[11m");			\
866
				else add_to_str(&a, &l, "\033[11m");			\
Lines 809-820 Link Here
809
		if (s->restrict_852 && (ch >> 15) && c >= 176 && c < 224) {		\
869
		if (s->restrict_852 && (ch >> 15) && c >= 176 && c < 224) {		\
810
			if (frame_restrict[c - 176]) c = frame_restrict[c - 176];	\
870
			if (frame_restrict[c - 176]) c = frame_restrict[c - 176];	\
811
		}									\
871
		}									\
812
	} else if (s->mode == TERM_VT100) {						\
872
	} else if (s->mode == TERM_VT100 && !s->utf_8_io) {						\
813
		if ((int)(ch >> 15) != mode) {						\
873
		if ((int)(ch >> 15) != mode) {						\
814
			if (!(mode = ch >> 15)) add_to_str(&a, &l, "\x0f");		\
874
			if (!(mode = ch >> 15)) add_to_str(&a, &l, "\x0f");		\
815
			else add_to_str(&a, &l, "\x0e");				\
875
			else add_to_str(&a, &l, "\x0e");				\
816
		}									\
876
		}									\
817
		if (mode && c >= 176 && c < 224) c = frame_vt100[c - 176];		\
877
		if (mode && c >= 176 && c < 224) c = frame_vt100[c - 176];		\
878
	} else if (s->mode == TERM_VT100 && (ch >> 15) && c >= 176 && c < 224) {	\
879
		c = frame_vt100_u[c - 176];						\
818
	} else if (s->mode == TERM_KOI8 && (ch >> 15) && c >= 176 && c < 224) { c = frame_koi[c - 176];\
880
	} else if (s->mode == TERM_KOI8 && (ch >> 15) && c >= 176 && c < 224) { c = frame_koi[c - 176];\
819
	} else if (s->mode == TERM_FREEBSD && (ch >> 15) && c >= 176 && c < 224) { c = frame_freebsd[c - 176];\
881
	} else if (s->mode == TERM_FREEBSD && (ch >> 15) && c >= 176 && c < 224) { c = frame_freebsd[c - 176];\
820
	} else if (s->mode == TERM_DUMB && (ch >> 15) && c >= 176 && c < 224) c = frame_dumb[c - 176];\
882
	} else if (s->mode == TERM_DUMB && (ch >> 15) && c >= 176 && c < 224) c = frame_dumb[c - 176];\
Lines 835-841 Link Here
835
		if (attrib & 0100) add_to_str(&a, &l, ";1");				\
897
		if (attrib & 0100) add_to_str(&a, &l, ";1");				\
836
		add_to_str(&a, &l, "m");						\
898
		add_to_str(&a, &l, "m");						\
837
	}										\
899
	}										\
838
	if (c >= ' ' && c != 127/* && c != 155*/) add_chr_to_str(&a, &l, c);		\
900
	if (c >= ' ' && c != 127/* && c != 155*/) {					\
901
		int charset = s->charset;						\
902
											\
903
		if (ch >> 15) {								\
904
			int frames_charset = (s->mode == TERM_LINUX || s->mode == TERM_VT100) \
905
						? get_cp_index("cp437")			\
906
						: s->mode == TERM_KOI8			\
907
						? get_cp_index("koi8-r")		\
908
						: -1;					\
909
			if (frames_charset != -1) charset = frames_charset;		\
910
		}									\
911
		if (s->utf_8_io) add_to_str(&a, &l, cp2utf_8(charset, c));		\
912
		else add_chr_to_str(&a, &l, c);						\
913
	}										\
839
	else if (!c || c == 1) add_chr_to_str(&a, &l, ' ');				\
914
	else if (!c || c == 1) add_chr_to_str(&a, &l, ' ');				\
840
	else add_chr_to_str(&a, &l, '.');						\
915
	else add_chr_to_str(&a, &l, '.');						\
841
	cx++;										\
916
	cx++;										\

Return to bug 80401