/*  eol Version 2 - Originally by Tom Wetmore, modified by John Chandler

Say you want to know who all of your end-of-line ancestors are, that
is, your direct ancestors whose parents you have not yet discovered;
these are the people most of us spend most of our time on researching.
Here is a program that will produce the list.  Any ancestor will be
listed at most once, even in cases where lines cross.

*/

proc main () {
        table(seen)
        getindi(indi)
        monthformat(4)
        "END OF LINE ANCESTORS OF " fullname(indi,1,0,30) " (" key(indi) ")\n\n"
        list(ilist)
        enqueue(ilist, indi)
        while(indi, dequeue(ilist)) {
                set(show, 1)
                if (par, father(indi)) {
                        enqueue(ilist, par)
                        set(show, 0)
                }
                if (par, mother(indi)) {
                        enqueue(ilist, par)
                        set(show, 0)
                }
                if (show) {
                        set(par_key, key(indi))
                        if(not(lookup(seen,par_key))) {
                                insert(seen,par_key,1)
                                col(1) fullname(indi,1,0,30)
                                col(35) par_key
                                col(44) stddate(birth(indi))
                                col(60) stddate(death(indi)) nl()
                        }
                }

        }
}
