Use Gedcom_val for the xref in the record start callback too.
authorPeter Verthez <Peter.Verthez@advalvas.be>
Sun, 30 Dec 2001 22:43:32 +0000 (22:43 +0000)
committerPeter Verthez <Peter.Verthez@advalvas.be>
Sun, 30 Dec 2001 22:43:32 +0000 (22:43 +0000)
gedcom/gedcom.y
gedcom/interface.c
gedcom/interface.h
include/gedcom.h

index 4fcd0cf087d58c82e2e5c517bd20a6fd231ea89c..872be1271cf9eec23b6adb96334dad6ec01814b1 100644 (file)
@@ -430,7 +430,7 @@ record      : fam_rec
 /**** Header                                                      ****/
 /*********************************************************************/
 head_sect    : OPEN DELIM TAG_HEAD
-               { $<ctxt>$ = start_record(REC_HEAD, $1, NULL, $3);
+               { $<ctxt>$ = start_record(REC_HEAD, $1, GEDCOM_MAKE_NULL(), $3);
                 START(HEAD, $<ctxt>$) }
                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
-               { $<ctxt>$ = start_record(REC_FAM, $1, $3, $5);
+               { $<ctxt>$ = start_record(REC_FAM,
+                                        $1, GEDCOM_MAKE_STRING($3), $5);
                 START(FAM, $<ctxt>$) }
                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
-              { $<ctxt>$ = start_record(REC_INDI, $1, $3, $5);
+              { $<ctxt>$ = start_record(REC_INDI,
+                                       $1, GEDCOM_MAKE_STRING($3), $5);
                START(INDI, $<ctxt>$) }
               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
-              { $<ctxt>$ = start_record(REC_OBJE, $1, $3, $5);
+              { $<ctxt>$ = start_record(REC_OBJE,
+                                       $1, GEDCOM_MAKE_STRING($3), $5);
                START(OBJE, $<ctxt>$) }
               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
-              { $<ctxt>$ = start_record(REC_NOTE, $1, $3, $5);
+              { $<ctxt>$ = start_record(REC_NOTE,
+                                       $1, GEDCOM_MAKE_STRING($3), $5);
                START(NOTE, $<ctxt>$) }
               note_subs
              { CHECK0 }
@@ -1254,7 +1258,8 @@ note_sub    : continuation_sub  /* 0:M */
 /**** Repository record                                           ****/
 /*********************************************************************/
 repos_rec   : OPEN DELIM POINTER DELIM TAG_REPO
-              { $<ctxt>$ = start_record(REC_REPO, $1, $3, $5);
+              { $<ctxt>$ = start_record(REC_REPO,
+                                       $1, GEDCOM_MAKE_STRING($3), $5);
                START(REPO, $<ctxt>$) }
               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
-              { $<ctxt>$ = start_record(REC_SOUR, $1, $3, $5);
+              { $<ctxt>$ = start_record(REC_SOUR,
+                                       $1, GEDCOM_MAKE_STRING($3), $5);
                START(SOUR, $<ctxt>$) }
               sour_subs
              { CHECK0 }
@@ -1514,7 +1520,8 @@ sour_text_sub  : continuation_sub  /* 0:M */
 /**** Submission record                                           ****/
 /*********************************************************************/
 submis_rec  : OPEN DELIM POINTER DELIM TAG_SUBN    
-              { $<ctxt>$ = start_record(REC_SUBN, $1, $3, $5);
+              { $<ctxt>$ = start_record(REC_SUBN,
+                                       $1, GEDCOM_MAKE_STRING($3), $5);
                START(SUBN, $<ctxt>$) }
               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    
-             { $<ctxt>$ = start_record(REC_SUBM, $1, $3, $5);
+             { $<ctxt>$ = start_record(REC_SUBM,
+                                      $1, GEDCOM_MAKE_STRING($3), $5);
                START(SUBM, $<ctxt>$) }
              subm_subs
             { CHECK1(NAME) }
@@ -3279,7 +3287,8 @@ user_rec    : OPEN DELIM opt_xref USERTAG
                }
              }
               opt_value
-              { $<ctxt>$ = start_record(REC_USER, $1, $3, $4);
+              { $<ctxt>$ = start_record(REC_USER,
+                                       $1, GEDCOM_MAKE_STRING($3), $4);
                START($4, $<ctxt>$)
              }
              user_sects
index 0ac773bdb689c617d90ef9318e5ce8ab8b551c39..58604442e4671c4533ce32c228775913a21f1f7c 100644 (file)
@@ -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)
index 0c52fc58c3250a313898375dcfeb5e646d1aec50..2e716c45c3693e2ba92582d5b5a62c189b614c48 100644 (file)
@@ -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,
index b2f7e69908508afa7aa9adcfa22c20ddaf3b5ab7..5e664763a7ab53054e492e549e64a84f569967e9 100644 (file)
@@ -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);