File: wife.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 (91 lines) | stat: -rw-r--r-- 3,140 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
82
83
84
85
86
87
88
89
90
91
/*
 * @progname       wife.ll
 * @version        1995-02-10
 * @author         Kurt Baudendistel <baud@RESEARCH.ATT.COM>
 * @category       
 * @output         Text
 * @description

		A report to find wives.
 */

proc main () {
    getstrmsg (str, "Name [hit enter for help]")

    if (eq (strlen (str), 0)) {

        print ("Enter a name in the browser format ...\n")
        print ("- case insensitive.\n")
        print ("- given name(s) [/optional surname]\n")
        print ("\n")
        print ("... and this program will give a list of women who have this\n")
        print ("    as their married name on the screen here.\n")
        print ("\n")
        print ("The matching mechanism, however, is not that used by the\n")
        print ("browser, but simply uses the \"index\" function to create a\n")
        print ("match separately in the given name(s) and surname. While\n")
        print ("this makes partial matching easier, it does not allow for\n")
        print ("abbreviations of multiple given names.\n")
        print ("\n")

    } else {

        if (i, index (str, "/", 1)) {
                set (Givens, save (substring (str, 1, sub (i, 1))))
                set (givens, save (Givens))
            set (j, index (str, "/", 2))
            if (not (j)) {
                set (j, add (strlen (str), 1))
            }
                set (Surname, save (substring (str, add (i, 1), sub (j, 1))))
                set (surname, save (Surname))
        } else {
                set (Givens, save (str))
                set (givens, save (Givens))
                set (Surname, "")
                set (surname, "")
        }

        print ("Possible identities of ")
        print (Givens)
        if (strlen (Surname)) {
            print (" (")
            print (Surname)
            print (")")
        }
        print (":\n\n")

        forindi (indi, n) {
            families (indi, fam, spouse, m) {
                if (and (strlen (surname (indi)),
                     and (index (lower (surname (indi)), surname, 1),
                                  and (strlen (givens (spouse)),
                               index (lower (givens (spouse)), givens, 1))))) {
                if (not (male (spouse))) {
                    print (name (spouse))
                    print (" (")
                    print (key (spouse))
                    print (")")
                    if (date (birth (spouse))) {
                        print (" ")
                        print (date (birth (spouse)))
                    } elsif (date (baptism (spouse))) {
                        print (" ")
                        print (date (baptism (spouse)))
                    }
                    print (" -")
                    if (date (death (spouse))) {
                        print (" ")
                        print (date (death (spouse)))
                    } elsif (date (burial (spouse))) {
                        print (" ")
                        print (date (burial (spouse)))
                    }
                    print ("\n")
                    }
                }
            }
        }

    }
}