4
* @author Paul B. McBride (pbmcbride@rcn.com)
9
* This LifeLines report program produces a GEDCOM file containing
10
* the entire LifeLines database, including header, trailer, and
11
* submitter records. It also gives the option to keep or remove user defined
12
* tags, and to remove any other tags.
14
* modified Sep 2005 to use getproperties to automatically generate the header
15
* by Stephen Dum dr.doom@verizon.net
17
* The default action is to remove all user defined tags. These are tags
18
* which begin with an underscore, "_", character.
20
* When a tag line is removed, lines following it with higher level
21
* numbers are also removed.
23
* This report program may require LifeLines 3.0.3 or later.
25
* The gedcom header is generated in main() using property's
26
* obtained from the lifelines config file (~/.linesrc on unix else
27
* lines.cfg - or from properties set in the database) with values from
28
* the user defined properties
33
* This report program was tested on databases created from the Test Book
34
* sample GEDCOM files at http://www.gentech.org
36
* 20 Feb 2000 Paul B. McBride (pbmcbride@rcn.com)
39
global(REMOVEUSERTAGS)
40
global(REMOVELISTEDTAGS)
41
global(REMOVETAG_LIST)
43
global(removed_line_count)
44
global(removed_udt_count)
48
list(REMOVETAG_LIST) /* list of tags to be removed */
49
set(REMOVELISTEDTAGS, 0) /* set to 1 if there are tags to be removed */
50
set(REMOVEUSERTAGS, askyn("Remove user defined tags (_*)"))
51
set(removed_udt_count, 0)
52
set(removed_line_count, 0)
55
getstrmsg(remtag, "Enter any other tag to be removed")
56
if(gt(strlen(remtag),0)) {
57
set(REMOVELISTEDTAGS, 1)
58
enqueue(REMOVETAG_LIST, remtag)
65
"1 SOUR LIFELINES" nl()
66
"2 VERS " version() nl()
67
"2 NAME LifeLines" nl()
75
"2 FORM Lineage-Linked" nl()
77
"1 DATE " stddate(gettoday()) nl()
78
/* and referenced submitter */
80
"1 NAME " getproperty("user.fullname") nl()
81
"1 ADDR " getproperty("user.address") nl()
82
"2 CONT E-mail: " getproperty("user.email") nl()
86
call ged_write_node(root(p))
87
set(icnt, add(icnt,1))
89
print(d(icnt), " INDI records (I*)...\n")
92
call ged_write_node(root(f))
93
set(fcnt, add(fcnt,1))
95
print(d(fcnt), " FAM records (F*)...\n")
98
call ged_write_node(root(e))
99
set(ecnt, add(ecnt,1))
101
print(d(ecnt), " EVEN records (E*)...\n")
104
call ged_write_node(root(s))
105
set(scnt, add(scnt,1))
107
print(d(scnt), " SOUR records (S*)...\n")
110
call ged_write_node(root(o))
111
set(ocnt, add(ocnt,1))
113
print(d(ocnt), " other level 0 records (X*)\n")
115
if(gt(removed_udt_count, 0)) {
116
print(d(removed_udt_count), " user defined tag structures were removed.\n")
118
if(gt(removed_line_count, 0)) {
119
print(d(removed_line_count), " lines were removed, as requested.\n")
122
"0 TRLR" nl() /* trailer */
125
proc ged_write_node(n)
127
set(remlevel, 10000) /* this value is larger than the largest level number */
128
traverse(n, m, level) {
129
if(le(level, remlevel)) {
130
set(remlevel, 10000) /* end of previous tag removal if any */
133
if(eqstr(trim(t, 1), "_")) {
134
set(remlevel, level) /* remove line, and subordinate tag lines */
135
set(removed_udt_count, add(removed_udt_count, 1))
140
if(lt(level, remlevel)) {
141
if(REMOVELISTEDTAGS) {
143
forlist(REMOVETAG_LIST, rt, n) {
152
if(lt(level, remlevel)) {
153
/* output this line to the GEDCOM file */
155
if (xref(m)) { " " xref(m) }
163
set(removed_line_count, add(removed_line_count, 1))
170
set(prompt, concat(msg, "? [y/n] "))
171
getstrmsg(str, prompt)
172
if(and(gt(strlen(str), 0),
173
or(eq(strcmp(str, "n"),0), eq(strcmp(str, "N"),0)))) {