static rc_t find_or_make_by_name( ref_exclude *exclude, const String * name, ref_node ** node ) { rc_t rc = 0; *node = find_ref_node( exclude, name ); if ( *node == NULL ) { /* if not found: make such a node... */ *node = make_ref_node( exclude, name ); if ( *node == NULL ) { rc = RC( rcApp, rcNoTarg, rcConstructing, rcSelf, rcNull ); } else { /* if node was successfully made, insert it into our tree */ rc = BSTreeInsert ( &exclude->ref_nodes, (BSTNode *)( *node ), ref_node_sort ); } } return rc; }
static void nentify_1(struct xcl_context *xc,struct xcl_c *cp) { int i = 0, last_nent_end = 0; for (i = 0; i < cp->nchildren; ++i) { if (cp->children[i].c->node_type == xcl_node_l && cp->children[i].l->f->f2.pos && is_pn_pos((char*)cp->children[i].l->f->f2.pos)) { int nent_begin = i, nent_end = -1; const char *lref; while (1) { while (i < cp->nchildren && cp->children[i].c->node_type == xcl_node_d) ++i; /*FIXME: this should use the d_actions */ if (i == cp->nchildren) break; lref = has_V_qualifier_ref(cp->children[i].l->f); if (lref) { int new_nent_end; struct prop *child_is = NULL; new_nent_end = find_ref_node(lref, cp, i+1); if (new_nent_end == i) break; else i = new_nent_end; /* FIXME: should this catch great-grand also? */ if ((child_is = props_find_prop(cp->children[i].l->f, (unsigned char *)"child-is", NULL))) great_check(child_is, cp->children[i].l); if (i >= cp->nchildren) break; else nent_end = new_nent_end; } else { int entry = 0; while ((i+1) < cp->nchildren && cp->children[i+1].c->node_type == xcl_node_d) ++i; /*FIXME: this should use the d_actions */ /* don't pick up trailing discontinuities */ entry = i; while ((i+1) < cp->nchildren && cp->children[i+1].c->node_type == xcl_node_l && has_marker(cp->children[i+1].l->f) && !has_h_relator(cp->children[i+1].l->f)) { ++i; if (has_v_relator(cp->children[i].l->f) && (i+1) < cp->nchildren && cp->children[i+1].c->node_type == xcl_node_l && (is_pn_pos((char*)cp->children[i+1].l->f->f2.epos))) ++i; } if (i == entry) break; else nent_end = i; } } if (nent_begin && (nent_begin-1) > last_nent_end && cp->children[nent_begin-1].c->node_type == xcl_node_l && has_marker(cp->children[nent_begin-1].l->f) && !has_h_relator(cp->children[nent_begin-1].l->f)) --nent_begin; else props_head_reg(xc->props, cp->children[nent_begin].l); #if 0 if (is_group_head(cp->children[nent_begin].l)) { const char *refid = cp->children[nent_begin].l->xml_id; int group_begin; for (group_begin = 0; group_begin < nent_begin; ++group_begin) { if (cp->children[group_begin].c->node_type == xcl_node_l && groups_with(cp->children[group_begin].l,refid)) break; } props_link(cp, group_begin, nent_begin, "psa", "person-group"); /* nent_begin = group_begin; */ } #endif props_link(cp, nent_begin, nent_end, "psa", "person-spec"); } } }