X-Git-Url: https://git.dlugolecki.net.pl/?a=blobdiff_plain;f=include%2Fgedcom.h.in;h=83b89fce635d8c6bfe2ca82bd91f84bb4eeaaa41;hb=58c7f618a6964a7fa5fc95c67f13f0a52689a29a;hp=33c0ec59dc7a12cdeab9410b4c1d37ad92a5a929;hpb=1568cb8ab16ecc1984d0d00b8ae8189c32508b08;p=gedcom-parse.git diff --git a/include/gedcom.h.in b/include/gedcom.h.in index 33c0ec5..83b89fc 100644 --- a/include/gedcom.h.in +++ b/include/gedcom.h.in @@ -37,7 +37,7 @@ extern "C" { #define GEDCOM_PARSE_VERSION_MAJOR @VERSION_MAJOR@ #define GEDCOM_PARSE_VERSION_MINOR @VERSION_MINOR@ -#define GEDCOM_PARSE_VERSION_PATCH 0 +#define GEDCOM_PARSE_VERSION_PATCH @VERSION_PATCH@ #define GEDCOM_PARSE_VERSION \ (GEDCOM_PARSE_VERSION_MAJOR * 1000 + GEDCOM_PARSE_VERSION_MINOR) @@ -385,6 +385,20 @@ typedef enum _ENC_LINE_END { END_LF_CR = 3 } Enc_line_end; +typedef enum _ENC_FROM { + ENC_FROM_FILE = 0, + ENC_FROM_SYS = 1, + ENC_MANUAL = 2 +} Enc_from; + +struct encoding_state; + +typedef enum _DATE_INPUT { + DI_FROM_STRINGS, + DI_FROM_NUMBERS, + DI_FROM_SDN +} Date_input; + /**************************************************************************/ /*** Things meant to be internal, susceptible to changes ***/ /*** Use the GEDCOM_STRING/GEDCOM_DATE interface instead of relying ***/ @@ -514,9 +528,13 @@ void gedcom_subscribe_to_element(Gedcom_elt elt, Gedcom_elt_end_cb cb_end); /* 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_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); +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); /* Handling cross-references */ @@ -530,20 +548,17 @@ int gedcom_delete_xref(const char* xrefstr); /* Writing support */ Gedcom_write_hndl gedcom_write_open(const char* filename); int gedcom_write_close(Gedcom_write_hndl hndl, int *total_conv_fails); -int gedcom_write_set_encoding(const char* charset, Encoding width, +int gedcom_write_set_encoding(Enc_from from, + const char* charset, Encoding width, Enc_bom bom); -int gedcom_write_set_line_terminator(Enc_line_end end); +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, int parsed_tag, - char* xrefstr, char* val); -int gedcom_write_element_str(Gedcom_write_hndl hndl, Gedcom_elt elt, - int parsed_tag, int parent_rec_or_elt, - char* val); - -int gedcom_write_record_xref(Gedcom_write_hndl hndl, - Gedcom_rec rec, int parsed_tag, - char* xrefstr, struct xref_value* val); + Gedcom_rec rec, char* xrefstr, char* val); + +int gedcom_write_element_str(Gedcom_write_hndl hndl, Gedcom_elt elt, + int parsed_tag, int parent_rec_or_elt, + 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);