~ubuntu-branches/ubuntu/trusty/lifelines/trusty

« back to all changes in this revision

Viewing changes to src/gedlib/spltjoin.c

  • Committer: Bazaar Package Importer
  • Author(s): Felipe Augusto van de Wiel (faw)
  • Date: 2007-05-23 23:49:53 UTC
  • mfrom: (3.1.3 edgy)
  • Revision ID: james.westby@ubuntu.com-20070523234953-ogno9rnbmth61i7p
Tags: 3.0.50-2etch1
* Changing docs/ll-reportmanual.xml and docs/ll-userguide.xml to fix
  documentation build problems (Closes: #418347).

* lifelines-reports
  - Adding a dependency to lifelines >= 3.0.50 to prevent file conflict.
    (Closes: #405500).

* Updating French translation. Thanks to Bernard Adrian. (Closes: #356671).

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
#include "table.h"
34
34
#include "translat.h"
35
35
#include "gedcom.h"
 
36
#include "cache.h"
 
37
 
 
38
/*********************************************
 
39
 * local function prototypes
 
40
 *********************************************/
 
41
 
 
42
/* alphabetical */
 
43
static void fix_cel(NODE root);
 
44
static void fix_children(NODE root);
36
45
 
37
46
/*======================================
38
47
 * split_indi -- Split person into parts
164
173
                else
165
174
                        nchild(indi) = fams;
166
175
        }
 
176
        /* fix parenthood of all children of indi */
 
177
        fix_children(indi);
 
178
        /* fix cache pointers of entire node tree */
 
179
        fix_cel(indi);
 
180
        /* validate entire node tree (if nodechecking on) */
 
181
        nodechk(indi, "join_indi");
167
182
}
168
183
/*=======================================
169
184
 * split_fam -- Split a family into parts
279
294
                else
280
295
                        nchild(fam) = chil;
281
296
        }
 
297
        /* fix parenthood of all children of fam */
 
298
        fix_children(fam);
 
299
        /* fix cache pointers of entire node tree */
 
300
        fix_cel(fam);
 
301
        /* validate entire node tree (if nodechecking on) */
 
302
        nodechk(fam, "join_fam");
282
303
}
283
304
/*=======================================
284
305
 * split_othr -- Split a misc node tree into parts
346
367
                        node = nsibling(node);
347
368
        }
348
369
}
 
370
/*==================================================
 
371
 * normalize_rec -- ensure nodes are in lifelines order
 
372
 * for any record
 
373
 *================================================*/
 
374
void
 
375
normalize_rec (RECORD irec)
 
376
{
 
377
        NODE root = nztop(irec);
 
378
        if (!root) return;
 
379
        if (eqstr(ntag(root), "INDI"))
 
380
                normalize_indi(root);
 
381
        else if (eqstr(ntag(root), "FAM"))
 
382
                normalize_fam(root);
 
383
}
 
384
/*==================================================
 
385
 * normalize_irec -- ensure nodes are in lifelines order
 
386
 * for individual record
 
387
 *================================================*/
 
388
void
 
389
normalize_irec (RECORD irec)
 
390
{
 
391
        NODE indi=nztop(irec);
 
392
        if (indi)
 
393
                normalize_indi(indi);
 
394
}
 
395
/*==================================================
 
396
 * normalize_indi -- ensure nodes are in lifelines order
 
397
 * for individual root node
 
398
 *================================================*/
 
399
void
 
400
normalize_indi (NODE indi)
 
401
{
 
402
        NODE name, refn, sex, body, famc, fams;
 
403
        
 
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);
 
407
}
 
408
/*==================================================
 
409
 * normalize_fam -- ensure nodes are in lifelines order
 
410
 *================================================*/
 
411
void
 
412
normalize_fam (NODE fam)
 
413
{
 
414
        NODE fref, husb, wife, chil, rest;
 
415
 
 
416
        split_fam(fam, &fref, &husb, &wife, &chil, &rest);
 
417
        ASSERT(eqstr(ntag(fam), "FAM"));
 
418
        join_fam(fam, fref, husb, wife, chil, rest);
 
419
}
 
420
/*=======================================
 
421
 * fix_children -- Set parent pointers of all immediate children
 
422
 *=====================================*/
 
423
static void
 
424
fix_children (NODE root)
 
425
{
 
426
        NODE node=0;
 
427
        for (node = nchild(root); node; node = nsibling(node)) {
 
428
                nparent(node) = root;
 
429
        }
 
430
}
 
431
/*=======================================
 
432
 * fix_cel -- Set cel of all descendants to agree with root
 
433
 *=====================================*/
 
434
static void
 
435
fix_cel (NODE root)
 
436
{
 
437
        set_all_nodetree_to_root_cel(root);
 
438
}