Added extra argument to callback functions: the record/element identifier.
authorPeter Verthez <Peter.Verthez@advalvas.be>
Sun, 25 Aug 2002 11:17:34 +0000 (11:17 +0000)
committerPeter Verthez <Peter.Verthez@advalvas.be>
Sun, 25 Aug 2002 11:17:34 +0000 (11:17 +0000)
gedcom/interface.c
t/standalone.c

index 74d2e9190931698c9a2a87742cd891a3b0d73591..7556667a253200a4b58ed9d7fab4f0f7f326ec0b 100644 (file)
@@ -61,7 +61,8 @@ Gedcom_ctxt start_record(Gedcom_rec rec,
 {
   Gedcom_rec_start_cb cb = record_start_callback[rec];
   if (cb != NULL)
-    return (*cb)(level, xref, tag.string, raw_value, tag.value, parsed_value);
+    return (*cb)(rec, level, xref, tag.string, raw_value, tag.value,
+                parsed_value);
   else
     return NULL;
 }
@@ -70,7 +71,7 @@ void end_record(Gedcom_rec rec, Gedcom_ctxt self)
 {
   Gedcom_rec_end_cb cb = record_end_callback[rec];
   if (cb != NULL)
-    (*cb)(self);
+    (*cb)(rec, self);
 }
 
 Gedcom_ctxt start_element(Gedcom_elt elt, Gedcom_ctxt parent, 
@@ -80,10 +81,10 @@ Gedcom_ctxt start_element(Gedcom_elt elt, Gedcom_ctxt parent,
   Gedcom_elt_start_cb cb = element_start_callback[elt];
   Gedcom_ctxt ctxt = parent;
   if (cb != NULL)
-    ctxt = (*cb)(parent, level, tag.string, raw_value,
+    ctxt = (*cb)(elt, parent, level, tag.string, raw_value,
                 tag.value, parsed_value);
   else if (default_cb != NULL && parent != NULL)
-    (*default_cb)(parent, level, tag.string, raw_value, tag.value);
+    (*default_cb)(elt, parent, level, tag.string, raw_value, tag.value);
   return ctxt;
 }
 
@@ -92,7 +93,7 @@ void end_element(Gedcom_elt elt, Gedcom_ctxt parent, Gedcom_ctxt self,
 {
   Gedcom_elt_end_cb cb = element_end_callback[elt];
   if (cb != NULL)
-    (*cb)(parent, self, parsed_value);
+    (*cb)(elt, parent, self, parsed_value);
 }
 
 char* val_type_str[] = { N_("null value"),
index 008b5148144c197a45a545553fe18b91a5366db6..68ebb18916f7e6c2588168e92fd09cecbe1ff2b6 100644 (file)
@@ -83,7 +83,7 @@ void header_end(Gedcom_ctxt self)
 char family_xreftags[100][255];
 int  family_nr = 1;
 
-Gedcom_ctxt family_start(int level, Gedcom_val xref, char *tag,
+Gedcom_ctxt family_start(Gedcom_rec rec, int level, Gedcom_val xref, char *tag,
                         char *raw_value, int tag_value,
                         Gedcom_val parsed_value)
 {
@@ -94,7 +94,7 @@ Gedcom_ctxt family_start(int level, Gedcom_val xref, char *tag,
   return (Gedcom_ctxt)(family_nr++);
 }
 
-Gedcom_ctxt rec_start(int level, Gedcom_val xref, char *tag,
+Gedcom_ctxt rec_start(Gedcom_rec rec, int level, Gedcom_val xref, char *tag,
                      char *raw_value, int tag_value,
                      Gedcom_val parsed_value)
 {
@@ -105,7 +105,7 @@ Gedcom_ctxt rec_start(int level, Gedcom_val xref, char *tag,
   return (Gedcom_ctxt)tag_value;
 }
 
-Gedcom_ctxt note_start(int level, Gedcom_val xref, char *tag,
+Gedcom_ctxt note_start(Gedcom_rec rec, int level, Gedcom_val xref, char *tag,
                       char *raw_value, int tag_value,
                       Gedcom_val parsed_value)
 {
@@ -115,12 +115,12 @@ Gedcom_ctxt note_start(int level, Gedcom_val xref, char *tag,
   return (Gedcom_ctxt)tag_value;
 }
 
-void family_end(Gedcom_ctxt self)
+void family_end(Gedcom_rec rec, Gedcom_ctxt self)
 {
   output(1, "Family end, xref is %s\n", family_xreftags[(int)self]);
 }
 
-Gedcom_ctxt submit_start(int level, Gedcom_val xref, char *tag,
+Gedcom_ctxt submit_start(Gedcom_rec rec, int level, Gedcom_val xref, char *tag,
                         char *raw_value, int tag_value,
                         Gedcom_val parsed_value)
 {
@@ -128,8 +128,8 @@ Gedcom_ctxt submit_start(int level, Gedcom_val xref, char *tag,
   return (Gedcom_ctxt)10000;
 }
 
-Gedcom_ctxt source_start(Gedcom_ctxt parent, int level, char *tag,
-                        char* raw_value,
+Gedcom_ctxt source_start(Gedcom_elt elt, Gedcom_ctxt parent, int level,
+                        char *tag, char* raw_value,
                         int tag_value, Gedcom_val parsed_value)
 {
   Gedcom_ctxt self = (Gedcom_ctxt)((int) parent + 1000);
@@ -138,13 +138,14 @@ Gedcom_ctxt source_start(Gedcom_ctxt parent, int level, char *tag,
   return self;
 }
 
-void source_end(Gedcom_ctxt parent, Gedcom_ctxt self, Gedcom_val parsed_value)
+void source_end(Gedcom_elt elt, Gedcom_ctxt parent, Gedcom_ctxt self,
+               Gedcom_val parsed_value)
 {
   output(1, "Source context %d in parent %d\n", (int)self, (int)parent);
 }
 
-Gedcom_ctxt date_start(Gedcom_ctxt parent, int level, char *tag,
-                      char* raw_value,
+Gedcom_ctxt date_start(Gedcom_elt elt, Gedcom_ctxt parent, int level,
+                      char *tag, char* raw_value,
                       int tag_value, Gedcom_val parsed_value)
 {
   struct date_value dv;
@@ -173,8 +174,8 @@ Gedcom_ctxt date_start(Gedcom_ctxt parent, int level, char *tag,
   return self;
 }
 
-void default_cb(Gedcom_ctxt ctxt, int level, char *tag, char *raw_value,
-               int tag_value)
+void default_cb(Gedcom_elt elt, Gedcom_ctxt ctxt, int level, char *tag,
+               char *raw_value, int tag_value)
 {
   char   *converted = NULL;
   int    conv_fails = 0;