1
0
Fork 0

Rename CONFIG_UTF_8 to CONFIG_UTF8.

The configure script no longer recognizes "CONFIG_UTF_8=yes" lines
in custom features.conf files.  They will have to be changed to
"CONFIG_UTF8=yes".  This incompatibility was deemed acceptable
because no released version of ELinks supports CONFIG_UTF_8.

The --enable-utf-8 option was not renamed.
This commit is contained in:
Kalle Olavi Niemitalo 2006-09-17 16:12:47 +03:00 committed by Kalle Olavi Niemitalo
parent e8462980e5
commit 92cb452a9e
44 changed files with 432 additions and 432 deletions

View File

@ -161,7 +161,7 @@ CONFIG_SSL = @CONFIG_SSL@
CONFIG_SYSMOUSE = @CONFIG_SYSMOUSE@
CONFIG_TRUE_COLOR = @CONFIG_TRUE_COLOR@
CONFIG_URI_REWRITE = @CONFIG_URI_REWRITE@
CONFIG_UTF_8 = @CONFIG_UTF_8@
CONFIG_UTF8 = @CONFIG_UTF8@
CONFIG_XBEL_BOOKMARKS = @CONFIG_XBEL_BOOKMARKS@
CONFIG_XMLTO = @CONFIG_XMLTO@
CONFIG_GSSAPI = @CONFIG_GSSAPI@

View File

@ -1281,7 +1281,7 @@ EL_ARG_ENABLE(CONFIG_OWN_LIBC, own-libc, [Own libc stubs],
EL_ARG_ENABLE(CONFIG_SMALL, small, [Small binary],
[ --enable-small reduce binary size as far as possible (but see the bottom of doc/small.txt!)])
EL_ARG_ENABLE(CONFIG_UTF_8, utf-8, [UTF-8],
EL_ARG_ENABLE(CONFIG_UTF8, utf-8, [UTF-8],
[ --enable-utf-8 enable UTF-8 support])

View File

@ -626,7 +626,7 @@ CONFIG_SMALL=no
#
# Default: disabled
CONFIG_UTF_8=no
CONFIG_UTF8=no

View File

@ -77,7 +77,7 @@ add_dlg_button_do(struct dialog *dlg, unsigned char *text, int flags,
}
}
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
static void
buttons_width(struct widget_data *widget_data, int n,
int *minwidth, int *maxwidth, int utf8)
@ -85,25 +85,25 @@ buttons_width(struct widget_data *widget_data, int n,
static void
buttons_width(struct widget_data *widget_data, int n,
int *minwidth, int *maxwidth)
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
{
int maxw = -BUTTON_HSPACING;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
int button_lr_len = utf8_ptr2cells(BUTTON_LEFT, NULL)
+ utf8_ptr2cells(BUTTON_RIGHT, NULL);
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
assert(n > 0);
if_assert_failed return;
while (n--) {
int minw;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (utf8)
minw = utf8_ptr2cells((widget_data++)->widget->text, NULL)
+ BUTTON_HSPACING + button_lr_len;
else
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
minw = (widget_data++)->widget->info.button.textlen
+ BUTTON_HSPACING + BUTTON_LR_LEN;
@ -128,41 +128,41 @@ dlg_format_buttons(struct terminal *term,
while (i2 < n) {
mw = 0;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
buttons_width(widget_data1, i2 - i1 + 1, NULL, &mw,
term->utf8);
#else
buttons_width(widget_data1, i2 - i1 + 1, NULL, &mw);
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
if (mw <= w) i2++;
else break;
}
mw = 0;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
buttons_width(widget_data1, i2 - i1, NULL, &mw, term->utf8);
#else
buttons_width(widget_data1, i2 - i1, NULL, &mw);
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
if (rw) int_bounds(rw, mw, w);
if (!format_only) {
int i;
int p = x + (align == ALIGN_CENTER ? (w - mw) / 2 : 0);
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
int button_lr_len = utf8_ptr2cells(BUTTON_LEFT, NULL)
+ utf8_ptr2cells(BUTTON_RIGHT, NULL);
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
for (i = i1; i < i2; i++) {
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (term->utf8)
set_box(&widget_data[i].box,
p, *y,
utf8_ptr2cells(widget_data[i].widget->text, NULL)
+ button_lr_len, BUTTON_HEIGHT);
else
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
set_box(&widget_data[i].box,
p, *y,
widget_data[i].widget->info.button.textlen
@ -195,7 +195,7 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
}
if (!color || !shortcut_color) return EVENT_PROCESSED;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (term->utf8) {
int button_left_len = utf8_ptr2cells(BUTTON_LEFT, NULL);
int button_right_len = utf8_ptr2cells(BUTTON_RIGHT, NULL);
@ -205,7 +205,7 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
(button_left_len + button_right_len);
} else
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
{
x = pos->x + BUTTON_LEFT_LEN;
len = widget_data->box.width - BUTTON_LR_LEN;
@ -221,7 +221,7 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
attr = get_opt_bool("ui.dialogs.underline_button_shortcuts")
? SCREEN_ATTR_UNDERLINE : 0;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (term->utf8) {
if (hk_pos >= 0) {
int hk_bytes = utf8charlen(&text[hk_pos+1]);
@ -266,7 +266,7 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
0, color);
}
} else
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
if (hk_pos >= 0) {
int right = widget_data->widget->info.button.truetextlen - hk_pos - 1;
@ -285,7 +285,7 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
draw_text(term, x + 1, pos->y, &text[1], len - 1, 0, color);
}
}
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (term->utf8) {
int text_cells = utf8_ptr2cells(widget_data->widget->text, NULL);
int hk = (widget_data->widget->info.button.hotkey_pos >= 0);
@ -293,7 +293,7 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
draw_text(term, x + text_cells - hk, pos->y,
BUTTON_RIGHT, BUTTON_RIGHT_LEN, 0, color);
} else
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
draw_text(term, x + len, pos->y, BUTTON_RIGHT,
BUTTON_RIGHT_LEN, 0, color);
if (sel) {

View File

@ -101,19 +101,19 @@ redraw_dialog(struct dialog_data *dlg_data, int layout)
int titlecells = titlelen;
int x, y;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (term->utf8)
titlecells = utf8_ptr2cells(title,
&title[titlelen]);
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
titlecells = int_min(box.width - 2, titlecells);
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (term->utf8)
titlelen = utf8_cells2bytes(title, titlecells,
NULL);
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
x = (box.width - titlecells) / 2 + box.x;
y = box.y - 1;
@ -286,7 +286,7 @@ static void
select_button_by_key(struct dialog_data *dlg_data)
{
term_event_char_T key;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
int codepage;
#endif
@ -295,7 +295,7 @@ select_button_by_key(struct dialog_data *dlg_data)
if (!check_kbd_label_key(ev)) return;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
key = unicode_fold_label_case(get_kbd_key(ev));
codepage = get_opt_codepage_tree(dlg_data->win->term->spec, "charset");
#else
@ -319,7 +319,7 @@ select_button_by_key(struct dialog_data *dlg_data)
else
hk_ptr = widget_data->widget->text;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
hk_char = cp_to_unicode(codepage, &hk_ptr,
strchr(hk_ptr, '\0'));
hk_char = unicode_fold_label_case(hk_char);
@ -611,11 +611,11 @@ generic_dialog_layouter(struct dialog_data *dlg_data)
int height = dialog_max_height(term);
int x = 0, y, rw;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (term->utf8)
rw = int_min(w, utf8_ptr2cells(dlg_data->dlg->title, NULL));
else
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
rw = int_min(w, strlen(dlg_data->dlg->title));
y = dlg_data->dlg->layout.padding_top ? 0 : -1;
@ -656,15 +656,15 @@ draw_dialog(struct dialog_data *dlg_data, int width, int height)
/* Draw shadow */
draw_shadow(term, &dlg_data->box,
get_bfu_color(term, "dialog.shadow"), 2, 1);
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (term->utf8)
fix_dwchar_around_box(term, &dlg_data->box, 0, 2, 1);
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
}
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
else if(term->utf8)
fix_dwchar_around_box(term, &dlg_data->box, 0, 0, 0);
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
}
static void

View File

@ -39,14 +39,14 @@ dlg_format_group(struct terminal *term,
int label_length;
int label_padding;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (term->utf8) {
if (text && *text)
label_length = utf8_ptr2cells(text, NULL);
else
label_length = 0;
} else
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
label_length = (text && *text) ? strlen(text) : 0;
label_padding = (label_length > 0);
@ -54,12 +54,12 @@ dlg_format_group(struct terminal *term,
if (widget_data->widget->type == WIDGET_CHECKBOX) {
width = CHECKBOX_LEN;
} else if (widget_is_textfield(widget_data)) {
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (term->utf8) {
width = utf8_ptr2cells(widget_data->widget->data,
NULL);
} else
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
width = widget_data->widget->datalen;
} else {
/* TODO: handle all widget types. */
@ -81,7 +81,7 @@ dlg_format_group(struct terminal *term,
if (widget_data->widget->type == WIDGET_CHECKBOX) {
/* Draw text at right of checkbox. */
if (label_length) {
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (term->utf8) {
int lb = utf8_cells2bytes(
text,
@ -92,7 +92,7 @@ dlg_format_group(struct terminal *term,
*y, text, lb, 0,
color);
} else
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
{
draw_text(term, xpos + width
+ label_padding,
@ -107,7 +107,7 @@ dlg_format_group(struct terminal *term,
} else if (widget_is_textfield(widget_data)) {
/* Draw label at left of widget. */
if (label_length) {
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (term->utf8) {
int lb = utf8_cells2bytes(
text,
@ -116,7 +116,7 @@ dlg_format_group(struct terminal *term,
draw_text(term, xpos, *y,
text, lb, 0, color);
} else
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
{
draw_text(term, xpos, *y,
text, label_length,
@ -148,11 +148,11 @@ group_layouter(struct dialog_data *dlg_data)
int y = 0;
int n = dlg_data->number_of_widgets - 2;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (term->utf8)
rw = int_min(w, utf8_ptr2cells(dlg_data->dlg->title, NULL));
else
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
rw = int_min(w, strlen(dlg_data->dlg->title));
dlg_format_group(term, dlg_data->widgets_data, n,

View File

@ -125,7 +125,7 @@ static int
check_hotkeys_common(struct menu *menu, term_event_char_T hotkey, struct terminal *term,
int check_mode)
{
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
unicode_val_T key = unicode_fold_label_case(hotkey);
int codepage = get_opt_codepage_tree(term->spec, "charset");
#else
@ -143,7 +143,7 @@ check_hotkeys_common(struct menu *menu, term_event_char_T hotkey, struct termina
do {
struct menu_item *item;
unsigned char *text;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
unicode_val_T items_hotkey;
#endif
int found;
@ -176,7 +176,7 @@ check_hotkeys_common(struct menu *menu, term_event_char_T hotkey, struct termina
}
/* Compare @key to the character to which @text points. */
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
items_hotkey = cp_to_unicode(codepage, &text,
strchr(text, '\0'));
found = (unicode_fold_label_case(items_hotkey) == key);

View File

@ -266,11 +266,11 @@ display_field_do(struct dialog_data *dlg_data, struct widget_data *widget_data,
struct terminal *term = dlg_data->win->term;
struct color_pair *color;
int sel = is_selected_widget(dlg_data, widget_data);
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
int len = 0, left = 0;
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (term->utf8) {
unsigned char *t = widget_data->cdata;
int p = widget_data->info.field.cpos;
@ -280,7 +280,7 @@ display_field_do(struct dialog_data *dlg_data, struct widget_data *widget_data,
int_lower_bound(&left, 0);
widget_data->info.field.vpos = utf8_cells2bytes(t, left, NULL);
} else
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
{
int_bounds(&widget_data->info.field.vpos,
widget_data->info.field.cpos - widget_data->box.width + 1,
@ -297,21 +297,21 @@ display_field_do(struct dialog_data *dlg_data, struct widget_data *widget_data,
unsigned char *text = widget_data->cdata + widget_data->info.field.vpos;
int len, w;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (term->utf8 && !hide)
len = utf8_ptr2cells(text, NULL);
else if (term->utf8)
len = utf8_ptr2chars(text, NULL);
else
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
len = strlen(text);
w = int_min(len, widget_data->box.width);
if (!hide) {
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (term->utf8)
w = utf8_cells2bytes(text, w, NULL);
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
draw_text(term, widget_data->box.x, widget_data->box.y,
text, w, 0, color);
} else {
@ -327,11 +327,11 @@ display_field_do(struct dialog_data *dlg_data, struct widget_data *widget_data,
if (sel) {
int x;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (term->utf8)
x = widget_data->box.x + len - left;
else
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
x = widget_data->box.x + widget_data->info.field.cpos - widget_data->info.field.vpos;
set_cursor(term, x, widget_data->box.y, 0);
@ -473,7 +473,7 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
case ACT_EDIT_RIGHT:
if (widget_data->info.field.cpos < strlen(widget_data->cdata)) {
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (term->utf8) {
unsigned char *next = widget_data->cdata + widget_data->info.field.cpos;
unsigned char *end = strchr(next, '\0');
@ -481,7 +481,7 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
utf8_to_unicode(&next, end);
widget_data->info.field.cpos = (int)(next - widget_data->cdata);
} else
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
{
widget_data->info.field.cpos++;
}
@ -491,7 +491,7 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
case ACT_EDIT_LEFT:
if (widget_data->info.field.cpos > 0)
widget_data->info.field.cpos--;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (widget_data->info.field.cpos && term->utf8) {
unsigned char *t = widget_data->cdata;
unsigned char *t2 = t;
@ -504,7 +504,7 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
widget_data->info.field.cpos = (int)(t2 - t);
}
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
goto display_field;
case ACT_EDIT_HOME:
@ -516,7 +516,7 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
goto display_field;
case ACT_EDIT_BACKSPACE:
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (widget_data->info.field.cpos && term->utf8) {
/* XXX: stolen from src/viewer/text/form.c */
/* FIXME: This isn't nice. We remove last byte
@ -543,7 +543,7 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
}
goto display_field;
}
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
if (widget_data->info.field.cpos) {
memmove(widget_data->cdata + widget_data->info.field.cpos - 1,
widget_data->cdata + widget_data->info.field.cpos,
@ -558,7 +558,7 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
if (widget_data->info.field.cpos >= cdata_len) goto display_field;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (term->utf8) {
unsigned char *end = widget_data->cdata + cdata_len;
unsigned char *text = widget_data->cdata + widget_data->info.field.cpos;
@ -571,7 +571,7 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
}
goto display_field;
}
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
memmove(widget_data->cdata + widget_data->info.field.cpos,
widget_data->cdata + widget_data->info.field.cpos + 1,
cdata_len - widget_data->info.field.cpos + 1);
@ -680,12 +680,12 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
if (check_kbd_textinput_key(ev)) {
unsigned char *text = widget_data->cdata;
int textlen = strlen(text);
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
const unsigned char *ins = encode_utf8(get_kbd_key(ev));
int inslen = utf8charlen(ins);
#else /* !CONFIG_UTF_8 */
#else /* !CONFIG_UTF8 */
const int inslen = 1;
#endif /* !CONFIG_UTF_8 */
#endif /* !CONFIG_UTF8 */
if (textlen >= widget_data->widget->datalen - inslen)
goto display_field;
@ -695,11 +695,11 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
text += widget_data->info.field.cpos;
memmove(text + inslen, text, textlen + 1);
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
memcpy(text, ins, inslen);
#else /* !CONFIG_UTF_8 */
#else /* !CONFIG_UTF8 */
*text = get_kbd_key(ev);
#endif /* !CONFIG_UTF_8 */
#endif /* !CONFIG_UTF8 */
widget_data->info.field.cpos += inslen;
goto display_field;
}

View File

@ -462,11 +462,11 @@ display_listbox_item(struct listbox_item *item, void *data_, int *offset)
len = strlen(text);
int_upper_bound(&len, int_max(0, data->widget_data->box.width - depth * 5));
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (data->term->utf8)
len_bytes = utf8_cells2bytes(text, len, NULL);
else
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
len_bytes = len;
draw_text(data->term, x, y, text, len_bytes, 0, text_color);

View File

@ -200,12 +200,12 @@ get_menuitem_text_width(struct terminal *term, struct menu_item *mi)
if (!text[0]) return 0;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (term->utf8)
return L_TEXT_SPACE + utf8_ptr2cells(text, NULL)
- !!mi->hotkey_pos + R_TEXT_SPACE;
else
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
return L_TEXT_SPACE + strlen(text)
- !!mi->hotkey_pos + R_TEXT_SPACE;
}
@ -382,13 +382,13 @@ draw_menu_left_text(struct terminal *term, unsigned char *text, int len,
if (len < 0) len = strlen(text);
if (!len) return;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (term->utf8) {
max_len = utf8_cells2bytes(text, w, NULL);
if (max_len <= 0)
return;
} else
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
max_len = w;
if (len > max_len) len = max_len;
@ -410,7 +410,7 @@ draw_menu_left_text_hk(struct terminal *term, unsigned char *text,
int xbase = x + L_TEXT_SPACE;
int w = width - (L_TEXT_SPACE + R_TEXT_SPACE);
int hk_state = 0;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
unsigned char *text2, *end;
#endif
@ -430,9 +430,9 @@ draw_menu_left_text_hk(struct terminal *term, unsigned char *text,
hk_color_sel = tmp;
}
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (term->utf8) goto utf8;
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
for (x = 0; x - !!hk_state < w && (c = text[x]); x++) {
if (!hk_state && x == hotkey_pos - 1) {
@ -454,7 +454,7 @@ draw_menu_left_text_hk(struct terminal *term, unsigned char *text,
}
return;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
utf8:
end = strchr(text, '\0');
text2 = text;
@ -517,7 +517,7 @@ utf8:
}
}
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
}
static inline void
@ -560,15 +560,15 @@ display_menu(struct terminal *term, struct menu *menu)
/* Draw shadow */
draw_shadow(term, &menu->box,
get_bfu_color(term, "dialog.shadow"), 2, 1);
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (term->utf8)
fix_dwchar_around_box(term, &box, 1, 2, 1);
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
}
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
else if(term->utf8)
fix_dwchar_around_box(term, &box, 1, 0, 0);
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
menu_height = box.height;
box.height = 1;
@ -1114,23 +1114,23 @@ display_mainmenu(struct terminal *term, struct menu *menu)
text = _(text, term);
textlen = strlen(text) - !!l;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (term->utf8)
screencnt = utf8_ptr2cells(text, NULL) - !!l;
else
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
screencnt = textlen;
if (selected) {
color = selected_color;
box.x = p;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (term->utf8)
box.width = L_MAINTEXT_SPACE + L_TEXT_SPACE
+ screencnt
+ R_TEXT_SPACE + R_MAINTEXT_SPACE;
else
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
box.width = L_MAINTEXT_SPACE + L_TEXT_SPACE
+ textlen
+ R_TEXT_SPACE + R_MAINTEXT_SPACE;
@ -1163,7 +1163,7 @@ display_mainmenu(struct terminal *term, struct menu *menu)
menu->last = i - 1;
int_lower_bound(&menu->last, menu->first);
if (menu->last < menu->size - 1) {
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (term->utf8) {
struct screen_char *schar;

View File

@ -36,13 +36,13 @@ add_dlg_text(struct dialog *dlg, unsigned char *text,
}
/* Returns length of substring (from start of @text) before a split. */
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
static inline int
split_line(unsigned char *text, int max_width, int *cells, int utf8)
#else
static inline int
split_line(unsigned char *text, int max_width, int *cells)
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
{
unsigned char *split = text;
int cells_save = *cells;
@ -52,7 +52,7 @@ split_line(unsigned char *text, int max_width, int *cells)
while (*split && *split != '\n') {
unsigned char *next_split;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (utf8) {
unsigned char *next_char_begin = split
+ utf8charlen(split);
@ -74,7 +74,7 @@ split_line(unsigned char *text, int max_width, int *cells)
next_char_begin += utf8charlen(next_split);
}
} else
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
{
next_split = split + 1;
@ -88,7 +88,7 @@ split_line(unsigned char *text, int max_width, int *cells)
* meaning there's no splittable substring under
* requested width. */
if (split == text) {
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (utf8) {
int m_bytes = utf8_cells2bytes(text,
max_width,
@ -97,7 +97,7 @@ split_line(unsigned char *text, int max_width, int *cells)
cells_save = utf8_ptr2cells(text,
split);
} else
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
{
split = &text[max_width];
cells_save = max_width;
@ -106,9 +106,9 @@ split_line(unsigned char *text, int max_width, int *cells)
/* FIXME: Function ispunct won't work correctly
* with UTF-8 characters. We need some similar
* function for UTF-8 characters. */
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (!utf8)
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
{
/* Give preference to split on a
* punctuation if any. Note that most
@ -150,13 +150,13 @@ split_line(unsigned char *text, int max_width, int *cells)
#define realloc_lines(x, o, n) mem_align_alloc(x, o, n, LINES_GRANULARITY)
/* Find the start of each line with the current max width */
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
static unsigned char **
split_lines(struct widget_data *widget_data, int max_width, int utf8)
#else
static unsigned char **
split_lines(struct widget_data *widget_data, int max_width)
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
{
unsigned char *text = widget_data->widget->text;
unsigned char **lines = (unsigned char **) widget_data->cdata;
@ -175,7 +175,7 @@ split_lines(struct widget_data *widget_data, int max_width)
if (isspace(*text)) text++;
if (!*text) break;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
width = split_line(text, max_width, &cells, utf8);
#else
width = split_line(text, max_width, &cells);
@ -228,11 +228,11 @@ dlg_format_text_do(struct terminal *term, unsigned char *text,
firstline = 0;
if (!*text) break;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
line_width = split_line(text, width, &cells, term->utf8);
#else
line_width = split_line(text, width, &cells);
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
/* split_line() may return 0. */
if (line_width < 1) {
@ -286,7 +286,7 @@ dlg_format_text(struct terminal *term, struct widget_data *widget_data,
/* Ensure that the current split is valid but don't
* split if we don't have to */
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (widget_data->box.width != width
&& !split_lines(widget_data, width, term->utf8))
return;

View File

@ -182,10 +182,10 @@ void add_keystroke_to_string(struct string *str, struct term_event_keyboard *kbd
/* void add_accesskey_to_string(struct string *str, unicode_val_T accesskey); */
#define add_accesskey_to_string(str, accesskey) do { \
struct term_event_keyboard kbd; \
/* FIXME: #ifndef CONFIG_UTF_8, kbd.key is encoded in \
/* FIXME: #ifndef CONFIG_UTF8, kbd.key is encoded in \
* the charset of the terminal, so accesskey should be \
* converted from unicode_val_T to that. \
* #ifdef CONFIG_UTF_8, the code is correct. */ \
* #ifdef CONFIG_UTF8, the code is correct. */ \
kbd.key = accesskey; \
/* try_document_key() recognizes only Alt-accesskey \
* combos. */ \

View File

@ -145,11 +145,11 @@ download_dialog_layouter(struct dialog_data *dlg_data)
mem_free(msg);
return;
}
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (term->utf8)
decode_uri(url);
else
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
decode_uri_for_display(url);
url_len = strlen(url);
@ -302,11 +302,11 @@ get_file_download_text(struct listbox_item *item, struct terminal *term)
uristring = get_uri_string(file_download->uri, URI_PUBLIC);
if (uristring) {
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (term->utf8)
decode_uri(uristring);
else
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
decode_uri_for_display(uristring);
}

View File

@ -581,11 +581,11 @@ query_file(struct session *ses, struct uri *uri, void *data,
add_mime_filename_to_string(&def, uri);
/* Remove the %-ugliness for display */
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (ses->tab->term->utf8)
decode_uri_string(&def);
else
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
decode_uri_string_for_display(&def);
if (interactive) {

View File

@ -60,9 +60,9 @@ charset_list(struct terminal *term, void *xxx, void *ses_)
if (!name) break;
#ifndef CONFIG_UTF_8
#ifndef CONFIG_UTF8
if (is_cp_utf8(i)) continue;
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
items++;
add_to_menu(&mi, name, NULL, ACT_MAIN_NONE,

View File

@ -419,7 +419,7 @@ display_title_bar(struct session *ses, struct terminal *term)
int maxlen = int_max(term->width - 4 - buflen, 0);
int titlelen, titlewidth;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (term->utf8) {
titlewidth = utf8_ptr2cells(document->title, NULL);
titlewidth = int_min(titlewidth, maxlen);
@ -427,7 +427,7 @@ display_title_bar(struct session *ses, struct terminal *term)
titlelen = utf8_cells2bytes(document->title,
titlewidth, NULL);
} else
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
{
titlewidth = int_min(strlen(document->title), maxlen);
titlelen = titlewidth;
@ -444,14 +444,14 @@ display_title_bar(struct session *ses, struct terminal *term)
if (title.length) {
int x;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (term->utf8) {
x = int_max(term->width - 1
- utf8_ptr2cells(title.source,
title.source
+ title.length), 0);
} else
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
x = int_max(term->width - 1 - title.length, 0);
draw_text(term, x, 0, title.source, title.length, 0,

View File

@ -118,7 +118,7 @@ struct link {
#define get_link_name(link) \
(!link_is_form(link) ? (link)->data.name : NULL)
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
struct search {
int x, y;
signed int n; /* RAM is cheap nowadays */
@ -182,7 +182,7 @@ struct document {
struct search **slines1;
struct search **slines2;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
unsigned char buf[7];
unsigned char buf_length;
#endif

View File

@ -261,10 +261,10 @@ render_dom_line(struct dom_renderer *renderer, struct screen_char *template,
struct conv_table *convert = renderer->convert_table;
enum convert_string_mode mode = renderer->convert_mode;
int x, charlen;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
int utf8 = document->options.utf8;
unsigned char *end;
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
assert(renderer && template && string && length);
@ -280,9 +280,9 @@ render_dom_line(struct dom_renderer *renderer, struct screen_char *template,
add_search_node(renderer, length);
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
end = string + length;
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
for (x = 0, charlen = 1; x < length;x += charlen, renderer->canvas_x++) {
unsigned char *text = &string[x];
@ -307,7 +307,7 @@ render_dom_line(struct dom_renderer *renderer, struct screen_char *template,
break;
}
default:
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (utf8) {
unicode_val_T data;
charlen = utf8charlen(text);
@ -324,7 +324,7 @@ render_dom_line(struct dom_renderer *renderer, struct screen_char *template,
}
} else
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
template->data = isscreensafe(*text) ? *text:'.';
}
@ -1050,9 +1050,9 @@ render_dom_document(struct cache_entry *cached, struct document *document,
init_dom_renderer(&renderer, document, buffer, convert_table);
document->bgcolor = document->options.default_bg;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
document->options.utf8 = is_cp_utf8(document->options.cp);
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
if (document->options.plain)
parser_type = SGML_PARSER_STREAM;

View File

@ -497,12 +497,12 @@ end_parse:
max_width = 0;
for (i = 0; i < order; i++) {
if (!labels[i]) continue;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (html_context->options->utf8)
int_lower_bound(&max_width,
utf8_ptr2cells(labels[i], NULL));
else
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
int_lower_bound(&max_width, strlen(labels[i]));
}

View File

@ -210,7 +210,7 @@ realloc_spaces(struct part *part, int length)
if (!ALIGN_SPACES(&part->spaces, part->spaces_len, length))
return -1;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (!ALIGN_SPACES(&part->char_width, part->spaces_len, length))
return -1;
#endif
@ -379,7 +379,7 @@ get_format_screen_char(struct html_context *html_context,
return &schar_cache;
}
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
/* First possibly do the format change and then find out what coordinates
* to use since sub- or superscript might change them */
static inline int
@ -567,7 +567,7 @@ set_hline(struct html_context *html_context, unsigned char *chars, int charslen,
}
}
}
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
static void
move_links(struct html_context *html_context, int xf, int yf, int xt, int yt)
@ -799,7 +799,7 @@ split_line_at(struct html_context *html_context, int width)
if (part->document) {
assert(part->document->data);
if_assert_failed return 0;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (html_context->options->utf8
&& width < part->spaces_len && part->char_width[width] == 2) {
move_chars(html_context, width, part->cy, par_format.leftmargin, part->cy + 1);
@ -815,7 +815,7 @@ split_line_at(struct html_context *html_context, int width)
}
}
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (!(html_context->options->utf8
&& width < part->spaces_len
&& part->char_width[width] == 2))
@ -826,7 +826,7 @@ split_line_at(struct html_context *html_context, int width)
if (tmp > 0) {
/* 0 is possible and I'm paranoid ... --Zas */
memmove(part->spaces, part->spaces + width, tmp);
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
memmove(part->char_width, part->char_width + width, tmp);
#endif
}
@ -834,7 +834,7 @@ split_line_at(struct html_context *html_context, int width)
assert(tmp >= 0);
if_assert_failed tmp = 0;
memset(part->spaces + tmp, 0, width);
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
memset(part->char_width + tmp, 0, width);
#endif
@ -843,7 +843,7 @@ split_line_at(struct html_context *html_context, int width)
assertm(tmp > 0, "part->spaces_len - par_format.leftmargin == %d", tmp);
/* So tmp is zero, memmove() should survive that. Don't recover. */
memmove(part->spaces + par_format.leftmargin, part->spaces, tmp);
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
memmove(part->char_width + par_format.leftmargin, part->char_width, tmp);
#endif
}
@ -883,7 +883,7 @@ split_line(struct html_context *html_context)
assert(part);
if_assert_failed return 0;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (html_context->options->utf8) {
for (x = overlap(par_format); x >= par_format.leftmargin; x--) {
@ -1343,7 +1343,7 @@ done_link_state_info(void)
sizeof(renderer_context.link_state_info));
}
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
static inline void
process_link(struct html_context *html_context, enum link_state link_state,
unsigned char *chars, int charslen, int cells)
@ -1351,7 +1351,7 @@ process_link(struct html_context *html_context, enum link_state link_state,
static inline void
process_link(struct html_context *html_context, enum link_state link_state,
unsigned char *chars, int charslen)
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
{
struct part *part = html_context->part;
struct link *link;
@ -1403,9 +1403,9 @@ process_link(struct html_context *html_context, enum link_state link_state,
if (x_offset) {
charslen -= x_offset;
chars += x_offset;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
cells -= x_offset;
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
}
link = new_link(html_context, chars, charslen);
@ -1420,17 +1420,17 @@ process_link(struct html_context *html_context, enum link_state link_state,
}
/* Add new canvas positions to the link. */
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (realloc_points(link, link->npoints + cells))
#else
if (realloc_points(link, link->npoints + charslen))
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
{
struct point *point = &link->points[link->npoints];
int x = X(part->cx) + x_offset;
int y = Y(part->cy);
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
link->npoints += cells;
for (; cells > 0; cells--, point++, x++)
@ -1438,7 +1438,7 @@ process_link(struct html_context *html_context, enum link_state link_state,
link->npoints += charslen;
for (; charslen > 0; charslen--, point++, x++)
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
{
point->x = x;
point->y = y;
@ -1490,9 +1490,9 @@ put_chars(struct html_context *html_context, unsigned char *chars, int charslen)
{
enum link_state link_state;
struct part *part;
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
int cells;
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
assert(html_context);
if_assert_failed return;
@ -1551,21 +1551,21 @@ put_chars(struct html_context *html_context, unsigned char *chars, int charslen)
else if (html_context->options->links_numbering)
put_link_number(html_context);
}
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
cells =
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
set_hline(html_context, chars, charslen, link_state);
if (link_state != LINK_STATE_NONE) {
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
process_link(html_context, link_state, chars, charslen,
cells);
#else
process_link(html_context, link_state, chars, charslen);
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
}
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
if (renderer_context.nowrap
&& part->cx + cells > overlap(par_format))
return;
@ -1577,7 +1577,7 @@ put_chars(struct html_context *html_context, unsigned char *chars, int charslen)
return;
part->cx += charslen;
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
renderer_context.nobreak = 0;
@ -1594,11 +1594,11 @@ put_chars(struct html_context *html_context, unsigned char *chars, int charslen)
}
assert(charslen > 0);
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
part->xa += cells;
#else
part->xa += charslen;
#endif /* CONFIG_UTF_8 */
#endif /* CONFIG_UTF8 */
int_lower_bound(&part->max_width, part->xa
+ par_format.leftmargin + par_format.rightmargin
- (chars[charslen - 1] == ' '
@ -1657,7 +1657,7 @@ end:
part->cx = -1;
part->xa = 0;
memset(part->spaces, 0, part->spaces_len);
#ifdef CONFIG_UTF_8
#ifdef CONFIG_UTF8
memset(part->char_width, 0, part->spaces_len);
#endif
}
@ -2079,7 +2079,7 @@ format_html_part(struct html_context *html_context,
done_link_state_info();