#include <stdlib.h>
#include <string.h>
#include <libintl.h>
+#include <time.h>
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
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)
Gedcom_ctxt self, Gedcom_val parsed_value);
void set_xref_type(struct xref_value *xr, const char* str);
-struct date_value* dup_date(struct date_value dv);
-struct age_value* dup_age(struct age_value age);
+int update_date(struct date_value** dv, struct tm* tm_ptr);
+int update_time(char** tv, struct tm* tm_ptr);
/* Doubly-linked list, but last rec->next is NULL (doesn't go to first rec) */
#define LINK_CHAIN_ELT(STRUCTTYPE, FIRSTVAL, VAL) \
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_) \
{ \
= SAFE_CTXT_CAST(STRUCTTYPE, (Gom_ctxt)parent); \
if (obj) { \
struct date_value dv = GEDCOM_DATE(parsed_value); \
- obj->FIELD = dup_date(dv); \
+ obj->FIELD = gedcom_new_date_value(&dv); \
if (! obj->FIELD) \
MEMORY_ERROR; \
else \
= SAFE_CTXT_CAST(STRUCTTYPE, (Gom_ctxt)parent); \
if (obj) { \
struct age_value age = GEDCOM_AGE(parsed_value); \
- obj->FIELD = dup_age(age); \
+ obj->FIELD = gedcom_new_age_value(&age); \
if (! obj->FIELD) \
MEMORY_ERROR; \
else \