X-Git-Url: https://git.dlugolecki.net.pl/?a=blobdiff_plain;f=gom%2Fgom_internal.h;h=01dde5cad0796b41dd93f5f976505dd18938816c;hb=082066d0c776403b70c366f9a7d1333c7a9fac15;hp=91a693215224e313e8d2727f88283696b4988f5f;hpb=5b045164f4a11b1f4d709820e784e1ca77b61b3f;p=gedcom-parse.git diff --git a/gom/gom_internal.h b/gom/gom_internal.h index 91a6932..01dde5c 100644 --- a/gom/gom_internal.h +++ b/gom/gom_internal.h @@ -75,6 +75,10 @@ void gom_cast_error(const char* file, int line, void gom_no_context(const char* file, int line); void gom_unexpected_context(const char* file, int line, OBJ_TYPE found); +int gom_write_xref_list(Gedcom_write_hndl hndl, + Gedcom_elt elt, int tag, int parent_rec_or_elt, + struct xref_list* val); + #define MAKE_GOM_CTXT(CTXT_TYPE, STRUCTTYPE, CTXT_PTR) \ make_gom_ctxt(CTXT_TYPE, T_ ## STRUCTTYPE, CTXT_PTR) @@ -212,6 +216,46 @@ void NULL_DESTROY(void* anything); return (Gedcom_ctxt)result; \ } +#define STRING_END_CB(STRUCTTYPE,CB_NAME,FIELD) \ + void CB_NAME(_ELT_END_PARAMS_) \ + { \ + Gom_ctxt ctxt = (Gom_ctxt)self; \ + if (! ctxt) \ + NO_CONTEXT; \ + else { \ + struct STRUCTTYPE *obj = SAFE_CTXT_CAST(STRUCTTYPE, ctxt); \ + if (obj) { \ + char *str = GEDCOM_STRING(parsed_value); \ + char *newvalue = strdup(str); \ + if (! newvalue) \ + MEMORY_ERROR; \ + else \ + obj->FIELD = newvalue; \ + } \ + destroy_gom_ctxt(ctxt); \ + } \ + } + +#define STRING_END_REC_CB(STRUCTTYPE,CB_NAME,FIELD) \ + void CB_NAME(_REC_END_PARAMS_) \ + { \ + Gom_ctxt ctxt = (Gom_ctxt)self; \ + if (! ctxt) \ + NO_CONTEXT; \ + else { \ + struct STRUCTTYPE *obj = SAFE_CTXT_CAST(STRUCTTYPE, ctxt); \ + if (obj) { \ + char *str = GEDCOM_STRING(parsed_value); \ + char *newvalue = strdup(str); \ + if (! newvalue) \ + MEMORY_ERROR; \ + else \ + obj->FIELD = newvalue; \ + } \ + destroy_gom_ctxt(ctxt); \ + } \ + } + #define DATE_CB(STRUCTTYPE,CB_NAME,FIELD) \ Gedcom_ctxt CB_NAME(_ELT_PARAMS_) \ { \