Copied from old documentation. Removed all Gedcom_val details.
[gedcom-parse.git] / gedcom / date.h
1 /* Header for date manipulation routines.
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 __DATE_H
25 #define __DATE_H
26
27 #include <stdlib.h>
28 #include "gedcom_internal.h"
29 #include "gedcom.h"
30
31 #define gedcom_date_error gedcom_warning
32 #define MAX_DATE_TOKEN 10
33
34 extern struct date_value dv_s;
35 extern struct date date_s;
36 extern struct date def_date;
37 extern const char* curr_line_value;
38
39 int               gedcom_date_parse();
40 int               gedcom_date_lex();
41
42 int get_date_token(const char* input);
43 int get_year_tokens(const char* str, char** year1, char** year2);
44
45 int get_day_num(const char* input);
46 int get_month_num(Calendar_type cal, const char* input);
47 int get_year_num(const char* input, Year_type* ytype);
48
49 /* These are defined in gedcom_date.lex */
50 void              init_gedcom_date_lex(const char* string);
51 void              close_gedcom_date_lex();
52
53 struct date_value* make_date_value(Date_value_type t, struct date *d1,
54                                    struct date *d2, const char* p);
55 void               copy_date(struct date *to, struct date *from);
56
57 #define GEDCOM_MAKE_DATE(VAR, DATE) \
58    GEDCOM_MAKE(VAR, DATE, GV_DATE_VALUE, date_val)
59
60 #endif /* __DATE_H */