055b0f0d1a7baf09f675d4f90f67b71600a1c978
[gedcom-parse.git] / gedcom / compat.h
1 /* Header for compatibility handling for the GEDCOM parser.
2    Copyright (C) 2001, 2002 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 __COMPAT_H
25 #define __COMPAT_H
26
27 #include "buffer.h"
28 #include "gedcom.h"
29 #include "gedcom_internal.h"
30
31 typedef enum _COMPAT_RULES {
32   C_NO_SUBMITTER,
33   C_INDI_ADDR,
34   C_NOTE_NO_VALUE,
35   C_NO_GEDC,
36   C_NO_CHAR,
37   C_HEAD_TIME,
38   C_NO_DOUBLE_AT,
39   C_NO_REQUIRED_VALUES,
40   C_551_TAGS,
41   C_NO_SLGC_FAMC,
42   C_SUBM_COMM,
43   C_DOUBLE_DATES_4,
44   C_CONC_NEEDS_SPACE,
45   C_NO_GEDC_FORM,
46   C_NOTE_NOTE,
47   C_TAB_CHARACTER,
48   C_SUBM_CTRY,
49   C_NOTE_TOO_LONG,
50   C_NOTE_CONC_SOUR,
51   C_NONSTD_SOUR_TAGS,
52   C_PAF_DATES,
53   C_NR_OF_RULES
54 } Compat_rule;
55
56 void set_compatibility_program(const char* program);
57 void set_compatibility_version(const char* version);
58 void compute_compatibility();
59 int  compat_mode(Compat_rule rule);
60 void compat_close();
61
62 /* C_NO_SUBMITTER */
63 void compat_generate_submitter_link(Gedcom_ctxt parent);
64 void compat_generate_submitter();
65
66 /* C_NO_GEDC, C_NO_GEDC_FORM */
67 void compat_generate_gedcom(Gedcom_ctxt parent);
68 void compat_generate_gedcom_form(Gedcom_ctxt parent);
69
70 /* C_NO_CHAR */
71 int  compat_generate_char(Gedcom_ctxt parent);
72
73 /* C_HEAD_TIME */
74 void compat_save_head_date_context(Gedcom_ctxt parent);
75 Gedcom_ctxt compat_generate_head_time_start(int level, struct tag_struct ts,
76                                             char* value);
77 void compat_generate_head_time_end(Gedcom_ctxt self);
78
79 /* C_SUBM_CTRY */
80 void compat_save_ctry_parent_context(Gedcom_ctxt parent);
81 Gedcom_ctxt compat_generate_addr_ctry_start(int level, struct tag_struct ts,
82                                             char* value);
83 void compat_generate_addr_ctry_end(Gedcom_ctxt self);
84 void compat_free_ctry_parent_context();
85
86 /* C_INDI_ATTR */
87 Gedcom_ctxt compat_generate_resi_start(Gedcom_ctxt parent);
88 void compat_generate_resi_end(Gedcom_ctxt parent, Gedcom_ctxt self);
89
90 /* C_551_TAGS */
91 int  compat_check_551_tag(const char* tag, struct safe_buffer* b);
92
93 /* C_NO_SLGC_FAMC */
94 void compat_generate_slgc_famc_link(Gedcom_ctxt parent);
95 void compat_generate_slgc_famc_fam();
96
97 /* C_SUBM_COMM */
98 int  compat_check_subm_comm(const char* tag, const char* parent_tag,
99                             struct safe_buffer* b);
100 void compat_close_subm_comm();
101 int  compat_check_subm_comm_cont(const char* tag);
102 Gedcom_ctxt compat_subm_comm_cont_start(Gedcom_ctxt parent, char* str);
103 void compat_subm_comm_cont_end(Gedcom_ctxt parent, Gedcom_ctxt self);
104
105 /* C_NOTE_TOO_LONG */
106 int  compat_long_line(int level, int tag);
107 char* compat_long_line_get_prefix(char* str);
108 void compat_long_line_finish(Gedcom_ctxt parent, int level);
109
110 /* C_NOTE_CONC_SOUR */
111 Gedcom_ctxt compat_generate_note_sour_start(Gedcom_ctxt parent,
112                                             int level, struct tag_struct ts,
113                                             char* pointer);
114 void compat_generate_note_sour_end(Gedcom_ctxt self);
115
116 /* C_NONSTD_SOUR_TAGS */
117 int  compat_check_sour_tag(const char* tag, struct safe_buffer* b);
118 Gedcom_ctxt compat_generate_nonstd_sour_start(Gedcom_ctxt parent, int level,
119                                               struct tag_struct ts,
120                                               char* value,
121                                               struct safe_buffer* b);
122 void compat_generate_nonstd_sour_end(Gedcom_ctxt parent, Gedcom_ctxt self);
123 int compat_generate_nonstd_sour_state();
124
125 #endif /* __COMPAT_H */