Index: trunk/ippTools/src/pxtree.c
===================================================================
--- trunk/ippTools/src/pxtree.c	(revision 14494)
+++ trunk/ippTools/src/pxtree.c	(revision 14510)
@@ -73,9 +73,10 @@
 }
 
+// func() returning false means decend no futher along this branch
 
-bool pxTreeCrawl(pxNode *node, pxNodeFunc func)
+bool pxTreeCrawl(pxNode *node, pxNodeFunc func, void *arg)
 {
     // if func() returns false, stop
-    if (!func(node)) {
+    if (!func(arg, node)) {
         return false;
     }
@@ -84,9 +85,5 @@
     pxNode *child = NULL;
     while ((child = psListGetAndIncrement(iter))) {
-        // if func() returns false, pxTreeCrawl() well return false, and we
-        // should stop
-        if (!pxTreeCrawl(child, func)) {
-            return false;
-        }
+        pxTreeCrawl(child, func, arg);
     }
     psFree(iter);
@@ -94,2 +91,45 @@
     return true;
 }
+
+bool pxNodeFuncCountDependants(void *arg, pxNode *node)
+{
+    (*(int *)arg)++;
+    return true;
+}
+
+bool pxNodeHasChildren(pxNode *node)
+{
+    int children = psListLength(node->children);
+
+    return children ? true : false;
+}
+
+bool pxNodeHasGrandChildren(pxNode *node)
+{
+    // find out how many nodes there are lower in the tree
+    // subtract the parent node from the count so we have just a tally of
+    // decendants
+    int nodes = -1;
+    pxTreeCrawl(node, pxNodeFuncCountDependants, &nodes);
+    psTrace("pxtree", PS_LOG_INFO, "node %s has %d dependants", node->name, nodes);
+
+    // find out how many children this node has
+    int children = psListLength(node->children);
+    psTrace("pxtree", PS_LOG_INFO, "node %s has %d children", node->name, children);
+
+    if (!children) {
+        // no children
+        return false;
+    }
+
+    if (nodes < children) {
+        psAbort("you can't have fewer children than decendants!");
+    }
+
+    if (nodes == children) {
+        // no grandchildren
+        return false;
+    }
+
+    return true;
+}
Index: trunk/ippTools/src/pxtree.h
===================================================================
--- trunk/ippTools/src/pxtree.h	(revision 14494)
+++ trunk/ippTools/src/pxtree.h	(revision 14510)
@@ -33,5 +33,5 @@
 } pxNode;
 
-typedef bool (*pxNodeFunc)(pxNode *node);
+typedef bool (*pxNodeFunc)(void *arg, pxNode *node);
 
 pxNode *pxNodeAlloc(
@@ -47,6 +47,14 @@
 bool pxTreeCrawl(
     pxNode  *node,
-    pxNodeFunc func
+    pxNodeFunc func,
+    void    *arg
 );
+
+bool pxNodeFuncCountDependants(void *arg, pxNode *node);
+
+bool pxNodeHasChildren(pxNode *node);
+
+bool pxNodeHasGrandChildren(pxNode *node);
+
 
 /*
