1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Merge branch 'master' of /srv/git/elinks

This commit is contained in:
Petr Baudis 2007-08-28 17:43:14 +02:00 committed by Petr Baudis
commit 2480d1ae0a
41 changed files with 2214 additions and 2106 deletions

View File

@ -56,6 +56,7 @@ CATALOGS = @CATALOGS@
CC = @CC@
CG_COMMIT_ID = @CG_COMMIT_ID@
CONFDIR = @CONFDIR@
DOXYGEN = @DOXYGEN@
GLIBC21 = @GLIBC21@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
@ -99,6 +100,7 @@ CONFIG_NLS = @CONFIG_NLS@
CONFIG_256_COLORS = @CONFIG_256_COLORS@
CONFIG_88_COLORS = @CONFIG_88_COLORS@
CONFIG_ASCIIDOC = @CONFIG_ASCIIDOC@
CONFIG_DOXYGEN = @CONFIG_DOXYGEN@
CONFIG_BACKTRACE = @CONFIG_BACKTRACE@
CONFIG_BITTORRENT = @CONFIG_BITTORRENT@
CONFIG_BOOKMARKS = @CONFIG_BOOKMARKS@

6
NEWS
View File

@ -17,7 +17,7 @@ To be released as ELinks 0.12.0.
//////////////////////////////////////////////////////////////////////
This list now contains all the important changes from ELinks 0.11.0 to
ELinks 0.12.GIT (98260f7970bcd940f2d2146ac7b5a980a7586082) and related
ELinks 0.12.GIT (21052fafb0be0b87b7f376fb4edfa70304e365cc) and related
bug numbers. Each section is sorted by severity and grouped by topic.
The list no doubt includes several changes that are not really
@ -61,8 +61,12 @@ Incompatibilities:
Miscellaneous:
* critical bug 723: fix dangling pointer crash when following a link
in a frame
* critical bug 756: ``assertion (cached)->object.refcount >= 0 failed''
after HTTP proxy was changed
* critical bug 869: long mailcap entry buffer overflow (non-security)
when downloading
* tabs opened by -remote now go behind existing dialogs
* Debian bug 257762: turn terminal transparency off by default
* bug 724: better parsing of escape sequences and control

View File

@ -95,10 +95,18 @@ if test "x$CONFIG_DOC" != xno; then
if test "x$POD2HTML" != "x"; then
EL_CONFIG(CONFIG_POD2HTML, [Pod2HTML])
fi
AC_PATH_PROGS(DOXYGEN, "doxygen")
if test "x$DOXYGEN" != "x"; then
EL_CONFIG(CONFIG_DOXYGEN, [Doxygen])
api_srcdir="$(cd "$srcdir" && pwd)/src"
AC_SUBST(api_srcdir)
fi
fi
AC_SUBST(ASCIIDOC_FLAGS)
AC_SUBST(CONFIG_ASCIIDOC)
AC_SUBST(CONFIG_DOXYGEN)
AC_SUBST(CONFIG_POD2HTML)
AC_SUBST(CONFIG_XMLTO)
AC_SUBST(CONFIG_JW)
@ -106,6 +114,7 @@ AC_SUBST(CONFIG_JW)
EL_CONFIG_DEPENDS(CONFIG_DOC, [CONFIG_ASCIIDOC CONFIG_XMLTO CONFIG_JW CONFIG_POD2HTML], [Documentation Tools])
EL_CONFIG_DEPENDS(CONFIG_MANUAL, [MANUAL_ASCIIDOC MANUAL_XMLTO MANUAL_JW], [Manual Formats])
EL_CONFIG_DEPENDS(CONFIG_MANPAGE, [MAN_ASCIIDOC MAN_XMLTO], [Man Page Formats])
EL_CONFIG_DEPENDS(CONFIG_APIDOCS, [CONFIG_DOXYGEN], [API Documentation])
dnl gcc specific options (to be continued at the bottom of configure)
if test "x$ac_cv_c_compiler_gnu" = "xyes"; then
@ -1451,6 +1460,7 @@ AC_CONFIG_FILES([ \
contrib/elinks.spec \
contrib/lua/hooks.lua \
contrib/conv/w3m2links.awk \
doc/Doxyfile \
doc/man/man1/elinks.1 \
src/intl/gettext/ref-add.sed \
src/intl/gettext/ref-del.sed

1
doc/.gitignore vendored
View File

@ -12,3 +12,4 @@ keymap-defaults.txt
manual.html-chunked
option-command.txt
option-config.txt
Doxyfile

View File

@ -7,7 +7,7 @@
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = ELinks
PROJECT_NUMBER = 0.13.GIT
OUTPUT_DIRECTORY = ../doc/api
OUTPUT_DIRECTORY = api
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
@ -26,7 +26,7 @@ ABBREVIATE_BRIEF = "The $name class" \
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = YES
STRIP_FROM_PATH = .
STRIP_FROM_PATH = @api_srcdir@
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = YES
@ -90,7 +90,7 @@ WARN_LOGFILE =
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = .
INPUT = @api_srcdir@
INPUT_ENCODING = UTF-8
FILE_PATTERNS = *.c \
*.h \
@ -224,10 +224,13 @@ SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED = "LIST_OF(element_T)=element_T list" \
CONFIG_ECMASCRIPT \
CONFIG_ECMASCRIPT_SEE \
CONFIG_DEBUG \
CONFIG_UTF8 \
HAVE_VARIADIC_MACROS
EXPAND_AS_DEFINED =
EXPAND_AS_DEFINED = LIST_HEAD \
INIT_LIST_OF
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------

View File

@ -56,6 +56,8 @@ MAN_DOCS-$(CONFIG_XMLTO) += \
PDF_DOCS-$(CONFIG_JW) += \
manual.pdf
API_DOCS-$(CONFIG_DOXYGEN) += \
api/doxygen
#############################################################################
## Set the default doc rules
@ -63,11 +65,13 @@ PDF_DOCS-$(CONFIG_JW) += \
MAN_DOCS = $(MAN_DOCS-yes)
HTML_DOCS = $(HTML_DOCS-yes)
PDF_DOCS = $(PDF_DOCS-yes)
API_DOCS = $(API_DOCS-yes)
txt: $(TXT_DOCS_NOINSTALL)
html: txt $(HTML_DOCS)
pdf: txt $(PDF_DOCS)
man: txt $(MAN_DOCS)
api: $(API_DOCS)
all-docs: man html pdf
@ -99,7 +103,6 @@ clean-local:
# TODO: perl.pod should be pod2ized during make install. --pasky
install-local:
#############################################################################
# Generated asciidoc files
@ -151,6 +154,9 @@ quiet_cmd_pod2html = ' [$(LINK_COLOR)POD2HTML$(END_COLOR)] $(RELPATH)$@'
quiet_cmd_asciidoc = ' [$(LINK_COLOR)ASCIIDOC$(END_COLOR)] $(RELPATH)$@'
cmd_asciidoc = $(ASCIIDOC) $(ASCIIDOC_FLAGS) -b $(call backend) -d $(call doctype) -o $@ $<
quiet_cmd_doxygen = ' [$(LINK_COLOR)DOXYGEN$(END_COLOR)] $(RELPATH)$@'
cmd_doxygen = $(DOXYGEN) $(2)
# Based on $@ find out asciidoc doctype or backend + xmlto output dir.
doctype = $(if $(findstring .1.,$@)$(findstring .5.,$@),manpage,book)
backend = $(if $(findstring .xml,$@),docbook,xhtml11)
@ -199,5 +205,11 @@ man_hack = sed "s/^\(\.TH \"ELINKS[^\"]*\" [0-9] \).*/\1\"$(1)\" \"$(MAN_DATE)\"
perl-%.html: %.pl
$(call cmd,pod2html)
Doxyfile: $(srcdir)Doxyfile.in $(top_srcdir)/configure.in
cd $(top_builddir) && \
CONFIG_FILES="$(RELPATH)$@" CONFIG_HEADERS= $(SHELL) ./config.status
api/doxygen: Doxyfile $(shell find $(top_srcdir)/src/ -name '*.[ch]' -o -name options.inc -o -name 'actions-*.inc' | sort)
$(call cmd,doxygen,$<)
include $(top_srcdir)/Makefile.lib

View File

@ -5118,12 +5118,11 @@ msgstr "dab."
#: src/dialogs/progress.c:65
msgid "Elapsed time"
msgstr "Likæs laikas"
msgstr "Praëjæs laikas"
#: src/dialogs/progress.c:66
#, fuzzy
msgid "elapsed time"
msgstr "Likæs laikas"
msgstr "praëjæs laikas"
#: src/dialogs/progress.c:67
msgid "ETT"
@ -5140,7 +5139,7 @@ msgstr "Greitis"
#: src/dialogs/progress.c:83
msgid "estimated time"
msgstr "numatytas laikas"
msgstr "likæs laikas"
#: src/dialogs/progress.c:84
msgid "ETA"

3450
po/pl.po

File diff suppressed because it is too large Load Diff

1
src/.gitignore vendored
View File

@ -1,2 +1,3 @@
ID
TAGS
tags

View File

@ -43,15 +43,21 @@ elinks: $(LIB_O_NAME) vernum.o
# directories, one doesn't have to remember which of those build
# directories has the most recent TAGS.
TAGS:
cd $(srcdir) \
cd $(firstword $(srcdir) .) \
&& find . \( -name "*.[ch]" -o -name "*.inc" \) -print \
| etags --regex='{c}/INIT_LIST_OF([^,]*,[ \t]*\([[:alnum:]_]+\))/\1/' \
| etags --regex='{c}/\(?:static \)?INIT_LIST_OF([^,]*,[ \t]*\([[:alnum:]_]+\))/\1/' \
--regex='{c}/struct_hierbox_browser(\n[ \t]*\([[:alnum:]_]+\),/\1/m' \
--regex='{c}/^ACTION_(\([[:alnum:]_]+\),[^,]*,[ \t]*\([[:alnum:]_]+\),/ACT_\1_\2/' \
--language=c -
.PHONY: TAGS
tags:
cd $(firstword $(srcdir) .) \
&& find . \( -name "*.[ch]" -o -name "*.inc" \) -print \
| ctags -L -
.PHONY: TAGS tags
PROGS = elinks
CLEAN = vernum.o
CLEAN = vernum.o TAGS tags
include $(top_srcdir)/Makefile.lib

View File

@ -7,30 +7,91 @@
struct session;
/** BFU hierbox browser button */
struct hierbox_browser_button {
/** The button label text
* It is automatically localized. */
unsigned char *label;
/** The button handler
* The handler gets called when the button is activated */
widget_handler_T *handler;
/* Should the button be displayed in anonymous mode */
/** Allow this button in anonymous mode
* Should the button be displayed in anonymous mode or not? This
* can be used to disable actions that are not safe in anonymous
* mode. */
unsigned int anonymous:1;
};
/** BFU hierbox browser
*
* Hierarchic listbox browsers are used for the various (subsystem)
* managers. They basically consist of some state data maintained
* throughout the life of the dialog (i.e. the listbox widget),
* manager specific operations (for modifying the underlying data
* structures), and some buttons.
*/
struct hierbox_browser {
/** The title of the browser
* Note, it is automatically localized. */
unsigned char *title;
/** Callback for (un)expansion of the listboxes
* Can be used by subsystems to install a handler to be called
* when listboxes are expanded and unexpanded. */
void (*expansion_callback)(void);
/** Array of browser buttons
*
* Each button represents an action for modifying or interacting
* with the items in the manager.
*
* A close button will be installed by default. */
const struct hierbox_browser_button *buttons;
/** The number of browser buttons */
size_t buttons_size;
/** List of active listbox containers
*
* Several instantiations of a manager can exist at the same
* time, if the user has more than one terminal open. This list
* contains all the listbox contains for this particular manager
* that are currently open. */
LIST_OF(struct listbox_data) boxes;
/** List of active dialogs
*
* Several instantiations of a manager can exist at the same
* time, if the user has more than one terminal open. This list
* contains all the manager dialogs for this particular manager
* that are currently open. */
LIST_OF(struct hierbox_dialog_list_item) dialogs;
/** The root listbox
* The ancestor of all listboxes in this listbox browser. */
struct listbox_item root;
/** Browser specific listbox operations
* The operations for managing the underlying data structures of
* the listboxes. */
const struct listbox_ops *ops;
/* For saving state */
unsigned int do_not_save_state:1;
/** State saved between invocations
* Each time the browser is closed, its current state is saved
* in this member so it can be restored when the browser is
* opened again. This way the currently selected item can be
* preserved across several interactions with the browser. */
struct listbox_data box_data;
/** Option for not saving the state
* Some browsers with highly dynamic content should not have
* their state restored. This member can be used to mark such
* browsers. */
unsigned int do_not_save_state:1;
};
/** Define a hierbox browser
* This macro takes care of initializing all the fields of a hierbox
* browser so it is ready to use. */
#define struct_hierbox_browser(name, title, buttons, ops) \
struct hierbox_browser name = { \
title, \
@ -69,32 +130,13 @@ add_listbox_item(struct hierbox_browser *browser, struct listbox_item *root,
#define add_listbox_leaf(browser, root, data) \
add_listbox_item(browser, root, BI_LEAF, data, 1)
/* We use hierarchic listbox browsers for the various managers. They consist
* of a listbox widget and some buttons.
/** Open a hierbox browser
* Opens an instantiation of a hierbox browser
*
* @term The terminal where the browser should appear.
*
* @title The title of the browser. It is automatically localized.
*
* @add_size The size of extra data to be allocated with the dialog.
*
* @browser The browser structure that contains info to setup listbox data
* and manage the dialog list to keep instances of the browser in
* sync on various terminals.
*
* @udata Is a reference to any data that the dialog could use.
*
* @buttons Denotes the number of buttons given as varadic arguments.
* For each button 4 arguments are extracted:
* o First the label text. It is automatically localized.
* If NULL, this button is skipped.
* o Second a pointer to a widget handler.
* XXX: A close button will be installed by default.
*
* XXX: Note that the @listbox_data is detached and freed by the dialog handler.
* Any other requirements should be handled by installing a specific
* dlg->abort handler. */
* @param browser The browser to open.
* @param ses The session (and terminal) on which it should appear.
* @return A reference to the dialog that was created or NULL.
*/
struct dialog_data *
hierbox_browser(struct hierbox_browser *browser, struct session *ses);

View File

@ -1,4 +1,5 @@
/* BFU display helpers. */
/** BFU style/color cache
* @file */
#ifdef HAVE_CONFIG_H
#include "config.h"

View File

@ -4,11 +4,27 @@
struct color_pair;
struct terminal;
/* Get the colors of the bfu element. If @color is 0 a style suitable for
* mono terminals is returned else a style for a color terminal. */
/** Get suitable BFU color for the specific terminal
*
* Get a color pair (foreground- and background color) for a specific
* BFU widget "style". Depending on the terminal settings a color
* suitable for either mono terminals or color terminals is returned.
* The returned color is derived by looking up the specified stylename
* under the option tree of "ui.colors.color" or the "ui.colors.mono",
* and using the values of the "text" and "background" color options as
* the values of the color pair.
*
* @param term Terminal for which the color will be used.
* @param stylename The name of the BFU color.
* @return A color pair matching the stylename or NULL.
*/
struct color_pair *
get_bfu_color(struct terminal *term, unsigned char *stylename);
/** Cleanup after the BFU style cache
*
* Free all resources used by the BFU style cache.
*/
void done_bfu_colors(void);
#endif

View File

@ -144,13 +144,13 @@ struct document {
#ifdef CONFIG_ECMASCRIPT
/** ECMAScript snippets to be executed during loading the document into
* a window. This currently involves <script>s and onLoad handlers.
* a window. This currently involves @<script>s and onLoad handlers.
* Note that if you hit a string beginning by '^' here, it is followed
* by an external reference - you must wait with processing other items
* until it gets resolved and loaded. New items are guaranteed to
* always appear at the list end. */
LIST_OF(struct string_list_item) onload_snippets;
/** \todo FIXME: We should externally maybe using cache_entry store the
/** @todo FIXME: We should externally maybe using cache_entry store the
* dependencies between the various entries so nothing gets removed
* unneeded. */
struct uri_list ecmascript_imports;
@ -158,7 +158,7 @@ struct document {
timer_id_T timeout;
#endif
#ifdef CONFIG_CSS
/** \todo FIXME: We should externally maybe using cache_entry store the
/** @todo FIXME: We should externally maybe using cache_entry store the
* dependencies between the various entries so nothing gets removed
* unneeded. */
struct uri_list css_imports;
@ -172,7 +172,7 @@ struct document {
struct cache_entry *cached;
struct frame_desc *frame;
struct frameset_desc *frame_desc; /**< \todo RENAME ME */
struct frameset_desc *frame_desc; /**< @todo RENAME ME */
struct document_refresh *refresh;
struct line *data;
@ -239,7 +239,7 @@ void shrink_format_cache(int);
extern struct module document_module;
/** \todo FIXME: support for entities and all Unicode characters.
/** @todo FIXME: support for entities and all Unicode characters.
* (Unpaired surrogates should be rejected, so that the ECMAScript
* interface can convert the access key to UTF-16.)
* For now, we only support simple printable character. */

View File

@ -1128,14 +1128,20 @@ justify_line(struct html_context *html_context, int y)
assert(word_len >= 0);
if_assert_failed continue;
if (!word_len) continue;
word_shift = (word * diff) / (spaces - 1);
new_start = word_start + word_shift;
/* Copy the original word, without any spaces. */
copy_chars(html_context, new_start, y, word_len,
&line[word_start]);
/* Assert that the realloc_line() above
* allocated enough memory for the word
* and the preceding spaces. */
assert(LEN(y) >= new_start + word_len);
if_assert_failed continue;
/* Copy the original word, without any spaces.
* word_len may be 0 here. */
copy_screen_chars(&POS(new_start, y),
&line[word_start], word_len);
/* Copy the space that preceded the word,
* duplicating it as many times as necessary.
@ -1147,10 +1153,6 @@ justify_line(struct html_context *html_context, int y)
if (word) {
int spacex;
/* realloc_line() was called above. */
assert(LEN(y) >= new_start);
if_assert_failed continue;
for (spacex = prev_end; spacex < new_start;
++spacex) {
copy_screen_chars(&POS(spacex, y),

View File

@ -164,8 +164,7 @@ struct dom_attribute_node {
/* Has the node->string been converted to internal charset. */
unsigned int converted:1;
/* Is the attribute a unique identifier meaning the owner (element)
* should be added to the document nodes @element_id hash. */
/* Is the attribute a unique identifier. */
unsigned int id:1;
/* The attribute value references some other resource */

View File

@ -19,50 +19,51 @@ struct bittorrent_fetcher;
struct connection;
struct terminal;
/* The least acceptable default sharing rate. */
/** The least acceptable default sharing rate. */
#define BITTORRENT_DEFAULT_SHARING_RATE 0.250
/* The number of seconds between updating the connection state and most
/** The number of seconds between updating the connection state and most
* importantly choke and unchoke peer connections. */
#define BITTORRENT_DEFAULT_CHOKE_INTERVAL 10
/* The length regarded as ``typical'' by the community wiki specification. */
/* Looks like Bram uses 2^14 here. */
/* Used for the protocol.bittorrent.request_length option */
/** The length regarded as ``typical'' by the community wiki specification.
* Looks like Bram uses 2^14 here.
* Used for the protocol.bittorrent.request_length option */
#define BITTORRENT_REQUEST_LENGTH (1 << 14)
/* The length of requested blocks of pieces should not exceed 2^17 bytes. */
/* Used for the protocol.bittorrent.max_request_length option */
/* Bram uses 2^23 here. */
/** The length of requested blocks of pieces should not exceed 2^17 bytes.
* Used for the protocol.bittorrent.max_request_length option
* Bram uses 2^23 here. */
#define BITTORRENT_REQUEST_ACCEPT_LENGTH (1 << 23)
/* The maximum size to allow a peer message to have. */
/** The maximum size to allow a peer message to have. */
/* Bram uses 2^23 here. */
#define BITTORRENT_MESSAGE_MAX_SIZE (1 << 23)
/* 20-byte string ID used for both peer IDs and info-hashes. */
/** 20-byte string ID used for both peer IDs and info-hashes. */
typedef sha1_digest_bin_T bittorrent_id_T;
/* Special peer ID used for determining whether an ID has been set. */
/** Special peer ID used for determining whether an ID has been set. */
extern const bittorrent_id_T BITTORRENT_NULL_ID;
/** Check if the ID has been set. */
#define bittorrent_id_is_empty(id) \
(!memcmp(id, BITTORRENT_NULL_ID, sizeof(bittorrent_id_T)))
/* BitTorrent error states. */
/** BitTorrent error states. */
enum bittorrent_state {
BITTORRENT_STATE_OK, /* All is well. */
BITTORRENT_STATE_ERROR, /* Some error happened. */
BITTORRENT_STATE_REQUEST_FAILURE, /* Failure from tracker. */
BITTORRENT_STATE_OUT_OF_MEM, /* Allocation failure. */
BITTORRENT_STATE_CACHE_FAILURE, /* Cache data access failed. */
BITTORRENT_STATE_CACHE_RESUME, /* Resume state from disk.. */
BITTORRENT_STATE_FILE_MISSING, /* File does not exist. */
BITTORRENT_STATE_OK, /**< All is well. */
BITTORRENT_STATE_ERROR, /**< Some error happened. */
BITTORRENT_STATE_REQUEST_FAILURE, /**< Failure from tracker. */
BITTORRENT_STATE_OUT_OF_MEM, /**< Allocation failure. */
BITTORRENT_STATE_CACHE_FAILURE, /**< Cache data access failed. */
BITTORRENT_STATE_CACHE_RESUME, /**< Resume state from disk. */
BITTORRENT_STATE_FILE_MISSING, /**< File does not exist. */
};
/* For showing tracker failure responses to the user. */
/** For showing tracker failure responses to the user. */
struct bittorrent_message {
LIST_HEAD(struct bittorrent_message);
@ -76,7 +77,7 @@ struct bittorrent_message {
/* Peer-wire types: */
/* ************************************************************************** */
/* BitTorrent peer-wire state and message IDs. */
/** BitTorrent peer-wire state and message IDs. */
enum bittorrent_message_id {
/* Special internal state and message type. */
BITTORRENT_MESSAGE_ERROR = -3,
@ -95,40 +96,40 @@ enum bittorrent_message_id {
BITTORRENT_MESSAGE_CANCEL = 8,
};
/* The peer request matches information sent in the request and cancel messages
/** The peer request matches information sent in the request and cancel messages
* in the peer-wire protocol. See the piece cache header file (cache.h) for more
* information about the cloned flag. */
struct bittorrent_peer_request {
LIST_HEAD(struct bittorrent_peer_request);
uint32_t piece; /* Zero-based piece index. */
uint32_t offset; /* Zero-based piece byte offset. */
uint32_t length; /* The wanted number of bytes. */
uint32_t piece; /**< Zero-based piece index. */
uint32_t offset; /**< Zero-based piece byte offset. */
uint32_t length; /**< The wanted number of bytes. */
uint16_t block; /* The block index in the piece. */
uint16_t block; /**< The block index in the piece. */
/* This holds the message id when the request struct is used for queuing
* pending messages. */
char id; /* -> enum bittorrent_message_id */
char id; /**< @-> enum bittorrent_message_id */
unsigned int cloned:1; /* The request was cloned. */
unsigned int requested:1; /* Whether it has been requested. */
unsigned int cloned:1; /**< The request was cloned. */
unsigned int requested:1; /**< Whether it has been requested. */
};
struct bittorrent_peer_status {
/* FIFO-like recording of requests. */
/** FIFO-like recording of requests. */
LIST_OF(struct bittorrent_peer_request) requests;
/* Flags for scheduling updating of the peer state. */
unsigned int choked:1; /* The peer was choked. */
unsigned int interested:1; /* The peer is interested. */
unsigned int snubbed:1; /* The peer was snubbed. */
unsigned int choked:1; /**< The peer was choked. */
unsigned int interested:1; /**< The peer is interested. */
unsigned int snubbed:1; /**< The peer was snubbed. */
/* State flags used for determining what to accept. */
unsigned int handshake:1; /* The handshake was sent. */
unsigned int bitfield:1; /* The bitfield was sent. */
unsigned int initiater:1; /* Initiater of the connection. */
unsigned int seeder:1; /* The peer has the complete torrent. */
unsigned int handshake:1; /**< The handshake was sent. */
unsigned int bitfield:1; /**< The bitfield was sent. */
unsigned int initiater:1; /**< Initiater of the connection. */
unsigned int seeder:1; /**< The peer has the complete torrent. */
};
struct bittorrent_peer_stats {
@ -142,38 +143,38 @@ struct bittorrent_peer_stats {
off_t uploaded;
};
/* Peer connection information. */
/** Peer connection information. */
struct bittorrent_peer_connection {
LIST_HEAD(struct bittorrent_peer_connection);
/* Unique peer ID string which can be used to look-up the peer hash. */
/** Unique peer ID string which can be used to look-up the peer hash. */
bittorrent_id_T id;
/* Timer handle for scheduling timeouts. */
/** Timer handle for scheduling timeouts. */
timer_id_T timer;
/* Socket information. */
/** Socket information. */
struct socket *socket;
/* Progress information and counter for the number of uploaded or
/** Progress information and counter for the number of uploaded or
* downloaded bytes depending on the mode. */
struct bittorrent_peer_stats stats;
/* The BitTorrent connection the peer connection is associated with.
/** The BitTorrent connection the peer connection is associated with.
* For recently accepted peer connections it might be NULL indicating
* that the info_hash has not yet been read from the handshake. */
struct bittorrent_connection *bittorrent;
/* Local client and remote peer status info. */
/** Local client and remote peer status info. */
struct bittorrent_peer_status local;
struct bittorrent_peer_status remote;
/* Outgoing message queue. Note piece messages are maintained entirely
/** Outgoing message queue. Note piece messages are maintained entirely
* in the request list in the bittorrent_peer_status struct. */
LIST_OF(struct bittorrent_peer_request) queue;
/* A bitfield of the available pieces from the peer. */
/* The size depends on the number of pieces. */
/** A bitfield of the available pieces from the peer.
* The size depends on the number of pieces. */
struct bitfield *bitfield;
};
@ -182,27 +183,27 @@ struct bittorrent_peer_connection {
/* Tracker types: */
/* ************************************************************************** */
/* Event state information needed by the tracker. */
/** Event state information needed by the tracker. */
enum bittorrent_tracker_event {
BITTORRENT_EVENT_STARTED = 0, /* XXX: Zero, to always send first */
BITTORRENT_EVENT_STOPPED, /* Graceful shut down */
BITTORRENT_EVENT_COMPLETED, /* Download was completed */
BITTORRENT_EVENT_REGULAR, /* Regular (periodical) tracker request */
BITTORRENT_EVENT_STARTED = 0, /**< XXX: Zero, to always send first */
BITTORRENT_EVENT_STOPPED, /**< Graceful shut down */
BITTORRENT_EVENT_COMPLETED, /**< Download was completed */
BITTORRENT_EVENT_REGULAR, /**< Regular (periodical) tracker request */
};
/* This stores info about tracker requests. */
/* It is not a real connection because it consists of a series of HTTP requests
/** This stores info about tracker requests.
* It is not a real connection because it consists of a series of HTTP requests
* but both the tracker and client is supposed to keep state information across
* all requests. */
struct bittorrent_tracker_connection {
/* Used for keeping track of when to send event info to the tracker. */
/** Used for keeping track of when to send event info to the tracker. */
enum bittorrent_tracker_event event;
/* Time in seconds between contacting the tracker and a timer handle. */
/** Time in seconds between contacting the tracker and a timer handle. */
timer_id_T timer;
int interval;
/* Requesting the tracker failed or was never started so no
/** Requesting the tracker failed or was never started so no
* event=stopped should be sent. */
unsigned int failed:1;
unsigned int started:1;
@ -213,74 +214,75 @@ struct bittorrent_tracker_connection {
/* Metafile types: */
/* ************************************************************************** */
/* Information about peers returned by the tracker. */
/** Information about peers returned by the tracker. */
struct bittorrent_peer {
LIST_HEAD(struct bittorrent_peer);
bittorrent_id_T id; /* Unique peer ID string. */
uint16_t port; /* The port number to connect to. */
unsigned char ip[1]; /* String with a IPv4 or IPv6 address. */
bittorrent_id_T id; /**< Unique peer ID string. */
uint16_t port; /**< The port number to connect to. */
unsigned char ip[1]; /**< String with a IPv4 or IPv6 address. */
};
/* Information about a file in the torrent. */
/** Information about a file in the torrent. */
struct bittorrent_file {
LIST_HEAD(struct bittorrent_file);
off_t length; /* Length of the file in bytes. */
md5_digest_hex_T md5sum; /* Hexadecimal MD5 sum of the file. */
off_t length; /**< Length of the file in bytes. */
md5_digest_hex_T md5sum; /**< Hexadecimal MD5 sum of the file. */
int selected;
unsigned char name[1]; /* Filename converted from path list. */
unsigned char name[1]; /**< Filename converted from path list. */
};
/* Static information from the .torrent metafile. */
/** Static information from the .torrent metafile. */
struct bittorrent_meta {
/* The SHA1 info hash of the value of the info key from the metainfo
/** The SHA1 info hash of the value of the info key from the metainfo
* .torrent file is used regularly when connecting to both the tracker
* and peers. */
bittorrent_id_T info_hash;
/* Optional information about the creation time of the torrent. */
/* Used if the document.download.set_original_time is true. */
/** Optional information about the creation time of the torrent.
* Used if the document.download.set_original_time is true. */
time_t creation_date;
/* Optional comment in free-form text. */
/** Optional comment in free-form text. */
unsigned char *comment;
/* The announced URI of each available tracker. */
/** The announced URI of each available tracker. */
struct uri_list tracker_uris;
/* The number of pieces. */
/** The number of pieces. */
uint32_t pieces;
/* The number of bytes in each piece. The last piece can be shorter
* than the others. */
/** The number of bytes in each piece. */
uint32_t piece_length;
/** The last piece can be shorter than the others. */
uint32_t last_piece_length;
/* List of concatenated SHA1 hash values for each piece. */
/** List of concatenated SHA1 hash values for each piece. */
unsigned char *piece_hash;
/* The type of the torrent. */
/** The type of the torrent. */
enum { BITTORRENT_SINGLE_FILE, BITTORRENT_MULTI_FILE } type;
unsigned int malicious_paths:1; /* Potential bad file path detected. */
/** Potential bad file path detected. */
unsigned int malicious_paths:1;
/* The name of either the single file or the top-most directory. */
/** The name of either the single file or the top-most directory. */
unsigned char *name;
/* A list with information about files in the torrent. */
/* The list is a singleton for single-file torrents. */
/** A list with information about files in the torrent.
* The list is a singleton for single-file torrents. */
LIST_OF(struct bittorrent_file) files;
};
enum bittorrent_connection_mode {
BITTORRENT_MODE_PIECELESS, /* The client has no piece to share. */
BITTORRENT_MODE_NORMAL, /* The client is up- and downloading. */
BITTORRENT_MODE_END_GAME, /* All remaining pieces are requested. */
BITTORRENT_MODE_SEEDER, /* The client is only uploading. */
BITTORRENT_MODE_PIECELESS, /**< The client has no piece to share. */
BITTORRENT_MODE_NORMAL, /**< The client is up- and downloading. */
BITTORRENT_MODE_END_GAME, /**< All remaining pieces are requested. */
BITTORRENT_MODE_SEEDER, /**< The client is only uploading. */
};
/* This stores info about an active BitTorrent connection. Note, the list head
/** This stores info about an active BitTorrent connection. Note, the list head
* is used by the handling of the peer-wire listening socket and should only be
* managed by that. */
struct bittorrent_connection {
@ -288,55 +290,57 @@ struct bittorrent_connection {
enum bittorrent_connection_mode mode;
/* Static information from the .torrent metafile. */
/** Static information from the .torrent metafile. */
struct bittorrent_meta meta;
/* Dynamic tracker information. */
/** Dynamic tracker information. */
struct bittorrent_tracker_connection tracker;
/* Dynamic tracker information. */
/** Dynamic tracker information. */
struct bittorrent_piece_cache *cache;
/* Back-reference to the connection the bittorrent connection belongs
/** Back-reference to the connection the bittorrent connection belongs
* to. */
struct connection *conn;
/* Active peer list */
/* The size is controlled by the protocol.bittorrent.max_active_peers
/** Active peer list
* The size is controlled by the protocol.bittorrent.max_active_peers
* option. */
LIST_OF(struct bittorrent_peer_connection) peers;
/* List of information about potential peers. */
/* TODO: Use hash. */
/** List of information about potential peers.
* @todo TODO: Use hash. */
LIST_OF(struct bittorrent_peer) peer_pool;
/* The peer ID of the client. */
/** The peer ID of the client. */
bittorrent_id_T peer_id;
/* The port of the listening socket */
/** The port of the listening socket */
uint16_t port;
/* Timer handle for scheduling periodic updating and rating of peer
/** Timer handle for scheduling periodic updating and rating of peer
* connections. */
timer_id_T timer;
/* Statistics for the tracker and total progress information for the
/** Statistics for the tracker and total progress information for the
* user interface. */
struct progress upload_progress;
off_t uploaded;
off_t downloaded;
off_t left;
/* Number of seeders and leechers. */
/** Number of seeders. */
uint32_t complete;
/** Number of leechers. */
uint32_t incomplete;
double sharing_rate;
/* Information about any running metainfo file or tracker request. */
/** Information about any running metainfo file or tracker request. */
struct bittorrent_fetcher *fetch;
/* For notifying on completion. May be NULL. */
/** For notifying on completion.
* May be NULL. */
struct terminal *term;
};
@ -416,10 +420,10 @@ void done_bittorrent_fetch(struct bittorrent_fetcher **fetcher_ref);
/* ************************************************************************** */
enum bittorrent_blacklist_flags {
BITTORRENT_BLACKLIST_NONE, /* No blacklisting is in effect */
BITTORRENT_BLACKLIST_PEER_POOL, /* Blacklist from peer pool. */
BITTORRENT_BLACKLIST_MALICIOUS, /* Malicious peer, refuse connection */
BITTORRENT_BLACKLIST_BEHAVIOUR, /* Unfair behaviour, refuse connection */
BITTORRENT_BLACKLIST_NONE, /**< No blacklisting is in effect */
BITTORRENT_BLACKLIST_PEER_POOL, /**< Blacklist from peer pool. */
BITTORRENT_BLACKLIST_MALICIOUS, /**< Malicious peer, refuse connection */
BITTORRENT_BLACKLIST_BEHAVIOUR, /**< Unfair behaviour, refuse connection */
};
void

View File

@ -11,7 +11,8 @@ struct string;
struct bittorrent_piece_cache_entry {
LIST_HEAD(struct bittorrent_piece_cache_entry);
/* To keep track of the client's view of the swarm in regards to pieces a
/** Piece rarity index
* To keep track of the client's view of the swarm in regards to pieces a
* piece rarity index for neighboring peers is maintained for each piece
* in the torrent. It keeps track of how many neighboring peers have the
* piece. The smaller the value the more rare the piece is. The table is
@ -19,50 +20,51 @@ struct bittorrent_piece_cache_entry {
* indicates that no neightboring peer has the piece. */
uint16_t rarity;
unsigned int completed:1; /* All blocks was downloaded. */
unsigned int remaining:1; /* Nothing has been even requested. */
unsigned int locked:1; /* Edge piece from partial downloads. */
unsigned int selected:1; /* Piece is part of partial download. */
unsigned int completed:1; /**< All blocks was downloaded. */
unsigned int remaining:1; /**< Nothing has been even requested. */
unsigned int locked:1; /**< Edge piece from partial downloads. */
unsigned int selected:1; /**< Piece is part of partial download. */
/* A bitfield of the blocks which remains to be downloaded for this
/** A bitfield of the blocks which remains to be downloaded for this
* piece. May be NULL if downloading is not in progress. */
struct bitfield *blocks;
/* The data of the piece. May be NULL if data has not been downloaded
* or the piece has been written to disk. */
/* XXX: This memory is mmaped using the mem_mmap_*() functions. */
/** The data of the piece.
* May be NULL if data has not been downloaded
* or the piece has been written to disk.
* XXX: This memory is mmaped using the mem_mmap_*() functions. */
unsigned char *data;
};
struct bittorrent_piece_cache {
/* The following is mostly maintained for making it easy to display in
* dialogs. */
unsigned int remaining_pieces; /* Number of untouched pieces */
unsigned int completed_pieces; /* Number of downloaded pieces */
unsigned int loading_pieces; /* Number of pieces in progress */
unsigned int rejected_pieces; /* Number of hash check rejects */
unsigned int unavailable_pieces;/* Number of unavailable pieces */
unsigned int partial_pieces; /* Number of selected file pieces */
unsigned int locked_pieces; /* Pieces locked due to partial download */
unsigned int remaining_pieces; /**< Number of untouched pieces */
unsigned int completed_pieces; /**< Number of downloaded pieces */
unsigned int loading_pieces; /**< Number of pieces in progress */
unsigned int rejected_pieces; /**< Number of hash check rejects */
unsigned int unavailable_pieces;/**< Number of unavailable pieces */
unsigned int partial_pieces; /**< Number of selected file pieces */
unsigned int locked_pieces; /**< Pieces locked due to partial download */
/* Flags set from the download dialog. */
unsigned int delete_files:1; /* Unlink files on shutdown? */
unsigned int notify_complete:1; /* Notify upon completion? */
unsigned int partial:1; /* Dealing with a partial download? */
unsigned int delete_files:1; /**< Unlink files on shutdown? */
unsigned int notify_complete:1; /**< Notify upon completion? */
unsigned int partial:1; /**< Dealing with a partial download? */
/* The pipe descripter used for communicating with the resume thread. */
/** The pipe descripter used for communicating with the resume thread. */
int resume_fd;
uint32_t resume_pos;
/* A bitfield of the available pieces. */
/** A bitfield of the available pieces. */
struct bitfield *bitfield;
/* A list of completed and saved entries which has been loaded into
/** A list of completed and saved entries which has been loaded into
* memory. The allocated memory for all these entries is disposable. The
* entries are sorted in a LRU-manner. */
LIST_OF(struct bittorrent_piece_cache_entry) queue;
/* Remaining pieces are tracked using the remaining_blocks member of the
/** Remaining pieces are tracked using the remaining_blocks member of the
* piece cache entry and a free list of piece blocks to be requested.
* Requests are taken from the free list every time a peer queries which
* piece block to request next. If the piece list is empty (or if the

View File

@ -196,7 +196,7 @@ static struct option_info uri_rewrite_options[] = {
INIT_OPT_SMART_PREFIX("mw", "http://www.m-w.com/cgi-bin/dictionary?book=Dictionary&va=%s"),
INIT_OPT_SMART_PREFIX("mwt", "http://www.m-w.com/cgi-bin/thesaurus?book=Thesaurus&va=%s"),
INIT_OPT_SMART_PREFIX("whatis", "http://uptime.netcraft.com/up/graph/?host=%s"),
INIT_OPT_SMART_PREFIX("wiki", "http://www.wikipedia.org/w/wiki.phtml?search=%s"),
INIT_OPT_SMART_PREFIX("wiki", "http://en.wikipedia.org/w/wiki.phtml?search=%s"),
INIT_OPT_SMART_PREFIX("wn", "http://www.cogsci.princeton.edu/cgi-bin/webwn1.7.1?stage=1&word=%s"),
/* Search the Free Software Directory */
INIT_OPT_SMART_PREFIX("fsd", "http://directory.fsf.org/search/fsd-search.py?q=%s"),

View File

@ -1 +1 @@
test_uri
uri-parser

View File

@ -2,7 +2,7 @@ top_builddir=../../..
include $(top_builddir)/Makefile.config
TEST_PROGS = \
test_uri
uri-test
TESTDEPS = \
$(top_builddir)/src/protocol/protocol.o \
@ -11,6 +11,6 @@ TESTDEPS = \
CLEAN = stub.o
test_uri:: stub.o
uri-test:: stub.o
include $(top_srcdir)/Makefile.lib

View File

@ -1,6 +0,0 @@
#ifndef EL__PROTOCOL_TEST_HARNESS_H
#define EL__PROTOCOL_TEST_HARNESS_H
void test_failed();
#endif

View File

@ -2,11 +2,15 @@
#include "config.h"
#endif
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "elinks.h"
#include "bfu/msgbox.h"
#include "main/module.h"
#include "protocol/test/harness.h"
#include "protocol/user.h"
#include "session/session.h"
@ -34,11 +38,25 @@ STUB_MODULE(smb_protocol_module);
STUB_MODULE(uri_rewrite_module);
STUB_MODULE(user_protocol_module);
static void
die(const char *msg, ...)
{
va_list args;
if (msg) {
va_start(args, msg);
vfprintf(stderr, msg, args);
fputs("\n", stderr);
va_end(args);
}
exit(!!NULL);
}
static void
stub_called(const unsigned char *fun)
{
fprintf(stderr, "FAIL: stub %s\n", fun);
test_failed();
die("FAIL: stub %s\n", fun);
}
#define STUB_PROTOCOL_HANDLER(name) \

View File

@ -0,0 +1,98 @@
#!/bin/sh
#
test_description='Test URI normalizing'
. "$TEST_LIB"
test_uri_equals () {
before="$1"; shift
expected="$1"; shift
normalized="$(uri-test "$before")"
test_expect_success "Normalize $before" "test \"$normalized\" = \"$expected\""
}
################################################################
test_uri_equals "http://example.org/foo/bar/baz?a=1&b=2#frag" \
"http://example.org/foo/bar/baz?a=1&b=2#frag"
test_uri_equals "http://example.org/foo/bar/../?a=1&b=2#frag" \
"http://example.org/foo/?a=1&b=2#frag"
test_uri_equals "http://example.org/foo/bar/../../baz?a=1&b=2#frag" \
"http://example.org/baz?a=1&b=2#frag"
test_uri_equals "http://example.org/foo/bar/.." \
"http://example.org/foo/"
test_uri_equals "http://example.org/foo/bar;a=1/.." \
"http://example.org/foo/"
test_uri_equals "http://example.org/foo/bar.." \
"http://example.org/foo/bar.."
# Bug 744 - ELinks changes "//" to "/" in path component of URI
test_uri_equals "http://example.org/foo/bar/baz" \
"http://example.org/foo/bar/baz"
test_uri_equals "http://example.org/foo/bar/" \
"http://example.org/foo/bar/"
test_uri_equals "http://example.org/foo//baz" \
"http://example.org/foo//baz"
test_uri_equals "http://example.org/foo//" \
"http://example.org/foo//"
test_uri_equals "http://example.org//bar/baz" \
"http://example.org//bar/baz"
test_uri_equals "http://example.org//bar/" \
"http://example.org//bar/"
test_uri_equals "http://example.org///baz" \
"http://example.org///baz"
test_uri_equals "http://example.org///" \
"http://example.org///"
test_uri_equals "http://example.org/foo/bar/baz/.." \
"http://example.org/foo/bar/"
test_uri_equals "http://example.org/foo/bar//.." \
"http://example.org/foo/bar/"
test_uri_equals "http://example.org/foo//baz/.." \
"http://example.org/foo//"
test_uri_equals "http://example.org/foo///.." \
"http://example.org/foo//"
test_uri_equals "http://example.org//bar/baz/.." \
"http://example.org//bar/"
test_uri_equals "http://example.org//bar//.." \
"http://example.org//bar/"
test_uri_equals "http://example.org///baz/.." \
"http://example.org///"
test_uri_equals "http://example.org////.." \
"http://example.org///"
test_uri_equals "http://example.org/foo/..//bar/baz" \
"http://example.org//bar/baz"
test_uri_equals "http://example.org//.//foo" \
"http://example.org///foo"
test_uri_equals "http://example.org//./../foo" \
"http://example.org/foo"
test_uri_equals "http://example.org/gag///./../.." \
"http://example.org/gag/"
test_done

View File

@ -1,2 +0,0 @@
#! /bin/sh -e
./test_uri

View File

@ -1,142 +0,0 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include "elinks.h"
#include "protocol/test/harness.h"
#include "protocol/uri.h"
#include "util/string.h"
static int failures = 0;
static int successes = 0;
void
test_failed(void)
{
++failures;
}
void
test_succeeded(void)
{
++successes;
}
static void
test_1_normalize_uri(const unsigned char *orig, const unsigned char *good)
{
struct string s;
unsigned char *norm;
if (!init_string(&s)) {
fputs("FAIL: init_string\n", stderr);
test_failed();
goto out;
}
if (!add_to_string(&s, orig)) {
fputs("FAIL: add_to_string\n", stderr);
test_failed();
goto out;
}
norm = normalize_uri(NULL, s.source);
if (norm == NULL) {
fprintf(stderr, "FAIL: normalize_uri NULL %s\n", orig);
test_failed();
goto out;
}
if (strcmp(norm, good) != 0) {
fprintf(stderr, "FAIL: normalize_uri mismatch:\n"
"\toriginal: %s\n"
"\tresult: %s\n"
"\texpected: %s\n",
orig, norm, good);
test_failed();
goto out;
}
test_succeeded();
out:
done_string(&s);
}
static void
test_normalize_uri(void)
{
static const struct {
unsigned char *orig;
unsigned char *norm;
} tests[] = {
{ "http://example.org/foo/bar/baz?a=1&b=2#frag",
"http://example.org/foo/bar/baz?a=1&b=2#frag" },
{ "http://example.org/foo/bar/../?a=1&b=2#frag",
"http://example.org/foo/?a=1&b=2#frag" },
{ "http://example.org/foo/bar/../../baz?a=1&b=2#frag",
"http://example.org/baz?a=1&b=2#frag" },
{ "http://example.org/foo/bar/..",
"http://example.org/foo/" },
{ "http://example.org/foo/bar;a=1/..",
"http://example.org/foo/" },
{ "http://example.org/foo/bar..",
"http://example.org/foo/bar.." },
/* Bug 744 - ELinks changes "//" to "/" in path
* component of URI */
{ "http://example.org/foo/bar/baz",
"http://example.org/foo/bar/baz" },
{ "http://example.org/foo/bar/",
"http://example.org/foo/bar/" },
{ "http://example.org/foo//baz",
"http://example.org/foo//baz" },
{ "http://example.org/foo//",
"http://example.org/foo//" },
{ "http://example.org//bar/baz",
"http://example.org//bar/baz" },
{ "http://example.org//bar/",
"http://example.org//bar/" },
{ "http://example.org///baz",
"http://example.org///baz" },
{ "http://example.org///",
"http://example.org///" },
{ "http://example.org/foo/bar/baz/..",
"http://example.org/foo/bar/" },
{ "http://example.org/foo/bar//..",
"http://example.org/foo/bar/" },
{ "http://example.org/foo//baz/..",
"http://example.org/foo//" },
{ "http://example.org/foo///..",
"http://example.org/foo//" },
{ "http://example.org//bar/baz/..",
"http://example.org//bar/" },
{ "http://example.org//bar//..",
"http://example.org//bar/" },
{ "http://example.org///baz/..",
"http://example.org///" },
{ "http://example.org////..",
"http://example.org///" },
{ "http://example.org/foo/..//bar/baz",
"http://example.org//bar/baz" },
{ "http://example.org//.//foo",
"http://example.org///foo" },
{ "http://example.org//./../foo",
"http://example.org/foo" },
{ "http://example.org/gag///./../..",
"http://example.org/gag/" },
};
size_t i;
for (i = 0; i < sizeof_array(tests); ++i)
test_1_normalize_uri(tests[i].orig, tests[i].norm);
}
int
main(int argc, char **argv)
{
test_normalize_uri();
printf("Total %d failures, %d successes.\n", failures, successes);
return failures ? EXIT_FAILURE : 0;
}

View File

@ -0,0 +1,21 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include "elinks.h"
#include "protocol/uri.h"
#include "util/string.h"
int
main(int argc, char **argv)
{
/* FIXME: As more protocol tests are added this could start
* taking arguments like --normalize-uri=<arg> etc. */
if (argc == 2) {
fprintf(stdout, "%s\n", normalize_uri(NULL, argv[1]));
}
return 0;
}

View File

@ -1345,7 +1345,7 @@ get_current_link_url(struct session *ses, unsigned char *str, size_t str_size)
}
/** get_current_link_name: returns the name of the current link
* (the text between <A> and </A>), @a str is a preallocated string,
* (the text between @<A> and @</A>), @a str is a preallocated string,
* @a str_size includes the null char.
* @relates session */
unsigned char *

View File

@ -63,7 +63,7 @@ struct screen_char {
* In the screen image, they have attribute SCREEN_ATTR_FRAME;
* you should drop them to the image using draw_border_char().
*
* \todo TODO: When we'll support internal Unicode, this should be
* @todo TODO: When we'll support internal Unicode, this should be
* changed to some Unicode sequences. --pasky
*
* Codes extracted from twin-0.4.6 GPL project, a Textmode WINdow environment,

View File

@ -8,8 +8,8 @@
* longer than ITRM_IN_QUEUE_SIZE bytes. So it should be defined
* as greater than the length of any control sequence that ELinks
* is expected to receive. These are the longest so far:
* VT420: "\E[?64;1;2;6;7;8;9;15;18;19;21c"
* VT510: "\E[?64;1;2;7;8;9;12;15;18;21;23;24;42;44;45;46c" */
* - VT420: "\E[?64;1;2;6;7;8;9;15;18;19;21c"
* - VT510: "\E[?64;1;2;7;8;9;12;15;18;21;23;24;42;44;45;46c" */
#define ITRM_IN_QUEUE_SIZE 64
struct itrm_queue {
@ -59,7 +59,7 @@ struct itrm_in {
struct itrm_queue queue;
};
/* Things going out from an itrm, whether to the terminal or to the
/** Things going out from an itrm, whether to the terminal or to the
* master. */
struct itrm_out {
/** A file descriptor for the standard output. In some ports,
@ -106,8 +106,7 @@ struct itrm {
/*! The @c remote flag is not set in regular slave terminals.
* Instead, it means the itrm controls a preexisting terminal,
* and windows should not be displayed on the terminal of the
* itrm (but see bug 776: the master clears the terminal anyway);
* thus the terminal init and done strings are not sent. */
* itrm; thus the terminal init and done strings are not sent. */
unsigned int remote:1; /**< Whether it is a remote session */
};

View File

@ -1,7 +1,7 @@
/** Support for keyboard interface
* @file
*
* \todo TODO: move stuff from here to itrm.{c,h} and mouse.{c,h}
* @todo TODO: move stuff from here to itrm.{c,h} and mouse.{c,h}
*/
#ifdef HAVE_CONFIG_H
@ -73,8 +73,8 @@ free_all_itrms(void)
/** A select_handler_T write_func for itrm_out.sock. This is called
* when there is data in \c itrm->out.queue and it is possible to write
* it to \c itrm->out.sock. When \c itrm->out.queue becomes empty, this
* when there is data in @c itrm->out.queue and it is possible to write
* it to @c itrm->out.sock. When @c itrm->out.queue becomes empty, this
* handler is temporarily removed. */
static void
itrm_queue_write(struct itrm *itrm)

View File

@ -1,7 +1,7 @@
/** Terminal color palettes.
* @file
*
* \todo TODO: We should probably autogenerate this using xterm's perl
* @todo TODO: We should probably autogenerate this using xterm's perl
* script. */
/** The 16 ANSI colors. */

View File

@ -29,17 +29,17 @@
/* TODO: We must use termcap/terminfo if available! --pasky */
/** Mapping from (enum border_char - 0xB0) to ASCII characters. */
/** Mapping from (enum ::border_char - 0xB0) to ASCII characters. */
const unsigned char frame_dumb[48] = " ||||++||++++++--|-+||++--|-+----++++++++ ";
/** Mapping from (enum border_char - 0xB0) to VT100 line-drawing
/** Mapping from (enum ::border_char - 0xB0) to VT100 line-drawing
* characters. */
static const unsigned char frame_vt100[48] = "aaaxuuukkuxkjjjkmvwtqnttmlvwtqnvvwwmmllnnjla ";
/** Mapping from (enum border_char - 0xB0) to VT100 line-drawing
/** Mapping from (enum ::border_char - 0xB0) to VT100 line-drawing
* characters encoded in CP437.
* When UTF-8 I/O is enabled, ELinks uses this array instead of
* frame_vt100[], and converts the characters from CP437 to UTF-8. */
* ::frame_vt100[], and converts the characters from CP437 to UTF-8. */
static const unsigned char frame_vt100_u[48] = {
177, 177, 177, 179, 180, 180, 180, 191,
191, 180, 179, 191, 217, 217, 217, 191,
@ -49,7 +49,7 @@ static const unsigned char frame_vt100_u[48] = {
197, 217, 218, 177, 32, 32, 32, 32
};
/** Mapping from (enum border_char - 0xB0) to obsolete FreeBSD ACS
/** Mapping from (enum ::border_char - 0xB0) to obsolete FreeBSD ACS
* graphics.
*
* This is for FreeBSD fonts that place graphics characters in the
@ -111,12 +111,12 @@ static const unsigned char frame_freebsd[48] = {
143, 139, 141, 128, 128, 128, 128, 128,
};
/** Mapping from (enum border_char - 0xB0) to obsolete FreeBSD ACS
/** Mapping from (enum ::border_char - 0xB0) to obsolete FreeBSD ACS
* graphics encoded in CP437.
* When UTF-8 I/O is enabled, ELinks uses this array instead of
* frame_freebsd[], and converts the characters from CP437 to UTF-8.
* ::frame_freebsd[], and converts the characters from CP437 to UTF-8.
*
* Derived from frame_freebsd[] by converting the characters to
* Derived from ::frame_freebsd[] by converting the characters to
* Unicode and back to CP437. frame_freebsd[1] = 138 = 0x8a = U+240B
* SYMBOL FOR VERTICAL TABULATION does not exist in CP437, so we
* substitute U+2592 MEDIUM SHADE. */
@ -129,7 +129,7 @@ static const unsigned char frame_freebsd_u[48] = {
197, 217, 218, 219, 219, 219, 219, 219,
};
/** Mapping from (enum border_char - 0xB0) to KOI8-R. */
/** Mapping from (enum ::border_char - 0xB0) to KOI8-R. */
static const unsigned char frame_koi[48] = {
144, 145, 146, 129, 135, 178, 180, 167,
166, 181, 161, 168, 174, 173, 172, 131,
@ -139,7 +139,7 @@ static const unsigned char frame_koi[48] = {
188, 133, 130, 141, 140, 142, 143, 139,
};
/** Mapping from (enum border_char - 0xB0) to CP850 or CP852. Most of
/** Mapping from (enum ::border_char - 0xB0) to CP850 or CP852. Most of
* this table is just 0xB0 + @<index in table>, because these codepages
* are quite similar to CP437. However, they lack some line-drawing
* characters, so we must use others instead. */
@ -154,7 +154,7 @@ static const unsigned char frame_restrict[48] = {
#define TERM_STRING(str) INIT_STRING(str, sizeof(str) - 1)
/** Like add_string_to_string but has fewer checks to slow it down. */
/** Like add_string_to_string() but has fewer checks to slow it down. */
#define add_term_string(str, tstr) \
add_bytes_to_string(str, (tstr).source, (tstr).length)
@ -308,8 +308,8 @@ static const struct screen_driver_opt *const screen_driver_opts[] = {
static INIT_LIST_OF(struct screen_driver, active_screen_drivers);
/** Set screen_driver.opt according to screen_driver.type and \a term_spec.
* Other members of \a *driver need not have been initialized.
/** Set screen_driver.opt according to screen_driver.type and @a term_spec.
* Other members of @a *driver need not have been initialized.
*
* If you modify anything here, check whether option descriptions
* should be updated. */
@ -476,7 +476,7 @@ done_screen_drivers(struct module *xxx)
/** Adds the term code for positioning the cursor at @a x and @a y to
* @a string. The template term code is: "\033[<@a y>;<@a x>H" */
* @a string. The template term code is: "\033[<y>;<x>H" */
static inline struct string *
add_cursor_move_to_string(struct string *screen, int y, int x)
{
@ -1165,7 +1165,7 @@ init_screen(void)
}
/*! The two images are allocated in one chunk.
* \todo TODO: It seems allocation failure here is fatal.
* @todo TODO: It seems allocation failure here is fatal.
* We should do something! */
void
resize_screen(struct terminal *term, int width, int height)

View File

@ -56,7 +56,7 @@ enum term_redrawing_state {
* is currently displayed on it) etc. It also maintains some runtime
* information about the actual ELinks instance owning this terminal.
*
* \todo TODO: Regroup the following into logical chunks. --pasky */
* @todo TODO: Regroup the following into logical chunks. --pasky */
struct terminal {
LIST_HEAD(struct terminal); /*!< ::terminals is the sentinel. */

View File

@ -22,9 +22,18 @@ enum window_type {
typedef void (window_handler_T)(struct window *, struct term_event *);
/** A window in the terminal screen. This structure does not know the
* position and size of the window, and no functions are provided for
* drawing into a window. Instead, when window.handler draws the
* window, it should decide the position and size of the window, and
* then draw directly to the terminal, taking care not to draw outside
* the window. Windows generally do not have their own coordinate
* systems; they get mouse events in the coordinate system of the
* terminal. */
struct window {
LIST_HEAD(struct window); /*!< terminal.windows is the sentinel. */
/** Whether this is a normal window or a tab window. */
enum window_type type;
/** The window event handler */

View File

@ -32,7 +32,7 @@ unsigned char *get_filename_position(unsigned char *filename);
* The returned file name is allocated. */
unsigned char *expand_tilde(unsigned char *filename);
/*! \brief Generate a unique file name by trial and error based on the
/*! @brief Generate a unique file name by trial and error based on the
* @a fileprefix by adding suffix counter (e.g. '.42').
*
* The returned file name is allocated if @a fileprefix is not unique. */

View File

@ -115,11 +115,6 @@ struct xlist_head {
#endif /* LISTDEBUG */
/** Define and initialize a list variable. The @a element_T parameter
* currently serves as documentation only; the compiler does not check
* that it matches. */
#define INIT_LIST_OF(element_T, x) struct list_head x = { D_LIST_HEAD(x) }
/** A list intended to contain elements of a specific type. The
* @a element_T parameter currently serves as documentation only;
* the compiler does not check that it matches. Doxyfile defines
@ -127,6 +122,11 @@ struct xlist_head {
* diagrams. */
#define LIST_OF(element_T) struct list_head
/** Define and initialize a list variable. The @a element_T parameter
* currently serves as documentation only; the compiler does not check
* that it matches. */
#define INIT_LIST_OF(element_T, x) LIST_OF(element_T) x = { D_LIST_HEAD(x) }
#ifdef HAVE_TYPEOF
#define list_typeof(x) typeof(x)
#else

View File

@ -29,7 +29,7 @@ static void transform_md5(uint32_t buf[4], uint32_t const in[16]);
/** Swap the bytes of each uint32_t, if necessary.
* This code is harmless on little-endian machines.
* \todo FIXME: Optimize it away on little-endian machines. */
* @todo FIXME: Optimize it away on little-endian machines. */
static void
reverse_md5_bytes(unsigned char *buf, unsigned int longs)
{

View File

@ -16,7 +16,7 @@
/**
* \struct memory_list
* @struct memory_list
* memory_list is used to track information about all allocated memory
* belonging to something. Then we can free it when we won't need it
* anymore, but the one who allocated it won't be able to get control

View File

@ -163,7 +163,7 @@ mem_align_alloc__(
/** @name Maybe-free macros
* \todo TODO: Think about making what they do more obvious in their
* @todo TODO: Think about making what they do more obvious in their
* identifier, they could be obfuscating their users a little for the
* newcomers otherwise.
* @{ */

View File

@ -18,7 +18,16 @@ struct view_state {
struct form_state *form_info;
int form_info_len;
int x, y;
/** Horizontal scrolling. If @c x is e.g. 2, then the
* leftmost two columns of the document have been scrolled out
* of sight. @c x should never be negative. */
int x;
/** Vertical scrolling. If @c y is e.g. 1, then the first
* line of the document has been scrolled out of sight. @c y
* should never be negative. */
int y;
int current_link;
int old_current_link;