From: Peter Verthez Date: Sat, 5 Jan 2002 14:05:11 +0000 (+0000) Subject: Parse and process cross-references. X-Git-Url: https://git.dlugolecki.net.pl/?a=commitdiff_plain;h=3068ed1f64a96d42cdde19cfebf1468ec9169e62;p=gedcom-parse.git Parse and process cross-references. --- diff --git a/doc/interface.html b/doc/interface.html index 057a31e..aab8221 100644 --- a/doc/interface.html +++ b/doc/interface.html @@ -2,2048 +2,2133 @@ Libgedcom interface details - + - +

Libgedcom interface details

-
- +
+

Index

- + -
- -
+
+ +

Record identifiers

- The following table describes the identifiers to be used in the record - callbacks.  The last column gives the - Gedcom_val type of the xref argument in the header - start callback.
+ The following table describes the identifiers to be used in the record + callbacks.  The last columns gives the + Gedcom_val type of the xref and val + arguments in the header start callback.
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Record
+
Meaning
+
Possible
+  xref types

+
Possible
+ val types
+

+
REC_HEAD
+
The header of the GEDCOM file
+
NULL
+
NULL
+
REC_FAM
+
A record describing a family
+
XREF_PTR(FAM)
+
NULL
+
REC_INDI
+
A record describing an individual
+
XREF_PTR(INDI)
+
NULL
+
REC_OBJE
+
A record describing a multimedia object
+
XREF_PTR(OBJE)
+
NULL
+
REC_NOTE
+
A record describing a note
+
XREF_PTR(NOTE)
+
STRING
+
REC_REPO
+
A record describing a source repository
+
XREF_PTR(REPO)
+
NULL
+
REC_SOUR
+
A record describing a source
+
XREF_PTR(SOUR)
+
NULL
+
REC_SUBN
+
A record describing the submission
+
XREF_PTR(SUBN)
+
NULL
+
REC_SUBM
+
A record describing the submitter
+
XREF_PTR(SUBM)
+
NULL
+
REC_USER
+
An application-specific record (the tag + in the start callback contains the actually used tag).
+
NULL
+XREF_PTR(USER)
+

+
NULL
+STRING
+XREF_PTR(USER)

+
+ +
+

Element identifiers

+ The following table describes the identifiers to be used in the element + callbacks.  The last column gives the + Gedcom_val type of the val argument in the element + start callback.

- +
- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + - - - + - - + - - + - + + - + + + + + - - + - - + - - + - - + - + + - + + + + + + + + + + + + + + + + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Record
+
Element
+
Possible
+ tags
+

+
Used within
+
Possible
+ val types
+

+
ELT_HEAD_SOUR
+
SOUR
+
REC_HEAD
+
STRING
+
ELT_HEAD_SOUR_VERS
+
VERS
+
ELT_HEAD_SOUR
+
STRING
+
ELT_HEAD_SOUR_NAME
+
NAME
+
ELT_HEAD_SOUR
+
STRING
+
ELT_HEAD_SOUR_COR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HI
+
REC_FAM
+
STRING
+
ELT_FAM_SUBM
+
SUBM
+
REC_FAM
+
XREF_PTR(SUBM)
+
ELT_INDI_RESN
+
RESN
+
REC_INDI
+
STRING
+
ELT_INDI_SEX
+
SEX
+
REC_INDI
+
STRING
+
ELT_INDI_SUBM
+
SUBM
+
REC_INDI
+
XREF_PTR(SUBM)
+
ELT_INDI_ALIA
+
ALIA
+
REC_INDI
+
XREF_PTR(INDI)
+
ELT_INDI_ANCI
+
ANCI
+
REC_INDI
+
XREF_PTR(SUBM)
+
ELT_INDI_DESI
+
DESI
+
REC_INDI
+
XREF_PTR(SUBM)
+
ELT_INDI_RFN
+
RFN
+
REC_INDI
+
STRING
+
ELT_INDI_AFN
+
AFN
+
REC_INDI
+
STRING
+
ELT_OBJE_FORM
+
FORM
+
REC_OBJE
+
STRING
+
ELT_OBJE_TITL
+
TITL
+
REC_OBJE
+
STRING
+
ELT_OBJE_BLOB
+
BLOB
+
REC_OBJE
+
NULL
+
ELT_OBJE_BLOB_CONT
+
CONT
+
ELT_OBJE_BLOB
+
STRING
+
ELT_OBJE_OBJE
+
OBJE
+
REC_OBJE
+
XREF_PTR(OBJE)
+
ELT_REPO_NAME
+
NAME
+
REC_REPO
+
STRING
+
ELT_SOUR_DATA
+
DATA
+
REC_SOUR
+
NULL
+
ELT_SOUR_DATA_EVEN
+
EVEN
+
ELT_SOUR_DATA
+
STRING
+
ELT_SOUR_DATA_EVEN_DATE
+
DATE
+
ELT_SOUR_DATA_EVEN
+
DATE
+
ELT_SOUR_DATA_EVEN_PLAC
+
PLAC
+
ELT_SOUR_DATA_EVEN
+
STRING
+
ELT_SOUR_DATA_AGNC
+
AGNC
+
ELT_SOUR_DATA
+
STRING
+
ELT_SOUR_AUTH
+
AUTH
+
REC_SOUR
+
STRING
+
ELT_SOUR_TITL
+
TITL
+
REC_SOUR
+
STRING
+
ELT_SOUR_ABBR
+
ABBR
+
REC_SOUR
+
STRING
+
ELT_SOUR_PUBL
+
PUBL
+
REC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M_EVT_WIFE
+
WIFE
+
ELT_SUB_FAM_EVT,
+ ELT_SUB_FAM_EVT_EVEN
+
NULL
+
ELT_SUB_FAM_EVT_AGE
+
AGE
+
ELT_SUB_FAM_EVT_HUSB,
+ ELT_SUB_FAM_EVT_WIFE
+
STRING
+
ELT_SUB_FAM_EVT_EVEN
+
EVEN
+
REC_FAM
+
NULL
+
ELT_SUB_IDENT_REFN
+
REFN
+
REC_FAM, REC_INDI,
+ REC_OBJE, REC_NOTE,
+ REC_REPO, REC_SOUR
+

+
STRING
+
ELT_SUB_IDENT_REFN_TYPE
+
TYPE
+
ELT_SUB_IDENT_REFN
+
STRING
+
ELT_SUB_IDENT_RIN
+
RIN
+
REC_FAM, REC_INDI,
+ REC_OBJE, REC_NOTE,
+ REC_REPO, REC_SOUR
+

+
STRING
+
ELT_SUB_INDIV_ATTR
+
CAST, DSCR, EDUC,
+ IDNO, NATI, NCHR,
+ NMR, OCCU, PROP,
+ RELI, SSN, TITL

+
REC_INDI
+
STRING
+
ELT_SUB_INDIV_RESI
+
RESI
+
REC_INDI
+
NULL
+
ELT_SUB_INDIV_BIRT
+
BIRT, CHR
+
REC_INDI
+
NULL
+ STRING

+
ELT_SUB_INDIV_BIRT_FAMC
+
FAMC
+
ELT_SUB_INDIV_BIRT
+
XREF_PTR(FAM)
+
ELT_SUB_INDIV_GEN
+
DEAT, BURI, CREM,
+ BAPM, BARM, BASM,
+ BLES, CHRA, CONF,
+ FCOM, ORDN, NATU,
+ EMIG, IMMI, CENS,
+ PROB, WILL, GRAD,
+ RETI

+
REC_INDI
+
NULL
+ STRING

+
ELT_SUB_INDIV_ADOP
+
ADOP
+
REC_INDI
+
NULL
+ STRING

+
ELT_SUB_INDIV_ADOP_FAMC
+
FAMC
+
ELT_SUB_INDIV_ADOP
+
XREF_PTR(FAM)
+
ELT_SUB_INDIV_ADOP_FAMC_ADOP
+
ADOP
+
ELT_SUB_INDIV_ADOP_FAMC
+
STRING
+
ELT_SUB_INDIV_EVEN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FORM
+
FORM
+
ELT_SUB_MULTIM_OBJE
+
STRING
+
ELT_SUB_MULTIM_OBJE_TITL
+
TITL
+
ELT_SUB_MULTIM_OBJE
+
STRING
+
ELT_SUB_MULTIM_OBJE_FILE
+
FILE
+
ELT_SUB_MULTIM_OBJE
+
STRING
+
ELT_SUB_NOTE
Meaning
+
NOTE
Possible
-  xref types

+
REC_FAM, REC_INDI,
+ REC_OBJE, REC_REPO,
+ REC_SOUR, ELT_SOUR_DATA,
+ ELT_SUB_ASSO, ELT_SUB_CHAN,
+ ELT_SUB_FAMC,
ELT_SUB_FAM_EVT,
+ ELT_SUB_FAM_EVT_EVEN,
+ ELT_SUB_INDIV_ATTR,
+ ELT_SUB_INDIV_RESI
,
+ ELT_SUB_INDIV_BIRT,
+ ELT_SUB_INDIV_GEN,
+ ELT_SUB_INDIV_ADOP,
+ ELT_SUB_LIO_BAPL,
+ ELT_SUB_LIO_SLGC,
+ ELT_SUB_LSS_SLGS,
+ ELT_SUB_MULTIM_OBJE,
+ ELT_SUB_PERS_NAME,
+ ELT_SUB_PLAC,
+ ELT_SUB_SOUR,
+ ELT_SUB_REPO,
+ ELT_SUB_FAMS

+
NULL
+ STRING
+XREF_PTR(NOTE)
+

REC_HEAD
+
ELT_SUB_PERS_NAME
The header of the GEDCOM file
+
NAME
NULL
+
REC_INDI
+
STRING
REC_FAM
+
ELT_SUB_PERS_NAME_NPFX
A record describing a family
+
NPFX
+
ELT_SUB_PERS_NAME
STRING
REC_INDI
+
ELT_SUB_PERS_NAME_GIVN
A record describing an individual
+
GIVN
+
ELT_SUB_PERS_NAME
STRING
REC_OBJE
+
ELT_SUB_PERS_NAME_NICK
+
NICK
+
ELT_SUB_PERS_NAME
A record describing a multimedia object
+
STRING
+
ELT_SUB_PERS_NAME_SPFX
+
SPFX
+
ELT_SUB_PERS_NAME
STRING
REC_NOTE
+
ELT_SUB_PERS_NAME_SURN
A record describing a note
+
SURN
+
ELT_SUB_PERS_NAME
STRING
REC_REPO
+
ELT_SUB_PERS_NAME_NSFX
A record describing a source repository
+
NSFX
+
ELT_SUB_PERS_NAME
STRING
REC_SOUR
+
ELT_SUB_PLAC
A record describing a source
+
PLAC
+
ELT_SUB_FAM_EVT,
+ ELT_SUB_FAM_EVT_EVEN,
+ ELT_SUB_INDIV_ATTR,
+ ELT_SUB_INDIV_RESI

STRING
REC_SUBN
+
ELT_SUB_PLAC_FORM
A record describing the submission
+
FORM
+
ELT_SUB_PLAC
STRING
REC_SUBM
+
ELT_SUB_SOUR
+
SOUR
+
REC_FAM, REC_INDI,
+ REC_NOTE, ELT_SUB_ASSO
+
ELT_SUB_FAM_EVT,
+
ELT_SUB_FAM_EVT_EVEN,
+ ELT_SUB_INDIV_ATTR,
+ ELT_SUB_INDIV_RESI
,
+ ELT_SUB_INDIV_BIRT,
+ ELT_SUB_INDIV_GEN,
+ ELT_SUB_INDIV_ADOP,
+ ELT_SUB_LIO_BAPL,
+ ELT_SUB_LIO_SLGC,
+ ELT_SUB_LSS_SLGS,
+ ELT_SUB_NOTE,
+ ELT_SUB_PERS_NAME,
+ ELT_SUB_PLAC

A record describing the submitter
+
STRING
+XREF_PTR(SOUR)

+
ELT_SUB_SOUR_PAGE
+
PAGE
+
ELT_SUB_SOUR
+
STRING
+
ELT_SUB_SOUR_EVEN
+
EVEN
+
ELT_SUB_SOUR
+
STRING
+
ELT_SUB_SOUR_EVEN_ROLE
+
ROLE
+
ELT_SUB_SOUR_EVEN
STRING
REC_USER
+
ELT_SUB_SOUR_DATA
+
DATA
An application-specific record (the tag - in the start callback contains the actually used tag).
+
ELT_SUB_SOUR
NULL
- STRING
+
ELT_SUB_SOUR_DATA_DATE
+
DATE
+
ELT_SUB_SOUR_DATA
+
DATE
+
ELT_SUB_SOUR_TEXT
+
TEXT
+
ELT_SUB_SOUR
+ ELT_SUB_SOUR_DATA

+
STRING
+
ELT_SUB_SOUR_QUAY
+
QUAY
+
ELT_SUB_SOUR
+
STRING
+
ELT_SUB_REPO
+
REPO
+
REC_SOUR
+
XREF_PTR(REPO)
+
ELT_SUB_REPO_CALN
+
CALN
+
ELT_SUB_REPO
+
STRING
+
ELT_SUB_REPO_CALN_MEDI
+
MEDI
+
ELT_SUB_REPO_CALN
+
STRING
+
ELT_SUB_FAMS
+
FAMS
+
REC_INDI
+
XREF_PTR(FAM)
+
ELT_USER
+
any tag starting
+ with an underscore

+
anywhere
+
NULL
+ STRING
+XREF_PTR(USER)

- -
-

Element identifiers

- The following table describes the identifiers to be used in the element - callbacks.  The last column gives the - Gedcom_val type of the val argument in the element - start callback.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Element
-
Possible
- tags
-

-
Used within
-
Possible
- val types
-

-
ELT_HEAD_SOUR
-
SOUR
-
REC_HEAD
-
STRING
-
ELT_HEAD_SOUR_VERS
-
VERS
-
ELT_HEAD_SOUR
-
STRING
-
ELT_HEAD_SOUR_NAME
-
NAME
-
ELT_HEAD_SOUR
-
STRING
-
ELT_HEAD_SOUR_CORP
-
CORP
-
ELT_HEAD_SOUR
-
STRING
-
ELT_HEAD_SOUR_DATA
-
DATA
-
ELT_HEAD_SOUR
-
STRING
-
ELT_HEAD_SOUR_DATA_DATE
-
DATE
-
ELT_HEAD_SOUR_DATA
-
DATE
-
ELT_HEAD_SOUR_DATA_COPR
-
COPR
-
ELT_HEAD_SOUR_DATA
-
STRING
-
ELT_HEAD_DEST
-
DEST
-
REC_HEAD
-
STRING
-
ELT_HEAD_DATE
-
DATE
-
REC_HEAD
-
DATE
-
ELT_HEAD_DATE_TIME
-
TIME
-
ELT_HEAD_DATE
-
STRING
-
ELT_HEAD_SUBM
-
SUBM
-
REC_HEAD
-
STRING
-
ELT_HEAD_SUBN
-
SUBN
-
REC_HEAD
-
STRING
-
ELT_HEAD_FILE
-
FILE
-
REC_HEAD
-
STRING
-
ELT_HEAD_COPR
-
COPR
-
REC_HEAD
-
STRING
-
ELT_HEAD_GEDC
-
GEDC
-
REC_HEAD
-
NULL
-
ELT_HEAD_GEDC_VERS
-
VERS
-
ELT_HEAD_GEDC
-
STRING
-
ELT_HEAD_GEDC_FORM
-
FORM
-
ELT_HEAD_GEDC
-
STRING
-
ELT_HEAD_CHAR
-
CHAR
-
REC_HEAD
-
STRING
-
ELT_HEAD_CHAR_VERS
-
VERS
-
ELT_HEAD_CHAR
-
STRING
-
ELT_HEAD_LANG
-
LANG
-
REC_HEAD
-
STRING
-
ELT_HEAD_PLAC
-
PLAC
-
REC_HEAD
-
NULL
-
ELT_HEAD_PLAC_FORM
-
FORM
-
ELT_HEAD_PLAC
-
STRING
-
ELT_HEAD_NOTE
-
NOTE
-
REC_HEAD
-
STRING
-
ELT_FAM_HUSB
-
HUSB
-
REC_FAM
-
STRING
-
ELT_FAM_WIFE
-
WIFE
-
REC_FAM
-
STRING
-
ELT_FAM_CHIL
-
CHIL
-
REC_FAM
-
STRING
-
ELT_FAM_NCHI
-
NCHI
-
REC_FAM
-
STRING
-
ELT_FAM_SUBM
-
SUBM
-
REC_FAM
-
STRING
-
ELT_INDI_RESN
-
RESN
-
REC_INDI
-
STRING
-
ELT_INDI_SEX
-
SEX
-
REC_INDI
-
STRING
-
ELT_INDI_SUBM
-
SUBM
-
REC_INDI
-
STRING
-
ELT_INDI_ALIA
-
ALIA
-
REC_INDI
-
STRING
-
ELT_INDI_ANCI
-
ANCI
-
REC_INDI
-
STRING
-
ELT_INDI_DESI
-
DESI
-
REC_INDI
-
STRING
-
ELT_INDI_RFN
-
RFN
-
REC_INDI
-
STRING
-
ELT_INDI_AFN
-
AFN
-
REC_INDI
-
STRING
-
ELT_OBJE_FORM
-
FORM
-
REC_OBJE
-
STRING
-
ELT_OBJE_TITL
-
TITL
-
REC_OBJE
-
STRING
-
ELT_OBJE_BLOB
-
BLOB
-
REC_OBJE
-
NULL
-
ELT_OBJE_BLOB_CONT
-
CONT
-
ELT_OBJE_BLOB
-
STRING
-
ELT_OBJE_OBJE
-
OBJE
-
REC_OBJE
-
STRING
-
ELT_REPO_NAME
-
NAME
-
REC_REPO
-
STRING
-
ELT_SOUR_DATA
-
DATA
-
REC_SOUR
-
NULL
-
ELT_SOUR_DATA_EVEN
-
EVEN
-
ELT_SOUR_DATA
-
STRING
-
ELT_SOUR_DATA_EVEN_DATE
-
DATE
-
ELT_SOUR_DATA_EVEN
-
DATE
-
ELT_SOUR_DATA_EVEN_PLAC
-
PLAC
-
ELT_SOUR_DATA_EVEN
-
STRING
-
ELT_SOUR_DATA_AGNC
-
AGNC
-
ELT_SOUR_DATA
-
STRING
-
ELT_SOUR_AUTH
-
AUTH
-
REC_SOUR
-
STRING
-
ELT_SOUR_TITL
-
TITL
-
REC_SOUR
-
STRING
-
ELT_SOUR_ABBR
-
ABBR
-
REC_SOUR
-
STRING
-
ELT_SOUR_PUBL
-
PUBL
-
REC_SOUR
-
STRING
-
ELT_SOUR_TEXT
-
TEXT
-
REC_SOUR
-
STRING
-
ELT_SUBN_SUBM
-
SUBM
-
REC_SUBN
-
STRING
-
ELT_SUBN_FAMF
-
FAMF
-
REC_SUBN
-
STRING
-
ELT_SUBN_TEMP
-
TEMP
-
REC_SUBN
-
STRING
-
ELT_SUBN_ANCE
-
ANCE
-
REC_SUBN
-
STRING
-
ELT_SUBN_DESC
-
DESC
-
REC_SUBN
-
STRING
-
ELT_SUBN_ORDI
-
ORDI
-
REC_SUBN
-
STRING
-
ELT_SUBN_RIN
-
RIN
-
REC_SUBN
-
STRING
-
ELT_SUBM_NAME
-
NAME
-
REC_SUBM
-
STRING
-
ELT_SUBM_LANG
-
LANG
-
REC_SUBM
-
STRING
-
ELT_SUBM_RFN
-
RFN
-
REC_SUBM
-
STRING
-
ELT_SUBM_RIN
-
RIN
-
REC_SUBM
-
STRING
-
ELT_SUB_ADDR
-
ADDR
-
ELT_HEAD_SOUR_CORP,
- REC_REPO, REC_SUBM,
-
ELT_SUB_FAM_EVT,
- ELT_SUB_FAM_EVT_EVEN,
- ELT_SUB_INDIV_ATTR,
- ELT_SUB_INDIV_RESI,
- ELT_SUB_INDIV_BIRT,
- ELT_SUB_INDIV_GEN,
- ELT_SUB_INDIV_ADOP
-

-
-
STRING
-
ELT_SUB_ADDR_CONT
-
CONT
-
ELT_SUB_ADDR
-
STRING
-
ELT_SUB_ADDR_ADR1
-
ADR1
-
ELT_SUB_ADDR
-
STRING
-
ELT_SUB_ADDR_ADR2
-
ADR2
-
ELT_SUB_ADDR
-
STRING
-
ELT_SUB_ADDR_CITY
-
CITY
-
ELT_SUB_ADDR
-
STRING
-
ELT_SUB_ADDR_STAE
-
STAE
-
ELT_SUB_ADDR
-
STRING
-
ELT_SUB_ADDR_POST
-
POST
-
ELT_SUB_ADDR
-
STRING
-
ELT_SUB_ADDR_CTRY
-
CTRY
-
ELT_SUB_ADDR
-
STRING
-
ELT_SUB_PHON
-
PHON
-
ELT_HEAD_SOUR_CORP,
- REC_REPO, REC_SUBM,
-
ELT_SUB_FAM_EVT,
-
ELT_SUB_FAM_EVT_EVEN,
- ELT_SUB_INDIV_ATTR,
- ELT_SUB_INDIV_RESI,
- ELT_SUB_INDIV_BIRT,
- ELT_SUB_INDIV_GEN,
- ELT_SUB_INDIV_ADOP
-

-
-
STRING
-
ELT_SUB_ASSO
-
ASSO
-
REC_INDI
-
STRING
-
ELT_SUB_ASSO_TYPE
-
TYPE
-
ELT_SUB_ASSO
-
STRING
-
ELT_SUB_ASSO_RELA
-
RELA
-
ELT_SUB_ASSO
-
STRING
-
ELT_SUB_CHAN
-
CHAN
-
REC_FAM, REC_INDI,
- REC_OBJE, REC_NOTE,
- REC_REPO, REC_SOUR,
- REC_SUBM
-

-
NULL
-
ELT_SUB_CHAN_DATE
-
DATE
-
ELT_SUB_CHAN
-
DATE
-
ELT_SUB_CHAN_TIME
-
TIME
-
ELT_SUB_CHAN_DATE
-
STRING
-
ELT_SUB_FAMC
-
FAMC
-
REC_INDI
-
STRING
-
ELT_SUB_FAMC_PEDI
-
PEDI
-
ELT_SUB_FAMC
-
STRING
-
ELT_SUB_CONT
-
CONT
-
ELT_HEAD_NOTE, REC_NOTE,
- ELT_SOUR_AUTH, ELT_SOUR_TITL,
- ELT_SOUR_PUBL, ELT_SOUR_TEXT,
- ELT_SUB_NOTE,
- ELT_SUB_SOUR, ELT_SUB_SOUR_TEXT
-

-
STRING
-
ELT_SUB_CONC
-
CONC
-
ELT_HEAD_NOTE, REC_NOTE,
- ELT_SOUR_AU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A, MARR,
- MARB, MARC, MARL,
- MARS

-
REC_FAM
-
NULL
- STRING

-
ELT_SUB_FAM_EVT_HUSB
-
HUSB
-
ELT_SUB_FAM_EVT,
- ELT_SUB_FAM_EVT_EVEN
-
NULL
-
ELT_SUB_FAM_EVT_WIFE
-
WIFE
-
ELT_SUB_FAM_EVT,
- ELT_SUB_FAM_EVT_EVEN
-
NULL
-
ELT_SUB_FAM_EVT_AGE
-
AGE
-
ELT_SUB_FAM_EVT_HUSB,
- ELT_SUB_FAM_EVT_WIFE
-
STRING
-
ELT_SUB_FAM_EVT_EVEN
-
EVEN
-
REC_FAM
-
NULL
-
ELT_SUB_IDENT_REFN
-
REFN
-
REC_FAM, REC_INDI,
- REC_OBJE, REC_NOTE,
- REC_REPO, REC_SOUR
-

-
STRING
-
ELT_SUB_IDENT_REFN_TYPE
-
TYPE
-
ELT_SUB_IDENT_REFN
-
STRING
-
ELT_SUB_IDENT_RIN
-
RIN
-
REC_FAM, REC_INDI,
- REC_OBJE, REC_NOTE,
- REC_REPO, REC_SOUR
-

-
STRING
-
ELT_SUB_INDIV_ATTR
-
CAST, DSCR, EDUC,
- IDNO, NATI, NCHR,
- NMR, OCCU, PROP,
- RELI, SSN, TITL

-
REC_INDI
-
STRING
-
ELT_SUB_INDIV_RESI
-
RESI
-
REC_INDI
-
NULL
-
ELT_SUB_INDIV_BIRT
-
BIRT, CHR
-
REC_INDI
-
NULL
- STRING

-
ELT_SUB_INDIV_BIRT_FAMC
-
FAMC
-
ELT_SUB_INDIV_BIRT
-
STRING
-
ELT_SUB_INDIV_GEN
-
DEAT, BURI, CREM,
- BAPM, BARM, BASM,
- BLES, CHRA, CONF,
- FCOM, ORDN, NATU,
- EMIG, IMMI, CENS,
- PROB, WILL, GRAD,
- RETI

-
REC_INDI
-
NULL
- STRING

-
ELT_SUB_INDIV_ADOP
-
ADOP
-
REC_INDI
-
NULL
- STRING

-
ELT_SUB_INDIV_ADOP_FAMC
-
FAMC
-
ELT_SUB_INDIV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- ELT_SUB_INDIV_ADOP,
- ELT_SUB_SOUR

-
NULL
-
ELT_SUB_MULTIM_OBJE_FORM
-
FORM
-
ELT_SUB_MULTIM_OBJE
-
STRING
-
ELT_SUB_MULTIM_OBJE_TITL
-
TITL
-
ELT_SUB_MULTIM_OBJE
-
STRING
-
ELT_SUB_MULTIM_OBJE_FILE
-
FILE
-
ELT_SUB_MULTIM_OBJE
-
STRING
-
ELT_SUB_NOTE
-
NOTE
-
REC_FAM, REC_INDI,
- REC_OBJE, REC_REPO,
- REC_SOUR, ELT_SOUR_DATA,
- ELT_SUB_ASSO, ELT_SUB_CHAN,
- ELT_SUB_FAMC,
ELT_SUB_FAM_EVT,
- ELT_SUB_FAM_EVT_EVEN,
- ELT_SUB_INDIV_ATTR,
- ELT_SUB_INDIV_RESI
,
- ELT_SUB_INDIV_BIRT,
- ELT_SUB_INDIV_GEN,
- ELT_SUB_INDIV_ADOP,
- ELT_SUB_LIO_BAPL,
- ELT_SUB_LIO_SLGC,
- ELT_SUB_LSS_SLGS,
- ELT_SUB_MULTIM_OBJE,
- ELT_SUB_PERS_NAME,
- ELT_SUB_PLAC,
- ELT_SUB_SOUR,
- ELT_SUB_REPO,
- ELT_SUB_FAMS

-
NULL
- STRING

-
ELT_SUB_PERS_NAME
-
NAME
-
REC_INDI
-
STRING
-
ELT_SUB_PERS_NAME_NPFX
-
NPFX
-
ELT_SUB_PERS_NAME
-
STRING
-
ELT_SUB_PERS_NAME_GIVN
-
GIVN
-
ELT_SUB_PERS_NAME
-
STRING
-
ELT_SUB_PERS_NAME_NICK
-
NICK
-
ELT_SUB_PERS_NAME
-
STRING
-
ELT_SUB_PERS_NAME_SPFX
-
SPFX
-
ELT_SUB_PERS_NAME
-
STRING
-
ELT_SUB_PERS_NAME_SURN
-
SURN
-
ELT_SUB_PERS_NAME
-
STRING
-
ELT_SUB_PERS_NAME_NSFX
-
NSFX
-
ELT_SUB_PERS_NAME
-
STRING
-
ELT_SUB_PLAC
-
PLAC
-
ELT_SUB_FAM_EVT,
- ELT_SUB_FAM_EVT_EVEN,
- ELT_SUB_INDIV_ATTR,
- ELT_SUB_INDIV_RESI

-
STRING
-
ELT_SUB_PLAC_FORM
-
FORM
-
ELT_SUB_PLAC
-
STRING
-
ELT_SUB_SOUR
-
SOUR
-
REC_FAM, REC_INDI,
- REC_NOTE, ELT_SUB_ASSO
-
ELT_SUB_FAM_EVT,
-
ELT_SUB_FAM_EVT_EVEN,
- ELT_SUB_INDIV_ATTR,
- ELT_SUB_INDIV_RESI
,
- ELT_SUB_INDIV_BIRT,
- ELT_SUB_INDIV_GEN,
- ELT_SUB_INDIV_ADOP,
- ELT_SUB_LIO_BAPL,
- ELT_SUB_LIO_SLGC,
- ELT_SUB_LSS_SLGS,
- ELT_SUB_NOTE,
- ELT_SUB_PERS_NAME,
- ELT_SUB_PLAC

-
STRING
-
ELT_SUB_SOUR_PAGE
-
PAGE
-
ELT_SUB_SOUR
-
STRING
-
ELT_SUB_SOUR_EVEN
-
EVEN
-
ELT_SUB_SOUR
-
STRING
-
ELT_SUB_SOUR_EVEN_ROLE
-
ROLE
-
ELT_SUB_SOUR_EVEN
-
STRING
-
ELT_SUB_SOUR_DATA
-
DATA
-
ELT_SUB_SOUR
-
NULL
-
ELT_SUB_SOUR_DATA_DATE
-
DATE
-
ELT_SUB_SOUR_DATA
-
DATE
-
ELT_SUB_SOUR_TEXT
-
TEXT
-
ELT_SUB_SOUR
- ELT_SUB_SOUR_DATA

-
STRING
-
ELT_SUB_SOUR_QUAY
-
QUAY
-
ELT_SUB_SOUR
-
STRING
-
ELT_SUB_REPO
-
REPO
-
REC_SOUR
-
STRING
-
ELT_SUB_REPO_CALN
-
CALN
-
ELT_SUB_REPO
-
STRING
-
ELT_SUB_REPO_CALN_MEDI
-
MEDI
-
ELT_SUB_REPO_CALN
-
STRING
-
ELT_SUB_FAMS
-
FAMS
-
REC_INDI
-
STRING
-
ELT_USER
-
any tag starting
- with an underscore

-
anywhere
-
NULL
- STRING

-
- -
+ +

Gedcom_val types
-

- Currently, the specific Gedcom_val types are (with - val of type Gedcom_val):
-
- + + Currently, the specific Gedcom_val types are (with + val of type Gedcom_val):
+
+ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + +

-
type checker
-
cast operator
-
null value
-
GEDCOM_IS_NULL(val)
-
N/A
-
string
-
GEDCOM_IS_STRING(val)
-
char* str = GEDCOM_STRING(val);
-
date
-
GEDCOM_IS_DATE(val)
-
struct date_value dv = GEDCOM_DATE(val);

+
type checker
+
cast operator
+
null value
+
GEDCOM_IS_NULL(val)
+
N/A
+
string
+
GEDCOM_IS_STRING(val)
+
char* str = GEDCOM_STRING(val);
+
date
+
GEDCOM_IS_DATE(val)
+
struct date_value dv = GEDCOM_DATE(val);
xref pointer
+
GEDCOM_IS_XREF_PTR(val)
+
struct xref_value *xr = GEDCOM_XREF_PTR(val);
+
-
-
- The type checker returns a true or a false value according to the type - of the value, but this is in principle only necessary in the rare circumstances - that two types are possible, or where an optional value can be provided. +
+
+ The type checker returns a true or a false value according to the type + of the value, but this is in principle only necessary in the rare circumstances + that two types are possible, or where an optional value can be provided.  In most cases, the type is fixed for a specific tag.
-
- The null value is used for when the GEDCOM spec doesn't allow a value, +
+ The null value is used for when the GEDCOM spec doesn't allow a value, or when an optional value is allowed but none is given.
-  
- The string value is the most general used value currently, for all those - values that don't have a more specific meaning.  In essence, the value - that is returned by GEDCOM_STRING is always the same as the raw_value passed +  
+ The string value is the most general used value currently, for all those + values that don't have a more specific meaning.  In essence, the value + that is returned by GEDCOM_STRING is always the same as the raw_value passed to the start callback, and is thus in fact redundant.
-
- The date value is used for all elements that return a date.
-
- +
+ The date value is used for all elements that return a date.  See +here for the definition.
+
+The xref value is for cross-references between records in the file.  See +here for the definition.
+
+

struct date_value

- This struct describes a date as given in the GEDCOM file, and has the + This struct describes a date as given in the GEDCOM file, and has the following definition:
- +
struct date_value {
-   Date_value_type  type;
-   struct date      date1;
-   struct date      date2;
-   char              phrase[MAX_PHRASE_LEN - + 1];
- };

-
- It depends on the first member, the type, which members are actually -relevant:
-
- +   Date_value_type  type;
+   struct date      date1;
+   struct date      date2;
+   char              phrase[MAX_PHRASE_LEN + + 1];
+ };
+ + It depends on the first member, the type, which members are actually + relevant:
+
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Date_value_type
-
Meaning
-
Relevant members
-
DV_NO_MODIFIER
-
just a simple date
-
date1
-
DV_BEFORE
-
a range (BEFORE date1)
-
date1
-
DV_AFTER
-
a range (AFTER date1)
-
date1
-
DV_BETWEEN
-
a range (BETWEEN date1 AND date2)
-
date1, date2
-
DV_FROM
-
a period (FROM date1)
-
date1
-
DV_TO
-
a period (TO date1)
-
date1
-
DV_FROM_TO
-
a period (FROM date1 TO date2)
-
date1, date2
-
DV_ABOUT
-
an approximation (ABOUT date1)
-
date1
-
DV_CALCULATED
-
an approximation (CALCULATED date1)
-
date1
-
DV_ESTIMATED
-
an approximation (ESTIMATED date1)
-
date1
-
DV_INTERPRETED
-
INTERPRETED date1 FROM a given free form date -phrase
-
date1, phrase
-
DV_PHRASE
-
a free form date phrase
-
phrase
-
Date_value_type
+
Meaning
+
Relevant members
+
DV_NO_MODIFIER
+
just a simple date
+
date1
+
DV_BEFORE
+
a range (BEFORE date1)
+
date1
+
DV_AFTER
+
a range (AFTER date1)
+
date1
+
DV_BETWEEN
+
a range (BETWEEN date1 AND date2)
+
date1, date2
+
DV_FROM
+
a period (FROM date1)
+
date1
+
DV_TO
+
a period (TO date1)
+
date1
+
DV_FROM_TO
+
a period (FROM date1 TO date2)
+
date1, date2
+
DV_ABOUT
+
an approximation (ABOUT date1)
+
date1
+
DV_CALCULATED
+
an approximation (CALCULATED date1)
+
date1
+
DV_ESTIMATED
+
an approximation (ESTIMATED date1)
+
date1
+
DV_INTERPRETED
+
INTERPRETED date1 FROM a given free form date + phrase
+
date1, phrase
+
DV_PHRASE
+
a free form date phrase
+
phrase
+
-
- +
+

struct date
-

- The date1 and date2 also have a strict syntax:
- + + The date1 and date2 also have a strict syntax:
+
struct date {
-   Calendar_type  cal;
-   char           day_str[MAX_DAY_LEN + 1];
-   char           month_str[MAX_MONTH_LEN -+ 1];
-   char           year_str[MAX_YEAR_LEN + +   Calendar_type  cal;
+   char           day_str[MAX_DAY_LEN + 1];
-
-   int            day;
-   int            month;
-   int            year;
-   Year_type      year_type;
-
-   Date_type      type;
-   long int       sdn1;
-   long int       sdn2;
- };

-
- The first four fields are the primary fields parsed from the value in -the GEDCOM file.  The day_str, month_str -and year_str are the literal parts of the date that denote -the day, month and year (the day_str and month_str - can be empty) .  The calendar type cal is one of (see -calendar overview LINK TBD):
- +   char           month_str[MAX_MONTH_LEN + + 1];
+   char           year_str[MAX_YEAR_LEN ++ 1];
+
+   int            day;
+   int            month;
+   int            year;
+   Year_type      year_type;
+
+   Date_type      type;
+   long int       sdn1;
+   long int       sdn2;
+ };
+ + The first four fields are the primary fields parsed from the value in +the GEDCOM file.  The day_str, month_str and + year_str are the literal parts of the date that denote + the day, month and year (the day_str and month_str + can be empty) .  The calendar type cal is one of (see + calendar overview LINK TBD):
+ - The next four fields are deduced from the first four:
- + The next four fields are deduced from the first four:
+ - It is possible that the year_str is given as e.g. "1677/78". -  This is coming from a date in a so called "annunciation style", where - the year began on 25 March: "20 March 1677/78" is 20 March 1677 in "annunciation - style" and 20 March 1678 in "circumcision style" (the current style).  See + It is possible that the year_str is given as e.g. "1677/78". +  This is coming from a date in a so called "annunciation style", where + the year began on 25 March: "20 March 1677/78" is 20 March 1677 in "annunciation + style" and 20 March 1678 in "circumcision style" (the current style).  See calendar overview (LINK TBD).
-
- In this case, the year will contain the "circumcision style" - year (1678 in the example), and year_type will be YEAR_DOUBLE. -  Normal dates will have a year_type equal to -YEAR_SINGLE .
-
- Finally, the last three fields are probably the most interesting values - for applications that want to process dates.  Basically, the date is - converted to a serial day number (aka Julian day), which is the unique day - number since November 25, 4714 BC in the Gregorian calendar.  The advantage - of these day numbers is that they are unique and independent of the calendar - system.  Furthermore, date differences can just be computed by subtracting +
+ In this case, the year will contain the "circumcision style" + year (1678 in the example), and year_type will be YEAR_DOUBLE. +  Normal dates will have a year_type equal to + YEAR_SINGLE .
+
+ Finally, the last three fields are probably the most interesting values + for applications that want to process dates.  Basically, the date is + converted to a serial day number (aka Julian day), which is the unique day + number since November 25, 4714 BC in the Gregorian calendar.  The advantage + of these day numbers is that they are unique and independent of the calendar + system.  Furthermore, date differences can just be computed by subtracting the serial day numbers.
-
- However, since dates in GEDCOM are not necessarily exact (e.g. "MAR 1990"), - it is not possible to represent all GEDCOM dates with 1 serial day number. -  Two cases can be distinguished:
- +
+ However, since dates in GEDCOM are not necessarily exact (e.g. "MAR 1990"), + it is not possible to represent all GEDCOM dates with 1 serial day number. +  Two cases can be distinguished:
+ - -
+ +
These are represented by a serial day number in sdn1 - and a Date_type equal to DATE_EXACT.
-
-
- + and a Date_type equal to DATE_EXACT.
+
+ + - -
+ +
These are represented by 2 serial day numbers ( - sdn1 and sdn2) and a Date_type equal to - DATE_BOUNDED.
-
- For example, the Gregorian date "MAR 1990" is represented by the serial - day numbers for "1 MAR 1990" and "31 MAR 1990", and the Gregorian date "1990" - is represented by the serial day numbers for "1 JAN 1990" and "31 DEC 1990". -  Similarly for the other calendar types.
-
-
-
- -
-
$Id$
$Name$
-
- - - + sdn1 and sdn2) and a Date_type equal +to DATE_BOUNDED.
+
+ For example, the Gregorian date "MAR 1990" is represented by the serial + day numbers for "1 MAR 1990" and "31 MAR 1990", and the Gregorian date "1990" + is represented by the serial day numbers for "1 JAN 1990" and "31 DEC 1990". +  Similarly for the other calendar types.
+
+ + +

struct xref_value

+This struct represents a cross-reference in the GEDCOM file (but note that +the Gedcom_val contains a pointer to such a struct, not the +struct itself).  It is defined as:
+
struct xref_value {
+  Xref_type   type,
+  char*       string,
+  Gedcom_ctxt object
+};

+
+The Xref_type gives the type of the cross-reference and can +be one of:
+ +The string gives the actual cross-reference string from the +GEDCOM file, and the object is initially NULL, +but can be filled by the application with an object (of any type) that corresponds +with the cross-reference, and then later extracted when the cross-reference +is used or defined again in the file.  This relieves the application +from the burden of maintaining the mapping between cross-references and objects.
+
+The parser checks whether all cross-references that are used are defined +(if not, an error is produced) and whether all cross-references that are +defined are used (if not, a warning is produced).  It also checks whether +the type of the cross-reference is the same on definition and use (if not, +an error is produced).
+
+ +
+
$Id$
$Name$
+
+ + + diff --git a/gedcom/Makefile.am b/gedcom/Makefile.am index 0fd201e..1081476 100644 --- a/gedcom/Makefile.am +++ b/gedcom/Makefile.am @@ -23,7 +23,8 @@ libgedcom_la_SOURCES = lex.gedcom_1byte_.c \ encoding.c \ interface.c \ date.c \ - hash.c + hash.c \ + xref.c libgedcom_la_LDFLAGS = -version-info $(LIBVERSION) libgedcom_la_LIBADD = calendar/libcalendar.la BUILT_SOURCES = lex.gedcom_1byte_.c \ @@ -39,7 +40,8 @@ noinst_HEADERS = encoding.h \ interface.h \ multilex.h \ date.h \ - hash.h + hash.h \ + xref.h EXTRA_DIST = gedcom.y \ gedcom_date.y \ gedcom_1byte.lex \ diff --git a/gedcom/gedcom.y b/gedcom/gedcom.y index a048185..3302c1b 100644 --- a/gedcom/gedcom.y +++ b/gedcom/gedcom.y @@ -146,6 +146,7 @@ #include "encoding.h" #include "interface.h" #include "date.h" +#include "xref.h" int count_level = 0; int fail = 0; @@ -153,7 +154,8 @@ int compat_enabled = 1; int gedcom_high_level_debug = 0; int compatibility = 0; Gedcom_err_mech error_mechanism = IMMED_FAIL; -Gedcom_val_struct val; +Gedcom_val_struct val1; +Gedcom_val_struct val2; char line_item_buf[MAXGEDCLINELEN * UTF_FACTOR + 1]; char *line_item_buf_ptr; @@ -402,7 +404,6 @@ int compat_mode(int flags); %type indiv_gen_tag %type lio_bapl_tag %type line_item -%type line_value %type mand_line_item %type mand_pointer %type note_line_item @@ -437,8 +438,9 @@ record : fam_rec /**** Header ****/ /*********************************************************************/ head_sect : OPEN DELIM TAG_HEAD - { $$ = start_record(REC_HEAD, $1, GEDCOM_MAKE_NULL(), $3, - NULL, GEDCOM_MAKE_NULL()); + { $$ = start_record(REC_HEAD, $1, GEDCOM_MAKE_NULL(val1), + $3, + NULL, GEDCOM_MAKE_NULL(val2)); START(HEAD, $$) } head_subs { if (compat_mode(C_FTREE)) @@ -474,7 +476,7 @@ head_sour_sect : OPEN DELIM TAG_SOUR mand_line_item { set_compatibility($4); $$ = start_element(ELT_HEAD_SOUR, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(SOUR, $$) } head_sour_subs @@ -497,7 +499,7 @@ head_sour_sub : head_sour_vers_sect { OCCUR2(VERS, 0, 1) } head_sour_vers_sect : OPEN DELIM TAG_VERS mand_line_item { $$ = start_element(ELT_HEAD_SOUR_VERS, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(VERS, $$) } no_std_subs @@ -510,7 +512,7 @@ head_sour_vers_sect : OPEN DELIM TAG_VERS mand_line_item head_sour_name_sect : OPEN DELIM TAG_NAME mand_line_item { $$ = start_element(ELT_HEAD_SOUR_NAME, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(NAME, $$) } no_std_subs @@ -523,7 +525,7 @@ head_sour_name_sect : OPEN DELIM TAG_NAME mand_line_item head_sour_corp_sect : OPEN DELIM TAG_CORP mand_line_item { $$ = start_element(ELT_HEAD_SOUR_CORP, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(CORP, $$) } head_sour_corp_subs @@ -545,7 +547,7 @@ head_sour_corp_sub : addr_struc_sub /* 0:1 */ head_sour_data_sect : OPEN DELIM TAG_DATA mand_line_item { $$ = start_element(ELT_HEAD_SOUR_DATA, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(DATA, $$) } head_sour_data_subs @@ -567,9 +569,10 @@ head_sour_data_sub : head_sour_data_date_sect { OCCUR2(DATE, 0, 1) } head_sour_data_date_sect : OPEN DELIM TAG_DATE mand_line_item { struct date_value dv = gedcom_parse_date($4); - $$ = start_element(ELT_HEAD_SOUR_DATA_DATE, - PARENT, $1, $3, $4, - GEDCOM_MAKE_DATE(dv)); + $$ + = start_element(ELT_HEAD_SOUR_DATA_DATE, + PARENT, $1, $3, $4, + GEDCOM_MAKE_DATE(val1, dv)); START(DATE, $$) } no_std_subs @@ -580,9 +583,10 @@ head_sour_data_date_sect : OPEN DELIM TAG_DATE mand_line_item } ; head_sour_data_copr_sect : OPEN DELIM TAG_COPR mand_line_item - { $$ = start_element(ELT_HEAD_SOUR_DATA_COPR, - PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + { $$ + = start_element(ELT_HEAD_SOUR_DATA_COPR, + PARENT, $1, $3, $4, + GEDCOM_MAKE_STRING(val1, $4)); START(COPR, $$) } no_std_subs @@ -597,7 +601,7 @@ head_sour_data_copr_sect : OPEN DELIM TAG_COPR mand_line_item head_dest_sect : OPEN DELIM TAG_DEST mand_line_item { $$ = start_element(ELT_HEAD_DEST, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(DEST, $$) } no_std_subs @@ -613,7 +617,7 @@ head_date_sect : OPEN DELIM TAG_DATE mand_line_item { struct date_value dv = gedcom_parse_date($4); $$ = start_element(ELT_HEAD_DATE, PARENT, $1, $3, $4, - GEDCOM_MAKE_DATE(dv)); + GEDCOM_MAKE_DATE(val1, dv)); START(DATE, $$) } head_date_subs @@ -635,7 +639,7 @@ head_date_sub : head_date_time_sect { OCCUR2(TIME, 0, 1) } head_date_time_sect : OPEN DELIM TAG_TIME mand_line_item { $$ = start_element(ELT_HEAD_DATE_TIME, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(TIME, $$) } no_std_subs @@ -648,9 +652,12 @@ head_date_time_sect : OPEN DELIM TAG_TIME mand_line_item /* HEAD.SUBM */ head_subm_sect : OPEN DELIM TAG_SUBM mand_pointer - { $$ = start_element(ELT_HEAD_SUBM, + { struct xref_value *xr = gedcom_parse_xref($4, XREF_USED, + XREF_SUBM); + if (xr == NULL) HANDLE_ERROR; + $$ = start_element(ELT_HEAD_SUBM, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_XREF_PTR(val1, xr)); START(SUBM, $$) } no_std_subs @@ -662,9 +669,12 @@ head_subm_sect : OPEN DELIM TAG_SUBM mand_pointer ; /* HEAD.SUBN */ head_subn_sect : OPEN DELIM TAG_SUBN mand_pointer - { $$ = start_element(ELT_HEAD_SUBN, + { struct xref_value *xr = gedcom_parse_xref($4, XREF_USED, + XREF_SUBN); + if (xr == NULL) HANDLE_ERROR; + $$ = start_element(ELT_HEAD_SUBN, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_XREF_PTR(val1, xr)); START(SUBN, $$) } no_std_subs @@ -678,7 +688,7 @@ head_subn_sect : OPEN DELIM TAG_SUBN mand_pointer head_file_sect : OPEN DELIM TAG_FILE mand_line_item { $$ = start_element(ELT_HEAD_FILE, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(FILE, $$) } no_std_subs @@ -691,7 +701,7 @@ head_file_sect : OPEN DELIM TAG_FILE mand_line_item head_copr_sect : OPEN DELIM TAG_COPR mand_line_item { $$ = start_element(ELT_HEAD_COPR, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(COPR, $$) } no_std_subs @@ -704,7 +714,7 @@ head_copr_sect : OPEN DELIM TAG_COPR mand_line_item head_gedc_sect : OPEN DELIM TAG_GEDC { $$ = start_element(ELT_HEAD_GEDC, PARENT, $1, $3, NULL, - GEDCOM_MAKE_NULL()); + GEDCOM_MAKE_NULL(val1)); START(GEDC, $$) } head_gedc_subs @@ -725,7 +735,7 @@ head_gedc_sub : head_gedc_vers_sect { OCCUR2(VERS, 1, 1) } head_gedc_vers_sect : OPEN DELIM TAG_VERS mand_line_item { $$ = start_element(ELT_HEAD_GEDC_VERS, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(VERS, $$) } no_std_subs @@ -738,7 +748,7 @@ head_gedc_vers_sect : OPEN DELIM TAG_VERS mand_line_item head_gedc_form_sect : OPEN DELIM TAG_FORM mand_line_item { $$ = start_element(ELT_HEAD_GEDC_FORM, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(FORM, $$) } no_std_subs @@ -754,7 +764,7 @@ head_char_sect : OPEN DELIM TAG_CHAR mand_line_item { if (open_conv_to_internal($4) == 0) YYERROR; $$ = start_element(ELT_HEAD_CHAR, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(CHAR, $$) } head_char_subs @@ -774,7 +784,7 @@ head_char_sub : head_char_vers_sect { OCCUR2(VERS, 0, 1) } head_char_vers_sect : OPEN DELIM TAG_VERS mand_line_item { $$ = start_element(ELT_HEAD_CHAR_VERS, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(VERS, $$) } no_std_subs @@ -789,7 +799,7 @@ head_char_vers_sect : OPEN DELIM TAG_VERS mand_line_item head_lang_sect : OPEN DELIM TAG_LANG mand_line_item { $$ = start_element(ELT_HEAD_LANG, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(LANG, $$) } no_std_subs @@ -802,7 +812,7 @@ head_lang_sect : OPEN DELIM TAG_LANG mand_line_item head_plac_sect : OPEN DELIM TAG_PLAC { $$ = start_element(ELT_HEAD_PLAC, PARENT, $1, $3, NULL, - GEDCOM_MAKE_NULL()); + GEDCOM_MAKE_NULL(val1)); START(PLAC, $$) } head_plac_subs @@ -822,7 +832,7 @@ head_plac_sub : head_plac_form_sect { OCCUR2(FORM, 1, 1) } head_plac_form_sect : OPEN DELIM TAG_FORM mand_line_item { $$ = start_element(ELT_HEAD_PLAC_FORM, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(FORM, $$) } no_std_subs @@ -837,7 +847,7 @@ head_plac_form_sect : OPEN DELIM TAG_FORM mand_line_item head_note_sect : OPEN DELIM TAG_NOTE mand_line_item { $$ = start_element(ELT_HEAD_NOTE, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(NOTE, $$) } head_note_subs @@ -866,9 +876,13 @@ trlr_sect : OPEN DELIM TAG_TRLR CLOSE { } /**** Family record ****/ /*********************************************************************/ fam_rec : OPEN DELIM POINTER DELIM TAG_FAM - { $$ = start_record(REC_FAM, - $1, GEDCOM_MAKE_STRING($3), $5, - NULL, GEDCOM_MAKE_NULL()); + { struct xref_value *xr = gedcom_parse_xref($3, XREF_DEFINED, + XREF_FAM); + if (xr == NULL) HANDLE_ERROR; + $$ = start_record(REC_FAM, + $1, GEDCOM_MAKE_XREF_PTR(val1, xr), + $5, + NULL, GEDCOM_MAKE_NULL(val2)); START(FAM, $$) } fam_subs { CHECK0 } @@ -897,9 +911,12 @@ fam_sub : fam_event_struc_sub /* 0:M */ /* FAM.HUSB */ fam_husb_sect : OPEN DELIM TAG_HUSB mand_pointer - { $$ = start_element(ELT_FAM_HUSB, + { struct xref_value *xr = gedcom_parse_xref($4, XREF_USED, + XREF_INDI); + if (xr == NULL) HANDLE_ERROR; + $$ = start_element(ELT_FAM_HUSB, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_XREF_PTR(val1, xr)); START(HUSB, $$) } no_std_subs @@ -911,9 +928,12 @@ fam_husb_sect : OPEN DELIM TAG_HUSB mand_pointer /* FAM.WIFE */ fam_wife_sect : OPEN DELIM TAG_WIFE mand_pointer - { $$ = start_element(ELT_FAM_WIFE, + { struct xref_value *xr = gedcom_parse_xref($4, XREF_USED, + XREF_INDI); + if (xr == NULL) HANDLE_ERROR; + $$ = start_element(ELT_FAM_WIFE, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_XREF_PTR(val1, xr)); START(WIFE, $$) } no_std_subs @@ -925,9 +945,12 @@ fam_wife_sect : OPEN DELIM TAG_WIFE mand_pointer /* FAM.CHIL */ fam_chil_sect : OPEN DELIM TAG_CHIL mand_pointer - { $$ = start_element(ELT_FAM_CHIL, + { struct xref_value *xr = gedcom_parse_xref($4, XREF_USED, + XREF_INDI); + if (xr == NULL) HANDLE_ERROR; + $$ = start_element(ELT_FAM_CHIL, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_XREF_PTR(val1, xr)); START(CHIL, $$) } no_std_subs @@ -941,7 +964,7 @@ fam_chil_sect : OPEN DELIM TAG_CHIL mand_pointer fam_nchi_sect : OPEN DELIM TAG_NCHI mand_line_item { $$ = start_element(ELT_FAM_NCHI, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(NCHI, $$) } no_std_subs @@ -953,9 +976,12 @@ fam_nchi_sect : OPEN DELIM TAG_NCHI mand_line_item /* FAM.SUBM */ fam_subm_sect : OPEN DELIM TAG_SUBM mand_pointer - { $$ = start_element(ELT_FAM_SUBM, + { struct xref_value *xr = gedcom_parse_xref($4, XREF_USED, + XREF_SUBM); + if (xr == NULL) HANDLE_ERROR; + $$ = start_element(ELT_FAM_SUBM, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_XREF_PTR(val1, xr)); START(SUBM, $$) } no_std_subs @@ -969,9 +995,12 @@ fam_subm_sect : OPEN DELIM TAG_SUBM mand_pointer /**** Individual record ****/ /*********************************************************************/ indiv_rec : OPEN DELIM POINTER DELIM TAG_INDI - { $$ = start_record(REC_INDI, - $1, GEDCOM_MAKE_STRING($3), $5, - NULL, GEDCOM_MAKE_NULL()); + { struct xref_value *xr = gedcom_parse_xref($3, XREF_DEFINED, + XREF_INDI); + if (xr == NULL) HANDLE_ERROR; + $$ = start_record(REC_INDI, + $1, GEDCOM_MAKE_XREF_PTR(val1, xr), $5, + NULL, GEDCOM_MAKE_NULL(val2)); START(INDI, $$) } indi_subs { CHECK0 } @@ -1013,7 +1042,7 @@ indi_sub : indi_resn_sect { OCCUR2(RESN, 0, 1) } indi_resn_sect : OPEN DELIM TAG_RESN mand_line_item { $$ = start_element(ELT_INDI_RESN, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(RESN, $$) } no_std_subs @@ -1027,7 +1056,7 @@ indi_resn_sect : OPEN DELIM TAG_RESN mand_line_item indi_sex_sect : OPEN DELIM TAG_SEX mand_line_item { $$ = start_element(ELT_INDI_SEX, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(SEX, $$) } no_std_subs @@ -1039,9 +1068,12 @@ indi_sex_sect : OPEN DELIM TAG_SEX mand_line_item /* INDI.SUBM */ indi_subm_sect : OPEN DELIM TAG_SUBM mand_pointer - { $$ = start_element(ELT_INDI_SUBM, + { struct xref_value *xr = gedcom_parse_xref($4, XREF_USED, + XREF_SUBM); + if (xr == NULL) HANDLE_ERROR; + $$ = start_element(ELT_INDI_SUBM, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_XREF_PTR(val1, xr)); START(SUBM, $$) } no_std_subs @@ -1053,9 +1085,12 @@ indi_subm_sect : OPEN DELIM TAG_SUBM mand_pointer /* INDI.ALIA */ indi_alia_sect : OPEN DELIM TAG_ALIA mand_pointer - { $$ = start_element(ELT_INDI_ALIA, + { struct xref_value *xr = gedcom_parse_xref($4, XREF_USED, + XREF_INDI); + if (xr == NULL) HANDLE_ERROR; + $$ = start_element(ELT_INDI_ALIA, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_XREF_PTR(val1, xr)); START(ALIA, $$) } no_std_subs @@ -1067,9 +1102,12 @@ indi_alia_sect : OPEN DELIM TAG_ALIA mand_pointer /* INDI.ANCI */ indi_anci_sect : OPEN DELIM TAG_ANCI mand_pointer - { $$ = start_element(ELT_INDI_ANCI, + { struct xref_value *xr = gedcom_parse_xref($4, XREF_USED, + XREF_SUBM); + if (xr == NULL) HANDLE_ERROR; + $$ = start_element(ELT_INDI_ANCI, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_XREF_PTR(val1, xr)); START(ANCI, $$) } no_std_subs @@ -1081,9 +1119,12 @@ indi_anci_sect : OPEN DELIM TAG_ANCI mand_pointer /* INDI.DESI */ indi_desi_sect : OPEN DELIM TAG_DESI mand_pointer - { $$ = start_element(ELT_INDI_DESI, + { struct xref_value *xr = gedcom_parse_xref($4, XREF_USED, + XREF_SUBM); + if (xr == NULL) HANDLE_ERROR; + $$ = start_element(ELT_INDI_DESI, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_XREF_PTR(val1, xr)); START(DESI, $$) } no_std_subs @@ -1097,7 +1138,7 @@ indi_desi_sect : OPEN DELIM TAG_DESI mand_pointer indi_rfn_sect : OPEN DELIM TAG_RFN mand_line_item { $$ = start_element(ELT_INDI_RFN, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(RFN, $$) } no_std_subs @@ -1111,7 +1152,7 @@ indi_rfn_sect : OPEN DELIM TAG_RFN mand_line_item indi_afn_sect : OPEN DELIM TAG_AFN mand_line_item { $$ = start_element(ELT_INDI_AFN, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(AFN, $$) } no_std_subs @@ -1129,9 +1170,12 @@ ftree_addr_sect : OPEN DELIM TAG_ADDR opt_line_item /**** Multimedia record ****/ /*********************************************************************/ multim_rec : OPEN DELIM POINTER DELIM TAG_OBJE - { $$ = start_record(REC_OBJE, - $1, GEDCOM_MAKE_STRING($3), $5, - NULL, GEDCOM_MAKE_NULL()); + { struct xref_value *xr = gedcom_parse_xref($3, XREF_DEFINED, + XREF_OBJE); + if (xr == NULL) HANDLE_ERROR; + $$ = start_record(REC_OBJE, + $1, GEDCOM_MAKE_XREF_PTR(val1, xr), $5, + NULL, GEDCOM_MAKE_NULL(val2)); START(OBJE, $$) } obje_subs { CHECK2(FORM, BLOB) } @@ -1157,7 +1201,7 @@ obje_sub : obje_form_sect { OCCUR2(FORM, 1, 1) } obje_form_sect : OPEN DELIM TAG_FORM mand_line_item { $$ = start_element(ELT_OBJE_FORM, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(FORM, $$) } no_std_subs @@ -1171,7 +1215,7 @@ obje_form_sect : OPEN DELIM TAG_FORM mand_line_item obje_titl_sect : OPEN DELIM TAG_TITL mand_line_item { $$ = start_element(ELT_OBJE_TITL, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(TITL, $$) } no_std_subs @@ -1185,7 +1229,7 @@ obje_titl_sect : OPEN DELIM TAG_TITL mand_line_item obje_blob_sect : OPEN DELIM TAG_BLOB { $$ = start_element(ELT_OBJE_BLOB, PARENT, $1, $3, NULL, - GEDCOM_MAKE_NULL()); + GEDCOM_MAKE_NULL(val1)); START(BLOB, $$) } obje_blob_subs @@ -1206,7 +1250,7 @@ obje_blob_sub : obje_blob_cont_sect { OCCUR1(CONT, 1) } obje_blob_cont_sect : OPEN DELIM TAG_CONT mand_line_item { $$ = start_element(ELT_OBJE_BLOB_CONT, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(CONT, $$) } no_std_subs @@ -1219,9 +1263,12 @@ obje_blob_cont_sect : OPEN DELIM TAG_CONT mand_line_item /* OBJE.OBJE */ obje_obje_sect : OPEN DELIM TAG_OBJE mand_pointer - { $$ = start_element(ELT_OBJE_OBJE, + { struct xref_value *xr = gedcom_parse_xref($4, XREF_USED, + XREF_OBJE); + if (xr == NULL) HANDLE_ERROR; + $$ = start_element(ELT_OBJE_OBJE, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_XREF_PTR(val1, xr)); START(OBJE, $$) } no_std_subs @@ -1235,9 +1282,12 @@ obje_obje_sect : OPEN DELIM TAG_OBJE mand_pointer /**** Note record ****/ /*********************************************************************/ note_rec : OPEN DELIM POINTER DELIM TAG_NOTE note_line_item - { $$ = start_record(REC_NOTE, - $1, GEDCOM_MAKE_STRING($3), $5, - $6, GEDCOM_MAKE_STRING($6)); + { struct xref_value *xr = gedcom_parse_xref($3, XREF_DEFINED, + XREF_NOTE); + if (xr == NULL) HANDLE_ERROR; + $$ = start_record(REC_NOTE, + $1, GEDCOM_MAKE_XREF_PTR(val1, xr), $5, + $6, GEDCOM_MAKE_STRING(val2, $6)); START(NOTE, $$) } note_subs { CHECK0 } @@ -1249,6 +1299,9 @@ note_line_item : /* empty */ { if (!compat_mode(C_FTREE)) { gedcom_error(_("Missing value")); YYERROR; } + else { + $$ = ""; + } } | DELIM line_item { gedcom_debug_print("==Val: %s==", $2); @@ -1270,9 +1323,12 @@ note_sub : continuation_sub /* 0:M */ /**** Repository record ****/ /*********************************************************************/ repos_rec : OPEN DELIM POINTER DELIM TAG_REPO - { $$ = start_record(REC_REPO, - $1, GEDCOM_MAKE_STRING($3), $5, - NULL, GEDCOM_MAKE_NULL()); + { struct xref_value *xr = gedcom_parse_xref($3, XREF_DEFINED, + XREF_REPO); + if (xr == NULL) HANDLE_ERROR; + $$ = start_record(REC_REPO, + $1, GEDCOM_MAKE_XREF_PTR(val1, xr), $5, + NULL, GEDCOM_MAKE_NULL(val2)); START(REPO, $$) } repo_subs { CHECK0 } @@ -1296,7 +1352,7 @@ repo_sub : repo_name_sect { OCCUR2(NAME, 0, 1) } repo_name_sect : OPEN DELIM TAG_NAME mand_line_item { $$ = start_element(ELT_REPO_NAME, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(NAME, $$) } no_std_subs @@ -1310,9 +1366,12 @@ repo_name_sect : OPEN DELIM TAG_NAME mand_line_item /**** Source record ****/ /*********************************************************************/ source_rec : OPEN DELIM POINTER DELIM TAG_SOUR - { $$ = start_record(REC_SOUR, - $1, GEDCOM_MAKE_STRING($3), $5, - NULL, GEDCOM_MAKE_NULL()); + { struct xref_value *xr = gedcom_parse_xref($3, XREF_DEFINED, + XREF_SOUR); + if (xr == NULL) HANDLE_ERROR; + $$ = start_record(REC_SOUR, + $1, GEDCOM_MAKE_XREF_PTR(val1, xr), $5, + NULL, GEDCOM_MAKE_NULL(val2)); START(SOUR, $$) } sour_subs { CHECK0 } @@ -1342,7 +1401,7 @@ sour_sub : sour_data_sect { OCCUR2(DATA, 0, 1) } sour_data_sect : OPEN DELIM TAG_DATA { $$ = start_element(ELT_SOUR_DATA, PARENT, $1, $3, NULL, - GEDCOM_MAKE_NULL()); + GEDCOM_MAKE_NULL(val1)); START(DATA, $$) } sour_data_subs @@ -1365,7 +1424,7 @@ sour_data_sub : sour_data_even_sect /* 0:M */ sour_data_even_sect : OPEN DELIM TAG_EVEN mand_line_item { $$ = start_element(ELT_SOUR_DATA_EVEN, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(EVEN, $$) } sour_data_even_subs @@ -1387,9 +1446,10 @@ sour_data_even_sub : sour_data_even_date_sect { OCCUR2(DATE, 0, 1) } sour_data_even_date_sect : OPEN DELIM TAG_DATE mand_line_item { struct date_value dv = gedcom_parse_date($4); - $$ = start_element(ELT_SOUR_DATA_EVEN_DATE, - PARENT, $1, $3, $4, - GEDCOM_MAKE_DATE(dv)); + $$ + = start_element(ELT_SOUR_DATA_EVEN_DATE, + PARENT, $1, $3, $4, + GEDCOM_MAKE_DATE(val1, dv)); START(DATE, $$) } no_std_subs @@ -1401,9 +1461,10 @@ sour_data_even_date_sect : OPEN DELIM TAG_DATE mand_line_item ; sour_data_even_plac_sect : OPEN DELIM TAG_PLAC mand_line_item - { $$ = start_element(ELT_SOUR_DATA_EVEN_PLAC, - PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + { $$ + = start_element(ELT_SOUR_DATA_EVEN_PLAC, + PARENT, $1, $3, $4, + GEDCOM_MAKE_STRING(val1, $4)); START(PLAC, $$) } no_std_subs @@ -1417,7 +1478,7 @@ sour_data_even_plac_sect : OPEN DELIM TAG_PLAC mand_line_item sour_data_agnc_sect : OPEN DELIM TAG_AGNC mand_line_item { $$ = start_element(ELT_SOUR_DATA_AGNC, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(AGNC, $$) } no_std_subs @@ -1432,7 +1493,7 @@ sour_data_agnc_sect : OPEN DELIM TAG_AGNC mand_line_item sour_auth_sect : OPEN DELIM TAG_AUTH mand_line_item { $$ = start_element(ELT_SOUR_AUTH, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(AUTH, $$) } sour_auth_subs @@ -1454,7 +1515,7 @@ sour_auth_sub : continuation_sub /* 0:M */ sour_titl_sect : OPEN DELIM TAG_TITL mand_line_item { $$ = start_element(ELT_SOUR_TITL, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(TITL, $$) } sour_titl_subs @@ -1476,7 +1537,7 @@ sour_titl_sub : continuation_sub /* 0:M */ sour_abbr_sect : OPEN DELIM TAG_ABBR mand_line_item { $$ = start_element(ELT_SOUR_ABBR, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(ABBR, $$) } no_std_subs @@ -1490,7 +1551,7 @@ sour_abbr_sect : OPEN DELIM TAG_ABBR mand_line_item sour_publ_sect : OPEN DELIM TAG_PUBL mand_line_item { $$ = start_element(ELT_SOUR_PUBL, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(PUBL, $$) } sour_publ_subs @@ -1512,7 +1573,7 @@ sour_publ_sub : continuation_sub /* 0:M */ sour_text_sect : OPEN DELIM TAG_TEXT mand_line_item { $$ = start_element(ELT_SOUR_TEXT, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(TEXT, $$) } sour_text_subs @@ -1534,9 +1595,12 @@ sour_text_sub : continuation_sub /* 0:M */ /**** Submission record ****/ /*********************************************************************/ submis_rec : OPEN DELIM POINTER DELIM TAG_SUBN - { $$ = start_record(REC_SUBN, - $1, GEDCOM_MAKE_STRING($3), $5, - NULL, GEDCOM_MAKE_NULL()); + { struct xref_value *xr = gedcom_parse_xref($3, XREF_DEFINED, + XREF_SUBN); + if (xr == NULL) HANDLE_ERROR; + $$ = start_record(REC_SUBN, + $1, GEDCOM_MAKE_XREF_PTR(val1, xr), $5, + NULL, GEDCOM_MAKE_NULL(val2)); START(SUBN, $$) } subn_subs { CHECK0 } @@ -1560,9 +1624,12 @@ subn_sub : subn_subm_sect { OCCUR2(SUBM, 0, 1) } /* SUBN.SUBM */ subn_subm_sect : OPEN DELIM TAG_SUBM mand_pointer - { $$ = start_element(ELT_SUBN_SUBM, + { struct xref_value *xr = gedcom_parse_xref($4, XREF_USED, + XREF_SUBM); + if (xr == NULL) HANDLE_ERROR; + $$ = start_element(ELT_SUBN_SUBM, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_XREF_PTR(val1, xr)); START(SUBM, $$) } no_std_subs @@ -1576,7 +1643,7 @@ subn_subm_sect : OPEN DELIM TAG_SUBM mand_pointer subn_famf_sect : OPEN DELIM TAG_FAMF mand_line_item { $$ = start_element(ELT_SUBN_FAMF, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(FAMF, $$) } no_std_subs @@ -1590,7 +1657,7 @@ subn_famf_sect : OPEN DELIM TAG_FAMF mand_line_item subn_temp_sect : OPEN DELIM TAG_TEMP mand_line_item { $$ = start_element(ELT_SUBN_TEMP, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(TEMP, $$) } no_std_subs @@ -1604,7 +1671,7 @@ subn_temp_sect : OPEN DELIM TAG_TEMP mand_line_item subn_ance_sect : OPEN DELIM TAG_ANCE mand_line_item { $$ = start_element(ELT_SUBN_ANCE, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(ANCE, $$) } no_std_subs @@ -1618,7 +1685,7 @@ subn_ance_sect : OPEN DELIM TAG_ANCE mand_line_item subn_desc_sect : OPEN DELIM TAG_DESC mand_line_item { $$ = start_element(ELT_SUBN_DESC, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(DESC, $$) } no_std_subs @@ -1632,7 +1699,7 @@ subn_desc_sect : OPEN DELIM TAG_DESC mand_line_item subn_ordi_sect : OPEN DELIM TAG_ORDI mand_line_item { $$ = start_element(ELT_SUBN_ORDI, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(ORDI, $$) } no_std_subs @@ -1646,7 +1713,7 @@ subn_ordi_sect : OPEN DELIM TAG_ORDI mand_line_item subn_rin_sect : OPEN DELIM TAG_RIN mand_line_item { $$ = start_element(ELT_SUBN_RIN, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(RIN, $$) } no_std_subs @@ -1660,9 +1727,12 @@ subn_rin_sect : OPEN DELIM TAG_RIN mand_line_item /**** Submitter record ****/ /*********************************************************************/ submit_rec : OPEN DELIM POINTER DELIM TAG_SUBM - { $$ = start_record(REC_SUBM, - $1, GEDCOM_MAKE_STRING($3), $5, - NULL, GEDCOM_MAKE_NULL()); + { struct xref_value *xr = gedcom_parse_xref($3, XREF_DEFINED, + XREF_SUBM); + if (xr == NULL) HANDLE_ERROR; + $$ = start_record(REC_SUBM, + $1, GEDCOM_MAKE_XREF_PTR(val1, xr), $5, + NULL, GEDCOM_MAKE_NULL(val2)); START(SUBM, $$) } subm_subs { CHECK1(NAME) } @@ -1688,7 +1758,7 @@ subm_sub : subm_name_sect { OCCUR2(NAME, 0, 1) } subm_name_sect : OPEN DELIM TAG_NAME mand_line_item { $$ = start_element(ELT_SUBM_NAME, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(NAME, $$) } no_std_subs @@ -1702,7 +1772,7 @@ subm_name_sect : OPEN DELIM TAG_NAME mand_line_item subm_lang_sect : OPEN DELIM TAG_LANG mand_line_item { $$ = start_element(ELT_SUBM_LANG, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(LANG, $$) } no_std_subs @@ -1716,7 +1786,7 @@ subm_lang_sect : OPEN DELIM TAG_LANG mand_line_item subm_rfn_sect : OPEN DELIM TAG_RFN mand_line_item { $$ = start_element(ELT_SUBM_RFN, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(RFN, $$) } no_std_subs @@ -1730,7 +1800,7 @@ subm_rfn_sect : OPEN DELIM TAG_RFN mand_line_item subm_rin_sect : OPEN DELIM TAG_RIN mand_line_item { $$ = start_element(ELT_SUBM_RIN, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(RIN, $$) } no_std_subs @@ -1752,7 +1822,7 @@ addr_struc_sub : addr_sect { OCCUR2(ADDR, 0, 1) } addr_sect : OPEN DELIM TAG_ADDR mand_line_item { $$ = start_element(ELT_SUB_ADDR, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(ADDR, $$) } addr_subs @@ -1779,7 +1849,7 @@ addr_sub : addr_cont_sect /* 0:M */ addr_cont_sect : OPEN DELIM TAG_CONT mand_line_item { $$ = start_element(ELT_SUB_ADDR_CONT, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(CONT, $$) } no_std_subs @@ -1791,7 +1861,7 @@ addr_cont_sect : OPEN DELIM TAG_CONT mand_line_item addr_adr1_sect : OPEN DELIM TAG_ADR1 mand_line_item { $$ = start_element(ELT_SUB_ADDR_ADR1, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(ADR1, $$) } no_std_subs @@ -1803,7 +1873,7 @@ addr_adr1_sect : OPEN DELIM TAG_ADR1 mand_line_item addr_adr2_sect : OPEN DELIM TAG_ADR2 mand_line_item { $$ = start_element(ELT_SUB_ADDR_ADR2, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(ADR2, $$) } no_std_subs @@ -1815,7 +1885,7 @@ addr_adr2_sect : OPEN DELIM TAG_ADR2 mand_line_item addr_city_sect : OPEN DELIM TAG_CITY mand_line_item { $$ = start_element(ELT_SUB_ADDR_CITY, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(CITY, $$) } no_std_subs @@ -1827,7 +1897,7 @@ addr_city_sect : OPEN DELIM TAG_CITY mand_line_item addr_stae_sect : OPEN DELIM TAG_STAE mand_line_item { $$ = start_element(ELT_SUB_ADDR_STAE, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(STAE, $$) } no_std_subs @@ -1839,7 +1909,7 @@ addr_stae_sect : OPEN DELIM TAG_STAE mand_line_item addr_post_sect : OPEN DELIM TAG_POST mand_line_item { $$ = start_element(ELT_SUB_ADDR_POST, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(POST, $$) } no_std_subs @@ -1851,7 +1921,7 @@ addr_post_sect : OPEN DELIM TAG_POST mand_line_item addr_ctry_sect : OPEN DELIM TAG_CTRY mand_line_item { $$ = start_element(ELT_SUB_ADDR_CTRY, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(CTRY, $$) } no_std_subs @@ -1864,7 +1934,7 @@ addr_ctry_sect : OPEN DELIM TAG_CTRY mand_line_item phon_sect : OPEN DELIM TAG_PHON mand_line_item { $$ = start_element(ELT_SUB_PHON, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(PHON, $$) } no_std_subs @@ -1879,9 +1949,12 @@ assoc_struc_sub : asso_sect /* 0:M */ ; asso_sect : OPEN DELIM TAG_ASSO mand_pointer - { $$ = start_element(ELT_SUB_ASSO, + { struct xref_value *xr = gedcom_parse_xref($4, XREF_USED, + XREF_INDI); + if (xr == NULL) HANDLE_ERROR; + $$ = start_element(ELT_SUB_ASSO, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_XREF_PTR(val1, xr)); START(ASSO, $$) } asso_subs @@ -1902,7 +1975,7 @@ asso_subs : /* empty */ asso_type_sect : OPEN DELIM TAG_TYPE mand_line_item { $$ = start_element(ELT_SUB_ASSO_TYPE, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(TYPE, $$) } no_std_subs @@ -1915,7 +1988,7 @@ asso_type_sect : OPEN DELIM TAG_TYPE mand_line_item asso_rela_sect : OPEN DELIM TAG_RELA mand_line_item { $$ = start_element(ELT_SUB_ASSO_RELA, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(RELA, $$) } no_std_subs @@ -1932,7 +2005,7 @@ change_date_sub : change_date_chan_sect { OCCUR2(CHAN, 0, 1) } change_date_chan_sect : OPEN DELIM TAG_CHAN { $$ = start_element(ELT_SUB_CHAN, PARENT, $1, $3, NULL, - GEDCOM_MAKE_NULL()); + GEDCOM_MAKE_NULL(val1)); START(CHAN, $$) } change_date_chan_subs @@ -1955,7 +2028,7 @@ change_date_date_sect : OPEN DELIM TAG_DATE mand_line_item { struct date_value dv = gedcom_parse_date($4); $$ = start_element(ELT_SUB_CHAN_DATE, PARENT, $1, $3, $4, - GEDCOM_MAKE_DATE(dv)); + GEDCOM_MAKE_DATE(val1, dv)); START(DATE, $$) } change_date_date_subs { CHECK0 } @@ -1977,7 +2050,7 @@ change_date_date_time_sect : OPEN DELIM TAG_TIME mand_line_item { $$ = start_element(ELT_SUB_CHAN_TIME, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(TIME, $$) } no_std_subs @@ -1993,9 +2066,12 @@ chi_fam_link_sub : famc_sect /* 0:M */ ; famc_sect : OPEN DELIM TAG_FAMC mand_pointer - { $$ = start_element(ELT_SUB_FAMC, + { struct xref_value *xr = gedcom_parse_xref($4, XREF_USED, + XREF_FAM); + if (xr == NULL) HANDLE_ERROR; + $$ = start_element(ELT_SUB_FAMC, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_XREF_PTR(val1, xr)); START(FAMC, $$) } famc_subs @@ -2017,7 +2093,7 @@ famc_sub : famc_pedi_sect /* 0:M */ famc_pedi_sect : OPEN DELIM TAG_PEDI mand_line_item { $$ = start_element(ELT_SUB_FAMC_PEDI, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(PEDI, $$) } no_std_subs @@ -2035,7 +2111,7 @@ continuation_sub : cont_sect /* 0:M */ cont_sect : OPEN DELIM TAG_CONT mand_line_item { $$ = start_element(ELT_SUB_CONT, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(CONT, $$) } no_std_subs @@ -2048,7 +2124,7 @@ cont_sect : OPEN DELIM TAG_CONT mand_line_item conc_sect : OPEN DELIM TAG_CONC mand_line_item { $$ = start_element(ELT_SUB_CONC, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(CONC, $$) } no_std_subs @@ -2072,9 +2148,10 @@ event_detail_sub : event_detail_type_sect { OCCUR2(TYPE, 0, 1) } ; event_detail_type_sect : OPEN DELIM TAG_TYPE mand_line_item - { $$ = start_element(ELT_SUB_EVT_TYPE, - PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + { $$ + = start_element(ELT_SUB_EVT_TYPE, + PARENT, $1, $3, $4, + GEDCOM_MAKE_STRING(val1, $4)); START(TYPE, $$) } no_std_subs @@ -2086,9 +2163,10 @@ event_detail_type_sect : OPEN DELIM TAG_TYPE mand_line_item ; event_detail_date_sect : OPEN DELIM TAG_DATE mand_line_item { struct date_value dv = gedcom_parse_date($4); - $$ = start_element(ELT_SUB_EVT_DATE, - PARENT, $1, $3, $4, - GEDCOM_MAKE_DATE(dv)); + $$ + = start_element(ELT_SUB_EVT_DATE, + PARENT, $1, $3, $4, + GEDCOM_MAKE_DATE(val1, dv)); START(DATE, $$) } no_std_subs @@ -2099,9 +2177,10 @@ event_detail_date_sect : OPEN DELIM TAG_DATE mand_line_item } ; event_detail_age_sect : OPEN DELIM TAG_AGE mand_line_item - { $$ = start_element(ELT_SUB_EVT_AGE, - PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + { $$ + = start_element(ELT_SUB_EVT_AGE, + PARENT, $1, $3, $4, + GEDCOM_MAKE_STRING(val1, $4)); START(AGE, $$) } no_std_subs @@ -2112,9 +2191,10 @@ event_detail_age_sect : OPEN DELIM TAG_AGE mand_line_item } ; event_detail_agnc_sect : OPEN DELIM TAG_AGNC mand_line_item - { $$ = start_element(ELT_SUB_EVT_AGNC, - PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + { $$ + = start_element(ELT_SUB_EVT_AGNC, + PARENT, $1, $3, $4, + GEDCOM_MAKE_STRING(val1, $4)); START(AGNC, $$) } no_std_subs @@ -2125,9 +2205,10 @@ event_detail_agnc_sect : OPEN DELIM TAG_AGNC mand_line_item } ; event_detail_caus_sect : OPEN DELIM TAG_CAUS mand_line_item - { $$ = start_element(ELT_SUB_EVT_CAUS, - PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + { $$ + = start_element(ELT_SUB_EVT_CAUS, + PARENT, $1, $3, $4, + GEDCOM_MAKE_STRING(val1, $4)); START(CAUS, $$) } no_std_subs @@ -2144,10 +2225,10 @@ fam_event_struc_sub : fam_event_sect ; fam_event_sect : OPEN DELIM fam_event_tag opt_value - { - $$ = start_element(ELT_SUB_FAM_EVT, - PARENT, $1, $3, $4, - GEDCOM_MAKE_NULL_OR_STRING($4)); + { $$ + = start_element(ELT_SUB_FAM_EVT, + PARENT, $1, $3, $4, + GEDCOM_MAKE_NULL_OR_STRING(val1, $4)); START2($$); } fam_event_subs @@ -2182,7 +2263,7 @@ fam_event_sub : event_detail_sub fam_even_husb_sect : OPEN DELIM TAG_HUSB { $$ = start_element(ELT_SUB_FAM_EVT_HUSB, PARENT, $1, $3, NULL, - GEDCOM_MAKE_NULL()); + GEDCOM_MAKE_NULL(val1)); START(HUSB, $$) } fam_even_husb_subs @@ -2204,7 +2285,7 @@ fam_even_husb_sub : fam_even_age_sect { OCCUR2(AGE, 1, 1) } fam_even_age_sect : OPEN DELIM TAG_AGE mand_line_item { $$ = start_element(ELT_SUB_FAM_EVT_AGE, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(AGE, $$) } no_std_subs @@ -2218,7 +2299,7 @@ fam_even_age_sect : OPEN DELIM TAG_AGE mand_line_item fam_even_wife_sect : OPEN DELIM TAG_WIFE { $$ = start_element(ELT_SUB_FAM_EVT_WIFE, PARENT, $1, $3, NULL, - GEDCOM_MAKE_NULL()); + GEDCOM_MAKE_NULL(val1)); START(WIFE, $$) } fam_even_husb_subs @@ -2232,7 +2313,7 @@ fam_even_wife_sect : OPEN DELIM TAG_WIFE fam_gen_even_sect : OPEN DELIM TAG_EVEN { $$ = start_element(ELT_SUB_FAM_EVT_EVEN, PARENT, $1, $3, NULL, - GEDCOM_MAKE_NULL()); + GEDCOM_MAKE_NULL(val1)); START(EVEN, $$) } fam_gen_even_subs @@ -2261,7 +2342,7 @@ ident_struc_sub : ident_refn_sect /* 0:M */ ident_refn_sect : OPEN DELIM TAG_REFN mand_line_item { $$ = start_element(ELT_SUB_IDENT_REFN, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(REFN, $$) } ident_refn_subs @@ -2281,9 +2362,10 @@ ident_refn_sub : ident_refn_type_sect { OCCUR2(TYPE, 0, 1) } ; ident_refn_type_sect : OPEN DELIM TAG_TYPE mand_line_item - { $$ = start_element(ELT_SUB_IDENT_REFN_TYPE, - PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + { $$ + = start_element(ELT_SUB_IDENT_REFN_TYPE, + PARENT, $1, $3, $4, + GEDCOM_MAKE_STRING(val1, $4)); START(TYPE, $$) } no_std_subs @@ -2297,7 +2379,7 @@ ident_refn_type_sect : OPEN DELIM TAG_TYPE mand_line_item ident_rin_sect : OPEN DELIM TAG_RIN mand_line_item { $$ = start_element(ELT_SUB_IDENT_RIN, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(RIN, $$) } no_std_subs @@ -2316,7 +2398,7 @@ indiv_attr_struc_sub : indiv_attr_sect /* 0:M */ indiv_attr_sect : OPEN DELIM indiv_attr_tag mand_line_item { $$ = start_element(ELT_SUB_INDIV_ATTR, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START2($$); } indiv_attr_event_subs @@ -2341,7 +2423,7 @@ indiv_attr_tag : TAG_CAST { $$ = $1; START1(CAST) } indiv_resi_sect : OPEN DELIM TAG_RESI { $$ = start_element(ELT_SUB_INDIV_RESI, PARENT, $1, $3, NULL, - GEDCOM_MAKE_NULL()); + GEDCOM_MAKE_NULL(val1)); START(RESI, $$) } indiv_attr_event_subs @@ -2367,9 +2449,10 @@ indiv_even_struc_sub : indiv_birt_sect ; indiv_birt_sect : OPEN DELIM indiv_birt_tag opt_value - { $$ = start_element(ELT_SUB_INDIV_BIRT, - PARENT, $1, $3, $4, - GEDCOM_MAKE_NULL_OR_STRING($4)); + { $$ + = start_element(ELT_SUB_INDIV_BIRT, + PARENT, $1, $3, $4, + GEDCOM_MAKE_NULL_OR_STRING(val1, $4)); START2($$); } indiv_birt_subs @@ -2393,9 +2476,14 @@ indiv_birt_sub : event_detail_sub ; indiv_birt_famc_sect : OPEN DELIM TAG_FAMC mand_pointer - { $$ = start_element(ELT_SUB_INDIV_BIRT_FAMC, - PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + { struct xref_value *xr = gedcom_parse_xref($4, + XREF_USED, + XREF_FAM); + if (xr == NULL) HANDLE_ERROR; + $$ + = start_element(ELT_SUB_INDIV_BIRT_FAMC, + PARENT, $1, $3, $4, + GEDCOM_MAKE_XREF_PTR(val1, xr)); START(FAMC, $$) } no_std_subs @@ -2407,9 +2495,10 @@ indiv_birt_famc_sect : OPEN DELIM TAG_FAMC mand_pointer ; indiv_gen_sect : OPEN DELIM indiv_gen_tag opt_value - { $$ = start_element(ELT_SUB_INDIV_GEN, - PARENT, $1, $3, $4, - GEDCOM_MAKE_NULL_OR_STRING($4)); + { $$ + = start_element(ELT_SUB_INDIV_GEN, + PARENT, $1, $3, $4, + GEDCOM_MAKE_NULL_OR_STRING(val1, $4)); START2($$); } indiv_gen_subs @@ -2449,9 +2538,10 @@ indiv_gen_sub : event_detail_sub ; indiv_adop_sect : OPEN DELIM TAG_ADOP opt_value - { $$ = start_element(ELT_SUB_INDIV_ADOP, - PARENT, $1, $3, $4, - GEDCOM_MAKE_NULL_OR_STRING($4)); + { $$ + = start_element(ELT_SUB_INDIV_ADOP, + PARENT, $1, $3, $4, + GEDCOM_MAKE_NULL_OR_STRING(val1, $4)); START(ADOP, $$) } indiv_adop_subs { CHECK0 } @@ -2470,9 +2560,14 @@ indiv_adop_sub : event_detail_sub ; indiv_adop_famc_sect : OPEN DELIM TAG_FAMC mand_pointer - { $$ = start_element(ELT_SUB_INDIV_ADOP_FAMC, - PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + { struct xref_value *xr = gedcom_parse_xref($4, + XREF_USED, + XREF_FAM); + if (xr == NULL) HANDLE_ERROR; + $$ + = start_element(ELT_SUB_INDIV_ADOP_FAMC, + PARENT, $1, $3, $4, + GEDCOM_MAKE_XREF_PTR(val1, xr)); START(FAMC, $$) } indiv_adop_famc_subs { CHECK0 } @@ -2494,7 +2589,7 @@ indiv_adop_famc_adop_sect : OPEN DELIM TAG_ADOP mand_line_item { $$ = start_element(ELT_SUB_INDIV_ADOP_FAMC_ADOP, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(ADOP, $$) } no_std_subs { CHECK0 } @@ -2507,7 +2602,7 @@ indiv_adop_famc_adop_sect : OPEN DELIM TAG_ADOP mand_line_item indiv_even_sect : OPEN DELIM TAG_EVEN { $$ = start_element(ELT_SUB_INDIV_EVEN, PARENT, $1, $3, NULL, - GEDCOM_MAKE_NULL()); + GEDCOM_MAKE_NULL(val1)); START(EVEN, $$) } indiv_gen_subs { CHECK0 } @@ -2524,7 +2619,7 @@ lds_indiv_ord_sub : lio_bapl_sect /* 0:M */ lio_bapl_sect : OPEN DELIM lio_bapl_tag { $$ = start_element(ELT_SUB_LIO_BAPL, PARENT, $1, $3, NULL, - GEDCOM_MAKE_NULL()); + GEDCOM_MAKE_NULL(val1)); START2($$); } lio_bapl_subs @@ -2555,7 +2650,7 @@ lio_bapl_sub : lio_bapl_stat_sect { OCCUR2(STAT, 0, 1) } lio_bapl_stat_sect : OPEN DELIM TAG_STAT mand_line_item { $$ = start_element(ELT_SUB_LIO_BAPL_STAT, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(STAT, $$) } no_std_subs @@ -2569,7 +2664,7 @@ lio_bapl_date_sect : OPEN DELIM TAG_DATE mand_line_item { struct date_value dv = gedcom_parse_date($4); $$ = start_element(ELT_SUB_LIO_BAPL_DATE, PARENT, $1, $3, $4, - GEDCOM_MAKE_DATE(dv)); + GEDCOM_MAKE_DATE(val1, dv)); START(DATE, $$) } no_std_subs @@ -2582,7 +2677,7 @@ lio_bapl_date_sect : OPEN DELIM TAG_DATE mand_line_item lio_bapl_temp_sect : OPEN DELIM TAG_TEMP mand_line_item { $$ = start_element(ELT_SUB_LIO_BAPL_TEMP, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(TEMP, $$) } no_std_subs @@ -2595,7 +2690,7 @@ lio_bapl_temp_sect : OPEN DELIM TAG_TEMP mand_line_item lio_bapl_plac_sect : OPEN DELIM TAG_PLAC mand_line_item { $$ = start_element(ELT_SUB_LIO_BAPL_PLAC, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(PLAC, $$) } no_std_subs @@ -2609,7 +2704,7 @@ lio_bapl_plac_sect : OPEN DELIM TAG_PLAC mand_line_item lio_slgc_sect : OPEN DELIM TAG_SLGC { $$ = start_element(ELT_SUB_LIO_SLGC, PARENT, $1, $3, NULL, - GEDCOM_MAKE_NULL()); + GEDCOM_MAKE_NULL(val1)); START(SLGC, $$) } lio_slgc_subs @@ -2628,9 +2723,13 @@ lio_slgc_sub : lio_bapl_sub ; lio_slgc_famc_sect : OPEN DELIM TAG_FAMC mand_pointer - { $$ = start_element(ELT_SUB_LIO_SLGC_FAMC, - PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + { struct xref_value *xr = gedcom_parse_xref($4, XREF_USED, + XREF_FAM); + if (xr == NULL) HANDLE_ERROR; + $$ + = start_element(ELT_SUB_LIO_SLGC_FAMC, + PARENT, $1, $3, $4, + GEDCOM_MAKE_XREF_PTR(val1, xr)); START(FAMC, $$) } no_std_subs @@ -2648,7 +2747,7 @@ lds_spouse_seal_sub : lss_slgs_sect lss_slgs_sect : OPEN DELIM TAG_SLGS { $$ = start_element(ELT_SUB_LSS_SLGS, PARENT, $1, $3, NULL, - GEDCOM_MAKE_NULL()); + GEDCOM_MAKE_NULL(val1)); START(SLGS, $$) } lss_slgs_subs { CHECK0 } @@ -2673,7 +2772,7 @@ lss_slgs_sub : lss_slgs_stat_sect { OCCUR2(STAT, 0, 1) } lss_slgs_stat_sect : OPEN DELIM TAG_STAT mand_line_item { $$ = start_element(ELT_SUB_LSS_SLGS_STAT, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(STAT, $$) } no_std_subs @@ -2687,7 +2786,7 @@ lss_slgs_date_sect : OPEN DELIM TAG_DATE mand_line_item { struct date_value dv = gedcom_parse_date($4); $$ = start_element(ELT_SUB_LSS_SLGS_DATE, PARENT, $1, $3, $4, - GEDCOM_MAKE_DATE(dv)); + GEDCOM_MAKE_DATE(val1, dv)); START(DATE, $$) } no_std_subs @@ -2700,7 +2799,7 @@ lss_slgs_date_sect : OPEN DELIM TAG_DATE mand_line_item lss_slgs_temp_sect : OPEN DELIM TAG_TEMP mand_line_item { $$ = start_element(ELT_SUB_LSS_SLGS_TEMP, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(TEMP, $$) } no_std_subs @@ -2713,7 +2812,7 @@ lss_slgs_temp_sect : OPEN DELIM TAG_TEMP mand_line_item lss_slgs_plac_sect : OPEN DELIM TAG_PLAC mand_line_item { $$ = start_element(ELT_SUB_LSS_SLGS_PLAC, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(PLAC, $$) } no_std_subs @@ -2730,9 +2829,14 @@ multim_link_sub : multim_obje_link_sect ; multim_obje_link_sect : OPEN DELIM TAG_OBJE DELIM POINTER - { $$ = start_element(ELT_SUB_MULTIM_OBJE, - PARENT, $1, $3, $5, - GEDCOM_MAKE_STRING($5)); + { struct xref_value *xr = gedcom_parse_xref($5, + XREF_USED, + XREF_OBJE); + if (xr == NULL) HANDLE_ERROR; + $$ + = start_element(ELT_SUB_MULTIM_OBJE, + PARENT, $1, $3, $5, + GEDCOM_MAKE_XREF_PTR(val1, xr)); START(OBJE, $$) } no_std_subs @@ -2746,7 +2850,7 @@ multim_obje_link_sect : OPEN DELIM TAG_OBJE DELIM POINTER multim_obje_emb_sect : OPEN DELIM TAG_OBJE { $$ = start_element(ELT_SUB_MULTIM_OBJE, PARENT, $1, $3, NULL, - GEDCOM_MAKE_NULL()); + GEDCOM_MAKE_NULL(val1)); START(OBJE, $$) } multim_obje_emb_subs @@ -2769,9 +2873,10 @@ multim_obje_emb_sub : multim_obje_form_sect { OCCUR2(FORM, 1, 1) } ; multim_obje_form_sect : OPEN DELIM TAG_FORM mand_line_item - { $$ = start_element(ELT_SUB_MULTIM_OBJE_FORM, - PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + { $$ + = start_element(ELT_SUB_MULTIM_OBJE_FORM, + PARENT, $1, $3, $4, + GEDCOM_MAKE_STRING(val1, $4)); START(FORM, $$) } no_std_subs @@ -2782,9 +2887,10 @@ multim_obje_form_sect : OPEN DELIM TAG_FORM mand_line_item } ; multim_obje_titl_sect : OPEN DELIM TAG_TITL mand_line_item - { $$ = start_element(ELT_SUB_MULTIM_OBJE_TITL, - PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + { $$ + = start_element(ELT_SUB_MULTIM_OBJE_TITL, + PARENT, $1, $3, $4, + GEDCOM_MAKE_STRING(val1, $4)); START(TITL, $$) } no_std_subs @@ -2795,9 +2901,10 @@ multim_obje_titl_sect : OPEN DELIM TAG_TITL mand_line_item } ; multim_obje_file_sect : OPEN DELIM TAG_FILE mand_line_item - { $$ = start_element(ELT_SUB_MULTIM_OBJE_FILE, - PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + { $$ + = start_element(ELT_SUB_MULTIM_OBJE_FILE, + PARENT, $1, $3, $4, + GEDCOM_MAKE_STRING(val1, $4)); START(FILE, $$) } no_std_subs @@ -2814,9 +2921,14 @@ note_struc_sub : note_struc_link_sect /* 0:M */ ; note_struc_link_sect : OPEN DELIM TAG_NOTE DELIM POINTER - { $$ = start_element(ELT_SUB_NOTE, - PARENT, $1, $3, $5, - GEDCOM_MAKE_STRING($5)); + { struct xref_value *xr = gedcom_parse_xref($5, + XREF_USED, + XREF_NOTE); + if (xr == NULL) HANDLE_ERROR; + $$ + = start_element(ELT_SUB_NOTE, + PARENT, $1, $3, $5, + GEDCOM_MAKE_XREF_PTR(val1, xr)); START(NOTE, $$) } note_struc_link_subs @@ -2838,7 +2950,7 @@ note_struc_emb_sect : OPEN DELIM TAG_NOTE opt_line_item { $$ = start_element(ELT_SUB_NOTE, PARENT, $1, $3, $4, - GEDCOM_MAKE_NULL_OR_STRING($4)); + GEDCOM_MAKE_NULL_OR_STRING(val1, $4)); START(NOTE, $$) } note_struc_emb_subs @@ -2864,7 +2976,7 @@ pers_name_struc_sub : pers_name_sect /* 0:M */ pers_name_sect : OPEN DELIM TAG_NAME mand_line_item { $$ = start_element(ELT_SUB_PERS_NAME, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(NAME, $$) } pers_name_subs @@ -2892,7 +3004,7 @@ pers_name_sub : pers_name_npfx_sect { OCCUR2(NPFX, 0, 1) } pers_name_npfx_sect : OPEN DELIM TAG_NPFX mand_line_item { $$ = start_element(ELT_SUB_PERS_NAME_NPFX, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(NPFX, $$) } no_std_subs @@ -2905,7 +3017,7 @@ pers_name_npfx_sect : OPEN DELIM TAG_NPFX mand_line_item pers_name_givn_sect : OPEN DELIM TAG_GIVN mand_line_item { $$ = start_element(ELT_SUB_PERS_NAME_GIVN, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(GIVN, $$) } no_std_subs @@ -2918,7 +3030,7 @@ pers_name_givn_sect : OPEN DELIM TAG_GIVN mand_line_item pers_name_nick_sect : OPEN DELIM TAG_NICK mand_line_item { $$ = start_element(ELT_SUB_PERS_NAME_NICK, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(NICK, $$) } no_std_subs @@ -2931,7 +3043,7 @@ pers_name_nick_sect : OPEN DELIM TAG_NICK mand_line_item pers_name_spfx_sect : OPEN DELIM TAG_SPFX mand_line_item { $$ = start_element(ELT_SUB_PERS_NAME_SPFX, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(SPFX, $$) } no_std_subs @@ -2944,7 +3056,7 @@ pers_name_spfx_sect : OPEN DELIM TAG_SPFX mand_line_item pers_name_surn_sect : OPEN DELIM TAG_SURN mand_line_item { $$ = start_element(ELT_SUB_PERS_NAME_SURN, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(SURN, $$) } no_std_subs @@ -2957,7 +3069,7 @@ pers_name_surn_sect : OPEN DELIM TAG_SURN mand_line_item pers_name_nsfx_sect : OPEN DELIM TAG_NSFX mand_line_item { $$ = start_element(ELT_SUB_PERS_NAME_NSFX, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(NSFX, $$) } no_std_subs @@ -2973,9 +3085,10 @@ place_struc_sub : place_struc_plac_sect /* 0:M */ ; place_struc_plac_sect : OPEN DELIM TAG_PLAC mand_line_item - { $$ = start_element(ELT_SUB_PLAC, - PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + { $$ + = start_element(ELT_SUB_PLAC, + PARENT, $1, $3, $4, + GEDCOM_MAKE_STRING(val1, $4)); START(PLAC, $$) } place_struc_plac_subs @@ -2996,9 +3109,10 @@ place_struc_plac_sub : place_plac_form_sect { OCCUR2(FORM, 0, 1) } ; place_plac_form_sect : OPEN DELIM TAG_FORM mand_line_item - { $$ = start_element(ELT_SUB_PLAC_FORM, - PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + { $$ + = start_element(ELT_SUB_PLAC_FORM, + PARENT, $1, $3, $4, + GEDCOM_MAKE_STRING(val1, $4)); START(FORM, $$) } no_std_subs @@ -3015,9 +3129,14 @@ source_cit_sub : source_cit_link_sect /* 0:M */ ; source_cit_link_sect : OPEN DELIM TAG_SOUR DELIM POINTER - { $$ = start_element(ELT_SUB_SOUR, - PARENT, $1, $3, $5, - GEDCOM_MAKE_STRING($5)); + { struct xref_value *xr = gedcom_parse_xref($5, + XREF_USED, + XREF_SOUR); + if (xr == NULL) HANDLE_ERROR; + $$ + = start_element(ELT_SUB_SOUR, + PARENT, $1, $3, $5, + GEDCOM_MAKE_XREF_PTR(val1, xr)); START(SOUR, $$) } source_cit_link_subs @@ -3041,9 +3160,10 @@ source_cit_link_sub : source_cit_page_sect { OCCUR2(PAGE, 0, 1) } ; source_cit_page_sect : OPEN DELIM TAG_PAGE mand_line_item - { $$ = start_element(ELT_SUB_SOUR_PAGE, - PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + { $$ + = start_element(ELT_SUB_SOUR_PAGE, + PARENT, $1, $3, $4, + GEDCOM_MAKE_STRING(val1, $4)); START(PAGE, $$) } no_std_subs @@ -3055,9 +3175,10 @@ source_cit_page_sect : OPEN DELIM TAG_PAGE mand_line_item ; source_cit_even_sect : OPEN DELIM TAG_EVEN mand_line_item - { $$ = start_element(ELT_SUB_SOUR_EVEN, - PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + { $$ + = start_element(ELT_SUB_SOUR_EVEN, + PARENT, $1, $3, $4, + GEDCOM_MAKE_STRING(val1, $4)); START(EVEN, $$) } source_cit_even_subs @@ -3077,9 +3198,10 @@ source_cit_even_sub : source_cit_even_role_sect { OCCUR2(ROLE, 0, 1) } ; source_cit_even_role_sect : OPEN DELIM TAG_ROLE mand_line_item - { $$ = start_element(ELT_SUB_SOUR_EVEN_ROLE, - PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + { $$ + = start_element(ELT_SUB_SOUR_EVEN_ROLE, + PARENT, $1, $3, $4, + GEDCOM_MAKE_STRING(val1, $4)); START(ROLE, $$) } no_std_subs @@ -3093,7 +3215,7 @@ source_cit_even_role_sect : OPEN DELIM TAG_ROLE mand_line_item source_cit_data_sect : OPEN DELIM TAG_DATA { $$ = start_element(ELT_SUB_SOUR_DATA, PARENT, $1, $3, NULL, - GEDCOM_MAKE_NULL()); + GEDCOM_MAKE_NULL(val1)); START(DATA, $$) } source_cit_data_subs @@ -3115,9 +3237,10 @@ source_cit_data_sub : source_cit_data_date_sect { OCCUR2(DATE, 0, 1) } source_cit_data_date_sect : OPEN DELIM TAG_DATE mand_line_item { struct date_value dv = gedcom_parse_date($4); - $$ = start_element(ELT_SUB_SOUR_DATA_DATE, - PARENT, $1, $3, $4, - GEDCOM_MAKE_DATE(dv)); + $$ + = start_element(ELT_SUB_SOUR_DATA_DATE, + PARENT, $1, $3, $4, + GEDCOM_MAKE_DATE(val1, dv)); START(DATE, $$) } no_std_subs @@ -3129,9 +3252,10 @@ source_cit_data_date_sect : OPEN DELIM TAG_DATE mand_line_item ; source_cit_text_sect : OPEN DELIM TAG_TEXT mand_line_item - { $$ = start_element(ELT_SUB_SOUR_TEXT, - PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + { $$ + = start_element(ELT_SUB_SOUR_TEXT, + PARENT, $1, $3, $4, + GEDCOM_MAKE_STRING(val1, $4)); START(TEXT, $$) } source_cit_text_subs @@ -3151,9 +3275,10 @@ source_cit_text_sub : continuation_sub ; source_cit_quay_sect : OPEN DELIM TAG_QUAY mand_line_item - { $$ = start_element(ELT_SUB_SOUR_QUAY, - PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + { $$ + = start_element(ELT_SUB_SOUR_QUAY, + PARENT, $1, $3, $4, + GEDCOM_MAKE_STRING(val1, $4)); START(QUAY, $$) } no_std_subs @@ -3167,7 +3292,7 @@ source_cit_quay_sect : OPEN DELIM TAG_QUAY mand_line_item source_cit_emb_sect : OPEN DELIM TAG_SOUR mand_line_item { $$ = start_element(ELT_SUB_SOUR, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(SOUR, $$) } source_cit_emb_subs @@ -3192,9 +3317,13 @@ source_repos_cit_sub : source_repos_repo_sect { OCCUR2(REPO, 0, 1) } ; source_repos_repo_sect : OPEN DELIM TAG_REPO mand_pointer - { $$ = start_element(ELT_SUB_REPO, - PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + { struct xref_value *xr + = gedcom_parse_xref($4, XREF_USED, XREF_REPO); + if (xr == NULL) HANDLE_ERROR; + $$ + = start_element(ELT_SUB_REPO, + PARENT, $1, $3, $4, + GEDCOM_MAKE_XREF_PTR(val1, xr)); START(REPO, $$) } source_repos_repo_subs @@ -3216,7 +3345,7 @@ source_repos_repo_sub : note_struc_sub caln_sect : OPEN DELIM TAG_CALN mand_line_item { $$ = start_element(ELT_SUB_REPO_CALN, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(CALN, $$) } caln_subs @@ -3237,7 +3366,7 @@ caln_sub : caln_medi_sect { OCCUR2(MEDI, 0, 1) } caln_medi_sect : OPEN DELIM TAG_MEDI mand_line_item { $$ = start_element(ELT_SUB_REPO_CALN_MEDI, PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + GEDCOM_MAKE_STRING(val1, $4)); START(MEDI, $$) } no_std_subs @@ -3252,9 +3381,13 @@ spou_fam_link_sub : spou_fam_fams_sect /* 0:M */ ; spou_fam_fams_sect : OPEN DELIM TAG_FAMS mand_pointer - { $$ = start_element(ELT_SUB_FAMS, - PARENT, $1, $3, $4, - GEDCOM_MAKE_STRING($4)); + { struct xref_value *xr = gedcom_parse_xref($4, XREF_USED, + XREF_FAM); + if (xr == NULL) HANDLE_ERROR; + $$ + = start_element(ELT_SUB_FAMS, + PARENT, $1, $3, $4, + GEDCOM_MAKE_XREF_PTR(val1, xr)); START(FAMS, $$) } spou_fam_fams_subs @@ -3298,9 +3431,15 @@ user_rec : OPEN DELIM opt_xref USERTAG } } opt_value - { $$ = start_record(REC_USER, - $1, GEDCOM_MAKE_NULL_OR_STRING($3), $4, - $6, GEDCOM_MAKE_NULL_OR_STRING($6)); + { struct xref_value *xr = NULL; + if ($3 != NULL) { + xr = gedcom_parse_xref($3, XREF_DEFINED, XREF_USER); + if (xr == NULL) HANDLE_ERROR; + } + $$ = start_record(REC_USER, + $1, + GEDCOM_MAKE_NULL_OR_XREF_PTR(val1, xr), + $4, $6, &val2); START($4, $$) } user_sects @@ -3316,8 +3455,7 @@ user_sect : OPEN DELIM opt_xref USERTAG } } opt_value - { $$ = start_element(ELT_USER, PARENT, $1, $4, $6, - GEDCOM_MAKE_NULL_OR_STRING($6)); + { $$ = start_element(ELT_USER, PARENT, $1, $4, $6, &val2); START($4, $$); } user_sects @@ -3335,12 +3473,15 @@ opt_xref : /* empty */ { $$ = NULL; } | POINTER DELIM { $$ = $1; } ; -opt_value : /* empty */ { $$ = NULL; } - | DELIM line_value { $$ = $2; } - ; - -line_value : POINTER { $$ = $1; } - | line_item { $$ = $1; } +opt_value : /* empty */ { GEDCOM_MAKE_NULL(val2); + $$ = NULL; } + | DELIM POINTER { struct xref_value *xr + = gedcom_parse_xref($2, XREF_USED, + XREF_USER); + GEDCOM_MAKE_XREF_PTR(val2, xr); + $$ = $2; } + | DELIM line_item { GEDCOM_MAKE_STRING(val2, $2); + $$ = $2; } ; mand_pointer : /* empty */ { gedcom_error(_("Missing pointer")); YYERROR; } diff --git a/gedcom/interface.c b/gedcom/interface.c index 152599a..74d2e91 100644 --- a/gedcom/interface.c +++ b/gedcom/interface.c @@ -97,7 +97,8 @@ void end_element(Gedcom_elt elt, Gedcom_ctxt parent, Gedcom_ctxt self, char* val_type_str[] = { N_("null value"), N_("character string"), - N_("date") }; + N_("date"), + N_("cross-reference") }; void gedcom_cast_error(char* file, int line, Gedcom_val_type tried_type, diff --git a/gedcom/multilex.c b/gedcom/multilex.c index cff8608..1899276 100644 --- a/gedcom/multilex.c +++ b/gedcom/multilex.c @@ -1,5 +1,5 @@ /* The lexer multiplexer for Gedcom. - Copyright (C) 2001 The Genes Development Team + Copyright (C) 2001,2002 The Genes Development Team This file is part of the Gedcom parser library. Contributed by Peter Verthez , 2001. @@ -24,6 +24,7 @@ #include "gedcom_internal.h" #include "multilex.h" #include "encoding.h" +#include "xref.h" int line_no; @@ -128,7 +129,10 @@ int gedcom_parse_file(char* file_name) if (lexer_init(enc, file)) { line_no = 1; + make_xref_table(); result = gedcom_parse(); + if (result == 0) + result = check_xref_table(); } lexer_close(); fclose(file); diff --git a/gedcom/xref.c b/gedcom/xref.c new file mode 100644 index 0000000..3c33909 --- /dev/null +++ b/gedcom/xref.c @@ -0,0 +1,156 @@ +/* Cross-reference manipulation routines. + Copyright (C) 2001,2002 The Genes Development Team + This file is part of the Gedcom parser library. + Contributed by Peter Verthez , 2001. + + The Gedcom parser library is free software; you can redistribute it + and/or modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The Gedcom parser library is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the Gedcom parser library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* $Id$ */ +/* $Name$ */ + +#include "gedcom_internal.h" +#include "xref.h" +#include "hash.h" + +struct xref_value def_xref_val = { XREF_NONE, "", NULL }; +static hash_t *xrefs = NULL; + +char* xref_type_str[] = { N_("nothing"), + N_("a family"), + N_("an individual"), + N_("a note"), + N_("a multimedia object"), + N_("a source repository"), + N_("a source"), + N_("a submitter"), + N_("a submission record"), + N_("an application-specific record"), + }; + +struct xref_node { + struct xref_value xref; + Xref_type defined_type; + Xref_type used_type; + int defined_line; + int used_line; +}; + +hnode_t *xref_alloc(void *c __attribute__((unused))) +{ + return malloc(sizeof *xref_alloc(NULL)); +} + +void xref_free(hnode_t *n, void *c __attribute__((unused))) +{ + struct xref_node *xr = (struct xref_node *)hnode_get(n); + free((void*)hnode_getkey(n)); + free(xr->xref.string); + free(xr); + free(n); +} + +struct xref_node *make_xref_node() +{ + struct xref_node *xr = (struct xref_node *)malloc(sizeof(struct xref_node)); + xr->xref.type = XREF_NONE; + xr->xref.string = NULL; + xr->xref.object = NULL; + xr->defined_type = XREF_NONE; + xr->used_type = XREF_NONE; + xr->defined_line = -1; + xr->used_line = -1; + return xr; +} + +void make_xref_table() +{ + xrefs = hash_create(HASHCOUNT_T_MAX, NULL, NULL); + hash_set_allocator(xrefs, xref_alloc, xref_free, NULL); +} + +int check_xref_table() +{ + int result = 0; + hscan_t hs; + hnode_t *node; + struct xref_node *xr; + + /* Check for undefined and unused xrefs */ + hash_scan_begin(&hs, xrefs); + while ((node = hash_scan_next(&hs))) { + xr = (struct xref_node *)hnode_get(node); + if (xr->defined_type == XREF_NONE && xr->used_type != XREF_NONE) { + gedcom_error(_("Cross-reference %s used on line %d is not defined"), + xr->xref.string, xr->used_line); + result |= 1; + } + if (xr->used_type == XREF_NONE && xr->defined_type != XREF_NONE) { + gedcom_warning(_("Cross-reference %s defined on line %d is never used"), + xr->xref.string, xr->defined_line); + } + } + + hash_free(xrefs); + return result; +} + +struct xref_value *gedcom_parse_xref(char *raw_value, + Xref_ctxt ctxt, Xref_type xref_type) +{ + struct xref_node *xr = NULL; + + hnode_t *node = hash_lookup(xrefs, raw_value); + if (node) { + xr = (struct xref_node *)hnode_get(node); + } + else { + char *key = strdup(raw_value); + xr = make_xref_node(); + xr->xref.type = xref_type; + xr->xref.string = strdup(raw_value); + hash_alloc_insert(xrefs, key, xr); + } + + if (ctxt == XREF_DEFINED && xr->defined_type == XREF_NONE) { + xr->defined_type = xref_type; + xr->defined_line = line_no; + } + else if (ctxt == XREF_USED && xr->used_type == XREF_NONE) { + xr->used_type = xref_type; + xr->used_line = line_no; + } + + if ((ctxt == XREF_DEFINED && xr->defined_type != xref_type) + || (ctxt == XREF_USED && + (xr->defined_type != XREF_NONE && xr->defined_type != xref_type))) { + gedcom_error(_("Cross-reference %s previously defined as pointer to %s, " + "on line %d"), + xr->xref.string, xref_type_str[xr->defined_type], + xr->defined_line); + return NULL; + } + + if ((ctxt == XREF_USED && xr->used_type != xref_type) + || (ctxt == XREF_DEFINED && + (xr->used_type != XREF_NONE && xr->used_type != xref_type))) { + gedcom_error(_("Cross-reference %s previously used as pointer to %s, " + "on line %d"), + xr->xref.string, xref_type_str[xr->used_type], xr->used_line); + return NULL; + } + + return &(xr->xref); +} diff --git a/gedcom/xref.h b/gedcom/xref.h new file mode 100644 index 0000000..a60a4ec --- /dev/null +++ b/gedcom/xref.h @@ -0,0 +1,48 @@ +/* Header for cross-reference manipulation routines. + Copyright (C) 2001,2002 The Genes Development Team + This file is part of the Gedcom parser library. + Contributed by Peter Verthez , 2001. + + The Gedcom parser library is free software; you can redistribute it + and/or modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The Gedcom parser library is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the Gedcom parser library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* $Id$ */ +/* $Name$ */ + +#ifndef __XREF_H +#define __XREF_H + +#include "gedcom.h" + +typedef enum _XREF_CTXT { + XREF_DEFINED, + XREF_USED +} Xref_ctxt; + +void make_xref_table(); +int check_xref_table(); + +struct xref_value *gedcom_parse_xref(char *raw_value, + Xref_ctxt ctxt, Xref_type type); + +#define GEDCOM_MAKE_XREF_PTR(VAR, XREF) \ + GEDCOM_MAKE(VAR, XREF, GV_XREF_PTR, xref_val) + +#define GEDCOM_MAKE_NULL_OR_XREF_PTR(VAR, XREF) \ + (XREF == NULL ? \ + GEDCOM_MAKE_NULL(VAR) : \ + GEDCOM_MAKE_XREF_PTR(VAR, XREF)) + +#endif /* __XREF_H */ diff --git a/include/gedcom.h b/include/gedcom.h index 495beb8..2b962da 100644 --- a/include/gedcom.h +++ b/include/gedcom.h @@ -313,6 +313,25 @@ struct date_value { /* Type for context handling, meant to be opaque */ typedef void* Gedcom_ctxt; +typedef enum _XREF_TYPE { + XREF_NONE, + XREF_FAM, + XREF_INDI, + XREF_NOTE, + XREF_OBJE, + XREF_REPO, + XREF_SOUR, + XREF_SUBM, + XREF_SUBN, + XREF_USER +} Xref_type; + +struct xref_value { + Xref_type type; + char *string; + Gedcom_ctxt object; +}; + /**************************************************************************/ /*** Things meant to be internal, susceptible to changes ***/ /*** Use the GEDCOM_STRING/GEDCOM_DATE interface instead of relying ***/ @@ -322,12 +341,14 @@ typedef void* Gedcom_ctxt; typedef enum _GEDCOM_VAL_TYPE { GV_NULL, GV_CHAR_PTR, - GV_DATE_VALUE + GV_DATE_VALUE, + GV_XREF_PTR } Gedcom_val_type; union _Gedcom_val_union { char* string_val; struct date_value date_val; + struct xref_value *xref_val; }; typedef struct _Gedcom_val_struct { @@ -340,6 +361,7 @@ void gedcom_cast_error(char* file, int line, Gedcom_val_type real_type); extern struct date_value def_date_val; +extern struct xref_value def_xref_val; #define GV_CHECK_CAST(VAL, TYPE, MEMBER, DEFVAL) \ ((VAL->type == TYPE) ? \ @@ -374,6 +396,13 @@ typedef Gedcom_val_struct* Gedcom_val; #define GEDCOM_IS_DATE(VAL) \ GV_IS_TYPE(VAL, GV_DATE_VALUE) +/* This returns the (struct xref_value *) from a Gedcom_val, if appropriate */ +/* It gives a gedcom_warning if the cast is not correct */ +#define GEDCOM_XREF_PTR(VAL) \ + GV_CHECK_CAST(VAL, GV_XREF_PTR, xref_val, &def_xref_val) +#define GEDCOM_IS_XREF_PTR(VAL) \ + GV_IS_TYPE(VAL, GV_XREF_PTR) + typedef void (*Gedcom_msg_handler) (Gedcom_msg_type type, char *msg); diff --git a/standalone.c b/standalone.c index f5d782b..70a3ac1 100644 --- a/standalone.c +++ b/standalone.c @@ -79,8 +79,10 @@ Gedcom_ctxt family_start(int level, Gedcom_val xref, char *tag, char *raw_value, int tag_value, Gedcom_val parsed_value) { - output(1, "Family start, xref is %s\n", GEDCOM_STRING(xref)); - strcpy(family_xreftags[family_nr], GEDCOM_STRING(xref)); + struct xref_value *xr = GEDCOM_XREF_PTR(xref); + output(1, "Family start, xref is %s\n", xr->string); + strcpy(family_xreftags[family_nr], xr->string); + xr->object = (Gedcom_ctxt)family_nr; return (Gedcom_ctxt)(family_nr++); } @@ -88,9 +90,9 @@ Gedcom_ctxt rec_start(int level, Gedcom_val xref, char *tag, char *raw_value, int tag_value, Gedcom_val parsed_value) { - char *xref_str = NULL; + char* xref_str = NULL; if (! GEDCOM_IS_NULL(xref)) - xref_str = GEDCOM_STRING(xref); + xref_str = GEDCOM_XREF_PTR(xref)->string; output(1, "Rec %s start, xref is %s\n", tag, xref_str); return (Gedcom_ctxt)tag_value; } @@ -99,9 +101,9 @@ Gedcom_ctxt note_start(int level, Gedcom_val xref, char *tag, char *raw_value, int tag_value, Gedcom_val parsed_value) { - output(0, "== %d %s (%d) %s (xref is %s)\n", + output(1, "== %d %s (%d) %s (xref is %s)\n", level, tag, tag_value, GEDCOM_STRING(parsed_value), - GEDCOM_STRING(xref)); + GEDCOM_XREF_PTR(xref)->string); return (Gedcom_ctxt)tag_value; } @@ -114,7 +116,7 @@ Gedcom_ctxt submit_start(int level, Gedcom_val xref, char *tag, char *raw_value, int tag_value, Gedcom_val parsed_value) { - output(1, "Submitter, xref is %s\n", GEDCOM_STRING(xref)); + output(1, "Submitter, xref is %s\n", GEDCOM_XREF_PTR(xref)->string); return (Gedcom_ctxt)10000; }