A little simplification in the write interface.
authorPeter Verthez <Peter.Verthez@advalvas.be>
Sat, 28 Dec 2002 17:01:37 +0000 (17:01 +0000)
committerPeter Verthez <Peter.Verthez@advalvas.be>
Sat, 28 Dec 2002 17:01:37 +0000 (17:01 +0000)
gedcom/write.c
gom/family.c
gom/header.c
gom/individual.c
gom/multimedia.c
gom/note.c
gom/repository.c
gom/source.c
gom/submission.c
gom/submitter.c
include/gedcom.h.in

index e338b948c30108142a02cebe1e6c30b1e9c848ef..5bc9efa10fd33e841b25b6cae66e0b25a2440569 100644 (file)
@@ -380,12 +380,11 @@ int _gedcom_write_val(Gedcom_write_hndl hndl,
 }
 
 int gedcom_write_record_str(Gedcom_write_hndl hndl,
-                           Gedcom_rec rec, int tag,
-                           char* xrefstr, char* val)
+                           Gedcom_rec rec, char* xrefstr, char* val)
 {
   int result = 1;
   if (check_type(rec, (val ? GV_CHAR_PTR : GV_NULL)))
-    result = _gedcom_write_val(hndl, rec, tag, -1, xrefstr, convert_at(val));
+    result = _gedcom_write_val(hndl, rec, 0, -1, xrefstr, convert_at(val));
   return result;
 }
 
@@ -400,16 +399,6 @@ int gedcom_write_element_str(Gedcom_write_hndl hndl,
   return result;
 }
 
-int gedcom_write_record_xref(Gedcom_write_hndl hndl,
-                            Gedcom_rec rec, int tag,
-                            char* xrefstr, struct xref_value* val)
-{
-  int result = 1;
-  if (check_type(rec, (val ? GV_XREF_PTR : GV_NULL)))
-    result = _gedcom_write_val(hndl, rec, tag, -1, xrefstr, val->string);
-  return result;
-}
-
 int gedcom_write_element_xref(Gedcom_write_hndl hndl,
                              Gedcom_elt elt, int tag, int parent_rec_or_elt,
                              struct xref_value* val)
index 995fd583f1fc0e019d9709d3f1b4f031ac56f3cb..f997eb870b56406284699c92af39d00fa80af39d 100644 (file)
@@ -169,8 +169,7 @@ int write_families(Gedcom_write_hndl hndl)
   struct family* obj;
 
   for (obj = gom_first_family; obj; obj = obj->next) {
-    result |= gedcom_write_record_str(hndl, REC_FAM, 0,
-                                     obj->xrefstr, NULL);
+    result |= gedcom_write_record_str(hndl, REC_FAM, obj->xrefstr, NULL);
     if (obj->event)
       result |= write_events(hndl, REC_FAM, EVT_TYPE_FAMILY, obj->event);
     if (obj->husband)
index 448059aa0e8ba341fdb735754cc27c367c7167fd..18dc38c07c1ea1a71b0e201ddb4ccce846e81d46 100644 (file)
@@ -168,10 +168,9 @@ int write_header(Gedcom_write_hndl hndl)
   int result = 0;
   int i;
   
-  result |= gedcom_write_record_str(hndl, REC_HEAD, 0, NULL, NULL);
+  result |= gedcom_write_record_str(hndl, REC_HEAD, NULL, NULL);
   if (gom_header.charset.name)
-    result |= gedcom_write_element_str(hndl, ELT_HEAD_CHAR, 0,
-                                      REC_HEAD,
+    result |= gedcom_write_element_str(hndl, ELT_HEAD_CHAR, 0, REC_HEAD,
                                       gom_header.charset.name);
   if (gom_header.charset.version)
     result |= gedcom_write_element_str(hndl, ELT_HEAD_CHAR_VERS, 0,
index 958cce8340f5dc797af86eb0d8140ec21ee5dbf9..6e8c3fca52bb6eee0f416d30d69621d7bb103851 100644 (file)
@@ -230,8 +230,7 @@ int write_individuals(Gedcom_write_hndl hndl)
   struct individual* obj;
 
   for (obj = gom_first_individual; obj; obj = obj->next) {
-    result |= gedcom_write_record_str(hndl, REC_INDI, 0,
-                                     obj->xrefstr, NULL);
+    result |= gedcom_write_record_str(hndl, REC_INDI, obj->xrefstr, NULL);
     if (obj->restriction_notice)
       result |= gedcom_write_element_str(hndl, ELT_INDI_RESN, 0,
                                         REC_INDI, obj->restriction_notice);
index af97afc79db6c2336fba67d405a1e89f661786fa..5fb331cb4a483888d12f8743c4b2e3a33bdeab01 100644 (file)
@@ -145,8 +145,7 @@ int write_multimedia_recs(Gedcom_write_hndl hndl)
   struct multimedia* obj;
 
   for (obj = gom_first_multimedia; obj; obj = obj->next) {
-    result |= gedcom_write_record_str(hndl, REC_OBJE, 0,
-                                     obj->xrefstr, NULL);
+    result |= gedcom_write_record_str(hndl, REC_OBJE, obj->xrefstr, NULL);
     if (obj->form)
       result |= gedcom_write_element_str(hndl, ELT_OBJE_FORM, 0,
                                         REC_OBJE, obj->form);
index 0dd24430501862bc01cd71f800156e0f1c7caecf..7f74a3027923815e4d189014f0be54b6ab65d2ef 100644 (file)
@@ -151,8 +151,7 @@ int write_notes(Gedcom_write_hndl hndl)
   struct note* obj;
 
   for (obj = gom_first_note; obj; obj = obj->next) {
-    result |= gedcom_write_record_str(hndl, REC_NOTE, 0,
-                                     obj->xrefstr, obj->text);
+    result |= gedcom_write_record_str(hndl, REC_NOTE, obj->xrefstr, obj->text);
     if (obj->citation)
       result |= write_citations(hndl, REC_NOTE, obj->citation);
     if (obj->ref)
index 1cf459505867d30f9cbd32eeb15a243992a8e554..3df73882ecebbde603ee01db1d373cf0c5821f6f 100644 (file)
@@ -147,8 +147,7 @@ int write_repositories(Gedcom_write_hndl hndl)
   struct repository* obj;
 
   for (obj = gom_first_repository; obj; obj = obj->next) {
-    result |= gedcom_write_record_str(hndl, REC_REPO, 0,
-                                     obj->xrefstr, NULL);
+    result |= gedcom_write_record_str(hndl, REC_REPO, obj->xrefstr, NULL);
     if (obj->name)
       result |= gedcom_write_element_str(hndl, ELT_REPO_NAME, 0,
                                         REC_REPO, obj->name);
index 2f353973d18fae5b840862ac9fca801f8cff23a0..024fa23287a92ae98f18366971bed7b5d084e6a3 100644 (file)
@@ -190,8 +190,7 @@ int write_sources(Gedcom_write_hndl hndl)
   struct source* obj;
 
   for (obj = gom_first_source; obj; obj = obj->next) {
-    result |= gedcom_write_record_str(hndl, REC_SOUR, 0,
-                                     obj->xrefstr, NULL);
+    result |= gedcom_write_record_str(hndl, REC_SOUR, obj->xrefstr, NULL);
     if (obj->data.event || obj->data.agency || obj->data.note)
       result |= gedcom_write_element_str(hndl, ELT_SOUR_DATA, 0,
                                         REC_SOUR, NULL);
index 3fe9b4041ffaece01f2c45cad5be84ef4cc1c485..32b57b809bb44ca2ca6d1eef2009da4d6e9ac784 100644 (file)
@@ -101,7 +101,7 @@ int write_submission(Gedcom_write_hndl hndl)
   int result = 0;
 
   if (gom_submission) {
-    result |= gedcom_write_record_str(hndl, REC_SUBN, 0,
+    result |= gedcom_write_record_str(hndl, REC_SUBN, 
                                      gom_submission->xrefstr, NULL);
     if (gom_submission->submitter)
       result |= gedcom_write_element_xref(hndl, ELT_SUBN_SUBM, 0,
index 107653f2686811db9e0aa531ba0e33fd375e4f1e..44ec48f2a578941a83217069742b04270b071709 100644 (file)
@@ -169,8 +169,7 @@ int write_submitters(Gedcom_write_hndl hndl)
   struct submitter* obj;
 
   for (obj = gom_first_submitter; obj; obj = obj->next) {
-    result |= gedcom_write_record_str(hndl, REC_SUBM, 0,
-                                     obj->xrefstr, NULL);
+    result |= gedcom_write_record_str(hndl, REC_SUBM, obj->xrefstr, NULL);
     if (obj->name)
       result |= gedcom_write_element_str(hndl, ELT_SUBM_NAME, 0, REC_SUBM,
                                         obj->name);
index 89160f1872af67a6e2b9f1886748c09ff8b30f3e..348baef6b9bcc0145413ccb8c263c287a23d4298 100644 (file)
@@ -545,15 +545,11 @@ int  gedcom_write_set_encoding(const char* charset, Encoding width,
 int  gedcom_write_set_line_terminator(Enc_line_end end);
 
 int  gedcom_write_record_str(Gedcom_write_hndl hndl,
-                            Gedcom_rec rec, int parsed_tag,
-                            char* xrefstr, char* val);
-int  gedcom_write_element_str(Gedcom_write_hndl hndl, Gedcom_elt elt,
-                             int parsed_tag, int parent_rec_or_elt,
-                             char* val);
-
-int gedcom_write_record_xref(Gedcom_write_hndl hndl,
-                            Gedcom_rec rec, int parsed_tag,
-                            char* xrefstr, struct xref_value* val);
+                            Gedcom_rec rec, char* xrefstr, char* val);
+  
+int gedcom_write_element_str(Gedcom_write_hndl hndl, Gedcom_elt elt,
+                            int parsed_tag, int parent_rec_or_elt,
+                            char* val);
 int gedcom_write_element_xref(Gedcom_write_hndl hndl, Gedcom_elt elt,
                               int parsed_tag, int parent_rec_or_elt,
                              struct xref_value* val);