1 /*
2    Hebcal - A Jewish Calendar Generator
3    Copyright (C) 1994-2012  Danny Sadinoff
4    Portions Copyright (c) 2002 Michael J. Radwin. All Rights Reserved.
5 
6    https://github.com/hebcal/hebcal
7 
8      This program is free software; you can redistribute it and/or
9      modify it under the terms of the GNU General Public License
10      as published by the Free Software Foundation; either version 2
11      of the License, or (at your option) any later version.
12 
13      This program is distributed in the hope that it will be useful,
14      but WITHOUT ANY WARRANTY; without even the implied warranty of
15      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16      GNU General Public License for more details.
17 
18      You should have received a copy of the GNU General Public License
19      along with this program; if not, write to the Free Software
20      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 
22      Danny Sadinoff can be reached at
23      danny@sadinoff.com
24 */
25 
26 #ifndef __HEBCAL__
27 #define __HEBCAL__
28 
29 #include "stdio.h"
30 #include "greg.h"
31 #include "myerror.h"
32 #include "timelib.h"
33 #include "config.h"
34 #include "translations.h"
35 
36 #ifndef ENV_CITY_STR
37 #define ENV_CITY_STR "HC_CITY"
38 #endif
39 
40 #define MAXDAYS 31
41 #define GREGYR_2_HEBYR(x) ((x)+ 3760)
42 #define MAX_LINE_LEN 100
43 #define LEAP_YR_HEB(x) ((1L + (long)(x)* 7L) % 19L < 7L ? 1 : 0)
44 #define MONTHS_IN_HEB(x) (LEAP_YR_HEB(x) ? 13 :12)
45 #define LANGUAGE2(str) ((char *)lookup_translation(str))
46 
47 extern FILE *inFile, *yFile;
48 
49 extern int
50     ashkenazis_sw,
51     dafYomi_sw,
52     candleLighting_sw,
53     euroDates_sw,
54     hebrewDates_sw,
55     inputFile_sw,
56     israel_sw,
57     latdeg, latmin, latsec, longdeg, longmin, longsec,
58     latlong_sw,
59     printOmer_sw,
60     printHebDates_sw,
61     printSomeHebDates_sw,
62     printMolad_sw,
63     printSunriseSunset_sw,
64     sedraAllWeek_sw,
65     sedrot_sw,
66     noGreg_sw,
67     noHolidays_sw,
68     suppress_rosh_chodesh_sw,
69     suppressModern_sw,
70     tabs_sw,
71     weekday_sw,
72     abbrev_sw,
73     yearDigits_sw,
74     yahrtzeitFile_sw,
75    default_zemanim;
76 extern int twentyFourHour_sw;
77 
78 extern timelib_tzinfo *TZ_INFO;
79 
80 extern int havdalah_minutes,
81    light_offset;
82 
83 typedef struct hebrew_year {
84    int first_day_of_week;
85    int leap_p;
86 } year_t;
87 
88 /* holiday typemask entries */
89 #define USER_EVENT 1
90 #define LIGHT_CANDLES 2
91 #define YOM_TOV_ENDS 4
92 #define CHUL_ONLY 8		/* chutz l'aretz (Diaspora) */
93 #define IL_ONLY 16		/* b'aretz (Israel) */
94 #define LIGHT_CANDLES_TZEIS 32
95 #define CHANUKAH_CANDLES 64
96 
97 typedef struct hinode{   /* holiday input structure */
98     date_t date;
99     char *name;
100     unsigned int typeMask;
101     struct hinode *next;
102 } holinput_t, *holinputp_t;
103 
104 typedef struct hsnode{  /* holiday storage structure */
105     char *name;
106     unsigned int typeMask;
107     struct hsnode *next;
108 } holstore_t, *holstorep_t;
109 
110 
111 #define ZMAN_ALOT_HASHACHAR (1 <<  0)
112 #define ZMAN_MISHEYAKIR     (1 <<  1)
113 #define ZMAN_SUNRISE        (1 <<  2)
114 #define ZMAN_SZKS           (1 <<  3)
115 #define ZMAN_TEFILAH        (1 <<  4)
116 #define ZMAN_CHATZOT        (1 <<  5)
117 #define ZMAN_MINCHA_GEDOLA  (1 <<  6)
118 #define ZMAN_MINCHA_KETANA  (1 <<  7)
119 #define ZMAN_PLAG_HAMINCHA  (1 <<  8)
120 #define ZMAN_SUNSET         (1 <<  9)
121 #define ZMAN_CANDLES_BEFORE (1 << 10)
122 #define ZMAN_CANDLES_AFTER  (1 << 11)
123 #define ZMAN_TZAIT_42       (1 << 12)
124 #define ZMAN_TZAIT_72       (1 << 13)
125 #define ZMAN_HAVDALAH       (1 << 14)
126 
127 year_t yearData( int );
128 date_t nextHebDate( date_t );
129 date_t prevHebDate( date_t );
130 struct hsnode *getHolstorep( void );
131 int PushHoliday( struct hsnode *, struct hsnode ** );
132 void init_holidays( int );
133 int getHebHolidays( date_t, struct hsnode ** );
134 void incHebGregDate( date_t *, date_t *,long *,int *,year_t * );
135 void PrintGregDate( date_t );
136 void main_calendar( long,long );
137 void print_candlelighting_times( int, int, date_t );
138 void print_sunrise_sunset(date_t);
139 void reset_Omer( int hYear );
140 
141 extern const char * license[];
142 extern const char * warranty[];
143 #endif
144 
145