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

Merge with git+ssh://pasky/srv/git/elinks.git

This commit is contained in:
Jonas Fonseca 2006-01-04 14:52:39 +01:00 committed by Jonas Fonseca
commit d3670173f2
16 changed files with 91 additions and 53 deletions

View File

@ -696,7 +696,7 @@ mnplus ISOtech 0x2213 # MINUS-OR-PLUS SIGN
models ISOamsr 0x22A7 # MODELS models ISOamsr 0x22A7 # MODELS
mu ISOgrk3 0x03BC # GREEK SMALL LETTER MU mu ISOgrk3 0x03BC # GREEK SMALL LETTER MU
mumap ISOamsa 0x22B8 # MULTIMAP mumap ISOamsa 0x22B8 # MULTIMAP
nVDash ISOamsn 0x22AF # NEGATED DOUBLE VERTICAL BAR DOUBLE RIGHT nVDash ISOamsn 0x22AF # NEGATED DOUBLE VERTICAL BAR DOUBLE RIGHT TURNS
nVdash ISOamsn 0x22AE # DOES NOT FORCE nVdash ISOamsn 0x22AE # DOES NOT FORCE
nabla ISOtech 0x2207 # NABLA nabla ISOtech 0x2207 # NABLA
nacute ISOlat2 0x0144 # LATIN SMALL LETTER N WITH ACUTE nacute ISOlat2 0x0144 # LATIN SMALL LETTER N WITH ACUTE

View File

@ -61,11 +61,11 @@ struct dom_renderer {
static void static void
init_template(struct screen_char *template, struct document_options *options, init_template(struct screen_char *template, struct document_options *options,
color_T background, color_T foreground) color_T background, color_T foreground, enum screen_char_attr attr)
{ {
struct color_pair colors = INIT_COLOR_PAIR(background, foreground); struct color_pair colors = INIT_COLOR_PAIR(background, foreground);
template->attr = 0; template->attr = attr;
template->data = ' '; template->data = ' ';
set_term_color(template, &colors, set_term_color(template, &colors,
options->color_flags, options->color_mode); options->color_flags, options->color_mode);
@ -115,6 +115,7 @@ init_dom_renderer(struct dom_renderer *renderer, struct document *document,
struct screen_char *template = &renderer->styles[type]; struct screen_char *template = &renderer->styles[type];
color_T background = document->options.default_bg; color_T background = document->options.default_bg;
color_T foreground = document->options.default_fg; color_T foreground = document->options.default_fg;
enum screen_char_attr attr = 0;
static int i_want_struct_module_for_dom; static int i_want_struct_module_for_dom;
struct dom_string *name = get_dom_node_type_name(type); struct dom_string *name = get_dom_node_type_name(type);
@ -157,9 +158,31 @@ init_dom_renderer(struct dom_renderer *renderer, struct document *document,
property = get_css_property(properties, CSS_PT_COLOR); property = get_css_property(properties, CSS_PT_COLOR);
if (property) foreground = property->value.color; if (property) foreground = property->value.color;
property = get_css_property(properties, CSS_PT_FONT_WEIGHT);
if (property) {
if (property->value.font_attribute.add & AT_BOLD)
attr |= SCREEN_ATTR_BOLD;
}
property = get_css_property(properties, CSS_PT_FONT_STYLE);
if (property) {
if (property->value.font_attribute.add & AT_UNDERLINE)
attr |= SCREEN_ATTR_UNDERLINE;
if (property->value.font_attribute.add & AT_ITALIC)
attr |= SCREEN_ATTR_ITALIC;
}
property = get_css_property(properties, CSS_PT_TEXT_DECORATION);
if (property) {
if (property->value.font_attribute.add & AT_UNDERLINE)
attr |= SCREEN_ATTR_UNDERLINE;
}
} }
init_template(template, &document->options, background, foreground); init_template(template, &document->options, background, foreground, attr);
} }
} }
@ -361,7 +384,7 @@ add_dom_link(struct dom_renderer *renderer, unsigned char *string, int length)
link->number = document->nlinks; link->number = document->nlinks;
init_template(&template, &document->options, init_template(&template, &document->options,
link->color.background, link->color.foreground); link->color.background, link->color.foreground, 0);
render_dom_text(renderer, &template, string, length); render_dom_text(renderer, &template, string, length);

View File

@ -530,7 +530,7 @@ init_dom_select(enum dom_select_syntax syntax, struct dom_string *string)
struct dom_stack stack; struct dom_stack stack;
enum dom_exception_code code; enum dom_exception_code code;
init_dom_stack(&stack, DOM_STACK_KEEP_NODES); init_dom_stack(&stack, DOM_STACK_FLAG_NONE);
add_dom_stack_tracer(&stack, "init-select: "); add_dom_stack_tracer(&stack, "init-select: ");
code = parse_dom_select(select, &stack, string); code = parse_dom_select(select, &stack, string);
@ -1060,12 +1060,12 @@ select_dom_nodes(struct dom_select *select, struct dom_node *root)
select_data.select = select;; select_data.select = select;;
init_dom_stack(&stack, DOM_STACK_KEEP_NODES); init_dom_stack(&stack, DOM_STACK_FLAG_NONE);
add_dom_stack_context(&stack, &select_data, add_dom_stack_context(&stack, &select_data,
&dom_select_context_info); &dom_select_context_info);
add_dom_stack_tracer(&stack, "select-tree: "); add_dom_stack_tracer(&stack, "select-tree: ");
init_dom_stack(&select_data.stack, DOM_STACK_KEEP_NODES); init_dom_stack(&select_data.stack, DOM_STACK_FLAG_NONE);
add_dom_stack_context(&select_data.stack, &select_data, add_dom_stack_context(&select_data.stack, &select_data,
&dom_select_data_context_info); &dom_select_data_context_info);
add_dom_stack_tracer(&select_data.stack, "select-match: "); add_dom_stack_tracer(&select_data.stack, "select-match: ");

View File

@ -557,8 +557,8 @@ init_sgml_parser(enum sgml_parser_type type, enum sgml_document_type doctype,
parser->flags = flags; parser->flags = flags;
parser->info = get_sgml_info(doctype); parser->info = get_sgml_info(doctype);
if (type == SGML_PARSER_TREE) if (type == SGML_PARSER_STREAM)
stack_flags |= DOM_STACK_KEEP_NODES; stack_flags |= DOM_STACK_FLAG_FREE_NODES;
init_dom_stack(&parser->stack, stack_flags); init_dom_stack(&parser->stack, stack_flags);
/* FIXME: Some sgml backend specific callbacks? Handle HTML script tags, /* FIXME: Some sgml backend specific callbacks? Handle HTML script tags,
@ -566,7 +566,7 @@ init_sgml_parser(enum sgml_parser_type type, enum sgml_document_type doctype,
add_dom_stack_context(&parser->stack, parser, &sgml_parser_context_info); add_dom_stack_context(&parser->stack, parser, &sgml_parser_context_info);
/* Don't keep the 'fake' text nodes that holds the parsing data. */ /* Don't keep the 'fake' text nodes that holds the parsing data. */
init_dom_stack(&parser->parsing, 0); init_dom_stack(&parser->parsing, DOM_STACK_FLAG_FREE_NODES);
add_dom_stack_context(&parser->parsing, parser, &sgml_parsing_context_info); add_dom_stack_context(&parser->parsing, parser, &sgml_parsing_context_info);
return parser; return parser;

View File

@ -213,7 +213,7 @@ pop_dom_node(struct dom_stack *stack)
call_dom_stack_callbacks(stack, state, DOM_STACK_POP); call_dom_stack_callbacks(stack, state, DOM_STACK_POP);
if (!(stack->flags & DOM_STACK_KEEP_NODES)) if (stack->flags & DOM_STACK_FLAG_FREE_NODES)
done_dom_node(state->node); done_dom_node(state->node);
stack->depth--; stack->depth--;

View File

@ -48,8 +48,10 @@ struct dom_stack_context {
}; };
enum dom_stack_flag { enum dom_stack_flag {
/* Keep nodes when popping them or call done_dom_node() on them. */ DOM_STACK_FLAG_NONE = 0,
DOM_STACK_KEEP_NODES = 1,
/* Free nodes when popping them by calling done_dom_node(). */
DOM_STACK_FLAG_FREE_NODES = 1,
}; };
/* The DOM stack is a convenient way to traverse DOM trees. Also it /* The DOM stack is a convenient way to traverse DOM trees. Also it

View File

@ -28,7 +28,7 @@ test_output_equals () {
echo "#document: $URI" > expected echo "#document: $URI" > expected
echo "$out" | sed -n '2,$p' >> expected echo "$out" | sed -n '2,$p' >> expected
test_expect_success "$desc" 'cmp -b output expected' test_expect_success "$desc" 'cmp output expected'
} }
test_expect_incomplete () { test_expect_incomplete () {

View File

@ -651,7 +651,7 @@ struct entity { char *s; unicode_val_T c; } entities [1002] = {
{ "models", 0x22A7 }, /* MODELS */ { "models", 0x22A7 }, /* MODELS */
{ "mu", 0x03BC }, /* GREEK SMALL LETTER MU */ { "mu", 0x03BC }, /* GREEK SMALL LETTER MU */
{ "mumap", 0x22B8 }, /* MULTIMAP */ { "mumap", 0x22B8 }, /* MULTIMAP */
{ "nVDash", 0x22AF }, /* NEGATED DOUBLE VERTICAL BAR DOUBLE RIGHT */ { "nVDash", 0x22AF }, /* NEGATED DOUBLE VERTICAL BAR DOUBLE RIGHT TURNS */
{ "nVdash", 0x22AE }, /* DOES NOT FORCE */ { "nVdash", 0x22AE }, /* DOES NOT FORCE */
{ "nabla", 0x2207 }, /* NABLA */ { "nabla", 0x2207 }, /* NABLA */
{ "nacute", 0x0144 }, /* LATIN SMALL LETTER N WITH ACUTE */ { "nacute", 0x0144 }, /* LATIN SMALL LETTER N WITH ACUTE */
@ -1005,4 +1005,4 @@ struct entity { char *s; unicode_val_T c; } entities [1002] = {
{ NULL, 0 } { NULL, 0 }
}; };
#define N_ENTITIES 1001 #define N_ENTITIES 1001

View File

@ -267,7 +267,7 @@ get_address(struct socket_info *info, enum addr_type type)
info->addr = (struct sockaddr *) sin; info->addr = (struct sockaddr *) sin;
info->size = sizeof(*sin); info->size = sizeof(*sin);
return AF_INET; return PF_INET;
} }
static int static int
@ -373,12 +373,12 @@ bind_to_af_unix(void)
{ {
mode_t saved_mask = umask(0177); mode_t saved_mask = umask(0177);
int attempts = 0; int attempts = 0;
int af = get_address(&s_info_listen, ADDR_IP_SERVER); int pf = get_address(&s_info_listen, ADDR_IP_SERVER);
if (af == -1) goto free_and_error; if (pf == -1) goto free_and_error;
while (1) { while (1) {
s_info_listen.fd = socket(af, SOCK_STREAM, 0); s_info_listen.fd = socket(pf, SOCK_STREAM, 0);
if (s_info_listen.fd == -1) { if (s_info_listen.fd == -1) {
report_af_unix_error("socket()", errno); report_af_unix_error("socket()", errno);
goto free_and_error; goto free_and_error;
@ -435,12 +435,12 @@ static int
connect_to_af_unix(void) connect_to_af_unix(void)
{ {
int attempts = 0; int attempts = 0;
int af = get_address(&s_info_connect, ADDR_IP_CLIENT); int pf = get_address(&s_info_connect, ADDR_IP_CLIENT);
while (af != -1 && attempts++ < MAX_CONNECT_TRIES) { while (pf != -1 && attempts++ < MAX_CONNECT_TRIES) {
int saved_errno; int saved_errno;
s_info_connect.fd = socket(af, SOCK_STREAM, 0); s_info_connect.fd = socket(pf, SOCK_STREAM, 0);
if (s_info_connect.fd == -1) { if (s_info_connect.fd == -1) {
report_af_unix_error("socket()", errno); report_af_unix_error("socket()", errno);
break; break;

View File

@ -303,7 +303,7 @@ sock_error:
/* Get a passive socket */ /* Get a passive socket */
sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
if (sock < 0) if (sock < 0)
goto sock_error; goto sock_error;
@ -504,6 +504,7 @@ connect_socket(struct socket *csocket, enum connection_state state)
#else #else
struct sockaddr_in addr = *((struct sockaddr_in *) &connect_info->addr[i]); struct sockaddr_in addr = *((struct sockaddr_in *) &connect_info->addr[i]);
#endif #endif
int pf;
int family; int family;
int force_family = connect_info->ip_family; int force_family = connect_info->ip_family;
@ -532,18 +533,30 @@ connect_socket(struct socket *csocket, enum connection_state state)
} }
#ifdef CONFIG_IPV6 #ifdef CONFIG_IPV6
if (family == AF_INET6 && (!get_opt_bool("connection.try_ipv6") || (force_family && force_family != 6))) { if (family == AF_INET6) {
silent_fail = 1; pf = PF_INET6;
continue; if (!get_opt_bool("connection.try_ipv6")
|| (force_family && force_family != 6)) {
silent_fail = 1;
continue;
}
} else } else
#endif #endif
if (family == AF_INET && (!get_opt_bool("connection.try_ipv4") || (force_family && force_family != 4))) { if (family == AF_INET) {
silent_fail = 1; pf = PF_INET;
if (!get_opt_bool("connection.try_ipv4")
|| (force_family && force_family != 4)) {
silent_fail = 1;
continue;
}
} else {
continue; continue;
} }
silent_fail = 0; silent_fail = 0;
sock = socket(family, SOCK_STREAM, IPPROTO_TCP); sock = socket(pf, SOCK_STREAM, IPPROTO_TCP);
if (sock == -1) { if (sock == -1) {
if (errno && !saved_errno) saved_errno = errno; if (errno && !saved_errno) saved_errno = errno;
continue; continue;

View File

@ -51,9 +51,9 @@ be_close(int s)
} }
int int
be_socket(int af, int sock, int prot) be_socket(int pf, int sock, int prot)
{ {
int h = socket(af, sock, prot); int h = socket(pf, sock, prot);
if (h < 0) return h; if (h < 0) return h;
return h + SHS; return h + SHS;
@ -122,13 +122,13 @@ be_pipe(int *fd)
int retry_count = 0; int retry_count = 0;
again: again:
s1 = be_socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); s1 = be_socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
if (s1 < 0) { if (s1 < 0) {
/*perror("socket1");*/ /*perror("socket1");*/
goto fatal_retry; goto fatal_retry;
} }
s2 = be_socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); s2 = be_socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
if (s2 < 0) { if (s2 < 0) {
/*perror("socket2");*/ /*perror("socket2");*/
be_close(s1); be_close(s1);

View File

@ -82,13 +82,13 @@
#include "osdep/getifaddrs.h" #include "osdep/getifaddrs.h"
#if (defined(AF_INET6) && defined(SIOCGIF6CONF) && defined(SIOCGIF6FLAGS)) \ #if (defined(PF_INET6) && defined(SIOCGIF6CONF) && defined(SIOCGIF6FLAGS)) \
|| (defined(AF_INET) && defined(SIOCGIFCONF) && defined(SIOCGIFFLAGS)) \ || (defined(PF_INET) && defined(SIOCGIFCONF) && defined(SIOCGIFFLAGS)) \
|| (defined(CONFIG_IPV6) && defined(SIOCGIFCONF)) || (defined(CONFIG_IPV6) && defined(SIOCGIFCONF))
static int static int
getifaddrs2(struct ifaddrs **ifap, getifaddrs2(struct ifaddrs **ifap,
int af, int siocgifconf, int siocgifflags, size_t ifreq_sz) int pf, int siocgifconf, int siocgifflags, size_t ifreq_sz)
{ {
struct sockaddr sa_zero; struct sockaddr sa_zero;
struct ifreq *ifr; struct ifreq *ifr;
@ -104,7 +104,7 @@ getifaddrs2(struct ifaddrs **ifap,
int num, j = 0; int num, j = 0;
memset(&sa_zero, 0, sizeof(sa_zero)); memset(&sa_zero, 0, sizeof(sa_zero));
fd = socket(af, SOCK_DGRAM, 0); fd = socket(pf, SOCK_DGRAM, 0);
if (fd < 0) if (fd < 0)
return -1; return -1;
@ -240,19 +240,19 @@ getifaddrs(struct ifaddrs **ifap)
errno = ENXIO; errno = ENXIO;
#if defined(AF_INET6) && defined(SIOCGIF6CONF) && defined(SIOCGIF6FLAGS) #if defined(PF_INET6) && defined(SIOCGIF6CONF) && defined(SIOCGIF6FLAGS)
if (ret) if (ret)
ret = getifaddrs2(ifap, AF_INET6, SIOCGIF6CONF, SIOCGIF6FLAGS, ret = getifaddrs2(ifap, PF_INET6, SIOCGIF6CONF, SIOCGIF6FLAGS,
sizeof(struct in6_ifreq)); sizeof(struct in6_ifreq));
#endif #endif
#if defined(CONFIG_IPV6) && defined(SIOCGIFCONF) #if defined(CONFIG_IPV6) && defined(SIOCGIFCONF)
if (ret) if (ret)
ret = getifaddrs2(ifap, AF_INET6, SIOCGIFCONF, SIOCGIFFLAGS, ret = getifaddrs2(ifap, PF_INET6, SIOCGIFCONF, SIOCGIFFLAGS,
sizeof(struct ifreq)); sizeof(struct ifreq));
#endif #endif
#if defined(AF_INET) && defined(SIOCGIFCONF) && defined(SIOCGIFFLAGS) #if defined(PF_INET) && defined(SIOCGIFCONF) && defined(SIOCGIFFLAGS)
if (ret) if (ret)
ret = getifaddrs2(ifap, AF_INET, SIOCGIFCONF, SIOCGIFFLAGS, ret = getifaddrs2(ifap, PF_INET, SIOCGIFCONF, SIOCGIFFLAGS,
sizeof(struct ifreq)); sizeof(struct ifreq));
#endif #endif
@ -322,7 +322,7 @@ main()
{ {
struct ifaddrs *a = NULL, *b; struct ifaddrs *a = NULL, *b;
getifaddrs2(&a, AF_INET, SIOCGIFCONF, SIOCGIFFLAGS, getifaddrs2(&a, PF_INET, SIOCGIFCONF, SIOCGIFFLAGS,
sizeof(struct ifreq)); sizeof(struct ifreq));
print_ifaddrs(a); print_ifaddrs(a);
printf("---\n"); printf("---\n");

View File

@ -347,9 +347,9 @@ win32_ioctl(int fd, long option, int *flag)
} }
int int
win32_socket(int family, int type, int protocol) win32_socket(int pf, int type, int protocol)
{ {
SOCKET s = socket(family, type, protocol); SOCKET s = socket(pf, type, protocol);
int rc; int rc;
if (s == INVALID_SOCKET) { if (s == INVALID_SOCKET) {
@ -359,7 +359,7 @@ win32_socket(int family, int type, int protocol)
rc = s + SOCK_SHIFT; rc = s + SOCK_SHIFT;
} }
TRACE("family %d, type %d, proto %d -> rc %d", family, type, protocol, rc); TRACE("family %d, type %d, proto %d -> rc %d", pf, type, protocol, rc);
return rc; return rc;
} }

View File

@ -12,7 +12,7 @@
int win32_write(int fd, const void *buf, unsigned len); int win32_write(int fd, const void *buf, unsigned len);
int win32_read(int fd, void *buf, unsigned len); int win32_read(int fd, void *buf, unsigned len);
int win32_pipe(int *fds); int win32_pipe(int *fds);
int win32_socket(int af, int type, int proto); int win32_socket(int pf, int type, int proto);
int win32_connect(int fd, struct sockaddr *addr, int addr_len); int win32_connect(int fd, struct sockaddr *addr, int addr_len);
int win32_getpeername(int fd, struct sockaddr *addr, int *addr_len); int win32_getpeername(int fd, struct sockaddr *addr, int *addr_len);
int win32_getsockname(int fd, struct sockaddr *addr, int *addr_len); int win32_getsockname(int fd, struct sockaddr *addr, int *addr_len);
@ -33,7 +33,7 @@ char *win32_strerror(int err);
#define write win32_write #define write win32_write
#define close win32_close #define close win32_close
#define pipe win32_pipe #define pipe win32_pipe
#define socket(af, type, prot) win32_socket(af, type, prot) #define socket(pf, type, prot) win32_socket(pf, type, prot)
#define connect(fd, a, al) win32_connect(fd, a, al) #define connect(fd, a, al) win32_connect(fd, a, al)
#define getpeername(fd, a, al) win32_getpeername(fd, a, al) #define getpeername(fd, a, al) win32_getpeername(fd, a, al)
#define getsockname(fd, a, al) win32_getsockname(fd, a, al) #define getsockname(fd, a, al) win32_getsockname(fd, a, al)

View File

@ -369,7 +369,7 @@ init_bittorrent_listening_socket(struct connection *conn)
if (bittorrent_socket != -1) if (bittorrent_socket != -1)
close(bittorrent_socket); close(bittorrent_socket);
bittorrent_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); bittorrent_socket = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
if (bittorrent_socket < 0) if (bittorrent_socket < 0)
return -errno; return -errno;

View File

@ -836,10 +836,10 @@ next:
} }
static int static int
ftp_data_connect(struct connection *conn, int family, struct sockaddr_storage *sa, ftp_data_connect(struct connection *conn, int pf, struct sockaddr_storage *sa,
int size_of_sockaddr) int size_of_sockaddr)
{ {
int fd = socket(family, SOCK_STREAM, 0); int fd = socket(pf, SOCK_STREAM, 0);
if (fd < 0 || set_nonblocking_fd(fd) < 0) { if (fd < 0 || set_nonblocking_fd(fd) < 0) {
abort_connection(conn, S_FTP_ERROR); abort_connection(conn, S_FTP_ERROR);