File gedcom.icn |
########################################################################### File: gedcom.icn Subject: Procedures for reading GEDCOM files Author: Gregg M. Townsend Date: June 23, 2000 ########################################################################### This file is in the public domain. ########################################################################### These procedures read and interpret GEDCOM files, a standard format for genealogy databases. ########################################################################### gedload(f) loads GEDCOM data from file f and returns a gedcom record containing the following fields: tree root of tree of gednode records id table of labeled nodes, indexed by @ID@ fam list of FAM nodes (marriages) ind list of INDI nodes (individuals) The tree is composed of gednode records R containing these fields: level level id ID (label), including @...@ delimiters tag tag data data lnum line number parent parent node in tree ref referenced node, if any sub sub-entry list hcode unique hashcode, if INDI node gedwalk(tree) generates the nodes of the tree in preorder. Three procedures find descendants of a node based on a sequence of identifying tag strings: gedsub(R, tag...) generates subnodes specified by tag sequence gedval(R, tag...) generates data values of those subnodes gedref(R, tag...) generates nodes referenced by those subnodes Three procedures extract a person's name from an INDI record: gedfnf(R) produces "John Quincy Adams" form gedlnf(R) produces "Adams, John Quincy" form gednmf(R,f) produces an arbitrary format, substituting prefix, firstname, lastname, suffix for "P", "F", "L", "S" (respectively) in f geddate(R) finds the DATE subnode of a node and returns a string of at least 12 characters in a standard form such as "11 Jul 1767" or "abt 1810". It is assumed that the input is in English. gedfind(g,s) generates the individuals under gedcom record g that are named by s, a string of whitespace-separated words. gedfind() generates each INDI node for which every word of s is matched by either a word of the individual's name or by the birth year. Matching is case-insensitive. ###########################################################################
This file is part of the (main) package.
Source code.Details |
Procedures: |
: get canonical date
: find individual by name
: get first name first
(internal procedure)
(internal procedure)
(internal procedure)
: get last name first
: load GEDCOM data from file f
(internal procedure)
: format name
: find referenced nodes
(internal procedure)
: find subrecords
: find subrecord values
: generate GEDCOM tree nodes in preorder
: get year
Records: |
tree | tree of data records
|
id | table of labeled nodes, indexed by @ID@
|
fam | list of FAM nodes
|
ind | list of INDI nodes
|
gednode(level, id, tag, data, lnum, parent, ref, sub, hcode)
level | level
|
id | ID (label), including @...@ delimiters
|
tag | tag
|
data | data
|
lnum | line number
|
parent | parent node in tree
|
ref | referenced node, if any
|
sub | sub-entry list
|
hcode | hashcode, if INDI node
|