1.12.42
[gnumeric.git] / plugins / fn-hebrew-date / hdate.h
blobfa8b8aca0c7a75b0eba6264159af13d94066d5b1
1 /*
2 * hdate_hdate.c: convert georgean and hebrew calendars.
4 * Author:
5 * Yaacov Zamir <kzamir@walla.co.il>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, see <https://www.gnu.org/licenses/>.
22 #ifndef __HDATE_H__
23 #define __HDATE_H__
25 #ifdef __cplusplus
26 extern "C"
28 #endif
30 /**
31 @brief Return the days from the start
33 @param y The years
34 @warning internal function.
36 int
37 hdate_days_from_start (int y);
39 /**
40 @brief compute hebrew date from gregorian date
42 @param d Day of month 1..31
43 @param m Month 1..12 , if m or d is 0 return current date.
44 @param y Year in 4 digits e.g. 2001
46 int
47 hdate_gdate_to_hdate (int d, int m, int y, int *hd, int *hm, int *hy);
49 /**
50 @brief compute general date structure from hebrew date
52 @param d Day of month 1..31
53 @param m Month 0..13 , if m or d is 0 return current date.
54 @param y Year in 4 digits e.g. 5731
56 @attention no sanity cheak !!
58 int
59 hdate_hdate_to_gdate (int d, int m, int y, int *gd, int *gm, int *gy);
61 /**
62 @brief Compute Julian day (jd from Gregorian day, month and year (d, m, y)
63 Algorithm from 'Julian and Gregorian Day Numbers' by Peter Meyer
64 @author Yaacov Zamir ( algorithm from Henry F. Fliegel and Thomas C. Van Flandern ,1968)
66 @param d Day of month 1..31
67 @param m Month 1..12
68 @param y Year in 4 digits e.g. 2001
70 int
71 hdate_gdate_to_jd (int d, int m, int y);
73 /**
74 @brief Converting from the Julian day to the Gregorian day
75 Algorithm from 'Julian and Gregorian Day Numbers' by Peter Meyer
76 @author Yaacov Zamir ( Algorithm, Henry F. Fliegel and Thomas C. Van Flandern ,1968)
78 @param jd Julian day
79 @param d Return Day of month 1..31
80 @param m Return Month 1..12
81 @param y Return Year in 4 digits e.g. 2001
83 void
84 hdate_jd_to_gdate (int jd, int *d, int *m, int *y);
86 /**
87 @brief Converting from the Julian day to the Hebrew day
88 @author Amos Shapir 1984 (rev. 1985, 1992) Yaacov Zamir 2003-2005
90 @param jd Julian day
91 @param d Return Day of month 1..31
92 @param m Return Month 1..14
93 @param y Return Year in 4 digits e.g. 2001
95 void
96 hdate_jd_to_hdate (int jd, int *d, int *m, int *y);
98 /**
99 @brief Compute Julian day (jd from Hebrew day, month and year (d, m, y)
100 @author Amos Shapir 1984 (rev. 1985, 1992) Yaacov Zamir 2003-2005
102 @param d Day of month 1..31
103 @param m Month 1..14
104 @param y Year in 4 digits e.g. 5753
107 hdate_hdate_to_jd (int d, int m, int y);
109 /* string functions */
112 @brief convert an integer to hebrew string UTF-8 (logical)
114 @param n The int to convert
115 @attention ( 0 < n < 10000)
116 @warning uses a static string, so output should be copied away.
118 void hdate_int_to_hebrew (GString *res, int n);
121 @brief Return a static string, with name of hebrew month.
123 @param month The number of the month 0..13 (0 - tishre, 12 - adar 1, 13 - adar 2).
124 @warning uses a static string, so output should be copied away.
126 const char *hdate_get_hebrew_month_name (int month);
129 @brief Return a static string, with name of hebrew month in hebrew.
131 @param month The number of the month 0..13 (0 - tishre, 12 - adar 1, 13 - adar 2).
132 @warning uses a static string, so output should be copied away.
134 const char *hdate_get_hebrew_month_name_heb (int month);
136 #ifdef __cplusplus
138 #endif
140 #endif