oid_backward
oid_backward (oid)
This function returns the oid of the element preceding the element specified by oid in linear (galley strip) order. Returns oid_null if oid is the first object in the document.
Examples
The oid_backward function could be written using oid_prev and oid_child as follows:
function oid_backward(o)
{
if (!oid_valid(o)) {
return oid_null()
}
# if no left sibling, return parent
local lsib = oid_prev(o)
if (!oid_valid(lsib)) {
return oid_parent(o)
}
# return deepest, rightmost child of the
# immediate left sibling, if there is one
local rchild = lsib, last
while (oid_valid(rchild)) {
last=rchild
rchild=oid_child(rchild, -1)
}
return last
}
Related Topics