aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dw/outofflowmgr.cc36
-rw-r--r--dw/textblock.cc10
-rw-r--r--dw/textblock_linebreaking.cc15
-rw-r--r--lout/debug.hh34
4 files changed, 62 insertions, 33 deletions
diff --git a/dw/outofflowmgr.cc b/dw/outofflowmgr.cc
index 5ba445ca..d5b1f364 100644
--- a/dw/outofflowmgr.cc
+++ b/dw/outofflowmgr.cc
@@ -1623,25 +1623,25 @@ int OutOfFlowMgr::getBorder (Textblock *textblock, Side side, int y, int h,
SortedFloatsVector *list = getFloatsListForTextblock (textblock, side);
-#ifdef DBG_RTFL
- DBG_OBJ_MSG ("border", 1, "searching in list:");
- DBG_OBJ_MSG_START ();
-
- for (int i = 0; i < list->size(); i++) {
- Float *f = list->get(i);
- DBG_OBJ_MSGF ("border", 1,
- "%d: (%p, i = %d/%d, y = %d/%d, s = (%d * (%d + %d), "
- "%s, %s); widget at (%d, %d)",
- i, f->getWidget (), f->index, f->sideSpanningIndex,
- f->yReq, f->yReal, f->size.width, f->size.ascent,
- f->size.descent, f->dirty ? "dirty" : "clean",
- f->sizeChangedSinceLastAllocation ? "scsla" : "sNcsla",
- f->getWidget()->getAllocation()->x,
- f->getWidget()->getAllocation()->y);
+ DBG_IF_RTFL {
+ DBG_OBJ_MSG ("border", 1, "searching in list:");
+ DBG_OBJ_MSG_START ();
+
+ for (int i = 0; i < list->size(); i++) {
+ Float *f = list->get(i);
+ DBG_OBJ_MSGF ("border", 1,
+ "%d: (%p, i = %d/%d, y = %d/%d, s = (%d * (%d + %d), "
+ "%s, %s); widget at (%d, %d)",
+ i, f->getWidget (), f->index, f->sideSpanningIndex,
+ f->yReq, f->yReal, f->size.width, f->size.ascent,
+ f->size.descent, f->dirty ? "dirty" : "clean",
+ f->sizeChangedSinceLastAllocation ? "scsla" : "sNcsla",
+ f->getWidget()->getAllocation()->x,
+ f->getWidget()->getAllocation()->y);
+ }
+
+ DBG_OBJ_MSG_END ();
}
-
- DBG_OBJ_MSG_END ();
-#endif
int first = list->findFirst (textblock, y, h, lastGB, lastExtIndex);
diff --git a/dw/textblock.cc b/dw/textblock.cc
index ec6d8ce7..3e184719 100644
--- a/dw/textblock.cc
+++ b/dw/textblock.cc
@@ -2116,7 +2116,7 @@ void Textblock::addText0 (const char *text, size_t len, short flags,
word->content.type = core::Content::TEXT;
word->content.text = layout->textZone->strndup(text, len);
- DBG_OBJ_ARRATTRSET_STR ("words", words->size () - 1, "type", "TEXT");
+ DBG_OBJ_ARRATTRSET_SYM ("words", words->size () - 1, "type", "TEXT");
DBG_OBJ_ARRATTRSET_STR ("words", words->size () - 1,
"text/widget/breakSpace", word->content.text);
@@ -2162,7 +2162,7 @@ void Textblock::addWidget (core::Widget *widget, core::style::Style *style)
word->content.widget = widget;
word->style = style;
- DBG_OBJ_ARRATTRSET_STR ("words", words->size () - 1, "type",
+ DBG_OBJ_ARRATTRSET_SYM ("words", words->size () - 1, "type",
"WIDGET_OOF_REF");
DBG_OBJ_ARRATTRSET_PTR ("words", words->size () - 1,
"text/widget/breakSpace", word->content.widget);
@@ -2182,7 +2182,7 @@ void Textblock::addWidget (core::Widget *widget, core::style::Style *style)
word->content.type = core::Content::WIDGET_IN_FLOW;
word->content.widget = widget;
- DBG_OBJ_ARRATTRSET_STR ("words", words->size () - 1, "type",
+ DBG_OBJ_ARRATTRSET_SYM ("words", words->size () - 1, "type",
"WIDGET_IN_FLOW");
DBG_OBJ_ARRATTRSET_PTR ("words", words->size () - 1,
"text/widget/breakSpace", word->content.widget);
@@ -2430,7 +2430,7 @@ void Textblock::addParbreak (int space, core::style::Style *style)
word->badnessAndPenalty.setPenalty (PENALTY_FORCE_BREAK);
word->content.breakSpace = space;
- DBG_OBJ_ARRATTRSET_STR ("words", words->size () - 1, "type", "BREAK");
+ DBG_OBJ_ARRATTRSET_SYM ("words", words->size () - 1, "type", "BREAK");
DBG_OBJ_ARRATTRSET_NUM ("words", words->size () - 1,
"text/widget/breakSpace", word->content.breakSpace);
@@ -2458,7 +2458,7 @@ void Textblock::addLinebreak (core::style::Style *style)
word->badnessAndPenalty.setPenalty (PENALTY_FORCE_BREAK);
word->content.breakSpace = 0;
- DBG_OBJ_ARRATTRSET_STR ("words", words->size () - 1, "type", "BREAK");
+ DBG_OBJ_ARRATTRSET_SYM ("words", words->size () - 1, "type", "BREAK");
DBG_OBJ_ARRATTRSET_NUM ("words", words->size () - 1,
"text/widget/breakSpace", word->content.breakSpace);
diff --git a/dw/textblock_linebreaking.cc b/dw/textblock_linebreaking.cc
index 975eae75..bfdb483e 100644
--- a/dw/textblock_linebreaking.cc
+++ b/dw/textblock_linebreaking.cc
@@ -1081,13 +1081,14 @@ int Textblock::hyphenateWord (int wordIndex)
PRINTF ("[%p] %d words ...\n", this, words->size ());
words->insert (wordIndex, numBreaks);
-#ifdef DBG_RTFL
- // TODO Must be corrected.
- for (int i = wordIndex + numBreaks; i < words->size (); i++) {
- DBG_OBJ_ARRATTRSET_STR ("words", i, "type", "???");
- DBG_OBJ_ARRATTRSET_STR ("words", i, "text/widget/breakSpace", "???");
+ DBG_IF_RTFL {
+ // TODO Must be corrected.
+ for (int i = wordIndex + numBreaks; i < words->size (); i++) {
+ DBG_OBJ_ARRATTRSET_SYM ("words", i, "type", "???");
+ DBG_OBJ_ARRATTRSET_STR ("words", i, "text/widget/breakSpace",
+ "???");
+ }
}
-#endif
for (int i = 0; i < numBreaks; i++)
initWord (wordIndex + i);
@@ -1120,7 +1121,7 @@ int Textblock::hyphenateWord (int wordIndex)
end - start);
PRINTF (" [%d] -> '%s'\n", wordIndex + i, w->content.text);
- DBG_OBJ_ARRATTRSET_STR ("words", wordIndex + i, "type", "TEXT");
+ DBG_OBJ_ARRATTRSET_SYM ("words", wordIndex + i, "type", "TEXT");
DBG_OBJ_ARRATTRSET_STR ("words", wordIndex + i,
"text/widget/breakSpace", w->content.text);
diff --git a/lout/debug.hh b/lout/debug.hh
index bf434e07..999a4a8b 100644
--- a/lout/debug.hh
+++ b/lout/debug.hh
@@ -40,6 +40,8 @@
#include <unistd.h>
#include <stdio.h>
+#define DBG_IF_RTFL if(1)
+
// "\n" at the beginning just in case that the previous line is not finished
// yet.
#define RTFL_PREFIX_FMT "\n[rtfl]%s:%d:%d:"
@@ -155,13 +157,20 @@
fflush (stdout); \
} D_STMT_END
-#define DBG_OBJ_SET_STR(var, val) \
+#define DBG_OBJ_SET_SYM(var, val) \
D_STMT_START { \
printf (RTFL_PREFIX_FMT "obj-set:%p:%s:%s\n", \
RTFL_PREFIX_ARGS, this, var, val); \
fflush (stdout); \
} D_STMT_END
+#define DBG_OBJ_SET_STR(var, val) \
+ D_STMT_START { \
+ printf (RTFL_PREFIX_FMT "obj-set:%p:%s:\"%s\"\n", \
+ RTFL_PREFIX_ARGS, this, var, val); \
+ fflush (stdout); \
+ } D_STMT_END
+
#define DBG_OBJ_SET_PTR(var, val) \
D_STMT_START { \
printf (RTFL_PREFIX_FMT "obj-set:%p:%s:%p\n", \
@@ -176,13 +185,20 @@
fflush (stdout); \
} D_STMT_END
-#define DBG_OBJ_ARRSET_STR(var, ind, val) \
+#define DBG_OBJ_ARRSET_SYM(var, ind, val) \
D_STMT_START { \
printf (RTFL_PREFIX_FMT "obj-set:%p:%s.%d:%s\n", \
RTFL_PREFIX_ARGS, this, var, ind, val); \
fflush (stdout); \
} D_STMT_END
+#define DBG_OBJ_ARRSET_STR(var, ind, val) \
+ D_STMT_START { \
+ printf (RTFL_PREFIX_FMT "obj-set:%p:%s.%d:\"%s\"\n", \
+ RTFL_PREFIX_ARGS, this, var, ind, val); \
+ fflush (stdout); \
+ } D_STMT_END
+
#define DBG_OBJ_ARRSET_PTR(var, ind, val) \
D_STMT_START { \
printf (RTFL_PREFIX_FMT "obj-set:%p:%s.%d:%p\n", \
@@ -197,13 +213,20 @@
fflush (stdout); \
} D_STMT_END
-#define DBG_OBJ_ARRATTRSET_STR(var, ind, attr, val) \
+#define DBG_OBJ_ARRATTRSET_SYM(var, ind, attr, val) \
D_STMT_START { \
printf (RTFL_PREFIX_FMT "obj-set:%p:%s.%d.%s:%s\n", \
RTFL_PREFIX_ARGS, this, var, ind, attr, val); \
fflush (stdout); \
} D_STMT_END
+#define DBG_OBJ_ARRATTRSET_STR(var, ind, attr, val) \
+ D_STMT_START { \
+ printf (RTFL_PREFIX_FMT "obj-set:%p:%s.%d.%s:\"%s\"\n", \
+ RTFL_PREFIX_ARGS, this, var, ind, attr, val); \
+ fflush (stdout); \
+ } D_STMT_END
+
#define DBG_OBJ_ARRATTRSET_PTR(var, ind, attr, val) \
D_STMT_START { \
printf (RTFL_PREFIX_FMT "obj-set:%p:%s.%d.%s:%p\n", \
@@ -220,6 +243,8 @@
#else /* DBG_RTFL */
+#define DBG_IF_RTFL if(0)
+
#define DBG_OBJ_MSG(aspect, prio, msg) D_STMT_NOP
#define DBG_OBJ_MSG_O(aspect, prio, obj, msg) D_STMT_NOP
#define DBG_OBJ_MSGF(aspect, prio, fmt, ...) D_STMT_NOP
@@ -235,12 +260,15 @@
#define DBG_OBJ_ASSOC(parent, child) D_STMT_NOP
#define DBG_OBJ_SET_NUM(var, val) D_STMT_NOP
#define DBG_OBJ_SET_NUM_O(obj, var, val) D_STMT_NOP
+#define DBG_OBJ_SET_SYM(var, val) D_STMT_NOP
#define DBG_OBJ_SET_STR(var, val) D_STMT_NOP
#define DBG_OBJ_SET_PTR(var, val) D_STMT_NOP
#define DBG_OBJ_ARRSET_NUM(var, ind, val) D_STMT_NOP
+#define DBG_OBJ_ARRSET_SYM(var, ind, val) D_STMT_NOP
#define DBG_OBJ_ARRSET_STR(var, ind, val) D_STMT_NOP
#define DBG_OBJ_ARRSET_PTR(var, ind, val) D_STMT_NOP
#define DBG_OBJ_ARRATTRSET_NUM(var, ind, attr, val) D_STMT_NOP
+#define DBG_OBJ_ARRATTRSET_SYM(var, ind, attr, val) D_STMT_NOP
#define DBG_OBJ_ARRATTRSET_STR(var, ind, attr, val) D_STMT_NOP
#define DBG_OBJ_ARRATTRSET_PTR(var, ind, attr, val) D_STMT_NOP
#define DBG_OBJ_COLOR(klass, color)