ifext/src/print.cxx
// find the src region in or under the passed node
//
// Note: Nodes on same level might not be in positional order
// so we continue with the next sibling even when the previous
// sibling is past the matching region.  Checks children if
// parent region brackets matching region or is blank.
find the src region in or under the passed node
Note: Nodes on same level might not be in positional order
so we continue with the next sibling even when the previous
sibling is past the matching region.  Checks children if
parent region brackets matching region or is blank.
find the src region in or under the passed node Note : Nodes on same level might not be in positional order so we continue with the next sibling even when the previous sibling is past the matching region . Checks children if parent region brackets matching region or is blank .
iffAstNode* ifp_find_node(iffRegion*src, iffAstNode*root)
{
  iffAstNode*rst = NULL;
  for(iffAstNode*cur = root->first; cur && !rst; cur=cur->next){
    iffRegion*cur_reg = cur->region;
    if(cur_reg) {
      if(pos_lt(cur_reg->en, src->en))
	continue;
      if(pos_lt(src->st, cur_reg->st)) 
	continue;
      if(pos_eq(cur_reg->en, src->en) && pos_eq(cur_reg->st, src->st)) {
	rst = cur;
	break;
      }
    }
    rst = ifp_find_node(src, cur);
  }
  return rst;
}
iffAstNode * ifp_find_node ( iffRegion * src , iffAstNode * root ) { iffAstNode * rst = NULL ; for ( iffAstNode * cur = root -> first ; cur && ! rst ; cur = cur -> next ) { iffRegion * cur_reg = cur -> region ; if ( cur_reg ) { if ( pos_lt ( cur_reg -> en , src -> en ) ) continue ; if ( pos_lt ( src -> st , cur_reg -> st ) ) continue ; if ( pos_eq ( cur_reg -> en , src -> en ) && pos_eq ( cur_reg -> st , src -> st ) ) { rst = cur ; break ; } } rst = ifp_find_node ( src , cur ) ; } return rst ; }
find the src region in or under the passed node
Note: Nodes on same level might not be in positional order
so we continue with the next sibling even when the previous
sibling is past the matching region.
find the src region in or under the passed node Note : Nodes on same level might not be in positional order so we continue with the next sibling even when the previous sibling is past the matching region .