1 /* 2 * extern.h -- external variable, function 3 * 4 * Copyright (C) 1989,1999,2001,2003 by Yoshifumi Mori 5 * 6 * tab:4 7 */ 8 9 #define SUPPORT_MIN_YEAR 1873 /* ����6ǯ1��1���������ܤ������� */ 10 #define SUPPORT_MAX_YEAR 9999 11 12 #define MAX_DAYOFMONTH 31 /* ���κ������� */ 13 14 struct DATE_T { 15 int year; /* ǯ */ 16 int month; /* �� */ 17 int day; /* �� */ 18 int dayofweek; /* ���� */ 19 }; 20 21 #define CHK_BITFLAGS(x,flags) (((x) & (flags)) == 0 ? FALSE : TRUE) 22 #define CHG_BITFLAGS(x,flags) ((x) ^= (flags)) 23 #define SET_BITFLAGS(x,flags,state) ((state) == 0 ? ((x) &= ~(flags)) : ((x) |= (flags))) 24 25 26 /* 27 * birthday.c 28 */ 29 30 #ifndef INCLUDE_CALENDAR 31 #define MAXBIRTHFILE 16 /* ������Ͽ�ե������(������) */ 32 33 enum { 34 BIRTHDAY_AGE_ALL = 0, /* ����������鷺ǯ��ɽ�� */ 35 BIRTHDAY_AGE_MAN_ONLY, /* ������ǯ��ɽ�� */ 36 BIRTHDAY_AGE_YOUNG_ONLY, /* ������24�аʲ���ǯ��ɽ�� */ 37 BIRTHDAY_AGE_NO, /* ǯ���ɽ�����ʤ� */ 38 }; 39 40 extern char *birthday_filetbl[MAXBIRTHFILE]; 41 extern char *birthday_sortorder; /* �����Ƚ�� */ 42 extern int birthday_agesort; /* ǯ��Υ����Ƚ� */ 43 extern int birthday_addinfo; /* ��������̿�����ɲþ������� */ 44 45 extern int birthday_agelevel; /* ǯ���ɽ������ */ 46 extern int birthday_notice_range; /* ������ͽ�ϴ��� */ 47 extern int birthday_notice_flag; /* ������ͽ������ */ 48 extern int birthday_flower; /* �������β����� */ 49 50 extern int deathday_flag; /* ̿����ɽ������ */ 51 extern int deathday_agelevel; /* �塦��ǯ��ɽ������ */ 52 extern int deathday_notice_range; /* ̿��ͽ�ϴ��� */ 53 extern int deathday_notice_flag; /* ̿��ͽ������ */ 54 55 extern void birthday(void); 56 #endif /* !INCLUDE_CALENDAR */ 57 58 59 /* 60 * calendar.c 61 */ 62 63 #if !defined(_T_WINDOWS) && defined(INCLUDE_CALENDAR) 64 #define CAL_MAXMONTH 3 65 66 struct CALTBL { 67 int year; 68 int month; 69 int dayofmonth; 70 int first_dayofweek; 71 int last_dayofweek; 72 const char *monthname; 73 }; 74 75 extern const char *todaycnf_file; 76 77 extern struct CALTBL caltbl[CAL_MAXMONTH]; 78 #endif /* !_T_WINDOWS && INCLUDE_CALENDAR */ 79 80 81 /* 82 * calfw.c 83 */ 84 85 #if defined(_T_WINDOWS) && defined(INCLUDE_CALENDAR) 86 #define CAL_MAXMONTH (3 + 2) 87 88 struct CALTBL { 89 int year; 90 int month; 91 int dayofmonth; 92 int first_dayofweek; 93 int last_dayofweek; 94 const char *monthname; 95 }; 96 97 extern struct CALTBL caltbl[CAL_MAXMONTH]; 98 99 extern const char *todaycnf_file; 100 101 extern char *szAppName; 102 extern char *szHelpFile; 103 extern char *szTodayClass; 104 #endif /* _T_WINDOWS && INCLUDE_CALENDAR */ 105 106 107 /* 108 * colorsel.c 109 */ 110 #if defined(_T_WINDOWS) 111 extern BOOL SelectColorMapNo(HWND hwnd, HINSTANCE hInstance, int *colno, const int colormap[], const int max_colormap); 112 #endif /* _T_WINDOWS */ 113 114 /* 115 * config.c 116 */ 117 118 enum OP_TYPE { /* ���ڥ졼�������� */ 119 VAR_NONE = 0, /* ����ʤ� */ 120 VAR_STR, /* ʸ���� */ 121 VAR_INT, /* ���� */ 122 VAR_OP, /* ���ڥ��� */ 123 VAR_DIMSTR, /* ���� ʸ���� */ 124 VAR_DIMINT, /* ���� ���� */ 125 VAR_OPNUM, /* ���ڥ��ɿ��� */ 126 #if defined(_T_UNIX) 127 VAR_PATH, /* �ѥ�ʸ���� */ 128 #endif 129 }; 130 131 struct OPERAND_TABLE { 132 const char * const op_name; /* ̾�� */ 133 const int op_value; /* �� */ 134 }; 135 136 struct CONFIG_VARIABLE_TABLE { 137 const char * const vl_name; /* �ѿ�̾ */ 138 const int vl_type; /* ���ڥ졼�������� */ 139 union CONFIG_OP_UNION { 140 const void *dummy; 141 const struct OPERAND_TABLE * const uvl_optbl; 142 const int uvl_limit; 143 } o; 144 union CONFIG_VAR_UNION { 145 void *dummy; 146 char ** const uvl_string; 147 int * const uvl_int; 148 } v; 149 #if defined(_T_WINDOWS) 150 int vl_fmt; /* ���ϥե����ޥå� */ 151 #endif 152 int vl_index; /* ����ǥå��� */ 153 }; 154 155 #define vl_optbl o.uvl_optbl /* ���ڥ��ɥơ��֥� */ 156 #define vl_limit o.uvl_limit /* ������ +1 */ 157 #define vl_string v.uvl_string /* ʸ�����������ɥ쥹 */ 158 #define vl_int v.uvl_int /* ���������ɥ쥹 */ 159 160 extern int config(const char *config_filename, struct CONFIG_VARIABLE_TABLE *cnf_tbl, const char **readblock); 161 extern void config_oneline(const char *execname, struct CONFIG_VARIABLE_TABLE *cnf_tbl, char *varcmd); 162 163 164 /* 165 * date.c 166 */ 167 168 #ifndef INCLUDE_CALENDAR 169 enum { 170 DATE_YEAR_JC = 0, /* ����ɽ�� */ 171 DATE_YEAR_AD, /* ����ɽ�� */ 172 }; 173 174 enum { 175 DATE_TIMESYSTEM_12H = 0, /* 12������ */ 176 DATE_TIMESYSTEM_24H, /* 24������ */ 177 }; 178 179 extern int date_12_flag; /* ����ľ��ɽ������ */ 180 extern int date_28_flag; /* ��Ȭ�ɤ�ɽ������ */ 181 extern int date_eto_flag; /* ���٤�ɽ������ */ 182 extern int date_eto2_flag; /* ���٤�ɽ������(ǯ����) */ 183 extern int date_kyureki_flag; /* �����ɽ������ */ 184 extern int date_kyusei_flag; /* ������ɽ������ */ 185 extern int date_time_flag; /* �����ɽ������ */ 186 extern int date_time_inhibit; /* �����ɽ������ TRUE:ɽ�����ʤ� */ 187 extern int date_timesystem_type; /* �������μ��� 12H/24H */ 188 extern int date_yeartype; /* ǯɽ���μ��� ����/���� */ 189 190 extern void date(void); 191 #endif /* !INCLUDE_CALENDAR */ 192 193 194 /* 195 * edit.c 196 */ 197 198 #if defined(_T_WINDOWS) 199 #define MAX_KINDITEM 10 200 201 enum { 202 KIND_EVENT = 0, 203 KIND_BIRTHDAY, 204 KIND_HISTORY, 205 KIND_SCHEDULE, 206 KIND_WEEK, 207 KIND_FLOWER, 208 KIND_GENGO, 209 KIND_HOLIDAY, 210 KIND_SUFFIX, 211 KIND_TODAYCNF, 212 }; 213 214 struct KIND_FILETBL { 215 const char *name; 216 const char **filetbl; 217 const int maxfiles; 218 }; 219 220 extern const struct KIND_FILETBL kind_filetbl[MAX_KINDITEM]; 221 222 extern char *file_editor_cmd; 223 224 extern void commonHelpControl(const DWORD *HelpIdTbl, LPHELPINFO lpInfo); 225 extern char *getCommandName(const char *editor_cmd); 226 extern char **makeSearchPathTbl(const char *searchpath, char **pathtbl, int *pathtblcnt); 227 extern void freeSearchPathTbl(char **pathtbl, const int pathtblcnt); 228 extern BOOL externalFileEdit(HWND hWnd, HINSTANCE hInstance, struct DATE_T nowdate); 229 extern void externalFileEditCleanup(void); 230 #endif /* _T_WINDOWS */ 231 232 233 /* 234 * escctrl.c 235 */ 236 237 #ifndef INCLUDE_CALENDAR 238 #if defined(_T_WINDOWS) 239 #define MASK_COL_FG(x) ((x) & 0x0F) 240 #define MASK_COL_BG(x) (((x) & 0xF0) >> 4) 241 242 struct ESC_TOKEN_T { 243 int len; /* ʸ���� */ 244 int attr; /* ������ -1:̵���� */ 245 char *msg; /* ʸ����(malloc) */ 246 }; 247 248 extern struct ESC_TOKEN_T *separate_escstring(char *string); 249 extern int getlength_escstring(char *string); 250 extern char *gettext_escstring(const char *string); 251 #endif /* _T_WINDOWS */ 252 #endif /* !INCLUDE_CALENDAR */ 253 254 255 /* 256 * event.c 257 */ 258 259 #ifndef INCLUDE_CALENDAR 260 #define MAXEVENTFILE 16 /* ������Ͽ�ե������(���٥��) */ 261 #define MAXWEEKFILE 4 /* ������Ͽ�ե������(����) */ 262 #define MAXLVAR 26 /* ��٥��ѿ��� */ 263 264 extern char *event_filetbl[MAXEVENTFILE]; 265 extern char *week_filetbl[MAXWEEKFILE]; 266 extern char *event_sortorder; /* �����Ƚ�� */ 267 extern int event_notice_range; /* ���٥��ͽ�ϴ��� */ 268 extern int event_notice_flag; /* ���٥��ͽ������ */ 269 extern int event_range_flag; /* ���٥�ȴ���ɽ������ */ 270 extern char *event_level_str; /* ���٥�ȥ�å�������٥� */ 271 272 extern void event(void); 273 #endif /* !INCLUDE_CALENDAR */ 274 275 276 /* 277 * find.c 278 */ 279 280 #if defined(_T_WINDOWS) 281 extern char *find_editor_cmd; 282 283 extern BOOL findString(HWND hWnd, HINSTANCE hInstance); 284 #endif /* _T_WINDOWS */ 285 286 287 /* 288 * getfile.c 289 */ 290 291 #ifdef _T_SJIS 292 enum CODE_STAT { 293 CODE_ANK, /* ANK ʸ�� */ 294 CODE_KNJ1, /* ���������� 1�Х����� */ 295 CODE_KNJ2, /* ���������� 2�Х����� */ 296 }; 297 #endif /* _T_SJIS */ 298 299 extern char *search_path; /* �ե����븡������ѥ��ꥹ�� */ 300 extern char *search_cmdpath; /* �ե����븡������ǥ��쥯�ȥ�̾ */ 301 extern char *search_envname; /* �ե����븡������Ķ��ѿ�̾ */ 302 #if defined(_T_UNIX) 303 extern char *search_defpath; /* �ե����븡������ɸ��ѥ��ꥹ�� */ 304 #endif 305 extern int lines; /* getline ���ɤ߹�����ե�����ι��ֹ� */ 306 extern int search_hitphase; /* �ե������ȯ�������ե����� */ 307 extern int search_gophase; /* �ե����������ե����� */ 308 extern int search_errignore; /* �������顼̵��ե饰 */ 309 extern int replace_pathenv; /* �ѥ���δĶ��ѿ��֤��������� */ 310 311 extern const char *search_filepath(const char *filename); 312 extern char *make_accesspath(char *path); 313 extern char *replace_accesspath(char *path, int buflen); 314 extern int openfile(const char *filename); 315 extern void closefile(void); 316 extern char *getfile(void); 317 extern char *strip(char *elem); 318 extern char *xstrescape(char *str); 319 #ifdef _T_SJIS 320 extern int knjstat(const char *buf, const int n); 321 #endif 322 323 324 /* 325 * getopt.c 326 */ 327 328 #if !defined(_T_UNIX) 329 extern char *optarg; 330 extern int optind; 331 extern int opterr; 332 333 extern int getopt(int argc, char **argv, const char *optstring); 334 #endif 335 336 337 /* 338 * getsb.c 339 */ 340 341 extern int GetSB(int year, int *sb1, int *sb2); 342 343 344 /* 345 * history.c 346 */ 347 348 #ifndef INCLUDE_CALENDAR 349 #define MAXHISTORYFILE 16 /* ������Ͽ�ե������ */ 350 351 extern char *history_filetbl[MAXHISTORYFILE]; 352 extern int history_sort; /* ��ˤΥ�������ˡ */ 353 extern int history_foldtype; /* ��å������ޤ��֤��μ��� */ 354 extern int history_addinfo; /* ��ʪ����������̿�����ɲþ������� */ 355 extern int history_year_comment; /* ��ʪ����������̿����ǯ��ɽ������ */ 356 extern int history_both_date; /* ��ʪ��ξ�������ե����å����� */ 357 358 extern void history(void); 359 #endif /* !INCLUDE_CALENDAR */ 360 361 362 /* 363 * kansi.c 364 */ 365 366 #ifndef INCLUDE_CALENDAR 367 struct kansi_t { 368 int ye; /* ǯ�δ� */ 369 int yt; /* ǯ�λ� */ 370 int me; /* ��δ� */ 371 int mt; /* ��λ� */ 372 int de; /* ���δ� */ 373 int dt; /* ���λ� */ 374 int et; /* ���δ��� */ 375 }; 376 377 struct kansi_name_t { 378 const char *yy1; /* ǯ�δ��� */ 379 const char *yy2; /* ǯ�δ���(�ɤ�) */ 380 const char *mm1; /* ��δ��� */ 381 const char *mm2; /* ��δ���(�ɤ�) */ 382 const char *dd1; /* ���δ��� */ 383 const char *dd2; /* ���δ���(�ɤ�) */ 384 }; 385 386 extern const struct kansi_t *kansi(int year, int month, long julianday); 387 extern const struct kansi_name_t *kansi_name(const struct kansi_t *k); 388 #endif /* !INCLUDE_CALENDAR */ 389 390 391 /* 392 * kyureki.c 393 */ 394 395 struct LUNAR_CALENDAR { /* ���� (������) lunar calendar */ 396 int year; /* ǯ (1872-2100) year */ 397 int month; /* �� (1-12) month of year */ 398 int day; /* �� (1-30) day of month */ 399 int leap; /* ���� 0:no 1:yes leap month */ 400 int dayofweek; /* ϻ�� (0-5) rokuyou number */ 401 const char *rokuyou; /* ϻ��̾ rokuyou name */ 402 }; 403 404 struct LC_MONTHTBL { /* ���� ��ơ��֥� */ 405 int year; /* ǯ */ 406 int month; /* �� */ 407 int leap; /* ���� */ 408 int dayofmonth; /* ������� */ 409 int first_dayofweek; /* ������ϻ�� */ 410 int last_dayofweek; /* ������ϻ�� */ 411 int offset_day; /* ��ơ��֥�κǽ餫��������� */ 412 }; 413 414 extern const struct LUNAR_CALENDAR *GetLunarCalendar(int year, int month, int day); 415 416 #ifndef INCLUDE_CALENDAR 417 extern const struct DATE_T *LunarToNowCalendar(int year, int month, int day, int leap); 418 extern int make_lc_monthtbl(struct LC_MONTHTBL *montbl, int tblcnt, int tblcenter, int year, int month, int day); 419 #endif /* !INCLUDE_CALENDAR */ 420 421 422 /* 423 * kyusei.c 424 */ 425 426 #ifndef INCLUDE_CALENDAR 427 struct kyusei_t { 428 const char *kyusei; /* ���� */ 429 }; 430 431 extern const struct kyusei_t *kyusei(int year, long julianday); 432 #endif /* !INCLUDE_CALENDAR */ 433 434 435 /* 436 * list.c 437 */ 438 439 #ifndef INCLUDE_CALENDAR 440 extern void list_init(void); 441 extern void list_free(void); 442 extern void list_add(int no, int key1, int key2, int key3, const char *msg); 443 extern void list_insert(int no, int key1, int key2, int key3, const char *msg); 444 extern void list_output(int no, void (*outfunc)(const char *fmt, ...)); 445 #endif /* !INCLUDE_CALENDAR */ 446 447 448 /* 449 * machine.c 450 */ 451 452 #ifndef INCLUDE_CALENDAR 453 enum { 454 MACHINE_NONE = 0, /* ̤���� */ 455 MACHINE_IBM, /* IBM PC/AT �ȸߴ��� */ 456 MACHINE_PC98, /* NEC PC-9800 ����� */ 457 MACHINE_X680x0, /* X680x0 Human68k */ 458 MACHINE_UNIX, /* unix system */ 459 MACHINE_WIN32CONSOLE, /* Win32 Console */ 460 }; 461 462 #if defined(_T_MSDOS) 463 extern int machine_type; 464 #endif 465 466 #if !defined(_T_WINDOWS) 467 extern void machine_setup(void); 468 #endif 469 #endif /* !INCLUDE_CALENDAR */ 470 471 472 /* 473 * main.c 474 */ 475 476 enum { 477 LANG_J = 0, /* ���ܸ� */ 478 LANG_E, /* �Ѹ� */ 479 }; 480 481 #ifndef INCLUDE_CALENDAR 482 enum { 483 SORT_UP_ORDER = 0, /* ���� ascending order */ 484 SORT_DOWN_ORDER, /* �߽� descending order */ 485 SORT_NO_ORDER, /* �ʤ� non sort */ 486 }; 487 488 enum { 489 NOTICE_NO = 0, /* ͽ��ʤ� */ 490 NOTICE_ALL, /* ͽ�� */ 491 NOTICE_MARK_ONLY, /* �ޡ�����ʬ�Τ�ͽ�� */ 492 }; 493 494 #define NOTICE_DEFAULT_RANGE 7 /* ͽ����֤Υǥե���� */ 495 /* birthday, event */ 496 #define MSG_FOLDTYPE_BASE 0 /* history, schedule */ 497 #define MAX_DISPLAY_ORDER 5 498 499 #ifdef MSG_STYLE 500 #define MSG_PERIOD "��" 501 #else 502 #define MSG_PERIOD "." 503 #endif 504 #endif /* !INCLUDE_CALENDAR */ 505 506 enum { /* ���顼��٥� */ 507 ERR_INFO, /* ���̾��� */ 508 ERR_WARN, /* �ٹ���� */ 509 ERR_DEBUG, /* �ǥХå����� */ 510 ERR_ERROR, /* ���顼���� */ 511 ERR_PANIC, /* �������å����顼���� */ 512 }; 513 514 enum { 515 TERM_MEMERROR = 100, /* ���ꥨ�顼�ˤ�뽪λ */ 516 TERM_FILEERROR, /* �ե�������ϥ��顼�ˤ�뽪λ */ 517 }; 518 519 #ifndef INCLUDE_CALENDAR 520 struct NOWDATE { /* ������������ */ 521 int year; /* ǯ (1873-9999) year */ 522 int month; /* �� (1-12) month of year */ 523 int day; /* �� (1-31) day of month */ 524 int dayofweek; /* ���� (0-6) day of week */ 525 int hour; /* �� (0-23) hours */ 526 int minute; /* ʬ (0-59) minutes */ 527 int sec; /* �� (0-59) seconds */ 528 int leap; /* ��ǯ (0-1) leap year */ 529 long julian_day; /* ��ꥦ������ julian day */ 530 int eto; /* ���� (0-59) eto */ 531 int de; /* ���� (0-9) 10 kan */ 532 int dt; /* ����� (0-11) 12 shi */ 533 /* ���� (������) lunar calendar */ 534 int lc_valid; /* ͭ���ե饰 T/F lc vaild flag */ 535 int lc_tbl; /* ���� ��ơ��֥� 536 ͭ���ե饰 T/F tbl vaild flag */ 537 int lc_year; /* ǯ (1872-2100) year */ 538 int lc_month; /* �� (1-12) month of year */ 539 int lc_day; /* �� (1-30) day of month */ 540 int lc_leap; /* ���� (0-1) leap month */ 541 int lc_dayofweek; /* ϻ�� (0-5) rokuyou number */ 542 char lc_rokuyou[6]; /* ϻ��̾ rokuyou name */ 543 }; 544 545 struct MONTHTBL { /* ����� ���ߤη�������ޤ� */ 546 int year; /* ǯ */ 547 int month; /* �� */ 548 int leap; /* ��ǯ */ 549 int dayofmonth; /* ������� */ 550 int first_dayofweek; /* ���������� */ 551 int last_dayofweek; /* ���������� */ 552 int offset_day; /* ��ơ��֥�κǽ餫��������� */ 553 struct LC_MONTHTBL lc; /* ���� ����� */ 554 }; 555 556 #define MAX_MONTH_TBL 3 557 #define CENTER_MONTH (MAX_MONTH_TBL / 2) 558 559 #define MAXMSGBUF 1024 /* �Ƽ��å��������ϥХåե������� */ 560 561 #if defined(_T_WINDOWS) 562 #define MAX_COLORMAP 16 563 #define T_CALL_FIRST 0 564 #define T_CALL_DATENOW 1 565 #define T_CALL_DATECHANGE 2 566 #endif 567 #endif /* !INCLUDE_CALENDAR */ 568 569 extern const char *fmt_sep1, *fmt_sep2, *fmt_sep3, *fmt_sep4; 570 /* format separator */ 571 572 extern const char *todaycnf_file; 573 574 #ifndef INCLUDE_CALENDAR 575 extern char msgbuf[MAXMSGBUF]; /* �Ƽ��å��������ϥХåե� */ 576 /* birthday.c, date.c */ 577 /* event.c, history.c */ 578 extern int screen_max_columns; /* ���̤κ����� */ 579 extern int screen_max_rows; /* ���̤κ���Կ� */ 580 extern struct NOWDATE calendar; /* ������������ */ 581 extern struct MONTHTBL monthtbl[MAX_MONTH_TBL]; 582 /* ����3����ʬ ����� */ 583 #if defined(_T_WINDOWS) 584 extern int win_colormap[MAX_COLORMAP]; /* ���� RGB �� */ 585 extern int win_default_color; /* �ǥե���ȿ� */ 586 587 #define CHK_SYSFLAGS(flags) CHK_BITFLAGS(sysflags,flags) 588 #define CHG_SYSFLAGS(flags) CHG_BITFLAGS(sysflags,flags) 589 #define SET_SYSFLAGS(flags,state) SET_BITFLAGS(sysflags,flags,state) 590 591 #define SYSFLAGS_TOOLFLAT 0x00000001 /* Toolbar FLAT */ 592 #define SYSFLAGS_WHEELMOUSE 0x00000002 /* wheel mouse */ 593 extern int sysflags; 594 595 #define CHK_EXTFLAGS(flags) CHK_BITFLAGS(extflags,flags) 596 #define CHG_EXTFLAGS(flags) CHG_BITFLAGS(extflags,flags) 597 #define SET_EXTFLAGS(flags,state) SET_BITFLAGS(extflags,flags,state) 598 599 #define EXTFLAGS_FONTCHOOSE 0x00000001 /* screen font choose */ 600 extern int extflags; 601 602 extern char *disp_fontname; 603 extern int disp_fontsize; 604 #endif /* _T_WINDOWS */ 605 606 extern int birthday_flag; 607 extern int date_flag; 608 extern int event_flag; 609 extern int history_flag; 610 extern int schedule_flag; 611 extern int display_order[MAX_DISPLAY_ORDER]; 612 #endif /* !INCLUDE_CALENDAR */ 613 614 extern void memerr(const char *func); 615 extern void errprint(const char *func, int level, const char *fmt, ...); 616 #if defined(_T_HUMAN68K) || defined(_T_MSDOS) || defined(_T_UNIX) || defined(_T_WIN32CONSOLE) 617 extern void terminate_program(int sig); 618 #endif 619 620 #ifndef INCLUDE_CALENDAR 621 #if defined(_T_WINDOWS) 622 extern int isDate(int year, int month, int day); 623 extern int configuration_today(int argc, char **argv); 624 extern int execute_today(HWND hWnd, int mode); 625 extern void terminate_today(HWND hWnd); 626 extern void preserveConfig(HWND hWnd); 627 #endif /* _T_WINDOWS */ 628 #endif /* !INCLUDE_CALENDAR */ 629 630 631 /* 632 * misc.c 633 */ 634 635 #ifndef INCLUDE_CALENDAR 636 #define NOTICE_MONTH(x) ((x) + 511) 637 #define MAXSORTITEM 3 /* �����ȹ��ܤο� */ 638 #define UNUSE -1 /* ������ɽ�� */ 639 #define SET_SUNID 0x8000 /* ������ */ 640 #define SET_SATID 0x4000 /* ������ */ 641 #define SET_HOLID 0x2000 /* ���� & ���� */ 642 #define SET_OVRID 0x1000 /* ���ص��� */ 643 #define MASK_HOLNAMEI 0x03FF 644 #define SET_HOLNAMEI(x) ((x) & MASK_HOLNAMEI) 645 #define GET_HOLNAMEI(x) ((x) & MASK_HOLNAMEI) 646 #endif /* !INCLUDE_CALENDAR */ 647 648 #define SET_MKF_CC 0x01 /* %c �������� */ 649 #define SET_MKF_YY 0x02 /* %y �������� */ 650 #define SET_MKF_MM 0x04 /* %m �������� */ 651 #define SET_MKF_DD 0x08 /* %d �������� */ 652 #define SET_MKF_PID 0x10 /* %p �������� */ 653 654 enum { 655 DATE_OK = 0, /* �����ɤ������ */ 656 DATE_NG, /* �ե����ޥåȰ۾� */ 657 }; 658 659 enum { 660 YEAR_OK = 0, /* ǯ�Ѵ����� */ 661 YEAR_NG, /* �ե����ޥåȰ۾� */ 662 }; 663 664 enum { 665 LOAD_NG = -1, /* �ɤ߹��߰۾� */ 666 LOAD_OK, /* gengo.tbl, suffix.tbl, holiday.tbl �ɤ߹������� */ 667 }; 668 669 extern const char *gengo_file; 670 extern const char *holiday_file; 671 672 #ifndef INCLUDE_CALENDAR 673 extern const char *flower_file; 674 675 struct FLOWER_T { 676 const char *name; /* �֤�̾�� flower name */ 677 const char *language; /* �ָ��� flower language */ 678 }; 679 680 extern unsigned int holiday_tbl[MAX_DAYOFMONTH * MAX_MONTH_TBL]; 681 682 extern char *suffix_file; 683 #endif /* !INCLUDE_CALENDAR */ 684 685 extern int mkfile_status; 686 687 extern int isleap(int year); 688 extern int GetDayofWeek(int year, int month, int day); 689 extern int GetDayofMonth(int year, int month); 690 extern long Julian(int year, int month, int day); 691 692 #ifndef INCLUDE_CALENDAR 693 extern int GetDayofYear(int year, int month, int day); 694 extern int GetDiffLCDate(int year2, int month2, int day2, int leap2, int year1, int month1, int day1, int leap1); 695 extern void date_inc(struct DATE_T *date, int offset); 696 #endif /* !INCLUDE_CALENDAR */ 697 698 extern int read_date(int fmt, char *bp, struct DATE_T *date, int *wflag); 699 extern int analysis_year(const char *p, int *year, int *wflag); 700 701 #ifndef INCLUDE_CALENDAR 702 extern int analysis_sortorder(const char *type, const char *string, int *sortorder_tbl, int org_sortflag); 703 #endif /* !INCLUDE_CALENDAR */ 704 705 #if !defined(INCLUDE_CALENDAR) || (defined(INCLUDE_CALENDAR) && defined(_T_WINDOWS)) 706 extern char *undertospace(char *chrptr); 707 #endif /* !INCLUDE_CALENAR || (INCLUDE_CALENDAR && _T_WINDOWS) */ 708 extern char *strlastp(char *p); 709 extern int Loading_GengoTbl(void); 710 711 #ifndef INCLUDE_CALENDAR 712 extern const char *GetNameofWhatday(int languagetype, int dayofweek); 713 extern const char *GetNameofEra(int languagetype, int year, int month, int day, int *wareki); 714 #endif /* !INCLUDE_CALENDAR */ 715 716 extern const char *GetNameofMonth(int languagetype, int month); 717 718 #ifndef INCLUDE_CALENDAR 719 extern const char *GetNameofBirthstone(int month); 720 extern const char *GetNameofBirthflowers(int month); 721 extern const char *GetNameofConstellation(int month, int day); 722 extern const struct FLOWER_T *GetLanguageofFlower(int month, int day); 723 extern const char *GetTimemessage(int hour); 724 extern int Loading_SuffixTbl(void); 725 extern const char *GetDefaultSuffix(int type); 726 extern const char *Notice_Message(char *msg, int diffday, char **end_msg); 727 extern const char *make_filename(const char *basename); 728 #endif /* !INCLUDE_CALENDAR */ 729 730 extern const char *make_filename2(const char *basename, int year, int month, int day); 731 732 #ifndef INCLUDE_CALENDAR 733 extern unsigned int getcharcode(const unsigned char *ptr, int *byte, int *width); 734 extern unsigned char *putcharcode(unsigned char *ptr, unsigned int code, int byte); 735 #ifdef _T_EUC 736 extern unsigned char *jstrchr(const unsigned char *string, int code); 737 #endif 738 #endif /* !INCLUDE_CALENDAR */ 739 740 extern void *xmalloc(size_t size); 741 extern char *xstrdup(const char *str); 742 743 #if defined(_T_MSDOS) 744 extern void FAR *far_xmalloc(size_t size); 745 extern char FAR *far_xstrdup(const char FAR *str); 746 #endif /* _T_MSDOS */ 747 748 extern int checkTransferHolidayJD(long jd); 749 extern int checkNationalHolidayJD(long jd); 750 751 #define checkTransferHoliday(yy,mm,dd) checkTransferHolidayJD(Julian(yy,mm,dd)) 752 #define checkNationalHoliday(yy,mm,dd) checkNationalHolidayJD(Julian(yy,mm,dd)) 753 754 extern int Loading_HolidayTbl(void); 755 extern int *GetHolidayTbl(int year, int month); 756 757 #ifndef INCLUDE_CALENDAR 758 extern void makeHolidayTbl(void); 759 #endif /* !INCLUDE_CALENDAR */ 760 #if !defined(INCLUDE_CALENDAR) || (defined(_T_WINDOWS) && defined(INCLUDE_CALENDAR)) 761 extern char *GetHolidayName(int holiday_index); 762 #endif /* !INCLUDE_CALENDAR || (_T_WINDOWS && INCLUDE_CALENDAR) */ 763 764 #ifndef _T_HAVE_STRTOK_R 765 extern char *strtok_r(char *s, const char *sep, char **lasts); 766 #endif /* !_T_HAVE_STRTOK_R */ 767 768 769 /* 770 * pager.c 771 */ 772 773 #ifndef INCLUDE_CALENDAR 774 extern char *pager_cmd; /* �����ڡ����㡼�Υ��ޥ��̾ */ 775 extern char *pager_outputfile; /* ���ϥե�����̾ */ 776 extern char *pager_filelog_path; /* ���ϥե�������¸��ѥ�̾ */ 777 extern int pager_action; /* �ڡ�����ư������ */ 778 extern int pager_filekeep; /* ���ϥե�������¸���� */ 779 extern int pager_pause; /* ��¢�ڡ����㡼���������� */ 780 extern int pager_lastpause; /* ��¢�ڡ����㡼��λ��������� */ 781 782 #if defined(_T_WINDOWS) 783 extern char **textBuf; 784 extern int textLines; 785 #endif 786 787 #if defined(_T_WINDOWS) 788 extern void pager_text_free(void); 789 #endif 790 extern void pager_init(void); 791 extern void pager_term(void); 792 extern void pager_clean(int delete_flag); 793 extern void pager_output(const char *msg, ...); 794 extern void pager_output_skip(void); 795 extern void message_fold(const unsigned char *msg, int width, int start1, int start2); 796 #endif /* !INCLUDE_CALENDAR */ 797 798 799 /* 800 * propshet.c 801 */ 802 803 #ifndef INCLUDE_CALENDAR 804 #if defined(_T_WINDOWS) 805 extern BOOL setupPropertyProc(HWND hWnd, HINSTANCE hInstance, BOOL *bChangeDisplay); 806 #endif 807 #endif /* !INCLUDE_CALENDAR */ 808 809 810 /* 811 * rdcalend.c 812 */ 813 814 struct CALENDAR { 815 int year; /* ǯ (1873-9999) year */ 816 int month; /* �� (1-12) month of year */ 817 int day; /* �� (1-31) day of month */ 818 int dayofweek; /* ���� (0-6) day of week */ 819 int hour; /* �� (0-23) hours */ 820 int minute; /* ʬ (0-59) minutes */ 821 int sec; /* �� (0-59) seconds */ 822 }; 823 824 extern void rdcalendar(struct CALENDAR * const calendar); 825 826 827 /* 828 * rekichu.c 829 */ 830 831 #ifndef INCLUDE_CALENDAR 832 #define SETBIT(b,f) (f)[(b) >> 3] |= (unsigned char)(1 << ((b) & 0x07)) 833 #define CLRBIT(b,f) (f)[(b) >> 3] &= (unsigned char)~(1 << ((b) & 0x07)) 834 #define CHKBIT(b,f) ((f)[(b) >> 3] & (1 << ((b) & 0x07))) 835 836 #define MAX_REKICHU 20 837 #define MAX_REKICHU_KADAN 22 838 839 extern char *rekichu_f_string; 840 extern char *rekichu_kadan_f_string; 841 842 extern const char *calc_12choku(int year, int month, int day, long jdn); 843 extern const char *calc_28syuku(long julianday); 844 extern void rekichu(unsigned char *evflag, void (*outfunc)(const char *msg, ...)); 845 #endif /* !INCLUDE_CALENDAR */ 846 847 848 /* 849 * schedule.c 850 */ 851 852 #define MAXSCHEDULEFILE 16 /* ������Ͽ�ե������(�������塼��) */ 853 854 extern char *schedule_filetbl[MAXSCHEDULEFILE]; 855 856 #ifndef INCLUDE_CALENDAR 857 extern int schedule_sort; /* �������塼��Υ�������ˡ */ 858 extern int schedule_foldtype; /* ��å������ޤ��֤��μ��� */ 859 extern int schedule_limit; /* �������塼��κ���ɽ������ */ 860 #else /* INCLUDE_CALENDAR */ 861 #define MAXMONTH_SCHEDULE CAL_MAXMONTH 862 #define MAXDAY_SCHEDULE MAX_DAYOFMONTH 863 864 enum { 865 SCHEDULE_NONE = 0, 866 SCHEDULE_EXIST, 867 }; 868 869 extern char schedule_daytbl[MAXMONTH_SCHEDULE][MAXDAY_SCHEDULE]; 870 #endif /* INCLUDE_CALENDAR */ 871 872 #ifndef INCLUDE_CALENDAR 873 extern void schedule(void); 874 #else /* INCLUDE_CALENDAR */ 875 extern void schedule_find(void); 876 #if defined(_T_WINDOWS) 877 extern char **schedule_loadmsg(int year, int month, int day, int *count); 878 #endif 879 #endif /* INCLUDE_CALENDAR */ 880 881 882 /* 883 * sekki.c 884 */ 885 886 #if !defined(INCLUDE_CALENDAR) || (defined(INCLUDE_CALENDAR) && defined(_T_WINDOWS)) 887 extern const char *GetSekkiName(int year, int month, int day, int *sekki_no); 888 #endif /* !INCLUDE_CALENDAR || (INCLUDE_CALENDAR && _T_WINDOWS) */ 889 #ifndef INCLUDE_CALENDAR 890 extern long GetSekkiJulianDay(int year, int sekki_no); 891 #endif /* !INCLUDE_CALENDAR */ 892 893 894 /* 895 * sepparam.c 896 */ 897 898 #ifndef INCLUDE_CALENDAR 899 struct SRANGE_T { 900 int bmonth; /* ���Ϸ� */ 901 int emonth; /* ��λ�� */ 902 int start; /* ������ */ 903 int end; /* ��λ�� */ 904 }; 905 906 extern int separate_param(char *str, char *buf, char **ptr, int maxptr, struct SRANGE_T *rtbl); 907 extern int separate_param2(char *str, char **ptr, int maxptr); 908 #endif /* !INCLUDE_CALENDAR */ 909 910 911 /* 912 * todayfw.c 913 */ 914 915 #ifndef INCLUDE_CALENDAR 916 #if defined(_T_WINDOWS) 917 extern char *szAppName; 918 extern char *szHelpFile; 919 extern char *szCalClass; 920 extern int splash_timeout; 921 922 extern HFONT createDisplayFontObject(HWND hwnd, const char *fontname, int *fontsize); 923 extern int getDisplayTextWidth(const char *string); 924 #endif 925 #endif /* !INCLUDE_CALENDAR */ 926 927 928 /* 929 * version.c 930 */ 931 932 #ifndef INCLUDE_CALENDAR 933 #if !defined(_T_WINDOWS) 934 extern const char Copyright[]; 935 extern const char Version[]; 936 extern const char UseLanguage[]; 937 938 #ifdef TRANS 939 extern const char Modify[]; 940 #endif 941 #endif /* !_T_WINDOWS */ 942 #endif /* !INCLUDE_CALENDAR */ 943 944 945 /* 946 * wconfig.c 947 */ 948 949 #if defined(_T_WINDOWS) 950 extern int writeConfig(const char *config_filename, struct CONFIG_VARIABLE_TABLE *cnf_tbl, const char **readblock); 951 #endif 952