static int ptElement_depth(PTElement e) { int n = -1; while (e != null) { ++n; e = e.parent; } ret n; }