Debian Codegraph @

reports/count_anc.ll

raw
1 /*
2 * @progname count_anc.ll
3 * @version 2.0
4 * @author Eggert
5 * @category
6 * @output Text
7 * @description
8
9 This program counts ancestors of a person by generation.
10 Only unique individuals in each generation are counted.
11 A person counts in all the generations he/she is in,
12 but only counts once in the grand total.
13
14 count_anc - a LifeLines ancestors counting program
15 by Jim Eggert ([email protected])
16 Version 1, 19 November 1992
17 Version 2, 16 February 1995, use lengthset(), print(,)
18 */
19
20 proc main ()
21 {
22 getindimsg(person,"Enter person to count ancestors of")
23 indiset(thisgen)
24 indiset(allgen)
25 addtoset(thisgen, person, 0)
26 print("Counting generation ")
27 "Number of ancestors of " key(person) " " name(person)
28 " by generation:\n"
29 set(thisgensize,1)
30 set(gen,1)
31 while(thisgensize) {
32 set(thisgensize,0)
33 if (thisgensize,lengthset(thisgen)) {
34 set(gen,sub(gen,1))
35 print(d(gen)," ")
36 "Generation " d(gen) " has " d(thisgensize) " individual"
37 if (gt(thisgensize,1)) { "s" }
38 ".\n"
39 set(thisgen,parentset(thisgen))
40 set(allgen,union(allgen,thisgen))
41 }
42 }
43 "Total unique ancestors in generations " d(gen) " to -1 is "
44 d(lengthset(allgen)) ".\n"
45 }