Some const correctness fixes.
[gedcom-parse.git] / include / gedcom.h.in
index c2c0bf1c59f099c83e540503b9a74aac0c87d5fc..8129975e38fce31ee121a57f45c608be419f97bb 100644 (file)
@@ -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,12 +385,27 @@ 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    ***/
 /***  on this !!                                                        ***/
 /**************************************************************************/
-                                                                          
+
+/* Update strings in interface.c if this changes */
 typedef enum _GEDCOM_VAL_TYPE {
   GV_NULL       = 0x01,
   GV_CHAR_PTR   = 0x02,
@@ -480,7 +495,7 @@ typedef Gedcom_ctxt
          char *raw_value, int tag_value, Gedcom_val parsed_value);
 typedef void
         (*Gedcom_rec_end_cb)
-        (Gedcom_rec rec, Gedcom_ctxt self);
+        (Gedcom_rec rec, Gedcom_ctxt self, Gedcom_val parsed_value);
 
 typedef Gedcom_ctxt
         (*Gedcom_elt_start_cb)
@@ -514,8 +529,14 @@ 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);
+struct date_value  gedcom_parse_date(const char* line_value);
+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(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);
@@ -528,15 +549,33 @@ 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, char* tag,
-                            struct xref_value* xref, char* val);
-int  gedcom_write_element_str(Gedcom_write_hndl hndl,
-                             Gedcom_elt elt, char* tag, int parent_rec_or_elt,
-                             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,
+                            const char* val);
+int gedcom_write_element_xref(Gedcom_write_hndl hndl, Gedcom_elt elt,
+                              int parsed_tag, int parent_rec_or_elt,
+                             const struct xref_value* val);
+
+int gedcom_write_element_date(Gedcom_write_hndl hndl,
+                             Gedcom_elt elt, int tag, int parent_rec_or_elt,
+                             const struct date_value* val);
+int gedcom_write_element_age(Gedcom_write_hndl hndl,
+                            Gedcom_elt elt, int tag, int parent_rec_or_elt,
+                            const struct age_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, ...);