1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -05:00

Make it possible to identify the output of DOM stack tracers

This commit is contained in:
Jonas Fonseca 2005-12-30 03:29:17 +01:00 committed by Jonas Fonseca
parent 0ddb5f2d18
commit 4f09ac99f7
3 changed files with 16 additions and 10 deletions

View File

@ -531,7 +531,7 @@ init_dom_select(enum dom_select_syntax syntax, struct dom_string *string)
enum dom_exception_code code;
init_dom_stack(&stack, DOM_STACK_KEEP_NODES);
add_dom_stack_tracer(&stack);
add_dom_stack_tracer(&stack, "init-select: ");
code = parse_dom_select(select, &stack, string);
done_dom_stack(&stack);
@ -1063,12 +1063,12 @@ select_dom_nodes(struct dom_select *select, struct dom_node *root)
init_dom_stack(&stack, DOM_STACK_KEEP_NODES);
add_dom_stack_context(&stack, &select_data,
&dom_select_context_info);
add_dom_stack_tracer(&stack);
add_dom_stack_tracer(&stack, "select-tree: ");
init_dom_stack(&select_data.stack, DOM_STACK_KEEP_NODES);
add_dom_stack_context(&select_data.stack, &select_data,
&dom_select_data_context_info);
add_dom_stack_tracer(&select_data.stack);
add_dom_stack_tracer(&select_data.stack, "select-match: ");
if (push_dom_node(&select_data.stack, &select->selector->node)) {
get_dom_stack_top(&select_data.stack)->immutable = 1;

View File

@ -425,6 +425,8 @@ walk_dom_nodes(struct dom_stack *stack, struct dom_node *root)
#ifdef DOM_STACK_TRACE
#include "util/string.h"
/* Compress a string to a single line with newlines etc. replaced with "\\n"
* sequence. */
static inline unsigned char *
@ -492,7 +494,8 @@ dom_stack_trace_tree(struct dom_stack *stack, struct dom_node *node, void *data)
struct dom_string *value = &node->string;
struct dom_string *name = get_dom_node_name(node);
LOG_INFO("%.*s %.*s: %.*s",
LOG_INFO("%s%.*s %.*s: %.*s",
empty_string_or_(stack->current->data),
get_indent_offset(stack), indent_string,
name->length, name->string,
value->length, value->string);
@ -511,7 +514,8 @@ dom_stack_trace_id_leaf(struct dom_stack *stack, struct dom_node *node, void *da
id = get_dom_node_type_name(node->type);
set_enhanced_dom_node_value(&value, node);
LOG_INFO("%.*s %.*s: %.*s -> %.*s",
LOG_INFO("%s%.*s %.*s: %.*s -> %.*s",
empty_string_or_(stack->current->data),
get_indent_offset(stack), indent_string,
id->length, id->string, name->length, name->string,
value.length, value.string);
@ -531,7 +535,8 @@ dom_stack_trace_leaf(struct dom_stack *stack, struct dom_node *node, void *data)
name = get_dom_node_name(node);
set_enhanced_dom_node_value(&value, node);
LOG_INFO("%.*s %.*s: %.*s",
LOG_INFO("%s%.*s %.*s: %.*s",
empty_string_or_(stack->current->data),
get_indent_offset(stack), indent_string,
name->length, name->string,
value.length, value.string);
@ -551,7 +556,8 @@ dom_stack_trace_branch(struct dom_stack *stack, struct dom_node *node, void *dat
name = get_dom_node_name(node);
id = get_dom_node_type_name(node->type);
LOG_INFO("%.*s %.*s: %.*s",
LOG_INFO("%s%.*s %.*s: %.*s",
empty_string_or_(stack->current->data),
get_indent_offset(stack), indent_string,
id->length, id->string, name->length, name->string);
}

View File

@ -104,10 +104,10 @@ get_dom_stack_state_data(struct dom_stack_context *context,
#ifdef DOM_STACK_TRACE
extern struct dom_stack_context_info dom_stack_trace_context_info;
#define add_dom_stack_tracer(stack) \
add_dom_stack_context(stack, NULL, &dom_stack_trace_context_info)
#define add_dom_stack_tracer(stack, name) \
add_dom_stack_context(stack, name, &dom_stack_trace_context_info)
#else
#define add_dom_stack_tracer(stack) /* Nada */
#define add_dom_stack_tracer(stack, name) /* Nada */
#endif
/* The state iterators do not include the bottom state */