src/gedlib/spltjoin.c
/*=======================================
 * split_othr -- Split a misc node tree into parts
 *  all unrecognized (level 1) nodes go into rest
 *  root:  [I/O] node root
 *  prefn: [OUT] first REFN (with others as sibs)
 *  prest: [OUT] first of rest (with others as sibs)
 * node tree is broken apart, so each section (eg, refns)
 *  is not connected to other sections
 *=====================================*/
- Split a misc node tree into parts
all unrecognized (level 1) nodes go into rest
root:  [I/O] node root
prefn: [OUT] first REFN (with others as sibs)
prest: [OUT] first of rest (with others as sibs)
node tree is broken apart, so each section
is not connected to other sections
- Split a misc node tree into parts all unrecognized ( level 1 ) nodes go into rest root : [ I / O ] node root prefn : [ OUT ] first REFN ( with others as sibs ) prest : [ OUT ] first of rest ( with others as sibs ) node tree is broken apart so each section is not connected to other sections
void
split_othr (NODE root, NODE *prefn, NODE *prest)
{
	NODE node, rest, last;
	NODE prev, refn, lref;
	STRING tag;
	rest = last = NULL;
	prev = refn = lref = NULL;
	node = nchild(root);
	nchild(root) = nsibling(root) = NULL;
	while (node) {
		tag = ntag(node);
		if (eqstr("REFN", tag)) {
			if (refn)
				lref = nsibling(lref) = node;
			else
				refn = lref = node;
		} else if (rest)
			last = nsibling(last) = node;
		else
			last = rest = node;
		prev = node;
		node = nsibling(node);
		nsibling(prev) = NULL;
	}
	*prefn = refn;
	*prest = rest;
}
void split_othr ( NODE root , NODE * prefn , NODE * prest ) { NODE node , rest , last ; NODE prev , refn , lref ; STRING tag ; rest = last = NULL ; prev = refn = lref = NULL ; node = nchild ( root ) ; nchild ( root ) = nsibling ( root ) = NULL ; while ( node ) { tag = ntag ( node ) ; if ( eqstr ( " " , tag ) ) { if ( refn ) lref = nsibling ( lref ) = node ; else refn = lref = node ; } else if ( rest ) last = nsibling ( last ) = node ; else last = rest = node ; prev = node ; node = nsibling ( node ) ; nsibling ( prev ) = NULL ; } * prefn = refn ; * prest = rest ; }
split_othr -- Split a misc node tree into parts
  all unrecognized (level 1) nodes go into rest
  root:  [I/O] node root
  prefn: [OUT] first REFN (with others as sibs)
  prest: [OUT] first of rest (with others as sibs)
 node tree is broken apart, so each section (eg, refns)
  is not connected to other sections
split_othr -- Split a misc node tree into parts all unrecognized ( level 1 ) nodes go into rest root : [ I / O ] node root prefn : [ OUT ] first REFN ( with others as sibs ) prest : [ OUT ] first of rest ( with others as sibs ) node tree is broken apart so each section ( eg refns ) is not connected to other sections