[Chinese-commits] [lunar] 01/05: Imported Debian patch 2.2-1

Anthony Fok foka at debian.org
Sat Sep 19 19:35:40 UTC 2015


This is an automated email from the git hooks/post-receive script.

foka pushed a commit to branch master
in repository lunar.

commit bd6464f858931dae49efa2291d1ab1e3b51995de
Author: Anthony Fok <foka at debian.org>
Date:   Sun Sep 22 14:54:09 2002 +0800

    Imported Debian patch 2.2-1
---
 Makefile         |  2 +-
 debian/changelog |  6 ++++
 debian/control   | 16 +++++++++++
 debian/copyright | 35 +++++++++++++++++++++++
 debian/rules     | 67 +++++++++++++++++++++++++++++++++++++++++++
 lunar.1          | 10 +++----
 lunar.c          | 86 +++++++++++++++++++++++++++++++++++++++++++++++++-------
 7 files changed, 206 insertions(+), 16 deletions(-)

diff --git a/Makefile b/Makefile
index 6ced2e3..e4aecd4 100644
--- a/Makefile
+++ b/Makefile
@@ -24,5 +24,5 @@ lunar:	lunar.o
 	cc -o lunar lunar.o
 
 clean:
-	rm *.o
+	rm *.o lunar
 
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..7c0aea1
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,6 @@
+lunar (2.2-1) unstable; urgency=low
+
+  * Initial Release.
+  * Added Big5 output in addition to the original Hanzi (GB) output.
+
+ -- Anthony Fok <foka at debian.org>  Sun, 22 Sep 2002 14:54:09 +0800
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..2a2b563
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,16 @@
+Source: lunar
+Section: utils
+Priority: optional
+Maintainer: Anthony Fok <foka at debian.org>
+Build-Depends: debhelper (>> 3.0.0)
+Standards-Version: 3.5.7
+
+Package: lunar
+Architecture: any
+Depends: ${shlibs:Depends}
+Description: Chinese Lunar Calendar conversion utility.
+ The program performs date conversion between the Gregorian Solar Calendar
+ (SC) and the Chinese Lunar Calendar (LC).  Given a date in either calendar,
+ the program also outputs the corresponding "shengxiao" animal of the year)
+ and "ganzhi" characters.  The date range currently covered is from about
+ 1900 A.D. to 2049 A.D.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..c64e794
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,35 @@
+This package was debianized by Anthony Fok <foka at debian.org> on
+Sat, 21 Sep 2002 11:54:26 +0800.
+
+It was downloaded from
+    http://umunhum.stanford.edu/~lee/chicomp/lunar-2.2.tar.gz
+
+Upstream Authors:
+    Fung F. Lee <lee at umunhum.stanford.edu> and
+    Ricky Yeung <cryeung at hotmail.com>
+
+Copyright:
+
+    Copyright (C) 1988, 1989, 1991, 1992, 2001 Fung F. Lee and Ricky Yeung
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or any
+    later version.
+
+    This program is distributed in the hope that it will be useful, but
+    WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+    The last version of this program was released on July 23, 1992 as
+    version 2.1a.  This program was first released under the terms of GNU
+    GPL on October 28, 2001 as version 2.2.  Both versions are identical
+    except for the license text.
+
+The complete text of the GNU General Public License can be found
+in `/usr/share/common-licenses/GPL' on your Debian system.
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..5a7790e
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,67 @@
+#!/usr/bin/make -f
+# debian/rules file for lunar-2.2
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# This is the debhelper compatibility version to use.
+export DH_COMPAT=3
+
+ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
+	CFLAGS += -g
+endif
+ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
+	INSTALL_PROGRAM += -s
+endif
+
+build: build-stamp
+build-stamp:
+	dh_testdir
+
+	# Add here commands to compile the package.
+	$(MAKE) CFLAGS="-O2 -Wall"
+
+	touch build-stamp
+
+clean:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp configure-stamp
+
+	# Add here commands to clean up after the build process.
+	-$(MAKE) clean
+
+	dh_clean
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+	dh_installdirs usr/bin
+
+	# Add here commands to install the package into debian/lunar.
+	install -m755 -p lunar debian/lunar/usr/bin/
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+	dh_installdocs
+	dh_installman lunar.1
+	dh_installchangelogs 
+	dh_link
+	dh_strip
+	dh_compress
+	dh_fixperms
+	dh_installdeb
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
diff --git a/lunar.1 b/lunar.1
index 56b1da5..17c053f 100644
--- a/lunar.1
+++ b/lunar.1
@@ -4,13 +4,13 @@ lunar (version 2.2) \- a calendar conversion utility
 .SH SYNTAX
 .B lunar
 [
-.B\-h
+.B \-h
 ] [
-.B\-b
+.B \-b
 ] [
-.B\-i
+.B \-i
 ] [
-.B\-l
+.B \-l
 ]
 .I year month day
 [
@@ -39,7 +39,7 @@ and SC 1991.2.16.1 is LC 1991.1.2.1.
 The standard time of the Lunar Calendar is
 Beijing (Hong Kong) Standard Time, not GMT.
 Be sure to adjust appropriately for other time zones
-and "Day-light Saving Time".
+and "Daylight Saving Time".
 .PP
 In the Lunar Calendar,
 a normal year has 12 months, and a leap year (run-nian) has 13 months,
diff --git a/lunar.c b/lunar.c
index 38e5f03..6076a45 100644
--- a/lunar.c
+++ b/lunar.c
@@ -131,6 +131,26 @@ static char *weekdayGB[] = {
     "��", "��", "��"
 };
 
+static	char	*GanB5[] = {
+    "��", "�A", "��", "�B", "��",
+    "�v", "��", "��", "��", "��"
+};
+
+static	char	*ZhiB5[] = {
+    "�l", "��", "�G", "�f", "��", "�x",
+    "��", "��", "��", "��", "��", "��"
+};
+
+static	char   *ShengXiaoB5[] = {
+    "��", "��", "��", "��", "�s", "�D",
+    "��", "��", "�U", "��", "��", "��"
+};
+
+static char *weekdayB5[] = {
+    "��", "�@", "�G", "�T",
+    "�|", "��", "��"
+};
+
 
 Date solar, lunar, gan, zhi, gan2, zhi2, lunar2;
 
@@ -141,6 +161,8 @@ int jieAlert;		/* if there is uncertainty in JieQi calculation */
 
 int	showHZ = 0;			/* output in hanzi */
 int	showBM = 0;			/* output in bitmap */
+int	showHZ_GB = 0;			/* output in GB-encoded hanzi */
+int	showHZ_B5 = 0;			/* output in Big5-encoded hanzi */
 char	BMfile[] = "lunar.bitmap";	/* bit map file */
 char	GZBM[NBM][BMRow][BMCol];	/* the bitmap array */
 char	*progname;
@@ -150,9 +172,9 @@ long    Solar2Day(), Solar2Day1(), Lunar2Day();
 void	Day2Lunar(), Day2Solar();
 int     make_yday(), make_mday(), GZcycle();
 void	CalGZ();
-int	JieDate(), JieDate();
+int	CmpDate(), JieDate();
 void    readBM(), display3();
-void	Report(), ReportE(), ReportBM(), ReportGB();
+void	Report(), ReportE(), ReportBM(), ReportGB(), ReportB5();
 void	usage(), Error();
 
 
@@ -175,6 +197,16 @@ char *argv[];
 	    case 'l': if (inverse) leap=1; else usage(); break;
 	    case 'h': showHZ = 1; break;
 	    case 'b': showBM = 1; break;
+	    case '-':
+		if (strncmp(argv[k], "--big5", 7) == 0) {
+		    showHZ = showHZ_B5 = 1;
+		    showHZ_GB = 0;
+		} else if (strncmp(argv[k], "--gb", 5) == 0) {
+		    showHZ = showHZ_GB = 1;
+		    showHZ_B5 = 0;
+		} else
+		    usage();
+		break;
 	    default:  usage(); break;
 	}
     }
@@ -234,7 +266,9 @@ void usage()
     printf("\t\t(in Lunar Calendar, 24 hour clock)\n");
     printf("\t\t-l means the month is a leap month (\"run4 yue4\")\n\n");
     printf("\t\t-h means output in hanzi (GB)\n");
-    printf("\t\t-b means output in \"bitmap\"\n\n");
+    printf("\t\t-b means output in \"bitmap\"\n");
+    printf("\t\t--gb   means output in hanzi (GB)\n");
+    printf("\t\t--big5 means output in hanzi (Big5)\n\n");
     printf("Date range: about %d years from the Solar Date %d.%d.%d\n", Nyear,
 	   SolarFirstDate.year, SolarFirstDate.month, SolarFirstDate.day);
     exit(1);
@@ -243,9 +277,7 @@ void usage()
 
 void Solar2Lunar()
 {
-
     long offset;
-    Date *d;
 
     offset = Solar2Day(&solar);
     solar.weekday = (offset + SolarFirstDate.weekday) % 7;
@@ -269,7 +301,6 @@ void Lunar2Solar()
 {
     long offset;
     int adj;
-    Date *d;
 
     /* A solar day begins at 12 a.m. */
     adj = (lunar.hour == 23)? -1 : 0;
@@ -286,7 +317,7 @@ void Lunar2Solar()
 }
 
 
-#define	LeapYear(y)	(((y)%4==0) && ((y)%100!=0) || ((y)%400==0))
+#define	LeapYear(y)	((((y)%4==0) && ((y)%100!=0)) || ((y)%400==0))
 #define BYEAR		1201
 /* BYEAR % 4 == 1  and BYEAR % 400 == 1 for easy calculation of leap years */
 /* assert(BYEAR <= SolarFirstDate.year) */
@@ -357,7 +388,6 @@ Date *d;
 void Day2Lunar(offset, d)
 long offset;
 Date *d;
-
 {
     int i, m, nYear, leapMonth;
     
@@ -486,7 +516,7 @@ int month1, day1, month2, day2;
 int JieDate(ds, dl)
 Date *ds, *dl;
 {
-    int m, flag;
+    int m, flag = 0;
 
     if (ds->month==1)
     {
@@ -591,7 +621,10 @@ int year;
 void Report()
 {
     if (showHZ)
-	ReportGB();
+	if (showHZ_B5)
+	    ReportB5();
+	else 
+	    ReportGB();
     else if (showBM)
 	ReportBM();
     else
@@ -632,6 +665,39 @@ void ReportGB()
 }
 
 
+void ReportB5()
+{
+    printf("%s%d%s%2d%s%2d%s%2d%s%s%s\n", "����G�@",
+	   solar.year, "�~", solar.month, "��", solar.day,
+	   "��", solar.hour, "�ɡ@",
+	   "�P��", weekdayB5[solar.weekday]); 
+    printf("%s%d%s%s%2d%s%2d%s%s%s%s%s\n", "����G�@",
+	   lunar.year, "�~", (lunar.leap? "�|":""),
+	   lunar.month, "��", lunar.day, "��", 
+	   ZhiB5[zhi.hour], "�ɡ@",
+	   "�ͨv��", ShengXiaoB5[zhi.year]);
+    printf("%s%s%s%s%s%s%s%s%s%s%s%s%s\n", "�z��G�@",
+	   GanB5[gan.year], ZhiB5[zhi.year], "�~�@",
+	   GanB5[gan.month], ZhiB5[zhi.month], "��@",
+	   GanB5[gan.day], ZhiB5[zhi.day], "��@",
+	   GanB5[gan.hour], ZhiB5[zhi.hour], "�ɡ@");
+    printf("%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+	   "�Υ|�W������⤧�ɨ��K�r�G�@",
+	   GanB5[gan2.year], ZhiB5[zhi2.year], "�~�@",
+	   GanB5[gan2.month], ZhiB5[zhi2.month], "��@",
+	   GanB5[gan2.day], ZhiB5[zhi2.day], "��@",
+	   GanB5[gan2.hour], ZhiB5[zhi2.hour], "�ɡ@");
+    if (jieAlert)
+    {
+	printf("* %s, %s\n", "�O�鬰�`",
+	       "��W�i��n�ק�");
+	if (lunar2.month==1)
+	    printf("* %s\n", "�~�W��i��n�ק�");
+	printf("* %s\n", "�Ьd���`��ɶ����U�~��");
+    }
+}
+
+
 void ReportE()
 {
     printf("Solar : %d.%d.%d.%d\t%s\n", solar.year, solar.month, solar.day,

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/chinese/lunar.git



More information about the Chinese-commits mailing list