120 lines
3.7 KiB
Text
120 lines
3.7 KiB
Text
--- lunar.c.orig Tue Feb 26 20:54:23 2002
|
|
+++ lunar.c Tue Feb 26 21:01:38 2002
|
|
@@ -118,6 +118,26 @@
|
|
"侐", "拻", "鞠"
|
|
};
|
|
|
|
+static char *GanBIG5[] = {
|
|
+ "甲", "乙", "丙", "丁", "戊",
|
|
+ "己", "庚", "辛", "壬", "癸"
|
|
+};
|
|
+
|
|
+static char *ZhiBIG5[] = {
|
|
+ "子", "丑", "寅", "卯", "辰", "巳",
|
|
+ "午", "未", "申", "酉", "戌", "亥"
|
|
+};
|
|
+
|
|
+static char *ShengXiaoBIG5[] = {
|
|
+ "鼠", "牛", "虎", "兔", "龍", "蛇",
|
|
+ "馬", "羊", "猴", "雞", "狗", "豬"
|
|
+};
|
|
+
|
|
+static char *weekdayBIG5[] = {
|
|
+ "日", "一", "二", "三",
|
|
+ "四", "五", "六"
|
|
+};
|
|
+
|
|
|
|
Date solar, lunar, gan, zhi, gan2, zhi2, lunar2;
|
|
|
|
@@ -127,6 +147,7 @@
|
|
int jieAlert; /* if there is uncertainty in JieQi calculation */
|
|
|
|
int showHZ = 0; /* output in hanzi */
|
|
+int showB5 = 0; /* output in big5 */
|
|
int showBM = 0; /* output in bitmap */
|
|
char BMfile[] = BITMAPFILE; /* bit map file */
|
|
char GZBM[NBM][BMRow][BMCol]; /* the bitmap array */
|
|
@@ -139,7 +160,7 @@
|
|
void CalGZ();
|
|
int JieDate(), JieDate();
|
|
void readBM(), display3();
|
|
-void Report(), ReportE(), ReportBM(), ReportGB();
|
|
+void Report(), ReportE(), ReportBM(), ReportGB(), ReportBIG5();
|
|
void usage(), Error();
|
|
|
|
|
|
@@ -162,6 +183,7 @@
|
|
case 'l': if (inverse) leap=1; else usage(); break;
|
|
case 'h': showHZ = 1; break;
|
|
case 'b': showBM = 1; break;
|
|
+ case '5': showB5 = 1; break;
|
|
default: usage(); break;
|
|
}
|
|
}
|
|
@@ -213,13 +235,14 @@
|
|
void usage()
|
|
{
|
|
printf("Usage:\n\n");
|
|
- printf("Solar->Lunar:\t%s [-h] [-b] year month day [hour]\n", progname);
|
|
+ printf("Solar->Lunar:\t%s [-h] [-5] [-b] year month day [hour]\n", progname);
|
|
printf("\t\t(in Solar Calendar, 24 hour clock)\n\n");
|
|
- printf("Lunar->Solar:\t%s [-h] [-b] -i [-l] year month day [hour]\n",
|
|
+ printf("Lunar->Solar:\t%s [-h] [-5] [-b] -i [-l] year month day [hour]\n",
|
|
progname);
|
|
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-5 means output in traditional chinese(BIG5)\n");
|
|
printf("\t\t-b means output in \"bitmap\"\n\n");
|
|
printf("Date range: about %d years from the Solar Date %d.%d.%d\n", Nyear,
|
|
SolarFirstDate.year, SolarFirstDate.month, SolarFirstDate.day);
|
|
@@ -578,6 +601,8 @@
|
|
{
|
|
if (showHZ)
|
|
ReportGB();
|
|
+ else if (showB5)
|
|
+ ReportBIG5();
|
|
else if (showBM)
|
|
ReportBM();
|
|
else
|
|
@@ -614,6 +639,39 @@
|
|
if (lunar2.month==1)
|
|
printf("* %s\n", "爛翐砫褫夔猁党蜊");
|
|
printf("* %s\n", "ワ脤衄誹げ奀潔眳勀爛盪");
|
|
+ }
|
|
+}
|
|
+
|
|
+
|
|
+void ReportBIG5()
|
|
+{
|
|
+ printf("%s%d%s%2d%s%2d%s%2d%s%s%s\n", "陽歷: ",
|
|
+ solar.year, "年", solar.month, "月", solar.day,
|
|
+ "日", solar.hour, "時 ",
|
|
+ "星期", weekdayBIG5[solar.weekday]);
|
|
+ printf("%s%d%s%s%2d%s%2d%s%s%s%s%s\n", "陰歷: ",
|
|
+ lunar.year, "年", (lunar.leap? "閏":""),
|
|
+ lunar.month, "月", lunar.day, "日",
|
|
+ ZhiBIG5[zhi.hour], "時 ",
|
|
+ "生肖屬", ShengXiaoBIG5[zhi.year]);
|
|
+ printf("%s%s%s%s%s%s%s%s%s%s%s%s%s\n", "干支: ",
|
|
+ GanBIG5[gan.year], ZhiBIG5[zhi.year], "年 ",
|
|
+ GanBIG5[gan.month], ZhiBIG5[zhi.month], "月 ",
|
|
+ GanBIG5[gan.day], ZhiBIG5[zhi.day], "日 ",
|
|
+ GanBIG5[gan.hour], ZhiBIG5[zhi.hour], "時 ");
|
|
+ printf("%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
|
|
+ "用四柱神算推算之時辰八字: ",
|
|
+ GanBIG5[gan2.year], ZhiBIG5[zhi2.year], "年 ",
|
|
+ GanBIG5[gan2.month], ZhiBIG5[zhi2.month], "月 ",
|
|
+ GanBIG5[gan2.day], ZhiBIG5[zhi2.day], "日 ",
|
|
+ GanBIG5[gan2.hour], ZhiBIG5[zhi2.hour], "時 ");
|
|
+ if (jieAlert)
|
|
+ {
|
|
+ printf("* %s, %s\n", "是日為節",
|
|
+ "月柱可能要修改");
|
|
+ if (lunar2.month==1)
|
|
+ printf("* %s\n", "年柱亦可能要修改");
|
|
+ printf("* %s\n", "請查有節氣時間之萬年歷");
|
|
}
|
|
}
|
|
|