| 1 |
/* |
| 2 |
* @progname sealing_line.ll |
| 3 |
* @version none |
| 4 |
* @author Tom Wetmore |
| 5 |
* @category |
| 6 |
* @output function, and driver writing Text |
| 7 |
* @description |
| 8 |
|
| 9 |
function sealing_line(). |
| 10 |
You pass it a person, and it returns the person's |
| 11 |
sealing line (if there is one) or nothing (if there isn't). The main |
| 12 |
program is only used here to test it. You would call "sealing_line" in the |
| 13 |
place you need it in your own program. Yes, it is a little complicated, |
| 14 |
but that's why we have modules. Write it, stick it in some library |
| 15 |
somewhere, and just call it when you need the info. |
| 16 |
|
| 17 |
Tom Wetmore |
| 18 |
*/ |
| 19 |
|
| 20 |
proc main () |
| 21 |
{ |
| 22 |
getindi(i) |
| 23 |
if (not(i)) { return() } |
| 24 |
if (l, sealing_line(i)) { |
| 25 |
print("yes\n") |
| 26 |
print(tag(l), " ", value(l), "\n") |
| 27 |
} else { |
| 28 |
print("no") |
| 29 |
} |
| 30 |
} |
| 31 |
|
| 32 |
func sealing_line (i) |
| 33 |
{ |
| 34 |
set(f, parents(i)) |
| 35 |
if (not(f)) { return(0) } |
| 36 |
set(ir, inode(i)) set(fr, fnode(f)) |
| 37 |
fornodes(fr, s) { |
| 38 |
if(and(eqstr("CHIL", tag(s)), eqstr(xref(ir), value(s)))) { |
| 39 |
fornodes(s, ss) { |
| 40 |
if(eqstr("SLGC", tag(ss))) { return(ss) } |
| 41 |
} |
| 42 |
return(0) |
| 43 |
} |
| 44 |
} |
| 45 |
return (0) |
| 46 |
} |