1
0
mirror of https://github.com/rkd77/elinks.git synced 2025-01-03 14:57:44 -05:00

Merge with master

This commit is contained in:
Witold Filipczyk 2007-02-12 13:00:11 +01:00 committed by Witold Filipczyk
commit 8bb34f124f
75 changed files with 413 additions and 313 deletions

26
NEWS
View File

@ -34,7 +34,6 @@ roughly in decreasing order of importance.
- (enhancement) Reject invalid UTF-8 input from documents and - (enhancement) Reject invalid UTF-8 input from documents and
terminals. terminals.
* Changes in terminal support * Changes in terminal support
- (new feature) Support for pasting from GNU screen clipboard
- (enhancement) Make ELinks FreeBSD friendly. Defined keys used on - (enhancement) Make ELinks FreeBSD friendly. Defined keys used on
FreeBSD console FreeBSD console
- (enhancement) Mouse wheel support on BSD via moused -z 4 - (enhancement) Mouse wheel support on BSD via moused -z 4
@ -67,12 +66,12 @@ roughly in decreasing order of importance.
- (enhancement) Tell the user how to move bookmarks. - (enhancement) Tell the user how to move bookmarks.
- (bugfix) Fix crash when moving bookmarks out of a folder. - (bugfix) Fix crash when moving bookmarks out of a folder.
- (bugfix) Fixed crash if XBEL bookmark has no title - (bugfix) Fixed crash if XBEL bookmark has no title
- (bugfix 886) If the user edits or deletes a cookie, mark the - (bugfix 886, 872) If the user edits or deletes a cookie, mark the
cookie list as needing to be saved. cookie list as needing to be saved.
- (enhancement 887) Save in cookie manager should save cookies even - (enhancement 887) Save in cookie manager should save cookies even
if unmodified. if unmodified.
* Changes in the user interface * Changes in the user interface
- (new feature) Internal clipboard support - (new feature 145) Internal clipboard support
- (enhancement) Place the cursor on the current listbox item, to - (enhancement) Place the cursor on the current listbox item, to
help screen readers help screen readers
- (enhancement) Localization updates - (enhancement) Localization updates
@ -81,7 +80,7 @@ roughly in decreasing order of importance.
- (new feature) Autocreate directories needed to download a file. - (new feature) Autocreate directories needed to download a file.
- (new feature) Option ui.show_menu_bar_always - (new feature) Option ui.show_menu_bar_always
- (new feature) Option ui.tabs moves the tab bar to the top. - (new feature) Option ui.tabs moves the tab bar to the top.
- (bugfix) Fix searching in menus past unselectable items. - (bugfix 24) Fix searching in menus past unselectable items.
- (bugfix) Fix crash with empty File extensions menu. - (bugfix) Fix crash with empty File extensions menu.
- (new feature) New actions: kill-word-back, move-backward-word, - (new feature) New actions: kill-word-back, move-backward-word,
move-forward-word move-forward-word
@ -92,8 +91,8 @@ roughly in decreasing order of importance.
- (bugfix 396) Never show empty filename in the what-to-do dialog - (bugfix 396) Never show empty filename in the what-to-do dialog
* Changes in support for URI schemes, protocols, caching, and encodings * Changes in support for URI schemes, protocols, caching, and encodings
- (workaround 841) SMB is now disabled because of CVE-2006-5925. - (workaround 841) SMB is now disabled because of CVE-2006-5925.
- (new feature) Native FSP protocol support (replaces CGI program in - (new feature 630) Native FSP protocol support (replaces CGI
contrib/fsp/) program in contrib/fsp/)
- (new feature) Local CGI - (new feature) Local CGI
- (experimental, bugfix) Gopher changes, including crash fixes - (experimental, bugfix) Gopher changes, including crash fixes
- (enhancement) FTP handler parses file sizes better - (enhancement) FTP handler parses file sizes better
@ -135,13 +134,11 @@ roughly in decreasing order of importance.
* Changes in parsing and rendering of non-HTML content-types * Changes in parsing and rendering of non-HTML content-types
- (new feature) If a mailcap entry indicates copiousoutput, ELinks - (new feature) If a mailcap entry indicates copiousoutput, ELinks
itself acts as a pager. itself acts as a pager.
- (new feature) Let plain text change colors with ESC [ 31 m or
similar control sequences.
* Changes in the document viewer and tabs * Changes in the document viewer and tabs
- (new feature) Highlight links as one enters link prefixes. - (new feature) Highlight links as one enters link prefixes.
- (new feature) Backspace backs out the last digit of the prefix. - (new feature) Backspace backs out the last digit of the prefix.
- (bugfix) Tabs opened by -remote now go behind existing dialogs. - (bugfix) Tabs opened by -remote now go behind existing dialogs.
- (new feature) -dump-color-mode - (new feature 622) -dump-color-mode
- (bugfix) Fix accesskeys so that they work when priority is 0 - (bugfix) Fix accesskeys so that they work when priority is 0
- (enhancement) Text type-ahead searching: don't follow current link - (enhancement) Text type-ahead searching: don't follow current link
on enter on enter
@ -239,7 +236,7 @@ have already been considered.
- (bugfix) Fix a crash when adding a server in the cookie manager. - (bugfix) Fix a crash when adding a server in the cookie manager.
- (bugfix) cookies: "Add Server" ignores "cookies.accept_policy". - (bugfix) cookies: "Add Server" ignores "cookies.accept_policy".
- (bugfix) Fix data: protocol. - (bugfix) Fix data: protocol.
- (bugfix) Properly deselect the main menu instead of crashing - (bugfix 747) Properly deselect the main menu instead of crashing
- (bugfix 778) ELinks crashes on binary files when - (bugfix 778) ELinks crashes on binary files when
document.plain.display_links is set document.plain.display_links is set
- (bugfix 784) UTF-8 mode misconverts non-ASCII entity in Latin-1 - (bugfix 784) UTF-8 mode misconverts non-ASCII entity in Latin-1
@ -258,6 +255,11 @@ have already been considered.
- (bugfix 826) too small table for double-cell characters - (bugfix 826) too small table for double-cell characters
- (bugfix 902) crash: "overflow detected realloc()" in realloc_line - (bugfix 902) crash: "overflow detected realloc()" in realloc_line
- (bugfix 912) wrong color in one cell of an HTML input field - (bugfix 912) wrong color in one cell of an HTML input field
- (bugfix 835) Text in textarea is unaffected by horizontal
scrolling of document in UTF-8 mode
- (bugfix 823) Big textarea is too slow with CONFIG_UTF8
- (bugfix 754) Pressing ESC do not pop up main menu anymore.
- (bugfix 794) tab-close-all-but-current crashes
* Reverted changes: * Reverted changes:
- (new feature) document.write, reverted in - (new feature) document.write, reverted in
2c087e52e74528a720621186b91880463e039d50 2c087e52e74528a720621186b91880463e039d50
@ -265,6 +267,10 @@ have already been considered.
in 10d72cae7eafa6b90db1c8f303deb200555734c2 in 10d72cae7eafa6b90db1c8f303deb200555734c2
- (enhancement) wcwidth, reverted in - (enhancement) wcwidth, reverted in
d050cb67aa37390ab938b0a308c7541f19578506 d050cb67aa37390ab938b0a308c7541f19578506
- (new feature) Let plain text change colors with ESC [ 31 m or
similar control sequences, reverted in
2a6125e3d0407b588eb286d4d0ff5c98c23ebda9
- (enhancement) Support for pasting from GNU screen clipboard
* Unimportant changes: * Unimportant changes:
- (enhancement) If select fails, save its errno. - (enhancement) If select fails, save its errno.

View File

@ -147,14 +147,14 @@ Window$ 1250
0x7E 0x007E #TILDE 0x7E 0x007E #TILDE
0x7F 0x007F #DELETE 0x7F 0x007F #DELETE
0x80 0x20AC #EURO SIGN 0x80 0x20AC #EURO SIGN
0x81 0x0000 #UNDEFINED 0x81 #UNDEFINED
0x82 0x201A #SINGLE LOW-9 QUOTATION MARK 0x82 0x201A #SINGLE LOW-9 QUOTATION MARK
0x83 0x0000 #UNDEFINED 0x83 #UNDEFINED
0x84 0x201E #DOUBLE LOW-9 QUOTATION MARK 0x84 0x201E #DOUBLE LOW-9 QUOTATION MARK
0x85 0x2026 #HORIZONTAL ELLIPSIS 0x85 0x2026 #HORIZONTAL ELLIPSIS
0x86 0x2020 #DAGGER 0x86 0x2020 #DAGGER
0x87 0x2021 #DOUBLE DAGGER 0x87 0x2021 #DOUBLE DAGGER
0x88 0x0000 #UNDEFINED 0x88 #UNDEFINED
0x89 0x2030 #PER MILLE SIGN 0x89 0x2030 #PER MILLE SIGN
0x8A 0x0160 #LATIN CAPITAL LETTER S WITH CARON 0x8A 0x0160 #LATIN CAPITAL LETTER S WITH CARON
0x8B 0x2039 #SINGLE LEFT-POINTING ANGLE QUOTATION MARK 0x8B 0x2039 #SINGLE LEFT-POINTING ANGLE QUOTATION MARK
@ -162,7 +162,7 @@ Window$ 1250
0x8D 0x0164 #LATIN CAPITAL LETTER T WITH CARON 0x8D 0x0164 #LATIN CAPITAL LETTER T WITH CARON
0x8E 0x017D #LATIN CAPITAL LETTER Z WITH CARON 0x8E 0x017D #LATIN CAPITAL LETTER Z WITH CARON
0x8F 0x0179 #LATIN CAPITAL LETTER Z WITH ACUTE 0x8F 0x0179 #LATIN CAPITAL LETTER Z WITH ACUTE
0x90 0x0000 #UNDEFINED 0x90 #UNDEFINED
0x91 0x2018 #LEFT SINGLE QUOTATION MARK 0x91 0x2018 #LEFT SINGLE QUOTATION MARK
0x92 0x2019 #RIGHT SINGLE QUOTATION MARK 0x92 0x2019 #RIGHT SINGLE QUOTATION MARK
0x93 0x201C #LEFT DOUBLE QUOTATION MARK 0x93 0x201C #LEFT DOUBLE QUOTATION MARK
@ -170,7 +170,7 @@ Window$ 1250
0x95 0x2022 #BULLET 0x95 0x2022 #BULLET
0x96 0x2013 #EN DASH 0x96 0x2013 #EN DASH
0x97 0x2014 #EM DASH 0x97 0x2014 #EM DASH
0x98 0x0000 #UNDEFINED 0x98 #UNDEFINED
0x99 0x2122 #TRADE MARK SIGN 0x99 0x2122 #TRADE MARK SIGN
0x9A 0x0161 #LATIN SMALL LETTER S WITH CARON 0x9A 0x0161 #LATIN SMALL LETTER S WITH CARON
0x9B 0x203A #SINGLE RIGHT-POINTING ANGLE QUOTATION MARK 0x9B 0x203A #SINGLE RIGHT-POINTING ANGLE QUOTATION MARK

View File

@ -23,22 +23,22 @@ Window$ 1257
0x20-0x7e idem 0x20-0x7e idem
# #
0x80 0x20AC #EURO SIGN 0x80 0x20AC #EURO SIGN
0x81 0x0000 #UNDEFINED 0x81 #UNDEFINED
0x82 0x201A #SINGLE LOW-9 QUOTATION MARK 0x82 0x201A #SINGLE LOW-9 QUOTATION MARK
0x83 0x0000 #UNDEFINED 0x83 #UNDEFINED
0x84 0x201E #DOUBLE LOW-9 QUOTATION MARK 0x84 0x201E #DOUBLE LOW-9 QUOTATION MARK
0x85 0x2026 #HORIZONTAL ELLIPSIS 0x85 0x2026 #HORIZONTAL ELLIPSIS
0x86 0x2020 #DAGGER 0x86 0x2020 #DAGGER
0x87 0x2021 #DOUBLE DAGGER 0x87 0x2021 #DOUBLE DAGGER
0x88 0x0000 #UNDEFINED 0x88 #UNDEFINED
0x89 0x2030 #PER MILLE SIGN 0x89 0x2030 #PER MILLE SIGN
0x8A 0x0000 #UNDEFINED 0x8A #UNDEFINED
0x8B 0x2039 #SINGLE LEFT-POINTING ANGLE QUOTATION MARK 0x8B 0x2039 #SINGLE LEFT-POINTING ANGLE QUOTATION MARK
0x8C 0x0000 #UNDEFINED 0x8C #UNDEFINED
0x8D 0x00A8 #DIAERESIS 0x8D 0x00A8 #DIAERESIS
0x8E 0x02C7 #CARON 0x8E 0x02C7 #CARON
0x8F 0x00B8 #CEDILLA 0x8F 0x00B8 #CEDILLA
0x90 0x0000 #UNDEFINED 0x90 #UNDEFINED
0x91 0x2018 #LEFT SINGLE QUOTATION MARK 0x91 0x2018 #LEFT SINGLE QUOTATION MARK
0x92 0x2019 #RIGHT SINGLE QUOTATION MARK 0x92 0x2019 #RIGHT SINGLE QUOTATION MARK
0x93 0x201C #LEFT DOUBLE QUOTATION MARK 0x93 0x201C #LEFT DOUBLE QUOTATION MARK
@ -46,20 +46,20 @@ Window$ 1257
0x95 0x2022 #BULLET 0x95 0x2022 #BULLET
0x96 0x2013 #EN DASH 0x96 0x2013 #EN DASH
0x97 0x2014 #EM DASH 0x97 0x2014 #EM DASH
0x98 0x0000 #UNDEFINED 0x98 #UNDEFINED
0x99 0x2122 #TRADE MARK SIGN 0x99 0x2122 #TRADE MARK SIGN
0x9A 0x0000 #UNDEFINED 0x9A #UNDEFINED
0x9B 0x203A #SINGLE RIGHT-POINTING ANGLE QUOTATION MARK 0x9B 0x203A #SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
0x9C 0x0000 #UNDEFINED 0x9C #UNDEFINED
0x9D 0x00AF #MACRON 0x9D 0x00AF #MACRON
0x9E 0x02DB #OGONEK 0x9E 0x02DB #OGONEK
0x9F 0x0000 #UNDEFINED 0x9F #UNDEFINED
0xA0 0x00A0 #NO-BREAK SPACE 0xA0 0x00A0 #NO-BREAK SPACE
0xA1 0x0000 #UNDEFINED 0xA1 #UNDEFINED
0xA2 0x00A2 #CENT SIGN 0xA2 0x00A2 #CENT SIGN
0xA3 0x00A3 #POUND SIGN 0xA3 0x00A3 #POUND SIGN
0xA4 0x00A4 #CURRENCY SIGN 0xA4 0x00A4 #CURRENCY SIGN
0xA5 0x0000 #UNDEFINED 0xA5 #UNDEFINED
0xA6 0x00A6 #BROKEN BAR 0xA6 0x00A6 #BROKEN BAR
0xA7 0x00A7 #SECTION SIGN 0xA7 0x00A7 #SECTION SIGN
0xA8 0x00D8 #LATIN CAPITAL LETTER O WITH STROKE 0xA8 0x00D8 #LATIN CAPITAL LETTER O WITH STROKE

View File

@ -8,7 +8,7 @@ N=`cat tmp | wc -l`
echo '/* Automatically generated by gen-7b */' echo '/* Automatically generated by gen-7b */'
echo '/* DO NOT EDIT THIS FILE! EDIT Unicode/7bitrepl.lnx INSTEAD! */' echo '/* DO NOT EDIT THIS FILE! EDIT Unicode/7bitrepl.lnx INSTEAD! */'
echo echo
echo 'struct { unicode_val_T x; unsigned char *s; } unicode_7b ['`expr $N + 1`'] = {' echo 'static const struct { unicode_val_T x; unsigned char *s; } unicode_7b ['`expr $N + 1`'] = {'
sort tmp | sed 's/\\/\\\\/g' | sed 's/"/\\"/g' | sed 's/^/ {/' | sed 's/:/, "/' | sed 's/$/"},/' sort tmp | sed 's/\\/\\\\/g' | sed 's/"/\\"/g' | sed 's/^/ {/' | sed 's/:/, "/' | sed 's/$/"},/'
echo ' {-1, NULL}' echo ' {-1, NULL}'
echo '};' echo '};'

View File

@ -23,17 +23,29 @@ for i in $codepages; do
echo "/*** $i ***/" echo "/*** $i ***/"
echo echo
sed '1,2d sed ' # Delete the name and aliases lines.
1,2d
# Delete comment-only and blank lines.
/^[ ]*\(#.*\)\{,1\}$/d /^[ ]*\(#.*\)\{,1\}$/d
# Copy to the hold space.
h h
# Delete everything except the comment.
s/^[^#]*// s/^[^#]*//
# If there is a comment, change it to use /* */ delimiters.
s!#[ ]*\(.*\)!/* \1 */! s!#[ ]*\(.*\)!/* \1 */!
# Exchange spaces; now hold space = comment and pattern space = all.
x x
# Delete the comment.
s/#.*// s/#.*//
# Canonicalize case so the strings can be used as lookup keys.
y/Xabcdef/xABCDEF/ y/Xabcdef/xABCDEF/
# Delete mappings of bytes 0x00...0x7F. ELinks assumes those match ASCII.
/^0x[01234567]/d /^0x[01234567]/d
/[^0x0123456789ABCDEF ]/d # Delete lines that do not map the byte to exactly one character.
/^[ ]*0x[0123456789ABCDEF]\{2\}[ ]\{1,\}0x[0123456789ABCDEF]\{1,\}[ ]*$/!d
# Append a newline and the comment from the hold space.
G G
# Delete the newline added by the previous command.
s/\n//' "$i.cp" | { s/\n//' "$i.cp" | {
for left in 8 9 A B C D E F; do for left in 8 9 A B C D E F; do
for right in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do for right in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do

View File

@ -16,7 +16,7 @@ N=`cat tmp | wc -l`
cat > ../src/intl/entity.inc <<EOF cat > ../src/intl/entity.inc <<EOF
/* Automatically generated by gen-ent */ /* Automatically generated by gen-ent */
struct entity { char *s; unicode_val_T c; } entities [$(expr $N + 1)] = { static const struct entity { char *s; unicode_val_T c; } entities [$(expr $N + 1)] = {
$(cat tmp) $(cat tmp)
{ NULL, 0 } { NULL, 0 }
}; };

View File

@ -32,9 +32,9 @@ where:
<keystroke>:: <keystroke>::
is a case sensitive key, which you can prefix with 'Ctrl-' or 'Alt-'. is a case sensitive key, which you can prefix with 'Ctrl-', 'Alt-',
'Ctrl-' must be followed by an uppercase key. See below for a list of or both. 'Ctrl-' must be followed by an uppercase key. See below for
valid keys. a list of valid keys.
<action>:: <action>::

View File

@ -34,7 +34,12 @@ have the following libraries and programs installed:
Dependency Description Dependency Description
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
Lua or Guile Makes it possible to write scripting plugins. \ Lua or Guile Makes it possible to write scripting plugins. \
ifdef::installation-webpage[]
See link:manual.html#lua-scripting[the Elinks - Lua interface] \
endif::installation-webpage[]
ifndef::installation-webpage[]
See <<lua-scripting,the Elinks - Lua interface>> \ See <<lua-scripting,the Elinks - Lua interface>> \
endif::installation-webpage[]
for more info. for more info.
GNU zip For handling compressed documents both locally and \ GNU zip For handling compressed documents both locally and \
sent from server. sent from server.
@ -50,7 +55,12 @@ xterm with 256 colors Program atleast patch level 179 or rxvt program \
libidn For internationalized domain names. libidn For internationalized domain names.
SpiderMonkey Mozilla's JavaScript engine for getting \ SpiderMonkey Mozilla's JavaScript engine for getting \
JavaScript/ECMAScript support in ELinks. \ JavaScript/ECMAScript support in ELinks. \
ifdef::installation-webpage[]
See also link:manual.html#ecmascript[notes on ECMAScript support].
endif::installation-webpage[]
ifndef::installation-webpage[]
See also <<ecmascript,notes on ECMAScript support>>. See also <<ecmascript,notes on ECMAScript support>>.
endif::installation-webpage[]
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
When compiling, you also need the header files for the libraries. Most OS When compiling, you also need the header files for the libraries. Most OS

View File

@ -6,8 +6,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: ELinks 0.12.GIT\n" "Project-Id-Version: ELinks 0.12.GIT\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-01-10 09:16+0100\n" "POT-Creation-Date: 2007-01-25 13:58+0100\n"
"PO-Revision-Date: 2007-01-10 09:18+0100\n" "PO-Revision-Date: 2007-01-25 14:00+0100\n"
"Last-Translator: Laurent Monin <zas@norz.org>\n" "Last-Translator: Laurent Monin <zas@norz.org>\n"
"Language-Team: French <zas@norz.org>\n" "Language-Team: French <zas@norz.org>\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -33,7 +33,7 @@ msgstr "Pressez espace pour d
#. accelerator_context(do_auth_dialog, do_edit_dialog, generic_external_protocol_handler, info_box, input_dialog, menu_add_ext, menu_keys, push_hierbox_info_button, python_info_box, refreshed_msg_box, resize_terminal_dialog, setup_first_session, src/config/dialogs.c:build_edit_dialog, src/cookies/dialogs.c:build_edit_dialog, src/cookies/dialogs.c:push_add_server_button, src/scripting/lua/core.c:l_edit_bookmark_dialog, src/scripting/lua/core.c:l_xdialog, src/viewer/text/search.c:search_dlg_do, terminal_options, write_config_dialog) #. accelerator_context(do_auth_dialog, do_edit_dialog, generic_external_protocol_handler, info_box, input_dialog, menu_add_ext, menu_keys, push_hierbox_info_button, python_info_box, refreshed_msg_box, resize_terminal_dialog, setup_first_session, src/config/dialogs.c:build_edit_dialog, src/cookies/dialogs.c:build_edit_dialog, src/cookies/dialogs.c:push_add_server_button, src/scripting/lua/core.c:l_edit_bookmark_dialog, src/scripting/lua/core.c:l_xdialog, src/viewer/text/search.c:search_dlg_do, terminal_options, write_config_dialog)
#: src/bfu/hierbox.c:441 src/bfu/inpfield.c:256 src/bfu/msgbox.c:173 #: src/bfu/hierbox.c:441 src/bfu/inpfield.c:256 src/bfu/msgbox.c:173
#: src/bfu/msgbox.c:191 src/config/dialogs.c:58 src/config/dialogs.c:363 #: src/bfu/msgbox.c:191 src/config/dialogs.c:58 src/config/dialogs.c:363
#: src/cookies/dialogs.c:357 src/cookies/dialogs.c:455 src/dialogs/edit.c:98 #: src/cookies/dialogs.c:359 src/cookies/dialogs.c:457 src/dialogs/edit.c:98
#: src/dialogs/info.c:134 src/dialogs/options.c:234 src/dialogs/options.c:315 #: src/dialogs/info.c:134 src/dialogs/options.c:234 src/dialogs/options.c:315
#: src/mime/dialogs.c:131 src/protocol/auth/dialogs.c:115 #: src/mime/dialogs.c:131 src/protocol/auth/dialogs.c:115
#: src/protocol/protocol.c:236 src/scripting/lua/core.c:390 #: src/protocol/protocol.c:236 src/scripting/lua/core.c:390
@ -146,7 +146,7 @@ msgid "Search string '%s' not found"
msgstr "Chaîne recherchée '%s' introuvable" msgstr "Chaîne recherchée '%s' introuvable"
#: src/bfu/hierbox.c:970 src/config/dialogs.c:139 src/config/dialogs.c:329 #: src/bfu/hierbox.c:970 src/config/dialogs.c:139 src/config/dialogs.c:329
#: src/config/dialogs.c:477 src/cookies/dialogs.c:34 src/cookies/dialogs.c:351 #: src/config/dialogs.c:477 src/cookies/dialogs.c:34 src/cookies/dialogs.c:353
#: src/dialogs/edit.c:92 src/dialogs/edit.c:94 src/scripting/lua/core.c:386 #: src/dialogs/edit.c:92 src/dialogs/edit.c:94 src/scripting/lua/core.c:386
#: src/scripting/lua/core.c:387 src/scripting/lua/core.c:468 #: src/scripting/lua/core.c:387 src/scripting/lua/core.c:468
msgid "Name" msgid "Name"
@ -174,8 +174,8 @@ msgid "Empty string not allowed"
msgstr "Chaîne vide non autorisée" msgstr "Chaîne vide non autorisée"
#. accelerator_context(do_auth_dialog, do_edit_dialog, input_dialog, menu_add_ext, resize_terminal_dialog, src/config/dialogs.c:build_edit_dialog, src/cookies/dialogs.c:build_edit_dialog, src/cookies/dialogs.c:push_add_server_button, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/scripting/lua/core.c:l_edit_bookmark_dialog, src/scripting/lua/core.c:l_xdialog, src/session/download.c:do_type_query, src/session/download.c:lookup_unique_name, src/viewer/text/search.c:search_dlg_do, terminal_options) #. accelerator_context(do_auth_dialog, do_edit_dialog, input_dialog, menu_add_ext, resize_terminal_dialog, src/config/dialogs.c:build_edit_dialog, src/cookies/dialogs.c:build_edit_dialog, src/cookies/dialogs.c:push_add_server_button, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/scripting/lua/core.c:l_edit_bookmark_dialog, src/scripting/lua/core.c:l_xdialog, src/session/download.c:do_type_query, src/session/download.c:lookup_unique_name, src/viewer/text/search.c:search_dlg_do, terminal_options)
#: src/bfu/inpfield.c:256 src/config/dialogs.c:364 src/cookies/dialogs.c:358 #: src/bfu/inpfield.c:256 src/config/dialogs.c:364 src/cookies/dialogs.c:360
#: src/cookies/dialogs.c:456 src/dialogs/edit.c:102 src/dialogs/edit.c:105 #: src/cookies/dialogs.c:458 src/dialogs/edit.c:102 src/dialogs/edit.c:105
#: src/dialogs/options.c:237 src/dialogs/options.c:316 src/mime/dialogs.c:132 #: src/dialogs/options.c:237 src/dialogs/options.c:316 src/mime/dialogs.c:132
#: src/protocol/auth/dialogs.c:116 src/protocol/bittorrent/dialogs.c:812 #: src/protocol/auth/dialogs.c:116 src/protocol/bittorrent/dialogs.c:812
#: src/scripting/lua/core.c:391 src/scripting/lua/core.c:472 #: src/scripting/lua/core.c:391 src/scripting/lua/core.c:472
@ -478,13 +478,13 @@ msgstr "A~ller
#. accelerator_context(src/bookmarks/dialogs.c:bookmark_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons) #. accelerator_context(src/bookmarks/dialogs.c:bookmark_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons)
#: src/bookmarks/dialogs.c:488 src/config/dialogs.c:501 #: src/bookmarks/dialogs.c:488 src/config/dialogs.c:501
#: src/cookies/dialogs.c:477 #: src/cookies/dialogs.c:479
msgid "~Edit" msgid "~Edit"
msgstr "~Modifier" msgstr "~Modifier"
#. accelerator_context(src/bookmarks/dialogs.c:bookmark_buttons, src/cache/dialogs.c:cache_buttons, src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/dialogs/menu.c:ext_menu, src/formhist/dialogs.c:formhist_buttons, src/globhist/dialogs.c:globhist_buttons, src/protocol/auth/dialogs.c:auth_buttons) #. accelerator_context(src/bookmarks/dialogs.c:bookmark_buttons, src/cache/dialogs.c:cache_buttons, src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/dialogs/menu.c:ext_menu, src/formhist/dialogs.c:formhist_buttons, src/globhist/dialogs.c:globhist_buttons, src/protocol/auth/dialogs.c:auth_buttons)
#: src/bookmarks/dialogs.c:489 src/cache/dialogs.c:231 #: src/bookmarks/dialogs.c:489 src/cache/dialogs.c:231
#: src/config/dialogs.c:503 src/config/dialogs.c:930 src/cookies/dialogs.c:478 #: src/config/dialogs.c:503 src/config/dialogs.c:930 src/cookies/dialogs.c:480
#: src/dialogs/menu.c:457 src/formhist/dialogs.c:211 #: src/dialogs/menu.c:457 src/formhist/dialogs.c:211
#: src/globhist/dialogs.c:229 src/protocol/auth/dialogs.c:263 #: src/globhist/dialogs.c:229 src/protocol/auth/dialogs.c:263
msgid "~Delete" msgid "~Delete"
@ -492,7 +492,7 @@ msgstr "~Supprimer"
#. accelerator_context(src/bookmarks/dialogs.c:bookmark_buttons, src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/dialogs/menu.c:ext_menu) #. accelerator_context(src/bookmarks/dialogs.c:bookmark_buttons, src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/dialogs/menu.c:ext_menu)
#: src/bookmarks/dialogs.c:490 src/config/dialogs.c:502 #: src/bookmarks/dialogs.c:490 src/config/dialogs.c:502
#: src/config/dialogs.c:929 src/cookies/dialogs.c:475 src/dialogs/menu.c:455 #: src/config/dialogs.c:929 src/cookies/dialogs.c:477 src/dialogs/menu.c:455
msgid "~Add" msgid "~Add"
msgstr "~Ajouter" msgstr "~Ajouter"
@ -599,7 +599,7 @@ msgid "invalid"
msgstr "invalide" msgstr "invalide"
#: src/cache/dialogs.c:125 src/cookies/dialogs.c:40 src/cookies/dialogs.c:44 #: src/cache/dialogs.c:125 src/cookies/dialogs.c:40 src/cookies/dialogs.c:44
#: src/cookies/dialogs.c:354 #: src/cookies/dialogs.c:356
msgid "Expires" msgid "Expires"
msgstr "Expiration" msgstr "Expiration"
@ -645,7 +645,7 @@ msgid "Delete this cache entry?"
msgstr "Supprimer cette entrée de cache ?" msgstr "Supprimer cette entrée de cache ?"
#. accelerator_context(display_download, src/cache/dialogs.c:cache_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/dialogs/download.c:download_buttons, src/formhist/dialogs.c:formhist_buttons, src/globhist/dialogs.c:globhist_buttons, src/protocol/auth/dialogs.c:auth_buttons) #. accelerator_context(display_download, src/cache/dialogs.c:cache_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/dialogs/download.c:download_buttons, src/formhist/dialogs.c:formhist_buttons, src/globhist/dialogs.c:globhist_buttons, src/protocol/auth/dialogs.c:auth_buttons)
#: src/cache/dialogs.c:229 src/config/dialogs.c:500 src/cookies/dialogs.c:474 #: src/cache/dialogs.c:229 src/config/dialogs.c:500 src/cookies/dialogs.c:476
#: src/dialogs/download.c:255 src/dialogs/download.c:492 #: src/dialogs/download.c:255 src/dialogs/download.c:492
#: src/formhist/dialogs.c:210 src/globhist/dialogs.c:225 #: src/formhist/dialogs.c:210 src/globhist/dialogs.c:225
#: src/protocol/auth/dialogs.c:262 #: src/protocol/auth/dialogs.c:262
@ -1827,7 +1827,7 @@ msgid "Type"
msgstr "Type" msgstr "Type"
#: src/config/dialogs.c:172 src/config/dialogs.c:359 src/cookies/dialogs.c:35 #: src/config/dialogs.c:172 src/config/dialogs.c:359 src/cookies/dialogs.c:35
#: src/cookies/dialogs.c:352 #: src/cookies/dialogs.c:354
msgid "Value" msgid "Value"
msgstr "Valeur" msgstr "Valeur"
@ -1860,7 +1860,7 @@ msgstr "Erreur"
msgid "Bad option value." msgid "Bad option value."
msgstr "Mauvaise valeur." msgstr "Mauvaise valeur."
#: src/config/dialogs.c:320 src/config/dialogs.c:388 src/cookies/dialogs.c:324 #: src/config/dialogs.c:320 src/config/dialogs.c:388 src/cookies/dialogs.c:325
msgid "Edit" msgid "Edit"
msgstr "Modifier" msgstr "Modifier"
@ -1890,7 +1890,7 @@ msgid "Cannot add an option here."
msgstr "Impossible d'ajouter une option ici." msgstr "Impossible d'ajouter une option ici."
#. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options) #. accelerator_context(src/config/dialogs.c:keybinding_buttons, src/config/dialogs.c:option_buttons, src/cookies/dialogs.c:cookie_buttons, src/formhist/dialogs.c:formhist_buttons, src/protocol/bittorrent/dialogs.c:bittorrent_query_callback, src/session/download.c:do_type_query, terminal_options)
#: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:480 #: src/config/dialogs.c:505 src/config/dialogs.c:933 src/cookies/dialogs.c:482
#: src/dialogs/options.c:236 src/formhist/dialogs.c:214 #: src/dialogs/options.c:236 src/formhist/dialogs.c:214
#: src/protocol/bittorrent/dialogs.c:799 src/session/download.c:1227 #: src/protocol/bittorrent/dialogs.c:799 src/session/download.c:1227
msgid "Sa~ve" msgid "Sa~ve"
@ -3705,7 +3705,7 @@ msgstr ""
"1 mode 16 couleurs, utilise les couleurs ANSI\n" "1 mode 16 couleurs, utilise les couleurs ANSI\n"
"2 mode 88 couleurs, utilise les codes RVB d'XTerm\n" "2 mode 88 couleurs, utilise les codes RVB d'XTerm\n"
"3 mode 256 couleurs, utilise les codes RVB d'XTerm\n" "3 mode 256 couleurs, utilise les codes RVB d'XTerm\n"
"4 mode vraies couleurs, utilise les codes RVB de konsole." "4 mode vraies couleurs, utilise les codes RVB de konsole"
#: src/config/options.inc:876 src/dialogs/options.c:230 #: src/config/options.inc:876 src/dialogs/options.c:230
msgid "Transparency" msgid "Transparency"
@ -4605,7 +4605,7 @@ msgstr "ELinks a
msgid "ELinks was started with the -anonymous option." msgid "ELinks was started with the -anonymous option."
msgstr "ELinks a été démarré avec l'option -anonymous." msgstr "ELinks a été démarré avec l'option -anonymous."
#: src/cookies/dialogs.c:36 src/cookies/dialogs.c:353 #: src/cookies/dialogs.c:36 src/cookies/dialogs.c:355
msgid "Domain" msgid "Domain"
msgstr "Domaine" msgstr "Domaine"
@ -4618,7 +4618,7 @@ msgstr "Chemin"
msgid "at quit time" msgid "at quit time"
msgstr "au moment de quitter" msgstr "au moment de quitter"
#: src/cookies/dialogs.c:49 src/cookies/dialogs.c:355 #: src/cookies/dialogs.c:49 src/cookies/dialogs.c:357
msgid "Secure" msgid "Secure"
msgstr "Sécurisé" msgstr "Sécurisé"
@ -4649,7 +4649,7 @@ msgstr "~Accepter"
msgid "~Reject" msgid "~Reject"
msgstr "~Rejeter" msgstr "~Rejeter"
#: src/cookies/dialogs.c:149 src/cookies/dialogs.c:343 #: src/cookies/dialogs.c:149 src/cookies/dialogs.c:345
#: src/dialogs/document.c:177 #: src/dialogs/document.c:177
msgid "Server" msgid "Server"
msgstr "Serveur" msgstr "Serveur"
@ -4720,26 +4720,26 @@ msgstr "Effacer tous les cookies"
msgid "Do you really want to remove all cookies?" msgid "Do you really want to remove all cookies?"
msgstr "Êtes-vous sûr de vouloir effacer tous les cookies ?" msgstr "Êtes-vous sûr de vouloir effacer tous les cookies ?"
#: src/cookies/dialogs.c:449 #: src/cookies/dialogs.c:451
msgid "Add server" msgid "Add server"
msgstr "Ajouter un serveur" msgstr "Ajouter un serveur"
#: src/cookies/dialogs.c:453 #: src/cookies/dialogs.c:455
msgid "Server name" msgid "Server name"
msgstr "Nom du serveur" msgstr "Nom du serveur"
#. accelerator_context(src/cookies/dialogs.c:cookie_buttons) #. accelerator_context(src/cookies/dialogs.c:cookie_buttons)
#: src/cookies/dialogs.c:476 #: src/cookies/dialogs.c:478
msgid "Add ~server" msgid "Add ~server"
msgstr "Ajouter un ser~veur" msgstr "Ajouter un ser~veur"
#. accelerator_context(do_edit_dialog, src/cookies/dialogs.c:cookie_buttons, src/dialogs/download.c:download_buttons, src/globhist/dialogs.c:globhist_buttons, src/protocol/auth/dialogs.c:auth_buttons) #. accelerator_context(do_edit_dialog, src/cookies/dialogs.c:cookie_buttons, src/dialogs/download.c:download_buttons, src/globhist/dialogs.c:globhist_buttons, src/protocol/auth/dialogs.c:auth_buttons)
#: src/cookies/dialogs.c:479 src/dialogs/download.c:498 src/dialogs/edit.c:99 #: src/cookies/dialogs.c:481 src/dialogs/download.c:498 src/dialogs/edit.c:99
#: src/globhist/dialogs.c:232 src/protocol/auth/dialogs.c:264 #: src/globhist/dialogs.c:232 src/protocol/auth/dialogs.c:264
msgid "C~lear" msgid "C~lear"
msgstr "~Effacer" msgstr "~Effacer"
#: src/cookies/dialogs.c:485 #: src/cookies/dialogs.c:487
msgid "Cookie manager" msgid "Cookie manager"
msgstr "Gestionnaire de cookies" msgstr "Gestionnaire de cookies"
@ -5957,7 +5957,7 @@ msgstr ""
"1 afficher les titres des pages" "1 afficher les titres des pages"
#. name: #. name:
#: src/globhist/globhist.c:448 #: src/globhist/globhist.c:449
msgid "Global History" msgid "Global History"
msgstr "Historique Global" msgstr "Historique Global"

View File

@ -38,6 +38,13 @@ vernum.o: $(LIB_O_NAME)
elinks: $(LIB_O_NAME) vernum.o elinks: $(LIB_O_NAME) vernum.o
$(call cmd,link) $(call cmd,link)
TAGS:
find $(srcdir). -name "*.[ch]" -print \
| etags --regex='{c}/INIT_LIST_HEAD(\([[:alnum:]_]+\))/\1/' \
--regex='{c}/struct_hierbox_browser(\n[ \t]*\([[:alnum:]_]+\),/\1/m' \
-
.PHONY: TAGS
PROGS = elinks PROGS = elinks
CLEAN = vernum.o CLEAN = vernum.o

View File

@ -36,7 +36,7 @@
#ifdef DEBUG_BUTTON_HOTKEY #ifdef DEBUG_BUTTON_HOTKEY
void void
add_dlg_button_do(unsigned char *file, int line, add_dlg_button_do(const unsigned char *file, int line,
struct dialog *dlg, unsigned char *text, int flags, struct dialog *dlg, unsigned char *text, int flags,
widget_handler_T *handler, void *data, widget_handler_T *handler, void *data,
done_handler_T *done, void *done_data) done_handler_T *done, void *done_data)
@ -331,7 +331,7 @@ select_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
return widget_data->widget->handler(dlg_data, widget_data); return widget_data->widget->handler(dlg_data, widget_data);
} }
struct widget_ops button_ops = { const struct widget_ops button_ops = {
display_button, display_button,
NULL, NULL,
mouse_button, mouse_button,

View File

@ -30,7 +30,7 @@ struct widget_info_button {
#ifdef DEBUG_BUTTON_HOTKEY #ifdef DEBUG_BUTTON_HOTKEY
void add_dlg_button_do(unsigned char *file, int line, struct dialog *dlg, unsigned char *text, int flags, widget_handler_T *handler, void *data, done_handler_T *done, void *done_data); void add_dlg_button_do(const unsigned char *file, int line, struct dialog *dlg, unsigned char *text, int flags, widget_handler_T *handler, void *data, done_handler_T *done, void *done_data);
#define add_dlg_ok_button(dlg, text, flags, done, data) \ #define add_dlg_ok_button(dlg, text, flags, done, data) \
add_dlg_button_do(__FILE__, __LINE__, dlg, text, flags, ok_dialog, NULL, done, data) add_dlg_button_do(__FILE__, __LINE__, dlg, text, flags, ok_dialog, NULL, done, data)
@ -47,7 +47,7 @@ void add_dlg_button_do(struct dialog *dlg, unsigned char *text, int flags, widge
add_dlg_button_do(dlg, text, flags, handler, data, NULL, NULL) add_dlg_button_do(dlg, text, flags, handler, data, NULL, NULL)
#endif #endif
extern struct widget_ops button_ops; extern const struct widget_ops button_ops;
void dlg_format_buttons(struct terminal *, struct widget_data *, int, int, int *, int, int *, enum format_align, int); void dlg_format_buttons(struct terminal *, struct widget_data *, int, int, int *, int, int *, enum format_align, int);
#endif #endif

View File

@ -164,7 +164,7 @@ select_checkbox(struct dialog_data *dlg_data, struct widget_data *widget_data)
return EVENT_PROCESSED; return EVENT_PROCESSED;
} }
struct widget_ops checkbox_ops = { const struct widget_ops checkbox_ops = {
display_checkbox, display_checkbox,
init_checkbox, init_checkbox,
mouse_checkbox, mouse_checkbox,

View File

@ -27,7 +27,7 @@ void add_dlg_radio_do(struct dialog *dlg, unsigned char *text, int groupid, int
#define add_dlg_checkbox(dlg, text, data) \ #define add_dlg_checkbox(dlg, text, data) \
add_dlg_radio_do(dlg, text, 0, 0, data) add_dlg_radio_do(dlg, text, 0, 0, data)
extern struct widget_ops checkbox_ops; extern const struct widget_ops checkbox_ops;
void void
dlg_format_checkbox(struct terminal *term, dlg_format_checkbox(struct terminal *term,

View File

@ -140,7 +140,7 @@ select_dlg_item(struct dialog_data *dlg_data, struct widget_data *widget_data)
widget_data->widget->ops->select(dlg_data, widget_data); widget_data->widget->ops->select(dlg_data, widget_data);
} }
static struct widget_ops *widget_type_to_ops[] = { static const struct widget_ops *const widget_type_to_ops[] = {
&checkbox_ops, &checkbox_ops,
&field_ops, &field_ops,
&field_pass_ops, &field_pass_ops,
@ -344,7 +344,7 @@ static void
dialog_ev_kbd(struct dialog_data *dlg_data) dialog_ev_kbd(struct dialog_data *dlg_data)
{ {
struct widget_data *widget_data = selected_widget(dlg_data); struct widget_data *widget_data = selected_widget(dlg_data);
struct widget_ops *ops = widget_data->widget->ops; const struct widget_ops *ops = widget_data->widget->ops;
/* XXX: KEYMAP_EDIT ? --pasky */ /* XXX: KEYMAP_EDIT ? --pasky */
enum menu_action action_id; enum menu_action action_id;
struct term_event *ev = dlg_data->term_event; struct term_event *ev = dlg_data->term_event;

View File

@ -318,7 +318,7 @@ hierbox_browser(struct hierbox_browser *browser, struct session *ses)
add_dlg_listbox(dlg, listbox_data); add_dlg_listbox(dlg, listbox_data);
for (button = 0; button < browser->buttons_size; button++) { for (button = 0; button < browser->buttons_size; button++) {
struct hierbox_browser_button *but = &browser->buttons[button]; const struct hierbox_browser_button *but = &browser->buttons[button];
/* Skip buttons that should not be displayed in anonymous mode */ /* Skip buttons that should not be displayed in anonymous mode */
if (anonymous && !but->anonymous) { if (anonymous && !but->anonymous) {
@ -547,7 +547,7 @@ enum delete_error {
DELETE_ERRORS, DELETE_ERRORS,
}; };
struct listbox_ops_messages default_listbox_ops_messages = { static const struct listbox_ops_messages default_listbox_ops_messages = {
/* cant_delete_item */ /* cant_delete_item */
N_("Sorry, but the item \"%s\" cannot be deleted."), N_("Sorry, but the item \"%s\" cannot be deleted."),
@ -592,7 +592,7 @@ struct listbox_ops_messages default_listbox_ops_messages = {
static void static void
print_delete_error(struct listbox_item *item, struct terminal *term, print_delete_error(struct listbox_item *item, struct terminal *term,
struct listbox_ops *ops, enum delete_error err) const struct listbox_ops *ops, enum delete_error err)
{ {
struct string msg; struct string msg;
unsigned char *errmsg; unsigned char *errmsg;
@ -647,7 +647,7 @@ static void
do_delete_item(struct listbox_item *item, struct listbox_context *info, do_delete_item(struct listbox_item *item, struct listbox_context *info,
int last) int last)
{ {
struct listbox_ops *ops = info->box->ops; const struct listbox_ops *ops = info->box->ops;
assert(item); assert(item);
@ -720,7 +720,7 @@ query_delete_selected_item(void *context_)
struct listbox_context *context, *oldcontext = context_; struct listbox_context *context, *oldcontext = context_;
struct terminal *term = oldcontext->term; struct terminal *term = oldcontext->term;
struct listbox_data *box = oldcontext->box; struct listbox_data *box = oldcontext->box;
struct listbox_ops *ops = box->ops; const struct listbox_ops *ops = box->ops;
struct listbox_item *item = box->sel; struct listbox_item *item = box->sel;
unsigned char *text; unsigned char *text;
enum delete_error delete; enum delete_error delete;
@ -779,7 +779,7 @@ push_hierbox_delete_button(struct dialog_data *dlg_data,
/* [gettext_accelerator_context(push_hierbox_delete_button)] */ /* [gettext_accelerator_context(push_hierbox_delete_button)] */
struct terminal *term = dlg_data->win->term; struct terminal *term = dlg_data->win->term;
struct listbox_data *box = get_dlg_listbox_data(dlg_data); struct listbox_data *box = get_dlg_listbox_data(dlg_data);
struct listbox_ops *ops = box->ops; const struct listbox_ops *ops = box->ops;
struct listbox_item *item = box->sel; struct listbox_item *item = box->sel;
struct listbox_context *context; struct listbox_context *context;
@ -842,7 +842,7 @@ push_hierbox_clear_button(struct dialog_data *dlg_data,
{ {
/* [gettext_accelerator_context(push_hierbox_clear_button)] */ /* [gettext_accelerator_context(push_hierbox_clear_button)] */
struct listbox_data *box = get_dlg_listbox_data(dlg_data); struct listbox_data *box = get_dlg_listbox_data(dlg_data);
struct listbox_ops *ops = box->ops; const struct listbox_ops *ops = box->ops;
struct terminal *term = dlg_data->win->term; struct terminal *term = dlg_data->win->term;
struct listbox_context *context; struct listbox_context *context;

View File

@ -18,13 +18,13 @@ struct hierbox_browser_button {
struct hierbox_browser { struct hierbox_browser {
unsigned char *title; unsigned char *title;
void (*expansion_callback)(void); void (*expansion_callback)(void);
struct hierbox_browser_button *buttons; const struct hierbox_browser_button *buttons;
size_t buttons_size; size_t buttons_size;
struct list_head boxes; struct list_head boxes;
struct list_head dialogs; struct list_head dialogs;
struct listbox_item root; struct listbox_item root;
struct listbox_ops *ops; const struct listbox_ops *ops;
/* For saving state */ /* For saving state */
unsigned int do_not_save_state:1; unsigned int do_not_save_state:1;

View File

@ -744,7 +744,7 @@ clear_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
return EVENT_PROCESSED; return EVENT_PROCESSED;
} }
struct widget_ops field_ops = { const struct widget_ops field_ops = {
display_field, display_field,
init_field, init_field,
mouse_field, mouse_field,
@ -753,7 +753,7 @@ struct widget_ops field_ops = {
clear_field, clear_field,
}; };
struct widget_ops field_pass_ops = { const struct widget_ops field_pass_ops = {
display_field_pass, display_field_pass,
init_field, init_field,
mouse_field, mouse_field,

View File

@ -56,8 +56,8 @@ add_dlg_field_do(struct dialog *dlg, enum widget_type type, unsigned char *label
add_dlg_field_do(dlg, WIDGET_FIELD_PASS, label, min, max, handler, len, field, NULL, INPFIELD_FLOAT) add_dlg_field_do(dlg, WIDGET_FIELD_PASS, label, min, max, handler, len, field, NULL, INPFIELD_FLOAT)
extern struct widget_ops field_ops; extern const struct widget_ops field_ops;
extern struct widget_ops field_pass_ops; extern const struct widget_ops field_pass_ops;
widget_handler_status_T check_number(struct dialog_data *, struct widget_data *); widget_handler_status_T check_number(struct dialog_data *, struct widget_data *);
widget_handler_status_T check_nonempty(struct dialog_data *, struct widget_data *); widget_handler_status_T check_nonempty(struct dialog_data *, struct widget_data *);

View File

@ -452,7 +452,7 @@ display_listbox_item(struct listbox_item *item, void *data_, int *offset)
} else { } else {
unsigned char *text; unsigned char *text;
struct listbox_ops *ops = data->box->ops; const struct listbox_ops *ops = data->box->ops;
int len_bytes; int len_bytes;
assert(ops && ops->get_info); assert(ops && ops->get_info);
@ -735,7 +735,7 @@ kbd_listbox(struct dialog_data *dlg_data, struct widget_data *widget_data)
return EVENT_NOT_PROCESSED; return EVENT_NOT_PROCESSED;
} }
struct widget_ops listbox_ops = { const struct widget_ops listbox_ops = {
display_listbox, display_listbox,
init_listbox, init_listbox,
mouse_listbox, mouse_listbox,

View File

@ -100,7 +100,7 @@ struct listbox_ops {
struct listbox_data { struct listbox_data {
LIST_HEAD(struct listbox_data); LIST_HEAD(struct listbox_data);
struct listbox_ops *ops; /* Backend-provided operations */ const struct listbox_ops *ops; /* Backend-provided operations */
struct listbox_item *sel; /* Item currently selected */ struct listbox_item *sel; /* Item currently selected */
struct listbox_item *top; /* Item which is on the top line of the box */ struct listbox_item *top; /* Item which is on the top line of the box */
@ -131,7 +131,7 @@ struct listbox_item {
void *udata; void *udata;
}; };
extern struct widget_ops listbox_ops; extern const struct widget_ops listbox_ops;
void dlg_format_listbox(struct terminal *, struct widget_data *, int, int *, int, int, int *, enum format_align, int format_only); void dlg_format_listbox(struct terminal *, struct widget_data *, int, int *, int, int, int *, enum format_align, int format_only);

View File

@ -542,7 +542,7 @@ mouse_text(struct dialog_data *dlg_data, struct widget_data *widget_data)
} }
struct widget_ops text_ops = { const struct widget_ops text_ops = {
display_text, display_text,
NULL, NULL,
mouse_text, mouse_text,

View File

@ -44,7 +44,7 @@ struct widget_data_info_text {
void add_dlg_text(struct dialog *dlg, unsigned char *text, void add_dlg_text(struct dialog *dlg, unsigned char *text,
enum format_align align, int bottom_pad); enum format_align align, int bottom_pad);
extern struct widget_ops text_ops; extern const struct widget_ops text_ops;
void dlg_format_text_do(struct terminal *term, void dlg_format_text_do(struct terminal *term,
unsigned char *text, int x, int *y, int w, int *rw, unsigned char *text, int x, int *y, int w, int *rw,
struct color_pair *scolor, enum format_align align, int format_only); struct color_pair *scolor, enum format_align align, int format_only);

View File

@ -30,7 +30,7 @@ struct widget_ops {
}; };
struct widget { struct widget {
struct widget_ops *ops; const struct widget_ops *ops;
unsigned char *text; unsigned char *text;

View File

@ -135,7 +135,7 @@ change_hook_folder_state(struct session *ses, struct option *current,
static void static void
init_bookmarks(struct module *module) init_bookmarks(struct module *module)
{ {
struct change_hook_info bookmarks_change_hooks[] = { static const struct change_hook_info bookmarks_change_hooks[] = {
{ "bookmarks.folder_state", change_hook_folder_state }, { "bookmarks.folder_state", change_hook_folder_state },
{ NULL, NULL }, { NULL, NULL },
}; };

View File

@ -139,7 +139,7 @@ static struct listbox_ops_messages bookmarks_messages = {
N_("Do you really want to remove all bookmarks?"), N_("Do you really want to remove all bookmarks?"),
}; };
static struct listbox_ops bookmarks_listbox_ops = { static const struct listbox_ops bookmarks_listbox_ops = {
lock_bookmark, lock_bookmark,
unlock_bookmark, unlock_bookmark,
is_bookmark_used, is_bookmark_used,
@ -482,7 +482,7 @@ push_move_button(struct dialog_data *dlg_data,
/**** MANAGEMENT *****************************************************/ /**** MANAGEMENT *****************************************************/
static struct hierbox_browser_button bookmark_buttons[] = { static const struct hierbox_browser_button bookmark_buttons[] = {
/* [gettext_accelerator_context(.bookmark_buttons)] */ /* [gettext_accelerator_context(.bookmark_buttons)] */
{ N_("~Goto"), push_hierbox_goto_button, 1 }, { N_("~Goto"), push_hierbox_goto_button, 1 },
{ N_("~Edit"), push_edit_button, 0 }, { N_("~Edit"), push_edit_button, 0 },
@ -498,7 +498,7 @@ static struct hierbox_browser_button bookmark_buttons[] = {
{ N_("Clear"), push_hierbox_clear_button, 0 }, { N_("Clear"), push_hierbox_clear_button, 0 },
/* TODO: Would this be useful? --jonas */ /* TODO: Would this be useful? --jonas */
{ N_("Save"), push_save_button }, { N_("Save"), push_save_button, 0 },
#endif #endif
}; };

4
src/cache/dialogs.c vendored
View File

@ -209,7 +209,7 @@ static struct listbox_ops_messages cache_messages = {
NULL, NULL,
}; };
static struct listbox_ops cache_entry_listbox_ops = { static const struct listbox_ops cache_entry_listbox_ops = {
lock_cache_entry, lock_cache_entry,
unlock_cache_entry, unlock_cache_entry,
is_cache_entry_used, is_cache_entry_used,
@ -224,7 +224,7 @@ static struct listbox_ops cache_entry_listbox_ops = {
&cache_messages, &cache_messages,
}; };
static struct hierbox_browser_button cache_buttons[] = { static const struct hierbox_browser_button cache_buttons[] = {
/* [gettext_accelerator_context(.cache_buttons)] */ /* [gettext_accelerator_context(.cache_buttons)] */
{ N_("~Info"), push_hierbox_info_button, 1 }, { N_("~Info"), push_hierbox_info_button, 1 },
{ N_("~Goto"), push_hierbox_goto_button, 1 }, { N_("~Goto"), push_hierbox_goto_button, 1 },

View File

@ -11,7 +11,7 @@ ACTION_(EDIT, "backspace", BACKSPACE, N__("Delete character in front of the curs
ACTION_(EDIT, "beginning-of-buffer", BEGINNING_OF_BUFFER, N__("Go to the first line of the buffer"), 0), ACTION_(EDIT, "beginning-of-buffer", BEGINNING_OF_BUFFER, N__("Go to the first line of the buffer"), 0),
ACTION_(EDIT, "cancel", CANCEL, N__("Cancel current state"), 0), ACTION_(EDIT, "cancel", CANCEL, N__("Cancel current state"), 0),
ACTION_(EDIT, "copy-clipboard", COPY_CLIPBOARD, N__("Copy text to clipboard"), 0), ACTION_(EDIT, "copy-clipboard", COPY_CLIPBOARD, N__("Copy text to clipboard"), 0),
ACTION_(EDIT, "cut-clipboard", CUT_CLIPBOARD, N__("Delete text from clipboard"), 0), ACTION_(EDIT, "cut-clipboard", CUT_CLIPBOARD, N__("Cut text to clipboard"), 0),
ACTION_(EDIT, "delete", DELETE, N__("Delete character under cursor"), 0), ACTION_(EDIT, "delete", DELETE, N__("Delete character under cursor"), 0),
ACTION_(EDIT, "down", DOWN, N__("Move cursor downwards"), 0), ACTION_(EDIT, "down", DOWN, N__("Move cursor downwards"), 0),
ACTION_(EDIT, "end", END, N__("Go to the end of the page/line"), 0), ACTION_(EDIT, "end", END, N__("Go to the end of the page/line"), 0),

View File

@ -32,11 +32,10 @@
static void static void
toggle_success_msgbox(void *dummy) disable_success_msgbox(void *dummy)
{ {
/* TODO: option_changed() */ get_opt_bool("ui.success_msgbox") = 0;
get_opt_bool("ui.success_msgbox") = !get_opt_bool("ui.success_msgbox"); option_changed(NULL, get_opt_rec(config_options, "ui.success_msgbox"));
get_opt_rec(config_options, "ui.success_msgbox")->flags |= OPT_TOUCHED;
} }
void void
@ -56,7 +55,7 @@ write_config_dialog(struct terminal *term, unsigned char *config_file,
config_file), config_file),
NULL, 2, NULL, 2,
N_("~OK"), NULL, B_ENTER | B_ESC, N_("~OK"), NULL, B_ENTER | B_ESC,
N_("~Do not show anymore"), toggle_success_msgbox, 0); N_("~Do not show anymore"), disable_success_msgbox, 0);
return; return;
} }
@ -243,7 +242,7 @@ delete_option_item(struct listbox_item *item, int last)
mark_option_as_deleted(option); mark_option_as_deleted(option);
} }
static struct listbox_ops options_listbox_ops = { static const struct listbox_ops options_listbox_ops = {
lock_option, lock_option,
unlock_option, unlock_option,
is_option_used, is_option_used,
@ -275,9 +274,7 @@ check_valid_option(struct dialog_data *dlg_data, struct widget_data *widget_data
if (chinon) { if (chinon) {
if (option_types[option->type].set && if (option_types[option->type].set &&
option_types[option->type].set(option, chinon)) { option_types[option->type].set(option, chinon)) {
struct option *current = option; option_changed(ses, option);
option_changed(ses, current, option);
commandline = 0; commandline = 0;
mem_free(chinon); mem_free(chinon);
@ -495,7 +492,7 @@ push_save_button(struct dialog_data *dlg_data,
} }
static struct hierbox_browser_button option_buttons[] = { static const struct hierbox_browser_button option_buttons[] = {
/* [gettext_accelerator_context(.option_buttons)] */ /* [gettext_accelerator_context(.option_buttons)] */
{ N_("~Info"), push_hierbox_info_button, 1 }, { N_("~Info"), push_hierbox_info_button, 1 },
{ N_("~Edit"), push_edit_button, 0 }, { N_("~Edit"), push_edit_button, 0 },
@ -730,7 +727,7 @@ delete_keybinding_item(struct listbox_item *item, int last)
free_keybinding(keybinding); free_keybinding(keybinding);
} }
static struct listbox_ops keybinding_listbox_ops = { static const struct listbox_ops keybinding_listbox_ops = {
lock_keybinding, lock_keybinding,
unlock_keybinding, unlock_keybinding,
is_keybinding_used, is_keybinding_used,
@ -924,7 +921,7 @@ push_kbdbind_save_button(struct dialog_data *dlg_data,
static INIT_LIST_HEAD(keybinding_dialog_list); static INIT_LIST_HEAD(keybinding_dialog_list);
static struct hierbox_browser_button keybinding_buttons[] = { static const struct hierbox_browser_button keybinding_buttons[] = {
/* [gettext_accelerator_context(.keybinding_buttons)] */ /* [gettext_accelerator_context(.keybinding_buttons)] */
{ N_("~Add"), push_kbdbind_add_button, 0 }, { N_("~Add"), push_kbdbind_add_button, 0 },
{ N_("~Delete"), push_hierbox_delete_button, 0 }, { N_("~Delete"), push_hierbox_delete_button, 0 },

View File

@ -159,7 +159,7 @@ static int no_autocreate = 0;
/* Get record of option of given name, or NULL if there's no such option. */ /* Get record of option of given name, or NULL if there's no such option. */
struct option * struct option *
get_opt_rec(struct option *tree, unsigned char *name_) get_opt_rec(struct option *tree, const unsigned char *name_)
{ {
struct option *option; struct option *option;
unsigned char *aname = stracpy(name_); unsigned char *aname = stracpy(name_);
@ -231,7 +231,7 @@ get_opt_rec(struct option *tree, unsigned char *name_)
* do not create the option if it doesn't exist and there's autocreation * do not create the option if it doesn't exist and there's autocreation
* enabled. */ * enabled. */
struct option * struct option *
get_opt_rec_real(struct option *tree, unsigned char *name) get_opt_rec_real(struct option *tree, const unsigned char *name)
{ {
struct option *opt; struct option *opt;
@ -680,7 +680,7 @@ register_autocreated_options(void)
static struct option_info config_options_info[]; static struct option_info config_options_info[];
extern struct option_info cmdline_options_info[]; extern struct option_info cmdline_options_info[];
static struct change_hook_info change_hooks[]; static const struct change_hook_info change_hooks[];
void void
init_options(void) init_options(void)
@ -716,7 +716,7 @@ done_options(void)
} }
void void
register_change_hooks(struct change_hook_info *change_hooks) register_change_hooks(const struct change_hook_info *change_hooks)
{ {
int i; int i;
@ -955,9 +955,8 @@ toggle_option(struct session *ses, struct option *option)
assert(option->type == OPT_BOOL || option->type == OPT_INT); assert(option->type == OPT_BOOL || option->type == OPT_INT);
assert(option->max); assert(option->max);
/* TODO: call change hooks. --jonas */
option->value.number = (number <= option->max) ? number : option->min; option->value.number = (number <= option->max) ? number : option->min;
option_changed(ses, option, option); option_changed(ses, option);
} }
static int static int
@ -976,7 +975,7 @@ change_hook_language(struct session *ses, struct option *current, struct option
return 0; return 0;
} }
static struct change_hook_info change_hooks[] = { static const struct change_hook_info change_hooks[] = {
{ "config.show_template", change_hook_stemplate }, { "config.show_template", change_hook_stemplate },
{ "connection", change_hook_connection }, { "connection", change_hook_connection },
{ "document.browse", change_hook_html }, { "document.browse", change_hook_html },
@ -1012,11 +1011,11 @@ call_change_hooks(struct session *ses, struct option *current, struct option *op
} }
void void
option_changed(struct session *ses, struct option *current, struct option *option) option_changed(struct session *ses, struct option *option)
{ {
option->flags |= OPT_TOUCHED; option->flags |= OPT_TOUCHED;
/* Notify everyone out there! */ /* Notify everyone out there! */
call_change_hooks(ses, current, option); call_change_hooks(ses, option, option);
} }
int int

View File

@ -105,7 +105,19 @@ union option_value {
unsigned char *string; unsigned char *string;
}; };
typedef int (*change_hook_T)(struct session *, struct option *current,
/* @session is the session via which the user changed the options,
* or NULL if not known. Because the options are currently not
* session-specific, it is best to ignore this parameter. In a future
* version of ELinks, this parameter might mean the session to which
* the changed options apply.
*
* @current is the option whose change hook is being called. It is
* never NULL.
*
* @changed is the option that was changed, or NULL if multiple
* descendants of @current may have been changed. */
typedef int (*change_hook_T)(struct session *session, struct option *current,
struct option *changed); struct option *changed);
struct option { struct option {
@ -145,7 +157,7 @@ struct change_hook_info {
change_hook_T change_hook; change_hook_T change_hook;
}; };
extern void register_change_hooks(struct change_hook_info *change_hooks); extern void register_change_hooks(const struct change_hook_info *change_hooks);
extern struct list_head *init_options_tree(void); extern struct list_head *init_options_tree(void);
@ -180,8 +192,7 @@ void call_change_hooks(struct session *ses, struct option *current,
/* Do proper bookkeeping after an option has changed - call this every time /* Do proper bookkeeping after an option has changed - call this every time
* you change an option value. */ * you change an option value. */
void option_changed(struct session *ses, struct option *current, void option_changed(struct session *ses, struct option *option);
struct option *option);
extern int commit_option_values(struct option_resolver *resolvers, extern int commit_option_values(struct option_resolver *resolvers,
struct option *root, struct option *root,
@ -197,8 +208,8 @@ extern void checkout_option_values(struct option_resolver *resolvers,
* use get_opt_type() and add_opt_type(). For command line options, you want to * use get_opt_type() and add_opt_type(). For command line options, you want to
* use get_opt_type_tree(cmdline_options, "option"). */ * use get_opt_type_tree(cmdline_options, "option"). */
extern struct option *get_opt_rec(struct option *, unsigned char *); extern struct option *get_opt_rec(struct option *, const unsigned char *);
extern struct option *get_opt_rec_real(struct option *, unsigned char *); extern struct option *get_opt_rec_real(struct option *, const unsigned char *);
#ifdef CONFIG_DEBUG #ifdef CONFIG_DEBUG
extern union option_value *get_opt_(unsigned char *, int, enum option_type, struct option *, unsigned char *); extern union option_value *get_opt_(unsigned char *, int, enum option_type, struct option *, unsigned char *);
#define get_opt(tree, name, type) get_opt_(__FILE__, __LINE__, type, tree, name) #define get_opt(tree, name, type) get_opt_(__FILE__, __LINE__, type, tree, name)

View File

@ -166,7 +166,7 @@ redir_add(struct option *opt, unsigned char *str)
/* Support functions for config file parsing. */ /* Support functions for config file parsing. */
static void static void
add_optstring_to_string(struct string *s, unsigned char *q, int qlen) add_optstring_to_string(struct string *s, const unsigned char *q, int qlen)
{ {
if (!commandline) add_char_to_string(s, '"'); if (!commandline) add_char_to_string(s, '"');
add_quoted_to_string(s, q, qlen); add_quoted_to_string(s, q, qlen);
@ -364,7 +364,7 @@ color_wr(struct option *opt, struct string *str)
{ {
color_T color = opt->value.color; color_T color = opt->value.color;
unsigned char hexcolor[8]; unsigned char hexcolor[8];
unsigned char *strcolor = get_color_string(color, hexcolor); const unsigned char *strcolor = get_color_string(color, hexcolor);
add_optstring_to_string(str, strcolor, strlen(strcolor)); add_optstring_to_string(str, strcolor, strlen(strcolor));
} }

View File

@ -63,7 +63,7 @@ periodic_save_change_hook(struct session *ses, struct option *current,
static void static void
init_timer(struct module *module) init_timer(struct module *module)
{ {
struct change_hook_info timer_change_hooks[] = { static const struct change_hook_info timer_change_hooks[] = {
{ "infofiles.save_interval", periodic_save_change_hook }, { "infofiles.save_interval", periodic_save_change_hook },
{ NULL, NULL }, { NULL, NULL },
}; };

View File

@ -219,7 +219,7 @@ static struct listbox_ops_messages cookies_messages = {
N_("Do you really want to remove all cookies?"), N_("Do you really want to remove all cookies?"),
}; };
static struct listbox_ops cookies_listbox_ops = { static const struct listbox_ops cookies_listbox_ops = {
lock_cookie, lock_cookie,
unlock_cookie, unlock_cookie,
is_cookie_used, is_cookie_used,
@ -471,7 +471,7 @@ push_save_button(struct dialog_data *dlg_data, struct widget_data *button)
return EVENT_PROCESSED; return EVENT_PROCESSED;
} }
static struct hierbox_browser_button cookie_buttons[] = { static const struct hierbox_browser_button cookie_buttons[] = {
/* [gettext_accelerator_context(.cookie_buttons)] */ /* [gettext_accelerator_context(.cookie_buttons)] */
{ N_("~Info"), push_hierbox_info_button, 1 }, { N_("~Info"), push_hierbox_info_button, 1 },
{ N_("~Add"), push_add_button, 1 }, { N_("~Add"), push_add_button, 1 },

View File

@ -445,7 +445,7 @@ static struct listbox_ops_messages download_messages = {
N_("Do you really want to interrupt all downloads?"), N_("Do you really want to interrupt all downloads?"),
}; };
static struct listbox_ops downloads_listbox_ops = { static const struct listbox_ops downloads_listbox_ops = {
lock_file_download, lock_file_download,
unlock_file_download, unlock_file_download,
is_file_download_used, is_file_download_used,
@ -487,7 +487,7 @@ push_info_button(struct dialog_data *dlg_data, struct widget_data *button)
* - Open button that can be used to set file_download->prog. * - Open button that can be used to set file_download->prog.
* - Toggle notify button * - Toggle notify button
*/ */
static struct hierbox_browser_button download_buttons[] = { static const struct hierbox_browser_button download_buttons[] = {
/* [gettext_accelerator_context(.download_buttons)] */ /* [gettext_accelerator_context(.download_buttons)] */
{ N_("~Info"), push_info_button }, { N_("~Info"), push_info_button },
{ N_("~Abort"), push_hierbox_delete_button }, { N_("~Abort"), push_hierbox_delete_button },

View File

@ -37,9 +37,7 @@ display_codepage(struct terminal *term, void *name_, void *xxx)
if (opt->value.number != index) { if (opt->value.number != index) {
opt->value.number = index; opt->value.number = index;
/* TODO: option_changed() (we need to review the hooks option_changed(NULL, opt);
* to handle NULL ses or properly document that stuff). */
opt->flags |= OPT_TOUCHED;
} }
cls_redraw_all_terminals(); cls_redraw_all_terminals();

View File

@ -19,6 +19,7 @@
#include "main/module.h" #include "main/module.h"
#include "network/connection.h" #include "network/connection.h"
#include "protocol/uri.h" #include "protocol/uri.h"
#include "session/session.h"
#include "util/error.h" #include "util/error.h"
#include "util/memory.h" #include "util/memory.h"
#include "viewer/text/draw.h" #include "viewer/text/draw.h"
@ -127,7 +128,10 @@ change_hook_css(struct session *ses, struct option *current, struct option *chan
import_default_css(); import_default_css();
} }
draw_formatted(ses, 1); /* Instead of using the value of the @ses parameter, iterate
* through the @sessions list. The parameter may be NULL and
* anyway we don't support session-specific options yet. */
foreach (ses, sessions) draw_formatted(ses, 1);
return 0; return 0;
} }
@ -135,7 +139,7 @@ change_hook_css(struct session *ses, struct option *current, struct option *chan
static void static void
init_css(struct module *module) init_css(struct module *module)
{ {
struct change_hook_info css_change_hooks[] = { static const struct change_hook_info css_change_hooks[] = {
{ "document.css", change_hook_css }, { "document.css", change_hook_css },
{ NULL, NULL }, { NULL, NULL },
}; };

View File

@ -460,15 +460,11 @@ set_hline(struct html_context *html_context, unsigned char *chars, int charslen,
} }
for (; chars < end; x++) { for (; chars < end; x++) {
if (*chars == NBSP_CHAR) { /* ELinks does not use NBSP_CHAR in UTF-8. */
schar->data = ' ';
part->spaces[x] = html_context->options->wrap_nbsp;
part->char_width[x] = 1;
chars++;
} else {
part->spaces[x] = (*chars == ' ');
data = utf8_to_unicode(&chars, end); data = utf8_to_unicode(&chars, end);
if (data == UCS_NO_CHAR) { if (data == UCS_NO_CHAR) {
part->spaces[x] = 0;
if (charslen == 1) { if (charslen == 1) {
/* HR */ /* HR */
unsigned char attr = schar->attr; unsigned char attr = schar->attr;
@ -490,6 +486,10 @@ set_hline(struct html_context *html_context, unsigned char *chars, int charslen,
} }
} else { } else {
good_char: good_char:
if (data == UCS_NO_BREAK_SPACE
&& html_context->options->wrap_nbsp)
data = UCS_SPACE;
part->spaces[x] = (data == UCS_SPACE);
if (unicode_to_cell(data) == 2) { if (unicode_to_cell(data) == 2) {
schar->data = (unicode_val_T)data; schar->data = (unicode_val_T)data;
part->char_width[x] = 2; part->char_width[x] = 2;
@ -502,10 +502,9 @@ good_char:
schar->data = (unicode_val_T)data; schar->data = (unicode_val_T)data;
} }
} }
}
copy_screen_chars(&POS(x, y), schar, 1); copy_screen_chars(&POS(x, y), schar, 1);
} }
} else { } else { /* not UTF-8 */
for (; charslen > 0; charslen--, x++, chars++) { for (; charslen > 0; charslen--, x++, chars++) {
part->char_width[x] = 1; part->char_width[x] = 1;
if (*chars == NBSP_CHAR) { if (*chars == NBSP_CHAR) {
@ -517,8 +516,8 @@ good_char:
} }
copy_screen_chars(&POS(x, y), schar, 1); copy_screen_chars(&POS(x, y), schar, 1);
} }
} /* end of UTF-8 check */
}
/* Assert that we haven't written past the end of the /* Assert that we haven't written past the end of the
* LINE(y).chars array. @x here is one greater than * LINE(y).chars array. @x here is one greater than
* the last one used in POS(x, y). Instead of this, * the last one used in POS(x, y). Instead of this,
@ -530,11 +529,11 @@ good_char:
* for line-wrapping decisions. It may currently be too * for line-wrapping decisions. It may currently be too
* large because it was allocated above based on @charslen * large because it was allocated above based on @charslen
* which is the number of bytes, not the number of cells. * which is the number of bytes, not the number of cells.
* Change the length to the correct size, but dont let it * Change the length to the correct size, but don't let it
* get smaller than it was on entry to this function. */ * get smaller than it was on entry to this function. */
LINE(y).length = int_max(orig_length, X(x)); LINE(y).length = int_max(orig_length, X(x));
len = x - x2; len = x - x2;
} else { } else { /* part->document == NULL */
if (utf8) { if (utf8) {
unsigned char *end; unsigned char *end;
@ -555,13 +554,13 @@ good_char:
} }
} }
len = x - x2; len = x - x2;
} else { } else { /* not UTF-8 */
for (; charslen > 0; charslen--, x++, chars++) { for (; charslen > 0; charslen--, x++, chars++) {
part->spaces[x] = (*chars == ' '); part->spaces[x] = (*chars == ' ');
part->char_width[x] = 1; part->char_width[x] = 1;
} }
} }
} } /* end of part->document check */
return len; return len;
} }
#else #else

View File

@ -142,7 +142,7 @@ static struct listbox_ops_messages formhist_messages = {
N_("Do you really want to remove all forms?"), N_("Do you really want to remove all forms?"),
}; };
static struct listbox_ops formhist_listbox_ops = { static const struct listbox_ops formhist_listbox_ops = {
lock_formhist_data, lock_formhist_data,
unlock_formhist_data, unlock_formhist_data,
is_formhist_data_used, is_formhist_data_used,
@ -204,7 +204,7 @@ push_save_button(struct dialog_data *dlg_data, struct widget_data *button)
return EVENT_PROCESSED; return EVENT_PROCESSED;
} }
static struct hierbox_browser_button formhist_buttons[] = { static const struct hierbox_browser_button formhist_buttons[] = {
/* [gettext_accelerator_context(.formhist_buttons)] */ /* [gettext_accelerator_context(.formhist_buttons)] */
{ N_("~Login"), push_login_button, 1 }, { N_("~Login"), push_login_button, 1 },
{ N_("~Info"), push_hierbox_info_button, 1 }, { N_("~Info"), push_hierbox_info_button, 1 },

View File

@ -127,7 +127,7 @@ static struct listbox_ops_messages globhist_messages = {
N_("Do you really want to remove all history entries?"), N_("Do you really want to remove all history entries?"),
}; };
static struct listbox_ops gh_listbox_ops = { static const struct listbox_ops gh_listbox_ops = {
lock_globhist_item, lock_globhist_item,
unlock_globhist_item, unlock_globhist_item,
is_globhist_item_used, is_globhist_item_used,
@ -219,7 +219,7 @@ push_bookmark_button(struct dialog_data *dlg_data,
/* The global history manager: */ /* The global history manager: */
static struct hierbox_browser_button globhist_buttons[] = { static const struct hierbox_browser_button globhist_buttons[] = {
/* [gettext_accelerator_context(.globhist_buttons)] */ /* [gettext_accelerator_context(.globhist_buttons)] */
{ N_("~Goto"), push_hierbox_goto_button, 1 }, { N_("~Goto"), push_hierbox_goto_button, 1 },
{ N_("~Info"), push_hierbox_info_button, 1 }, { N_("~Info"), push_hierbox_info_button, 1 },
@ -232,7 +232,7 @@ static struct hierbox_browser_button globhist_buttons[] = {
{ N_("C~lear"), push_hierbox_clear_button, 0 }, { N_("C~lear"), push_hierbox_clear_button, 0 },
#if 0 #if 0
/* TODO: Would this be useful? --jonas */ /* TODO: Would this be useful? --jonas */
{ N_("Save"), push_save_button }, { N_("Save"), push_save_button, 0 },
#endif #endif
}; };

View File

@ -183,7 +183,8 @@ u2cp_(unicode_val_T u, int to, enum nbsp_mode nbsp_mode)
return encode_utf8(u); return encode_utf8(u);
#endif /* CONFIG_UTF8 */ #endif /* CONFIG_UTF8 */
/* To mark non breaking spaces, we use a special char NBSP_CHAR. */ /* To mark non breaking spaces in non-UTF-8 strings, we use a
* special char NBSP_CHAR. */
if (u == 0xa0) { if (u == 0xa0) {
if (nbsp_mode == NBSP_MODE_HACK) return NBSP_CHAR_STRING; if (nbsp_mode == NBSP_MODE_HACK) return NBSP_CHAR_STRING;
else /* NBSP_MODE_ASCII */ return " "; else /* NBSP_MODE_ASCII */ return " ";

View File

@ -3,6 +3,13 @@
typedef uint32_t unicode_val_T; typedef uint32_t unicode_val_T;
/* U+0020 SPACE. Normally the same as ' ' or L' ' but perhaps ELinks
* shouldn't rely on that. */
#define UCS_SPACE ((unicode_val_T) 0x0020)
/* U+00A0 NO-BREAK SPACE. */
#define UCS_NO_BREAK_SPACE ((unicode_val_T) 0x00A0)
/* U+FFFD REPLACEMENT CHARACTER. Used when no Unicode mapping is /* U+FFFD REPLACEMENT CHARACTER. Used when no Unicode mapping is
* known for a byte in a codepage, or when invalid UTF-8 is received * known for a byte in a codepage, or when invalid UTF-8 is received
* from a terminal. After generating the character, ELinks then * from a terminal. After generating the character, ELinks then
@ -27,7 +34,8 @@ typedef uint32_t unicode_val_T;
* We should fix that if we ever change the value. */ * We should fix that if we ever change the value. */
#define UCS_ORPHAN_CELL ((unicode_val_T) 0x20) #define UCS_ORPHAN_CELL ((unicode_val_T) 0x20)
/* &nbsp; replacement character. See u2cp(). */ /* &nbsp; replacement character. See u2cp().
* UTF-8 strings should use the encoding of U+00A0 instead. */
#define NBSP_CHAR ((unsigned char) 1) #define NBSP_CHAR ((unsigned char) 1)
#define NBSP_CHAR_STRING "\001" #define NBSP_CHAR_STRING "\001"
@ -60,7 +68,8 @@ enum convert_string_mode {
CSM_NONE, /* Convert nothing. */ CSM_NONE, /* Convert nothing. */
}; };
/* How to translate non-breaking spaces. */ /* How to translate U+00A0 NO-BREAK SPACE. If u2cp_ is converting to
* UTF-8, it ignores this choice and just encodes the U+00A0. */
enum nbsp_mode { enum nbsp_mode {
/* Convert to NBSP_CHAR. This lets the HTML renderer /* Convert to NBSP_CHAR. This lets the HTML renderer
* recognize nbsp even if the codepage doesn't support * recognize nbsp even if the codepage doesn't support

View File

@ -2134,14 +2134,14 @@ unsigned char *const aliases_8859_16 [] = {
const uint16_t highhalf_cp1250 [] = { const uint16_t highhalf_cp1250 [] = {
/* 0x80 */ 0x20AC, /* EURO SIGN */ /* 0x80 */ 0x20AC, /* EURO SIGN */
/* 0x81 */ 0x0000, /* UNDEFINED */ /* 0x81 */ 0xFFFF,
/* 0x82 */ 0x201A, /* SINGLE LOW-9 QUOTATION MARK */ /* 0x82 */ 0x201A, /* SINGLE LOW-9 QUOTATION MARK */
/* 0x83 */ 0x0000, /* UNDEFINED */ /* 0x83 */ 0xFFFF,
/* 0x84 */ 0x201E, /* DOUBLE LOW-9 QUOTATION MARK */ /* 0x84 */ 0x201E, /* DOUBLE LOW-9 QUOTATION MARK */
/* 0x85 */ 0x2026, /* HORIZONTAL ELLIPSIS */ /* 0x85 */ 0x2026, /* HORIZONTAL ELLIPSIS */
/* 0x86 */ 0x2020, /* DAGGER */ /* 0x86 */ 0x2020, /* DAGGER */
/* 0x87 */ 0x2021, /* DOUBLE DAGGER */ /* 0x87 */ 0x2021, /* DOUBLE DAGGER */
/* 0x88 */ 0x0000, /* UNDEFINED */ /* 0x88 */ 0xFFFF,
/* 0x89 */ 0x2030, /* PER MILLE SIGN */ /* 0x89 */ 0x2030, /* PER MILLE SIGN */
/* 0x8A */ 0x0160, /* LATIN CAPITAL LETTER S WITH CARON */ /* 0x8A */ 0x0160, /* LATIN CAPITAL LETTER S WITH CARON */
/* 0x8B */ 0x2039, /* SINGLE LEFT-POINTING ANGLE QUOTATION MARK */ /* 0x8B */ 0x2039, /* SINGLE LEFT-POINTING ANGLE QUOTATION MARK */
@ -2149,7 +2149,7 @@ const uint16_t highhalf_cp1250 [] = {
/* 0x8D */ 0x0164, /* LATIN CAPITAL LETTER T WITH CARON */ /* 0x8D */ 0x0164, /* LATIN CAPITAL LETTER T WITH CARON */
/* 0x8E */ 0x017D, /* LATIN CAPITAL LETTER Z WITH CARON */ /* 0x8E */ 0x017D, /* LATIN CAPITAL LETTER Z WITH CARON */
/* 0x8F */ 0x0179, /* LATIN CAPITAL LETTER Z WITH ACUTE */ /* 0x8F */ 0x0179, /* LATIN CAPITAL LETTER Z WITH ACUTE */
/* 0x90 */ 0x0000, /* UNDEFINED */ /* 0x90 */ 0xFFFF,
/* 0x91 */ 0x2018, /* LEFT SINGLE QUOTATION MARK */ /* 0x91 */ 0x2018, /* LEFT SINGLE QUOTATION MARK */
/* 0x92 */ 0x2019, /* RIGHT SINGLE QUOTATION MARK */ /* 0x92 */ 0x2019, /* RIGHT SINGLE QUOTATION MARK */
/* 0x93 */ 0x201C, /* LEFT DOUBLE QUOTATION MARK */ /* 0x93 */ 0x201C, /* LEFT DOUBLE QUOTATION MARK */
@ -2157,7 +2157,7 @@ const uint16_t highhalf_cp1250 [] = {
/* 0x95 */ 0x2022, /* BULLET */ /* 0x95 */ 0x2022, /* BULLET */
/* 0x96 */ 0x2013, /* EN DASH */ /* 0x96 */ 0x2013, /* EN DASH */
/* 0x97 */ 0x2014, /* EM DASH */ /* 0x97 */ 0x2014, /* EM DASH */
/* 0x98 */ 0x0000, /* UNDEFINED */ /* 0x98 */ 0xFFFF,
/* 0x99 */ 0x2122, /* TRADE MARK SIGN */ /* 0x99 */ 0x2122, /* TRADE MARK SIGN */
/* 0x9A */ 0x0161, /* LATIN SMALL LETTER S WITH CARON */ /* 0x9A */ 0x0161, /* LATIN SMALL LETTER S WITH CARON */
/* 0x9B */ 0x203A, /* SINGLE RIGHT-POINTING ANGLE QUOTATION MARK */ /* 0x9B */ 0x203A, /* SINGLE RIGHT-POINTING ANGLE QUOTATION MARK */
@ -2710,22 +2710,22 @@ unsigned char *const aliases_cp1256 [] = {
const uint16_t highhalf_cp1257 [] = { const uint16_t highhalf_cp1257 [] = {
/* 0x80 */ 0x20AC, /* EURO SIGN */ /* 0x80 */ 0x20AC, /* EURO SIGN */
/* 0x81 */ 0x0000, /* UNDEFINED */ /* 0x81 */ 0xFFFF,
/* 0x82 */ 0x201A, /* SINGLE LOW-9 QUOTATION MARK */ /* 0x82 */ 0x201A, /* SINGLE LOW-9 QUOTATION MARK */
/* 0x83 */ 0x0000, /* UNDEFINED */ /* 0x83 */ 0xFFFF,
/* 0x84 */ 0x201E, /* DOUBLE LOW-9 QUOTATION MARK */ /* 0x84 */ 0x201E, /* DOUBLE LOW-9 QUOTATION MARK */
/* 0x85 */ 0x2026, /* HORIZONTAL ELLIPSIS */ /* 0x85 */ 0x2026, /* HORIZONTAL ELLIPSIS */
/* 0x86 */ 0x2020, /* DAGGER */ /* 0x86 */ 0x2020, /* DAGGER */
/* 0x87 */ 0x2021, /* DOUBLE DAGGER */ /* 0x87 */ 0x2021, /* DOUBLE DAGGER */
/* 0x88 */ 0x0000, /* UNDEFINED */ /* 0x88 */ 0xFFFF,
/* 0x89 */ 0x2030, /* PER MILLE SIGN */ /* 0x89 */ 0x2030, /* PER MILLE SIGN */
/* 0x8A */ 0x0000, /* UNDEFINED */ /* 0x8A */ 0xFFFF,
/* 0x8B */ 0x2039, /* SINGLE LEFT-POINTING ANGLE QUOTATION MARK */ /* 0x8B */ 0x2039, /* SINGLE LEFT-POINTING ANGLE QUOTATION MARK */
/* 0x8C */ 0x0000, /* UNDEFINED */ /* 0x8C */ 0xFFFF,
/* 0x8D */ 0x00A8, /* DIAERESIS */ /* 0x8D */ 0x00A8, /* DIAERESIS */
/* 0x8E */ 0x02C7, /* CARON */ /* 0x8E */ 0x02C7, /* CARON */
/* 0x8F */ 0x00B8, /* CEDILLA */ /* 0x8F */ 0x00B8, /* CEDILLA */
/* 0x90 */ 0x0000, /* UNDEFINED */ /* 0x90 */ 0xFFFF,
/* 0x91 */ 0x2018, /* LEFT SINGLE QUOTATION MARK */ /* 0x91 */ 0x2018, /* LEFT SINGLE QUOTATION MARK */
/* 0x92 */ 0x2019, /* RIGHT SINGLE QUOTATION MARK */ /* 0x92 */ 0x2019, /* RIGHT SINGLE QUOTATION MARK */
/* 0x93 */ 0x201C, /* LEFT DOUBLE QUOTATION MARK */ /* 0x93 */ 0x201C, /* LEFT DOUBLE QUOTATION MARK */
@ -2733,20 +2733,20 @@ const uint16_t highhalf_cp1257 [] = {
/* 0x95 */ 0x2022, /* BULLET */ /* 0x95 */ 0x2022, /* BULLET */
/* 0x96 */ 0x2013, /* EN DASH */ /* 0x96 */ 0x2013, /* EN DASH */
/* 0x97 */ 0x2014, /* EM DASH */ /* 0x97 */ 0x2014, /* EM DASH */
/* 0x98 */ 0x0000, /* UNDEFINED */ /* 0x98 */ 0xFFFF,
/* 0x99 */ 0x2122, /* TRADE MARK SIGN */ /* 0x99 */ 0x2122, /* TRADE MARK SIGN */
/* 0x9A */ 0x0000, /* UNDEFINED */ /* 0x9A */ 0xFFFF,
/* 0x9B */ 0x203A, /* SINGLE RIGHT-POINTING ANGLE QUOTATION MARK */ /* 0x9B */ 0x203A, /* SINGLE RIGHT-POINTING ANGLE QUOTATION MARK */
/* 0x9C */ 0x0000, /* UNDEFINED */ /* 0x9C */ 0xFFFF,
/* 0x9D */ 0x00AF, /* MACRON */ /* 0x9D */ 0x00AF, /* MACRON */
/* 0x9E */ 0x02DB, /* OGONEK */ /* 0x9E */ 0x02DB, /* OGONEK */
/* 0x9F */ 0x0000, /* UNDEFINED */ /* 0x9F */ 0xFFFF,
/* 0xA0 */ 0x00A0, /* NO-BREAK SPACE */ /* 0xA0 */ 0x00A0, /* NO-BREAK SPACE */
/* 0xA1 */ 0x0000, /* UNDEFINED */ /* 0xA1 */ 0xFFFF,
/* 0xA2 */ 0x00A2, /* CENT SIGN */ /* 0xA2 */ 0x00A2, /* CENT SIGN */
/* 0xA3 */ 0x00A3, /* POUND SIGN */ /* 0xA3 */ 0x00A3, /* POUND SIGN */
/* 0xA4 */ 0x00A4, /* CURRENCY SIGN */ /* 0xA4 */ 0x00A4, /* CURRENCY SIGN */
/* 0xA5 */ 0x0000, /* UNDEFINED */ /* 0xA5 */ 0xFFFF,
/* 0xA6 */ 0x00A6, /* BROKEN BAR */ /* 0xA6 */ 0x00A6, /* BROKEN BAR */
/* 0xA7 */ 0x00A7, /* SECTION SIGN */ /* 0xA7 */ 0x00A7, /* SECTION SIGN */
/* 0xA8 */ 0x00D8, /* LATIN CAPITAL LETTER O WITH STROKE */ /* 0xA8 */ 0x00D8, /* LATIN CAPITAL LETTER O WITH STROKE */

View File

@ -1,6 +1,6 @@
/* Automatically generated by gen-ent */ /* Automatically generated by gen-ent */
struct entity { char *s; unicode_val_T c; } entities [1002] = { static const struct entity { char *s; unicode_val_T c; } entities [1002] = {
{ "AElig", 0x00C6 }, /* LATIN CAPITAL LETTER AE */ { "AElig", 0x00C6 }, /* LATIN CAPITAL LETTER AE */
{ "Aacgr", 0x0386 }, /* GREEK CAPITAL LETTER ALPHA WITH TONOS */ { "Aacgr", 0x0386 }, /* GREEK CAPITAL LETTER ALPHA WITH TONOS */
{ "Aacute", 0x00C1 }, /* LATIN CAPITAL LETTER A WITH ACUTE */ { "Aacute", 0x00C1 }, /* LATIN CAPITAL LETTER A WITH ACUTE */

View File

@ -1,7 +1,7 @@
/* Automatically generated by gen-7b */ /* Automatically generated by gen-7b */
/* DO NOT EDIT THIS FILE! EDIT Unicode/7bitrepl.lnx INSTEAD! */ /* DO NOT EDIT THIS FILE! EDIT Unicode/7bitrepl.lnx INSTEAD! */
struct { unicode_val_T x; unsigned char *s; } unicode_7b [2453] = { static const struct { unicode_val_T x; unsigned char *s; } unicode_7b [2453] = {
{0x00000000, "NUL"}, {0x00000000, "NUL"},
{0x00000001, "SH"}, {0x00000001, "SH"},
{0x00000002, "SX"}, {0x00000002, "SX"},

View File

@ -24,7 +24,7 @@
#include "mime/backend/mailcap.h" #include "mime/backend/mailcap.h"
#include "mime/backend/mimetypes.h" #include "mime/backend/mimetypes.h"
static struct mime_backend *mime_backends[] = { static const struct mime_backend *const mime_backends[] = {
&default_mime_backend, &default_mime_backend,
#ifdef CONFIG_MAILCAP #ifdef CONFIG_MAILCAP
&mailcap_mime_backend, &mailcap_mime_backend,
@ -39,7 +39,7 @@ static struct mime_backend *mime_backends[] = {
unsigned char * unsigned char *
get_content_type_backends(unsigned char *extension) get_content_type_backends(unsigned char *extension)
{ {
struct mime_backend *backend; const struct mime_backend *backend;
int i; int i;
foreach_module_builtin (backend, mime_backends, i) { foreach_module_builtin (backend, mime_backends, i) {
@ -57,7 +57,7 @@ get_content_type_backends(unsigned char *extension)
struct mime_handler * struct mime_handler *
get_mime_handler_backends(unsigned char *ctype, int have_x) get_mime_handler_backends(unsigned char *ctype, int have_x)
{ {
struct mime_backend *backend; const struct mime_backend *backend;
int i; int i;
foreach_module_builtin (backend, mime_backends, i) { foreach_module_builtin (backend, mime_backends, i) {

View File

@ -206,7 +206,7 @@ get_mime_handler_default(unsigned char *type, int have_x)
} }
struct mime_backend default_mime_backend = { const struct mime_backend default_mime_backend = {
/* get_content_type: */ get_content_type_default, /* get_content_type: */ get_content_type_default,
/* get_mime_handler: */ get_mime_handler_default, /* get_mime_handler: */ get_mime_handler_default,
}; };

View File

@ -5,7 +5,7 @@
#include "main/module.h" #include "main/module.h"
#include "mime/backend/common.h" #include "mime/backend/common.h"
extern struct mime_backend default_mime_backend; extern const struct mime_backend default_mime_backend;
extern struct module default_mime_module; extern struct module default_mime_module;
#endif #endif

View File

@ -456,7 +456,7 @@ change_hook_mailcap(struct session *ses, struct option *current, struct option *
static void static void
init_mailcap(struct module *module) init_mailcap(struct module *module)
{ {
struct change_hook_info mimetypes_change_hooks[] = { static const struct change_hook_info mimetypes_change_hooks[] = {
{ "mime.mailcap", change_hook_mailcap }, { "mime.mailcap", change_hook_mailcap },
{ NULL, NULL }, { NULL, NULL },
}; };
@ -661,7 +661,7 @@ get_mime_handler_mailcap(unsigned char *type, int options)
} }
struct mime_backend mailcap_mime_backend = { const struct mime_backend mailcap_mime_backend = {
/* get_content_type: */ NULL, /* get_content_type: */ NULL,
/* get_mime_handler: */ get_mime_handler_mailcap, /* get_mime_handler: */ get_mime_handler_mailcap,
}; };

View File

@ -5,7 +5,7 @@
#include "main/module.h" #include "main/module.h"
#include "mime/backend/common.h" #include "mime/backend/common.h"
extern struct mime_backend mailcap_mime_backend; extern const struct mime_backend mailcap_mime_backend;
extern struct module mailcap_mime_module; extern struct module mailcap_mime_module;
#endif #endif

View File

@ -221,7 +221,7 @@ change_hook_mimetypes(struct session *ses, struct option *current, struct option
static void static void
init_mimetypes(struct module *module) init_mimetypes(struct module *module)
{ {
struct change_hook_info mimetypes_change_hooks[] = { static const struct change_hook_info mimetypes_change_hooks[] = {
{ "mime.mimetypes", change_hook_mimetypes }, { "mime.mimetypes", change_hook_mimetypes },
{ NULL, NULL }, { NULL, NULL },
}; };
@ -270,7 +270,7 @@ get_content_type_mimetypes(unsigned char *extension)
return NULL; return NULL;
} }
struct mime_backend mimetypes_mime_backend = { const struct mime_backend mimetypes_mime_backend = {
/* get_content_type: */ get_content_type_mimetypes, /* get_content_type: */ get_content_type_mimetypes,
/* get_mime_handler: */ NULL, /* get_mime_handler: */ NULL,
}; };

View File

@ -5,7 +5,7 @@
#include "main/module.h" #include "main/module.h"
#include "mime/backend/common.h" #include "mime/backend/common.h"
extern struct mime_backend mimetypes_mime_backend; extern const struct mime_backend mimetypes_mime_backend;
extern struct module mimetypes_mime_module; extern struct module mimetypes_mime_module;
#endif #endif

View File

@ -22,7 +22,8 @@
struct s_msg_dsc { struct s_msg_dsc {
int n; int n;
unsigned char *msg; unsigned char *msg;
} msg_dsc[] = { };
static const struct s_msg_dsc msg_dsc[] = {
{S_WAIT, N_("Waiting in queue")}, {S_WAIT, N_("Waiting in queue")},
{S_DNS, N_("Looking up host")}, {S_DNS, N_("Looking up host")},
{S_CONN, N_("Making connection")}, {S_CONN, N_("Making connection")},

View File

@ -349,6 +349,26 @@ static unsigned char *clipboard;
unsigned char * unsigned char *
get_clipboard_text(void) get_clipboard_text(void)
{ {
/* The following support for GNU Screen's clipboard is
* disabled for two reasons:
*
* 1. It does not actually return the string from that
* clipboard, but rather causes the clipboard contents to
* appear in stdin. get_clipboard_text is normally called
* because the user pressed a Paste key in an input field,
* so the characters end up being inserted in that field;
* but if there are newlines in the clipboard, then the
* field may lose focus, in which case the remaining
* characters may trigger arbitrary actions in ELinks.
*
* 2. It pastes from both GNU Screen's clipboard and the ELinks
* internal clipboard. Because set_clipboard_text also sets
* them both, the same text would typically get pasted twice.
*
* Users can instead use the GNU Screen key bindings to run the
* paste command. This method still suffers from problem 1 but
* any user of GNU Screen should know that already. */
#if 0
/* GNU Screen's clipboard */ /* GNU Screen's clipboard */
if (is_gnuscreen()) { if (is_gnuscreen()) {
struct string str; struct string str;
@ -359,6 +379,7 @@ get_clipboard_text(void)
if (str.length) exe(str.source); if (str.length) exe(str.source);
if (str.source) done_string(&str); if (str.source) done_string(&str);
} }
#endif
return stracpy(empty_string_or_(clipboard)); return stracpy(empty_string_or_(clipboard));
} }

View File

@ -241,7 +241,7 @@ static struct listbox_ops_messages http_auth_messages = {
N_("Do you really want to remove all auth entries?"), N_("Do you really want to remove all auth entries?"),
}; };
static struct listbox_ops auth_listbox_ops = { static const struct listbox_ops auth_listbox_ops = {
lock_auth_entry, lock_auth_entry,
unlock_auth_entry, unlock_auth_entry,
is_auth_entry_used, is_auth_entry_used,
@ -256,7 +256,7 @@ static struct listbox_ops auth_listbox_ops = {
&http_auth_messages, &http_auth_messages,
}; };
static struct hierbox_browser_button auth_buttons[] = { static const struct hierbox_browser_button auth_buttons[] = {
/* [gettext_accelerator_context(.auth_buttons)] */ /* [gettext_accelerator_context(.auth_buttons)] */
{ N_("~Goto"), push_hierbox_goto_button, 1 }, { N_("~Goto"), push_hierbox_goto_button, 1 },
{ N_("~Info"), push_hierbox_info_button, 1 }, { N_("~Info"), push_hierbox_info_button, 1 },

View File

@ -25,11 +25,11 @@
struct http_code { struct http_code {
int num; int num;
unsigned char *str; const unsigned char *str;
}; };
/* Source: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html */ /* Source: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html */
static struct http_code http_code[] = { static const struct http_code http_code[] = {
{ 100, "Continue" }, { 100, "Continue" },
{ 101, "Switching Protocols" }, { 101, "Switching Protocols" },
{ 200, "OK" }, { 200, "OK" },
@ -77,15 +77,16 @@ static int
compare_http_codes(const void *key, const void *element) compare_http_codes(const void *key, const void *element)
{ {
int first = (long) key; int first = (long) key;
int second = ((struct http_code *) element)->num; int second = ((const struct http_code *) element)->num;
return first - second; return first - second;
} }
static unsigned char * static const unsigned char *
http_code_to_string(int code) http_code_to_string(int code)
{ {
struct http_code *element = bsearch((void *) (long) code, http_code, const struct http_code *element
= bsearch((void *) (long) code, http_code,
sizeof_array(http_code), sizeof_array(http_code),
sizeof(*element), sizeof(*element),
compare_http_codes); compare_http_codes);
@ -100,7 +101,7 @@ http_code_to_string(int code)
static unsigned char * static unsigned char *
get_http_error_document(struct terminal *term, struct uri *uri, int code) get_http_error_document(struct terminal *term, struct uri *uri, int code)
{ {
unsigned char *codestr = http_code_to_string(code); const unsigned char *codestr = http_code_to_string(code);
unsigned char *title = asprintfa(_("HTTP error %03d", term), code); unsigned char *title = asprintfa(_("HTTP error %03d", term), code);
struct string string; struct string string;

View File

@ -440,8 +440,9 @@ static int
check_http_server_bugs(struct uri *uri, struct http_connection_info *http, check_http_server_bugs(struct uri *uri, struct http_connection_info *http,
unsigned char *head) unsigned char *head)
{ {
unsigned char *server, **s; unsigned char *server;
static unsigned char *buggy_servers[] = { const unsigned char *const *s;
static const unsigned char *const buggy_servers[] = {
"mod_czech/3.1.0", "mod_czech/3.1.0",
"Purveyor", "Purveyor",
"Netscape-Enterprise", "Netscape-Enterprise",

View File

@ -93,7 +93,7 @@ int
end_with_known_tld(unsigned char *s, int slen) end_with_known_tld(unsigned char *s, int slen)
{ {
int i; int i;
static const unsigned char *tld[] = static const unsigned char *const tld[] =
{ "com", "edu", "net", { "com", "edu", "net",
"org", "gov", "mil", "org", "gov", "mil",
"int", "biz", "arpa", "int", "biz", "arpa",

View File

@ -491,7 +491,7 @@ static int
l_set_option(LS) l_set_option(LS)
{ {
int nargs; int nargs;
struct option *opt, *current; struct option *opt;
const char *name; const char *name;
nargs = lua_gettop(S); nargs = lua_gettop(S);
@ -536,11 +536,8 @@ l_set_option(LS)
goto lua_error; goto lua_error;
} }
opt->flags |= OPT_TOUCHED;
/* Call hook */ /* Call hook */
current = opt; option_changed(lua_ses, opt);
call_change_hooks(lua_ses, current, opt);
return 1; return 1;
lua_error: lua_error:
@ -602,7 +599,7 @@ l_get_option(LS)
{ {
color_T color; color_T color;
unsigned char hexcolor[8]; unsigned char hexcolor[8];
unsigned char *strcolor; const unsigned char *strcolor;
color = opt->value.color; color = opt->value.color;
strcolor = get_color_string(color, hexcolor); strcolor = get_color_string(color, hexcolor);

View File

@ -1265,7 +1265,7 @@ do_type_query(struct type_query *type_query, unsigned char *ct, struct mime_hand
struct { struct {
unsigned char *type; unsigned char *type;
unsigned int plain:1; unsigned int plain:1;
} static known_types[] = { } static const known_types[] = {
{ "text/html", 0 }, { "text/html", 0 },
{ "text/plain", 1 }, { "text/plain", 1 },
{ "application/xhtml+xml", 0 }, /* RFC 3236 */ { "application/xhtml+xml", 0 }, /* RFC 3236 */

View File

@ -775,7 +775,7 @@ setup_first_session(struct session *ses, struct uri *uri)
if (!get_opt_bool("config.saving_style_w")) { if (!get_opt_bool("config.saving_style_w")) {
struct option *opt = get_opt_rec(config_options, "config.saving_style_w"); struct option *opt = get_opt_rec(config_options, "config.saving_style_w");
opt->value.number = 1; opt->value.number = 1;
option_changed(ses, opt, opt); option_changed(ses, opt);
if (get_opt_int("config.saving_style") != 3) { if (get_opt_int("config.saving_style") != 3) {
info_box(term, 0, info_box(term, 0,
N_("Warning"), ALIGN_CENTER, N_("Warning"), ALIGN_CENTER,

View File

@ -46,7 +46,7 @@ void
draw_border_cross(struct terminal *term, int x, int y, draw_border_cross(struct terminal *term, int x, int y,
enum border_cross_direction dir, struct color_pair *color) enum border_cross_direction dir, struct color_pair *color)
{ {
static unsigned char border_trans[2][4] = { static const unsigned char border_trans[2][4] = {
/* Used for BORDER_X_{RIGHT,LEFT}: */ /* Used for BORDER_X_{RIGHT,LEFT}: */
{ BORDER_SVLINE, BORDER_SRTEE, BORDER_SLTEE }, { BORDER_SVLINE, BORDER_SRTEE, BORDER_SLTEE },
/* Used for BORDER_X_{DOWN,UP}: */ /* Used for BORDER_X_{DOWN,UP}: */
@ -155,7 +155,7 @@ draw_line(struct terminal *term, int x, int y, int l, struct screen_char *line)
if (term->utf8) { if (term->utf8) {
struct screen_char *sc; struct screen_char *sc;
if (line->data == UCS_NO_CHAR && x == 0) { if (line[0].data == UCS_NO_CHAR && x == 0) {
unicode_val_T data_save; unicode_val_T data_save;
sc = line; sc = line;
@ -191,7 +191,7 @@ void
draw_border(struct terminal *term, struct box *box, draw_border(struct terminal *term, struct box *box,
struct color_pair *color, int width) struct color_pair *color, int width)
{ {
static enum border_char p1[] = { static const enum border_char p1[] = {
BORDER_SULCORNER, BORDER_SULCORNER,
BORDER_SURCORNER, BORDER_SURCORNER,
BORDER_SDLCORNER, BORDER_SDLCORNER,
@ -199,7 +199,7 @@ draw_border(struct terminal *term, struct box *box,
BORDER_SVLINE, BORDER_SVLINE,
BORDER_SHLINE, BORDER_SHLINE,
}; };
static enum border_char p2[] = { static const enum border_char p2[] = {
BORDER_DULCORNER, BORDER_DULCORNER,
BORDER_DURCORNER, BORDER_DURCORNER,
BORDER_DDLCORNER, BORDER_DDLCORNER,
@ -207,7 +207,7 @@ draw_border(struct terminal *term, struct box *box,
BORDER_DVLINE, BORDER_DVLINE,
BORDER_DHLINE, BORDER_DHLINE,
}; };
enum border_char *p = (width > 1) ? p2 : p1; const enum border_char *p = (width > 1) ? p2 : p1;
struct box borderbox; struct box borderbox;
set_box(&borderbox, box->x - 1, box->y - 1, set_box(&borderbox, box->x - 1, box->y - 1,

View File

@ -31,6 +31,8 @@ enum screen_char_attr {
/* One position in the terminal screen's image. */ /* One position in the terminal screen's image. */
struct screen_char { struct screen_char {
/* Contains either character value or frame data. /* Contains either character value or frame data.
* If @attr includes SCREEN_ATTR_FRAME, then @data is enum
* border_char; otherwise, @data is a character value.
* If CONFIG_UTF8 is defined, and UTF-8 I/O is enabled for the * If CONFIG_UTF8 is defined, and UTF-8 I/O is enabled for the
* terminal, then the character value is in UCS-4; otherwise, * terminal, then the character value is in UCS-4; otherwise,
* it is in the charset of the terminal, and the charset is * it is in the charset of the terminal, and the charset is

View File

@ -28,12 +28,12 @@
/* TODO: We must use termcap/terminfo if available! --pasky */ /* TODO: We must use termcap/terminfo if available! --pasky */
unsigned char frame_dumb[48] = " ||||++||++++++--|-+||++--|-+----++++++++ "; const unsigned char frame_dumb[48] = " ||||++||++++++--|-+||++--|-+----++++++++ ";
static unsigned char frame_vt100[48] = "aaaxuuukkuxkjjjkmvwtqnttmlvwtqnvvwwmmllnnjla "; static const unsigned char frame_vt100[48] = "aaaxuuukkuxkjjjkmvwtqnttmlvwtqnvvwwmmllnnjla ";
#ifndef CONFIG_UTF8 #ifndef CONFIG_UTF8
/* For UTF8 I/O */ /* For UTF8 I/O */
static unsigned char frame_vt100_u[48] = { static const unsigned char frame_vt100_u[48] = {
177, 177, 177, 179, 180, 180, 180, 191, 177, 177, 177, 179, 180, 180, 180, 191,
191, 180, 179, 191, 217, 217, 217, 191, 191, 180, 179, 191, 217, 217, 217, 191,
192, 193, 194, 195, 196, 197, 195, 195, 192, 193, 194, 195, 196, 197, 195, 195,
@ -43,7 +43,7 @@ static unsigned char frame_vt100_u[48] = {
}; };
#endif /* CONFIG_UTF8 */ #endif /* CONFIG_UTF8 */
static unsigned char frame_freebsd[48] = { static const unsigned char frame_freebsd[48] = {
130, 138, 128, 153, 150, 150, 150, 140, 130, 138, 128, 153, 150, 150, 150, 140,
140, 150, 153, 140, 139, 139, 139, 140, 140, 150, 153, 140, 139, 139, 139, 140,
142, 151, 152, 149, 146, 143, 149, 149, 142, 151, 152, 149, 146, 143, 149, 149,
@ -52,7 +52,7 @@ static unsigned char frame_freebsd[48] = {
143, 139, 141, 128, 128, 128, 128, 128, 143, 139, 141, 128, 128, 128, 128, 128,
}; };
static unsigned char frame_koi[48] = { static const unsigned char frame_koi[48] = {
144, 145, 146, 129, 135, 178, 180, 167, 144, 145, 146, 129, 135, 178, 180, 167,
166, 181, 161, 168, 174, 173, 172, 131, 166, 181, 161, 168, 174, 173, 172, 131,
132, 137, 136, 134, 128, 138, 175, 176, 132, 137, 136, 134, 128, 138, 175, 176,
@ -62,7 +62,7 @@ static unsigned char frame_koi[48] = {
}; };
/* Most of this table is just 176 + <index in table>. */ /* Most of this table is just 176 + <index in table>. */
static unsigned char frame_restrict[48] = { static const unsigned char frame_restrict[48] = {
176, 177, 178, 179, 180, 179, 186, 186, 176, 177, 178, 179, 180, 179, 186, 186,
205, 185, 186, 187, 188, 186, 205, 191, 205, 185, 186, 187, 188, 186, 205, 191,
192, 193, 194, 195, 196, 197, 179, 186, 192, 193, 194, 195, 196, 197, 179, 186,
@ -76,24 +76,24 @@ static unsigned char frame_restrict[48] = {
#define add_term_string(str, tstr) \ #define add_term_string(str, tstr) \
add_bytes_to_string(str, (tstr).source, (tstr).length) add_bytes_to_string(str, (tstr).source, (tstr).length)
static struct string m11_hack_frame_seqs[] = { static const struct string m11_hack_frame_seqs[] = {
/* end border: */ TERM_STRING("\033[10m"), /* end border: */ TERM_STRING("\033[10m"),
/* begin border: */ TERM_STRING("\033[11m"), /* begin border: */ TERM_STRING("\033[11m"),
}; };
#ifdef CONFIG_UTF8 #ifdef CONFIG_UTF8
static struct string utf8_linux_frame_seqs[] = { static const struct string utf8_linux_frame_seqs[] = {
/* end border: */ TERM_STRING("\033[10m\033%G"), /* end border: */ TERM_STRING("\033[10m\033%G"),
/* begin border: */ TERM_STRING("\033%@\033[11m"), /* begin border: */ TERM_STRING("\033%@\033[11m"),
}; };
#endif /* CONFIG_UTF8 */ #endif /* CONFIG_UTF8 */
static struct string vt100_frame_seqs[] = { static const struct string vt100_frame_seqs[] = {
/* end border: */ TERM_STRING("\x0f"), /* end border: */ TERM_STRING("\x0f"),
/* begin border: */ TERM_STRING("\x0e"), /* begin border: */ TERM_STRING("\x0e"),
}; };
static struct string underline_seqs[] = { static const struct string underline_seqs[] = {
/* begin underline: */ TERM_STRING("\033[24m"), /* begin underline: */ TERM_STRING("\033[24m"),
/* end underline: */ TERM_STRING("\033[4m"), /* end underline: */ TERM_STRING("\033[4m"),
}; };
@ -112,18 +112,18 @@ struct screen_driver {
#ifndef CONFIG_UTF8 #ifndef CONFIG_UTF8
/* Charsets when doing UTF8 I/O. */ /* Charsets when doing UTF8 I/O. */
/* [0] is the common charset and [1] is the frame charset. /* [0] is the common charset and [1] is the frame charset.
* Test wether to use UTF8 I/O using the use_utf8_io() macro. */ * Test whether to use UTF8 I/O using the use_utf8_io() macro. */
int charsets[2]; int charsets[2];
#endif /* CONFIG_UTF8 */ #endif /* CONFIG_UTF8 */
/* The frame translation table. May be NULL. */ /* The frame translation table. May be NULL. */
unsigned char *frame; const unsigned char *frame;
/* The frame mode setup and teardown sequences. May be NULL. */ /* The frame mode setup and teardown sequences. May be NULL. */
struct string *frame_seqs; const struct string *frame_seqs;
/* The underline mode setup and teardown sequences. May be NULL. */ /* The underline mode setup and teardown sequences. May be NULL. */
struct string *underline; const struct string *underline;
/* The color mode */ /* The color mode */
enum color_mode color_mode; enum color_mode color_mode;
@ -140,7 +140,7 @@ struct screen_driver {
unsigned char name[1]; /* XXX: Keep last! */ unsigned char name[1]; /* XXX: Keep last! */
}; };
static struct screen_driver dumb_screen_driver = { static const struct screen_driver dumb_screen_driver = {
NULL_LIST_HEAD, NULL_LIST_HEAD,
/* type: */ TERM_DUMB, /* type: */ TERM_DUMB,
#ifndef CONFIG_UTF8 #ifndef CONFIG_UTF8
@ -156,7 +156,7 @@ static struct screen_driver dumb_screen_driver = {
#endif /* CONFIG_UTF8 */ #endif /* CONFIG_UTF8 */
}; };
static struct screen_driver vt100_screen_driver = { static const struct screen_driver vt100_screen_driver = {
NULL_LIST_HEAD, NULL_LIST_HEAD,
/* type: */ TERM_VT100, /* type: */ TERM_VT100,
#ifndef CONFIG_UTF8 #ifndef CONFIG_UTF8
@ -172,7 +172,7 @@ static struct screen_driver vt100_screen_driver = {
#endif /* CONFIG_UTF8 */ #endif /* CONFIG_UTF8 */
}; };
static struct screen_driver linux_screen_driver = { static const struct screen_driver linux_screen_driver = {
NULL_LIST_HEAD, NULL_LIST_HEAD,
/* type: */ TERM_LINUX, /* type: */ TERM_LINUX,
#ifndef CONFIG_UTF8 #ifndef CONFIG_UTF8
@ -188,7 +188,7 @@ static struct screen_driver linux_screen_driver = {
#endif /* CONFIG_UTF8 */ #endif /* CONFIG_UTF8 */
}; };
static struct screen_driver koi8_screen_driver = { static const struct screen_driver koi8_screen_driver = {
NULL_LIST_HEAD, NULL_LIST_HEAD,
/* type: */ TERM_KOI8, /* type: */ TERM_KOI8,
#ifndef CONFIG_UTF8 #ifndef CONFIG_UTF8
@ -204,7 +204,7 @@ static struct screen_driver koi8_screen_driver = {
#endif /* CONFIG_UTF8 */ #endif /* CONFIG_UTF8 */
}; };
static struct screen_driver freebsd_screen_driver = { static const struct screen_driver freebsd_screen_driver = {
NULL_LIST_HEAD, NULL_LIST_HEAD,
/* type: */ TERM_FREEBSD, /* type: */ TERM_FREEBSD,
#ifndef CONFIG_UTF8 #ifndef CONFIG_UTF8
@ -221,7 +221,7 @@ static struct screen_driver freebsd_screen_driver = {
}; };
/* XXX: Keep in sync with enum term_mode_type. */ /* XXX: Keep in sync with enum term_mode_type. */
static struct screen_driver *screen_drivers[] = { static const struct screen_driver *const screen_drivers[] = {
/* TERM_DUMB: */ &dumb_screen_driver, /* TERM_DUMB: */ &dumb_screen_driver,
/* TERM_VT100: */ &vt100_screen_driver, /* TERM_VT100: */ &vt100_screen_driver,
/* TERM_LINUX: */ &linux_screen_driver, /* TERM_LINUX: */ &linux_screen_driver,
@ -532,10 +532,19 @@ add_char_data(struct string *screen, struct screen_driver *driver,
unsigned char data, unsigned char border) unsigned char data, unsigned char border)
#endif /* CONFIG_UTF8 */ #endif /* CONFIG_UTF8 */
{ {
if (!isscreensafe(data)) { /* CONFIG_UTF8 use_utf8_io border data add_to_string
add_char_to_string(screen, ' '); * ----------- ----------- ------ ---------------- ----------------
return; * not defined 0 0 terminal unibyte terminal unibyte
} * not defined 0 1 enum border_char border unibyte
* not defined 1 0 terminal unibyte UTF-8
* not defined 1 1 enum border_char UTF-8
* defined 0 0 terminal unibyte terminal unibyte
* defined 0 1 enum border_char border unibyte
* defined 1 0 UTF-32 UTF-8
* defined 1 1 enum border_char border unibyte
*
* For "UTF-32" above, the data can also be UCS_NO_CHAR.
*/
if (border && driver->frame && data >= 176 && data < 224) if (border && driver->frame && data >= 176 && data < 224)
data = driver->frame[data - 176]; data = driver->frame[data - 176];
@ -544,18 +553,25 @@ add_char_data(struct string *screen, struct screen_driver *driver,
#ifdef CONFIG_UTF8 #ifdef CONFIG_UTF8
if (border) if (border)
add_char_to_string(screen, (unsigned char)data); add_char_to_string(screen, (unsigned char)data);
else else if (data != UCS_NO_CHAR) {
if (data != UCS_NO_CHAR) if (!isscreensafe_ucs(data))
data = UCS_SPACE;
add_to_string(screen, encode_utf8(data)); add_to_string(screen, encode_utf8(data));
}
#else #else
int charset = driver->charsets[!!border]; int charset = driver->charsets[!!border];
if (border || isscreensafe(data))
add_to_string(screen, cp2utf8(charset, data)); add_to_string(screen, cp2utf8(charset, data));
else /* UCS_SPACE <= 0x7F and so fits in one UTF-8 byte */
add_char_to_string(screen, UCS_SPACE);
#endif /* CONFIG_UTF8 */ #endif /* CONFIG_UTF8 */
return; } else {
} if (border || isscreensafe(data))
add_char_to_string(screen, (unsigned char)data); add_char_to_string(screen, (unsigned char)data);
else
add_char_to_string(screen, ' ');
}
} }
/* Time critical section. */ /* Time critical section. */
@ -655,13 +671,13 @@ add_char16(struct string *screen, struct screen_driver *driver,
} }
#if defined(CONFIG_88_COLORS) || defined(CONFIG_256_COLORS) #if defined(CONFIG_88_COLORS) || defined(CONFIG_256_COLORS)
static struct string color256_seqs[] = { static const struct string color256_seqs[] = {
/* foreground: */ TERM_STRING("\033[0;38;5;%dm"), /* foreground: */ TERM_STRING("\033[0;38;5;%dm"),
/* background: */ TERM_STRING("\033[48;5;%dm"), /* background: */ TERM_STRING("\033[48;5;%dm"),
}; };
static inline void static inline void
add_char_color(struct string *screen, struct string *seq, unsigned char color) add_char_color(struct string *screen, const struct string *seq, unsigned char color)
{ {
unsigned char color_buf[3]; unsigned char color_buf[3];
unsigned char *color_pos = color_buf; unsigned char *color_pos = color_buf;
@ -772,14 +788,14 @@ add_char256(struct string *screen, struct screen_driver *driver,
#endif #endif
#ifdef CONFIG_TRUE_COLOR #ifdef CONFIG_TRUE_COLOR
static struct string color_true_seqs[] = { static const struct string color_true_seqs[] = {
/* foreground: */ TERM_STRING("\033[0;38;2"), /* foreground: */ TERM_STRING("\033[0;38;2"),
/* background: */ TERM_STRING("\033[48;2"), /* background: */ TERM_STRING("\033[48;2"),
}; };
#define add_true_background_color(str, seq, chr) add_char_true_color(str, &(seq)[1], &(chr)->color[3]) #define add_true_background_color(str, seq, chr) add_char_true_color(str, &(seq)[1], &(chr)->color[3])
#define add_true_foreground_color(str, seq, chr) add_char_true_color(str, &(seq)[0], &(chr)->color[0]) #define add_true_foreground_color(str, seq, chr) add_char_true_color(str, &(seq)[0], &(chr)->color[0])
static inline void static inline void
add_char_true_color(struct string *screen, struct string *seq, unsigned char *colors) add_char_true_color(struct string *screen, const struct string *seq, unsigned char *colors)
{ {
unsigned char color_buf[3]; unsigned char color_buf[3];
int i; int i;

View File

@ -159,7 +159,7 @@ struct terminal {
extern struct list_head terminals; extern struct list_head terminals;
extern unsigned char frame_dumb[]; extern const unsigned char frame_dumb[];
struct terminal *init_term(int, int); struct terminal *init_term(int, int);
void destroy_terminal(struct terminal *); void destroy_terminal(struct terminal *);

View File

@ -18,11 +18,11 @@
#include "util/string.h" #include "util/string.h"
struct color_spec { struct color_spec {
char *name; const char *name;
color_T rgb; color_T rgb;
}; };
static struct color_spec color_specs[] = { static const struct color_spec color_specs[] = {
#include "util/color_s.inc" #include "util/color_s.inc"
#ifndef CONFIG_SMALL #ifndef CONFIG_SMALL
#include "util/color.inc" #include "util/color.inc"
@ -32,7 +32,7 @@ static struct color_spec color_specs[] = {
#ifdef USE_FASTFIND #ifdef USE_FASTFIND
static struct color_spec *internal_pointer; static const struct color_spec *internal_pointer;
static void static void
colors_list_reset(void) colors_list_reset(void)
@ -52,7 +52,7 @@ colors_list_next(void)
if (!internal_pointer->name) return NULL; if (!internal_pointer->name) return NULL;
kv.key = (unsigned char *) internal_pointer->name; kv.key = (unsigned char *) internal_pointer->name;
kv.data = internal_pointer; kv.data = (void *) internal_pointer; /* cast away const */
internal_pointer++; internal_pointer++;
@ -107,7 +107,7 @@ decode_hex_color:
return 0; return 0;
} }
} else { } else {
struct color_spec *cs; const struct color_spec *cs;
#ifndef USE_FASTFIND #ifndef USE_FASTFIND
for (cs = color_specs; cs->name; cs++) for (cs = color_specs; cs->name; cs++)
@ -135,10 +135,10 @@ decode_hex_color:
return -1; /* Not found */ return -1; /* Not found */
} }
unsigned char * const unsigned char *
get_color_string(color_T color, unsigned char hexcolor[8]) get_color_string(color_T color, unsigned char hexcolor[8])
{ {
struct color_spec *cs; const struct color_spec *cs;
for (cs = color_specs; cs->name; cs++) for (cs = color_specs; cs->name; cs++)
if (cs->rgb == color) if (cs->rgb == color)

View File

@ -17,7 +17,7 @@ int decode_color(unsigned char *str, int slen, color_T *color);
/* Returns a string containing the color info. If no ``English'' name can be /* Returns a string containing the color info. If no ``English'' name can be
* found the hex color (#rrggbb) is returned in the given buffer. */ * found the hex color (#rrggbb) is returned in the given buffer. */
unsigned char *get_color_string(color_T color, unsigned char hexcolor[8]); const unsigned char *get_color_string(color_T color, unsigned char hexcolor[8]);
/* Translate rgb color to string in #rrggbb format. str should be a pointer to /* Translate rgb color to string in #rrggbb format. str should be a pointer to
* a 8 bytes memory space. */ * a 8 bytes memory space. */

View File

@ -52,9 +52,9 @@ elinks_ulongcat(unsigned char *s, unsigned int *slen,
unsigned char fillchar, unsigned int base, unsigned char fillchar, unsigned int base,
unsigned int upper) unsigned int upper)
{ {
static unsigned char unum[]= "0123456789ABCDEF"; static const unsigned char unum[]= "0123456789ABCDEF";
static unsigned char lnum[]= "0123456789abcdef"; static const unsigned char lnum[]= "0123456789abcdef";
unsigned char *to_num = (unsigned char *) (upper ? &unum : &lnum); const unsigned char *to_num = (upper ? unum : lnum);
unsigned int start = slen ? *slen : 0; unsigned int start = slen ? *slen : 0;
unsigned int nlen = 1; /* '0' is one char, we can't have less. */ unsigned int nlen = 1; /* '0' is one char, we can't have less. */
unsigned int pos = start; /* starting position of the number */ unsigned int pos = start; /* starting position of the number */
@ -295,7 +295,7 @@ add_html_to_string(struct string *string, unsigned char *src, int len)
/* TODO Optimize later --pasky */ /* TODO Optimize later --pasky */
struct string * struct string *
add_quoted_to_string(struct string *string, unsigned char *src, int len) add_quoted_to_string(struct string *string, const unsigned char *src, int len)
{ {
for (; len; len--, src++) { for (; len; len--, src++) {
if (isquote(*src) || *src == '\\') if (isquote(*src) || *src == '\\')

View File

@ -80,7 +80,7 @@ add_string_replace(struct string *string, unsigned char *src, int len,
struct string *add_html_to_string(struct string *string, unsigned char *html, int htmllen); struct string *add_html_to_string(struct string *string, unsigned char *html, int htmllen);
/* Escapes \ and " with a \ */ /* Escapes \ and " with a \ */
struct string *add_quoted_to_string(struct string *string, unsigned char *q, int qlen); struct string *add_quoted_to_string(struct string *string, const unsigned char *q, int qlen);
/* Adds ', |len| bytes of |src| with all single-quotes converted to '\'', /* Adds ', |len| bytes of |src| with all single-quotes converted to '\'',
* and ' to |string|. */ * and ' to |string|. */

View File

@ -124,7 +124,7 @@ void *mem_realloc(void *, size_t);
static inline void * static inline void *
mem_align_alloc__( mem_align_alloc__(
#ifdef DEBUG_MEMLEAK #ifdef DEBUG_MEMLEAK
unsigned char *file, int line, const unsigned char *file, int line,
#endif #endif
void **ptr, size_t old, size_t new, size_t objsize, size_t mask) void **ptr, size_t old, size_t new, size_t objsize, size_t mask)
{ {

View File

@ -97,7 +97,7 @@ stracpy(const unsigned char *src)
void void
add_to_strn(unsigned char **dst, unsigned char *src) add_to_strn(unsigned char **dst, const unsigned char *src)
{ {
unsigned char *newdst; unsigned char *newdst;
int dstlen; int dstlen;
@ -132,10 +132,10 @@ insert_in_string(unsigned char **dst, int pos,
} }
unsigned char * unsigned char *
straconcat(unsigned char *str, ...) straconcat(const unsigned char *str, ...)
{ {
va_list ap; va_list ap;
unsigned char *a; const unsigned char *a;
unsigned char *s; unsigned char *s;
unsigned int len; unsigned int len;
@ -149,7 +149,7 @@ straconcat(unsigned char *str, ...)
if (len) memcpy(s, str, len); if (len) memcpy(s, str, len);
va_start(ap, str); va_start(ap, str);
while ((a = va_arg(ap, unsigned char *))) { while ((a = va_arg(ap, const unsigned char *))) {
unsigned int l = strlen(a); unsigned int l = strlen(a);
unsigned char *ns; unsigned char *ns;
@ -173,7 +173,7 @@ straconcat(unsigned char *str, ...)
} }
int int
xstrcmp(unsigned char *s1, unsigned char *s2) xstrcmp(const unsigned char *s1, const unsigned char *s2)
{ {
if (!s1) return -!!s2; if (!s1) return -!!s2;
if (!s2) return 1; if (!s2) return 1;
@ -245,7 +245,7 @@ elinks_strlcasecmp(const unsigned char *s1, size_t n1,
inline struct string * inline struct string *
#ifdef DEBUG_MEMLEAK #ifdef DEBUG_MEMLEAK
init_string__(unsigned char *file, int line, struct string *string) init_string__(const unsigned char *file, int line, struct string *string)
#else #else
init_string(struct string *string) init_string(struct string *string)
#endif #endif
@ -318,7 +318,7 @@ add_crlf_to_string(struct string *string)
} }
inline struct string * inline struct string *
add_string_to_string(struct string *string, struct string *from) add_string_to_string(struct string *string, const struct string *from)
{ {
assertm(string && from, "[add_string_to_string]"); assertm(string && from, "[add_string_to_string]");
if_assert_failed { return NULL; } if_assert_failed { return NULL; }
@ -332,7 +332,7 @@ add_string_to_string(struct string *string, struct string *from)
} }
struct string * struct string *
add_file_to_string(struct string *string, unsigned char *filename) add_file_to_string(struct string *string, const unsigned char *filename)
{ {
FILE *file; FILE *file;
off_t filelen; off_t filelen;
@ -375,7 +375,7 @@ struct string *
string_concat(struct string *string, ...) string_concat(struct string *string, ...)
{ {
va_list ap; va_list ap;
unsigned char *source; const unsigned char *source;
assertm(string, "[string_concat]"); assertm(string, "[string_concat]");
if_assert_failed { return NULL; } if_assert_failed { return NULL; }
@ -383,7 +383,7 @@ string_concat(struct string *string, ...)
check_string_magic(string); check_string_magic(string);
va_start(ap, string); va_start(ap, string);
while ((source = va_arg(ap, unsigned char *))) while ((source = va_arg(ap, const unsigned char *)))
if (*source) if (*source)
add_to_string(string, source); add_to_string(string, source);
@ -434,7 +434,7 @@ add_xchar_to_string(struct string *string, unsigned char character, int times)
/* Add printf-like format string to @string. */ /* Add printf-like format string to @string. */
struct string * struct string *
add_format_to_string(struct string *string, unsigned char *format, ...) add_format_to_string(struct string *string, const unsigned char *format, ...)
{ {
int newlength; int newlength;
int width; int width;

View File

@ -43,7 +43,7 @@ unsigned char *debug_stracpy(const unsigned char *, int, const unsigned char *);
/* Concatenates @src to @str. */ /* Concatenates @src to @str. */
/* If reallocation of @str fails @str is not touched. */ /* If reallocation of @str fails @str is not touched. */
void add_to_strn(unsigned char **str, unsigned char *src); void add_to_strn(unsigned char **str, const unsigned char *src);
/* Inserts @seqlen chars from @seq at position @pos in the @dst string. */ /* Inserts @seqlen chars from @seq at position @pos in the @dst string. */
/* If reallocation of @dst fails it is not touched and NULL is returned. */ /* If reallocation of @dst fails it is not touched and NULL is returned. */
@ -58,13 +58,13 @@ unsigned char *insert_in_string(unsigned char **dst, int pos,
* if (abc) return; * if (abc) return;
* printf("%s", abc); -> print "ABC" * printf("%s", abc); -> print "ABC"
* mem_free(abc); -> free memory used by @abc */ * mem_free(abc); -> free memory used by @abc */
unsigned char *straconcat(unsigned char *str, ...); unsigned char *straconcat(const unsigned char *str, ...);
/* Misc. utility string functions. */ /* Misc. utility string functions. */
/* Compare two strings, handling correctly @s1 or @s2 being NULL. */ /* Compare two strings, handling correctly @s1 or @s2 being NULL. */
int xstrcmp(unsigned char *s1, unsigned char *s2); int xstrcmp(const unsigned char *s1, const unsigned char *s2);
/* Copies at most @len chars into @dst. Ensures null termination of @dst. */ /* Copies at most @len chars into @dst. Ensures null termination of @dst. */
unsigned char *safe_strncpy(unsigned char *dst, const unsigned char *src, size_t len); unsigned char *safe_strncpy(unsigned char *dst, const unsigned char *src, size_t len);
@ -109,9 +109,14 @@ int elinks_strlcasecmp(const unsigned char *s1, size_t n1,
#define isasciialnum(c) (isasciialpha(c) || isdigit(c)) #define isasciialnum(c) (isasciialpha(c) || isdigit(c))
#define isident(c) (isasciialnum(c) || (c) == '_' || (c) == '-') #define isident(c) (isasciialnum(c) || (c) == '_' || (c) == '-')
/* Char is safe to write to the terminal screen */ /* Char is safe to write to the terminal screen. Cannot test for C1
* control characters (0x80 to 0x9F) because this is also used for
* non-ISO-8859 charsets. */
#define isscreensafe(c) ((c) >= ' ' && (c) != ASCII_DEL) #define isscreensafe(c) ((c) >= ' ' && (c) != ASCII_DEL)
/* Like isscreensafe but takes Unicode values and so can check for C1. */
#define isscreensafe_ucs(c) (((c) >= 0x20 && (c) <= 0x7E) || (c) >= 0xA0)
/* String debugging using magic number, it may catch some errors. */ /* String debugging using magic number, it may catch some errors. */
#ifdef CONFIG_DEBUG #ifdef CONFIG_DEBUG
@ -145,7 +150,7 @@ struct string {
/* Initializes the passed string struct by preallocating the @source member. */ /* Initializes the passed string struct by preallocating the @source member. */
#ifdef DEBUG_MEMLEAK #ifdef DEBUG_MEMLEAK
struct string *init_string__(unsigned char *file, int line, struct string *string); struct string *init_string__(const unsigned char *file, int line, struct string *string);
#define init_string(string) init_string__(__FILE__, __LINE__, string) #define init_string(string) init_string__(__FILE__, __LINE__, string)
#else #else
struct string *init_string(struct string *string); struct string *init_string(struct string *string);
@ -158,8 +163,8 @@ void done_string(struct string *string);
struct string *add_to_string(struct string *string, struct string *add_to_string(struct string *string,
const unsigned char *source); const unsigned char *source);
struct string *add_char_to_string(struct string *string, unsigned char character); struct string *add_char_to_string(struct string *string, unsigned char character);
struct string *add_string_to_string(struct string *to, struct string *from); struct string *add_string_to_string(struct string *to, const struct string *from);
struct string *add_file_to_string(struct string *string, unsigned char *filename); struct string *add_file_to_string(struct string *string, const unsigned char *filename);
struct string *add_crlf_to_string(struct string *string); struct string *add_crlf_to_string(struct string *string);
/* Adds each C string to @string until a terminating NULL is met. */ /* Adds each C string to @string until a terminating NULL is met. */
@ -169,7 +174,7 @@ struct string *string_concat(struct string *string, ...);
struct string *add_xchar_to_string(struct string *string, unsigned char character, int times); struct string *add_xchar_to_string(struct string *string, unsigned char character, int times);
/* Add printf-style format string to @string. */ /* Add printf-style format string to @string. */
struct string *add_format_to_string(struct string *string, unsigned char *format, ...); struct string *add_format_to_string(struct string *string, const unsigned char *format, ...);
/* Get a regular newly allocated stream of bytes from @string. */ /* Get a regular newly allocated stream of bytes from @string. */
static unsigned char *squeezastring(struct string *string); static unsigned char *squeezastring(struct string *string);
@ -209,7 +214,7 @@ squeezastring(struct string *string)
static inline struct string * static inline struct string *
add_bytes_to_string__( add_bytes_to_string__(
#ifdef DEBUG_MEMLEAK #ifdef DEBUG_MEMLEAK
unsigned char *file, int line, const unsigned char *file, int line,
#endif #endif
struct string *string, const unsigned char *bytes, struct string *string, const unsigned char *bytes,
int length) int length)

View File

@ -405,7 +405,7 @@ utf8:
unicode_val_T data = pos->data; unicode_val_T data = pos->data;
unsigned int frame = (pos->attr & SCREEN_ATTR_FRAME); unsigned int frame = (pos->attr & SCREEN_ATTR_FRAME);
if (!isscreensafe(data)) { if (!isscreensafe_ucs(data)) {
white++; white++;
continue; continue;
} else { } else {

View File

@ -71,6 +71,7 @@ index_from_char(unsigned char mark)
void void
goto_mark(unsigned char mark, struct view_state *vs) goto_mark(unsigned char mark, struct view_state *vs)
{ {
int old_current_link;
#ifdef CONFIG_ECMASCRIPT #ifdef CONFIG_ECMASCRIPT
struct ecmascript_interpreter *ecmascript; struct ecmascript_interpreter *ecmascript;
int ecmascript_fragile; int ecmascript_fragile;
@ -88,6 +89,7 @@ goto_mark(unsigned char mark, struct view_state *vs)
if (!marks[i] || !compare_uri(marks[i]->uri, vs->uri, 0)) if (!marks[i] || !compare_uri(marks[i]->uri, vs->uri, 0))
return; return;
old_current_link = vs->current_link;
#ifdef CONFIG_ECMASCRIPT #ifdef CONFIG_ECMASCRIPT
ecmascript = vs->ecmascript; ecmascript = vs->ecmascript;
ecmascript_fragile = vs->ecmascript_fragile; ecmascript_fragile = vs->ecmascript_fragile;
@ -103,6 +105,7 @@ goto_mark(unsigned char mark, struct view_state *vs)
vs->ecmascript = ecmascript; vs->ecmascript = ecmascript;
vs->ecmascript_fragile = ecmascript_fragile; vs->ecmascript_fragile = ecmascript_fragile;
#endif #endif
vs->old_current_link = old_current_link;
} }
static void static void

View File

@ -1400,7 +1400,7 @@ text_typeahead_handler(struct input_line *line, int action_id)
opt->value.number = (opt->value.number + 1) opt->value.number = (opt->value.number + 1)
% (opt->max + 1); % (opt->max + 1);
option_changed(ses, opt, opt); option_changed(ses, opt);
} }
/* Fall thru */ /* Fall thru */