1 /* General header for the Gedcom object model.
2 Copyright (C) 2002 The Genes Development Team
3 This file is part of the Gedcom parser library.
4 Contributed by Peter Verthez <Peter.Verthez@advalvas.be>, 2002.
6 The Gedcom parser library is free software; you can redistribute it
7 and/or modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The Gedcom parser library is distributed in the hope that it will be
12 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the Gedcom parser library; if not, write to the
18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
24 #ifndef __GOM_INTERNAL_H
25 #define __GOM_INTERNAL_H
37 #define _(string) dgettext(PACKAGE, string)
38 #define N_(string) (string)
41 #define UNUSED __attribute__((unused))
49 T_header, T_submission, T_submitter, T_family, T_individual,
50 T_multimedia, T_note, T_repository, T_source, T_user_rec,
52 T_address, T_event, T_place, T_source_citation, T_text,
53 T_note_sub, T_multimedia_link, T_lds_event, T_user_ref_number,
54 T_change_date, T_personal_name, T_family_link, T_pedigree,
55 T_association, T_source_event, T_source_description,
60 struct Gom_ctxt_struct;
61 typedef struct Gom_ctxt_struct *Gom_ctxt;
63 Gom_ctxt make_gom_ctxt(int ctxt_type, OBJ_TYPE obj_type, void *ctxt_ptr);
64 Gom_ctxt dup_gom_ctxt(Gom_ctxt ctxt, int ctxt_type);
65 void* safe_ctxt_cast(Gom_ctxt ctxt, OBJ_TYPE type, const char* file, int line);
66 int ctxt_type(Gom_ctxt ctxt);
67 OBJ_TYPE ctxt_obj_type(Gom_ctxt ctxt);
69 void gom_cast_error(const char* file, int line,
70 OBJ_TYPE expected, OBJ_TYPE found);
71 void gom_no_context(const char* file, int line);
72 void gom_unexpected_context(const char* file, int line, OBJ_TYPE found);
73 void gom_xref_already_in_use(const char *xrefstr);
74 void gom_move_error(const char* type);
75 void gom_find_error(const char* type);
76 void unref_xref_value(struct xref_value *xref);
78 int gom_write_xref_list(Gedcom_write_hndl hndl,
79 Gedcom_elt elt, int tag, int parent_rec_or_elt,
80 struct xref_list* val);
82 #define MAKE_GOM_CTXT(CTXT_TYPE, STRUCTTYPE, CTXT_PTR) \
83 make_gom_ctxt(CTXT_TYPE, T_ ## STRUCTTYPE, CTXT_PTR)
85 #define SAFE_CTXT_CAST(STRUCTTYPE, VAL) \
86 safe_ctxt_cast(VAL, T_ ## STRUCTTYPE, __FILE__, __LINE__)
88 #define SAFE_FREE(PTR) \
94 #define UNEXPECTED_CONTEXT(CTXT_TYPE) \
95 gom_unexpected_context(__FILE__, __LINE__, CTXT_TYPE)
98 gom_no_context(__FILE__, __LINE__)
100 void gom_mem_error(const char *filename, int line);
102 #define MEMORY_ERROR gom_mem_error(__FILE__, __LINE__)
104 void def_rec_end(Gedcom_rec rec, Gedcom_ctxt self, Gedcom_val parsed_value);
105 void def_elt_end(Gedcom_elt elt, Gedcom_ctxt parent,
106 Gedcom_ctxt self, Gedcom_val parsed_value);
107 void set_xref_type(struct xref_value *xr, const char* str);
109 int update_date(struct date_value** dv, struct tm* tm_ptr);
110 int update_time(char** tv, struct tm* tm_ptr);
112 void NULL_DESTROY(void* anything);
114 #include "func_template.h"
116 DECLARE_UNREFALLFUNC(xref_list);
117 DECLARE_CLEANFUNC(xref_list);
119 #endif /* __GOM_INTERNAL_H */