File: fix_nameplac.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 (56 lines) | stat: -rw-r--r-- 1,270 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
/*
 * @progname       fix_nameplac.ll
 * @version        1
 * @author         Eggert
 * @category       
 * @output         GEDCOM
 * @description    

This is a quicky to show how to fix name and place spacing.


fix_nameplac - a LifeLines names and places fixing program
        by Jim Eggert (eggertj@atc.ll.mit.edu)
        Version 1,  8 January 1993


*/

proc fixit(root) {
    list(components)
    traverse(root,node,level) {
        set(t,save(tag(node)))
        d(level) " " t " "
        if (not(strcmp(t,"PLAC"))) {
            extractplaces(node,components,nplaces)
            forlist(components,place,plnum) {
                if (gt(plnum,1)) { ", " }
                place
            }
        }
        elsif (not(strcmp(t,"NAME"))) {
            extractnames(node,components,nnames,nsurname)
            forlist(components,name,nnum) {
                if (gt(nnum,1)) { " " }
                if (eq(nnum,nsurname)) { "/" }
                name
                if (eq(nnum,nsurname)) { "/" }
            }
        }
        else {
            value(node)
        }
        "\n"
    }
}


proc main() {
    forindi(person,pnum) {
        call fixit(inode(person))
    }
    forfam(family,fnum) {
        call fixit(fnode(family))
    }
    "0 TRLR\n"
}