From 6c7572f8bd23064f96ba716e1ba8ba8a34847001 Mon Sep 17 00:00:00 2001 From: Sebastian Geerken Date: Mon, 9 Dec 2013 14:16:01 +0100 Subject: Activated RTFL again, see . --- dw/alignedtextblock.cc | 2 + dw/findtext.cc | 3 ++ dw/fltkflatview.cc | 2 + dw/fltkplatform.cc | 4 ++ dw/fltkviewport.cc | 3 ++ dw/image.cc | 2 + dw/layout.cc | 10 ++-- dw/listitem.cc | 2 + dw/selection.cc | 3 ++ dw/table.cc | 2 + dw/tablecell.cc | 2 + dw/textblock.cc | 2 + dw/ui.cc | 2 + dw/widget.cc | 24 ++++----- lout/debug.hh | 131 +++++++++++++++++++++++++++++-------------------- src/dillo.cc | 5 ++ 16 files changed, 133 insertions(+), 66 deletions(-) diff --git a/dw/alignedtextblock.cc b/dw/alignedtextblock.cc index dde408b2..0d910c93 100644 --- a/dw/alignedtextblock.cc +++ b/dw/alignedtextblock.cc @@ -20,6 +20,7 @@ #include "alignedtextblock.hh" +#include "../lout/debug.hh" #include namespace dw { @@ -62,6 +63,7 @@ int AlignedTextblock::CLASS_ID = -1; AlignedTextblock::AlignedTextblock (bool limitTextWidth): Textblock (limitTextWidth) { + DBG_OBJ_CREATE ("dw::AlignedTextblock"); registerName ("dw::AlignedTextblock", &CLASS_ID); } diff --git a/dw/findtext.cc b/dw/findtext.cc index 05896ebd..4390e3ee 100644 --- a/dw/findtext.cc +++ b/dw/findtext.cc @@ -20,6 +20,7 @@ #include "core.hh" +#include "../lout/debug.hh" #include "../lout/msg.h" namespace dw { @@ -27,6 +28,8 @@ namespace core { FindtextState::FindtextState () { + DBG_OBJ_CREATE ("dw::core::FindtextState"); + key = NULL; nexttab = NULL; widget = NULL; diff --git a/dw/fltkflatview.cc b/dw/fltkflatview.cc index b9e85d99..d40c59e5 100644 --- a/dw/fltkflatview.cc +++ b/dw/fltkflatview.cc @@ -20,6 +20,7 @@ #include "fltkflatview.hh" +#include "../lout/debug.hh" #include @@ -31,6 +32,7 @@ namespace fltk { FltkFlatView::FltkFlatView (int x, int y, int w, int h, const char *label): FltkWidgetView (x, y, w, h, label) { + DBG_OBJ_CREATE ("dw::fltk::FltkFlatView"); } FltkFlatView::~FltkFlatView () diff --git a/dw/fltkplatform.cc b/dw/fltkplatform.cc index 1d77e289..2a160d63 100644 --- a/dw/fltkplatform.cc +++ b/dw/fltkplatform.cc @@ -20,6 +20,7 @@ #include #include "../lout/msg.h" +#include "../lout/debug.hh" #include "fltkcore.hh" #include @@ -454,6 +455,8 @@ core::ui::RadioButtonResource FltkPlatform::FltkPlatform () { + DBG_OBJ_CREATE ("dw::fltk::FltkPlatform"); + layout = NULL; idleQueue = new container::typed::List (true); idleFuncRunning = false; @@ -476,6 +479,7 @@ FltkPlatform::~FltkPlatform () void FltkPlatform::setLayout (core::Layout *layout) { this->layout = layout; + DBG_OBJ_ASSOC_CHILD (layout); } diff --git a/dw/fltkviewport.cc b/dw/fltkviewport.cc index de4c8f94..7e91a83a 100644 --- a/dw/fltkviewport.cc +++ b/dw/fltkviewport.cc @@ -27,6 +27,7 @@ #include #include "../lout/msg.h" +#include "../lout/debug.hh" using namespace lout; using namespace lout::object; @@ -53,6 +54,8 @@ public: FltkViewport::FltkViewport (int X, int Y, int W, int H, const char *label): FltkWidgetView (X, Y, W, H, label) { + DBG_OBJ_CREATE ("dw::fltk::FltkViewport"); + hscrollbar = new CustScrollbar (x (), y (), 1, 1); hscrollbar->type(FL_HORIZONTAL); hscrollbar->callback (hscrollbarCallback, this); diff --git a/dw/image.cc b/dw/image.cc index acb2779e..3aef42ac 100644 --- a/dw/image.cc +++ b/dw/image.cc @@ -22,6 +22,7 @@ #include "image.hh" #include "../lout/msg.h" #include "../lout/misc.hh" +#include "../lout/debug.hh" namespace dw { @@ -143,6 +144,7 @@ int Image::CLASS_ID = -1; Image::Image(const char *altText) { + DBG_OBJ_CREATE ("dw::Image"); registerName ("dw::Image", &CLASS_ID); this->altText = altText ? strdup (altText) : NULL; altTextWidth = -1; // not yet calculated diff --git a/dw/layout.cc b/dw/layout.cc index 89361881..f7bd7597 100644 --- a/dw/layout.cc +++ b/dw/layout.cc @@ -245,7 +245,7 @@ Layout::Layout (Platform *platform) topLevel = NULL; widgetAtPoint = NULL; - DBG_OBJ_CREATE (this, "DwRenderLayout"); + DBG_OBJ_CREATE ("dw::core::Layout"); bgColor = NULL; bgImage = NULL; @@ -270,8 +270,8 @@ Layout::Layout (Platform *platform) textZone = new misc::ZoneAllocator (16 * 1024); - DBG_OBJ_ASSOC (&findtextState, this); - DBG_OBJ_ASSOC (&selectionState, this); + DBG_OBJ_ASSOC_CHILD (&findtextState); + DBG_OBJ_ASSOC_CHILD (&selectionState); platform->setLayout (this); @@ -354,6 +354,8 @@ void Layout::removeWidget () void Layout::setWidget (Widget *widget) { + DBG_OBJ_ASSOC_CHILD (widget); + widgetAtPoint = NULL; if (topLevel) { Widget *w = topLevel; @@ -377,6 +379,8 @@ void Layout::attachView (View *view) if (this->view) MSG_ERR("attachView: Multiple views for layout!\n"); + DBG_OBJ_ASSOC_CHILD (view); + this->view = view; platform->attachView (view); diff --git a/dw/listitem.cc b/dw/listitem.cc index ed7a2c75..11086a9e 100644 --- a/dw/listitem.cc +++ b/dw/listitem.cc @@ -20,6 +20,7 @@ #include "listitem.hh" +#include "../lout/debug.hh" #include namespace dw { @@ -29,6 +30,7 @@ int ListItem::CLASS_ID = -1; ListItem::ListItem (ListItem *ref, bool limitTextWidth): AlignedTextblock (limitTextWidth) { + DBG_OBJ_CREATE ("dw::ListItem"); registerName ("dw::ListItem", &CLASS_ID); setRefTextblock (ref); } diff --git a/dw/selection.cc b/dw/selection.cc index 8b4cf318..2201af44 100644 --- a/dw/selection.cc +++ b/dw/selection.cc @@ -20,6 +20,7 @@ #include "core.hh" +#include "../lout/debug.hh" #include @@ -45,6 +46,8 @@ namespace core { SelectionState::SelectionState () { + DBG_OBJ_CREATE ("dw::core::SelectionState"); + layout = NULL; selectionState = NONE; diff --git a/dw/table.cc b/dw/table.cc index 8be39fc3..8db9ef2a 100644 --- a/dw/table.cc +++ b/dw/table.cc @@ -22,6 +22,7 @@ #include "table.hh" #include "../lout/msg.h" #include "../lout/misc.hh" +#include "../lout/debug.hh" using namespace lout; @@ -31,6 +32,7 @@ int Table::CLASS_ID = -1; Table::Table(bool limitTextWidth) { + DBG_OBJ_CREATE ("dw::Table"); registerName ("dw::Table", &CLASS_ID); setFlags (BLOCK_LEVEL); setFlags (USES_HINTS); diff --git a/dw/tablecell.cc b/dw/tablecell.cc index a3aaf07e..5a005e3d 100644 --- a/dw/tablecell.cc +++ b/dw/tablecell.cc @@ -20,6 +20,7 @@ #include "tablecell.hh" +#include "../lout/debug.hh" #include namespace dw { @@ -29,6 +30,7 @@ int TableCell::CLASS_ID = -1; TableCell::TableCell (TableCell *ref, bool limitTextWidth): AlignedTextblock (limitTextWidth) { + DBG_OBJ_CREATE ("dw::TableCell"); registerName ("dw::TableCell", &CLASS_ID); /** \bug ignoreLine1OffsetSometimes does not work? */ diff --git a/dw/textblock.cc b/dw/textblock.cc index 21aaa9dd..8623a574 100644 --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -22,6 +22,7 @@ #include "../lout/msg.h" #include "../lout/misc.hh" #include "../lout/unicode.hh" +#include "../lout/debug.hh" #include #include @@ -221,6 +222,7 @@ void Textblock::setStretchabilityFactor (int stretchabilityFactor) Textblock::Textblock (bool limitTextWidth) { + DBG_OBJ_CREATE ("dw::Textblock"); registerName ("dw::Textblock", &CLASS_ID); setFlags (BLOCK_LEVEL); setFlags (USES_HINTS); diff --git a/dw/ui.cc b/dw/ui.cc index dd98b2e9..8963d3bf 100644 --- a/dw/ui.cc +++ b/dw/ui.cc @@ -20,6 +20,7 @@ #include "core.hh" +#include "../lout/debug.hh" #include @@ -34,6 +35,7 @@ int Embed::CLASS_ID = -1; Embed::Embed(Resource *resource) { + DBG_OBJ_CREATE ("dw::core::ui::Embed"); registerName ("dw::core::ui::Embed", &CLASS_ID); this->resource = resource; resource->setEmbed (this); diff --git a/dw/widget.cc b/dw/widget.cc index 415da6bc..b09c51e9 100644 --- a/dw/widget.cc +++ b/dw/widget.cc @@ -66,6 +66,7 @@ int Widget::CLASS_ID = -1; Widget::Widget () { + DBG_OBJ_CREATE ("dw::core::Widget"); registerName ("dw::core::Widget", &CLASS_ID); flags = (Flags)(NEEDS_RESIZE | EXTREMES_CHANGED | HAS_CONTENTS); @@ -146,7 +147,8 @@ void Widget::setParent (Widget *parent) if (!buttonSensitiveSet) buttonSensitive = parent->buttonSensitive; - //DBG_OBJ_ASSOC (widget, parent); + DBG_OBJ_ASSOC_PARENT (parent); + //printf ("The %s %p becomes a child of the %s %p\n", // getClassName(), this, parent->getClassName(), parent); } @@ -212,9 +214,9 @@ void Widget::sizeRequest (Requisition *requisition) this->requisition = *requisition; unsetFlags (NEEDS_RESIZE); - DBG_OBJ_SET_NUM (this, "requisition->width", requisition->width); - DBG_OBJ_SET_NUM (this, "requisition->ascent", requisition->ascent); - DBG_OBJ_SET_NUM (this, "requisition->descent", requisition->descent); + DBG_OBJ_SET_NUM ("requisition.width", requisition->width); + DBG_OBJ_SET_NUM ("requisition.ascent", requisition->ascent); + DBG_OBJ_SET_NUM ("requisition.descent", requisition->descent); } else *requisition = this->requisition; } @@ -229,8 +231,8 @@ void Widget::getExtremes (Extremes *extremes) this->extremes = *extremes; unsetFlags (EXTREMES_CHANGED); - DBG_OBJ_SET_NUM (this, "extremes->minWidth", extremes->minWidth); - DBG_OBJ_SET_NUM (this, "extremes->maxWidth", extremes->maxWidth); + DBG_OBJ_SET_NUM ("extremes.minWidth", extremes->minWidth); + DBG_OBJ_SET_NUM ("extremes.maxWidth", extremes->maxWidth); } else *extremes = this->extremes; } @@ -273,11 +275,11 @@ void Widget::sizeAllocate (Allocation *allocation) resizeDrawImpl (); - DBG_OBJ_SET_NUM (this, "allocation.x", this->allocation.x); - DBG_OBJ_SET_NUM (this, "allocation.y", this->allocation.y); - DBG_OBJ_SET_NUM (this, "allocation.width", this->allocation.width); - DBG_OBJ_SET_NUM (this, "allocation.ascent", this->allocation.ascent); - DBG_OBJ_SET_NUM (this, "allocation.descent", this->allocation.descent); + DBG_OBJ_SET_NUM ("allocation.x", this->allocation.x); + DBG_OBJ_SET_NUM ("allocation.y", this->allocation.y); + DBG_OBJ_SET_NUM ("allocation.width", this->allocation.width); + DBG_OBJ_SET_NUM ("allocation.ascent", this->allocation.ascent); + DBG_OBJ_SET_NUM ("allocation.descent", this->allocation.descent); } /*unsetFlags (NEEDS_RESIZE);*/ diff --git a/lout/debug.hh b/lout/debug.hh index a2c08393..bbbe401b 100644 --- a/lout/debug.hh +++ b/lout/debug.hh @@ -30,7 +30,7 @@ /* - * Following is experimental, and will be explained soon. + * See . */ #ifdef DBG_RTFL @@ -38,111 +38,138 @@ #include #include -#define DBG_MSG(obj, aspect, prio, msg) \ +#define RTFL_PREFIX_FMT "[rtfl]%s:%d:%d:" +#define RTFL_PREFIX_ARGS __FILE__, __LINE__, getpid() + +#define DBG_OBJ_MSG(aspect, prio, msg) \ + D_STMT_START { \ + printf (RTFL_PREFIX_FMT "obj-msg:%p:%s:%d:%s\n", \ + RTFL_PREFIX_ARGS, this, aspect, prio, msg); \ + fflush (stdout); \ + } D_STMT_END + +#define DBG_OBJ_MSGF(aspect, prio, fmt, ...) \ + D_STMT_START { \ + printf (RTFL_PREFIX_FMT "obj-msg:%p:%s:%d:" fmt "\n", \ + RTFL_PREFIX_ARGS, this, aspect, prio, __VA_ARGS__); \ + fflush (stdout); \ + } D_STMT_END + +#define DBG_OBJ_MSG_START() \ + D_STMT_START { \ + printf (RTFL_PREFIX_FMT "obj-msg-start:%p\n", \ + RTFL_PREFIX_ARGS, this); \ + fflush (stdout); \ + } D_STMT_END + +#define DBG_OBJ_MSG_END() \ D_STMT_START { \ - printf ("[rtfl]%s:%d:%d:msg:%p:%s:%d:%s\n", \ - __FILE__, __LINE__, getpid(), obj, aspect, prio, msg); \ + printf (RTFL_PREFIX_FMT "obj-msg-end:%p\n", \ + RTFL_PREFIX_ARGS, this); \ fflush (stdout); \ } D_STMT_END -#define DBG_MSGF(obj, aspect, prio, fmt, ...) \ +#define DBG_OBJ_CREATE(klass) \ D_STMT_START { \ - printf ("[rtfl]%s:%d:%d:msg:%p:%s:%d:" fmt "\n", \ - __FILE__, __LINE__, getpid(), obj, aspect, prio, __VA_ARGS__); \ + printf (RTFL_PREFIX_FMT "obj-create:%p:%s\n", \ + RTFL_PREFIX_ARGS, this, klass); \ fflush (stdout); \ } D_STMT_END -#define DBG_MSG_START(obj) \ +#define DBG_OBJ_BASECLASS(klass) \ D_STMT_START { \ - printf ("[rtfl]%s:%d:%d:msg-start:%p\n", \ - __FILE__, __LINE__, getpid(), obj); \ + printf (RTFL_PREFIX_FMT "obj-ident:%p:%p\n", \ + RTFL_PREFIX_ARGS, this, (klass*)this); \ fflush (stdout); \ } D_STMT_END -#define DBG_MSG_END(obj) \ +#define DBG_OBJ_ASSOC(parent, child) \ D_STMT_START { \ - printf ("[rtfl]%s:%d:%d:msg-end:%p\n", \ - __FILE__, __LINE__, getpid(), obj); \ + printf (RTFL_PREFIX_FMT "obj-assoc:%p:%p\n", \ + RTFL_PREFIX_ARGS, parent, child); \ fflush (stdout); \ } D_STMT_END -#define DBG_OBJ_CREATE(obj, klass) \ +#define DBG_OBJ_ASSOC_PARENT(parent) \ D_STMT_START { \ - printf ("[rtfl]%s:%d:%d:obj-create:%p:%s\n", \ - __FILE__, __LINE__, getpid(), obj, klass); \ + printf (RTFL_PREFIX_FMT "obj-assoc:%p:%p\n", \ + RTFL_PREFIX_ARGS, parent, this); \ fflush (stdout); \ } D_STMT_END -#define DBG_OBJ_ASSOC(child, parent) \ +#define DBG_OBJ_ASSOC_CHILD(child) \ D_STMT_START { \ - printf ("[rtfl]%s:%d:%d:obj-assoc:%p:%p\n", \ - __FILE__, __LINE__, getpid(), child, parent); \ + printf (RTFL_PREFIX_FMT "obj-assoc:%p:%p\n", \ + RTFL_PREFIX_ARGS, this, child); \ fflush (stdout); \ } D_STMT_END -#define DBG_OBJ_SET_NUM(obj, var, val) \ +#define DBG_OBJ_SET_NUM(var, val) \ D_STMT_START { \ - printf ("[rtfl]%s:%d:%d:obj-set:%p:%s:%d\n", \ - __FILE__, __LINE__, getpid(), obj, var, val); \ + printf (RTFL_PREFIX_FMT "obj-set:%p:%s:%d\n", \ + RTFL_PREFIX_ARGS, this, var, val); \ fflush (stdout); \ } D_STMT_END -#define DBG_OBJ_SET_STR(obj, var, val) \ +#define DBG_OBJ_SET_STR(var, val) \ D_STMT_START { \ - printf ("[rtfl]%s:%d:%d:obj-set:%p:%s:%s\n", \ - __FILE__, __LINE__, getpid(), obj, var, val); \ + 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(obj, var, val) \ +#define DBG_OBJ_SET_PTR(var, val) \ D_STMT_START { \ - printf ("[rtfl]%s:%d:%d:obj-set:%p:%s:%p\n", \ - __FILE__, __LINE__, getpid(), obj, var, val); \ + printf (RTFL_PREFIX_FMT "obj-set:%p:%s:%p\n", \ + RTFL_PREFIX_ARGS, this, var, val); \ fflush (stdout); \ } D_STMT_END -#define DBG_OBJ_ARRSET_NUM(obj, var, ind, val) \ +#define DBG_OBJ_ARRSET_NUM(var, ind, val) \ D_STMT_START { \ - printf ("[rtfl]%s:%d:%d:obj-set:%p:" var ":%d\n", \ - __FILE__, __LINE__, getpid(), obj, ind, val); \ + printf (RTFL_PREFIX_FMT "obj-set:%p:" var ".%d:%d\n", \ + RTFL_PREFIX_ARGS, this, ind, val); \ fflush (stdout); \ } D_STMT_END -#define DBG_OBJ_ARRSET_STR(obj, var, ind, val) \ +#define DBG_OBJ_ARRSET_STR(var, ind, val) \ D_STMT_START { \ - printf ("[rtfl]%s:%d:%d:obj-set:%p:" var ":%s\n", \ - __FILE__, __LINE__, getpid(), obj, ind, val); \ + printf (RTFL_PREFIX_FMT "obj-set:%p:" var ".%d:%s\n", \ + RTFL_PREFIX_ARGS, this, ind, val); \ fflush (stdout); \ } D_STMT_END -#define DBG_OBJ_ARRSET_PTR(obj, var, ind, val) \ +#define DBG_OBJ_ARRSET_PTR(var, ind, val) \ D_STMT_START { \ - printf ("[rtfl]%s:%d:%d:obj-set:%p:" var ":%p\n", \ - __FILE__, __LINE__, getpid(), obj, ind, val); \ + printf (RTFL_PREFIX_FMT "obj-set:%p:" var ".%d:%p\n", \ + RTFL_PREFIX_ARGS, this, ind, val); \ fflush (stdout); \ } D_STMT_END -#define DBG_OBJ_COLOR(klass, color) \ +#define DBG_OBJ_COLOR(color, klass) \ D_STMT_START { \ - printf ("[rtfl]%s:%d:%d:obj-color:%s:%s\n", \ - __FILE__, __LINE__, getpid(), klass, color); \ + printf (RTFL_PREFIX_FMT "obj-color:%s:%s\n", \ + RTFL_PREFIX_ARGS, color, klass); \ fflush (stdout); \ } D_STMT_END #else /* DBG_RTFL */ -#define DBG_MSG(obj, aspect, prio, msg) -#define DBG_MSGF(obj, aspect, prio, fmt, ...) -#define DBG_MSG_START(obj) -#define DBG_MSG_END(obj) -#define DBG_OBJ_CREATE(obj, klass) -#define DBG_OBJ_ASSOC(child, parent) -#define DBG_OBJ_SET_NUM(obj, var, val) -#define DBG_OBJ_SET_STR(obj, var, val) -#define DBG_OBJ_SET_PTR(obj, var, val) -#define DBG_OBJ_ARRSET_NUM(obj, var, ind, val) -#define DBG_OBJ_ARRSET_STR(obj, var, ind, val) -#define DBG_OBJ_ARRSET_PTR(obj, var, ind, val) +#define DBG_OBJ_MSG(aspect, prio, msg) +#define DBG_OBJ_MSGF(aspect, prio, fmt, ...) +#define DBG_OBJ_MSG_START(obj) +#define DBG_OBJ_MSG_END(obj) +#define DBG_OBJ_CREATE(klass) +#define DBG_OBJ_BASECLASS(klass) +#define DBG_OBJ_ASSOC_PARENT(parent) +#define DBG_OBJ_ASSOC_CHILD(child) +#define DBG_OBJ_ASSOC(parent, child) +#define DBG_OBJ_SET_NUM(var, val) +#define DBG_OBJ_SET_STR(var, val) +#define DBG_OBJ_SET_PTR(var, val) +#define DBG_OBJ_ARRSET_NUM(var, ind, val) +#define DBG_OBJ_ARRSET_STR(var, ind, val) +#define DBG_OBJ_ARRSET_PTR(var, ind, val) #define DBG_OBJ_COLOR(klass, color) #endif /* DBG_RTFL */ diff --git a/src/dillo.cc b/src/dillo.cc index e519d4df..2b9f1645 100644 --- a/src/dillo.cc +++ b/src/dillo.cc @@ -53,6 +53,7 @@ #include "domain.h" #include "auth.h" +#include "lout/debug.hh" #include "dw/fltkcore.hh" #include "dw/textblock.hh" @@ -375,6 +376,10 @@ static DilloUrl *makeStartUrl(char *str, bool local) */ int main(int argc, char **argv) { + DBG_OBJ_COLOR("#c0ff80", "dw::*"); + DBG_OBJ_COLOR("#c0c0ff", "dw::fltk::*"); + DBG_OBJ_COLOR("#ffa0a0", "dw::core::*"); + uint_t opt_id; uint_t options_got = 0; uint32_t xid = 0; -- cgit v1.2.3