File: index_html.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 (186 lines) | stat: -rw-r--r-- 4,306 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
/*
 * @progname       index_html.ll
 * @version        1.3
 * @author         Scott McGee (smcgee@microware.com)
 * @category       
 * @output         HTML
 * @description

This report program converts a LifeLines database into html index document.
You will need to change the contents of proc html_address() and to
set the value of HREF appropriately to your server.
You need to set the value of PATH to point to the directory to put
the file into.
You also need to set the value of HOST to be the http server and
path where you will server these files from.

@(#)index_html.ll	1.3 10/14/95
by Scott McGee (smcgee@microware.com)

*/

global(INDEX)
global(HREF)
global(PATH)
global(RVAL)
global(FB)
global(nl)
global(last_surname)
global(name_count)
global(surname_count)
global(owner_email)
global(db_owner)

proc main()
{
     set(db_owner, getproperty("user.fullname"))
     set(owner_email, getproperty("user.email"))
    set(FB, 0)
    set(nl, nl())
    set(last_surname, "ZZ")
    list(RVAL)
    indiset(INDEX)
    set(PATH, "/users/smcgee/www/")
    set(HOST, "http://www.emcee.com")
    set(HREF, concat(
                "http://www.emcee.com/~smcgee/cgi-bin/genweb_cgi/DB=",
                database(),
                "/INDEX="))
    print("processing database\n")
    set(count, 0)
    forindi(me,num)
    {
      if(eq(count, 100)){
        set(count, 0)
        print(".")
      }else{
        incr(count)
      }
      addtoset(INDEX,me,1)
    }
    print("\nwriting file\n")
    set(name_count, 0)
    set(surname_count, 0)
    call create_index_file()
    print("\n", d(name_count), " individuals, ", d(surname_count), " surnames\n")
}

proc create_index_file()
{
    namesort(INDEX)
    set(fn, save(concat(PATH, concat("genweb/", database(), "_idx.html"))))
    newfile(fn, FB)
    call html_header(0)
    "<BODY>" nl
    "<IMG SRC=\"http://www.emcee.com/~smcgee/pics/genweb.gif\" ALT = \"\"><BR><BR>\n"
    "<H1> INDEX </H1>" nl
    "<UL>" nl
    forindiset(INDEX, me, v, n)
    {
        call href(me) nl
    }
    "</UL>" nl
    call html_address()
    "</BODY>" nl
    "</HTML>" nl
}

proc href(me)
{
    if(me)
    {
        call print_name(me, 1)
        incr(name_count)
        if(ne(strcmp(surname(me), last_surname), 0)){
           incr(surname_count)
           print(surname(me))
           print("\n")
           set(last_surname, save(surname(me)))
           "<A NAME=" qt() last_surname qt() "></A>\n"
        }
        "<LI><A HREF=" qt() HREF key(me) "?LookupInternal" qt() ">\n"
        pop(RVAL)
        "</A> -"
        if (evt, birth(me)) {
          " born "
          short(evt)
        }
        else {
            if (evt, baptism(me)) {
                " baptised "
                short(evt)
            }
            else {
                if (evt, bapt(me)) {
                    " baptised "
                    short(evt)
                }
            }
        }
        if (evt, death(me)) {
          " died "
          short(evt)
        }
    }
}
proc html_header(isindex)
{
    "<HTML>" nl
    "<HEAD>" nl
    "<LINK rev=\"made\" HREF=\"mailto:" owner_email "\">"
    if(isindex) { "<ISINDEX>" nl }
    "<TITLE>Index of database - "
    database()
    "</TITLE>" nl
    "</HEAD>" nl
 }

proc html_address()
{
    "<HR>" nl
    "<ADDRESS>Last update : "
    date(gettoday())
    "<br>" db_owner "  //  " owner_email " </ADDRESS>" nl
}

proc print_name (me, last)
{
    call get_title(me)
    set(junk, pop(RVAL))
    push(RVAL, save(concat(fullname(me, 0, not(last), 45), junk)))
}

proc get_title (me)
{
    fornodes(inode(me), node)
    {
        if (not(strcmp("TITL", tag(node)))) { set(n, node) }
    }
    if (n) { push(RVAL, save(concat(" ", value(n)))) }
        else { push(RVAL, "") }
}

proc rjt(n, w)
{
    if (lt(n, 10)) { set(d, 1) }
    elsif (lt(n, 100)) { set(d, 2) }
    elsif (lt(n, 1000)) { set(d, 3) }
    elsif (lt(n, 10000)) { set(d, 4) }
    else  { set(d, 5) }
    if (lt(d, w))
        { set(pad, save( trim("      ", sub(w, d)))) }
    else
        { set(pad, "") }
    push(RVAL, save( concat(pad, save(d(n)))))
}
func bapt (indi) {
  fornodes(inode(indi), node) {
    if (eq(0, strcmp(tag(node), "BAPL"))) {
      return(node)
    }
    if (eq(0, strcmp(tag(node), "BAPM"))) {
      return(node)
    }
  }
  return(0)
}