~ubuntu-branches/ubuntu/trusty/lifelines/trusty

« back to all changes in this revision

Viewing changes to reports/count_dup.ll

  • Committer: Bazaar Package Importer
  • Author(s): Felipe Augusto van de Wiel (faw)
  • Date: 2007-05-23 23:49:53 UTC
  • mfrom: (3.1.3 edgy)
  • Revision ID: james.westby@ubuntu.com-20070523234953-ogno9rnbmth61i7p
Tags: 3.0.50-2etch1
* Changing docs/ll-reportmanual.xml and docs/ll-userguide.xml to fix
  documentation build problems (Closes: #418347).

* lifelines-reports
  - Adding a dependency to lifelines >= 3.0.50 to prevent file conflict.
    (Closes: #405500).

* Updating French translation. Thanks to Bernard Adrian. (Closes: #356671).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * @progname    count_dup.ll
 
3
 * @version     1.0
 
4
 * @author      anon
 
5
 * @category
 
6
 * @output      Text
 
7
 * @description
 
8
 *              Count dups among ancestors?
 
9
 */
 
10
 
 
11
global(cnttab)
 
12
global(indtab)
 
13
global(undone)
 
14
global(allind)
 
15
global(maxcount)
 
16
global(maxindi)
 
17
 
 
18
proc main() {
 
19
 
 
20
    list(undone)
 
21
    list(allind)
 
22
    table(cnttab)
 
23
    table(indtab)
 
24
 
 
25
    getindi(person)
 
26
    set(maxcount,0)
 
27
    set(maxindi,person)
 
28
    call addaperson(person)
 
29
    set(c,0)
 
30
 
 
31
    while (person,dequeue(undone)) {
 
32
        incr(c)
 
33
        /* print(d(c)," ",key(person),"\n") */
 
34
        if(eq(mod(c,1000), 0)) {
 
35
         print(d(c)," ",d(maxcount)," ",key(maxindi)," ",name(maxindi),"\n")
 
36
        }
 
37
        if (p,father(person)) { call addaperson(p) }
 
38
        if (p,mother(person)) { call addaperson(p) }
 
39
    }
 
40
 
 
41
    while(p,dequeue(allind)) {
 
42
        set(count,lookup(cnttab,key(p)))
 
43
        d(count) " " key(p) " " name(p) " " title(p) "\n"
 
44
    }
 
45
}
 
46
 
 
47
proc addaperson(p)
 
48
{
 
49
        enqueue(undone,p)
 
50
        set(count,lookup(cnttab,key(p)))
 
51
        if(ne(count,0)) {
 
52
          set(count, add(count,1))
 
53
          if(gt(count, maxcount)) {
 
54
                set(maxcount, count)
 
55
                set(maxindi, p)
 
56
          }
 
57
        } else    {
 
58
          set(count,1)
 
59
          insert(indtab, key(p), p)
 
60
          enqueue(allind,p)
 
61
        }
 
62
        insert(cnttab, key(p), count)
 
63
}