| 1 |
/* |
| 2 |
* @progname simpleged.ll |
| 3 |
* @version 1.0 |
| 4 |
* @author Wetmore |
| 5 |
* @category |
| 6 |
* @output GEDCOM |
| 7 |
* @description |
| 8 |
|
| 9 |
This program generates a simple GEDCOM file from a database. It can |
| 10 |
be modified to convert your own LifeLines database formats to other |
| 11 |
GEDCOM formats. |
| 12 |
|
| 13 |
simpleged |
| 14 |
|
| 15 |
Written by Tom Wetmore, July 1993. |
| 16 |
*/ |
| 17 |
|
| 18 |
proc main () |
| 19 |
{ |
| 20 |
"0 HEAD \n" |
| 21 |
"1 SOUR LIFELINES\n" |
| 22 |
forindi(indi, num) { |
| 23 |
print("i") |
| 24 |
call outindi(indi) |
| 25 |
} |
| 26 |
forfam(fam, num) { |
| 27 |
print("f") |
| 28 |
call outfam(fam) |
| 29 |
} |
| 30 |
"0 TRLR \n" |
| 31 |
} |
| 32 |
|
| 33 |
proc outindi (indi) |
| 34 |
{ |
| 35 |
set(root, inode(indi)) |
| 36 |
set(noname, 1) |
| 37 |
set(nosex, 1) |
| 38 |
set(nobirt, 1) |
| 39 |
set(nobapt, 1) |
| 40 |
set(nodeat, 1) |
| 41 |
set(noburi, 1) |
| 42 |
"0 " xref(root) " " tag(root) nl() |
| 43 |
set(node, child(root)) |
| 44 |
while (node) { |
| 45 |
if (and(noname, not(strcmp("NAME", tag(node))))) { |
| 46 |
"1 NAME " value(node) nl() |
| 47 |
set(noname, 0) |
| 48 |
} elsif (and(nosex, not(strcmp("SEX", tag(node))))) { |
| 49 |
"1 SEX " value(node) nl() |
| 50 |
set(nosex, 0) |
| 51 |
} elsif (and(nobirt, not(strcmp("BIRT", tag(node))))) { |
| 52 |
call outevent(node) |
| 53 |
set(nobirt, 0) |
| 54 |
} elsif (and(nobapt, not(strcmp("CHR", tag(node))))) { |
| 55 |
call outevent(node) |
| 56 |
set(nobapt, 0) |
| 57 |
} elsif (and(nodeat, not(strcmp("DEAT", tag(node))))) { |
| 58 |
call outevent(node) |
| 59 |
set(nodeat, 0) |
| 60 |
} elsif (and(noburi, not(strcmp("BURI", tag(node))))) { |
| 61 |
call outevent(node) |
| 62 |
set(noburi, 0) |
| 63 |
} elsif (not(strcmp("FAMC", tag(node)))) { |
| 64 |
"1 FAMC " value(node) nl() |
| 65 |
} elsif (not(strcmp("FAMS", tag(node)))) { |
| 66 |
"1 FAMS " value(node) nl() |
| 67 |
} |
| 68 |
set(node, sibling(node)) |
| 69 |
} |
| 70 |
} |
| 71 |
|
| 72 |
proc outfam (fam) |
| 73 |
{ |
| 74 |
set(nomarr, 1) |
| 75 |
set(root, fnode(fam)) |
| 76 |
"0 " xref(root) " " tag(root) nl() |
| 77 |
set(node, child(root)) |
| 78 |
while (node) { |
| 79 |
if (not(strcmp("HUSB", tag(node)))) { |
| 80 |
"1 HUSB " value(node) nl() |
| 81 |
} elsif (not(strcmp("WIFE", tag(node)))) { |
| 82 |
"1 WIFE " value(node) nl() |
| 83 |
} elsif (not(strcmp("CHIL", tag(node)))) { |
| 84 |
"1 CHIL " value(node) nl() |
| 85 |
} elsif (and(nomarr, not(strcmp("MARR", tag(node))))) { |
| 86 |
call outevent(node) |
| 87 |
set(nomarr, 0) |
| 88 |
} |
| 89 |
set(node, sibling(node)) |
| 90 |
} |
| 91 |
} |
| 92 |
|
| 93 |
proc outevent (evt) |
| 94 |
{ |
| 95 |
set(nodate, 1) |
| 96 |
set(noplac, 1) |
| 97 |
set(nosour, 1) |
| 98 |
"1 " tag(evt) "\n" |
| 99 |
set(evt, child(evt)) |
| 100 |
while (evt) { |
| 101 |
if (and(nodate, not(strcmp("DATE", tag(evt))))) { |
| 102 |
"2 DATE " value(evt) nl() |
| 103 |
set(nodate, 0) |
| 104 |
} elsif (and(noplac, not(strcmp("PLAC", tag(evt))))) { |
| 105 |
"2 PLAC " value(evt) nl() |
| 106 |
set(noplac, 0) |
| 107 |
} elsif (and(nosour, not(strcmp("SOUR", tag(evt))))) { |
| 108 |
"2 SOUR " value(evt) nl() |
| 109 |
set(nosour, 0) |
| 110 |
} |
| 111 |
set(evt, sibling(evt)) |
| 112 |
} |
| 113 |
} |