File: sealing_line.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 (46 lines) | stat: -rw-r--r-- 1,312 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
/*
 * @progname       sealing_line.ll
 * @version        none
 * @author         Tom Wetmore
 * @category       
 * @output         function, and driver writing Text
 * @description

function sealing_line().
You pass it a person, and it returns the person's
sealing line (if there is one) or nothing (if there isn't).  The main
program is only used here to test it.  You would call "sealing_line" in the
place you need it in your own program.  Yes, it is a little complicated,
but that's why we have modules.  Write it, stick it in some library
somewhere, and just call it when you need the info.

Tom Wetmore
 */

proc main ()
{
        getindi(i)
        if (not(i)) { return() }
        if (l, sealing_line(i)) {
                print("yes\n")
                print(tag(l), " ", value(l), "\n")
        } else {
                print("no")
        }
}

func sealing_line (i)
{
        set(f, parents(i))
        if (not(f)) { return(0) }
        set(ir, inode(i)) set(fr, fnode(f))
        fornodes(fr, s) {
                if(and(eqstr("CHIL", tag(s)), eqstr(xref(ir), value(s)))) {
                        fornodes(s, ss) {
                                if(eqstr("SLGC", tag(ss))) { return(ss) }
                        }
                        return(0)
                }
        }
        return (0)
}