X-Git-Url: https://git.dlugolecki.net.pl/?a=blobdiff_plain;f=include%2Fgedcom.h.in;h=bf53759727f0026db1aa607e0bbb4493577efe0d;hb=473f146038f88434e3edd070dfa42390bd0df60f;hp=83b89fce635d8c6bfe2ca82bd91f84bb4eeaaa41;hpb=4ff6c7ea2919afc5495b4d55144eb8d4c45fe44d;p=gedcom-parse.git diff --git a/include/gedcom.h.in b/include/gedcom.h.in index 83b89fc..bf53759 100644 --- a/include/gedcom.h.in +++ b/include/gedcom.h.in @@ -399,12 +399,17 @@ typedef enum _DATE_INPUT { DI_FROM_SDN } Date_input; +typedef enum _COMPAT_OPTIONS { + COMPAT_ALLOW_OUT_OF_CONTEXT = 0x01 +} Gedcom_compat; + /**************************************************************************/ /*** Things meant to be internal, susceptible to changes ***/ /*** Use the GEDCOM_STRING/GEDCOM_DATE interface instead of relying ***/ /*** on this !! ***/ /**************************************************************************/ - + +/* Update strings in interface.c if this changes */ typedef enum _GEDCOM_VAL_TYPE { GV_NULL = 0x01, GV_CHAR_PTR = 0x02, @@ -434,12 +439,12 @@ extern struct age_value def_age_val; extern struct xref_value def_xref_val; #define GV_CHECK_CAST(VAL, TYPE, MEMBER, DEFVAL) \ - ((VAL->type == TYPE) ? \ - VAL->value.MEMBER : \ - (gedcom_cast_error(__FILE__,__LINE__, TYPE, VAL->type), DEFVAL)) + (((VAL)->type == TYPE) ? \ + (VAL)->value.MEMBER : \ + (gedcom_cast_error(__FILE__,__LINE__, TYPE, (VAL)->type), DEFVAL)) #define GV_IS_TYPE(VAL, TYPE) \ - (VAL->type == TYPE) + ((VAL)->type == TYPE) /**************************************************************************/ /*** Function interface ***/ @@ -517,6 +522,7 @@ int gedcom_new_model(); void gedcom_set_debug_level(int level, FILE* trace_output); void gedcom_set_error_handling(Gedcom_err_mech mechanism); void gedcom_set_compat_handling(int enable_compat); +void gedcom_set_compat_options(Gedcom_compat options); void gedcom_set_message_handler(Gedcom_msg_handler func); void gedcom_set_default_callback(Gedcom_def_cb func); @@ -529,13 +535,13 @@ void gedcom_subscribe_to_element(Gedcom_elt elt, /* Separate value parsing functions */ struct date_value gedcom_parse_date(const char* line_value); -char* gedcom_date_to_string(struct date_value* val); -struct date_value* gedcom_new_date_value(struct date_value* copy_from); +char* gedcom_date_to_string(const struct date_value* val); +struct date_value* gedcom_new_date_value(const struct date_value* copy_from); int gedcom_normalize_date(Date_input compute_from, struct date_value *val); struct age_value gedcom_parse_age(const char* line_value); -struct age_value* gedcom_new_age_value(struct age_value* copy_from); -char* gedcom_age_to_string(struct age_value* val); +struct age_value* gedcom_new_age_value(const struct age_value* copy_from); +char* gedcom_age_to_string(const struct age_value* val); /* Handling cross-references */ struct xref_value *gedcom_get_by_xref(const char *key); @@ -554,26 +560,27 @@ int gedcom_write_set_encoding(Enc_from from, int gedcom_write_set_line_terminator(Enc_from from, Enc_line_end end); int gedcom_write_record_str(Gedcom_write_hndl hndl, - Gedcom_rec rec, char* xrefstr, char* val); + Gedcom_rec rec, const char* xrefstr, + const char* val); int gedcom_write_element_str(Gedcom_write_hndl hndl, Gedcom_elt elt, int parsed_tag, int parent_rec_or_elt, - char* val); + const 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); + const struct xref_value* val); int gedcom_write_element_date(Gedcom_write_hndl hndl, Gedcom_elt elt, int tag, int parent_rec_or_elt, - struct date_value* val); + const struct date_value* val); int gedcom_write_element_age(Gedcom_write_hndl hndl, Gedcom_elt elt, int tag, int parent_rec_or_elt, - struct age_value* val); + const struct age_value* val); -int gedcom_write_user_str(Gedcom_write_hndl hndl, int level, char* tag, - char* xrefstr, char* value); -int gedcom_write_user_xref(Gedcom_write_hndl hndl, int level, char* tag, - char* xrefstr, struct xref_value* val); +int gedcom_write_user_str(Gedcom_write_hndl hndl, int level, const char* tag, + const char* xrefstr, const char* value); +int gedcom_write_user_xref(Gedcom_write_hndl hndl, int level, const char* tag, + const char* xrefstr, const struct xref_value* val); /* For use in gom */ int gedcom_error(const char* s, ...);