| 1 |
/* |
| 2 |
* @progname gedlod.ll |
| 3 |
* @version 2000-02-15 |
| 4 |
* @author Paul B. McBride ([email protected]) |
| 5 |
* @category |
| 6 |
* @output GEDCOM |
| 7 |
* @description |
| 8 |
* |
| 9 |
* Generate a GEDCOM file of a person's descent from an ancestor. |
| 10 |
* The GEDCOM file will contain the following: |
| 11 |
* all descendents of the ancestor who are ancestors of descendant, |
| 12 |
* as well as the ancestor and descendant themselves. |
| 13 |
* |
| 14 |
* 15 Feb 2000 Paul B. McBride ([email protected]) |
| 15 |
*/ |
| 16 |
|
| 17 |
include("prompt.li") |
| 18 |
include("ged_write.li") |
| 19 |
|
| 20 |
proc main () |
| 21 |
{ |
| 22 |
indiset(iset) |
| 23 |
indiset(dset) |
| 24 |
indiset(tset) |
| 25 |
indiset(uset) |
| 26 |
indiset(aset) |
| 27 |
indiset(gset) |
| 28 |
|
| 29 |
getindimsg(descendant,"Identify the descendant") |
| 30 |
if(descendant) { |
| 31 |
set(i, 1) |
| 32 |
while(1) { |
| 33 |
getindimsg(ancestor, concat("Identify ", ord(i), " ancestor")) |
| 34 |
if(ancestor) { |
| 35 |
set(i, add(i,1)) |
| 36 |
addtoset(iset, ancestor, 0) |
| 37 |
} |
| 38 |
else { |
| 39 |
break() |
| 40 |
} |
| 41 |
} |
| 42 |
} |
| 43 |
if(and(gt(lengthset(iset), 0),ne(descendant,0))) { |
| 44 |
set(addspouses, askyn("Include spouses")) |
| 45 |
set(addchildren, askyn("Include children")) |
| 46 |
|
| 47 |
/* find all the people of interest */ |
| 48 |
print("Finding Ancestors... ") |
| 49 |
addtoset(dset, descendant, 0) |
| 50 |
set(tset, ancestorset(dset)) |
| 51 |
print(d(lengthset(tset)), nl()) |
| 52 |
|
| 53 |
print("Finding Descendants... ") |
| 54 |
set(uset, descendantset(iset)) |
| 55 |
print(d(lengthset(uset)), nl()) |
| 56 |
|
| 57 |
set(aset, intersect(tset, uset)) |
| 58 |
set(aset, union(aset, iset)) /* add in ancestors */ |
| 59 |
addtoset(aset, descendant, 0) /* add in descendant */ |
| 60 |
|
| 61 |
if(addspouses) { |
| 62 |
set(tset, spouseset(aset)) /* add their spouses */ |
| 63 |
set(aset, union(aset, tset)) |
| 64 |
} |
| 65 |
|
| 66 |
if(addchildren) { |
| 67 |
set(tset, childset(aset)) /* find everyone's children */ |
| 68 |
set(aset, union(aset, tset)) |
| 69 |
} |
| 70 |
call ged_write(aset) /* write out GEDCOM file */ |
| 71 |
} |
| 72 |
} |