| 1 |
/* |
| 2 |
* @progname gedtags.ll |
| 3 |
* @version 2001-06-28 |
| 4 |
* @author Paul B.McBride ([email protected]) |
| 5 |
* @category |
| 6 |
* @output Text |
| 7 |
* @description |
| 8 |
|
| 9 |
produces a unique list of all tags used in the database |
| 10 |
listed like the following: |
| 11 |
INDI |
| 12 |
INDI.BIRT |
| 13 |
INDI.BIRT.DATE |
| 14 |
INDI.BIRT.PLAC |
| 15 |
... |
| 16 |
|
| 17 |
each line of the output will be unique. |
| 18 |
|
| 19 |
this can be useful in understanding the structure of the data in a GEDCOM |
| 20 |
file, or in checking for errors. |
| 21 |
|
| 22 |
sort the output file using an external sort program. |
| 23 |
|
| 24 |
Warning: for some versions of LifeLines probably prior to 3.0.3 |
| 25 |
a save() should surround the values to be stored in tables and lists. |
| 26 |
|
| 27 |
* Paul B.McBride ([email protected]) 28 June 2001 |
| 28 |
*/ |
| 29 |
|
| 30 |
global(tagnames) |
| 31 |
global(taglevels) |
| 32 |
global(content) |
| 33 |
|
| 34 |
proc main () |
| 35 |
{ |
| 36 |
list(tagnames) |
| 37 |
list(taglevels) |
| 38 |
table(content) |
| 39 |
|
| 40 |
forindi(pers,x) { |
| 41 |
call out(pers) |
| 42 |
} |
| 43 |
forfam(fm,x) { |
| 44 |
call out(fm) |
| 45 |
} |
| 46 |
foreven(evn, n) { |
| 47 |
call out(evn) |
| 48 |
} |
| 49 |
forsour(src, n) { |
| 50 |
call out(src) |
| 51 |
} |
| 52 |
forothr(oth, n) { |
| 53 |
call out(oth) |
| 54 |
} |
| 55 |
|
| 56 |
/* insert sorting code here if desired */ |
| 57 |
|
| 58 |
forlist(tagnames,n,p) { n "\n" } |
| 59 |
} |
| 60 |
|
| 61 |
proc out(item) |
| 62 |
{ |
| 63 |
traverse(root(item),y,level) { |
| 64 |
|
| 65 |
setel(taglevels,add(level,1),tag(y)) |
| 66 |
|
| 67 |
set(i,0) |
| 68 |
set(s,"") |
| 69 |
while(le(i,level)) { |
| 70 |
if(gt(i,0)) { |
| 71 |
set(s,concat(s,".")) |
| 72 |
} |
| 73 |
set(s,concat(s, getel(taglevels,add(i,1)))) |
| 74 |
incr(i) |
| 75 |
} |
| 76 |
if(eq(lookup(content, s),0)) { |
| 77 |
enqueue(tagnames,s) |
| 78 |
insert(content,s,1) |
| 79 |
} |
| 80 |
} |
| 81 |
} |