34
34
#include "translat.h"
35
35
#include "gedcom.h"
38
/*********************************************
39
* local function prototypes
40
*********************************************/
43
static void fix_cel(NODE root);
44
static void fix_children(NODE root);
37
46
/*======================================
38
47
* split_indi -- Split person into parts
346
367
node = nsibling(node);
370
/*==================================================
371
* normalize_rec -- ensure nodes are in lifelines order
373
*================================================*/
375
normalize_rec (RECORD irec)
377
NODE root = nztop(irec);
379
if (eqstr(ntag(root), "INDI"))
380
normalize_indi(root);
381
else if (eqstr(ntag(root), "FAM"))
384
/*==================================================
385
* normalize_irec -- ensure nodes are in lifelines order
386
* for individual record
387
*================================================*/
389
normalize_irec (RECORD irec)
391
NODE indi=nztop(irec);
393
normalize_indi(indi);
395
/*==================================================
396
* normalize_indi -- ensure nodes are in lifelines order
397
* for individual root node
398
*================================================*/
400
normalize_indi (NODE indi)
402
NODE name, refn, sex, body, famc, fams;
404
split_indi_old(indi, &name, &refn, &sex, &body, &famc, &fams);
405
ASSERT(eqstr(ntag(indi), "INDI"));
406
join_indi(indi, name, refn, sex, body, famc, fams);
408
/*==================================================
409
* normalize_fam -- ensure nodes are in lifelines order
410
*================================================*/
412
normalize_fam (NODE fam)
414
NODE fref, husb, wife, chil, rest;
416
split_fam(fam, &fref, &husb, &wife, &chil, &rest);
417
ASSERT(eqstr(ntag(fam), "FAM"));
418
join_fam(fam, fref, husb, wife, chil, rest);
420
/*=======================================
421
* fix_children -- Set parent pointers of all immediate children
422
*=====================================*/
424
fix_children (NODE root)
427
for (node = nchild(root); node; node = nsibling(node)) {
428
nparent(node) = root;
431
/*=======================================
432
* fix_cel -- Set cel of all descendants to agree with root
433
*=====================================*/
437
set_all_nodetree_to_root_cel(root);