File: gedtags.ll

package info (click to toggle)
lifelines 3.0.50-2
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 11,140 kB
  • ctags: 6,517
  • sloc: ansic: 57,468; xml: 8,014; sh: 4,255; makefile: 848; yacc: 601; perl: 170; sed: 16
file content (81 lines) | stat: -rw-r--r-- 1,585 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
 * @progname       gedtags.ll
 * @version        2001-06-28
 * @author         Paul B.McBride (pbmcbride@rcn.com)
 * @category       
 * @output         Text
 * @description

    produces a unique list of all tags used in the database
    listed like the following:
    INDI
    INDI.BIRT
    INDI.BIRT.DATE
    INDI.BIRT.PLAC
    ...

    each line of the output will be unique.

    this can be useful in understanding the structure of the data in a GEDCOM
    file, or in checking for errors.

    sort the output file using an external sort program.

    Warning: for some versions of LifeLines probably prior to 3.0.3
    a save() should surround the values to be stored in tables and lists.

 * Paul B.McBride (pbmcbride@rcn.com) 28 June 2001
 */

global(tagnames)
global(taglevels)
global(content)

proc main ()
{
   list(tagnames)
   list(taglevels)
   table(content)

   forindi(pers,x) {
       call out(pers)
   }
   forfam(fm,x) {
       call out(fm)
   }
   foreven(evn, n) {
       call out(evn)
   }
   forsour(src, n) {
       call out(src)
   }
   forothr(oth, n) {
       call out(oth)
   }

   /* insert sorting code here if desired */

   forlist(tagnames,n,p) { n "\n" }
}

proc out(item)
{
   traverse(root(item),y,level) {

     setel(taglevels,add(level,1),tag(y))

     set(i,0)
     set(s,"")
     while(le(i,level)) {
       if(gt(i,0)) {
         set(s,concat(s,"."))
       }
       set(s,concat(s, getel(taglevels,add(i,1))))
       incr(i)
     }
     if(eq(lookup(content, s),0)) {
       enqueue(tagnames,s)
       insert(content,s,1)
     }
   }
}