File: gedlod.ll

package info (click to toggle)
lifelines 3.0.50-2
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 11,140 kB
  • ctags: 6,517
  • sloc: ansic: 57,468; xml: 8,014; sh: 4,255; makefile: 848; yacc: 601; perl: 170; sed: 16
file content (72 lines) | stat: -rw-r--r-- 1,892 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
 * @progname       gedlod.ll
 * @version        2000-02-15
 * @author         Paul B. McBride (pbmcbride@rcn.com)
 * @category       
 * @output         GEDCOM
 * @description
 *
 * Generate a GEDCOM file of a person's descent from an ancestor.
 * The GEDCOM file will contain the following:
 * all descendents of the ancestor who are ancestors of descendant, 
 * as well as the ancestor and descendant themselves.
 *
 * 15 Feb 2000 Paul B. McBride (pbmcbride@rcn.com)
 */

include("prompt.li")
include("ged_write.li")

proc main ()
{
      indiset(iset)
      indiset(dset)
      indiset(tset)
      indiset(uset)
      indiset(aset)
      indiset(gset)

      getindimsg(descendant,"Identify the descendant")
      if(descendant) {
        set(i, 1)
        while(1) {
          getindimsg(ancestor, concat("Identify ", ord(i), " ancestor"))
          if(ancestor) {
	    set(i, add(i,1))
	    addtoset(iset, ancestor, 0)
      	  }
	  else {
	    break()
	  }
        }
      }
      if(and(gt(lengthset(iset), 0),ne(descendant,0))) {
      	  set(addspouses, askyn("Include spouses"))
      	  set(addchildren, askyn("Include children"))

	  /* find all the people of interest */
	  print("Finding Ancestors... ")
	  addtoset(dset, descendant, 0)
	  set(tset, ancestorset(dset))
	  print(d(lengthset(tset)), nl())

	  print("Finding Descendants... ")
	  set(uset, descendantset(iset))
	  print(d(lengthset(uset)), nl())

	  set(aset, intersect(tset, uset))
	  set(aset, union(aset, iset))	/* add in ancestors */
	  addtoset(aset, descendant, 0)	/* add in descendant */

	  if(addspouses) {
	    set(tset, spouseset(aset))	/* add their spouses */
            set(aset, union(aset, tset))
	  }

	  if(addchildren) {
	    set(tset, childset(aset))	/* find everyone's children */
            set(aset, union(aset, tset))
	  }
	  call ged_write(aset)		/* write out GEDCOM file */
      }
}