[project @ 2002-10-08 09:38:29 by bursa]

LOG(()) macro for easier debugging.

svn path=/import/netsurf/; revision=41
This commit is contained in:
James Bursa 2002-10-08 09:38:29 +00:00
parent 6f095fcdf8
commit 53c0e810e5
5 changed files with 48 additions and 6 deletions

View File

@ -1,5 +1,5 @@
/** /**
* $Id: netsurf.c,v 1.1 2002/09/11 14:24:02 monkeyson Exp $ * $Id: netsurf.c,v 1.2 2002/10/08 09:38:29 bursa Exp $
*/ */
#include "netsurf/desktop/netsurf.h" #include "netsurf/desktop/netsurf.h"
@ -22,6 +22,7 @@ void netsurf_poll(void)
void netsurf_init(int argc, char** argv) void netsurf_init(int argc, char** argv)
{ {
stdout = stderr;
gui_init(argc, argv); gui_init(argc, argv);
} }

View File

@ -1,4 +1,4 @@
# $Id: makefile,v 1.3 2002/09/11 21:19:24 bursa Exp $ # $Id: makefile,v 1.4 2002/10/08 09:38:29 bursa Exp $
all: netsurf,ff8 all: netsurf,ff8
clean: clean:
@ -9,7 +9,7 @@ FLAGS = -g -Wall -W -Wundef -Wpointer-arith -Wbad-function-cast -Wcast-qual \
-Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline -std=c9x \ -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline -std=c9x \
-I.. -I../../Tools/libxml2/include -I../../Tools/oslib \ -I.. -I../../Tools/libxml2/include -I../../Tools/oslib \
-I../../Tools/curl/include -I../../Tools/libutf-8 \ -I../../Tools/curl/include -I../../Tools/libutf-8 \
-Dfd_set=long -mpoke-function-name -Dfd_set=long -mpoke-function-name -DNETSURF_DUMP
CC = riscos-gcc CC = riscos-gcc
OBJECTS = render/objs-riscos/utils.o render/objs-riscos/css.o \ OBJECTS = render/objs-riscos/utils.o render/objs-riscos/css.o \
render/objs-riscos/css_enum.o render/objs-riscos/box.o \ render/objs-riscos/css_enum.o render/objs-riscos/box.o \

View File

@ -1,5 +1,5 @@
/** /**
* $Id: box.c,v 1.17 2002/09/26 21:38:32 bursa Exp $ * $Id: box.c,v 1.18 2002/10/08 09:38:29 bursa Exp $
*/ */
#include <assert.h> #include <assert.h>
@ -13,6 +13,7 @@
#include "netsurf/riscos/font.h" #include "netsurf/riscos/font.h"
#include "netsurf/render/box.h" #include "netsurf/render/box.h"
#include "netsurf/render/utils.h" #include "netsurf/render/utils.h"
#include "netsurf/utils/log.h"
/** /**
* internal functions * internal functions
@ -123,8 +124,10 @@ void xml_to_box(xmlNode * n, struct css_style * parent_style,
struct box * parent, struct box * inline_container, struct box * parent, struct box * inline_container,
const char *href, struct font_set *fonts) const char *href, struct font_set *fonts)
{ {
LOG(("node %p", n));
convert_xml_to_box(n, parent_style, stylesheet, convert_xml_to_box(n, parent_style, stylesheet,
selector, depth, parent, inline_container, href, fonts); selector, depth, parent, inline_container, href, fonts);
LOG(("normalising"));
box_normalise_block(parent->children); box_normalise_block(parent->children);
} }
@ -141,6 +144,9 @@ struct box * convert_xml_to_box(xmlNode * n, struct css_style * parent_style,
xmlNode * c; xmlNode * c;
char * s; char * s;
assert(n != 0 && parent_style != 0 && stylesheet != 0 && selector != 0 &&
parent != 0 && fonts != 0);
LOG(("depth %i, node %p, node type %i", depth, n, n->type));
gui_multitask(); gui_multitask();
if (n->type == XML_ELEMENT_NODE) { if (n->type == XML_ELEMENT_NODE) {
@ -153,6 +159,7 @@ struct box * convert_xml_to_box(xmlNode * n, struct css_style * parent_style,
free(s); free(s);
} }
style = box_get_style(stylesheet, parent_style, n, *selector, depth + 1); style = box_get_style(stylesheet, parent_style, n, *selector, depth + 1);
LOG(("display: %s", css_display_name[style->display]));
if (style->display == CSS_DISPLAY_NONE) if (style->display == CSS_DISPLAY_NONE)
return inline_container; return inline_container;
@ -174,12 +181,16 @@ struct box * convert_xml_to_box(xmlNode * n, struct css_style * parent_style,
box_add_child(parent, inline_container); box_add_child(parent, inline_container);
} }
if (n->type == XML_TEXT_NODE) { if (n->type == XML_TEXT_NODE) {
LOG(("text node"));
box = box_create(n, BOX_INLINE, parent_style, href); box = box_create(n, BOX_INLINE, parent_style, href);
box->text = squash_whitespace(n->content); box->text = squash_whitespace(n->content);
box->length = strlen(box->text); box->length = strlen(box->text);
LOG(("text node 2"));
box->font = font_open(fonts, box->style); box->font = font_open(fonts, box->style);
box_add_child(inline_container, box); box_add_child(inline_container, box);
LOG(("text node 3"));
} else { } else {
LOG(("float"));
box = box_create(0, BOX_FLOAT_LEFT, 0, href); box = box_create(0, BOX_FLOAT_LEFT, 0, href);
if (style->float_ == CSS_FLOAT_RIGHT) box->type = BOX_FLOAT_RIGHT; if (style->float_ == CSS_FLOAT_RIGHT) box->type = BOX_FLOAT_RIGHT;
box_add_child(inline_container, box); box_add_child(inline_container, box);
@ -258,6 +269,7 @@ struct box * convert_xml_to_box(xmlNode * n, struct css_style * parent_style,
} }
} }
LOG(("depth %i, node %p, node type %i END", depth, n, n->type));
return inline_container; return inline_container;
} }
@ -373,6 +385,7 @@ void box_normalise_block(struct box *block)
struct box *table; struct box *table;
struct css_style *style; struct css_style *style;
LOG(("block %p", block));
assert(block->type == BOX_BLOCK || block->type == BOX_TABLE_CELL); assert(block->type == BOX_BLOCK || block->type == BOX_TABLE_CELL);
for (child = block->children; child != 0; prev_child = child, child = child->next) { for (child = block->children; child != 0; prev_child = child, child = child->next) {
@ -434,6 +447,7 @@ void box_normalise_table(struct box *table)
struct box *row_group; struct box *row_group;
struct css_style *style; struct css_style *style;
LOG(("table %p", table));
assert(table->type == BOX_TABLE); assert(table->type == BOX_TABLE);
for (child = table->children; child != 0; prev_child = child, child = child->next) { for (child = table->children; child != 0; prev_child = child, child = child->next) {
@ -495,6 +509,7 @@ void box_normalise_table_row_group(struct box *row_group)
struct box *row; struct box *row;
struct css_style *style; struct css_style *style;
LOG(("row_group %p", row_group));
assert(row_group->type == BOX_TABLE_ROW_GROUP); assert(row_group->type == BOX_TABLE_ROW_GROUP);
for (child = row_group->children; child != 0; prev_child = child, child = child->next) { for (child = row_group->children; child != 0; prev_child = child, child = child->next) {
@ -555,6 +570,7 @@ void box_normalise_table_row(struct box *row)
struct css_style *style; struct css_style *style;
unsigned int columns = 0; unsigned int columns = 0;
LOG(("row %p", row));
assert(row->type == BOX_TABLE_ROW); assert(row->type == BOX_TABLE_ROW);
for (child = row->children; child != 0; prev_child = child, child = child->next) { for (child = row->children; child != 0; prev_child = child, child = child->next) {
@ -616,6 +632,7 @@ void box_normalise_inline_container(struct box *cont)
struct box *child; struct box *child;
struct box *prev_child = 0; struct box *prev_child = 0;
LOG(("cont %p"));
assert(cont->type == BOX_INLINE_CONTAINER); assert(cont->type == BOX_INLINE_CONTAINER);
for (child = cont->children; child != 0; prev_child = child, child = child->next) { for (child = cont->children; child != 0; prev_child = child, child = child->next) {

View File

@ -1,5 +1,5 @@
/** /**
* $Id: layout.c,v 1.19 2002/09/26 21:38:33 bursa Exp $ * $Id: layout.c,v 1.20 2002/10/08 09:38:29 bursa Exp $
*/ */
#include <assert.h> #include <assert.h>
@ -14,7 +14,7 @@
#include "netsurf/render/utils.h" #include "netsurf/render/utils.h"
#include "netsurf/render/layout.h" #include "netsurf/render/layout.h"
/* #define DEBUG_LAYOUT */ #define DEBUG_LAYOUT
/** /**
* internal functions * internal functions

24
utils/log.h Normal file
View File

@ -0,0 +1,24 @@
/**
* $Id: log.h,v 1.1 2002/10/08 09:38:29 bursa Exp $
*/
#include <stdio.h>
#ifndef _NETSURF_LOG_H_
#define _NETSURF_LOG_H_
#ifdef NDEBUG
#define LOG(x) ((void) 0)
#else
#ifdef __GNUC__
#define LOG(x) (printf(__FILE__ " " __PRETTY_FUNCTION__ " %i: ", __LINE__), printf x, printf("\n"))
#else
#define LOG(x) (printf(__FILE__ " %i: ", __LINE__), printf x, printf("\n"))
#endif
#endif
#endif