| 1 |
/* |
| 2 |
* @progname igi-search.ll |
| 3 |
* @version 1.1 |
| 4 |
* @author Vincent Broman |
| 5 |
* @category |
| 6 |
* @output Text |
| 7 |
* @description |
| 8 |
* |
| 9 |
* prints out a list of people to look up in the IGI, |
| 10 |
* those who are closely enough related, who fall in a time range, |
| 11 |
* and whose temple work is not done. |
| 12 |
*/ |
| 13 |
|
| 14 |
include( "ldsgedcom.li") |
| 15 |
|
| 16 |
/* TODO: needs a sort and handling "OF" places */ |
| 17 |
|
| 18 |
/* |
| 19 |
* indvordsdone and marrordsdone test whether all the individual (Bap/End/Sch) |
| 20 |
* or marriage (Ssp) ordinances are recorded for this individual |
| 21 |
* in the database. |
| 22 |
*/ |
| 23 |
|
| 24 |
func indvordsdone( indi) { |
| 25 |
return( and( ldsbaptism( indi), |
| 26 |
ldsendowment( indi), |
| 27 |
or( ldschildsealing( indi), |
| 28 |
not( father( indi))))) |
| 29 |
} |
| 30 |
|
| 31 |
func marrordsdone( indi) { |
| 32 |
families( indi, f, sp, ctm) { |
| 33 |
if( not( ldsspousesealing( f))) { return( 0) } |
| 34 |
} |
| 35 |
return( 1) |
| 36 |
} |
| 37 |
|
| 38 |
/* return as a string the birth/christening year if known, else 0 */ |
| 39 |
func knownbirthyear( indi) { |
| 40 |
set( b, birth( indi)) |
| 41 |
if( not( b)) { set( b, baptism( indi)) } |
| 42 |
if( b) { |
| 43 |
return( save( year( b))) |
| 44 |
} |
| 45 |
return( 0) |
| 46 |
} |
| 47 |
|
| 48 |
global( thisyear) |
| 49 |
|
| 50 |
/* isdead tests whether this individual is known to be dead |
| 51 |
* or can be assumed dead by the rules for LDS temple work submission. |
| 52 |
*/ |
| 53 |
func isdead( indi) { |
| 54 |
if( death( indi)) { return( 1) } |
| 55 |
if( burial( indi)) { return( 1) } |
| 56 |
if( by, knownbirthyear( indi)) { |
| 57 |
return( le( strtoint( by), sub( thisyear, 110))) |
| 58 |
} |
| 59 |
families( indi, f, sp, ctd) { |
| 60 |
if( m, marriage( f)) { |
| 61 |
if( md, year( m)) { |
| 62 |
if( le( strtoint( md), sub( thisyear, 95))) { |
| 63 |
return( 1) |
| 64 |
} |
| 65 |
} |
| 66 |
} |
| 67 |
} |
| 68 |
return( 0) |
| 69 |
} |
| 70 |
|
| 71 |
/* return the set of people who are wide-sense ancestors |
| 72 |
* of the given individual, plus the children of these wide-sense ancestors, |
| 73 |
* where a wide-sense ancestor is either the given individual himself/herself |
| 74 |
* a parent or step-parent of a wide-sense ancestor. |
| 75 |
*/ |
| 76 |
func interestingforebearsof( indi) { |
| 77 |
indiset( res) |
| 78 |
addtoset( res, indi, key( indi)) |
| 79 |
|
| 80 |
set( pf, parents( indi)) |
| 81 |
if( not( pf)) { return( res) } |
| 82 |
|
| 83 |
if( h, husband( pf)) { |
| 84 |
set( res, union( res, interestingforebearsof( h))) |
| 85 |
families( h, f, sp, ctf) { |
| 86 |
if( sp) { |
| 87 |
set( res, union( res, interestingforebearsof( sp))) |
| 88 |
} |
| 89 |
children( f, ch, ctc) { |
| 90 |
addtoset( res, ch, key( ch)) |
| 91 |
} |
| 92 |
} |
| 93 |
set( hk, key( h)) |
| 94 |
} else { |
| 95 |
set( hk, "") |
| 96 |
} |
| 97 |
if( w, wife( pf)) { |
| 98 |
families( w, f, sp, cth) { |
| 99 |
/* add only husbands not the father */ |
| 100 |
if( and( sp, nestr( hk, key( sp)))) { |
| 101 |
set( res, union( res, interestingforebearsof( sp))) |
| 102 |
} else { |
| 103 |
children( f, ch, ctcc) { |
| 104 |
addtoset( res, ch, key( ch)) |
| 105 |
} |
| 106 |
} |
| 107 |
} |
| 108 |
} |
| 109 |
return( res) |
| 110 |
} |
| 111 |
|
| 112 |
proc igiord( e) { |
| 113 |
if( e) { |
| 114 |
if( v, value( e)) { |
| 115 |
v |
| 116 |
} else { |
| 117 |
if( ed, date( e)) { |
| 118 |
ed |
| 119 |
} else { |
| 120 |
" " |
| 121 |
} |
| 122 |
" " |
| 123 |
if( et, ldstemple( e)) { |
| 124 |
et |
| 125 |
} else { |
| 126 |
" " |
| 127 |
} |
| 128 |
|
| 129 |
} |
| 130 |
} |
| 131 |
} |
| 132 |
|
| 133 |
proc printigientry( indi) { |
| 134 |
if( n, name( indi)) { |
| 135 |
n " " |
| 136 |
} else { |
| 137 |
"<nameless> " |
| 138 |
} |
| 139 |
"(" |
| 140 |
if( fa, father( indi)) { |
| 141 |
if( fn, name( fa)) { |
| 142 |
fn |
| 143 |
} |
| 144 |
} |
| 145 |
"/" |
| 146 |
if( mo, mother( indi)) { |
| 147 |
if( mn, name( mo)) { |
| 148 |
mn |
| 149 |
} |
| 150 |
} |
| 151 |
") " nl() |
| 152 |
if( b, birth( indi)) { |
| 153 |
sex( indi) |
| 154 |
"B " long( b) |
| 155 |
if( c, baptism( indi)) { |
| 156 |
" and " |
| 157 |
sex( indi) |
| 158 |
"C " long( c) |
| 159 |
} |
| 160 |
} elsif( c, baptism( indi)) { |
| 161 |
sex( indi) |
| 162 |
"C " long( c) |
| 163 |
} else { |
| 164 |
sex( indi) |
| 165 |
" no B/C event " |
| 166 |
} |
| 167 |
nl() |
| 168 |
set( ba, ldsbaptism( indi)) |
| 169 |
set( en, ldsendowment( indi)) |
| 170 |
set( cs, ldschildsealing( indi)) |
| 171 |
if( or( ba, en, cs)) { |
| 172 |
call igiord( ba) |
| 173 |
"/" |
| 174 |
call igiord( en) |
| 175 |
"/" |
| 176 |
call igiord( cs) |
| 177 |
nl() |
| 178 |
} |
| 179 |
nl() |
| 180 |
} |
| 181 |
|
| 182 |
proc main() { |
| 183 |
set( thisyear, strtoint( year( gettoday()))) |
| 184 |
|
| 185 |
getindi( i, "Who's ancestors should be checked for IGI entries?") |
| 186 |
getint( fby, "First birth year of interest?") |
| 187 |
getint( lby, "Last birth year of interest?") |
| 188 |
forindiset( interestingforebearsof( i), ai, k, ctb) { |
| 189 |
if( by, knownbirthyear( ai)) { |
| 190 |
set( iby, strtoint( by)) |
| 191 |
if( and( isdead( ai), |
| 192 |
not( indvordsdone( ai)), |
| 193 |
le( fby, iby), |
| 194 |
le( iby, lby))) { |
| 195 |
by nl() |
| 196 |
call printigientry( ai) |
| 197 |
} |
| 198 |
} |
| 199 |
} |
| 200 |
} |