1 #ifndef __RC_DEFS_H 2 # define __RC_DEFS_H 3 /*! 4 * \file rc-defs.h 5 * \brief Fixed dates/resource file specific statements, macros, 6 * typedefs, global variable declarations... 7 */ 8 /* 9 * Copyright (c) 1994, 95, 96, 1997, 2000, 2011 Thomas Esken 10 * Copyright (c) 2010, 2011, 2013 Free Software Foundation, Inc. 11 * 12 * This software doesn't claim completeness, correctness or usability. 13 * On principle I will not be liable for ANY damages or losses (implicit 14 * or explicit), which result from using or handling my software. 15 * If you use this software, you agree without any exception to this 16 * agreement, which binds you LEGALLY !! 17 * 18 * This program is free software; you can redistribute it and/or modify 19 * it under the terms of the `GNU General Public License' as published by 20 * the `Free Software Foundation'; either version 3, or (at your option) 21 * any later version. 22 * 23 * You should have received a copy of the `GNU General Public License' 24 * along with this program; if not, write to the: 25 * 26 */ 27 28 29 30 /* 31 * $Id: rc-defs.h 3.01 2000/06/20 03:00:01 tom Exp $ 32 */ 33 34 35 36 /* 37 * Preprocessor statements for the exit codes. 38 */ 39 /* 40 * Configuration dependent values. 41 */ 42 # define ERR_NO_FIXED_DATES_LISTED 1 43 # define ERR_EXTERNAL_CMD_FAILURE 2 44 # define ERR_MAINTAINER_FAILURE 50 45 # define ERR_INVALID_REGEX_PATTERN 104 46 # define ERR_ILLEGAL_VAR_DEFINITION 105 47 # define ERR_INVALID_VAR_ASSIGNMENT 112 48 # define ERR_INVALID_VAR_REFERENCE 113 49 # define ERR_ILLEGAL_VAR_OPERATION 114 50 # define ERR_NO_SEPARATOR_CHAR 116 51 # define ERR_INVALID_NWD_FIELD 117 52 # define ERR_FILE_NOT_FOUND 118 53 # define ERR_CYCLIC_INCLUDE 119 54 # define ERR_MALFORMED_INCLUDE 120 55 # define ERR_INVALID_DAY_FIELD 121 56 # define ERR_INVALID_MONTH_FIELD 122 57 # define ERR_INVALID_DATE_FIELD 123 58 59 60 61 /* 62 * Preprocessor statements for long options `Lopt_struct' field `symbolic_name'. 63 */ 64 /* Configuration dependent values. */ 65 # define SYM_ADJUST_VALUE 200 66 # define SYM_ALTERNATIVE_FORMAT 201 67 # define SYM_ATMOSPHERE 202 68 # define SYM_BIORHYTHM_AXIS_LEN 203 69 # define SYM_CYCLE_END 204 70 # define SYM_CYCLE_STEP 205 71 # define SYM_DATE_VARIABLE 206 72 # define SYM_DESC_FIXED_DATES_LIST 207 73 # define SYM_END_OF_MONTH 208 74 # define SYM_END_OF_WEEK 209 75 # define SYM_END_OF_YEAR 210 76 # define SYM_EXCLUDE_RC_TITLE 211 77 # define SYM_EXECUTE_COMMAND 212 78 # define SYM_extern_static_DVARS 213 79 # define SYM_extern_static_TVARS 214 80 # define SYM_FILTER_DAY 215 81 # define SYM_FILTER_PERIOD 216 82 # define SYM_FILTER_TEXT 217 83 # define SYM_FIXED_DATES 218 84 # define SYM_FIXED_DATES_LIST 219 85 # define SYM_GROUPING_TEXT 220 86 # define SYM_HEADING_TEXT 221 87 # define SYM_HERE_FILE 222 88 # define SYM_IGNORE_CASE 223 89 # define SYM_INCLUDE_CONS_NUMBER 224 90 # define SYM_INCLUDE_FILENAME 225 91 # define SYM_INCLUDE_HOLIDAY 226 92 # define SYM_INCLUDE_TODAY 227 93 # define SYM_INCLUDE_WEEK_NUMBER 228 94 # define SYM_LEAP_DAY 229 95 # define SYM_LIMIT 230 96 # define SYM_LIST_MODE 231 97 # define SYM_MONTH 232 98 # define SYM_MOONIMAGE_LINES 233 99 # define SYM_OMIT_DATE_PART 234 100 # define SYM_PERIOD 235 101 # define SYM_PRECISE 236 102 # define SYM_RESOURCE_FILE 237 103 # define SYM_REVERT_MATCH 238 104 # define SYM_START_OF_MONTH 239 105 # define SYM_START_OF_WEEK 240 106 # define SYM_START_OF_YEAR 241 107 # define SYM_SUPPRESS_DATE_PART 242 108 # define SYM_SUPPRESS_FDLIST_SEP 243 109 # define SYM_SUPPRESS_TEXT_PART 244 110 # define SYM_TEXT_VARIABLE 245 111 # define SYM_TODAY 246 112 # define SYM_TOMORROW 247 113 # define SYM_WEEK 248 114 # define SYM_YEAR 249 115 # define SYM_ZERO_DATES 250 116 117 118 119 /* 120 * Further preprocessor symbols. 121 */ 122 /*! Number of default 2-month mode rows both dates. */ 123 # define A2_OUT_ROWS 1 124 125 /*! Number of default 2-month mode columns both dates. */ 126 # define A2_OUT_COLS 2 127 128 /*! Number of default 2-month mode rows both dates. */ 129 # define B2_OUT_ROWS 2 130 131 /*! Number of default 2-month mode columns both dates. */ 132 # define B2_OUT_COLS 1 133 134 /* 135 * Additional usage texts. 136 */ 137 # define USAGE_RC1 "CDFIP" 138 # define USAGE_RC2 "cf" 139 # define USAGE_RC3 "r" 140 # define USAGE_RC4 "v" 141 142 143 144 /* 145 * Now define the user and system data directories of Gcal's resource files. 146 * Please note: If your compiler does not support the ANSI-C string 147 * concatenation feature like `"foo""bar" => "foobar"' 148 * you have to provide your Makefile with the appropriate 149 * texts referenced by GCAL_USR_DATADIR and GCAL_SYS_DATADIR 150 * to avoid compilation errors. 151 */ 152 /*! Access file relative to $HOME directory. */ 153 # ifndef GCAL_USR_DATADIR 154 # define GCAL_USR_DATADIR "share"DIR_SEP""PACKAGE_NAME 155 # endif 156 157 /*! Access file absolute to root directory. */ 158 # ifndef GCAL_SYS_DATADIR 159 # define GCAL_SYS_DATADIR DIR_SEP"usr"DIR_SEP"local"DIR_SEP"share"DIR_SEP""PACKAGE_NAME 160 # endif 161 162 163 164 /* 165 * Specific preprocessor statements for fixed dates/resource files. 166 */ 167 /*! Default number of `rc_elems_table[]' entries. */ 168 # ifndef RC_ELEMS_MAX 169 # define RC_ELEMS_MAX 1024 170 # endif 171 172 /*! Default number of `rc_files_table[]' entries. */ 173 # ifndef RC_FILES_MAX 174 # define RC_FILES_MAX 8 175 # endif 176 177 /*! Maximum number of date variables. */ 178 # define RC_DVAR_MAX 26 179 180 /*! Maximum number of text variables. */ 181 # define RC_TVAR_MAX RC_DVAR_MAX 182 183 /*! Separator of a list of days (WWW,WWW... or NWWW,NWWW... or WWWN,WWWN...). */ 184 # define RC_DLIST_CHAR ',' 185 186 /*! Separator of a range of days (WWW#WWW or NWWW#NWWW or WWWN#WWWN). */ 187 # define RC_DRANGE_CHAR '#' 188 189 /*! Separator of a "repeat for N days since..." coding (e.g.: YYYYMMDD:10). */ 190 # define RC_REPEAT_CHAR ':' 191 192 /*! Separator of a "appears each N'th day since..." coding (e.g.: YYYYMMDD:10.3). */ 193 # define RC_APPEARS_CHAR '.' 194 195 /*! Leading char of a modified actual date %DATE. */ 196 # define RC_ADATE_CHAR '%' 197 198 /*! RC-file holiday/date-variable prefix in date part. */ 199 # define RC_HDY_CHAR '@' 200 201 /*! RC-file N'th weekday prefix in date part. */ 202 # define RC_NWD_CHAR '*' 203 204 /*! Inserts a real newline '\n' character if found and breaks to colomn 1. */ 205 # define RC_NL_CHAR '~' 206 207 /*! Inserts a real newline '\n' character if found. */ 208 # define RC_NL2_CHAR '^' 209 210 /*! Leading char of a @easter date part. */ 211 # define RC_EASTER_CHAR 'e' 212 213 /*! Leading char of a @today date part. */ 214 # define RC_TODAY_CHAR 't' 215 216 /*! Modifier for selecting the 12-hrs format in %[gm]time* or %sun* or %moon* special texts. */ 217 # define RC_12_HOURS_FORMAT_CHAR '*' 218 219 /*! Assignment operator of a date/text variable (DVAR=MMDD, $TVAR=TEXT). */ 220 # define RC_VAR_ASSIGN "=" 221 222 /*! Interpreted command assignment of a text variable ($TVAR?COMMAND). */ 223 # define RC_TVAR_ICMD_ASSIGN "?" 224 225 /*! Uninterpreted command assignment of a text variable ($TVAR:COMMAND). */ 226 # define RC_TVAR_UCMD_ASSIGN ":" 227 228 /*! Add operator of a date/text variable ([D|$T]VAR++ | [D|$T]VAR+=N ...). */ 229 # define RC_VAR_ADD "+" 230 231 /*! Subtract operator of a date variable ([D|$T]VAR-- | [D|$T]VAR-=N ...). */ 232 # define RC_VAR_SUB "-" 233 234 /*! RC-file text variable prefix. */ 235 # define RC_TVAR_CHAR '$' 236 237 /*! Default grouping text of fixed date list option `-cg<TEXT>'. */ 238 # define RC_GROUP_SEP "" 239 240 /*! Name of RC-file include statement (upper-case). */ 241 # define RC_INCL_STMENT "#include" 242 243 /*! User include file name starts with. */ 244 # define RC_INCL_USR_ID "\"" 245 246 /*! User include file name ends with. */ 247 # define RC_INCL_USR_OD RC_INCL_USR_ID 248 249 /*! System include file name start with. */ 250 # define RC_INCL_SYS_ID "<" 251 252 /*! System include file name ends with. */ 253 # define RC_INCL_SYS_OD ">" 254 255 /*! Environment variable name for user datadir. */ 256 # define ENV_VAR_USR_DATADIR "GCAL_USR_DATADIR" 257 258 /*! Environment variable name for system datadir. */ 259 # define ENV_VAR_SYS_DATADIR "GCAL_SYS_DATADIR" 260 261 /*! Name part of default resource file. */ 262 # define RC_SUFFIX "rc" 263 264 /*! Text displayed if an invalid parameter is given to %[gm]time* or %distance or %sun* or %moon*. */ 265 # define RC_INVALID_PARAM_TEXT "??" 266 267 /*! Text displayed if an invalid value is computed in %[gm]time* or %distance or %sun* or %moon*. */ 268 # define RC_INVALID_VALUE_TEXT "**" 269 270 /*! Text displayed if there is no rise/set/transit time because the astronomical 271 object is always above the requested horizon in %sun* or %moon*. */ 272 # define RC_A_ABOVE_VALUE_TEXT "++" 273 274 /*! Text displayed if there is no rise/set/transit time because the astronomical 275 object is always below the requested horizon in %sun* or %moon*. */ 276 # define RC_A_BELOW_VALUE_TEXT "--" 277 278 /*! Separator used between two coordinates in %distance. */ 279 # define RC_COORDINATE_SEP "/" 280 281 /*! Modifier for selecting the statute miles format in %distance special texts. */ 282 # define RC_SMILES_FORMAT_CHAR RC_12_HOURS_FORMAT_CHAR 283 284 /*! Output redirection symbol. */ 285 # ifndef REDIRECT_OUT 286 # define REDIRECT_OUT ">" 287 # endif 288 289 /*! Pipelining symbol. */ 290 # ifndef PIPELINE 291 # define PIPELINE "|" 292 # endif 293 294 /*! Name of default Txt2gcal program if $TXT2GCALPROG is not set. */ 295 # ifndef TXT2GCAL_PRGR 296 # define TXT2GCAL_PRGR "txt2gcal" 297 # endif 298 299 /*! Name of environment variable for accessing the Txt2gcal program. */ 300 # ifndef ENV_VAR_TXT2GCALPROG 301 # define ENV_VAR_TXT2GCALPROG "TXT2GCALPROG" 302 # endif 303 304 305 306 /*! 307 * Kilometers to statute miles. 308 */ 309 # define KM2SM(x) ((x) * 0.621371192237) 310 /*! 311 * Astronomical units to kilometers. 312 */ 313 # define AU2KM(x) ((x) * ASTRONOMICAL_UNIT) 314 /*! 315 * Earth-equator radii to kilometers. 316 */ 317 # define ER2KM(x) ((x) * EQUATOR_EARTH_RADIUS * 0.001) 318 319 320 321 /* 322 * The suffixes used by the Moon phase special texts. 323 */ 324 # define MOON_MIN "!" 325 # define MOON_MAX "@" 326 # define MOON_WANES "-" 327 # define MOON_WAXES "+" 328 329 /* 330 * The minimum, maximum and default number of lines of the Moon phase text graphics image. 331 */ 332 # define MOONIMAGE_MIN 6 333 # define MOONIMAGE_MAX 30 334 # define MOONIMAGE_DEF 12 335 336 /* 337 * The widgets of the Moon phase text graphics image. 338 */ 339 # define MOONIMAGE_BRIGHT MOON_MAX 340 # define MOONIMAGE_LEDGE "(" 341 # define MOONIMAGE_REDGE ")" 342 343 344 345 /* 346 * Some constant values necessary for using the %distance* 347 * or %sun* and %moon* special texts. 348 */ 349 # define COOR_LON_DEG_MAX ((int)DEGS_PER_12_HOURS) 350 # define COOR_LON_MIN_MAX MINS_PER_HOUR 351 # define COOR_LON_SEC_MAX SECS_PER_MIN 352 # define COOR_LAT_DEG_MAX ((int)DEGS_PER_06_HOURS) 353 # define COOR_LAT_MIN_MAX MINS_PER_HOUR 354 # define COOR_LAT_SEC_MAX SECS_PER_MIN 355 356 357 358 /* 359 * The astronomical objects. 360 */ 361 # define AOBJ_NONE SPECIAL_VALUE 362 # define AOBJ_SUN 0 363 # define AOBJ_MOON 1 364 365 366 367 /*! 368 * The codes that define the output and error format types used for 369 * formatting the data of the %sun*, %moon* and %distance special texts. 370 */ 371 # define FMT_NIL SYM_NIL 372 /*! Number with[out] fraction. */ 373 # define FMT_NNN 1 374 /*! Number with fraction. */ 375 # define FMT_NND 2 376 /*! Number with sign and fraction. */ 377 # define FMT_NSD 3 378 /*! Hour and minute [and second+fraction]. */ 379 # define FMT_HHH 4 380 /*! Value in hours and minutes [and seconds+fraction]. */ 381 # define FMT_TTT 5 382 /*! Value in hours and minutes [and seconds+fraction] with sign. */ 383 # define FMT_TTS 6 384 /*! Value in hours and minutes with sign. */ 385 # define FMT_TXS 7 386 /*! Degree and minute [and second+fraction]. */ 387 # define FMT_DDD 8 388 /* Degree and minute [and second+fraction] with sign. */ 389 # define FMT_DDS 9 390 # define ERR_NIL FMT_NIL 391 # define ERR_NNN 1 392 # define ERR_HHH 2 393 # define ERR_TTT 3 394 # define ERR_DDD 4 395 396 397 398 /* 399 * The suffixes used by the biorhythm special texts. 400 */ 401 # define BIO_WANES MOON_WANES 402 # define BIO_WAXES MOON_WAXES 403 # define BIO_STABLE MOON_MAX 404 # define BIO_CRITICAL MOON_MIN 405 # define BIO_OVERLAPS BIO_STABLE 406 407 /* 408 * The minimum, maximum and default single length of the biorhythm text graphics bar. 409 */ 410 /*! Minimum value that is divided by 2 without a remainder. */ 411 # define BIO_AXIS_MIN 1 412 413 /*! Maximum value that is divided by 2 without a remainder. */ 414 # define BIO_AXIS_MAX 100 415 416 /*! Default value that divides BIO_AXIS_MAX without a remainder. */ 417 # define BIO_AXIS_DEF 20 418 419 /* 420 * Some scaling symbols/macros needed for creating the biorhythm text graphics bar. 421 */ 422 # define BIO_AXIS_EXTRA 2 423 # define BIO_AXIS_SCALE(x) (100/(x)) 424 # define BIO_AXIS_ZERO(x) (BIO_AXIS_EXTRA+(x)) 425 # define BIO_AXIS_TOTAL(x) (((x)*2)+(BIO_AXIS_EXTRA*2)+2) 426 427 428 429 /*! Default timestep value in minutes used within a cycle. */ 430 # define DEFAULT_CYCLE_STEP 1 431 432 433 434 /*! 435 * Prefix character of a "special text" given in a line of a Gcal resource file. 436 */ 437 # define RC_SPECIAL_TEXT_CHAR DFORMAT_CHAR 438 439 /* 440 * %?[TEXT_TILL_EOL] --- Runs commands. 441 */ 442 /*! %shell escape special text. */ 443 # define RC_SHELL_ESC_CHAR '!' 444 445 /* 446 * %?TEXT --- Inserts contents of environment variable. 447 */ 448 /*! %shell environment variable special text. */ 449 # define RC_ENV_VAR_CHAR '-' 450 451 /* 452 * %? --- Excludes special dates. 453 */ 454 /*! Exclude if date is in eternal holiday list (legal days only). */ 455 # define RC_EX_LHDY_CHAR 'V' 456 457 /*! Exclude if date is not in eternal holiday list (legal days only). */ 458 # define RC_EX_NLHDY_CHAR 'v' 459 460 /*! Exclude if date is in eternal holiday list (all days). */ 461 # define RC_EX_AHDY_CHAR 'X' 462 463 /*! Exclude if date is not in eternal holiday list (all days). */ 464 # define RC_EX_NAHDY_CHAR 'x' 465 466 /*! Exclude if date is a Monday. */ 467 # define RC_EX_MON_CHAR 'A' 468 469 /*! Exclude if date is no Monday. */ 470 # define RC_EX_NMON_CHAR 'a' 471 472 /*! Exclude if date is a Tuesday. */ 473 # define RC_EX_TUE_CHAR 'C' 474 475 /*! Exclude if date is no Tuesday. */ 476 # define RC_EX_NTUE_CHAR 'c' 477 478 /*! Exclude if date is a Wednesday. */ 479 # define RC_EX_WED_CHAR 'F' 480 481 /*! Exclude if date is no Wednesday. */ 482 # define RC_EX_NWED_CHAR 'f' 483 484 /*! Exclude if date is a Thursday. */ 485 # define RC_EX_THU_CHAR 'G' 486 487 /*! Exclude if date is no Thursday. */ 488 # define RC_EX_NTHU_CHAR 'g' 489 490 /*! Exclude if date is a Friday. */ 491 # define RC_EX_FRI_CHAR 'H' 492 493 /*! Exclude if date is no Friday. */ 494 # define RC_EX_NFRI_CHAR 'h' 495 496 /*! Exclude if date is a Saturday. */ 497 # define RC_EX_SAT_CHAR 'L' 498 499 /*! Exclude if date is no Saturday. */ 500 # define RC_EX_NSAT_CHAR 'l' 501 502 /*! Exclude if date is a Sunday. */ 503 # define RC_EX_SUN_CHAR 'P' 504 505 /*! Exclude if date is no Sunday. */ 506 # define RC_EX_NSUN_CHAR 'p' 507 508 /*! Exclude if date is a Monday...Thursday. */ 509 # define RC_EX_MON_2_THU_CHAR 'Q' 510 511 /*! Exclude if date is no Monday...Thursday. */ 512 # define RC_EX_NMON_2_THU_CHAR 'q' 513 514 /*! Exclude if date is a Monday...Friday. */ 515 # define RC_EX_MON_2_FRI_CHAR 'R' 516 517 /*! Exclude if date is no Monday...Friday. */ 518 # define RC_EX_NMON_2_FRI_CHAR 'r' 519 520 /* 521 * %?[STARTING_DATE][#[ENDING_DATE]] --- Excludes special dates. 522 */ 523 /*! %inclusive date special text. */ 524 # define RC_IDATE_CHAR 'i' 525 526 /*! %exclusive date special text. */ 527 # define RC_EDATE_CHAR 'e' 528 529 /* 530 * %?[DATE] --- Creates special texts. 531 */ 532 /*! %weekday name special text. */ 533 # define RC_WDNAME_CHAR WDNAME_CHAR 534 535 /*! %weekday number (Mon=1...Sun=7) special text. */ 536 # define RC_WDNR_M1_2_S7_CHAR 'W' 537 538 /*! %weekday number (Mon=0...Sun=6) special text. */ 539 # define RC_WDNR_M0_2_S6_CHAR 'E' 540 541 /*! %weekday number (Sun=1...Sat=7) special text. */ 542 # define RC_WDNR_S1_2_S7_CHAR 'I' 543 544 /*! %weekday number (Sun=0...Sat=6) special text. */ 545 # define RC_WDNR_S0_2_S6_CHAR 'J' 546 547 /*! %weekday number (Monday=1...Sunday=7) special text. */ 548 # define RC_WDNR_X1_2_X7_CHAR 'S' 549 550 /*! %weekday number (Monday=0...Sunday=6) special text. */ 551 # define RC_WDNR_X0_2_X6_CHAR 'T' 552 553 /*! %day of year number special text. */ 554 # define RC_DOYNR_CHAR 'N' 555 556 /*! %day number special text. */ 557 # define RC_DAYNR_CHAR DAYNR_CHAR 558 559 /*! %month name special text. */ 560 # define RC_MONTHNAME_CHAR MONTHNAME_CHAR 561 562 /*! %month number special text. */ 563 # define RC_MONTHNR_CHAR MONTHNR_CHAR 564 565 /*! %year number special text. */ 566 # define RC_YEARNR_CHAR YEARNR_CHAR 567 568 /*! %week number special text. */ 569 # define RC_WEEKNR_CHAR 'k' 570 571 /*! %birth age number special text. */ 572 # define RC_BYEAR_CHAR 'B' 573 574 /*! %moon phase special text. */ 575 # define RC_MOON_CHAR 'O' 576 577 /*! %moon phase text graphics image. */ 578 # define RC_MOON_IMAGE_CHAR 'Z' 579 580 /*! %biorhythm special text. */ 581 # define RC_BIO_CHAR ',' 582 583 /*! %biorhythm text graphics bar. */ 584 # define RC_BIO_BAR_CHAR ';' 585 586 /* 587 * %?[OTHER_MODIFIER] --- Creates special texts. 588 */ 589 /*! %textual date special text. */ 590 # define RC_TDATE_CHAR 'n' 591 592 /*! %julian days since 1.5-Jan-4713 BCE special text. */ 593 # define RC_JDAYS_CHAR 'j' 594 595 /*! %time special text. */ 596 # define RC_TIME_CHAR 't' 597 598 /*! %time total minutes special text. */ 599 # define RC_TIME_TMI_CHAR '\'' 600 601 /*! %time hour special text. */ 602 # define RC_TIME_HR_CHAR '_' 603 604 /*! %time minute special text. */ 605 # define RC_TIME_MI_CHAR '?' 606 607 /*! %time `am|pm' suffix special text. */ 608 # define RC_TIME_AMPM_CHAR '{' 609 610 /*! %gmtime special text. */ 611 # define RC_GMTIME_CHAR '@' 612 613 /*! %gmtime total minutes special text. */ 614 # define RC_GMTIME_TMI_CHAR '`' 615 616 /*! %gmtime hour special text. */ 617 # define RC_GMTIME_HR_CHAR '.' 618 619 /*! %gmtime minute special text. */ 620 # define RC_GMTIME_MI_CHAR '/' 621 622 /*! %gmtime `am|pm' suffix special text. */ 623 # define RC_GMTIME_AMPM_CHAR '}' 624 625 /*! %timezone offset based on local time zone special text. */ 626 # define RC_LT_ZONE_OFFS_CHAR '=' 627 628 /*! %timezone offset based on UTC/GMT zone special text. */ 629 # define RC_UT_ZONE_OFFS_CHAR '"' 630 631 /*! %distance between two geographical point locations special text */ 632 # define RC_DISTANCE_CHAR 'b' 633 634 /*! %sunrise special text. */ 635 # define RC_SUN_RISE_CHAR 'o' 636 637 /*! %sunset special text. */ 638 # define RC_SUN_SET_CHAR 's' 639 640 /*! %day length special text. */ 641 # define RC_SUN_DAY_CHAR 'u' 642 643 /*! %night length special text. */ 644 # define RC_SUN_NIGHT_CHAR 'z' 645 646 /*! %moonrise special text. */ 647 # define RC_MOON_RISE_CHAR '(' 648 649 /*! %moonset special text. */ 650 # define RC_MOON_SET_CHAR ')' 651 652 /*! %moons-day length special text. */ 653 # define RC_MOON_DAY_CHAR '[' 654 655 /*! %moons-night length special text. */ 656 # define RC_MOON_NIGHT_CHAR ']' 657 658 /* 659 * %? --- Creates difference values. 660 */ 661 /*! %day difference special text. */ 662 # define RC_DAY_DIFF_CHAR 'd' 663 664 /*! %week difference special text. */ 665 # define RC_WEEK_DIFF_CHAR 'w' 666 667 /*! %month difference special text. */ 668 # define RC_MONTH_DIFF_CHAR 'm' 669 670 /*! %year | %year[DATE] difference special text. */ 671 # define RC_YEAR_DIFF_CHAR 'y' 672 673 /* 674 * %? --- Emits highlighting sequences/marking characters. 675 */ 676 /*! %highlighting sequence 1 enable special text. */ 677 # define RC_HLS1S_CHAR HLS1S_CHAR 678 679 /*! %highlighting sequence 1 disable special text. */ 680 # define RC_HLS1E_CHAR HLS1E_CHAR 681 682 /*! %highlighting sequence 2 enable special text. */ 683 # define RC_HLS2S_CHAR '3' 684 685 /*! %highlighting sequence 2 disable special text. */ 686 # define RC_HLS2E_CHAR '4' 687 688 /*! %highlighting sequence 1 enable special text if fixed date is on today's date. */ 689 # define RC_HLS3S_CHAR '5' 690 691 /*! %highlighting sequence 1 disable special text if fixed date is on today's date. */ 692 # define RC_HLS3E_CHAR '6' 693 694 /*! %highlighting sequence 2 enable special text if fixed date is on a legal holiday date. */ 695 # define RC_HLS4S_CHAR '7' 696 697 /*! %highlighting sequence 2 disable special text if fixed date is on a legal holiday date. */ 698 # define RC_HLS4E_CHAR '8' 699 700 /*! %highlighting sequence 1|2 enable special text if fixed date is on today's or legal holiday date. */ 701 # define RC_HLS5S_CHAR '9' 702 703 /*! %highlighting sequence 1|2 disable special text if fixed date is on today's or legal holiday date. */ 704 # define RC_HLS5E_CHAR '0' 705 706 707 708 /* 709 * Common preprocessor macros for fixed dates/resource files. 710 */ 711 # ifdef IDX 712 # undef IDX 713 # endif 714 # define IDX(gc_c) (tolower((gc_c)) - 'a') 715 # ifdef CHR2DIG 716 # undef CHR2DIG 717 # endif 718 # define CHR2DIG(gc_c) ((gc_c) - '0') 719 # ifdef DIG2CHR 720 # undef DIG2CHR 721 # endif 722 # define DIG2CHR(gc_x) ((gc_x) + '0') 723 724 725 726 # ifdef CUT_LONGNAMES 727 /* 728 * Cut resp., replace some long variable or function names to 6 significant 729 * places so ANY linker should be able to bind an executable file. 730 */ 731 # define bio_emo_ptext V_bet 732 # define bio_emo_phase V_bep 733 # define bio_emo_waxes V_bew 734 # define bio_int_ptext V_bit 735 # define bio_int_phase V_bip 736 # define bio_int_waxes V_biw 737 # define bio_phy_ptext V_bpt 738 # define bio_phy_phase V_bpp 739 # define bio_phy_waxes V_bpw 740 # define bio_positive_day V_bpd 741 # define exclusive_date_map V_edm 742 # define exclusive_weekday_map V_ewm 743 # define fiscal_month V_fm 744 # define fiscal_year V_fy 745 # define got_lat_min V_gmi 746 # define got_lat_max V_gma 747 # define inclusive_date_map V_idm 748 # define inclusive_weekday_map V_iwm 749 # define insert_line_into_table F_ilt 750 # define insert_response_file F_irf 751 # define num_of_range_chars V_nrc 752 # define num_of_repeat_chars V_noc 753 # define num_of_appears_chars V_nfc 754 # define precomp_date F_pd 755 # define precomp_nth_wd F_pwd 756 # define print_line V_pl 757 # define ptr_info_exclusive_day V_ped 758 # define print_twice V_ptw 759 # define time_sep V_ts 760 # define time_sep_found V_tsf 761 # define rc_bio_axis_len V_rba 762 # define rc_bio_emo_lit V_rbe 763 # define rc_bio_int_lit V_rbi 764 # define rc_bio_phy_lit V_rbp 765 # define rc_elems_table V_ret 766 # define rc_elems_max V_rem 767 # define rc_elems V_rei 768 # define rc_enable_fn_flag V_rff 769 # define rc_enable_hda_flag V_rha 770 # define rc_enable_hdl_flag V_rhl 771 # define rc_export_ldvar_flag V_red 772 # define rc_export_ltvar_flag V_ret 773 # define rc_feb_29_to_feb_28 V_f2f 774 # define rc_feb_29_to_mar_01 V_f2m 775 # define rc_files_table V_rft 776 # define rc_files_max V_rfm 777 # define rc_files V_rfi 778 # define rc_filename V_rfn 779 # define rc_filter_day V_rfd 780 # define rc_filter_period V_rfp 781 # define rc_filter_text V_rfx 782 # define rc_here_fn V_rhn 783 # define rc_here_fp V_rhp 784 # define rc_period V_rp 785 # define rc_period_argv V_rpa 786 # define rc_period_flag V_rpf 787 # define rc_period_is_longopt V_rpi 788 # define rc_period_list V_rpl 789 # define rc_period_option V_rpo 790 # define rc_suppr_date_part_flag V_rsd 791 # define rc_suppr_list_sep_flag V_rsl 792 # define rc_suppr_text_part_flag V_rst 793 # define rc_tvar V_rt 794 # define rc_tvar_tfn V_rtf 795 # define rc_tvar_tfp V_rtp 796 # define rc_use F_ru 797 # define rc_use_flag V_ruf 798 # define rc_valid_day F_rvd 799 # define rc_valid_period F_rvp 800 # define rc_week_flag V_rwf 801 # define rc_weekno_flag V_rwn 802 # define rc_week_year_flag V_rwy 803 # define weekday_of_date F_wod 804 # define weekday_map V_wm 805 # define weekday_name_group V_wng 806 # endif /* CUT_LONGNAMES */ 807 808 809 810 /* 811 * Type definitions. 812 */ 813 /* 814 * The date variable records. 815 */ 816 typedef struct dvar_base_type 817 { 818 char dvar_month; 819 char dvar_day; 820 } 821 Dvar_base_struct; 822 823 typedef struct dvar_type 824 { 825 /* Global date variables. */ 826 Dvar_base_struct dvar_global; 827 828 /* Local date variables. */ 829 Dvar_base_struct dvar_local; 830 } 831 Dvar_struct; 832 833 /* 834 * The text variable records. 835 */ 836 typedef struct tvar_base_type 837 { 838 char *tvar_text; 839 } 840 Tvar_base_struct; 841 842 typedef struct tvar_type 843 { 844 /* Global text variables. */ 845 Tvar_base_struct tvar_global; 846 847 /* Local text variables. */ 848 Tvar_base_struct tvar_local; 849 } 850 Tvar_struct; 851 852 /* 853 * The line part record. 854 */ 855 typedef struct line_type 856 { 857 /* List of days given? */ 858 Bool day_list; 859 860 /* Range of days given? */ 861 Bool day_range; 862 863 /* Points to the list/range of days of a line, otherwise NULL. */ 864 char *day_part; 865 866 /* Points to the "repeat for N days since..." field of a line, otherwise NULL. */ 867 char *repeat_part; 868 869 /* Points to the "appears each N'th day since..." field of a line, otherwise NULL. */ 870 char *appears_part; 871 872 /* Points to the text part of a line (always). */ 873 char *text_part; 874 } 875 Line_struct; 876 877 /* 878 * The file type record. 879 */ 880 typedef struct file_type 881 { 882 /* Actual file pointer. */ 883 FILE *fp; 884 885 /* Name of actual resource/include file. */ 886 char *filename; 887 888 /* Actual line number of actual resource/include file. */ 889 long line_number; 890 891 /* Number of bytes still unhandled in self-managed buffer. */ 892 int in_pool; 893 894 /* Memory region of self-managed buffer. */ 895 char *pool; 896 897 /* Pointer to next unmanaged character in self-managed buffer. */ 898 char *ptr_pool; 899 900 /* Buffered local date variables of a "previous" file. */ 901 Dvar_base_struct local_dvars[RC_DVAR_MAX]; 902 903 /* Buffered local text variables of a "previous" file. */ 904 Tvar_base_struct local_tvars[RC_TVAR_MAX]; 905 } 906 File_struct; 907 908 /* 909 * The local coordinates record used by the %distance, %sun* and %moon* special texts. 910 */ 911 typedef struct coor_type 912 { 913 int lon_deg; 914 int lon_min; 915 int lon_sec; 916 int lat_deg; 917 int lat_min; 918 int lat_sec; 919 int the_mode; 920 int meters_above_sea_level; 921 int time_zone_in_mins; 922 } 923 Coor_struct; 924 925 /* 926 * The output format of an astronomical object record. 927 */ 928 typedef struct astronomical_object_output_format_type 929 { 930 char data_format; 931 char error_format; 932 } 933 Aobj_oformat_struct; 934 935 /* 936 * General purpose enumerations. 937 */ 938 typedef enum var_mode 939 { 940 GLobal = 1, 941 LOcal 942 } 943 Var_enum; 944 945 typedef enum astronomical_event 946 { 947 RIse = 1, 948 SEt 949 } 950 Aevent_enum; 951 952 953 954 /* 955 * SUB-include one of the regex header file ;< 956 */ 957 /* 958 * The REGEX stuff. 959 */ 960 # if HAVE_GNU_RE_COMPILE_PATTERN 961 # if HAVE_SYS_TYPES_H 962 # include <sys/types.h> 963 # endif 964 # if HAVE_REGEX_H 965 # include <regex.h> 966 # endif 967 # endif 968 # if HAVE_POSIX_REGCOMP 969 # if HAVE_SYS_TYPES_H 970 # include <sys/types.h> 971 # endif 972 # if HAVE_REGEX_H 973 # include <regex.h> 974 # endif 975 # endif 976 977 978 /* 979 * GLOBAL variables declarations. 980 */ 981 /*! Points to the local coordinates 1. */ 982 extern Coor_struct *coor1; 983 984 /*! Points to the local coordinates 2. */ 985 extern Coor_struct *coor2; 986 987 /*! Date variables a[=MMDD]...z[] (YYYY@{a|b|...|z}[[-]N]). */ 988 extern Dvar_struct rc_dvar[]; 989 990 /*! Temporary file used when a command is assigned to a TVAR. */ 991 extern FILE *rc_tvar_tfp; 992 993 /*! Temporary file used for managing `--here=ARG' options. */ 994 extern FILE *rc_here_fp; 995 996 /*! Pointers to different parts of a (resource file) line. */ 997 extern Line_struct *lineptrs; 998 999 /*! Pointers to different parts of a (resource file) line. */ 1000 extern Line_struct *lptrs2; 1001 1002 /*! Pointers to different parts of a (resource file) line. */ 1003 extern Line_struct *lptrs3; 1004 1005 /*! Pointers to different parts of a (resource file) line. */ 1006 extern Line_struct *lptrs; 1007 1008 /*! Text variables $a[=TEXT]...$z[]. */ 1009 extern Tvar_struct rc_tvar[]; 1010 1011 /*! Time displacement value in days used by %sun* and %moon* 1012 (also used as cycle-starting time value for %sun* and %moon* special texts). */ 1013 extern double time_offset; 1014 1015 /*! Atmospheric pressure in millibar (`--atmosphere=PRESSURE,TEMPERATURE'). */ 1016 extern double atm_pressure; 1017 1018 /*! Atmospheric temperature in degrees Celsius (`--atmosphere=PRESSURE,TEMPERATURE'). */ 1019 extern double atm_temperature; 1020 1021 /*! Adjust rise/set-based reference altitude resp. shadow length factor (`--adjust-value=NUMBER'). */ 1022 extern double adjust_value; 1023 1024 /*! Actual size of `rc_elems_table[]'. */ 1025 extern Uint rc_elems_max; 1026 1027 /*! Cycle-ending time value in minutes for %sun* and %moon* special texts. */ 1028 extern int loop_end; 1029 1030 /*! Cycle-timestep value in minutes for %sun* and %moon* special texts. */ 1031 extern int loop_step; 1032 1033 /*! Buffer of actual GMT day. */ 1034 extern int buf_gd; 1035 1036 /*! Buffer of actual GMT month. */ 1037 extern int buf_gm; 1038 1039 /*! Buffer of actual GMT year. */ 1040 extern int buf_gy; 1041 1042 /*! Day of event found in line. */ 1043 extern int d; 1044 1045 /*! Buffered day of event. */ 1046 extern int d_buf; 1047 1048 /*! Indicates whether event also appears in previous year. */ 1049 extern int decr_year; 1050 1051 /*! Actual GMT hour. */ 1052 extern int gmt_hour; 1053 1054 /*! Day difference of GMT and local date. */ 1055 extern int gmt_loc_diff; 1056 1057 /*! Actual GMT minute. */ 1058 extern int gmt_min; 1059 1060 /*! The `N'th weekday of month' displacement value. */ 1061 extern int hn; 1062 1063 /*! The weekday number of `N'th weekday of month'*/ 1064 extern int hwd; 1065 1066 /*! Indicates whether event also appears in next year. */ 1067 extern int incr_year; 1068 1069 /*! Filler length of week number text. */ 1070 extern int len_fil_wt; 1071 1072 /*! Actual size of text buffer of "text"-part of a line. */ 1073 extern int len_the_text; 1074 1075 /*! Month of event found in line. */ 1076 extern int m; 1077 1078 /*! Buffered month of event. */ 1079 extern int m_buf; 1080 1081 /*! Length of a single axis of a biorhythm text graphics bar. */ 1082 extern int rc_bio_axis_len; 1083 1084 /*! Amount of resource file entries. */ 1085 extern int rc_elems; 1086 1087 /*! `-cd'. */ 1088 extern int rc_have_today_in_list; 1089 1090 /*! Number of lines of a Moon phase text graphics image. */ 1091 extern int rc_moonimage_lines; 1092 1093 /*! Amount of period of fixed dates. */ 1094 extern int rc_period; 1095 1096 /*! Starting index of dummy resource file entries in table. */ 1097 extern int rc_zero_pos; 1098 1099 /*! Year of event found in line. */ 1100 extern int y; 1101 1102 /*! The mode specifying character. */ 1103 extern char hc; 1104 1105 /*! Vector of holiday dates (memorial days). */ 1106 extern char hd_mdays[]; 1107 1108 /*! Stores the eternal holiday list texts. */ 1109 extern char *hd_table[]; 1110 1111 /*! Text buffer of a line read from a resource file. */ 1112 extern char *line_buffer; 1113 1114 /*! Text containing modified actual date %DATE. */ 1115 extern char *rc_adate; 1116 1117 /*! The biorhythm's "Emo" text. */ 1118 extern char *rc_bio_emo_lit; 1119 1120 /*! The biorhythm's "Int" text. */ 1121 extern char *rc_bio_int_lit; 1122 1123 /*! The biorhythm's "Phy" text. */ 1124 extern char *rc_bio_phy_lit; 1125 1126 /*! Name of alternative resource file(s) `-f|F<NAME[+...]>'. */ 1127 extern char *rc_filename; 1128 1129 /*! Argument used for filtering fixed date days. */ 1130 extern char *rc_filter_day; 1131 1132 /*! Argument used for filtering fixed date periods. */ 1133 extern char *rc_filter_period; 1134 1135 /*! REGEX used for filtering fixed date. */ 1136 extern char *rc_filter_text; 1137 1138 /*! Fixed date list grouping separator `-cg[TEXT]'. */ 1139 extern char *rc_grp_sep; 1140 1141 /*! Fixed date list heading text `--heading-text=TEXT'. */ 1142 extern char *rc_heading_text; 1143 1144 /*! Name of tempfile used when a command is assigned to a TVAR. */ 1145 extern char *rc_tvar_tfn; 1146 1147 /*! Name of tempfile used for managing `--here=ARG' options. */ 1148 extern char *rc_here_fn; 1149 1150 /*! General purpose text buffer 5. */ 1151 extern char *s5; 1152 1153 /*! General purpose text buffer 6. */ 1154 extern char *s6; 1155 1156 /*! General purpose text buffer 7. */ 1157 extern char *s7; 1158 1159 /*! Text buffer of "text"-part of a line. */ 1160 extern char *the_text; 1161 1162 /*! Stores the valid fixed date texts. */ 1163 extern char **rc_elems_table; 1164 1165 /*! `-cNw' and actual date modified. */ 1166 extern Bool adate_set; 1167 1168 /*! Does the command enables a year implicitly? */ 1169 extern Bool date_enables_year; 1170 1171 /*! `-cNw' and complete week is in month. */ 1172 extern Bool is_1month_mode; 1173 1174 /*! `-cNw' and only part of week is in month. */ 1175 extern Bool is_2month_mode; 1176 1177 /*! Reference to a date variable found in line. */ 1178 extern Bool is_2dvar; 1179 1180 /*! Reference to Easter Sundays date found in line. */ 1181 extern Bool is_2easter; 1182 1183 /*! Is a command (explicit date) given in the command line? */ 1184 extern Bool is_date_given; 1185 1186 /*! `-C[]' or `-C[][T|W|M|Y]' or `-c[][T|W|M|Y]' or `-F<>'. */ 1187 extern Bool rc_all_dates_flag; 1188 1189 /*! `-cA'. */ 1190 extern Bool rc_alternative_format_flag; 1191 1192 /*! `-c<N|w|m|y>'-. */ 1193 extern Bool rc_backwards_flag; 1194 1195 /*! `-jcb'. */ 1196 extern Bool rc_both_dates_flag; 1197 1198 /*! Buffers the state of `rc_backwards_flag'. */ 1199 extern Bool rc_bwdf_buffer; 1200 1201 /*! `-cz'. */ 1202 extern Bool rc_count_flag; 1203 1204 /*! `-ca'. */ 1205 extern Bool rc_enable_fn_flag; 1206 1207 /*! `-ce'. */ 1208 extern Bool rc_enable_hda_flag; 1209 1210 /*! `-cE'. */ 1211 extern Bool rc_enable_hdl_flag; 1212 1213 /*! `--execute-command'. */ 1214 extern Bool rc_execute_command; 1215 1216 /*! `--export-date-variables'. */ 1217 extern Bool rc_export_ldvar_flag; 1218 1219 /*! `--export-text-variables'. */ 1220 extern Bool rc_export_ltvar_flag; 1221 1222 /*! `--leap-day=february'. */ 1223 extern Bool rc_feb_29_to_feb_28; 1224 1225 /*! `--leap-day=march'. */ 1226 extern Bool rc_feb_29_to_mar_01; 1227 1228 /*! `--precise' to display precise, non-rounded, times and data. */ 1229 extern Bool rc_precise; 1230 1231 /*! `-c<N|w|m|y>+'. */ 1232 extern Bool rc_forwards_flag; 1233 1234 /*! Buffers the state of `rc_forwards_flag'. */ 1235 extern Bool rc_fwdf_buffer; 1236 1237 /*! `--ignore-case' to ignore case distinctions in PATTERN. */ 1238 extern Bool rc_ignore_case_flag; 1239 1240 /*! `--limit' to calculate rise/set time limited to the current day only. */ 1241 extern Bool rc_limit; 1242 1243 /*! `-cm'. */ 1244 extern Bool rc_month_flag; 1245 1246 /*! `-co'. */ 1247 extern Bool rc_omit_date_flag; 1248 1249 /*! `-cN[d|w|+|-]|MMDD|MMWW[W]N'. */ 1250 extern Bool rc_period_flag; 1251 1252 /*! `-cl'. */ 1253 extern Bool rc_period_list; 1254 1255 /*! `--revert-match' to select non-matching PATTERN lines. */ 1256 extern Bool rc_revert_match_flag; 1257 1258 /*! `-c-'. */ 1259 extern Bool rc_sort_des_flag; 1260 1261 /*! `-jc'. */ 1262 extern Bool rc_special_flag; 1263 1264 /*! `-cU'. */ 1265 extern Bool rc_suppr_date_part_flag; 1266 1267 /*! `-cQ'. */ 1268 extern Bool rc_suppr_list_sep_flag; 1269 1270 /*! `-cJ'. */ 1271 extern Bool rc_suppr_text_part_flag; 1272 1273 /*! `-cx'. */ 1274 extern Bool rc_title_flag; 1275 1276 /*! `-ct'. */ 1277 extern Bool rc_tomorrow_flag; 1278 1279 /*! `-c'. */ 1280 extern Bool rc_use_flag; 1281 1282 /*! `-cw'. */ 1283 extern Bool rc_week_flag; 1284 1285 /*! `-ck'. */ 1286 extern Bool rc_week_number_flag; 1287 1288 /*! `-cNw'. */ 1289 extern Bool rc_week_year_flag; 1290 1291 /*! `-cy'. */ 1292 extern Bool rc_year_flag; 1293 1294 /*! `-cZ'. */ 1295 extern Bool rc_zero_dates_flag; 1296 1297 /*! Remove highlighting sequences before searching PATTERN? */ 1298 extern Bool remove_hls_in_regex; 1299 1300 /*! Stores whether a %shell escape special text is run. */ 1301 extern Bool shell_escape_done; 1302 1303 # if HAVE_GNU_RE_COMPILE_PATTERN 1304 extern struct re_pattern_buffer regpattern; 1305 # endif 1306 1307 # if HAVE_POSIX_REGCOMP 1308 extern regex_t regpattern; 1309 # endif 1310 1311 # if HAVE_RE_COMP 1312 extern int re_pattern; 1313 # endif 1314 1315 #endif /* __RC_DEFS_H */ 1316