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
58 /* Assumptions for context:
59 - In case of error, NULL is passed as context
60 - If not NULL, the ctxt_ptr of the context is not NULL also
61 - UNEXPECTED_CONTEXT is not treated as an error, but as a warning
64 struct Gom_ctxt_struct {
70 typedef struct Gom_ctxt_struct *Gom_ctxt;
72 Gom_ctxt make_gom_ctxt(int ctxt_type, OBJ_TYPE obj_type, void *ctxt_ptr);
73 void destroy_gom_ctxt(Gom_ctxt ctxt);
74 void gom_cast_error(const char* file, int line,
75 OBJ_TYPE expected, OBJ_TYPE found);
76 void gom_no_context(const char* file, int line);
77 void gom_unexpected_context(const char* file, int line, OBJ_TYPE found);
78 void gom_xref_already_in_use(const char *xrefstr);
79 void gom_move_error(const char* type);
80 void unref_xref_value(struct xref_value *xref);
82 int gom_write_xref_list(Gedcom_write_hndl hndl,
83 Gedcom_elt elt, int tag, int parent_rec_or_elt,
84 struct xref_list* val);
86 #define MAKE_GOM_CTXT(CTXT_TYPE, STRUCTTYPE, CTXT_PTR) \
87 make_gom_ctxt(CTXT_TYPE, T_ ## STRUCTTYPE, CTXT_PTR)
89 #define SAFE_CTXT_CAST(STRUCTTYPE, VAL) \
90 (((VAL)->obj_type == T_ ## STRUCTTYPE) ? \
92 (gom_cast_error(__FILE__, __LINE__, T_ ## STRUCTTYPE, (VAL)->obj_type), \
95 #define SAFE_FREE(PTR) \
101 #define UNEXPECTED_CONTEXT(CTXT_TYPE) \
102 gom_unexpected_context(__FILE__, __LINE__, CTXT_TYPE)
105 gom_no_context(__FILE__, __LINE__)
107 void gom_mem_error(const char *filename, int line);
109 #define MEMORY_ERROR gom_mem_error(__FILE__, __LINE__)
111 void def_rec_end(Gedcom_rec rec, Gedcom_ctxt self, Gedcom_val parsed_value);
112 void def_elt_end(Gedcom_elt elt, Gedcom_ctxt parent,
113 Gedcom_ctxt self, Gedcom_val parsed_value);
114 void set_xref_type(struct xref_value *xr, const char* str);
116 int update_date(struct date_value** dv, struct tm* tm_ptr);
117 int update_time(char** tv, struct tm* tm_ptr);
119 void NULL_DESTROY(void* anything);
121 #include "func_template.h"
123 DECLARE_UNREFALLFUNC(xref_list);
124 DECLARE_CLEANFUNC(xref_list);
126 #endif /* __GOM_INTERNAL_H */