From aff82aa4ea8f9e7dcc549afec9218154e1d9c7bd Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 18 Jan 2024 00:43:48 -0600 Subject: new paths Signed-off-by: Jeff Carr --- debug.go | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'debug.go') diff --git a/debug.go b/debug.go index 0de8d95..371de36 100644 --- a/debug.go +++ b/debug.go @@ -8,8 +8,8 @@ import ( "errors" "strconv" + "go.wit.com/lib/widget" "go.wit.com/log" - "go.wit.com/gui/widget" ) // for printing out the binary tree @@ -25,15 +25,15 @@ func (n *Node) Dump() { Indent(b, "(X,Y) = ", n.X, n.Y) Indent(b, "Next (W,H) = ", n.NextW, n.NextH) - if (n.parent == nil) { + if n.parent == nil { Indent(b, "parent = nil") } else { Indent(b, "parent.id =", n.parent.id) } - if (n.children != nil) { + if n.children != nil { Indent(b, "children = ", n.children) } - if (n.Custom != nil) { + if n.Custom != nil { Indent(b, "Custom = ", n.Custom) } Indent(b, "NODE DUMP END") @@ -49,13 +49,12 @@ func Indent(b bool, a ...interface{}) { func (n *Node) dumpWidget(b bool) string { var info, d string - if (n == nil) { + if n == nil { log.Error(errors.New("dumpWidget() node == nil")) return "" } info = n.WidgetType.String() - var tabs string for i := 0; i < listChildrenDepth; i++ { tabs = tabs + defaultPadding @@ -87,21 +86,21 @@ func (n *Node) Children() []*Node { // func (n *Node) ListChildren(dump bool, dropdown *Node, mapNodes map[string]*Node) { func (n *Node) ListChildren(dump bool) { - if (n == nil) { + if n == nil { return } n.dumpWidget(dump) if len(n.children) == 0 { - if (n.parent == nil) { + if n.parent == nil { return } - log.Log(NODE, "\t\t\tparent =",n.parent.id) - if (listChildrenParent != nil) { - log.Log(NODE, "\t\t\tlistChildrenParent =",listChildrenParent.id) - if (listChildrenParent.id != n.parent.id) { - log.Log(NOW, "parent =",n.parent.id, n.parent.progname) - log.Log(NOW, "listChildrenParent =",listChildrenParent.id, listChildrenParent.progname) + log.Log(NODE, "\t\t\tparent =", n.parent.id) + if listChildrenParent != nil { + log.Log(NODE, "\t\t\tlistChildrenParent =", listChildrenParent.id) + if listChildrenParent.id != n.parent.id { + log.Log(NOW, "parent =", n.parent.id, n.parent.progname) + log.Log(NOW, "listChildrenParent =", listChildrenParent.id, listChildrenParent.progname) log.Log(NOW, listChildrenParent.id, "!=", n.parent.id) log.Exit("parent.child does not match child.parent") } @@ -110,15 +109,15 @@ func (n *Node) ListChildren(dump bool) { return } for _, child := range n.children { - if (child.parent != nil) { - log.Log(NODE, "\t\t\tparent =",child.parent.id) + if child.parent != nil { + log.Log(NODE, "\t\t\tparent =", child.parent.id) } else { log.Log(GUI, "\t\t\tno parent") // memory corruption? non-threadsafe access? // can all binary tree changes to Node.parent & Node.child be forced into a singular goroutine? panic("something is wrong with the wit golang gui logic and the binary tree is broken. child has no parent") } - if (child.children == nil) { + if child.children == nil { log.Log(NODE, "\t\t", child.id, "has no children") } else { log.Log(NODE, "\t\t\tHas children:", child.children) -- cgit v1.2.3