- tag_str = get_tag_string(elt, tag);
- level = get_level(hndl, elt, parent_rec_or_elt);
- if (tag_str && (level != -1)
- && check_type(elt, (val ? GV_CHAR_PTR : GV_NULL))) {
- result = write_simple(hndl, level, NULL, tag_str, val);
- }
+int gedcom_write_element_xref(Gedcom_write_hndl hndl,
+ Gedcom_elt elt, int tag, int parent_rec_or_elt,
+ const struct xref_value* val)
+{
+ int result = 1;
+ if (check_type(elt, (val ? GV_XREF_PTR : GV_NULL)))
+ result = _gedcom_write_val(hndl, elt, tag, parent_rec_or_elt, NULL,
+ val->string);
+ return result;
+}
+
+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 result = 1;
+ if (check_type(elt, (val ? GV_DATE_VALUE : GV_NULL)))
+ result = _gedcom_write_val(hndl, elt, tag, parent_rec_or_elt, NULL,
+ gedcom_date_to_string(val));
+ return result;
+}
+
+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 result = 1;
+ if (check_type(elt, (val ? GV_AGE_VALUE : GV_NULL)))
+ result = _gedcom_write_val(hndl, elt, tag, parent_rec_or_elt, NULL,
+ gedcom_age_to_string(val));
+ return result;
+}
+
+int gedcom_write_user_str(Gedcom_write_hndl hndl, int level, const char* tag,
+ const char* xrefstr, const char* value)
+{
+ int result = 1;
+ if (tag && tag[0] == '_')
+ result = write_simple(hndl, level, xrefstr, tag, convert_at(value));
+ return result;
+}