aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2012-11-05 23:05:43 +0100
committerSebastian Geerken <devnull@localhost>2012-11-05 23:05:43 +0100
commit2e217082100a213c5d716d84dbf696826de64379 (patch)
tree77d7e010178f71dd5c76615afbe02868a680e913
parentad64e574ff6b05571633e0e418e30fb8ec82047d (diff)
Saved some int's per word.
-rw-r--r--dw/textblock.hh4
-rw-r--r--dw/textblock_linebreaking.cc6
2 files changed, 9 insertions, 1 deletions
diff --git a/dw/textblock.hh b/dw/textblock.hh
index 73771feb..42286134 100644
--- a/dw/textblock.hh
+++ b/dw/textblock.hh
@@ -161,8 +161,10 @@ private:
int ratio; // ratio is only defined when badness is defined
int badness, penalty;
- // for debugging:
+ // For debugging: define DEBUG for more informations in print().
+#ifdef DEBUG
int totalWidth, idealWidth, totalStretchability, totalShrinkability;
+#endif
// "Infinity levels" are used to represent very large numbers,
// including "quasi-infinite" numbers. A couple of infinity
diff --git a/dw/textblock_linebreaking.cc b/dw/textblock_linebreaking.cc
index 52f1f4e0..8a1cf442 100644
--- a/dw/textblock_linebreaking.cc
+++ b/dw/textblock_linebreaking.cc
@@ -53,10 +53,12 @@ void Textblock::BadnessAndPenalty::calcBadness (int totalWidth, int idealWidth,
int totalStretchability,
int totalShrinkability)
{
+#ifdef DEBUG
this->totalWidth = totalWidth;
this->idealWidth = idealWidth;
this->totalStretchability = totalStretchability;
this->totalShrinkability = totalShrinkability;
+#endif
ratio = 0; // because this is used in print()
@@ -188,8 +190,12 @@ void Textblock::BadnessAndPenalty::print ()
break;
}
+#ifdef DEBUG
printf (" [%d + %d - %d vs. %d] + ",
totalWidth, totalStretchability, totalShrinkability, idealWidth);
+#else
+ printf (" <no debug> + ");
+#endif
switch (penaltyState) {
case FORCE_BREAK: