From: Peter Verthez Date: Sun, 30 Dec 2001 22:43:32 +0000 (+0000) Subject: Use Gedcom_val for the xref in the record start callback too. X-Git-Url: https://git.dlugolecki.net.pl/?a=commitdiff_plain;h=e33cdc26ace551aae08fcd71a9f0d460c89b789d;p=gedcom-parse.git Use Gedcom_val for the xref in the record start callback too. --- diff --git a/gedcom/gedcom.y b/gedcom/gedcom.y index 4fcd0cf..872be12 100644 --- a/gedcom/gedcom.y +++ b/gedcom/gedcom.y @@ -430,7 +430,7 @@ record : fam_rec /**** Header ****/ /*********************************************************************/ head_sect : OPEN DELIM TAG_HEAD - { $$ = start_record(REC_HEAD, $1, NULL, $3); + { $$ = start_record(REC_HEAD, $1, GEDCOM_MAKE_NULL(), $3); START(HEAD, $$) } head_subs { if (compat_mode(C_FTREE)) @@ -858,7 +858,8 @@ trlr_sect : OPEN DELIM TAG_TRLR CLOSE { } /**** Family record ****/ /*********************************************************************/ fam_rec : OPEN DELIM POINTER DELIM TAG_FAM - { $$ = start_record(REC_FAM, $1, $3, $5); + { $$ = start_record(REC_FAM, + $1, GEDCOM_MAKE_STRING($3), $5); START(FAM, $$) } fam_subs { CHECK0 } @@ -959,7 +960,8 @@ fam_subm_sect : OPEN DELIM TAG_SUBM mand_pointer /**** Individual record ****/ /*********************************************************************/ indiv_rec : OPEN DELIM POINTER DELIM TAG_INDI - { $$ = start_record(REC_INDI, $1, $3, $5); + { $$ = start_record(REC_INDI, + $1, GEDCOM_MAKE_STRING($3), $5); START(INDI, $$) } indi_subs { CHECK0 } @@ -1117,7 +1119,8 @@ 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, $3, $5); + { $$ = start_record(REC_OBJE, + $1, GEDCOM_MAKE_STRING($3), $5); START(OBJE, $$) } obje_subs { CHECK2(FORM, BLOB) } @@ -1221,7 +1224,8 @@ 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, $3, $5); + { $$ = start_record(REC_NOTE, + $1, GEDCOM_MAKE_STRING($3), $5); START(NOTE, $$) } note_subs { CHECK0 } @@ -1254,7 +1258,8 @@ note_sub : continuation_sub /* 0:M */ /**** Repository record ****/ /*********************************************************************/ repos_rec : OPEN DELIM POINTER DELIM TAG_REPO - { $$ = start_record(REC_REPO, $1, $3, $5); + { $$ = start_record(REC_REPO, + $1, GEDCOM_MAKE_STRING($3), $5); START(REPO, $$) } repo_subs { CHECK0 } @@ -1292,7 +1297,8 @@ 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, $3, $5); + { $$ = start_record(REC_SOUR, + $1, GEDCOM_MAKE_STRING($3), $5); START(SOUR, $$) } sour_subs { CHECK0 } @@ -1514,7 +1520,8 @@ sour_text_sub : continuation_sub /* 0:M */ /**** Submission record ****/ /*********************************************************************/ submis_rec : OPEN DELIM POINTER DELIM TAG_SUBN - { $$ = start_record(REC_SUBN, $1, $3, $5); + { $$ = start_record(REC_SUBN, + $1, GEDCOM_MAKE_STRING($3), $5); START(SUBN, $$) } subn_subs { CHECK0 } @@ -1638,7 +1645,8 @@ 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, $3, $5); + { $$ = start_record(REC_SUBM, + $1, GEDCOM_MAKE_STRING($3), $5); START(SUBM, $$) } subm_subs { CHECK1(NAME) } @@ -3279,7 +3287,8 @@ user_rec : OPEN DELIM opt_xref USERTAG } } opt_value - { $$ = start_record(REC_USER, $1, $3, $4); + { $$ = start_record(REC_USER, + $1, GEDCOM_MAKE_STRING($3), $4); START($4, $$) } user_sects diff --git a/gedcom/interface.c b/gedcom/interface.c index 0ac773b..5860444 100644 --- a/gedcom/interface.c +++ b/gedcom/interface.c @@ -39,20 +39,24 @@ void gedcom_subscribe_to_record(Gedcom_rec rec, Gedcom_rec_start_cb cb_start, Gedcom_rec_end_cb cb_end) { - record_start_callback[rec] = cb_start; - record_end_callback[rec] = cb_end; + if (cb_start) { + record_start_callback[rec] = cb_start; + record_end_callback[rec] = cb_end; + } } void gedcom_subscribe_to_element(Gedcom_elt elt, Gedcom_elt_start_cb cb_start, Gedcom_elt_end_cb cb_end) { - element_start_callback[elt] = cb_start; - element_end_callback[elt] = cb_end; + if (cb_start) { + element_start_callback[elt] = cb_start; + element_end_callback[elt] = cb_end; + } } Gedcom_ctxt start_record(Gedcom_rec rec, - int level, char *xref, char *tag) + int level, Gedcom_val xref, char *tag) { Gedcom_rec_start_cb cb = record_start_callback[rec]; if (cb != NULL) diff --git a/gedcom/interface.h b/gedcom/interface.h index 0c52fc5..2e716c4 100644 --- a/gedcom/interface.h +++ b/gedcom/interface.h @@ -26,7 +26,8 @@ #include "gedcom.h" -Gedcom_ctxt start_record(Gedcom_rec rec, int level, char *xref, char *tag); +Gedcom_ctxt start_record(Gedcom_rec rec, + int level, Gedcom_val xref, char *tag); void end_record(Gedcom_rec rec, Gedcom_ctxt self); Gedcom_ctxt start_element(Gedcom_elt elt, Gedcom_ctxt parent, diff --git a/include/gedcom.h b/include/gedcom.h index b2f7e69..5e66476 100644 --- a/include/gedcom.h +++ b/include/gedcom.h @@ -371,7 +371,7 @@ typedef void typedef Gedcom_ctxt (*Gedcom_rec_start_cb) - (int level, char *xref, char *tag); + (int level, Gedcom_val xref, char *tag); typedef void (*Gedcom_rec_end_cb) (Gedcom_ctxt self);