Lifelines Emulation in GEDitCOM II

Lifelines is a menu-based, Unix tool written by Tom Wetmore in the 1990's for genealogy research. Two of its powerful features are its excellent support for GEDCOM files and it's ability to be controlled by "Lifelines programs" to report on the genealogy data. Two of its drawbacks are that does not run in a modern graphical user interface and is not actively being developed (see here for development status).

Like Lifelines, GEDitCOM II also has excellent support for GEDCOM files and it can be scripted for custom genealogy reports. One scripting option for GEDitCOM II is to use the python programming language, which opens up the python universe when working with genealogy data. One powerful option of the python language is the use of modules. You can write modules of methods to use in many scripts or download many available modules to add new features to your scripts. We recently noticed that a python module for GEDitCOM II scripting can turn GEDitCOM II into a platform that can emulate the Lifelines programming language. In brief, you can start with an existing Lifelines program, do a short list of conversions, and then run that same program in a python script for GEDitCOM II. This tutorial explains how to get started running Lifelines programs in GEDitCOM II. Most of the details are in the provided download. The getting-started topics are:

Install Lifelines Emulation for GEDitCOM II

The tools for Lifelines emulations are not part of the standard GEDitCOM II installation, but they are easy to download and install:

  1. Download (by clicking here) the Lifelines Emulation Package.
  2. Expand the downloaded zip file (if it does not expand automatically)
  3. Copy the entire "Lifelines" folder to the ~/Library/Application Support/GEDitCOM II/Scripts folder in your home directory.
  4. Copy the file in that folder to the ~/Library/Application Support/GEDitCOM II/Modules folder in your home directory (if that folder is not already there, create it and then add the file).
  5. Start GEDitCOM II (or if it is already running, choose "Refresh Extensions" in the Extensions menu).

The Lifelines emulation is now installed. To verify it is working, try this sample Lifelines emulation program:

  1. Open a genealogy file in GEDitCOM II and select any individual with ancestors.
  2. Choose Extensions menu command Lifelines→Emulations→ahnentafel

After a few seconds, you should see emulation output in a standard GEDitCOM II report window. The output will have an Ahnentafel report for the selected individual. See the next section for the next steps.

Getting Started

To get starting converting Lifelines programs to GEDitCOM II emulations, see the Documentation folder in the Lifelines folder. The "quickref.pdf" file is the Lifelines reference manual (included here for convenience) from the Lifelines system. The "Emulation Documentation.html" file has the additional information you need for working with the Lifelines emulation module.

Also included in the Lifelines folder are two folders called "Reports Converted" and "Reports Unconverted." These two folders contain all the original Lifelines programs provided with the standard Lifelines installation. The "Reports Converted" folder has the original Lifelines programs that have already been converted to GEDitCOM II emulations. The emulation version for each of these programs can be found in the "Emulations" folder. The emulations have the same name as the original program but the extension is changed from .ll to .py. The "Reports Unconverted" folders contains the remaining, standard Lifelines programs that have not yet been converted.

Finally, the "GEDitCOM II Native" folder contains selected Lifelines programs that have been convert to native GEDitCOM II scripts. Unlike the emulation scripts, the native scripts use standard GEDitCOM II methods. Because they are not emulations, they should run faster. They also make use of more advanced formatting methods (such as html tables) when producing the output. These versions have the same name as the emulation version except _gc is inserted at the end (before the extension).

Sample Lifelines Program Conversion

The following Lifelines program creates a simple Ahnentafel list of the selected individuals ancestors. This sample program is used the the Lifelines reference manual (see the "quickref.pdf" document) to introduce its programming language.

proc main ()
    enqueue(ilist, indi)
    enqueue(alist, 1)
    while(indi, dequeue(ilist)) {
        set(ahnen, dequeue(alist))
        d(ahnen) ". " name(indi) nl()
        if (e, birth(indi)) { "	b. " long(e) nl() }
        if (e, death(indi)) { "	d. " long(e) nl() }
        if (par, father(indi)) {
            enqueue(ilist, par)
            enqueue(alist, mul(2,ahnen))
        if (par,mother(indi)) {
            enqueue(ilist, par)
            enqueue(alist, add(1,mul(2,ahnen)))

This program will not be explained here, please refer to the "quickref.pdf" document for that information. Instead, this tutorial simply shows the Lifelines emulation version with some brief comments. Here is a script that runs in GEDitCOM II to emulate this sample program:

from lifelines import *
from operator import add,mul
gdoc = ll_init("quickref example program")
# main() method
indi = getindi()
ilist = list()
alist = list()
enqueue(ilist, indi)
enqueue(alist, 1) 
while length(ilist) :
    indi = dequeue(ilist)
    ahnen = dequeue(alist)
    out(d(ahnen)+". "+name(indi)+"\n")
    e = birth(indi)
    if e : out("    b. "+long(e)+"\n")
    e = death(indi)
    if e : out("    d. "+long(e)+"\n")
    par = father(indi)
    if par:
        enqueue(ilist, par)
        enqueue(alist, mul(2,ahnen))
    par = mother(indi)
    if par:
        enqueue(ilist, par)
        enqueue(alist, add(1,mul(2,ahnen)))

The first few lines load the modules needed for Lifelines emulation and then call ll_init() to initialize the emulation process. All emulation scripts will start with this preamble. The remaining lines are translations of the Lifelines program into a GEDitCOM II script. The needed changes were:

The above is simply one example. Please refer to the "Emulation Documentation.html" file in the downloaded emulation package for all the details on the conversion process. Also note that conversion of Lifelines programs does not have to be limited to translating the Lifelines commands. Because the emulations are python scripts, you can simultaneously make use of the entire python programming language to help the conversion or now to enhance its features. For example, you do not have to use the emulation methods for math expressions. A Lifelines program with add(1,mul(2,ahnen)) can be more naturally be converted to 2*ahnen+1. Furthermore, Lifelines is limited to integer math, but python can use integers, floating point numbers, and more. Besides different types of numbers, you can use any of the python built-in types or even create your own custom types by defining python classes.