X-Git-Url: https://git.dlugolecki.net.pl/?a=blobdiff_plain;f=gom%2Fgom.c;h=1770efdbd3690f6c328b5e426c7730137aec1df0;hb=f8536669a2c38054a067bfe1596f90744b6c58da;hp=cc388ee2be9dbd7484d4a5d55e9ed3b4a26eea72;hpb=998fcda019513849988a0aa5132c99426a08f810;p=gedcom-parse.git diff --git a/gom/gom.c b/gom/gom.c index cc388ee..1770efd 100644 --- a/gom/gom.c +++ b/gom/gom.c @@ -115,6 +115,20 @@ int gom_new_model() return gedcom_new_model(); } +int gom_write_file(const char* file_name, int *total_conv_fails) +{ + Gedcom_write_hndl hndl; + int result = 1; + + hndl = gedcom_write_open(file_name); + if (hndl) { + result = write_header(hndl); + result |= gedcom_write_close(hndl, total_conv_fails); + } + + return result; +} + Gom_ctxt make_gom_ctxt(int ctxt_type, OBJ_TYPE obj_type, void *ctxt_ptr) { Gom_ctxt ctxt = (Gom_ctxt)malloc(sizeof(struct Gom_ctxt_struct)); @@ -171,7 +185,8 @@ void gom_default_callback (Gedcom_elt elt UNUSED, Gedcom_ctxt parent UNUSED, level, tag, raw_value); } -void def_rec_end(Gedcom_rec rec UNUSED, Gedcom_ctxt self) +void def_rec_end(Gedcom_rec rec UNUSED, Gedcom_ctxt self, + Gedcom_val parsed_value UNUSED) { Gom_ctxt ctxt = (Gom_ctxt)self; destroy_gom_ctxt(ctxt); @@ -206,31 +221,6 @@ void set_xref_type(struct xref_value* xr, const char *str) xr->type = XREF_ANY; } -char* concat_strings(NL_TYPE type, char *str1, const char *str2) -{ - if (str1 != NULL && str2 != NULL) { - char *newp; - char *wp; - size_t len1 = strlen(str1); - size_t len2 = strlen(str2); - size_t len = len1 + len2 + 1; - if (type == WITH_NL) - len++; - newp = (char*) realloc(str1, len); - if (newp == NULL) - return NULL; - wp = newp + len1; - str1 = newp; - if (type == WITH_NL) - *wp++ = '\n'; - wp = memcpy (wp, str2, len2); - wp += len2; - *wp++ = '\0'; - } - - return str1; -} - struct date_value* dup_date(struct date_value dv) { struct date_value* dv_ptr;