Debian Codegraph @

reports/cid.ll

raw
1 /*
2 * @progname cid.ll
3 * @version 1.0
4 * @author Wetmore, Chandler
5 * @category
6 * @output Text
7 * @description
8
9 Generates Pete Cook's CID (Chronological Identifier) for a person
10 in a LifeLines database.
11
12 The program first computes the C-Vector, a
13 seven element array of the birth years of a person and his/her parents
14 and grandparents in ahnentafel order. The program then subtracts the
15 base person's birth year from those of the others. Those differences
16 are converted to the follow letters:
17
18 Char Parent Age Grandparent Age
19 0 0-15 0-30
20 1-9 16-24 31-39
21 A-Z 25-50 40-65
22 a-y 51-75 66-90
23 z over 75 over 90
24 - unknown unknown
25
26 Version 1, 15 Mar 1995, Tom Wetmore, modified by J.F.Chandler
27 */
28
29 proc main ()
30 {
31 getindi(i, "Compute CID for what person?")
32 if (eq(0, i)) { return() }
33 set(b, getyear(birth(i)))
34 if (lt(b, 1000)) {
35 print("Base person has no birth year")
36 return()
37 }
38 set(f, father(i))
39 set(m, mother(i))
40 set(ff, father(f))
41 set(fm, mother(f))
42 set(mf, father(m))
43 set(mm, mother(m))
44
45 set(bf, getyear(birth(f)))
46 set(bm, getyear(birth(m)))
47 set(bff, getyear(birth(ff)))
48 set(bfm, getyear(birth(fm)))
49 set(bmf, getyear(birth(mf)))
50 set(bmm, getyear(birth(mm)))
51
52 set(bf, sub(sub(b, bf), 15))
53 set(bm, sub(sub(b, bm), 15))
54 set(bff, sub(sub(b, bff), 30))
55 set(bfm, sub(sub(b, bfm), 30))
56 set(bmf, sub(sub(b, bmf), 30))
57 set(bmm, sub(sub(b, bmm), 30))
58
59 print("The CID for ", name(i), " is: ", d(b), letter(bf),
60 letter(bm), letter(bff), letter(bfm), letter(bmf),
61 letter(bmm), "\n")
62 }
63
64 func getyear(event)
65 {
66 set(mod, trim(date(event),3))
67 if (and( strcmp(mod,"BEF"),
68 strcmp(mod,"AFT"),
69 strcmp(mod,"ABT") )) { return(atoi(year(event))) }
70 return(0)
71 }
72
73 func letter (yr)
74 {
75 if (gt(yr, 500)) { return("-") }
76 if (lt(yr, 0)) { return("0") }
77 if (le(yr, 9)) { return(d(yr)) }
78 if (eq(yr, 10)) { return("A") }
79 if (eq(yr, 11)) { return("B") }
80 if (eq(yr, 12)) { return("C") }
81 if (eq(yr, 13)) { return("D") }
82 if (eq(yr, 14)) { return("E") }
83 if (eq(yr, 15)) { return("F") }
84 if (eq(yr, 16)) { return("G") }
85 if (eq(yr, 17)) { return("H") }
86 if (eq(yr, 18)) { return("I") }
87 if (eq(yr, 19)) { return("J") }
88 if (eq(yr, 20)) { return("K") }
89 if (eq(yr, 21)) { return("L") }
90 if (eq(yr, 22)) { return("M") }
91 if (eq(yr, 23)) { return("N") }
92 if (eq(yr, 24)) { return("O") }
93 if (eq(yr, 25)) { return("P") }
94 if (eq(yr, 26)) { return("Q") }
95 if (eq(yr, 27)) { return("R") }
96 if (eq(yr, 28)) { return("S") }
97 if (eq(yr, 29)) { return("T") }
98 if (eq(yr, 30)) { return("U") }
99 if (eq(yr, 31)) { return("V") }
100 if (eq(yr, 32)) { return("W") }
101 if (eq(yr, 33)) { return("X") }
102 if (eq(yr, 34)) { return("Y") }
103 if (eq(yr, 35)) { return("Z") }
104 if (eq(yr, 36)) { return("a") }
105 if (eq(yr, 37)) { return("b") }
106 if (eq(yr, 38)) { return("c") }
107 if (eq(yr, 39)) { return("d") }
108 if (eq(yr, 40)) { return("e") }
109 if (eq(yr, 41)) { return("f") }
110 if (eq(yr, 42)) { return("g") }
111 if (eq(yr, 43)) { return("h") }
112 if (eq(yr, 44)) { return("i") }
113 if (eq(yr, 45)) { return("j") }
114 if (eq(yr, 46)) { return("k") }
115 if (eq(yr, 47)) { return("l") }
116 if (eq(yr, 48)) { return("m") }
117 if (eq(yr, 49)) { return("n") }
118 if (eq(yr, 50)) { return("o") }
119 if (eq(yr, 51)) { return("p") }
120 if (eq(yr, 52)) { return("q") }
121 if (eq(yr, 53)) { return("r") }
122 if (eq(yr, 54)) { return("s") }
123 if (eq(yr, 55)) { return("t") }
124 if (eq(yr, 56)) { return("u") }
125 if (eq(yr, 57)) { return("v") }
126 if (eq(yr, 58)) { return("w") }
127 if (eq(yr, 59)) { return("x") }
128 if (eq(yr, 60)) { return("y") }
129 return("z")
130 }