Person Set Functions and GEDCOM Extraction

VOID indiset(SET_V);

declare a set variable

SET addtoset(SET, INDI, ANY);

add a person to a set

SET deletefromset(SET, INDI, BOOL);

remove a person from a set

INT lengthset(SET);

size of a set

SET union(SET, SET);

union of two sets

SET intersect(SET, SET);

intersection of two sets

SET difference(SET, SET);

difference of two sets

SET parentset(SET);

set of all parents

SET childset(SET);

set of all children

SET spouseset(SET);

set of all spouses

SET siblingset(SET);

set of all siblings

SET ancestorset(SET);

set of all ancestors

SET descendentset(SET);

set of all descendents

SET descendantset(SET);

same as descendentset; spelling

SET uniqueset(SET);

remove duplicates from set

VOID namesort(SET);

sort indiset by name

VOID keysort(SET);

sort indiset by key values

VOID valuesort(SET);

sort indiset by auxiliary values

VOID genindiset(STRING, SET);

generate indiset from GEDCOM name string

VOID gengedcom(SET);

generate GEDCOM file from person set

forindiset (SET, INDI_V, ANY_V, INT_V) { commands }

loop through all persons in person set

These functions allow you to manipulate person sets. A person set is a potentially large set of persons; each person may have an arbitrary value associated with him/her. A person set must be declared with the indiset function before it can be used.

Addtoset adds a person to a set. The first argument is the set; the second argument is the person; and the third argument may be any value. The same person may be added to a set more than once, each time with a different value. Deletefromset removes a person from a set. The first argument is the set; the second argument is the person; if the third parameter is true all of the person’s entries are removed from the set; if false only the first entry is removed. Lengthset returns the number of persons in a person set.

Union, intersect and difference return the set union, set intersection and set difference, respectively, of two person sets. Each functions takes two person sets as arguments and returns a third person set. The functions do not affect the values of their two argument sets.

Parentset, childset, spouseset and siblingset return the set of all parents, set of all children, set of all spouses and set of all siblings, respectively, of the set of persons in their argument. In all cases there is no change to the argument person set.

Ancestorset returns the set all ancestors of all persons in the argument set. Descendentset returns the set of all descendents of all persons in the argument set. Descendantset is the same as descendentset; it allows an alternate spelling.

Uniqueset sorts a person set by key value and then removes all entries with duplicate keys; the input set is modified and returned.

Namesort, keysort and valuesort sort a set of persons by name, by key and by associated value, respectively.

Each person in a person set has an associated value. When a person is added to a set with addtoset, the value is explicitly assigned. When new sets are created by other functions, a number of rules are used to associate values with persons as they are added to the new sets. For parentset, childset and spouseset the values are copied from the first input set person that causes the new person to be added to the set. For union, intersect and difference, the values are copied from the values in the first input set, except in the case of union, when persons are taken from the second set alone, in which case the values come from there. For ancestorset and descendantset the value is set to the number of generations the new person is away from the first person in the input set that the new person is related to. If the new person is related to more than one person in the input set, the value is set for the nearest relationship; that is, the value is as low as possible. Valuesort sorts a person set by the values of these auxiliary values.

Genindiset generates the set of persons that matche a string whose value is a name in GEDCOM format. Genindiset uses the same algorithm that matches names entered at the browse prompt or by the user interaction getindiset function.

Gengedcom generates GEDCOM format output, to the report output file, of all persons in the argument person set. The output contains a person record for each person in the set, and all the family records that link at least two of the persons in the set together.

Forindiset is an iterator that loops through each person in an indiset. The first parameter is an indiset. The second parameter is a variable that iterates through each person in the set. The third parameter iterates through the values associated with the persons. The fourth parameter is an integer variable that counts the iterations.