Debian Codegraph @

reports/ldsgedcom.li

raw
1 /*
2 * @progname ldsgedcom.li
3 * @version 1.2 of 2004-07-03
4 * @author Vincent Broman ([email protected])
5 * @category
6 * @output gedcom event and string function values
7 * @description
8 *
9 * Utility functions supporting LDS aspects of GeDCom data
10 * ldstemple( event) -> string,
11 * ldsspousesealing( fam) -> event,
12 * ldsbaptism( indi) -> event,
13 * ldsendowment( indi) -> event,
14 * ldschildsealing( indi) -> event
15 *
16 * I put equivalent functions in my C source, but this can be used everywhere.
17 */
18
19 func ldstemple( ev) {
20 fornodes( ev, childnode) {
21 if( eqstr( tag( childnode), "TEMP")) {
22 return( save( value( childnode)))
23 }
24 }
25 return( 0)
26 }
27
28 func ldsspousesealing( fam) {
29 fornodes( root( fam), childnode) {
30 if( eqstr( tag( childnode), "SLGS")) {
31 return( childnode)
32 }
33 }
34 return( 0)
35 }
36
37 func ldsbaptism( indi) {
38 fornodes( root( indi), childnode) {
39 if( eqstr( tag( childnode), "BAPL")) {
40 return( childnode)
41 }
42 }
43 return( 0)
44 }
45
46 func ldsendowment( indi) {
47 fornodes( root( indi), childnode) {
48 if( eqstr( tag( childnode), "ENDL")) {
49 return( childnode)
50 }
51 }
52 return( 0)
53 }
54
55 /*
56 * ldschildsealing(i) returns a SLGC sealing of child EVENT for the INDI indi
57 * or if no such event is found zero is returned.
58 * if the person is a child sealed in more than one family,
59 * only the first find is returned.
60 * This searches first the INDI-SLGC or INDI-FAMC-SLGC syntax, then the old FAM-CHIL-SLGC one.
61 */
62
63 func ldschildsealing( indi) {
64 fornodes( root( indi), childnode) {
65 if( eqstr( tag( childnode), "FAMC")) {
66 fornodes( childnode, sealnode) {
67 if( eqstr( tag( sealnode), "SLGC")) {
68 return( sealnode)
69 }
70 }
71 } else if( eqstr( tag( childnode), "SLGC")) {
72 return( childnode)
73 }
74 }
75 set( k, save( concat( "@", key( indi), "@")))
76 if( p, parents( indi)) {
77 /* children( p, ch, i) */
78 fornodes( root( p), childnode) {
79 if( and( eqstr( tag( childnode), "CHIL"),
80 eqstr( value( childnode), k))) {
81 fornodes( childnode, sealnode) {
82 if( eqstr( tag( sealnode), "SLGC")) {
83 return( sealnode)
84 }
85 }
86 }
87 }
88 }
89 return( 0)
90 }
91
92 /* for testing
93 proc printordinance( ord) {
94 if( ord) {
95 tag( ord) ": "
96 if( val, value( ord)) {
97 val
98 } else {
99 set( ordd, save( date( ord)))
100 ordd
101 if( ordt, ldstemple( ord)) {
102 if( ordd) { ", " }
103 ordt
104 }
105 }
106 nl()
107 }
108 }
109
110 proc main() {
111 "All individual ordinances" nl() nl()
112 forindi( i, c) {
113 "#" d( c) ": " name( i)
114 if( b, birth( i)) { " b. " long( b) }
115 nl()
116 call printordinance( ldsbaptism( i))
117 call printordinance( ldsendowment( i))
118 call printordinance( ldschildsealing( i))
119 }
120 }
121 */