Use Gedcom_val for the xref in the record start callback too.
[gedcom-parse.git] / gedcom / interface.h
1 /* Header for interface.c
2    Copyright (C) 2001 The Genes Development Team
3    This file is part of the Gedcom parser library.
4    Contributed by Peter Verthez <Peter.Verthez@advalvas.be>, 2001.
5
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.
10
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.
15
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
19    02111-1307 USA.  */
20
21 /* $Id$ */
22 /* $Name$ */
23
24 #ifndef __INTERFACE_H
25 #define __INTERFACE_H
26
27 #include "gedcom.h"
28
29 Gedcom_ctxt start_record(Gedcom_rec rec,
30                          int level, Gedcom_val xref, char *tag);
31 void        end_record(Gedcom_rec rec, Gedcom_ctxt self);
32
33 Gedcom_ctxt start_element(Gedcom_elt elt, Gedcom_ctxt parent,
34                           int level, char *tag, char *raw_value,
35                           Gedcom_val parsed_value);
36 void        end_element(Gedcom_elt elt, Gedcom_ctxt parent, Gedcom_ctxt self,
37                         Gedcom_val parsed_value);
38
39 extern Gedcom_val_struct val;
40
41 #define GEDCOM_MAKE(VALUE, TYPE, MEMBER) \
42    (val.type = TYPE, val.value.MEMBER = VALUE, &val)
43
44 #define GEDCOM_MAKE_NULL() \
45    GEDCOM_MAKE(NULL, GV_NULL, string_val)
46
47 #define GEDCOM_MAKE_STRING(STRING) \
48    GEDCOM_MAKE(STRING, GV_CHAR_PTR, string_val)
49
50 #define GEDCOM_MAKE_NULL_OR_STRING(STRING) \
51    (STRING == NULL ? \
52     GEDCOM_MAKE_NULL() : \
53     GEDCOM_MAKE_STRING(STRING)) \
54
55 #define GEDCOM_MAKE_DATE(DATE) \
56    GEDCOM_MAKE(DATE, GV_DATE_VALUE, date_val)
57
58
59 #endif /* __INTERFACE_H */