X-Git-Url: https://git.dlugolecki.net.pl/?a=blobdiff_plain;ds=sidebyside;f=gom%2Fevent.c;h=b585a688abca91f686c7e5ac5d840e85ff0ff8fa;hb=8073f669d16f11bfd50d42bb2cf6fdb79d358565;hp=af6e9129c11ea417c23de76f6e744946db4dec2e;hpb=763e8737b5118c5f23dca84a3290c2d805bbefe6;p=gedcom-parse.git diff --git a/gom/event.c b/gom/event.c index af6e912..b585a68 100644 --- a/gom/event.c +++ b/gom/event.c @@ -65,13 +65,14 @@ Gedcom_ctxt sub_evt_start(_ELT_PARAMS_) } if (! err) { - switch (ctxt->ctxt_type) { + int type = ctxt_type(ctxt); + switch (type) { case REC_FAM: ADDFUNC2(family,event)(ctxt, evt); break; case REC_INDI: ADDFUNC2(individual,event)(ctxt, evt); break; default: - UNEXPECTED_CONTEXT(ctxt->ctxt_type); + UNEXPECTED_CONTEXT(type); } result = MAKE_GOM_CTXT(elt, event, evt); } @@ -111,11 +112,12 @@ Gedcom_ctxt sub_attr_start(_ELT_PARAMS_) } if (! err) { - switch (ctxt->ctxt_type) { + int type = ctxt_type(ctxt); + switch (type) { case REC_INDI: ADDFUNC2_TOVAR(individual,event,attribute)(ctxt, evt); break; default: - UNEXPECTED_CONTEXT(ctxt->ctxt_type); + UNEXPECTED_CONTEXT(type); } result = MAKE_GOM_CTXT(elt, event, evt); } @@ -126,6 +128,10 @@ Gedcom_ctxt sub_attr_start(_ELT_PARAMS_) } DEFINE_SUB_MAKEFUNC(event) +DEFINE_SUB_ADDFUNC(event) +DEFINE_SUB_FINDFUNC(event) +DEFINE_SUB_REMOVEFUNC(event) +DEFINE_SUB_MOVEFUNC(event) DEFINE_STRING_CB(event, sub_evt_type_start, type) DEFINE_DATE_CB(event, sub_evt_date_start, date) @@ -156,7 +162,8 @@ Gedcom_ctxt sub_fam_evt_age_start(_ELT_PARAMS_) if (evt) { int err = 0; struct age_value age = GEDCOM_AGE(parsed_value); - switch (ctxt->ctxt_type) { + int type = ctxt_type(ctxt); + switch (type) { case ELT_SUB_FAM_EVT_HUSB: evt->husband_age = gedcom_new_age_value(&age); if (! evt->husband_age) { @@ -172,7 +179,7 @@ Gedcom_ctxt sub_fam_evt_age_start(_ELT_PARAMS_) } break; default: - UNEXPECTED_CONTEXT(ctxt->ctxt_type); + UNEXPECTED_CONTEXT(type); } if (! err) result = MAKE_GOM_CTXT(elt, event, evt); @@ -222,6 +229,22 @@ void event_subscribe() sub_evt_caus_start, def_elt_end); } +void UNREFALLFUNC(event)(struct event* obj) +{ + if (obj) { + struct event* runner; + for (runner = obj; runner; runner = runner->next) { + UNREFALLFUNC(place)(runner->place); + UNREFALLFUNC(address)(runner->address); + UNREFALLFUNC(source_citation)(runner->citation); + UNREFALLFUNC(multimedia_link)(runner->mm_link); + UNREFALLFUNC(note_sub)(runner->note); + unref_xref_value(runner->family); + UNREFALLFUNC(user_data)(runner->extra); + } + } +} + void CLEANFUNC(event)(struct event* evt) { if (evt) {