Codebase list libhdate / uncommitted/main
* Non-maintainer upload. * Drop python-hdate, there are no remaining rdeps remaining (Closes: #936873) Moritz Muehlenhoff authored 3 years ago Debian Janitor committed 3 years ago
67 changed file(s) with 28237 addition(s) and 203 deletion(s). Raw diff Collapse all Expand all
0 debian/patches
0 docdir.patch
1 ld-as-needed.patch
2 time_t.patch
3 typos.patch
4 cflags.patch
5 duplicate_gnu_source.patch
6 size_t.patch
7 clang.patch
0
1 EXTRA_DIST = hdate.i
2
3 if WITH_PERL
4
5 DEPS= $(top_builddir)/src/libhdate.la
6
7 CLEANFILES = *.o *.cxx *.so *wrap* *.pm
8
9 all-am: hdate.so
10
11
12 hdate.so: hdate_wrap.cxx
13 g++ -fpic -c hdate_wrap.cxx $(PE_CFLAGS) -I$(top_srcdir)/src
14 g++ -shared hdate_wrap.o ../../src/.libs/libhdate.so -o hdate.so
15
16 hdate_wrap.cxx: hdate.i
17 swig -perl -c++ hdate.i
18
19 install-data-local: hdate.so
20 $(mkinstalldirs) $(DESTDIR)$(PE_MODULES_PATH)/auto/hdate/
21 $(INSTALL_DATA) hdate.so $(DESTDIR)$(PE_MODULES_PATH)/auto/hdate/hdate.so
22 $(INSTALL_DATA) hdate.pm $(DESTDIR)$(PE_MODULES_PATH)/hdate.pm
23
24 endif
0 # Makefile.in generated by automake 1.11.6 from Makefile.am.
1 # @configure_input@
2
3 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
4 # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
5 # Foundation, Inc.
6 # This Makefile.in is free software; the Free Software Foundation
7 # gives unlimited permission to copy and/or distribute it,
8 # with or without modifications, as long as this notice is preserved.
9
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
12 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13 # PARTICULAR PURPOSE.
14
15 @SET_MAKE@
16 VPATH = @srcdir@
17 am__make_dryrun = \
18 { \
19 am__dry=no; \
20 case $$MAKEFLAGS in \
21 *\\[\ \ ]*) \
22 echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
23 | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
24 *) \
25 for am__flg in $$MAKEFLAGS; do \
26 case $$am__flg in \
27 *=*|--*) ;; \
28 *n*) am__dry=yes; break;; \
29 esac; \
30 done;; \
31 esac; \
32 test $$am__dry = yes; \
33 }
34 pkgdatadir = $(datadir)/@PACKAGE@
35 pkgincludedir = $(includedir)/@PACKAGE@
36 pkglibdir = $(libdir)/@PACKAGE@
37 pkglibexecdir = $(libexecdir)/@PACKAGE@
38 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
39 install_sh_DATA = $(install_sh) -c -m 644
40 install_sh_PROGRAM = $(install_sh) -c
41 install_sh_SCRIPT = $(install_sh) -c
42 INSTALL_HEADER = $(INSTALL_DATA)
43 transform = $(program_transform_name)
44 NORMAL_INSTALL = :
45 PRE_INSTALL = :
46 POST_INSTALL = :
47 NORMAL_UNINSTALL = :
48 PRE_UNINSTALL = :
49 POST_UNINSTALL = :
50 build_triplet = @build@
51 host_triplet = @host@
52 subdir = bindings/perl
53 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
54 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
55 am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
56 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
57 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
58 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
59 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
60 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
61 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
62 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.in
63 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
64 $(ACLOCAL_M4)
65 mkinstalldirs = $(install_sh) -d
66 CONFIG_CLEAN_FILES =
67 CONFIG_CLEAN_VPATH_FILES =
68 SOURCES =
69 DIST_SOURCES =
70 am__can_run_installinfo = \
71 case $$AM_UPDATE_INFO_DIR in \
72 n|no|NO) false;; \
73 *) (install-info --version) >/dev/null 2>&1;; \
74 esac
75 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
76 ACLOCAL = @ACLOCAL@
77 AMTAR = @AMTAR@
78 AR = @AR@
79 AUTOCONF = @AUTOCONF@
80 AUTOHEADER = @AUTOHEADER@
81 AUTOMAKE = @AUTOMAKE@
82 AWK = @AWK@
83 CC = @CC@
84 CCDEPMODE = @CCDEPMODE@
85 CFLAGS = @CFLAGS@
86 CPP = @CPP@
87 CPPFLAGS = @CPPFLAGS@
88 CYGPATH_W = @CYGPATH_W@
89 DATADIRNAME = @DATADIRNAME@
90 DEFS = @DEFS@
91 DEPDIR = @DEPDIR@
92 DLLTOOL = @DLLTOOL@
93 DSYMUTIL = @DSYMUTIL@
94 DUMPBIN = @DUMPBIN@
95 ECHO_C = @ECHO_C@
96 ECHO_N = @ECHO_N@
97 ECHO_T = @ECHO_T@
98 EGREP = @EGREP@
99 EXEEXT = @EXEEXT@
100 FGREP = @FGREP@
101 GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
102 GMSGFMT = @GMSGFMT@
103 GMSGFMT_015 = @GMSGFMT_015@
104 GP_MODULES_PATH = @GP_MODULES_PATH@
105 GREP = @GREP@
106 INSTALL = @INSTALL@
107 INSTALL_DATA = @INSTALL_DATA@
108 INSTALL_PROGRAM = @INSTALL_PROGRAM@
109 INSTALL_SCRIPT = @INSTALL_SCRIPT@
110 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
111 INTLLIBS = @INTLLIBS@
112 INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
113 LD = @LD@
114 LDFLAGS = @LDFLAGS@
115 LIBICONV = @LIBICONV@
116 LIBINTL = @LIBINTL@
117 LIBOBJS = @LIBOBJS@
118 LIBS = @LIBS@
119 LIBTOOL = @LIBTOOL@
120 LIPO = @LIPO@
121 LN_S = @LN_S@
122 LTLIBICONV = @LTLIBICONV@
123 LTLIBINTL = @LTLIBINTL@
124 LTLIBOBJS = @LTLIBOBJS@
125 MAINT = @MAINT@
126 MAKEINFO = @MAKEINFO@
127 MANIFEST_TOOL = @MANIFEST_TOOL@
128 MKDIR_P = @MKDIR_P@
129 MSGFMT = @MSGFMT@
130 MSGFMT_015 = @MSGFMT_015@
131 MSGMERGE = @MSGMERGE@
132 NM = @NM@
133 NMEDIT = @NMEDIT@
134 OBJDUMP = @OBJDUMP@
135 OBJEXT = @OBJEXT@
136 OTOOL = @OTOOL@
137 OTOOL64 = @OTOOL64@
138 PACKAGE = @PACKAGE@
139 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
140 PACKAGE_NAME = @PACKAGE_NAME@
141 PACKAGE_STRING = @PACKAGE_STRING@
142 PACKAGE_TARNAME = @PACKAGE_TARNAME@
143 PACKAGE_URL = @PACKAGE_URL@
144 PACKAGE_VERSION = @PACKAGE_VERSION@
145 PATH_SEPARATOR = @PATH_SEPARATOR@
146 PA_MODULES_PATH = @PA_MODULES_PATH@
147 PA_VERSION = @PA_VERSION@
148 PE_CFLAGS = @PE_CFLAGS@
149 PE_MODULES_PATH = @PE_MODULES_PATH@
150 PH_CONFIG_PATH = @PH_CONFIG_PATH@
151 PH_INCLUDE_PATH = @PH_INCLUDE_PATH@
152 PH_MODULES_PATH = @PH_MODULES_PATH@
153 PKG_CONFIG = @PKG_CONFIG@
154 POSUB = @POSUB@
155 PY_CFLAGS = @PY_CFLAGS@
156 PY_MODULES_PATH = @PY_MODULES_PATH@
157 PY_VERSION = @PY_VERSION@
158 RANLIB = @RANLIB@
159 RU_CFLAGS = @RU_CFLAGS@
160 RU_MODULES_PATH = @RU_MODULES_PATH@
161 RU_VERSION = @RU_VERSION@
162 SED = @SED@
163 SET_MAKE = @SET_MAKE@
164 SHELL = @SHELL@
165 STRIP = @STRIP@
166 USE_NLS = @USE_NLS@
167 VERSION = @VERSION@
168 VERSION_INFO = @VERSION_INFO@
169 XGETTEXT = @XGETTEXT@
170 XGETTEXT_015 = @XGETTEXT_015@
171 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
172 abs_builddir = @abs_builddir@
173 abs_srcdir = @abs_srcdir@
174 abs_top_builddir = @abs_top_builddir@
175 abs_top_srcdir = @abs_top_srcdir@
176 ac_ct_AR = @ac_ct_AR@
177 ac_ct_CC = @ac_ct_CC@
178 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
179 am__include = @am__include@
180 am__leading_dot = @am__leading_dot@
181 am__quote = @am__quote@
182 am__tar = @am__tar@
183 am__untar = @am__untar@
184 bindir = @bindir@
185 build = @build@
186 build_alias = @build_alias@
187 build_cpu = @build_cpu@
188 build_os = @build_os@
189 build_vendor = @build_vendor@
190 builddir = @builddir@
191 datadir = @datadir@
192 datarootdir = @datarootdir@
193 docdir = @docdir@
194 dvidir = @dvidir@
195 exec_prefix = @exec_prefix@
196 have_fpc = @have_fpc@
197 have_gpc = @have_gpc@
198 have_perl = @have_perl@
199 have_php = @have_php@
200 have_php_config = @have_php_config@
201 have_python = @have_python@
202 have_ruby = @have_ruby@
203 have_swig = @have_swig@
204 host = @host@
205 host_alias = @host_alias@
206 host_cpu = @host_cpu@
207 host_os = @host_os@
208 host_vendor = @host_vendor@
209 htmldir = @htmldir@
210 includedir = @includedir@
211 infodir = @infodir@
212 install_sh = @install_sh@
213 libdir = @libdir@
214 libexecdir = @libexecdir@
215 localedir = @localedir@
216 localstatedir = @localstatedir@
217 mandir = @mandir@
218 mkdir_p = @mkdir_p@
219 oldincludedir = @oldincludedir@
220 pdfdir = @pdfdir@
221 prefix = @prefix@
222 program_transform_name = @program_transform_name@
223 psdir = @psdir@
224 sbindir = @sbindir@
225 sharedstatedir = @sharedstatedir@
226 srcdir = @srcdir@
227 sysconfdir = @sysconfdir@
228 target_alias = @target_alias@
229 top_build_prefix = @top_build_prefix@
230 top_builddir = @top_builddir@
231 top_srcdir = @top_srcdir@
232 EXTRA_DIST = hdate.i
233 @WITH_PERL_TRUE@DEPS = $(top_builddir)/src/libhdate.la
234 @WITH_PERL_TRUE@CLEANFILES = *.o *.cxx *.so *wrap* *.pm
235 all: all-am
236
237 .SUFFIXES:
238 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
239 @for dep in $?; do \
240 case '$(am__configure_deps)' in \
241 *$$dep*) \
242 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
243 && { if test -f $@; then exit 0; else break; fi; }; \
244 exit 1;; \
245 esac; \
246 done; \
247 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu bindings/perl/Makefile'; \
248 $(am__cd) $(top_srcdir) && \
249 $(AUTOMAKE) --gnu bindings/perl/Makefile
250 .PRECIOUS: Makefile
251 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
252 @case '$?' in \
253 *config.status*) \
254 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
255 *) \
256 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
257 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
258 esac;
259
260 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
261 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
262
263 $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
264 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
265 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
266 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
267 $(am__aclocal_m4_deps):
268
269 mostlyclean-libtool:
270 -rm -f *.lo
271
272 clean-libtool:
273 -rm -rf .libs _libs
274 tags: TAGS
275 TAGS:
276
277 ctags: CTAGS
278 CTAGS:
279
280
281 distdir: $(DISTFILES)
282 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
283 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
284 list='$(DISTFILES)'; \
285 dist_files=`for file in $$list; do echo $$file; done | \
286 sed -e "s|^$$srcdirstrip/||;t" \
287 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
288 case $$dist_files in \
289 */*) $(MKDIR_P) `echo "$$dist_files" | \
290 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
291 sort -u` ;; \
292 esac; \
293 for file in $$dist_files; do \
294 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
295 if test -d $$d/$$file; then \
296 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
297 if test -d "$(distdir)/$$file"; then \
298 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
299 fi; \
300 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
301 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
302 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
303 fi; \
304 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
305 else \
306 test -f "$(distdir)/$$file" \
307 || cp -p $$d/$$file "$(distdir)/$$file" \
308 || exit 1; \
309 fi; \
310 done
311 check-am: all-am
312 check: check-am
313 all-am: Makefile
314 installdirs:
315 install: install-am
316 install-exec: install-exec-am
317 install-data: install-data-am
318 uninstall: uninstall-am
319
320 install-am: all-am
321 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
322
323 installcheck: installcheck-am
324 install-strip:
325 if test -z '$(STRIP)'; then \
326 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
327 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
328 install; \
329 else \
330 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
331 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
332 "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
333 fi
334 mostlyclean-generic:
335
336 clean-generic:
337 -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
338
339 distclean-generic:
340 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
341 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
342
343 maintainer-clean-generic:
344 @echo "This command is intended for maintainers to use"
345 @echo "it deletes files that may require special tools to rebuild."
346 @WITH_PERL_FALSE@install-data-local:
347 clean: clean-am
348
349 clean-am: clean-generic clean-libtool mostlyclean-am
350
351 distclean: distclean-am
352 -rm -f Makefile
353 distclean-am: clean-am distclean-generic
354
355 dvi: dvi-am
356
357 dvi-am:
358
359 html: html-am
360
361 html-am:
362
363 info: info-am
364
365 info-am:
366
367 install-data-am: install-data-local
368
369 install-dvi: install-dvi-am
370
371 install-dvi-am:
372
373 install-exec-am:
374
375 install-html: install-html-am
376
377 install-html-am:
378
379 install-info: install-info-am
380
381 install-info-am:
382
383 install-man:
384
385 install-pdf: install-pdf-am
386
387 install-pdf-am:
388
389 install-ps: install-ps-am
390
391 install-ps-am:
392
393 installcheck-am:
394
395 maintainer-clean: maintainer-clean-am
396 -rm -f Makefile
397 maintainer-clean-am: distclean-am maintainer-clean-generic
398
399 mostlyclean: mostlyclean-am
400
401 mostlyclean-am: mostlyclean-generic mostlyclean-libtool
402
403 pdf: pdf-am
404
405 pdf-am:
406
407 ps: ps-am
408
409 ps-am:
410
411 uninstall-am:
412
413 .MAKE: install-am install-strip
414
415 .PHONY: all all-am check check-am clean clean-generic clean-libtool \
416 distclean distclean-generic distclean-libtool distdir dvi \
417 dvi-am html html-am info info-am install install-am \
418 install-data install-data-am install-data-local install-dvi \
419 install-dvi-am install-exec install-exec-am install-html \
420 install-html-am install-info install-info-am install-man \
421 install-pdf install-pdf-am install-ps install-ps-am \
422 install-strip installcheck installcheck-am installdirs \
423 maintainer-clean maintainer-clean-generic mostlyclean \
424 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
425 uninstall uninstall-am
426
427
428 @WITH_PERL_TRUE@all-am: hdate.so
429
430 @WITH_PERL_TRUE@hdate.so: hdate_wrap.cxx
431 @WITH_PERL_TRUE@ g++ -fpic -c hdate_wrap.cxx $(PE_CFLAGS) -I$(top_srcdir)/src
432 @WITH_PERL_TRUE@ g++ -shared hdate_wrap.o ../../src/.libs/libhdate.so -o hdate.so
433
434 @WITH_PERL_TRUE@hdate_wrap.cxx: hdate.i
435 @WITH_PERL_TRUE@ swig -perl -c++ hdate.i
436
437 @WITH_PERL_TRUE@install-data-local: hdate.so
438 @WITH_PERL_TRUE@ $(mkinstalldirs) $(DESTDIR)$(PE_MODULES_PATH)/auto/hdate/
439 @WITH_PERL_TRUE@ $(INSTALL_DATA) hdate.so $(DESTDIR)$(PE_MODULES_PATH)/auto/hdate/hdate.so
440 @WITH_PERL_TRUE@ $(INSTALL_DATA) hdate.pm $(DESTDIR)$(PE_MODULES_PATH)/hdate.pm
441
442 # Tell versions [3.59,3.63) of GNU make to not export all variables.
443 # Otherwise a system limit (for SysV at least) may be exceeded.
444 .NOEXPORT:
0
1 EXTRA_DIST = hdate.i
2
3 if WITH_PYTHON
4
5 DEPS= $(top_builddir)/src/libhdate.la
6
7 CLEANFILES = *.o *.cxx *.so *wrap* *.py
8
9 all-am: _hdate.so
10
11
12 _hdate.so: hdate_wrap.cxx
13 g++ -fpic -c hdate_wrap.cxx $(PY_CFLAGS) -I$(top_srcdir)/src
14 g++ -shared hdate_wrap.o ../../src/.libs/libhdate.so -o _hdate.so
15
16 hdate_wrap.cxx: hdate.i
17 swig -python -c++ hdate.i
18
19 install-data-local: _hdate.so
20 $(mkinstalldirs) $(DESTDIR)$(PY_MODULES_PATH)
21 $(INSTALL_DATA) _hdate.so $(DESTDIR)$(PY_MODULES_PATH)/_hdate.so
22 $(INSTALL_DATA) hdate.py $(DESTDIR)$(PY_MODULES_PATH)/hdate.py
23
24 endif
0 # Makefile.in generated by automake 1.11.6 from Makefile.am.
1 # @configure_input@
2
3 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
4 # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
5 # Foundation, Inc.
6 # This Makefile.in is free software; the Free Software Foundation
7 # gives unlimited permission to copy and/or distribute it,
8 # with or without modifications, as long as this notice is preserved.
9
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
12 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13 # PARTICULAR PURPOSE.
14
15 @SET_MAKE@
16 VPATH = @srcdir@
17 am__make_dryrun = \
18 { \
19 am__dry=no; \
20 case $$MAKEFLAGS in \
21 *\\[\ \ ]*) \
22 echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
23 | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
24 *) \
25 for am__flg in $$MAKEFLAGS; do \
26 case $$am__flg in \
27 *=*|--*) ;; \
28 *n*) am__dry=yes; break;; \
29 esac; \
30 done;; \
31 esac; \
32 test $$am__dry = yes; \
33 }
34 pkgdatadir = $(datadir)/@PACKAGE@
35 pkgincludedir = $(includedir)/@PACKAGE@
36 pkglibdir = $(libdir)/@PACKAGE@
37 pkglibexecdir = $(libexecdir)/@PACKAGE@
38 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
39 install_sh_DATA = $(install_sh) -c -m 644
40 install_sh_PROGRAM = $(install_sh) -c
41 install_sh_SCRIPT = $(install_sh) -c
42 INSTALL_HEADER = $(INSTALL_DATA)
43 transform = $(program_transform_name)
44 NORMAL_INSTALL = :
45 PRE_INSTALL = :
46 POST_INSTALL = :
47 NORMAL_UNINSTALL = :
48 PRE_UNINSTALL = :
49 POST_UNINSTALL = :
50 build_triplet = @build@
51 host_triplet = @host@
52 subdir = bindings/python
53 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
54 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
55 am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
56 $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
57 $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
58 $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
59 $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
60 $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
61 $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
62 $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.in
63 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
64 $(ACLOCAL_M4)
65 mkinstalldirs = $(install_sh) -d
66 CONFIG_CLEAN_FILES =
67 CONFIG_CLEAN_VPATH_FILES =
68 SOURCES =
69 DIST_SOURCES =
70 am__can_run_installinfo = \
71 case $$AM_UPDATE_INFO_DIR in \
72 n|no|NO) false;; \
73 *) (install-info --version) >/dev/null 2>&1;; \
74 esac
75 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
76 ACLOCAL = @ACLOCAL@
77 AMTAR = @AMTAR@
78 AR = @AR@
79 AUTOCONF = @AUTOCONF@
80 AUTOHEADER = @AUTOHEADER@
81 AUTOMAKE = @AUTOMAKE@
82 AWK = @AWK@
83 CC = @CC@
84 CCDEPMODE = @CCDEPMODE@
85 CFLAGS = @CFLAGS@
86 CPP = @CPP@
87 CPPFLAGS = @CPPFLAGS@
88 CYGPATH_W = @CYGPATH_W@
89 DATADIRNAME = @DATADIRNAME@
90 DEFS = @DEFS@
91 DEPDIR = @DEPDIR@
92 DLLTOOL = @DLLTOOL@
93 DSYMUTIL = @DSYMUTIL@
94 DUMPBIN = @DUMPBIN@
95 ECHO_C = @ECHO_C@
96 ECHO_N = @ECHO_N@
97 ECHO_T = @ECHO_T@
98 EGREP = @EGREP@
99 EXEEXT = @EXEEXT@
100 FGREP = @FGREP@
101 GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
102 GMSGFMT = @GMSGFMT@
103 GMSGFMT_015 = @GMSGFMT_015@
104 GP_MODULES_PATH = @GP_MODULES_PATH@
105 GREP = @GREP@
106 INSTALL = @INSTALL@
107 INSTALL_DATA = @INSTALL_DATA@
108 INSTALL_PROGRAM = @INSTALL_PROGRAM@
109 INSTALL_SCRIPT = @INSTALL_SCRIPT@
110 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
111 INTLLIBS = @INTLLIBS@
112 INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
113 LD = @LD@
114 LDFLAGS = @LDFLAGS@
115 LIBICONV = @LIBICONV@
116 LIBINTL = @LIBINTL@
117 LIBOBJS = @LIBOBJS@
118 LIBS = @LIBS@
119 LIBTOOL = @LIBTOOL@
120 LIPO = @LIPO@
121 LN_S = @LN_S@
122 LTLIBICONV = @LTLIBICONV@
123 LTLIBINTL = @LTLIBINTL@
124 LTLIBOBJS = @LTLIBOBJS@
125 MAINT = @MAINT@
126 MAKEINFO = @MAKEINFO@
127 MANIFEST_TOOL = @MANIFEST_TOOL@
128 MKDIR_P = @MKDIR_P@
129 MSGFMT = @MSGFMT@
130 MSGFMT_015 = @MSGFMT_015@
131 MSGMERGE = @MSGMERGE@
132 NM = @NM@
133 NMEDIT = @NMEDIT@
134 OBJDUMP = @OBJDUMP@
135 OBJEXT = @OBJEXT@
136 OTOOL = @OTOOL@
137 OTOOL64 = @OTOOL64@
138 PACKAGE = @PACKAGE@
139 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
140 PACKAGE_NAME = @PACKAGE_NAME@
141 PACKAGE_STRING = @PACKAGE_STRING@
142 PACKAGE_TARNAME = @PACKAGE_TARNAME@
143 PACKAGE_URL = @PACKAGE_URL@
144 PACKAGE_VERSION = @PACKAGE_VERSION@
145 PATH_SEPARATOR = @PATH_SEPARATOR@
146 PA_MODULES_PATH = @PA_MODULES_PATH@
147 PA_VERSION = @PA_VERSION@
148 PE_CFLAGS = @PE_CFLAGS@
149 PE_MODULES_PATH = @PE_MODULES_PATH@
150 PH_CONFIG_PATH = @PH_CONFIG_PATH@
151 PH_INCLUDE_PATH = @PH_INCLUDE_PATH@
152 PH_MODULES_PATH = @PH_MODULES_PATH@
153 PKG_CONFIG = @PKG_CONFIG@
154 POSUB = @POSUB@
155 PY_CFLAGS = @PY_CFLAGS@
156 PY_MODULES_PATH = @PY_MODULES_PATH@
157 PY_VERSION = @PY_VERSION@
158 RANLIB = @RANLIB@
159 RU_CFLAGS = @RU_CFLAGS@
160 RU_MODULES_PATH = @RU_MODULES_PATH@
161 RU_VERSION = @RU_VERSION@
162 SED = @SED@
163 SET_MAKE = @SET_MAKE@
164 SHELL = @SHELL@
165 STRIP = @STRIP@
166 USE_NLS = @USE_NLS@
167 VERSION = @VERSION@
168 VERSION_INFO = @VERSION_INFO@
169 XGETTEXT = @XGETTEXT@
170 XGETTEXT_015 = @XGETTEXT_015@
171 XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
172 abs_builddir = @abs_builddir@
173 abs_srcdir = @abs_srcdir@
174 abs_top_builddir = @abs_top_builddir@
175 abs_top_srcdir = @abs_top_srcdir@
176 ac_ct_AR = @ac_ct_AR@
177 ac_ct_CC = @ac_ct_CC@
178 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
179 am__include = @am__include@
180 am__leading_dot = @am__leading_dot@
181 am__quote = @am__quote@
182 am__tar = @am__tar@
183 am__untar = @am__untar@
184 bindir = @bindir@
185 build = @build@
186 build_alias = @build_alias@
187 build_cpu = @build_cpu@
188 build_os = @build_os@
189 build_vendor = @build_vendor@
190 builddir = @builddir@
191 datadir = @datadir@
192 datarootdir = @datarootdir@
193 docdir = @docdir@
194 dvidir = @dvidir@
195 exec_prefix = @exec_prefix@
196 have_fpc = @have_fpc@
197 have_gpc = @have_gpc@
198 have_perl = @have_perl@
199 have_php = @have_php@
200 have_php_config = @have_php_config@
201 have_python = @have_python@
202 have_ruby = @have_ruby@
203 have_swig = @have_swig@
204 host = @host@
205 host_alias = @host_alias@
206 host_cpu = @host_cpu@
207 host_os = @host_os@
208 host_vendor = @host_vendor@
209 htmldir = @htmldir@
210 includedir = @includedir@
211 infodir = @infodir@
212 install_sh = @install_sh@
213 libdir = @libdir@
214 libexecdir = @libexecdir@
215 localedir = @localedir@
216 localstatedir = @localstatedir@
217 mandir = @mandir@
218 mkdir_p = @mkdir_p@
219 oldincludedir = @oldincludedir@
220 pdfdir = @pdfdir@
221 prefix = @prefix@
222 program_transform_name = @program_transform_name@
223 psdir = @psdir@
224 sbindir = @sbindir@
225 sharedstatedir = @sharedstatedir@
226 srcdir = @srcdir@
227 sysconfdir = @sysconfdir@
228 target_alias = @target_alias@
229 top_build_prefix = @top_build_prefix@
230 top_builddir = @top_builddir@
231 top_srcdir = @top_srcdir@
232 EXTRA_DIST = hdate.i
233 @WITH_PYTHON_TRUE@DEPS = $(top_builddir)/src/libhdate.la
234 @WITH_PYTHON_TRUE@CLEANFILES = *.o *.cxx *.so *wrap* *.py
235 all: all-am
236
237 .SUFFIXES:
238 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
239 @for dep in $?; do \
240 case '$(am__configure_deps)' in \
241 *$$dep*) \
242 ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
243 && { if test -f $@; then exit 0; else break; fi; }; \
244 exit 1;; \
245 esac; \
246 done; \
247 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu bindings/python/Makefile'; \
248 $(am__cd) $(top_srcdir) && \
249 $(AUTOMAKE) --gnu bindings/python/Makefile
250 .PRECIOUS: Makefile
251 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
252 @case '$?' in \
253 *config.status*) \
254 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
255 *) \
256 echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
257 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
258 esac;
259
260 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
261 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
262
263 $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
264 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
265 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
266 cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
267 $(am__aclocal_m4_deps):
268
269 mostlyclean-libtool:
270 -rm -f *.lo
271
272 clean-libtool:
273 -rm -rf .libs _libs
274 tags: TAGS
275 TAGS:
276
277 ctags: CTAGS
278 CTAGS:
279
280
281 distdir: $(DISTFILES)
282 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
283 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
284 list='$(DISTFILES)'; \
285 dist_files=`for file in $$list; do echo $$file; done | \
286 sed -e "s|^$$srcdirstrip/||;t" \
287 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
288 case $$dist_files in \
289 */*) $(MKDIR_P) `echo "$$dist_files" | \
290 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
291 sort -u` ;; \
292 esac; \
293 for file in $$dist_files; do \
294 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
295 if test -d $$d/$$file; then \
296 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
297 if test -d "$(distdir)/$$file"; then \
298 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
299 fi; \
300 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
301 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
302 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
303 fi; \
304 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
305 else \
306 test -f "$(distdir)/$$file" \
307 || cp -p $$d/$$file "$(distdir)/$$file" \
308 || exit 1; \
309 fi; \
310 done
311 check-am: all-am
312 check: check-am
313 all-am: Makefile
314 installdirs:
315 install: install-am
316 install-exec: install-exec-am
317 install-data: install-data-am
318 uninstall: uninstall-am
319
320 install-am: all-am
321 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
322
323 installcheck: installcheck-am
324 install-strip:
325 if test -z '$(STRIP)'; then \
326 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
327 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
328 install; \
329 else \
330 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
331 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
332 "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
333 fi
334 mostlyclean-generic:
335
336 clean-generic:
337 -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
338
339 distclean-generic:
340 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
341 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
342
343 maintainer-clean-generic:
344 @echo "This command is intended for maintainers to use"
345 @echo "it deletes files that may require special tools to rebuild."
346 @WITH_PYTHON_FALSE@install-data-local:
347 clean: clean-am
348
349 clean-am: clean-generic clean-libtool mostlyclean-am
350
351 distclean: distclean-am
352 -rm -f Makefile
353 distclean-am: clean-am distclean-generic
354
355 dvi: dvi-am
356
357 dvi-am:
358
359 html: html-am
360
361 html-am:
362
363 info: info-am
364
365 info-am:
366
367 install-data-am: install-data-local
368
369 install-dvi: install-dvi-am
370
371 install-dvi-am:
372
373 install-exec-am:
374
375 install-html: install-html-am
376
377 install-html-am:
378
379 install-info: install-info-am
380
381 install-info-am:
382
383 install-man:
384
385 install-pdf: install-pdf-am
386
387 install-pdf-am:
388
389 install-ps: install-ps-am
390
391 install-ps-am:
392
393 installcheck-am:
394
395 maintainer-clean: maintainer-clean-am
396 -rm -f Makefile
397 maintainer-clean-am: distclean-am maintainer-clean-generic
398
399 mostlyclean: mostlyclean-am
400
401 mostlyclean-am: mostlyclean-generic mostlyclean-libtool
402
403 pdf: pdf-am
404
405 pdf-am:
406
407 ps: ps-am
408
409 ps-am:
410
411 uninstall-am:
412
413 .MAKE: install-am install-strip
414
415 .PHONY: all all-am check check-am clean clean-generic clean-libtool \
416 distclean distclean-generic distclean-libtool distdir dvi \
417 dvi-am html html-am info info-am install install-am \
418 install-data install-data-am install-data-local install-dvi \
419 install-dvi-am install-exec install-exec-am install-html \
420 install-html-am install-info install-info-am install-man \
421 install-pdf install-pdf-am install-ps install-ps-am \
422 install-strip installcheck installcheck-am installdirs \
423 maintainer-clean maintainer-clean-generic mostlyclean \
424 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
425 uninstall uninstall-am
426
427
428 @WITH_PYTHON_TRUE@all-am: _hdate.so
429
430 @WITH_PYTHON_TRUE@_hdate.so: hdate_wrap.cxx
431 @WITH_PYTHON_TRUE@ g++ -fpic -c hdate_wrap.cxx $(PY_CFLAGS) -I$(top_srcdir)/src
432 @WITH_PYTHON_TRUE@ g++ -shared hdate_wrap.o ../../src/.libs/libhdate.so -o _hdate.so
433
434 @WITH_PYTHON_TRUE@hdate_wrap.cxx: hdate.i
435 @WITH_PYTHON_TRUE@ swig -python -c++ hdate.i
436
437 @WITH_PYTHON_TRUE@install-data-local: _hdate.so
438 @WITH_PYTHON_TRUE@ $(mkinstalldirs) $(DESTDIR)$(PY_MODULES_PATH)
439 @WITH_PYTHON_TRUE@ $(INSTALL_DATA) _hdate.so $(DESTDIR)$(PY_MODULES_PATH)/_hdate.so
440 @WITH_PYTHON_TRUE@ $(INSTALL_DATA) hdate.py $(DESTDIR)$(PY_MODULES_PATH)/hdate.py
441
442 # Tell versions [3.59,3.63) of GNU make to not export all variables.
443 # Otherwise a system limit (for SysV at least) may be exceeded.
444 .NOEXPORT:
0 AC_INIT(src/hdate.h)
1
2 dnl Set release number
3 PACKAGE=libhdate
4 LIBHDATE_MAJOR_VERSION=1
5 LIBHDATE_MINOR_VERSION=6
6 LIBHDATE_MICRO_VERSION=02
7
8 VERSION=$LIBHDATE_MAJOR_VERSION.$LIBHDATE_MINOR_VERSION.$LIBHDATE_MICRO_VERSION
9
10 dnl libtool library numbering
11 VERSION_INFO=$LIBHDATE_MAJOR_VERSION:$LIBHDATE_MINOR_VERSION:0
12
13 AC_SUBST(VERSION_INFO)
14
15 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
16 AM_MAINTAINER_MODE
17
18 dnl Checks for programs.
19 AC_ISC_POSIX
20 AC_GNU_SOURCE
21 AC_USE_SYSTEM_EXTENSIONS
22 AC_PROG_CC
23 AC_PROG_INSTALL
24 AC_PROG_LN_S
25 AC_PROG_MAKE_SET
26 AC_STDC_HEADERS
27 AM_PROG_LIBTOOL
28
29 AM_MAINTAINER_MODE
30
31 AC_C_CONST
32 AC_CONFIG_MACRO_DIR([m4])
33 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
34
35 CFLAGS=" -Wall -g -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -O1 -fstack-protector --param ssp-buffer-size=4 -fPIE -pie"
36 LIBS=-lm
37
38 dnl =======================================================================================
39
40 AC_CHECK_PROG(have_swig, "swig", yes, no)
41
42 dnl =======================================================================================
43
44 AC_CHECK_PROG(have_fpc, "fpc", yes, no)
45
46 build_fpc=$have_fpc
47
48 AC_ARG_ENABLE([fpc],
49 [AS_HELP_STRING([--disable-fpc],
50 [do not build free pascal binding])],
51 [build_fpc=no], [build_fpc=$have_fpc])
52
53 if test "$have_fpc" = "yes"; then
54 PA_VERSION=`fpc -iV`
55 PA_TPR=`fpc -iTP`
56 PA_TOS=`fpc -iTO`
57 PA_MODULES_PATH="/usr/lib/fpc/$PA_VERSION/units/$PA_TPR-$PA_TOS"
58 AC_SUBST([PA_VERSION])
59 AC_SUBST([PA_MODULES_PATH])
60 fi
61
62 dnl =======================================================================================
63
64 AC_CHECK_PROG(have_gpc, "gpc", yes, no)
65
66 build_gpc=$have_gpc
67
68 AC_ARG_ENABLE([gpc],
69 [AS_HELP_STRING([--disable-gpc],
70 [do not build gnu pascal binding])],
71 [build_gpc=no], [build_gpc=$have_gpc])
72
73 if test "$have_gpc" = "yes"; then
74 GP_MODULES_PATH=`gpc -print-search-dirs | grep install | cut -d' ' -f 2`
75 AC_SUBST([GP_MODULES_PATH])
76 fi
77
78 dnl =======================================================================================
79
80 AM_CONDITIONAL(WITH_GPC_FPC, [test "$build_fpc" = "yes" -a "$build_gpc" = "yes" ])
81 AM_CONDITIONAL(WITH_GPC, [test "$build_gpc" = "yes" -a "$build_fpc" != "yes" ])
82 AM_CONDITIONAL(WITH_FPC, [test "$build_gpc" != "yes" -a "$build_fpc" = "yes" ])
83
84 dnl =======================================================================================
85
86 AC_CHECK_PROG(have_python, "python", yes, no)
87
88 build_python=$have_python
89
90 AC_ARG_ENABLE([python],
91 [AS_HELP_STRING([--disable-python],
92 [do not build python binding])],
93 [build_python=no], [build_python=$have_python])
94
95 AC_ARG_WITH(python-sitelib-dir,
96 [AS_HELP_STRING([--with-python-sitelib-dir=PATH],
97 [path to python site lib])])
98
99 if test "$have_python" = "yes"; then
100 PY_PREFIX=`python -c 'import sys ; print sys.prefix'`
101 PY_VERSION=`python -c 'import sys ; print sys.version[[0:3]]'`
102 AC_MSG_CHECKING(for $PY_PREFIX/include/python$PY_VERSION/Python.h)
103 if test -f $PY_PREFIX/include/python$PY_VERSION/Python.h; then
104 AC_MSG_RESULT(yes)
105 PY_CFLAGS="-I$PY_PREFIX/include/python$PY_VERSION"
106
107 if test "$with_python_sitelib_dir" = "" ; then
108 PY_MODULES_PATH="$PY_PREFIX/lib/python$PY_VERSION/dist-packages"
109 else
110 PY_MODULES_PATH=$with_python_sitelib_dir
111 fi
112
113 AC_SUBST([PY_VERSION])
114 AC_SUBST([PY_CFLAGS])
115 AC_SUBST([PY_MODULES_PATH])
116 if test "$have_swig" = "no"; then
117 build_python=no
118 fi
119 else
120 AC_MSG_RESULT(no)
121 build_python=no
122 fi
123 fi
124
125 AM_CONDITIONAL(WITH_PYTHON, test "$build_python" = "yes")
126
127 dnl =======================================================================================
128
129 AC_CHECK_PROG(have_ruby, "ruby", yes, no)
130
131 build_ruby=$have_ruby
132
133 AC_ARG_ENABLE([ruby],
134 [AS_HELP_STRING([--disable-ruby],
135 [do not build ruby binding])],
136 [build_ruby=no], [build_ruby=$have_ruby])
137
138 AC_ARG_WITH(ruby-sitelib-dir,
139 [AS_HELP_STRING([--with-ruby-sitelib-dir=PATH],
140 [path to ruby site lib])])
141
142 if test "$have_ruby" = "yes"; then
143 RU_PREFIX=`ruby -e 'require "mkmf"; puts $topdir'`
144 RU_VERSION=`ruby -e "require 'mkmf'; puts config_string('MAJOR')"`
145 RU_VERSION+=.`ruby -e "require 'mkmf'; puts config_string('MINOR')"`
146 AC_MSG_CHECKING(for $RU_PREFIX/ruby.h)
147 if test -f $RU_PREFIX/ruby.h; then
148 AC_MSG_RESULT(yes)
149 RU_CFLAGS="-I$RU_PREFIX"
150
151 if test "$with_ruby_sitelib_dir" = "" ; then
152 RU_MODULES_PATH="$RU_PREFIX"
153 else
154 RU_MODULES_PATH=$with_ruby_sitelib_dir
155 fi
156
157 AC_SUBST([RU_VERSION])
158 AC_SUBST([RU_CFLAGS])
159 AC_SUBST([RU_MODULES_PATH])
160 if test "$have_swig" = "no"; then
161 build_ruby=no
162 fi
163 else
164 AC_MSG_RESULT(no)
165 build_ruby=no
166 fi
167 fi
168
169 AM_CONDITIONAL(WITH_RUBY, test "$build_ruby" = "yes")
170
171 dnl =======================================================================================
172
173 AC_CHECK_PROG(have_php, "php", yes, no)
174
175 build_php=$have_php
176
177 AC_ARG_ENABLE([php],
178 [AS_HELP_STRING([--disable-php],
179 [do not build php binding])],
180 [build_php=no], [build_php=$have_php])
181
182 AC_ARG_WITH(php-sitelib-dir,
183 [AS_HELP_STRING([--with-php-sitelib-dir=PATH],
184 [path to php site lib])])
185
186 if test "$have_php" = "yes"; then
187 AC_CHECK_PROG(have_php_config, "php-config5", yes, no)
188 if test "$have_php_config" = "yes"; then
189
190 PH_CONFIG_PATH=`php --ini | grep "Scan" | cut -d: -f2 | sed 's/\s//g'`
191 PH_INCLUDE_PATH=`php -r "echo get_include_path();" | cut -f2 -d:`
192 if test "$with_php_sitelib_dir" = "" ; then
193 PH_MODULES_PATH=`php-config5 --extension-dir`
194 else
195 PH_MODULES_PATH=$with_php_sitelib_dir
196 fi
197
198 AC_SUBST([PH_CONFIG_PATH])
199 AC_SUBST([PH_INCLUDE_PATH])
200 AC_SUBST([PH_MODULES_PATH])
201 if test "$have_swig" = "no"; then
202 build_php=no
203 fi
204 else
205 AC_MSG_RESULT(no)
206 build_php=no
207 fi
208 fi
209
210 AM_CONDITIONAL(WITH_PHP, test "$build_php" = "yes")
211
212 dnl =======================================================================================
213
214 AC_CHECK_PROG(have_perl, "perl", yes, no)
215
216 build_perl=$have_perl
217
218 AC_ARG_ENABLE([perl],
219 [AS_HELP_STRING([--disable-perl],
220 [do not build perl binding])],
221 [build_perl=no], [build_perl=$have_perl])
222
223 AC_ARG_WITH(perl-sitelib-dir,
224 [AS_HELP_STRING([--with-perl-sitelib-dir=PATH],
225 [path to perl site lib])])
226
227 if test "$have_perl" = "yes"; then
228 PE_PREFIX=`(perl -e 'use Config; print $Config{archlib};')`
229 AC_MSG_CHECKING(for $PE_PREFIX/CORE/perl.h)
230 if test -f $PE_PREFIX/CORE/perl.h; then
231 AC_MSG_RESULT(yes)
232 PE_CFLAGS="-I$PE_PREFIX/CORE "
233 PE_CFLAGS=$PE_CFLAGS`(perl -e 'use Config; print $Config{cppflags};')`
234
235 if test "$with_perl_sitelib_dir" = "" ; then
236 PE_MODULES_PATH=`(perl -e 'use Config; print $Config{sitelib};')`
237 else
238 PE_MODULES_PATH=$with_perl_sitelib_dir
239 fi
240
241 AC_SUBST([PE_CFLAGS])
242 AC_SUBST([PE_MODULES_PATH])
243 if test "x$have_swig" = "xno"; then
244 build_perl=no
245 fi
246 else
247 AC_MSG_RESULT(no)
248 build_perl=no
249 fi
250 fi
251
252 AM_CONDITIONAL(WITH_PERL, test "$build_perl" = "yes")
253
254 dnl =======================================================================================
255
256 dnl gettext
257
258 dnl Languages which your application supports
259 ALL_LINGUAS="he es_MX ru fr sv"
260 AM_GNU_GETTEXT([external])
261 AM_GNU_GETTEXT_VERSION([0.18.1])
262
263 if test "$DATADIRNAME" = ""; then
264 DATADIRNAME="share"
265 AC_SUBST(DATADIRNAME)
266 fi
267
268 localepath=`eval eval echo ${localedir}`
269
270 AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR, "${localepath}")
271
272 dnl =======================================================================================
273
274 build_hcal=yes
275
276 AC_ARG_ENABLE([hcal],
277 [AS_HELP_STRING([--disable-hcal],
278 [do not build hcal/hdate utility programs])],
279 [build_hcal=no], [build_hcal=yes])
280
281 AM_CONDITIONAL(WITH_HCAL, test "$build_hcal" = "yes")
282
283 dnl =======================================================================================
284
285 AC_SUBST(CFLAGS)
286 AC_SUBST(LIBS)
287
288 dnl =======================================================================================
289
290 AC_OUTPUT([
291 Makefile
292 libhdate.pc
293 po/Makefile.in
294 docs/Makefile
295 docs/man/Makefile
296 docs/man/man1/Makefile
297 docs/man/man3/Makefile
298 src/Makefile
299 examples/Makefile
300 examples/hcal/Makefile
301 examples/bindings/Makefile
302 examples/bindings/pascal/Makefile
303 bindings/Makefile
304 bindings/python/Makefile
305 bindings/perl/Makefile
306 bindings/pascal/Makefile
307 bindings/ruby/Makefile
308 bindings/php/Makefile
309 ])
310
311 dnl ===========================================================================================
312
313 echo "
314 $PACKAGE-$VERSION
315
316 prefix: ${prefix}
317 compiler: ${CC}
318 locale-dir: $localepath
319
320 have swig ${have_swig}
321 have free pascal ${have_fpc}
322 have gnu pascal ${have_gpc}
323 have python ${have_python}
324 have perl ${have_perl}
325 have ruby ${have_ruby}
326 have php ${have_php} php-dev,php-cli ${have_php_config}
327
328 build hcal ${build_hcal}
329
330 build python binding ${build_python}
331 build perl binding ${build_perl}
332 puild free pascal binding ${build_fpc}
333 puild ruby binding ${build_ruby}
334 puild php binding ${build_php}
335
336 perl site lib path: $PE_MODULES_PATH
337 python site lib path: $PY_MODULES_PATH
338 free pascal site lib path: $PA_MODULES_PATH
339 gnu pascal site lib path: $GP_MODULES_PATH
340 ruby site lib path: $RU_MODULES_PATH
341 php site lib path: $PH_MODULES_PATH
342 php config path: $PH_CONFIG_PATH
343 php include path: $PH_INCLUDE_PATH
344 "
0 /* hcal.c http://libhdate.sourceforge.net
1 * Hebrew calendar (part of package libhdate)
2 *
3 * compile:
4 * gcc `pkg-config --libs --cflags libhdate` hcal.c -o hcal
5 *
6 * Copyright: 2011-2012 (c) Boruch Baum, 2004-2010 (c) Yaacov Zamir
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (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, see <http://www.gnu.org/licenses/>.
20 */
21
22 #include <stdio.h> // For printf
23 #include <hdate.h> // For hebrew date
24 //#include "../../src/hdate.h"
25 #include <stdlib.h> // For atoi, malloc
26 #include <locale.h> // For setlocale
27 #include <getopt.h> // For getopt_long
28 #include <string.h> // For strlen, mempcpy
29 #include <time.h> // For time, tzset
30 //#include <wchar.h> // for unicode character operations
31
32 #define FALSE 0
33 #define TRUE -1
34 #define SHABBAT 7
35
36 #define HDATE_STRING_SHORT 1
37
38 // for opt.menu[MAX_MENU_ITEMS]
39 #define MAX_MENU_ITEMS 10
40
41
42
43 // for colorization
44 #define CODE_REVERSE_VIDEO "%c[7m", 27
45 #define CODE_RESTORE_VIDEO "%c[m", 27
46 #define CODE_BLACK "%c[30m", 27
47 #define CODE_LIGHT_RED "%c[31m", 27
48 #define CODE_LIGHT_GREEN "%c[32m", 27
49 #define CODE_LIGHT_BROWN "%c[33m", 27
50 #define CODE_DARK_BLUE "%c[34m", 27
51 #define CODE_LIGHT_PURPLE "%c[35m", 27
52 #define CODE_LIGHT_AQUA "%c[36m", 27
53 #define CODE_LIGHT_GREY "%c[37m", 27
54 #define CODE_BOLD_GREY "%c[1;30m", 27
55 #define CODE_BOLD_RED "%c[1;31m", 27
56 #define CODE_BOLD_GREEN "%c[1;32m", 27
57 #define CODE_BOLD_YELLOW "%c[1;33m", 27
58 #define CODE_BOLD_BLUE "%c[1;34m", 27
59 #define CODE_BOLD_PURPLE "%c[1;35m", 27
60 #define CODE_BOLD_AQUA "%c[1;36m", 27
61 #define CODE_BOLD_WHITE "%c[1;37m", 27
62 #define ELEMENT_WEEKDAY_G 1
63 #define ELEMENT_WEEKDAY_H 2
64 #define ELEMENT_SHABBAT_DAY 3
65 #define ELEMENT_HOLIDAY_DAY 4
66 #define ELEMENT_HOLIDAY_FLAG 5
67 #define ELEMENT_SHABBAT_NAME 6
68 #define ELEMENT_WEEKDAY_NAMES 7
69 #define ELEMENT_MONTH_G 8
70 #define ELEMENT_MONTH_H 9
71 #define ELEMENT_SHABBAT_TIMES 10
72 #define ELEMENT_PARASHA 11
73 #define ELEMENT_THIS_SHABBAT_TIMES 12
74 #define ELEMENT_THIS_PARASHA 13
75 #define ELEMENT_HOLIDAY_NAME 14
76 #define ELEMENT_TODAY_HOLIDAY_DAY 15
77 #define ELEMENT_TODAY_HOLIDAY_NAME 16
78
79 /**************************************************
80 * functions to support hcal and hdate
81 **************************************************/
82 #include "./local_functions.c"
83
84
85
86 static char holiday_flag[] = { '/', '+', '*', '~', '!', '@', '#', '$', '%', '^' };
87 /* Holiday types: (reference hdate_holyday.c)
88 / - 0 - Regular day
89 + - 1 - Yom tov (plus yom kippor)
90 * - 2 - Erev yom kippur
91 ~ - 3 - Hol hamoed
92 ! - 4 - Hanuka and purim
93 @ - 5 - Tzomot
94 # - 6 - Independance day and Yom yerushalaim
95 $ - 7 - Lag baomer ,Tu beav, Tu beshvat
96 % - 8 - Tzahal and Holocaust memorial days
97 ^ - 9 - National days
98 */
99
100
101
102 typedef struct {
103 int html;
104 int external_css;
105 int diaspora;
106 int parasha;
107 int shabbat;
108 int candles;
109 int havdalah;
110 int no_reverse;
111 int three_month;
112 int colorize;
113 int footnote;
114 int jd_today_g;
115 int jd_today_h;
116 int force_hebrew;
117 int force_israel;
118 int not_sunset_aware;
119 int quiet_alerts;
120 int bidi;
121 double lat;
122 double lon;
123 int tz;
124 int menu;
125 char* menu_item[MAX_MENU_ITEMS];
126 } option_list;
127
128 typedef struct {
129 int g_month_1;
130 int g_year_1;
131 int g_month_2;
132 int g_year_2;
133 int h_month_1;
134 int h_year_1;
135 int h_month_2;
136 int h_year_2;
137 } header_info;
138
139
140 const char* hcal_config_file_text = N_("\
141 # configuration file for hcal - Hebrew calendar program\n\
142 # part of package libhdate\n\
143 #\n# Should you mangle this file and wish to restore its default content,\n\
144 # rename or delete this file and run hcal; hcal will automatically\n\
145 # regenerate the default content.\n#\n\
146 # Your system administrator can set system-wide defaults for hcal by\n\
147 # modifying file <not yet implemented>.\n\
148 # You may override all defaults by changing the contents of this file.\n\
149 #\n\
150 # Version information\n\
151 # This may be used by updates to hcal to determine how to parse the file\n\
152 # and whether additional information and options should be appended to\n\
153 # the end of this file.\n\
154 VERSION=2.00\n\
155 # Location awareness\n\
156 # hcal wants to accurately highlight the current Hebrew day, including\n\
157 # during the hours between sunset and secular midnight. If you don't\n\
158 # provide it with latitude, longitude, and time zone information, hcal\n\
159 # will try to guess the information, based upon your system timezone,\n\
160 # and its (limited, and maybe biased) of the dominant Jewish community\n\
161 # in that timezone. When hcal is forced to guess, it alerts the user\n\
162 # with a message that includes the guessed location.\n\
163 # hcal's guesses will also affect its default behaviour for output of\n\
164 # Shabbat times, parshiot, and choice of Israel/diaspora hoidays\n\
165 #SUNSET_AWARE=TRUE\n\
166 # LATITUDE and LONGITUDE may be in decimal format or in the form\n\
167 # degrees[:minutes[:seconds]] with the characters :'\" as possible\n\
168 # delimiters. Use negative values to indicate South and West, or\n\
169 # use the abbreviated compass directions N, S, E, W.\n\
170 #LATITUDE=\n\
171 #LONGITUDE=\n\
172 # TIMEZONE may may be in decimal format or in the form degrees[:minutes]\n\
173 # with the characters :'\" as possible delimiters.\n\
174 #TIMEZONE=\n\n\
175 # Israel and the diaspora\n\
176 # If hcal guesses that you're not in Israel, the DIASPORA option will be\n\
177 # set true. This will affect holiday and parasha output. FORCE_ISRAEL\n\
178 # forces hcal to display calendar information for Israel, using hcal's\n\
179 # default coordinates foe Israel, or coordinates that you provide that\n\
180 # seem legitmately within Israel.\n\
181 # Thus, if you are living in Sao Paolo, and will be visiting Israel for\n\
182 # Sukkot, set BOTH flags true in order to see holiday information for\n\
183 # a non-resident vistor to Israel. The command line options for these\n\
184 # features are --israel, -I, --diaspora, -d.\n\
185 #FORCE_DIASPORA=FALSE;\n\
186 #FORCE_ISRAEL=FALSE;\n\n\
187 # Shabbat related\n\
188 # Setting SHABBAT_INFO true will output parshiot and Shabbat times.\n\
189 # The command line options for these features are -p (--parasha), and\n\
190 # -s (--shabbat). The CANDLE_LIGHTING field can accept a value of 18 - 90 (minutes\n\
191 # before sunset). The HAVDALAH field can accept a value of 20 - 90\n\
192 # (minutes after sunset).\n\
193 #PARASHA_NAMES=FALSE\n\
194 #SHABBAT_INFO=FALSE\n\
195 #CANDLE_LIGHTING=FALSE\n\
196 #HAVDALAH=FALSE\n\n\
197 # Holiday identification\n\
198 # hcal flags holidays by replacing the gregorian/Hebrew date separator\n\
199 # with assorted unhelpful cryptic symbols. Setting FOOTNOTES to true\n\
200 # will have hcal output after the month's calendar, a list of the month's\n\
201 # holidays along with the days on which they occur.\n\
202 #FOOTNOTE=FALSE\n\n\
203 # Output in hebrew characters\n\
204 # hcal defaults to output all information in your default language, so\n\
205 # if your default language is Hebrew, you're all set. Otherwise, you can\n\
206 # set FORCE_HEBREW to true to output Hebrew information in Hebrew, while\n\
207 # still outputting gregorian information in your default language. To\n\
208 # output ALL information in Hebrew, run something like this:\n\
209 # LC_TEMP=LC_ALL; LC_ALL=\"he_IL.UTF-8\"; hcal; LC_ALL=$LC_TEMP\n\
210 # If setting FORCE_HEBREW to true results in 'garbage' or non-Hebrew\n\
211 # output, you need to install a terminal font that includes the Hebrew\n\
212 # character set (hint: unicode).\n\
213 # The command line option for FORCE_HEBREW is either --hebrew or -H\n\
214 #FORCE_HEBREW=FALSE\n\n\
215 # The FORCE_HEBREW option outputs data that is 'correct' and 'logical'.\n\
216 # Unfortunately, the world can not be depended upon to be either. Most\n\
217 # Xwindow applications will display the data fine with FORCE_HEBREW; most\n\
218 # xterm implementations will not. (in fact, the only xterm clone I know\n\
219 # of that comes close is mlterm). If using FORCE_HEBREW results in\n\
220 # Hebrew characters being displayed in reverse, set OUTPUT_BIDI to true.\n\
221 # This will reverse the order of the Hebrew characters, so they will\n\
222 # display 'visual'ly correct; however, such output will not be suitable\n\
223 # for piping or pasting to many other applications. Setting OUTPUT_BIDI\n\
224 # automatically forces hebrew.\n\
225 # The command line option for OUTPUT_BIDI is either --bidi, --visual, or -b\n\
226 #OUTPUT_BIDI=FALSE\n\n\
227 # Display enhancements\n\
228 # hcal defaults to display the current day in reverse video\n\
229 # The command line option for this feature is --no-reverse\n\
230 #SUPPRESS_REVERSE_VIDEO=FALSE;\n\
231 # hcal can display its output \"calming, muted tones\". Note that piping\n\
232 # colorized output may yield unexpected results.\n\
233 #COLORIZE=FALSE\n\n\
234 # HTML OUTPUT\n\
235 #OUTPUT_HTML=FALSE\n\
236 #USE_EXTERNAL_CSS_FILE=\"pathto/foo/bar\"\n\n\
237 # Suppress alerts and warnings\n\
238 # hcal alerts the user via STDERR when it guesses the user's location.\n\
239 #QUIET_ALERTS=FALSE\n\n\
240 # Three month display\n\
241 # hcal can display a previous, current and next month side-by-side. hcal\n\
242 # can also display a calendar for an entire year in four rows of three\n\
243 # months each. Note that this will display properly only if your console\n\
244 # is set for at least 127 columns. Note also that setting this option to\n\
245 # will cause options FOOTNOTES, SHABBAT, and PARASHA_NAMES to false.\n\
246 #THREE_MONTH=FALSE\n\n\
247 # User-defined menus\n\
248 # You may specify here command-line strings to optionally be parsed\n\
249 # by hcal at execution time. To do so, use the command line option -m\n\
250 # (--menu). hcal will process first the settings of this config file,\n\
251 # then the other settings of your command line, and then will prompt\n\
252 # you for which menu item you would like to select. hcal will process\n\
253 # your menu selection as if it were a new command line, further modifying\n\
254 # all the prior settings.\n\
255 # Only the first ten \"MENU=\" entries will be read. Each line will be\n\
256 # truncated at one hundred characters\n\
257 #MENU= -l -23.55 -L -46.61 -z -3 # parents in Sao Paolo\n\
258 #MENU= -l 32 -L 34 -z 2 # son in bnei brak\n\
259 #MENU= -fbc -l 43.71 -L -79.43 -z -5 # me in Toronto\n\
260 #MENU= -l 22.26 -L 114.15 -z 8 # supplier in Hong Kong\n\
261 ");
262
263
264 /**************************************************
265 * print version
266 *************************************************/
267 int print_version ()
268 {
269 printf ("%s\n", N_("hcal - Hebrew calendar\nversion 1.6"));
270 return 0;
271 }
272
273 /**************************************************
274 * print usage
275 *************************************************/
276 void print_usage_hcal ()
277 {
278 printf ("%s\n",
279 N_("Usage: hcal [options] [coordinates timezone] ] [[month] year]\n\
280 coordinates: -l [NS]yy[.xxx] -L [EW]xx[.xxx]\n\
281 -l [NS]yy[:mm[:ss]] -L [EW]xx[:mm[:ss]]\n\
282 timezone: -z nn[( .nn | :mm )]\n\
283 Try \'hcal --help\' for more information"));
284 }
285
286 /**************************************************
287 * print help
288 *************************************************/
289 void print_help ()
290 {
291 print_usage_hcal();
292 printf ("%s\n",
293 N_("Hebrew calendar\nOPTIONS:\n\
294 -1 --one-month over-ride config file setting if you had set\n\
295 option --three-month as a default there\n\
296 -3 --three-month displays previous/next months\n\
297 side by side. requires 127 columns\n\
298 -b --bidi prints hebrew in reverse (visual)\n\
299 --visual\n\
300 --no-bidi over-ride config file setting if you had set\n\
301 --no-visual option -bidi as a default there\n\
302 -c --colorize displays in calming, muted tones\n\
303 --no-color over-ride a --colorize setting in your config file\n\
304 -d --diaspora use diaspora reading and holidays.\n\
305 -f --footnote print descriptive notes of holidays\n\
306 --no-footnote over-ride a footnote setting in your config file\n\
307 -h --html output in html format to stdout\n\
308 -H --hebrew print hebrew information in Hebrew\n\
309 -i use external css file \"./hcal.css\".\n\
310 -I --israel override a diaspora default\n\
311 --no-reverse do not highlight today's date\n\
312 -m --menu prompt user-defined menu from config file\n\
313 -p --parasha print week's parasha on each calendar row\n\
314 -q --quiet-alerts suppress warning messages\n\
315 -s --shabbat print Shabbat times and parshiot\n\
316 --candles modify default minhag of 20 minutes. (17<n<91)\n\
317 --havdalah modify default minhag of 3 stars. (19<n<91 minutes)\n\
318 -z --timezone nn timezone, +/-UTC\n\
319 -l --latitude yy latitude yy degrees. Negative values are South\n\
320 -L --longitude xx longitude xx degrees. Negative values are West\n\n\
321 All options can be made default in the config file, or menu-ized for\n\
322 easy selection."));
323 }
324
325
326 /**************************************************
327 * HTML - print css section
328 *************************************************/
329 int print_css (const int external_css)
330 {
331 if (external_css) printf ("\n\t@import \"hcal.css\";\n");
332 else
333 {
334 printf ("\nbody.hebrew { direction: rtl;}\n\
335 img { margin:0; padding: 0; vertical-align: middle; border: 0;}\n\
336 p {}\n\
337 table.main { width: 90%%; table-layout: fixed; font-size: 14pt; border: solid #aaaaaa; }\n\
338 table.day { width: 100%%; height: 100%%; table-layout: fixed; font-size: 14pt; }\n\
339 th.gmonth { font-size: 30pt; font-weight: bold }\n\
340 th.gyear { font-size: 30pt; font-weight: bold}\n\
341 th.hmonth { font-size: 30pt; font-weight: bold}\n\
342 th.hyear {font-size: 30pt; font-weight: bold }\n\
343 th.week { background-color: #aaaaaa; text-align: center; }\n\
344 td.gday { font-size: 30pt; vertical-align: top; }\n\
345 td.hday { font-size: 12pt; vertical-align: top; }\n\
346 td.sat { border: solid #777777; }\n\
347 td.regular { border: solid #aaaaaa; }\n\
348 td.holiday { color: #990000; border: solid #888888; }\n\
349 td.out_of_month { color: #dddddd; border: solid #dddddd; }\n\
350 tr.line1 { height: 30%%; }\n\
351 tr.line2 { height: 50%%; font-size: 30pt; }\n\
352 tr.line3 { height: 20%%; font-size: 12pt; vertical-align: bottom; }\n\
353 span.today { }\n\
354 span.gmonth { font-size: 24pt; }\n\
355 span.gyear { font-size: 24pt; }\n\
356 span.hmonth { font-size: 24pt; }\n\
357 span.hyear { font-size: 24pt; }\n\
358 span.holiday_name { }\n");
359 }
360
361 return 0;
362 }
363
364
365
366 /**************************************************
367 * HTML - print header
368 *************************************************/
369 int print_header_html ( const int external_css, const int force_hebrew)
370 {
371 printf ("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"\"http://www.w3.org/TR/html4/strict.dtd\">\n\
372 <html>\n\
373 <head>\n\
374 <meta name=\"generator\" content=\"hcal (libhdate)\">\n\
375 <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n\
376 <style title=\"Normal\" type=\"text/css\" media=\"all\">");
377
378 print_css (external_css);
379
380 printf ("</style>\n");
381
382 /* some alternative css styles */
383 printf ("\n\
384 <link rel=\"alternate stylesheet\" title=\"High contrast\" type=\"text/css\" media=\"screen\" href=\"high_contrast.css\">\n\
385 <link rel=\"alternate stylesheet\" title=\"Colorful\" type=\"text/css\" media=\"screen\" href=\"colorful.css\">\n\
386 <link rel=\"alternate stylesheet\" title=\"Print\" type=\"text/css\" media=\"all\" href=\"print.css\">\n");
387
388 if ( (force_hebrew) || (hdate_is_hebrew_locale()) )
389 printf ("<title>Hebrew Calendar</title>\n</head>\n<body class=\"hebrew\"><center>\n");
390 else
391 printf ("<title>Hebrew Calendar</title>\n</head>\n<body><center>\n");
392
393 return 0;
394 }
395
396
397
398 /**************************************************
399 * HTML - print footer
400 *************************************************/
401 int print_html_footer ()
402 {
403 printf ("<!-- <p>\n\
404 <a href=\"http://validator.w3.org/check/referer\">\n<img \
405 src=\"http://www.w3.org/Icons/valid-html401\"\n\
406 alt=\"Valid HTML 4.01!\" height=\"31\" width=\"88\" />\n</a>\n");
407 printf ("<a href=\"http://jigsaw.w3.org/css-validator\">\n\
408 <img src=\"http://www.w3.org/Icons/valid-css\" alt=\"Valid CSS!\">\n\
409 </a>\n</p> -->\n");
410
411 printf ("</body></html>\n");
412
413 return 0;
414 }
415
416
417 /**************************************************
418 * Print HTML header - month line
419 *************************************************/
420 void print_header_month_line_html( const header_info header)
421 {
422
423 // TODO - fix bug ellul xxxx - tishrei xxxx+1
424 // char *h_year_1;
425 // h_year_1 = malloc(HEBREW_NUMBER_BUFFER_SIZE);
426 // char h_year_1[HEBREW_NUMBER_BUFFER_SIZE + 1];
427 char *h_year_1 = NULL;
428
429 /**************************************************
430 * Print Gregorian month and year
431 **************************************************/
432 printf ("<table width=90%%><tr><td align=left><span class=\"gmonth\">%s <span class=\"gyear\">%d</span></td>\n",
433 hdate_string( HDATE_STRING_GMONTH, header.g_month_1, HDATE_STRING_LONG, HDATE_STRING_LOCAL),
434 header.g_year_1);
435
436 h_year_1 = hdate_string(HDATE_STRING_INT, header.h_year_1, HDATE_STRING_LONG, HDATE_STRING_HEBREW);
437 /**************************************************
438 * Print Hebrew month and year
439 **************************************************/
440 printf ("<td align=right><span class=\"hmonth\">");
441 if (header.h_month_1 != header.h_month_2)
442 {
443 printf ("%s-",
444 hdate_string( HDATE_STRING_HMONTH , header.h_month_1, HDATE_STRING_LONG, HDATE_STRING_LOCAL));
445 }
446 printf ("%s ", hdate_string( HDATE_STRING_HMONTH , header.h_month_2, HDATE_STRING_LONG, HDATE_STRING_LOCAL));
447 printf ("</span>\n");
448 printf ("<span class=\"hyear\">%s</span></td></tr></table>\n", h_year_1);
449
450 printf ("<span class=\"month_table\">\n<table class=main>\n");
451
452
453 if (h_year_1 != NULL) free(h_year_1);
454 }
455
456
457 /**************************************************
458 * HTML - print column headings for days of weeks
459 **************************************************/
460 void print_header_dow_line_html()
461 {
462 int j;
463
464 for (j = 1; j < 8; j++)
465 printf ("<th class=\"week\">%3s</th>",
466 hdate_string( HDATE_STRING_DOW, j, TRUE, FALSE));
467 }
468
469
470
471 /**************************************************
472 * end HTML functions
473 *************************************************/
474
475
476 /*************************************************
477 * Display data in a more pleasing visual manner
478 *************************************************/
479 void colorize_element ( const int element )
480 {
481 switch (element) {
482 case ELEMENT_WEEKDAY_G: printf(CODE_LIGHT_GREY); break;
483 case ELEMENT_WEEKDAY_H: printf(CODE_LIGHT_BROWN); break;
484 case ELEMENT_MONTH_G: printf(CODE_LIGHT_GREY); break;
485 case ELEMENT_MONTH_H: printf(CODE_LIGHT_BROWN); break;
486 case ELEMENT_WEEKDAY_NAMES: printf(CODE_LIGHT_GREEN); break;
487 case ELEMENT_SHABBAT_NAME: printf(CODE_LIGHT_AQUA); break;
488 case ELEMENT_SHABBAT_DAY: printf(CODE_LIGHT_AQUA); break;
489 case ELEMENT_HOLIDAY_DAY: printf(CODE_LIGHT_AQUA); break;
490 case ELEMENT_SHABBAT_TIMES: printf(CODE_LIGHT_PURPLE); break;
491 case ELEMENT_PARASHA: printf(CODE_LIGHT_GREEN); break;
492 case ELEMENT_THIS_SHABBAT_TIMES: printf(CODE_LIGHT_GREEN); break;
493 case ELEMENT_THIS_PARASHA: printf(CODE_LIGHT_GREEN); break;
494 case ELEMENT_HOLIDAY_NAME: printf(CODE_LIGHT_GREY); break;
495 case ELEMENT_TODAY_HOLIDAY_DAY: printf(CODE_LIGHT_GREEN); break;
496 case ELEMENT_TODAY_HOLIDAY_NAME: printf(CODE_LIGHT_GREEN); break;
497 }
498 /* switch (element) {
499 case ELEMENT_WEEKDAY_G: printf(CODE_LIGHT_GREY); break;
500 case ELEMENT_WEEKDAY_H: printf(CODE_LIGHT_AQUA); break;
501 case ELEMENT_MONTH_G: printf(CODE_LIGHT_GREY); break;
502 case ELEMENT_MONTH_H: printf(CODE_LIGHT_AQUA); break;
503 case ELEMENT_WEEKDAY_NAMES: printf(CODE_LIGHT_GREEN); break;
504 case ELEMENT_SHABBAT_NAME: printf(CODE_BOLD_BLUE); break;
505 case ELEMENT_SHABBAT_DAY: printf(CODE_BOLD_BLUE); break;
506 case ELEMENT_HOLIDAY_DAY: printf(CODE_BOLD_BLUE); break;
507 case ELEMENT_SHABBAT_TIMES: printf(CODE_LIGHT_BROWN); break;
508 case ELEMENT_PARASHA: printf(CODE_LIGHT_GREEN); break;
509 case ELEMENT_THIS_SHABBAT_TIMES: printf(CODE_LIGHT_GREEN); break;
510 case ELEMENT_THIS_PARASHA: printf(CODE_LIGHT_GREEN); break;
511 case ELEMENT_HOLIDAY_NAME: printf(CODE_LIGHT_GREY); break;
512 case ELEMENT_TODAY_HOLIDAY_DAY: printf(CODE_LIGHT_GREEN); break;
513 case ELEMENT_TODAY_HOLIDAY_NAME: printf(CODE_LIGHT_GREEN); break;
514 */
515 }
516
517
518
519 /**************************************************
520 * print header - month line to stdout
521 *************************************************/
522 void print_header_month_line_stdout( const header_info header, const int colorize, const int force_hebrew, const int visual_bidi )
523 {
524 char *g_month, *h1_month, *h2_month;
525 char *h1_year = NULL;
526 char *h2_year = NULL;
527 size_t g_month_len, g_year_len, h1_month_len, h2_month_len, h1_year_len, h2_year_len;
528
529
530 char *hebrew_buffer, *hebrew_buffer_next;
531 size_t hebrew_buffer_len, literals_len;
532
533 int j;
534 size_t padding = 0;
535
536
537 /**************************************************
538 * Print Gregorian month and year
539 *************************************************/
540 g_month = hdate_string( HDATE_STRING_GMONTH, header.g_month_1, HDATE_STRING_LONG, HDATE_STRING_LOCAL);
541 if (colorize) colorize_element(ELEMENT_MONTH_G);
542 printf ("%s %d", g_month, header.g_year_1);
543 if (colorize) printf(CODE_RESTORE_VIDEO);
544
545 /**************************************************
546 * Print Hebrew month and year
547 *
548 * because we want this printed right-justified on
549 * the same line, we need to calculate how many
550 * spaces to pad.
551 *
552 * because of the possible user option --bidi, we
553 * need to buffer the entire Hebrew text in order
554 * reverse its sequence for 'visual' display.
555 *
556 * This all requires collecting the data first
557 * and determining each's length.
558 *************************************************/
559
560 #define CALENDAR_WIDTH 41
561 #define DASH_WIDTH 3 // includes surrounding spaces
562 #define SPACE_WIDTH 1
563
564
565 /*************************************************
566 * padding info for gregorian date
567 *************************************************/
568 g_month_len = strlen(g_month);
569 g_year_len = 4;
570 switch (header.g_year_1)
571 {
572 case 1-9: g_year_len = 1; break;
573 case 10-99: g_year_len = 2; break;
574 case 100-999: g_year_len = 3; break;
575 }
576
577
578 /**************************************************
579 * collect padding info for Hebrew date
580 *************************************************/
581 h1_month = hdate_string( HDATE_STRING_HMONTH , header.h_month_1, HDATE_STRING_LONG, force_hebrew);
582 h1_year = hdate_string( HDATE_STRING_INT, header.h_year_1, HDATE_STRING_SHORT, force_hebrew);
583 //printf("\nh1_month = %s; h1_year = %s, in-year = %d\n",h1_month,h1_year, header.h_year_1);exit(0);
584
585 h1_month_len = strlen(h1_month);
586 h1_year_len = strlen(h1_year);
587 // DEBUG - printf("\nh1 year value = %d, h1 year string = %s, string length = %d\n",header.h_year_1, h1_year, h1_year_len);
588 // DEBUG - int ii; for (ii=0; ii<h1_year_len; ii++) printf("%x ",h1_year[ii]);
589
590 if (header.h_year_1 != header.h_year_2)
591 {
592
593 h2_month = hdate_string( HDATE_STRING_HMONTH , header.h_month_2, HDATE_STRING_LONG, force_hebrew);
594 h2_year = hdate_string(HDATE_STRING_INT, header.h_year_2, HDATE_STRING_LONG,force_hebrew);
595
596 h2_month_len = strlen(h2_month);
597 h2_year_len = strlen(h2_year);
598 literals_len = SPACE_WIDTH + DASH_WIDTH + SPACE_WIDTH;
599
600 hebrew_buffer_len = h1_month_len + h1_year_len + h2_month_len
601 + h2_year_len + literals_len;
602
603 // printf("\nlength values = %d %d %d %d %d %d\n",h1_month_len , h1_year_len , DASH_WIDTH, h2_month_len, SPACE_WIDTH , h2_year_len);
604 hebrew_buffer = malloc(hebrew_buffer_len+1);
605 hebrew_buffer_next = mempcpy(hebrew_buffer, h1_month, h1_month_len);
606 hebrew_buffer_next = mempcpy(hebrew_buffer_next, " ", SPACE_WIDTH);
607 hebrew_buffer_next = mempcpy(hebrew_buffer_next, h1_year, h1_year_len);
608 hebrew_buffer_next = mempcpy(hebrew_buffer_next, " - ", DASH_WIDTH);
609 hebrew_buffer_next = mempcpy(hebrew_buffer_next, h2_month, h2_month_len);
610 hebrew_buffer_next = mempcpy(hebrew_buffer_next, " ", SPACE_WIDTH);
611 hebrew_buffer_next = mempcpy(hebrew_buffer_next, h2_year, h2_year_len);
612 hebrew_buffer[hebrew_buffer_len]='\0';
613
614 // printf("\nbuffer length = %d\nbuffer contents = %s\n",hebrew_buffer_len, hebrew_buffer); exit(0);
615 // free(hebrew_buffer);
616 }
617 else if (header.h_month_1 != header.h_month_2)
618 {
619 h2_month = hdate_string( HDATE_STRING_HMONTH , header.h_month_2, HDATE_STRING_LONG, force_hebrew);
620 h2_month_len = strlen(h2_month);
621 literals_len = DASH_WIDTH + SPACE_WIDTH;
622
623 hebrew_buffer_len = h1_month_len + h2_month_len + h1_year_len + literals_len;
624 hebrew_buffer = malloc(hebrew_buffer_len+1);
625 hebrew_buffer_next = mempcpy(hebrew_buffer, h1_month, h1_month_len);
626 hebrew_buffer_next = mempcpy(hebrew_buffer_next, " - ", DASH_WIDTH);
627 hebrew_buffer_next = mempcpy(hebrew_buffer_next, h2_month, h2_month_len);
628 hebrew_buffer_next = mempcpy(hebrew_buffer_next, " ", SPACE_WIDTH);
629 hebrew_buffer_next = mempcpy(hebrew_buffer_next, h1_year, h1_year_len);
630 hebrew_buffer[hebrew_buffer_len]='\0';
631 }
632 else
633 {
634 h2_month_len = 0;
635 h2_year_len = 0;
636 literals_len = SPACE_WIDTH;
637
638 hebrew_buffer_len = h1_month_len + h1_year_len + literals_len;
639
640 hebrew_buffer = malloc(hebrew_buffer_len+1);
641 hebrew_buffer_next = mempcpy(hebrew_buffer, h1_month, h1_month_len);
642 hebrew_buffer_next = mempcpy(hebrew_buffer_next, " ", SPACE_WIDTH);
643 hebrew_buffer_next = mempcpy(hebrew_buffer_next, h1_year, h1_year_len);
644 hebrew_buffer[hebrew_buffer_len]='\0';
645 }
646
647 if (!force_hebrew)
648 padding = CALENDAR_WIDTH - g_month_len - g_year_len - hebrew_buffer_len ;
649 else
650 padding = CALENDAR_WIDTH - g_month_len - g_year_len - (hebrew_buffer_len/2) - literals_len +1;
651
652
653
654 /**************************************************
655 * print padding
656 *************************************************/
657 for (j = 1; j < (int)padding; j++) printf(" ");
658
659
660 /**************************************************
661 * Print Hebrew month and year
662 *************************************************/
663 if (colorize) colorize_element(ELEMENT_MONTH_H);
664 if (visual_bidi) revstr(hebrew_buffer, hebrew_buffer_len);
665 printf ("%s", hebrew_buffer);
666 if (colorize) printf(CODE_RESTORE_VIDEO);
667
668
669 /**************************************************
670 * free allocated memory
671 *************************************************/
672 if (h1_year != NULL) free(h1_year);
673 // if (header.h_year_1 != header.h_year_2) free(h2_year);
674 if (h2_year != NULL) free(h2_year);
675 free(hebrew_buffer);
676 }
677
678
679 /**************************************************
680 * print column headings for days of weeks
681 **************************************************/
682 void print_header_dow_line_stdout( const int colorize )
683 {
684 int column;
685
686 void print_dow_column( int column )
687 {
688 if (hdate_is_hebrew_locale())
689 { /* Hebrew heading is a single charcter per day */
690 printf ("%s%s%s", " ",
691 hdate_string( HDATE_STRING_DOW, column, HDATE_STRING_SHORT, HDATE_STRING_HEBREW),
692 " ");
693 }
694 else
695 { /* presume three character heading */
696 printf ("%s%3s", " ",
697 hdate_string( HDATE_STRING_DOW, column, HDATE_STRING_SHORT, HDATE_STRING_LOCAL));
698 }
699
700 if (column != 7) printf (" ");
701 }
702
703 if (colorize) colorize_element(ELEMENT_WEEKDAY_NAMES);
704 for (column = 1; column < 7; column++) print_dow_column(column);
705 if (colorize) colorize_element(ELEMENT_SHABBAT_NAME);
706 print_dow_column(7);
707 if (colorize) printf(CODE_RESTORE_VIDEO);
708 }
709
710
711
712 /**************************************************
713 * calculate start/end month/year for a calendar
714 **************************************************/
715 header_info calculate_calendar_start_end (const int month, const int year)
716 {
717 hdate_struct h;
718 header_info header;
719
720 hdate_set_gdate (&h, 1, month, year);
721 header.g_month_1 = h.gd_mon;
722 header.g_year_1 = h.gd_year;
723 header.h_month_1 = h.hd_mon;
724 header.h_year_1 = h.hd_year;
725
726
727 hdate_set_jd ( &h, hdate_gdate_to_jd ( 1, month % 12 + 1, ((month==12) ? year+1 : year) ) - 1 );
728 header.g_month_2 = h.gd_mon;
729 header.g_year_2 = h.gd_year;
730 header.h_month_2 = h.hd_mon;
731 header.h_year_2 = h.hd_year;
732
733 return header;
734 }
735
736
737 /**************************************************
738 * print header - year and month
739 *************************************************/
740 int print_header ( const int month, const int year, const option_list opt)
741 {
742 header_info previous_month, current_month, next_month;
743
744
745 /**********************************************************
746 * Preliminary - set dates for begining and end of calendar
747 **********************************************************/
748 current_month = calculate_calendar_start_end(month, year);
749 if (opt.three_month)
750 {
751 previous_month = calculate_calendar_start_end(
752 (month==1 ? 12 : month-1), (month==1 ? year-1 : year) );
753 next_month = calculate_calendar_start_end(
754 (month==12 ? 1 : month+1), (month==12 ? year+1: year) );
755 }
756
757 /**************************************************
758 * HTML output - month header line
759 *************************************************/
760 if (opt.html) print_header_month_line_html(current_month);
761
762
763 /**************************************************
764 * STDOUT output - month header line
765 *************************************************/
766 else
767 {
768 if (opt.three_month)
769 {
770 print_header_month_line_stdout(previous_month, opt.colorize, opt.force_hebrew, opt.bidi);
771 printf(" ");
772 }
773
774 print_header_month_line_stdout(current_month, opt.colorize, opt.force_hebrew, opt.bidi);
775
776 if (opt.three_month)
777 {
778 printf(" ");
779 print_header_month_line_stdout(next_month, opt.colorize, opt.force_hebrew, opt.bidi);
780 }
781 }
782
783 /**************************************************
784 * terminate line
785 **************************************************/
786 if (opt.html) printf ("</tr>\n");
787 else printf ("\n");
788
789
790 /**************************************************
791 * print column headings for days of weeks
792 **************************************************/
793 if (opt.html) print_header_dow_line_html();
794 else
795 {
796 if (opt.three_month)
797 {
798 print_header_dow_line_stdout(opt.colorize);
799 printf(" ");
800 }
801 print_header_dow_line_stdout(opt.colorize);
802 if (opt.three_month)
803 {
804 printf(" ");
805 print_header_dow_line_stdout(opt.colorize);
806 }
807 }
808
809 /**************************************************
810 * terminate line
811 **************************************************/
812 if (opt.html) printf ("</tr>\n");
813 else printf ("\n");
814
815 return 0;
816 }
817
818
819 /**************************************************
820 * print HTML calendar entry (ie. a single day)
821 *************************************************/
822 void print_day_html ( const hdate_struct h, const int month, const option_list opt)
823 {
824
825 int holiday_type;
826 // char *hd_day;
827 // hd_day = malloc(HEBREW_NUMBER_BUFFER_SIZE);
828 // char hd_day_buffer[HEBREW_NUMBER_BUFFER_SIZE + 1];
829 char *hd_day_str = NULL;
830
831 holiday_type = hdate_get_holyday_type(hdate_get_holyday(&h, opt.diaspora));
832
833
834 if (h.gd_mon != month) printf ("<td class=\"out_of_month\">");
835 else if (h.hd_dw == SHABBAT) printf ("<td class=\"sat\">");
836 else if (holiday_type) printf ("<td class=\"holiday\">");
837 else printf ("<td class=\"regular\">");
838
839 /* Print a day */
840 hd_day_str = hdate_string(HDATE_STRING_INT, h.hd_day, HDATE_STRING_LONG,opt.force_hebrew);
841 printf ("<table class=day><tr class=line1><td class=\"gday\">%2d</td>\n\
842 <td class=\"hday\">%3s&nbsp;%s</td></tr><tr class=line2><td>&nbsp;</td></tr>",
843 h.gd_day,
844 hd_day_str,
845 hdate_string( HDATE_STRING_HMONTH , h.hd_mon, HDATE_STRING_LONG, opt.force_hebrew));
846 if (holiday_type) printf ("<tr class=line3><td class=\"holiday_name\">%s</td></tr>",
847 hdate_string( HDATE_STRING_HOLIDAY,
848 hdate_get_holyday (&h, opt.diaspora),
849 HDATE_STRING_SHORT, HDATE_STRING_LOCAL)
850 );
851 else printf ("<tr class=line3><td class=\"holiday_name\">&nbsp;</td></tr>");
852
853 printf ("</table></td>\n");
854
855 if (hd_day_str != NULL) free(hd_day_str);
856 }
857
858
859 /*************************************************
860 * print stdout calendar entry (ie. a single day)
861 *************************************************/
862 void print_day ( const hdate_struct h, const int month, const option_list opt)
863 {
864
865 // for forcing Hebrew printing of Hebrew data
866 //char *language;
867
868 // char *hd_day_buffer[HEBREW_NUMBER_BUFFER_SIZE + 1];
869 // hd_day_buffer = malloc(HEBREW_NUMBER_BUFFER_SIZE + 1);
870 char *hd_day_str = NULL;
871
872 size_t hd_day_buffer_str_len;
873
874 int holiday_type;
875 holiday_type = hdate_get_holyday_type(hdate_get_holyday(&h, opt.diaspora));
876
877 /**************************************************
878 * out of month - needs padding
879 *************************************************/
880 if (h.gd_mon != month) printf(" ");
881
882
883 /**************************************************
884 * in month - print the data
885 *************************************************/
886 else
887 {
888 /*************************************************
889 * Gregorian date entry - color prefix
890 *************************************************/
891 if (h.hd_jd == opt.jd_today_g)
892 printf (CODE_REVERSE_VIDEO);
893 else if (opt.colorize)
894 {
895 if (h.hd_dw==7) colorize_element(ELEMENT_SHABBAT_DAY);
896 else if (holiday_type) colorize_element(ELEMENT_HOLIDAY_DAY);
897 else colorize_element(ELEMENT_WEEKDAY_G);
898 }
899
900 /*************************************************
901 * Gregorian date entry - the day of the month
902 *************************************************/
903 // this next line is necessary to align numbers
904 // correctly with bidi (tested using mlterm)
905 if ( (h.gd_day < 10) && (hdate_is_hebrew_locale()) )
906 printf ("%d ", h.gd_day);
907 else printf ("%2d", h.gd_day);
908
909 /*************************************************
910 * Gregorian date entry - color cleanup
911 *************************************************/
912 if ((h.hd_jd == opt.jd_today_g) || (opt.colorize))
913 printf (CODE_RESTORE_VIDEO);
914
915
916 /*************************************************
917 * holiday flag
918 *************************************************/
919 printf ("%c", holiday_flag[holiday_type]);
920
921
922 /*************************************************
923 * Hebrew date entry - color prefix
924 *************************************************/
925 if (h.hd_jd == opt.jd_today_h)
926 printf (CODE_REVERSE_VIDEO);
927 else if (opt.colorize)
928 {
929 if (h.hd_dw==7) colorize_element(ELEMENT_SHABBAT_DAY);
930 else if (holiday_type) colorize_element(ELEMENT_HOLIDAY_DAY);
931 else colorize_element(ELEMENT_WEEKDAY_H);
932 }
933
934
935 /*************************************************
936 * Hebrew date entry - day of the month
937 *************************************************/
938 hd_day_str = hdate_string(HDATE_STRING_INT, h.hd_day,HDATE_STRING_SHORT,opt.force_hebrew);
939 if (opt.bidi)
940 {
941 hd_day_buffer_str_len = (size_t) strlen(hd_day_str);
942 if ( hd_day_buffer_str_len > HEBREW_NUMBER_BUFFER_SIZE)
943 hd_day_buffer_str_len = HEBREW_NUMBER_BUFFER_SIZE - 1;
944 revstr(hd_day_str, hd_day_buffer_str_len);
945 }
946 if ( ( (opt.force_hebrew) || (hdate_is_hebrew_locale()) ) &&
947 ( (h.hd_day < 11) || (h.hd_day == 20) || (h.hd_day == 30) ) )
948 { // need to pad Hebrew dates 1-10, 20, 30
949 printf ("%s%s"," ",hd_day_str);
950 }
951 else printf ("%2s", hd_day_str);
952
953 /*************************************************
954 * Hebrew date entry - color cleanup
955 *************************************************/
956 if ((h.hd_jd == opt.jd_today_h) || (opt.colorize))
957 printf (CODE_RESTORE_VIDEO);
958
959 }
960
961 if (hd_day_str != NULL) free(hd_day_str);
962 }
963
964
965 /*************************************************
966 * print a calendar week's entry (ie. seven columns)
967 *************************************************/
968 void print_week( int jd, const int month, const option_list opt)
969 {
970 #define long_parasha_name 0
971
972 hdate_struct h;
973
974 int calendar_column;
975
976 // for opt.shabbat
977 int sun_hour, first_light, talit, sunrise;
978 int midday, sunset, first_stars, three_stars;
979 int this_week;
980 hdate_struct yom_shishi;
981
982 // for opt.parasha
983 int shabbat_name;
984 char *shabbat_name_str, *shabbat_name_buffer;
985 size_t shabbat_name_str_len;
986
987
988 // for forcing Hebrew printing of Hebrew data
989 //char *language;
990
991
992 /**************************************************
993 * for each column of calendar
994 *************************************************/
995 for (calendar_column = 0; calendar_column < 7; calendar_column++)
996 {
997
998 /**************************************************
999 * Get this day's information
1000 *************************************************/
1001 hdate_set_jd (&h, jd);
1002 if ( ((opt.shabbat) || (opt.parasha)) && (calendar_column == 5) )
1003 yom_shishi = h;
1004
1005
1006 /**************************************************
1007 * HTML calendar option
1008 *************************************************/
1009 if (opt.html) print_day_html ( h, month, opt );
1010
1011
1012
1013 /**************************************************
1014 * non-HTML calendar option
1015 *************************************************/
1016 else print_day ( h, month, opt);
1017
1018
1019 /**************************************************
1020 * space between days of week
1021 *************************************************/
1022 if (calendar_column != 6) printf (" ");
1023
1024 /**************************************************
1025 * advance to next day of week
1026 *************************************************/
1027 jd++;
1028 }
1029
1030 /**************************************************
1031 * print end of calendar line
1032 *************************************************/
1033 if ((!opt.html) && ( (h.gd_mon == month) || (h.gd_day < SHABBAT) ) )
1034 {
1035
1036 /********************************************************
1037 * determine whether this line gets special highlighting
1038 ********************************************************/
1039 if ((opt.colorize)
1040 && ((opt.shabbat) || (opt.parasha))
1041 && ((jd - 1) > opt.jd_today_h)
1042 && (((jd - 1) - opt.jd_today_h) < 7) )
1043 this_week = TRUE;
1044 else this_week = FALSE;
1045
1046 /*************************************************
1047 * print shabbat times
1048 *************************************************/
1049 if (opt.shabbat)
1050 {
1051 // candlelighting times
1052 /// note: compiler incorrectly issued warnings:
1053 /// "may be used uninitialized in this function [-Wmaybe-uninitialized]"
1054 /// The initialization occurs above (~line 1005) "yom_shishi = h"
1055 hdate_get_utc_sun_time (yom_shishi.gd_day, yom_shishi.gd_mon, yom_shishi.gd_year,
1056 opt.lat, opt.lon, &sunrise, &sunset);
1057
1058 // FIXME - allow for further minhag variation
1059 if (opt.candles != 1) sunset = sunset - opt.candles + opt.tz;
1060 else sunset = sunset + opt.tz - DEFAULT_CANDLES_MINUTES;
1061
1062 if (opt.colorize)
1063 {
1064 if (this_week) colorize_element(ELEMENT_THIS_SHABBAT_TIMES);
1065 else colorize_element(ELEMENT_SHABBAT_TIMES);
1066 }
1067 printf (" %02d:%02d", sunset / 60, sunset % 60);
1068 if (opt.colorize) printf (CODE_RESTORE_VIDEO);
1069
1070 printf(" - ");
1071
1072 // motzay shabat time
1073 hdate_get_utc_sun_time_full (h.gd_day, h.gd_mon, h.gd_year, opt.lat,
1074 opt.lon, &sun_hour, &first_light, &talit,
1075 &sunrise, &midday, &sunset,
1076 &first_stars, &three_stars);
1077
1078 // FIXME - allow for further minhag variation
1079 if (opt.havdalah != 1) three_stars = sunset + opt.havdalah + opt.tz;
1080 else three_stars = three_stars + opt.tz;
1081
1082 if (opt.colorize)
1083 {
1084 if (this_week) colorize_element(ELEMENT_THIS_SHABBAT_TIMES);
1085 else colorize_element(ELEMENT_SHABBAT_TIMES);
1086 }
1087 printf ("%02d:%02d", three_stars / 60, three_stars % 60);
1088 if (opt.colorize) printf (CODE_RESTORE_VIDEO);
1089 }
1090
1091
1092 /*************************************************
1093 * print shabbat name
1094 *************************************************/
1095 if (opt.parasha)
1096 {
1097
1098 /*************************************************
1099 * print shabbat name - force-hebrew setup
1100 *************************************************/
1101 // BUG - this isn't thread-safe
1102 /*if (opt.force_hebrew)
1103 {
1104 language=getenv("LANGUAGE");
1105 setenv("LANGUAGE", "he_IL.UTF-8", 1);
1106 }*/
1107
1108
1109 shabbat_name = hdate_get_parasha (&h, opt.diaspora);
1110 if (shabbat_name) shabbat_name_str =
1111 hdate_string( HDATE_STRING_PARASHA, shabbat_name,
1112 HDATE_STRING_SHORT, opt.force_hebrew);
1113 else
1114 {
1115 shabbat_name = hdate_get_holyday(&h, opt.diaspora);
1116 if (shabbat_name) shabbat_name_str =
1117 hdate_string( HDATE_STRING_HOLIDAY,
1118 shabbat_name,
1119 HDATE_STRING_SHORT, opt.force_hebrew);
1120 }
1121 if (shabbat_name)
1122 {
1123 if (opt.colorize)
1124 {
1125 if (this_week) colorize_element(ELEMENT_THIS_PARASHA);
1126 else colorize_element(ELEMENT_PARASHA);
1127 }
1128 if (opt.bidi)
1129 {
1130 shabbat_name_str_len = strlen(shabbat_name_str);
1131 shabbat_name_buffer = malloc(shabbat_name_str_len+1);
1132 memcpy(shabbat_name_buffer, shabbat_name_str, shabbat_name_str_len);
1133 shabbat_name_buffer[shabbat_name_str_len] = '\0';
1134 revstr(shabbat_name_buffer, shabbat_name_str_len);
1135
1136 // padding - FIXME - spaces are single-byte, while
1137 // the Hebrew characters are two bytes
1138 const int margin_max = 15;
1139 printf("%*s%s", (int)(margin_max - shabbat_name_str_len/2)," ", shabbat_name_buffer);
1140
1141 free(shabbat_name_buffer);
1142 }
1143 else printf(" %s", shabbat_name_str);
1144 //if (opt.force_hebrew) setenv("LANGUAGE", language, 1);
1145 if (opt.colorize) printf (CODE_RESTORE_VIDEO);
1146 }
1147 }
1148 }
1149 }
1150
1151
1152
1153
1154 /**************************************************
1155 * print month table
1156 *************************************************/
1157 int print_calendar ( const int current_month, const int current_year, const option_list opt)
1158 {
1159 hdate_struct h;
1160 int calendar_line;
1161 int max_calendar_lines = 4;
1162 /// the initializations on next line aren't truly necessary, but they do
1163 /// suppress warning "may be used uninitialized in this function [-Wmaybe-uninitialized]"
1164 int previous_month = 1, next_month = 1;
1165 int previous_year, next_year;
1166 /// the initializations on next line aren't truly necessary, but they do
1167 /// suppress warning "may be used uninitialized in this function [-Wmaybe-uninitialized]"
1168 int jd_current_month, jd_previous_month = 1, jd_next_month = 1;
1169
1170 void how_many_calendar_lines( int month, int start_dow )
1171 {
1172 switch (month)
1173 {
1174 case 4:
1175 case 6:
1176 case 9:
1177 case 11: if (start_dow == 7) max_calendar_lines = 6;
1178 else if (max_calendar_lines == 4) max_calendar_lines = 5;
1179 break;
1180 case 1:
1181 case 3:
1182 case 5:
1183 case 7:
1184 case 8:
1185 case 10:
1186 case 12: if (start_dow > 5) max_calendar_lines = 6;
1187 else if (max_calendar_lines == 4) max_calendar_lines = 5;
1188 break;
1189 case 2: if (start_dow > 1 && max_calendar_lines == 4) max_calendar_lines = 5;
1190 break;
1191 }
1192 }
1193
1194 /*********************************************************
1195 * Preliminaries:
1196 * - Find the first sunday(s) of each calendar
1197 * - Find number of calendar lines
1198 *********************************************************/
1199 hdate_set_gdate (&h, 1, current_month, current_year);
1200 jd_current_month = h.hd_jd - h.hd_dw + 1;
1201 how_many_calendar_lines( h.gd_mon, h.hd_dw );
1202
1203 /*********************************************************
1204 * three months, side-by-side
1205 *********************************************************/
1206 if (opt.three_month)
1207 {
1208 /*********************************************************
1209 * previous month
1210 *********************************************************/
1211 if (current_month == 1)
1212 {
1213 previous_month = 12;
1214 previous_year = current_year - 1;
1215 }
1216 else
1217 {
1218 previous_month = current_month - 1;
1219 previous_year = current_year;
1220 }
1221 hdate_set_gdate (&h, 1, previous_month, previous_year);
1222 jd_previous_month = h.hd_jd - h.hd_dw + 1;
1223 how_many_calendar_lines( h.gd_mon, h.hd_dw );
1224
1225 /*********************************************************
1226 * next month
1227 *********************************************************/
1228 if (current_month == 12)
1229 {
1230 next_month = 1;
1231 next_year = current_year + 1;
1232 }
1233 else
1234 {
1235 next_month = current_month + 1;
1236 next_year = current_year;
1237 }
1238 hdate_set_gdate (&h, 1, next_month, next_year);
1239 jd_next_month = h.hd_jd - h.hd_dw + 1;
1240 how_many_calendar_lines( h.gd_mon, h.hd_dw );
1241 }
1242
1243
1244
1245 /**************************************************
1246 * maximum six lines of calendar
1247 **************************************************/
1248 for (calendar_line = 0; calendar_line < max_calendar_lines; calendar_line++)
1249 {
1250 if (opt.html) printf ("<tr>\n");
1251
1252 if (opt.three_month)
1253 {
1254 print_week(jd_previous_month, previous_month, opt);
1255 jd_previous_month = jd_previous_month + 7;
1256 printf(" ");
1257 }
1258
1259 print_week(jd_current_month, current_month, opt);
1260 jd_current_month = jd_current_month + 7;
1261
1262
1263 if (opt.three_month)
1264 {
1265 printf(" ");
1266 print_week(jd_next_month, next_month, opt);
1267 jd_next_month = jd_next_month + 7;
1268 }
1269
1270 if (opt.html) printf ("</tr>\n");
1271 else printf ("\n");
1272 }
1273
1274
1275 /**************************************************
1276 * print end of calendar
1277 *************************************************/
1278 if (opt.html) printf ("</table>\n</span>");
1279
1280 return 0;
1281 }
1282
1283
1284
1285
1286
1287
1288 /****************************************************
1289 * print month header, month table, month footnotes
1290 ****************************************************/
1291 int print_month ( const int month, const int year, const option_list opt)
1292 {
1293 hdate_struct h;
1294
1295 // following are for opt.footnote
1296 int jd_counter, holiday;
1297 //char *language; // for forcing Hebrew printing of footnote
1298
1299
1300 /* check if hebrew year (year > 3000) */
1301 if (year > 3000) hdate_set_hdate (&h, 1, month, year);
1302 else hdate_set_gdate (&h, 1, month, year);
1303
1304
1305 print_header (h.gd_mon, h.gd_year, opt);
1306 print_calendar (h.gd_mon, h.gd_year, opt);
1307 printf("\n");
1308
1309
1310 /****************************************************
1311 * print footnotes
1312 ****************************************************/
1313 if (opt.footnote)
1314 {
1315 jd_counter = h.hd_jd;
1316 while ( month == h.gd_mon )
1317 {
1318 holiday = hdate_get_holyday(&h, opt.diaspora);
1319 if (holiday)
1320 {
1321 print_day ( h, month, opt);
1322 /*if (opt.force_hebrew)
1323 {
1324 // BUG - this isn't thread-safe
1325 // --- and it may no longer be nexessary anywhere
1326 // in the code now that I've embedded Hebrew
1327 language=getenv("LANGUAGE");
1328 setenv("LANGUAGE", "he_IL.UTF-8", 1);
1329 }*/
1330 if (opt.colorize)
1331 {
1332 if (opt.jd_today_h == h.hd_jd) colorize_element(ELEMENT_TODAY_HOLIDAY_NAME);
1333 else colorize_element(ELEMENT_HOLIDAY_NAME);
1334 }
1335
1336 if (opt.bidi)
1337 {
1338 char *holiday_str, *holiday_buffer;
1339 size_t holiday_str_len;
1340 holiday_str = hdate_string( HDATE_STRING_HOLIDAY,
1341 holiday,
1342 HDATE_STRING_LONG,
1343 opt.force_hebrew);
1344
1345 holiday_str_len = strlen(holiday_str);
1346 holiday_buffer = malloc(holiday_str_len+1);
1347 memcpy(holiday_buffer, holiday_str, holiday_str_len);
1348 holiday_buffer[holiday_str_len] = '\0';
1349 revstr(holiday_buffer, holiday_str_len);
1350
1351 // padding - FIXME - spaces are single-byte, while
1352 // the Hebrew characters are two bytes
1353 const int margin_max = 16; // 15 fails because of jabotinsky in july
1354 printf("%*s%s\n", (int)(margin_max - holiday_str_len/2)," ", holiday_buffer);
1355
1356 free(holiday_buffer);
1357 }
1358 else printf (" %s\n",
1359 hdate_string( HDATE_STRING_HOLIDAY,
1360 holiday,
1361 HDATE_STRING_LONG,
1362 opt.force_hebrew));
1363
1364 if (opt.colorize) printf (CODE_RESTORE_VIDEO);
1365 //if (opt.force_hebrew) setenv("LANGUAGE", language, 1);
1366 }
1367 jd_counter++;
1368 hdate_set_jd (&h, jd_counter);
1369 }
1370 }
1371 return 0;
1372 }
1373
1374
1375 /****************************************************
1376 * read and parse config file
1377 ****************************************************/
1378 void read_config_file( FILE *config_file,
1379 option_list *opt,
1380 double* latitude,
1381 int* opt_latitude,
1382 double* longitude,
1383 int* opt_longitude,
1384 int* tz )
1385
1386 {
1387 char *input_string;
1388 size_t input_str_len = 100; // WARNING: if you change this value
1389 // you will still have to also
1390 // change a matching value below
1391 // in the statement that includes:
1392 // match_count = sscanf(input_string
1393 char *input_key = "";
1394 char *input_value = "";
1395 int line_count = 0;
1396 int menu_item = 0;
1397 size_t menu_len = 0;
1398 int match_count;
1399 int end_of_input_file = FALSE;
1400 int i;
1401 const int num_of_keys = 20;
1402 const char* key_list[] = { "SUNSET_AWARE", // 0
1403 "LATITUDE",
1404 "LONGITUDE", // 2
1405 "TIMEZONE",
1406 "DIASPORA", // 4
1407 "FORCE_ISRAEL",
1408 "PARASHA_NAMES", // 6
1409 "SHABBAT_INFO",
1410 "FOOTNOTES", // 8
1411 "FORCE_HEBREW",
1412 "OUTPUT_BIDI", //10
1413 "SUPPRESS_REVERSE_VIDEO",
1414 "COLORIZE", //12
1415 "OUTPUT_HTML",
1416 "USE_EXTERNAL_CSS_FILE",
1417 "QUIET_ALERTS",
1418 "THREE_MONTH", //16
1419 "MENU",
1420 "CANDLE_LIGHTING", //18
1421 "HAVDALAH"
1422 };
1423
1424 input_string = malloc(input_str_len+1);
1425 input_key = malloc(input_str_len+1);
1426 input_value = malloc(input_str_len+1);
1427 while ( end_of_input_file!=TRUE )
1428 {
1429 end_of_input_file = getline(&input_string, &input_str_len, config_file);
1430 if ( end_of_input_file!=TRUE )
1431 {
1432 errno = 0;
1433 // The '100' in the next statement is inelegant; it is meant to
1434 // be the value of input_str_len. Alternatively, don't malloc
1435 // input_value above, use the 'a' specifier here, and free(input_value)
1436 // at the end of every successful read and evaluation
1437 match_count = sscanf(input_string,"%[A-Z_]=%100[^\n]",input_key,input_value);
1438 line_count++;
1439 if (errno != 0) error(0,errno,"scan error at line %d", line_count);
1440 // DEBUG - printf("line number = %d, matches made = %d, key = %s, value = %s, string = %s",
1441 // line_count, match_count, input_key, input_value, input_string);
1442 if (match_count ==2)
1443 {
1444 for (i=0; i<num_of_keys; i++)
1445 {
1446 if (strcmp(input_key, key_list[i]) == 0)
1447 {
1448 // DEBUG - printf("match found!, %s = %s, index = %d\n",input_key,key_list[i],i);
1449 switch(i)
1450 {
1451
1452 case 0:if (strcmp(input_value,"FALSE") == 0) opt->not_sunset_aware = 1;
1453 else if (strcmp(input_value,"TRUE") == 0) opt->not_sunset_aware = 0;
1454 break;
1455 case 1:
1456 parse_coordinate(1, input_value, latitude, opt_latitude);
1457 break;
1458 case 2:
1459 parse_coordinate(2, input_value, longitude, opt_longitude);
1460 break;
1461 case 3:
1462 parse_timezone(input_value, tz);
1463 break;
1464 case 4:if (strcmp(input_value,"FALSE") == 0) opt->diaspora = 0;
1465 else if (strcmp(input_value,"TRUE") == 0) opt->diaspora = 1;
1466 break;
1467 case 5:if (strcmp(input_value,"FALSE") == 0) opt->force_israel = 0;
1468 else if (strcmp(input_value,"TRUE") == 0) opt->force_israel = 1;
1469 break;
1470 case 6:if (strcmp(input_value,"FALSE") == 0) opt->parasha = 0;
1471 else if (strcmp(input_value,"TRUE") == 0) opt->parasha = 1;
1472 break;
1473 case 7:if (strcmp(input_value,"FALSE") == 0) opt->shabbat = 0;
1474 else if (strcmp(input_value,"TRUE") == 0)
1475 {
1476 opt->shabbat = 1;
1477 opt->parasha = 1;
1478 }
1479 break;
1480 case 8:if (strcmp(input_value,"FALSE") == 0) opt->footnote = 0;
1481 else if (strcmp(input_value,"TRUE") == 0) opt->footnote = 1;
1482 break;
1483 case 9:if (strcmp(input_value,"FALSE") == 0) opt->force_hebrew = 0;
1484 else if (strcmp(input_value,"TRUE") == 0) opt->force_hebrew = 1;
1485 break;
1486 case 10:if (strcmp(input_value,"FALSE") == 0) opt->bidi = 0;
1487 else if (strcmp(input_value,"TRUE") == 0)
1488 {
1489 opt->bidi = 1;
1490 opt->force_hebrew = 1;
1491 }
1492 break;
1493 case 11:if (strcmp(input_value,"FALSE") == 0) opt->no_reverse = 0;
1494 else if (strcmp(input_value,"TRUE") == 0) opt->no_reverse = 1;
1495 break;
1496 case 12:if (strcmp(input_value,"FALSE") == 0) opt->colorize = 0;
1497 else if (strcmp(input_value,"TRUE") == 0) opt->colorize = 1;
1498 break;
1499 case 13:if (strcmp(input_value,"FALSE") == 0) opt->html = 0;
1500 else if (strcmp(input_value,"TRUE") == 0) opt->html = 1;
1501 break;
1502 case 14:if (strcmp(input_value,"FALSE") == 0) opt->external_css = 0;
1503 else if (strcmp(input_value,"TRUE") == 0) opt->external_css = 1;
1504 break;
1505 case 15:if (strcmp(input_value,"FALSE") == 0) opt->quiet_alerts = 0;
1506 else if (strcmp(input_value,"TRUE") == 0) opt->quiet_alerts = 1;
1507 break;
1508 case 16:if (strcmp(input_value,"FALSE") == 0) opt->three_month = 0;
1509 else if (strcmp(input_value,"TRUE") == 0) opt->three_month = 1;
1510 break;
1511
1512 // MENU
1513 case 17:if (menu_item < MAX_MENU_ITEMS)
1514 {
1515 menu_len = strlen(input_value);
1516 opt->menu_item[menu_item] = malloc(menu_len+1);
1517 memcpy(opt->menu_item[menu_item], input_value,menu_len);
1518 menu_item++;
1519 }
1520 break;
1521 // CANDLE_LIGHTING
1522 case 18:if (strcmp(input_value,"FALSE") == 0) opt->candles = 0;
1523 else if (strcmp(input_value,"TRUE") == 0) opt->candles = 1;
1524 else if (fnmatch( "[[:digit:]]?([[:digit:]])", input_value, FNM_EXTMATCH) == 0)
1525 {
1526 opt->candles = atoi(input_value);
1527 if (opt->candles < MIN_CANDLES_MINUTES) opt->candles = MIN_CANDLES_MINUTES;
1528 else if (opt->candles > MAX_CANDLES_MINUTES) opt->candles = MAX_CANDLES_MINUTES;
1529 }
1530 break;
1531
1532 // HAVDALAH
1533 case 19:if (strcmp(input_value,"FALSE") == 0) opt->havdalah = 0;
1534 else if (strcmp(input_value,"TRUE") == 0) opt->havdalah = 1;
1535 else if (fnmatch( "[[:digit:]]?([[:digit:]])", input_value, FNM_EXTMATCH) == 0)
1536 {
1537 opt->havdalah = atoi(input_value);
1538 if (opt->havdalah < MIN_MOTZASH_MINUTES) opt->havdalah = MIN_MOTZASH_MINUTES;
1539 else if (opt->havdalah > MAX_MOTZASH_MINUTES) opt->havdalah = MAX_MOTZASH_MINUTES;
1540 }
1541 break;
1542
1543 } // end of switch(i)
1544 break; // if found a match don't continue for loop
1545 }
1546 }
1547 }
1548 }
1549 }
1550 free(input_string);
1551 free(input_key);
1552 free(input_value);
1553 return;
1554 }
1555
1556
1557 /****************************************************
1558 * exit elegantly
1559 ****************************************************/
1560 void exit_main( option_list *opt, const int exit_code)
1561 {
1562 int i;
1563 for (i=0; i<MAX_MENU_ITEMS; i++)
1564 {
1565 if (opt->menu_item[i] == NULL) break;
1566 free(opt->menu_item[i]);
1567 }
1568 exit (exit_code);
1569 }
1570
1571
1572 /****************************************************
1573 * parse a command-line or a config-file menu line
1574 *
1575 * It was appropriate to make this a function, outside
1576 * of main, because of its dual use and dual reference
1577 ****************************************************/
1578 int hcal_parser( const int switch_arg, option_list *opt,
1579 double *lat, int *opt_latitude,
1580 double *lon, int *opt_Longitude,
1581 int *tz, int long_option_index)
1582
1583 {
1584 int error_detected = 0;
1585
1586 switch (switch_arg)
1587 {
1588
1589 case 0: /* long options */
1590 switch (long_option_index)
1591 {
1592 /* --version */ case 0: print_version (); exit_main(opt, 0); break;
1593 /* --help */ case 1: print_help (); exit_main(opt, 0); break;
1594 /* --no-reverse */ case 2: opt->no_reverse = 1; break;
1595 /* --html */ case 3: break;
1596 /* --parasha */ case 4: break;
1597 /* --shabbat */ case 5: break;
1598 /* --three-month*/ case 6: break;
1599 /* --colorize */ case 7: break;
1600 /* --footnote */ case 8: break;
1601 /* --hebrew */ case 9: break;
1602 /* --israel */ case 10:break;
1603 /* --latitude */ case 11:break;
1604 /* --longitude */ case 12:break;
1605 /* --timezone */ case 13:break;
1606 /* --not-sunset-aware */ case 14: opt->not_sunset_aware = 1; break;
1607 /* --quiet-alerts*/ case 15: break;
1608 /* --visual */ case 16:
1609 /* --bidi */ case 17: break;
1610 /* --one-month */ case 18: break;
1611 /* --no-visual */ case 19:
1612 /* --no-bidi */ case 20: opt->bidi = 0; opt->force_hebrew = 0; break;
1613 /* --no-color */ case 21: opt->colorize = 0; break;
1614 /* --no-footnote*/ case 22: opt->footnote = 0; break;
1615 /* --menu */ case 23: break;
1616 /* --candles */ case 24:
1617 if ( (optarg == NULL) && (opt->candles == 0) )opt->candles = 1;
1618 else
1619 {
1620 if (fnmatch( "[[:digit:]]?([[:digit:]])", optarg, FNM_EXTMATCH) == 0)
1621 {
1622 opt->candles = atoi(optarg);
1623 if ( (opt->candles >= MIN_CANDLES_MINUTES) &&
1624 (opt->candles <= MAX_CANDLES_MINUTES) ) break;
1625 }
1626 print_parm_error("--candles");
1627 error_detected++;
1628 }
1629 break;
1630 /* --havdalah */ case 25:
1631 if ( (optarg == NULL) && (opt->havdalah == 0) ) opt->havdalah = 1;
1632 else
1633 {
1634 if (fnmatch( "[[:digit:]]?([[:digit:]])", optarg, FNM_EXTMATCH) == 0)
1635 {
1636 opt->havdalah = atoi(optarg);
1637 if ( (opt->havdalah >= MIN_MOTZASH_MINUTES) &&
1638 (opt->havdalah <= MAX_MOTZASH_MINUTES) ) break;
1639 }
1640 print_parm_error("--havdalah");
1641 error_detected++;
1642 }
1643 break;
1644
1645 } // end switch for long_options
1646 break;
1647
1648
1649 case '1': opt->three_month = 0; break;
1650 case '3': opt->three_month = 1; break;
1651 case 'b': opt->bidi = 1; opt->force_hebrew = 1; break;
1652 case 'c': opt->colorize = 1; break;
1653 case 'd': opt->diaspora = 1; break;
1654 case 'f': opt->footnote = 1; break;
1655 case 'h': opt->html = 1; break;
1656 case 'H': opt->force_hebrew = 1; break;
1657 case 'I': opt->force_israel = 1; break;
1658 case 'i': opt->external_css = 1; break;
1659 case 'm': opt->menu = 1; break;
1660 case 'p': opt->parasha = 1; break;
1661 case 'q': opt->quiet_alerts = 1; break;
1662 case 'l':
1663 error_detected = error_detected + parse_coordinate(1, optarg, lat, opt_latitude);
1664 break;
1665 case 'L':
1666 error_detected = error_detected + parse_coordinate(2, optarg, lon, opt_Longitude);
1667 break;
1668 case 's':
1669 opt->shabbat = 1;
1670 opt->parasha = 1;
1671 if (opt->candles == 0) opt->candles = 1;
1672 if (opt->havdalah == 0) opt->havdalah = 1;
1673 break;
1674 case 'z':
1675 error_detected = error_detected + parse_timezone(optarg, tz);
1676 break;
1677 case '?':
1678 // FIXME if (strchr(short_options,optopt)!=NULL)
1679 print_parm_missing_error((char*) &optopt);
1680 error_detected = TRUE;
1681 break;
1682 default: print_usage_hcal (); exit_main(opt, 0); break;
1683 }
1684 return error_detected;
1685 }
1686
1687 /**************************************************
1688 ***************************************************
1689 ***************************************************
1690 * main
1691 ***************************************************
1692 ***************************************************
1693 **************************************************/
1694 int main (int argc, char *argv[])
1695 {
1696
1697 /* date */
1698 int month, year;
1699
1700 double lat = BAD_COORDINATE; /* set to this value for error handling */
1701 double lon = BAD_COORDINATE; /* set to this value for error handling */
1702 int tz = BAD_TIMEZONE; /* -z option Time Zone, default to system local time */
1703
1704 int opt_latitude = 0; /* -l option latitude */
1705 int opt_Longitude = 0; /* -L option longitude */
1706
1707 int error_detected = FALSE; /* exit after reporting ALL bad parms */
1708
1709
1710 option_list opt;
1711 opt.bidi = 0; // visual bidi, implies --force-hebrew
1712 opt.html = 0; // -h html format flag
1713 opt.diaspora = 0; // -d Diaspora holidays
1714 opt.external_css = 0; // -i External css file
1715 opt.parasha = 0; // -p print parasha alongside calendar
1716 opt.shabbat = 0; // -c print candle-lighting alongside calendar
1717 opt.candles = 0;
1718 opt.havdalah = 0;
1719 opt.no_reverse = 0; // don't highlight today in reverse video
1720 opt.three_month = 0; // print previous and next months also
1721 opt.colorize = 0; // display calendar in muted, more pleasing tones
1722 opt.footnote = 0; // display description of month's holidays
1723 opt.force_hebrew = 0; // force display of Hebrew data in Hebrew
1724 opt.force_israel = 0; // override diaspora-awareness
1725 opt.not_sunset_aware = 0; // override sunset-awareness
1726 opt.quiet_alerts = 0;
1727
1728 opt.lat = BAD_COORDINATE;
1729 opt.lon = BAD_COORDINATE;
1730 opt.tz = BAD_TIMEZONE;
1731
1732 opt.menu = 0; // -m print menus for user-selection
1733 int i;
1734 for (i=0; i<MAX_MENU_ITEMS; i++) opt.menu_item[i] = NULL;
1735
1736
1737 // support for getopt short options
1738 static char * short_options = "13bcdfhHiImpqsl:L:z:";
1739
1740 /* support for long options */
1741 int long_option_index = 0;
1742 int c;
1743 static struct option long_options[] = {
1744 // name, has_arg, flag, val
1745 {"version", 0, 0, 0},
1746 {"help", 0, 0, 0},
1747 {"no-reverse", 0, 0, 0},
1748 {"html", 0, 0, 'h'},
1749 {"parasha", 0, 0, 'p'},
1750 {"shabbat", 0, 0, 's'},
1751 {"three-month", 0, 0, '3'},
1752 {"colorize", 0, 0, 'c'},
1753 {"footnote",0,0,'f'},
1754 {"hebrew",0,0,'H'},
1755 {"israel",0,0,'I'},
1756 {"latitude", 1, 0, 'l'},
1757 {"longitude", 1, 0, 'L'},
1758 {"timezone", 1, 0, 'z'},
1759 {"not-sunset-aware", 0, 0, 0},
1760 {"quiet-alerts",0,0,'q'},
1761 {"bidi",0,0,'b'},
1762 {"visual",0,0,'b'},
1763 {"one-month",0,0,'1'},
1764 {"no-bidi",0,0,0},
1765 {"no-visual",0,0,0},
1766 {"no-color",0,0,0},
1767 {"no-footnote",0,0,0},
1768 {"menu",0,0,'m'},
1769 {"candles",2,0,0},
1770 {"havdalah",2,0,0},
1771 {0, 0, 0, 0}
1772 };
1773
1774 /* hdate struct */
1775 hdate_struct h;
1776
1777 // for config file user-defined menus
1778 size_t menu_len = 0;
1779 int menu_index;
1780 char *menuptr, *optptr;
1781
1782 /************************************************************
1783 * init locale
1784 *
1785 * I'm not sure why this had to be done. Per an answer on
1786 * stackoverflow (not yet check out by me):
1787 *
1788 * "At program startup, you should call setlocale():
1789 * setlocale(LC_CTYPE, "");
1790 * This will cause the wide character functions to use the
1791 * appropriate character set defined by the environment - eg.
1792 * on Unix-like systems, the LANG environment variable. For
1793 * example, this means that if your LANG variable is set to a
1794 * UTF8 locale, the wide character functions will handle input
1795 * and output in UTF8. (This is how the POSIX wc utility is
1796 * specified to work). You can then use the wide-character
1797 * versions of all the standard functions. However, if you
1798 * really do want to count characters rather than bytes, and
1799 * can assume that your text files are encoded in UTF-8, then
1800 * the easiest approach is to count all bytes that are not
1801 * trail bytes (i.e., in the range 0x80 to 0xBF)."
1802 *
1803 * Note: the code sets LC_ALL instead of LC_CTYPE; and the
1804 * code does not use wide_char functions ...
1805 ************************************************************/
1806 setlocale (LC_ALL, "");
1807
1808 /************************************************************
1809 * parse config file
1810 ************************************************************/
1811 FILE *config_file = get_config_file("/hcal", "/hcalrc", hcal_config_file_text);
1812 if (config_file != NULL)
1813 {
1814 read_config_file(config_file, &opt, &lat, &opt_latitude, &lon, &opt_Longitude, &tz);
1815