home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 3 / 3075 < prev    next >
Encoding:
Internet Message Format  |  1991-03-15  |  57.8 KB

  1. From: jbr0@cbnews.att.com (joseph.a.brownlee)
  2. Newsgroups: alt.sources
  3. Subject: Pcal v4.0, part 3 of 5
  4. Message-ID: <1991Mar14.124949.9520@cbnews.att.com>
  5. Date: 14 Mar 91 12:49:49 GMT
  6.  
  7. #!/bin/sh
  8. # This is part 03 of a multipart archive
  9. # ============= pcal.man ==============
  10. if test -f 'pcal.man' -a X"$1" != X"-c"; then
  11.     echo 'x - skipping pcal.man (File already exists)'
  12. else
  13. echo 'x - extracting pcal.man (Text)'
  14. sed 's/^X//' << 'SHAR_EOF' > 'pcal.man' &&
  15. .TH PCAL 1
  16. .SH NAME
  17. pcal \- generate PostScript calendars
  18. .SH SYNOPSIS
  19. .BR pcal " ["
  20. .BR \-e " | " \-f
  21. .I cal
  22. ] [
  23. .BI \-o " file"
  24. ] [
  25. .BR \-j " | " \-J
  26. ] [
  27. .BR \-l " | " \-p
  28. ] [
  29. .BR \-m " | " \-M
  30. ] [
  31. .BI \-b " day"
  32. | all ]
  33. [
  34. .BI \-g " day"
  35. | all ]
  36. [
  37. .B \-O
  38. ] [
  39. .BI \-F " day"
  40. ] [
  41. .BR \-A " | " \-E
  42. ] [
  43. .BI \-t " title_font"
  44. ] [
  45. .BI \-d " day_font"
  46. ] [
  47. .BI \-n " text_font"
  48. ] [
  49. .BI \-L " footer_string"
  50. ] [
  51. .BI \-C " footer_string"
  52. ] [
  53. .BI \-R " footer_string"
  54. ] [
  55. .BI \-D " symbol"
  56. ] [
  57. .BI \-U " symbol"
  58. ] [
  59. .BI \-x " xscale"
  60. ] [
  61. .BI \-y " yscale"
  62. ] [
  63. .BI \-X " xtrans"
  64. ] [
  65. .BI \-Y " ytrans"
  66. ] [
  67. .B \-I
  68. ] [
  69. .B \-B
  70. ] [
  71. .B \-w
  72. ] [
  73. .B \-h
  74. ] [
  75. .B month
  76. ] [
  77. .B year
  78. ] [
  79. .B nmonths
  80. ]
  81. .SH DESCRIPTION
  82. .I Pcal
  83. generates PostScript to produce landscape or portrait calendars for any 
  84. month and year.  The arguments
  85. .BR month ,
  86. .BR year ,
  87. and
  88. .BR nmonths ,
  89. if provided, should be numeric.  The 
  90. .BR month
  91. value should be in the range 1 \- 12, and the 
  92. .BR year
  93. value should be specified as 1 or 2 digits or as the full 4 digit year.
  94. If no numeric arguments are provided, the calendar for the current month
  95. and year will be generated.
  96. .PP
  97. If one numeric argument is provided, it is interpreted as the
  98. .BR year
  99. value, and calendars for the entire year will be generated.  Otherwise, 
  100. .BR nmonth
  101. months, starting with
  102. .BR month
  103. and
  104. .BR year ,
  105. will be generated.
  106. .PP
  107. For whole-year calendars (i.e. the
  108. .B \-w
  109. option is given), the command line arguments are interpreted somewhat
  110. differently.  By default, all months in the current year are printed, starting
  111. with January.  If the
  112. .B month
  113. argument alone is given, it is expected to be the desired
  114. .B year
  115. to print, and prints all of the months in the given year.  If both
  116. .BR month " and " year
  117. are given, then 12 consecutive months are printed starting at the given
  118. month and year.  If the
  119. .BR month ", " year ", and " nmonths
  120. arguments are all present, printing begins with the given month and year and
  121. .B nmonths
  122. months are printed, rounded up to the nearest multiple of 12.
  123. .PP
  124. .B The Date File
  125. .PP
  126. By default,
  127. .I pcal
  128. simply prints an empty calendar.  Its real power is in its ability to place
  129. ``events'' in appropriate days on the calendar, thus allowing the user to
  130. create personalized calendars.  This is achieved through the use of the
  131. ``date file''.
  132. .PP
  133. The date file is named
  134. .IR \.calendar " (" pcal.dat
  135. under MS-DOS),
  136. or
  137. .I calendar
  138. for compatibility with older versions.
  139. .I Pcal
  140. will look in several places for such a file.  First, if a file called
  141. .I \.calendar
  142. exists in the caller's home directory, it is used.  Next, if such a file exists
  143. in the directory indicated by
  144. environment variable
  145. .BR PCAL_DIR
  146. (or the current directory if no such variable is defined), it is used.
  147. Finally, the directory where the
  148. .I pcal
  149. executable resides will be checked.  If no date file is found, an empty
  150. calendar is printed.
  151. .PP
  152. If a date file is found, it will be searched for lines with
  153. leading dates matching the requested month and year.
  154. Any text following the dates found will be printed on the calendar under the
  155. appropriate day of the month.  Dates in the
  156. .I \.calendar
  157. file may be expressed in any of several formats:
  158. .PP
  159. .ft CW
  160. .nf
  161. X    <ordinal> <day_spec> in <month_spec>{*} {<text>}
  162. X    <day_spec> <prep> <date_spec>{*} {<text>}
  163. X    <date_spec>{*} {<text>}
  164. .fi
  165. .ft
  166. .PP
  167. Where:
  168. .PP
  169. .nf
  170. X    <month_name>    := first 3+ characters of name of month, or ``all''
  171. X    <month_spec>    := <month_name>, or ``year''
  172. X    <day_spec>    := first 3+ characters of name of weekday, ``day'',
  173. X                ``weekday'', ``workday'', ``holiday'', ``nonweekday'',
  174. X                ``nonworkday'', or ``nonholiday''
  175. X    <ordinal>    := any ordinal number (``1st'', ``2nd'', etc.), ``first'' ... ``fifth'',
  176. X                ``last'', ``odd'', ``even'', or ``all''
  177. X    <prep>        := ``before'', ``preceding'', ``after'', ``following'',
  178. X                ``on_or_before'' (``oob''), or ``on_or_after'' (``ooa'')
  179. X    <sep>        := one or more non-numeric, non-space, non-'*' characters
  180. X    <month>    := a numeric month (1-12)
  181. X    <day>        := day of month (1-31)
  182. X    <year>        := a numeric year
  183. .fi
  184. .ft
  185. .PP
  186. If the
  187. .B \-A
  188. option (American date formats, the default) is given:
  189. .PP
  190. .nf
  191. X    <date_spec>    := [ <month_name> <day> | <month><sep><day>{<sep><year>} ]
  192. .fi
  193. .PP
  194. If the
  195. .B \-E
  196. option (European date formats) is given:
  197. .PP
  198. .nf
  199. X    <date_spec>    := [ <day> <month_name> | <day><sep><month>{<sep><year>} ]
  200. .fi
  201. .PP
  202. Examples:
  203. .PP
  204. .ft CW
  205. .nf
  206. X    last Monday in May*         Memorial Day Holiday
  207. .sp
  208. X    all Fridays in Oct          Status Meeting, 11 AM
  209. X    last workday in all         Progress report due
  210. X    all Fri in all              Time card due, 3 PM
  211. X    Fri on_or_before all 15     Pay Day
  212. X    even Fridays in year        Pay Day
  213. X    183rd day of year           mid-year
  214. .sp
  215. X    Tue after first Mon in Nov  Election Day (USA)
  216. .sp
  217. X    4th Thu in Nov*             Thanksgiving
  218. X    Fri after 4th Thu in Nov*   Day after Thanksgiving
  219. .sp
  220. X    12/25/90*                   Christmas     # American
  221. X    25.12.90*                   Christmas     # European
  222. .sp
  223. X    Dec 25*                     Christmas     # American
  224. X    25 Dec*                     Christmas     # European
  225. .fi
  226. .ft
  227. .PP
  228. Any non-numeric character may separate numeric dates.  Holidays may
  229. be flagged by following the date immediately with `*'
  230. as in the examples above; this will cause the
  231. date to be printed in gray.
  232. ``Each'' and ``every'' are accepted as synonyms for ``all'', and any word may
  233. be used in place of ``in''.  The abbreviations ``oob'' and ``ooa'' may be used
  234. in place of the keywords ``on_or_before'' and ``on_or_after'', respectively.
  235. .PP
  236. Wildcard day names are also provided.  The keyword ``weekday'' applies to any
  237. days which are normally printed in black on the calendar.  The keyword
  238. ``workday'' is the same, but does not include any holidays.  The keyword
  239. ``holiday'' includes only those days flagged as holidays.  The keywords
  240. ``nonweekday'', ``nonworkday'', and ``nonholiday'' are also recognized as
  241. negations of the above.  See the
  242. .B CAVEATS
  243. below for important notes on using these keywords.
  244. .PP
  245. Ordinal day numbers may be used to specify dates, either relative to the
  246. month or to the year.  Either words or numeric abbreviations may be used for
  247. ``first'' through ``fifth''; higher numbers must be given using the
  248. numeric equivalent (e.g. 100th).  Negative ordinal numbers may even be used.
  249. For example, ``\-2nd'' means ``next to last''.
  250. .PP
  251. ``Odd'' and ``even'' do not refer to the actual date; instead, ``odd''
  252. means ``alternate, starting with the first'', and ``even'' means ``alternate,
  253. starting with the second''.  Thus, ``odd Fridays in March'' refers to
  254. the first, third, and (if present) fifth Fridays in March - not to
  255. those Fridays falling on odd dates.
  256. .PP
  257. ``All'' refers to each individual month; ``year'' refers to the year
  258. as an entity.  Thus ``odd Fridays in all'' refers to the first, third, and fifth
  259. Friday of each month, while ``odd Fridays in year'' refers to
  260. the first Friday of January and every other Friday thereafter.
  261. .PP
  262. Text in the date file may use C-like escape sequences (i.e. a `\\' followed by
  263. a character, 1 \- 3 octal digits, or `x' followed by 1 \- 2 hexadecimal digits).
  264. Escaped whitespace (including
  265. .B newline
  266. ) and the standard ANSI character escapes (`\\a', `\\b', `\\f', `\\n', `\\r',
  267. `\\t', `\\v') are all replaced by a single blank.
  268. .PP
  269. Lines in the
  270. .I \.calendar
  271. file consisting of 
  272. .B year XXXX
  273. (where
  274. .B XXXX
  275. is a numeric year) can be used
  276. to set the year for following entries.  This assumes that the following
  277. entries do not contain a year; any date entries containing year information
  278. will set the remembered year to that year.
  279. .PP
  280. Lines in the
  281. .I \.calendar
  282. file consisting of 
  283. .B opt <options>
  284. can be used to override the defaults for
  285. any command-line options except
  286. .BR \-e ,
  287. .BR \-f ,
  288. .BR \-h ,
  289. .BR \-D ", and"
  290. .BR \-U .
  291. Any options specified in this manner
  292. are, in turn, overridden by those specified explicitly on the command line.
  293. .PP
  294. Lines in the
  295. .I \.calendar
  296. file consisting of
  297. .B note <month>
  298. can be used to place notes regarding the
  299. entire month is one of the unused blocks of the calendar.  The
  300. .B <month>
  301. indicator may be either a number 1 through 12 or an alphabetic month name
  302. as described above;  ``note all'' will place the associated text in the
  303. notes block for each month in the current year.
  304. .PP
  305. Comments are supported in the
  306. .I \.calendar
  307. file.  Any characters following a `#' character through the end of the
  308. line are ignored.
  309. .PP
  310. .I Pcal
  311. supports rudimentary
  312. .IR cpp -like
  313. functionality in the
  314. date file, allowing the following constructs:
  315. .BR "define | undef" ,
  316. .B if{n}def ... {else ...} endif,
  317. and
  318. .BR include .
  319. Note that these are not preceded by `#' as they are in C.
  320. Symbol names defined using these keywords (or via the 
  321. .B -D
  322. option) are case-insensitive.
  323. It is not an error to
  324. .BR undef
  325. an undefined symbol, nor to
  326. .BR define
  327. a previously-defined one.  An
  328. .BR ifdef
  329. alone is always
  330. .BR false "; an"
  331. .BR ifndef
  332. alone is always
  333. .BR true .
  334. .PP
  335. The name of the file in the 
  336. .BR include
  337. directive may optionally be
  338. surrounded by either "" or <>, both of which are ignored.  If the
  339. name is not an absolute path, it is taken to be relative to the
  340. directory where the file containing the directive is located.
  341. .I Pcal
  342. is smart enough to translate
  343. .B ~/
  344. to the user's home directory.
  345. .PP
  346. In addition to pre-processing keywords,
  347. .I pcal
  348. also accepts boolean expressions in
  349. .B if{n}def
  350. directives.  These expressions consist of symbol names joined by the boolean
  351. operators
  352. .BR ! ", " & ", " ^ ", and "
  353. .BR | ,
  354. in order of precedence, high to low.  Parentheses may be used to alter the
  355. precedence.  The synonyms
  356. .BR && " and " ||
  357. are accepted for
  358. .BR & " and " | .
  359. A symbol name evaluates to 
  360. .B true
  361. if currently defined,
  362. .B false
  363. if not; thus:
  364. .PP
  365. .ft CW
  366. .nf
  367. X    ifdef A | B | C
  368. .fi
  369. .ft
  370. .PP
  371. \&...is
  372. .B true
  373. if any of the symbols A, B, and C is defined, and:
  374. .PP
  375. .ft CW
  376. .nf
  377. X    ifdef A & B & C
  378. .fi
  379. .ft
  380. .PP
  381. \&...is
  382. .B true
  383. if they all are.  Note that 
  384. .B ifndef <expr>
  385. is equivalent to 
  386. .B ifdef !( <expr> ).
  387. .PP
  388. .B The Moon File
  389. .PP
  390. If a file of the name
  391. .IR .moonXX " (" moonXX.dat
  392. under MS-DOS),
  393. where
  394. .B XX
  395. is the last two digits of the calendar year, exists in the same directory
  396. as the date file,
  397. .I pcal
  398. uses the information contained within to calculate the phase of the
  399. moon.  If no such file exists,
  400. .I pcal
  401. uses an approximate algorithm.
  402. .PP
  403. Entries in the moon file must conform to the following syntax:
  404. .PP
  405. If the
  406. .B \-A
  407. option (American date formats, the default) is given:
  408. .PP
  409. .ft CW
  410. .nf
  411. X    <quarter> <month><sep><day> {<hour><sep><min>}
  412. .fi
  413. .ft
  414. .PP
  415. If the
  416. .B \-E
  417. option (European date formats) is given:
  418. .PP
  419. .ft CW
  420. .nf
  421. X    <quarter> <day><sep><month> {<hour><sep><min>}
  422. .fi
  423. .ft
  424. .PP
  425. Where:
  426. .PP
  427. .nf
  428. X    <quarter>    := ``nm'', ``fq'' or ``1q'', ``fm'', ``3q'' or ``lq'' (new moon,
  429. X                first quarter, full moon, last quarter)
  430. X    <hour>        := number 0-23 (24-hour clock)
  431. X    <min>        := number 0-59
  432. .fi
  433. .PP
  434. This file must contain entries for all quarter moons in the year,
  435. in chronological order; if any errors are encountered,
  436. .I pcal
  437. will revert to using its default algorithm.
  438. .PP
  439. As in the date file, comments start with '#' and run through
  440. end-of-line.  
  441. .PP
  442. .B Options
  443. .PP
  444. .I Pcal
  445. has many options:
  446. .P
  447. .TP 12
  448. .B \-e
  449. Prints an empty calendar.  Do not print entries from a
  450. .I \.calendar
  451. file.
  452. .TP
  453. .BI \-f " cal"
  454. Directs
  455. .I pcal
  456. to use the file name
  457. .I cal
  458. as the input file in place of the default
  459. .I \.calendar
  460. file in the user's home directory (or the directory pointed to by
  461. .BR PCAL_DIR ).
  462. .TP
  463. .BI \-o " file"
  464. Directs
  465. .I pcal
  466. to write the output to
  467. .I file
  468. instead of to stdout.
  469. .TP
  470. .B \-l
  471. Causes the output to be in landscape mode (default).  This also resets the
  472. x- and y-axis scaling and translation factors to the defaults for
  473. landscape mode.
  474. .TP
  475. .B \-p
  476. Causes the output to be in portrait mode.  This also resets the
  477. x- and y-axis scaling and translation factors to the defaults for portrait
  478. mode.
  479. .TP
  480. .B \-j
  481. Causes the Julian date (day of year) to be printed in each calendar box.
  482. .TP
  483. .B \-J
  484. Causes the Julian date and the number of days remaining in the year to
  485. be printed in each calendar box.
  486. .TP
  487. .B \-m
  488. Causes moon icons to be printed on dates corresponding to
  489. new, half, and full moons (the default is that no moons are printed).
  490. .TP
  491. .B \-M
  492. Causes moon icons to be printed on all dates (the default is
  493. that no moons are printed).
  494. .TP
  495. .BI \-b " day" " | all"
  496. Causes all dates falling on weekday
  497. .I day
  498. to be printed in black;
  499. .B \-b all
  500. causes all weekdays to be printed in black.
  501. .TP
  502. .BI \-g " day" " | all"
  503. Causes all dates falling on weekday
  504. .I day
  505. to be printed in gray;
  506. .B \-g all
  507. causes all weekdays to be printed in gray.
  508. .IP
  509. The default for the
  510. .BR \-b " and " \-g
  511. options is to print Saturdays and Sundays in gray and other days, unless
  512. flagged as holidays, in black.
  513. .TP
  514. .BI \-O
  515. Causes pcal to print ``gray'' dates as outlined characters.
  516. .TP
  517. .BI \-F " day"
  518. Selects weekday
  519. .I day
  520. as the first day of the week.  The given day will appear in the left-most
  521. column of the calendar.
  522. .TP
  523. .B \-A
  524. Directs
  525. .I pcal
  526. to use American date conventions
  527. .B mm/dd{/yy}
  528. and
  529. .B month dd
  530. ) when parsing the date file (default).
  531. .TP
  532. .B \-E
  533. Directs
  534. .I pcal
  535. to use European date conventions
  536. .B dd/mm{/yy}
  537. and
  538. .B dd month
  539. ) when parsing the date file.
  540. .TP
  541. .BI \-X " xtrans"
  542. Specifies the x-axis translation value for positioning the output on the page.
  543. .TP
  544. .BI \-Y " ytrans"
  545. Specifies the y-axis translation value for positioning the output on the page.
  546. .TP
  547. .BI \-x " xscale"
  548. Specifies the x-axis scaling factor for the calendar size.
  549. .TP
  550. .BI \-y " yscale"
  551. Specifies the y-axis scaling factor for the calendar size.
  552. .TP
  553. .BI \-t " title_font"
  554. Specifies the name of a font to use to print the
  555. month name and year at the top of the calendar.  For example,
  556. .BR "pcal \-t Times-Roman" .
  557. .TP
  558. .BI \-d " day_font"
  559. Similar to the
  560. .B \-t
  561. option, but selects the font used to print the day numbers.
  562. .TP
  563. .BI \-n " text_font"
  564. Similar to the
  565. .B \-t
  566. option, but selects the font used to print the text inside each day and in
  567. the notes block.
  568. .TP
  569. .BI \-D " symbol"
  570. Defines the named symbol prior to reading the date file.
  571. .TP
  572. .BI \-U " symbol"
  573. Un-defines the named symbol prior to reading the date file.
  574. .TP
  575. .BI \-L " string"
  576. Causes the accompanying string to be printed as a left-justified footer.
  577. .TP
  578. .BI \-C " string"
  579. Causes the accompanying string to be printed as a centered footer.
  580. .TP
  581. .BI \-R " string"
  582. Causes the accompanying string to be printed as a right-justified
  583. footer.
  584. .TP
  585. .BI \-B
  586. Causes pcal to leave unused calendar boxes blank (default is gray).
  587. .TP
  588. .BI \-w
  589. Causes pcal to print a calendar for 12 consecutive months: 3 rows / 4
  590. columns in landscape mode, 4 rows / 3 columns in portrait mode.  See the
  591. CAVEATS section for details on the use of this option with other options.
  592. .TP
  593. .B \-I
  594. Resets all parameters to the program defaults.
  595. .TP
  596. .B \-h
  597. Causes
  598. .I pcal
  599. to write version information and a usage message (to stdout) and terminate.
  600. .PP
  601. Any option which normally takes an argument may be specified without
  602. the argument in order to reset the value to the program default.  Note that
  603. while the
  604. .B \-D
  605. option alone clears all the defined symbols, the
  606. .B \-U
  607. option alone has no effect.  The
  608. .B \-
  609. (or
  610. .BR "\-\|\-" " as per"
  611. System V) argument may be used to disambiguate command lines such as:
  612. .IP
  613. .B pcal \-t 9 90
  614. .PP
  615. This could be written instead as one of the following:
  616. .IP
  617. .B pcal \-t \- 9 90
  618. .br
  619. .B pcal \-t \-\|\- 9 90
  620. .PP
  621. If the environment variable
  622. .BR PCAL_OPTS
  623. is defined, its contents are parsed as a command line.  Flags set via
  624. .BR PCAL_OPTS
  625. override the program defaults, but are overridden by options set via 
  626. .B opt
  627. lines in the
  628. .I \.calendar
  629. file or explicitly on the command line.
  630. .SH CAVEATS
  631. The ``workday'' and ``holiday'' keywords are aware of only those holidays
  632. which have already been flagged at the point where they appear.  For example,
  633. consider January 1990:
  634. .PP
  635. .ft CW
  636. .nf
  637. .ne 7
  638. X                January 1990
  639. X             S  M Tu  W Th  F  S
  640. X                1  2  3  4  5  6
  641. X             7  8  9 10 11 12 13
  642. X            14 15 16 17 18 19 20
  643. X            21 22 23 24 25 26 27
  644. X            28 29 30 31
  645. .fi
  646. .ft
  647. .PP
  648. If the
  649. .I \.calendar
  650. file looked like this:
  651. .PP
  652. .ft CW
  653. .nf
  654. X    workday on_or_before all 15    payday
  655. X    3rd Mon in Jan*            MLK day
  656. .fi
  657. .ft
  658. .PP
  659. \&\.\.\. then
  660. .I pcal
  661. would mark the 15th as ``payday'' since at that point in the
  662. .I \.calendar
  663. file it has no way of knowing that January 15th will later be flagged as a
  664. holiday.  If the two lines were reversed, such that the holiday preceded the
  665. ``workday'' wildcard, then
  666. .I pcal
  667. would work as intended, marking instead the 12th as ``payday''.  Also, beware
  668. of year boundaries which affect the handling of all of the day wildcard
  669. keywords.  In general, it is best to place monthly wildcards such as the
  670. example above at the end of each year to achieve the desired effect.
  671. .PP
  672. When the
  673. .B \-w
  674. and
  675. .B \-p
  676. options are used together,
  677. .I pcal
  678. revises the y-scale factor in order to use the entire portrait page; therefore,
  679. the user should avoid using use the
  680. .B \-y
  681. option when using both the
  682. .B \-w
  683. and
  684. .B \-p
  685. options.  Use of the
  686. .B \-w
  687. option in any case effectively disables the
  688. .BR \-m ", " \-M ", " \-j ", and "
  689. .B \-J
  690. options.
  691. .SH SEE ALSO
  692. cal(1)
  693. .SH AUTHORS
  694. The original PostScript code to generate the calendars was written by
  695. Patrick Wood (Copyright (c) 1987 by Patrick Wood of Pipeline Associates,
  696. Inc.), and authorized for modification and redistribution.  The calendar
  697. file inclusion code was originally written in
  698. .IR bs (1)
  699. by Bill Vogel of AT&T.  Patrick's original PostScript was modified and
  700. enhanced several times by others whose names have regrettably been lost.
  701. Ken Keirnan of Pacific Bell assembled the original ``C'' version upon which
  702. this is based; additional modifications and enhancements are the work of
  703. Joseph P. Larson, Ed Hand, Andrew W. Rogers, Mark Kantrowitz, Joe Brownlee,
  704. Jamie Zawinski, Bill Hogsett, and Floyd Miller.
  705. SHAR_EOF
  706. chmod 0644 pcal.man ||
  707. echo 'restore of pcal.man failed'
  708. Wc_c="`wc -c < 'pcal.man'`"
  709. test 17774 -eq "$Wc_c" ||
  710.     echo 'pcal.man: original size 17774, current size' "$Wc_c"
  711. fi
  712. # ============= pcal.tex ==============
  713. if test -f 'pcal.tex' -a X"$1" != X"-c"; then
  714.     echo 'x - skipping pcal.tex (File already exists)'
  715. else
  716. echo 'x - extracting pcal.tex (Text)'
  717. sed 's/^X//' << 'SHAR_EOF' > 'pcal.tex' &&
  718. % -*-LaTeX-*-
  719. % Converted automatically from troff to LaTeX by tr2tex on Fri Mar  1 21:59:54 1991
  720. % tr2tex was written by Kamal Al-Yahya at Stanford University
  721. % (Kamal%Hanauma@SU-SCORE.ARPA)
  722. X
  723. \documentstyle[troffman]{article}
  724. \begin{document}
  725. %
  726. % input file: pcal.man
  727. %
  728. \phead{PCAL}{1}{}
  729. X
  730. \shead{NAME}
  731. pcal -- generate PostScript calendars
  732. X
  733. \shead{SYNOPSIS}
  734. {\bf pcal}{\rm \ [} {\bf --e}{\rm \ $|$\ }{\bf --f} {\it cal} ] [ {\bf
  735. --o}{\it \ file} ] [ {\bf --j}{\rm \ $|$\ }{\bf --J} ] [ {\bf --l}{\rm \
  736. $|$\ }{\bf --p} ] [ {\bf --m}{\rm \ $|$\ }{\bf --M} ] [ {\bf --b}{\it \
  737. day} $|$ all ] [ {\bf --g}{\it \ day} $|$ all ]\hfil\break
  738. [ {\bf --O} ] [ {\bf --F}{\it \ day} ] [ {\bf --A}{\rm \ $|$\ }{\bf --E}
  739. ] [ {\bf --t}{\it \ title\_font} ] [ {\bf --d}{\it \ day\_font} ] [ {\bf
  740. --n}{\it \ text\_font} ] [ {\bf --L}{\it \ footer\_string} ]\hfil\break
  741. [ {\bf --C}{\it \ footer\_string} ] [ {\bf --R}{\it \ footer\_string} ] [
  742. {\bf --D}{\it \ symbol} ] [ {\bf --U}{\it \ symbol} ] [ {\bf --x}{\it \
  743. xscale} ] [ {\bf --y}{\it \ yscale} ]\hfil\break
  744. [ {\bf --X}{\it \ xtrans} ] [ {\bf --Y}{\it \ ytrans} ] [ {\bf --I} ] [
  745. {\bf --B} ] [ {\bf --w} ] [ {\bf --h} ]\hfil\break
  746. [ {\bf month} ] [ {\bf year} ] [ {\bf nmonths} ]
  747. X
  748. \shead{DESCRIPTION}
  749. {\it Pcal} generates PostScript to produce landscape or portrait
  750. calendars for any month and year.  The arguments {\bf month}{\rm ,} {\bf
  751. year}{\rm ,} and {\bf nmonths}{\rm ,} if provided, should be numeric.
  752. The {\bf month} value should be in the range 1 -- 12, and the {\bf year}
  753. value should be specified as 1 or 2 digits or as the full 4 digit year.
  754. If no numeric arguments are provided, the calendar for the current month
  755. and year will be generated.
  756. \vskip\baselineskip
  757. X
  758. If one numeric argument is provided, it is interpreted as the {\bf year}
  759. value, and calendars for the entire year will be generated.  Otherwise,
  760. {\bf nmonth} months, starting with {\bf month} and {\bf year}{\rm ,} will
  761. be generated.
  762. \vskip\baselineskip
  763. X
  764. For whole-year calendars ({\it i.e.}, the {\bf --w} option is given), the
  765. command line arguments are interpreted somewhat differently.  By default,
  766. all months in the current year are printed, starting with January.  If
  767. the {\bf month} argument alone is given, it is expected to be the desired
  768. {\bf year} to print, and prints all of the months in the given year.  If
  769. both {\bf month}{\rm \ and\ }{\bf year} are given, then 12 consecutive
  770. months are printed starting at the given month and year.  If the {\bf
  771. month}{\rm ,\ }{\bf year}{\rm ,\ and\ }{\bf nmonths} arguments are all
  772. present, printing begins with the given month and year and {\bf nmonths}
  773. months are printed, rounded up to the nearest multiple of 12.
  774. \vskip\baselineskip
  775. X
  776. {\bf The Date File}
  777. \vskip\baselineskip
  778. X
  779. By default, {\it pcal} simply prints an empty calendar.  Its real power
  780. is in its ability to place ``events'' in appropriate days on the
  781. calendar, thus allowing the user to create personalized calendars.  This
  782. is achieved through the use of the ``date file''.
  783. \vskip\baselineskip
  784. X
  785. The date file is named {\it .calendar} (or {\it calendar} for
  786. compatibility with older versions).  {\it Pcal} will look in several
  787. places for such a file.  First, if a file called {\it .calendar} exists
  788. in the caller's home directory, it is used.  Next, if such a file exists
  789. in the directory indicated by environment variable {\bf PCAL\_DIR} (or
  790. the current directory if no such variable is defined), it is used.
  791. Finally, the directory where the {\it pcal} executable resides will be
  792. checked.  If no date file is found, an empty calendar is printed.
  793. \vskip\baselineskip
  794. X
  795. If a date file is found, it will be searched for lines with leading dates
  796. matching the requested month and year.  Any text following the dates
  797. found will be printed on the calendar under the appropriate day of the
  798. month.  Dates in the {\it .calendar} file may be expressed in any of
  799. several formats:
  800. X
  801. {\tt
  802. \nofill
  803. X        $<$ordinal$>$ $<$day\_spec$>$ in $<$month\_spec$>$\{$\ast$\} \{$<$text$>$\}
  804. X        $<$day\_spec$>$ $<$prep$>$ $<$date\_spec$>$\{$\ast$\} \{$<$text$>$\}
  805. X        $<$date\_spec$>$\{$\ast$\} \{$<$text$>$\}
  806. \fill}
  807. Where:
  808. {\tt
  809. \nofill
  810. X        $<$month\_name$>$    := first 3+ characters of name of month, or "all"
  811. X        $<$month\_spec$>$    := $<$month\_name$>$, or "year"
  812. X        $<$day\_spec$>$      := first 3+ characters of name of weekday, "day",
  813. X                            "weekday", "workday", "holiday", "nonweekday",
  814. X                            "nonworkday", or "nonholiday"
  815. X        $<$ordinal$>$       := any ordinal number ("1st", "2nd", {\it etc}.),
  816. X                            "first" $\ldots$ "fifth", "last", "odd",
  817. X                            "even", or "all"
  818. X        $<$prep$>$          := "before", "preceding", "after", "following",
  819. X                            "on\_or\_before" ("oob"), or "on\_or\_after" ("ooa")
  820. X        $<$sep$>$           := one or more non-numeric, non-space, non-`$\ast$' characters
  821. X        $<$month$>$         := a numeric month (1-12)
  822. X        $<$day$>$           := day of month (1-31)
  823. X        $<$year$>$          := a numeric year
  824. \fill}
  825. X
  826. If the {\bf --A} option (American date formats, the default) is given:
  827. {\tt
  828. \nofill
  829. X    $<$date\_spec$>$   := [ $<$month\_name$>$ $<$day$>$ $|$ $<$month$>$$<$sep$>$$<$day$>$\{$<$sep$>$$<$year$>$\} ]
  830. \fill}
  831. X
  832. If the {\bf --E} option (European date formats) is given:
  833. {\tt
  834. \nofill
  835. X    $<$date\_spec$>$   := [ $<$day$>$ $<$month\_name$>$ $|$ $<$day$>$$<$sep$>$$<$month$>$\{$<$sep$>$$<$year$>$\} ]
  836. \fill}
  837. X
  838. Examples:
  839. {\tt
  840. \nofill
  841. X        last Monday in May$\ast$         Memorial Day Holiday
  842. \vskip\baselineskip
  843. X        all Fridays in Oct          Status Meeting, 11 AM
  844. X        last workday in all         Progress report due
  845. X        all Fri in all              Time card due, 3 PM
  846. X        Fri on\_or\_before all 15      Pay Day
  847. X        even Fridays in year        Pay Day
  848. X        183rd day of year           mid-year
  849. \vskip\baselineskip
  850. X        Tue after first Mon in Nov  Election Day (USA)
  851. \vskip\baselineskip
  852. X        4th Thu in Nov$\ast$             Thanksgiving
  853. X        Fri after 4th Thu in Nov$\ast$   Day after Thanksgiving
  854. \vskip\baselineskip
  855. X        12/25/90$\ast$                   Christmas     \# American
  856. X        25.12.90$\ast$                   Christmas     \# European
  857. \vskip\baselineskip
  858. X        Dec 25$\ast$                     Christmas     \# American
  859. X        25 Dec$\ast$                     Christmas     \# European
  860. \fill}
  861. X
  862. Any non-numeric character may separate numeric dates.  Holidays may be
  863. flagged by following the date immediately with `$\ast$' as in the examples
  864. above; this will cause the date to be printed in gray.  ``Each'' and
  865. ``every'' are accepted as synonyms for ``all'', and any word may be used
  866. in place of ``in''.  The abbreviations ``oob'' and ``ooa'' may be used in
  867. place of the keywords ``on\_or\_before'' and ``on\_or\_after'',
  868. respectively.
  869. \vskip\baselineskip
  870. X
  871. Wildcard day names are also provided.  The keyword ``weekday'' applies to
  872. any days which are normally printed in black on the calendar.  The
  873. keyword ``workday'' is the same, but does not include any holidays.  The
  874. keyword ``holiday'' includes only those days flagged as holidays.  The
  875. keywords ``nonweekday'', ``nonworkday'', and ``nonholiday'' are also
  876. recognized as negations of the above.  See the {\bf CAVEATS} below for
  877. important notes on using these keywords.
  878. \vskip\baselineskip
  879. X
  880. Ordinal day numbers may be used to specify dates, either relative to the
  881. month or to the year.  Either words or numeric abbreviations may be used
  882. for ``first'' through ``fifth''; higher numbers must be given using the
  883. numeric equivalent (e.g. 100th).  Negative ordinal numbers may even be
  884. used.  For example, ``--2nd'' means ``next to last''.
  885. \vskip\baselineskip
  886. X
  887. ``Odd'' and ``even'' do not refer to the actual date; instead, ``odd''
  888. means ``alternate, starting with the first'', and ``even'' means
  889. ``alternate, starting with the second''.  Thus, ``odd Fridays in March''
  890. refers to the first, third, and (if present) fifth Fridays in March - not
  891. to those Fridays falling on odd dates.
  892. \vskip\baselineskip
  893. X
  894. ``All'' refers to each individual month; ``year'' refers to the year as
  895. an entity.  Thus ``odd Fridays in all'' refers to the first, third, and
  896. fifth Friday of each month, while ``odd Fridays in year'' refers to the
  897. first Friday of January and every other Friday thereafter.
  898. \vskip\baselineskip
  899. X
  900. Text in the date file may use C-like escape sequences ({\it i.e.}, a `\bs
  901. ' followed by a character, 1 -- 3 octal digits, or `x' followed by 1 -- 2
  902. hexadecimal digits).  Escaped whitespace (including {\bf newline} ) and
  903. the standard ANSI character escapes (`\bs a', `\bs b', `\bs f', `\bs n',
  904. `\bs r', `\bs t', `\bs v') are all replaced by a single blank.
  905. \vskip\baselineskip
  906. X
  907. Lines in the {\it .calendar} file consisting of {\bf year} XXXX (where
  908. XXXXX is a numeric year) can be used to set the year for following
  909. entries.  This assumes that the following entries do not contain a year;
  910. any date entries containing year information will set the remembered year
  911. to that year.
  912. \vskip\baselineskip
  913. X
  914. Lines in the {\it .calendar} file consisting of {\bf opt} $<$options$>$
  915. can be used to override the defaults for any command-line options except
  916. {\bf --e}{\rm ,} {\bf --f}{\rm ,} {\bf --h}{\rm ,} {\bf --D}{\rm ,\ and}
  917. {\bf --U}{\rm .} Any options specified in this manner are, in turn,
  918. overridden by those specified explicitly on the command line.
  919. \vskip\baselineskip
  920. X
  921. Lines in the {\it .calendar} file consisting of {\bf note} $<$month$>$
  922. can be used to place notes regarding the entire month is one of the
  923. unused blocks of the calendar.  The {\bf $<$month$>$} indicator may be
  924. either a number 1 through 12 or an alphabetic month name as described
  925. above;  ``note all'' will place the associated text in the notes block
  926. for each month in the current year.
  927. \vskip\baselineskip
  928. X
  929. Comments are supported in the {\it .calendar} file.  Any characters
  930. following a `\#' character through the end of the line are ignored.
  931. \vskip\baselineskip
  932. X
  933. {\it Pcal} supports rudimentary {\it cpp}{\rm -like} functionality in the
  934. date file, allowing the following constructs:  {\bf define\ $|$\
  935. undef}{\rm ,} {\bf if\{n\}def $\ldots$ \{else $\ldots$\} endif}, and {\bf
  936. include}{\rm .} Note that these are not preceded by `\#' as they are in
  937. C.  Symbol names defined using these keywords (or via the {\bf -D}
  938. option) are case-insensitive.  It is not an error to {\bf undef} an
  939. undefined symbol, nor to {\bf define} a previously-defined one.  An {\bf
  940. ifdef} alone is always {\bf false}{\rm ;\ an} {\bf ifndef} alone is
  941. always {\bf true}{\rm .}
  942. \vskip\baselineskip
  943. X
  944. The name of the file in the {\bf include} directive may optionally be
  945. surrounded by either "" or $<$$>$, both of which are ignored.  If the
  946. name is not an absolute path, it is taken to be relative to the directory
  947. where the file containing the directive is located.  {\it Pcal} is smart
  948. enough to translate {\bf \~{}/} to the user's home directory.
  949. \vskip\baselineskip
  950. X
  951. In addition to pre-processing keywords, {\it pcal} also accepts boolean
  952. expressions in {\bf if\{n}\}def directives.  These expressions consist of
  953. symbol names joined by the boolean operators {\bf !}{\rm ,\ }{\bf \&}{\rm
  954. ,\ }{\bf \^{}}{\rm ,\ and\ } {\bf $|$}{\rm ,} in order of precedence,
  955. high to low.  Parentheses may be used to alter the precedence.  The
  956. synonyms {\bf \&\&}{\rm \ and\ }{\bf $|$$|$} are accepted for {\bf
  957. \&}{\rm \ and\ }{\bf $|$}{\rm .} A symbol name evaluates to {\bf true} if
  958. currently defined, {\bf false} if not; thus:
  959. {\tt
  960. \nofill
  961. X        ifdef A $|$ B $|$ C
  962. \fill}
  963. X
  964. $\ldots$ is {\bf true} if any of the symbols A, B, and C is defined, and:
  965. {\tt
  966. \nofill
  967. X        ifdef A \& B \& C
  968. \fill}
  969. X
  970. $\ldots$ is {\bf true} if they all are.  Note that {\bf ifndef} $<$expr$>$ is
  971. equivalent to {\bf ifdef} !( $<$expr$>$ ).
  972. \vskip\baselineskip
  973. X
  974. {\bf The Moon File}
  975. \vskip\baselineskip
  976. X
  977. If a file of the name {\it .moonXX} (where {\it XX} is the last two
  978. digits of the calendar year) exists in the same directory as the date
  979. file, {\it pcal} uses the information contained within to calculate the
  980. phase of the moon.  If no such file exists, {\it pcal} uses an
  981. approximate algorithm.
  982. \vskip\baselineskip
  983. X
  984. Entries in the moon file must conform to the following syntax;  If the
  985. {\bf --A} option (American date formats, the default) is given:
  986. {\tt
  987. \nofill
  988. X        $<$quarter$>$ $<$month$>$$<$sep$>$$<$day$>$ \{$<$hour$>$$<$sep$>$$<$min$>$\}
  989. \fill}
  990. X
  991. If the {\bf --E} option (European date formats) is given:
  992. {\tt
  993. \nofill
  994. X        $<$quarter$>$ $<$day$>$$<$sep$>$$<$month$>$ \{$<$hour$>$$<$sep$>$$<$min$>$\}
  995. \fill}
  996. X
  997. Where:
  998. {\tt
  999. \nofill
  1000. X        $<$quarter$>$   := "nm", "fq" or "1q", "fm", "3q" or "lq"
  1001. X                        (new moon, first quarter, full moon, last quarter)
  1002. X        $<$hour$>$      := number 0-23 (24-hour clock)
  1003. X        $<$min$>$       := number 0-59
  1004. \fill}
  1005. X
  1006. This file must contain entries for all quarter moons in the year, in
  1007. chronological order; if any errors are encountered, {\it pcal} will
  1008. revert to using its default algorithm.  As in the date file, comments
  1009. start with '\#' and run through end-of-line.
  1010. \vskip\baselineskip
  1011. X
  1012. {\bf Options}
  1013. \vskip\baselineskip
  1014. X
  1015. {\it Pcal} has many options:
  1016. X
  1017. \begin{TPlist}{{\bf --e}}
  1018. \item[{{\bf --e}}] Prints an empty calendar.  Do not print entries from a
  1019. X    {\it .calendar} file.
  1020. \item[{{\bf --f}{\it \ cal}}] Directs {\it pcal} to use the file name
  1021. X    {\it cal} as the input file in place of the default {\it .calendar}
  1022. X    file in the user's home directory (or the directory pointed to by
  1023. X    {\bf PCAL\_DIR}{\rm ).}
  1024. \item[{{\bf --o}{\it \ file} }] Directs {\it pcal} to write the output to
  1025. X    {\it file} instead of to stdout.
  1026. \item[{{\bf --l}}] Causes the output to be in landscape mode (default).
  1027. X    This also resets the x- and y-axis scaling and translation factors to
  1028. X    the defaults for landscape mode.
  1029. \item[{{\bf --p}}] Causes the output to be in portrait mode.  This also
  1030. X    resets the x- and y-axis scaling and translation factors to the
  1031. X    defaults for portrait mode.
  1032. \item[{{\bf --j}}] Causes the Julian date (day of year) to be printed in
  1033. X    each calendar box.
  1034. \item[{{\bf --J}}] Causes the Julian date and the number of days
  1035. X    remaining in the year to be printed in each calendar box.
  1036. \item[{{\bf --m}}] Causes moon icons to be printed on dates corresponding
  1037. X    to new, half, and full moons (the default is that no moons are
  1038. X    printed).
  1039. \item[{{\bf --M}}] Causes moon icons to be printed on all dates (the
  1040. X    default is that no moons are printed).
  1041. \item[{{\bf --b}{\it \ day}{\bf \ $|$\ all} }] Causes all dates falling
  1042. X    on weekday {\it day} to be printed in black;  {\bf --b} all causes
  1043. X    all weekdays to be printed in black.
  1044. \item[{{\bf --g}{\it \ day}{\bf \ $|$\ all} }] Causes all dates falling
  1045. X    on weekday {\it day} to be printed in gray;  {\bf --g} all causes all
  1046. X    weekdays to be printed in gray.
  1047. X    \begin{itemize}
  1048. X    \item[{}] The default for the {\bf --b}{\rm \ and\ }{\bf --g} options is
  1049. X        to print Saturdays and Sundays in gray and other days, unless flagged
  1050. X        as holidays, in black.
  1051. X    \end{itemize}
  1052. \item[{{\bf --O} }] Causes pcal to print ``gray'' dates as outlined
  1053. X    characters.
  1054. \item[{{\bf --F}{\it \ day} }] Selects weekday {\it day} as the first day
  1055. X    of the week.  The given day will appear in the left-most column of
  1056. X    the calendar.
  1057. \item[{{\bf --A}}] Directs {\it pcal} to use American date conventions
  1058. X    {\bf mm/dd\{/yy}\} and {\bf month} dd ) when parsing the date file
  1059. X    (default).
  1060. \item[{{\bf --E}}] Directs {\it pcal} to use European date conventions
  1061. X    {\bf dd/mm\{/yy}\} and {\bf dd} month ) when parsing the date file.
  1062. \item[{{\bf --X}{\it \ xtrans} }] Specifies the x-axis translation value
  1063. X    for positioning the output on the page.
  1064. \item[{{\bf --Y}{\it \ ytrans} }] Specifies the y-axis translation value
  1065. X    for positioning the output on the page.
  1066. \item[{{\bf --x}{\it \ xscale} }] Specifies the x-axis scaling factor for
  1067. X    the calendar size.
  1068. \item[{{\bf --y}{\it \ yscale} }] Specifies the y-axis scaling factor for
  1069. X    the calendar size.
  1070. \item[{{\bf --t}{\it \ title\_font} }] Specifies the name of a font to
  1071. X    use to print the month name and year at the top of the calendar.  For
  1072. X    example, {\bf pcal\ --t\ Times-Roman}{\rm .}
  1073. \item[{{\bf --d}{\it \ day\_font} }] Similar to the {\bf --t} option, but
  1074. X    selects the font used to print the day numbers.
  1075. \item[{{\bf --n}{\it \ text\_font} }] Similar to the {\bf --t} option,
  1076. X    but selects the font used to print the text inside each day and in
  1077. X    the notes block.
  1078. \item[{{\bf --D}{\it \ symbol} }] Defines the named symbol prior to
  1079. X    reading the date file.
  1080. \item[{{\bf --U}{\it \ symbol} }] Un-defines the named symbol prior to
  1081. X    reading the date file.
  1082. \item[{{\bf --L}{\it \ string} }] Causes the accompanying string to be
  1083. X    printed as a left-justified footer.
  1084. \item[{{\bf --C}{\it \ string} }] Causes the accompanying string to be
  1085. X    printed as a centered footer.
  1086. \item[{{\bf --R}{\it \ string} }] Causes the accompanying string to be
  1087. X    printed as a right-justified footer.
  1088. \item[{{\bf --B} }] Causes pcal to leave unused calendar boxes blank
  1089. X    (default is gray).
  1090. \item[{{\bf --w} }] Causes pcal to print a calendar for 12 consecutive
  1091. X    months: 3 rows / 4 columns in landscape mode, 4 rows / 3 columns in
  1092. X    portrait mode.  See the CAVEATS section for details on the use of
  1093. X    this option with other options.
  1094. \item[{{\bf --I}}] Resets all parameters to the program defaults.
  1095. \item[{{\bf --h}}] Causes {\it pcal} to write version information and a
  1096. X    usage message (to stdout) and terminate.
  1097. \end{TPlist}
  1098. X
  1099. Any option which normally takes an argument may be specified without the
  1100. argument in order to reset the value to the program default.  Note that
  1101. while the {\bf --D} option alone clears all the defined symbols, the {\bf
  1102. --U} option alone has no effect.  The {\bf --} (or {\bf --\,--}{\rm \ as\
  1103. per} System V) argument may be used to disambiguate command lines such
  1104. as:
  1105. \begin{itemize}
  1106. \item[{}] {\bf pcal} --t 9 90
  1107. \end{itemize}
  1108. This could be written instead as one of the following:
  1109. \begin{itemize}
  1110. \item[{}] {\bf pcal} --t -- 9 90 \nwl {\bf pcal} --t --\,-- 9 90
  1111. \end{itemize}
  1112. X
  1113. If the environment variable {\bf PCAL\_OPTS} is defined, its contents are
  1114. parsed as a command line.  Flags set via {\bf PCAL\_OPTS} override the
  1115. program defaults, but are overridden by options set via {\bf opt} lines
  1116. in the {\it .calendar} file or explicitly on the command line.
  1117. X
  1118. \shead{CAVEATS}
  1119. The ``workday'' and ``holiday'' keywords are aware of only those holidays
  1120. which have already been flagged at the point where they appear.  For
  1121. example, consider January 1990:
  1122. X
  1123. {\tt\vbox{
  1124. \nofill
  1125. X                                January 1990
  1126. X                             S  M Tu  W Th  F  S
  1127. X                                1  2  3  4  5  6
  1128. X                             7  8  9 10 11 12 13
  1129. X                            14 15 16 17 18 19 20
  1130. X                            21 22 23 24 25 26 27
  1131. X                            28 29 30 31
  1132. \fill}}
  1133. X
  1134. If the {\it .calendar} file looked like this:
  1135. {\tt
  1136. \nofill
  1137. X        workday on\_or\_before all 15        payday
  1138. X        3rd Mon in Jan$\ast$                 MLK day
  1139. \fill}
  1140. X
  1141. then {\it pcal} would mark the 15th as ``payday'' since at that point in
  1142. the {\it .calendar} file it has no way of knowing that January 15th will
  1143. later be flagged as a holiday.  If the two lines were reversed, such that
  1144. the holiday preceded the ``workday'' wildcard, then {\it pcal} would work
  1145. as intended, marking instead the 12th as ``payday''.  Also, beware of
  1146. year boundaries which affect the handling of all of the day wildcard
  1147. keywords.  In general, it is best to place monthly wildcards such as the
  1148. example above at the end of each year to achieve the desired effect.
  1149. \vskip\baselineskip
  1150. X
  1151. When the {\bf --w} and {\bf --p} options are used together, {\it pcal}
  1152. revises the y-scale factor in order to use the entire portrait page;
  1153. therefore, the user should avoid using use the {\bf --y} option when
  1154. using both the {\bf --w} and {\bf --p} options.  Use of the {\bf --w}
  1155. option in any case effectively disables the {\bf --m}{\rm ,\ }{\bf
  1156. --M}{\rm ,\ }{\bf --j}{\rm ,\ and\ } {\bf --J} options.
  1157. X
  1158. \shead{SEE ALSO}
  1159. cal(1)
  1160. X
  1161. \shead{AUTHORS}
  1162. The original PostScript code to generate the calendars was written by
  1163. Patrick Wood (\copyright 1987 by Patrick Wood of Pipeline Associates,
  1164. Inc.), and authorized for modification and redistribution.  The calendar
  1165. file inclusion code was originally written in {\it bs}{\rm (1)} by Bill
  1166. Vogel of AT\&T.  Patrick's original PostScript was modified and enhanced
  1167. several times by others whose names have regrettably been lost.  Ken
  1168. Keirnan of Pacific Bell assembled the original ``C'' version upon which
  1169. this is based; additional modifications and enhancements are the work of
  1170. Joseph P. Larson, Ed Hand, Andrew W. Rogers, Mark Kantrowitz, Joe
  1171. Brownlee, Jamie Zawinski, Bill Hogsett, and Floyd Miller.
  1172. X
  1173. \end{document}
  1174. SHAR_EOF
  1175. chmod 0644 pcal.tex ||
  1176. echo 'restore of pcal.tex failed'
  1177. Wc_c="`wc -c < 'pcal.tex'`"
  1178. test 20982 -eq "$Wc_c" ||
  1179.     echo 'pcal.tex: original size 20982, current size' "$Wc_c"
  1180. fi
  1181. # ============= pcaldefs.h ==============
  1182. if test -f 'pcaldefs.h' -a X"$1" != X"-c"; then
  1183.     echo 'x - skipping pcaldefs.h (File already exists)'
  1184. else
  1185. echo 'x - extracting pcaldefs.h (Text)'
  1186. sed 's/^X//' << 'SHAR_EOF' > 'pcaldefs.h' &&
  1187. /*
  1188. X * pcaldefs.h - definitions for Pcal program
  1189. X *
  1190. X * Revision history:
  1191. X *
  1192. X *    4.0    AWR    03/01/91    Add STDLIB macro for systems which
  1193. X *                    support <stdlib.h>
  1194. X *
  1195. X *        AWR    02/22/91    add definitions for MS-DOS support (as
  1196. X *                    per Floyd Miller)
  1197. X *
  1198. X *        AWR    02/19/91    revise ORD_XXX to support negative
  1199. X *                    ordinals
  1200. X *
  1201. X *                    add definitions for Amiga support (as
  1202. X *                    per Bill Hogsett)
  1203. X *
  1204. X *        AWR    02/06/91    additional defs for expression
  1205. X *                    processing
  1206. X *
  1207. X *        AWR    02/04/91    support "year" as additional month
  1208. X *                    name; use negative numbers for
  1209. X *                    special ordinal codes (reserve
  1210. X *                    positive numbers for ordinals)
  1211. X *
  1212. X *            01/28/91    miscellaneous new constants/macros
  1213. X *
  1214. X *            01/07/91    add FEB_29_OK (cf. enter_day_info())
  1215. X *
  1216. X *    3.0    AWR    12/10/90    support "weekday", "workday",
  1217. X *                    "holiday", et. al.
  1218. X *
  1219. X *        AWR    11/13/90    extracted from pcal.c; added scale and
  1220. X *                    translation support (-x, -y, -X, -Y);
  1221. X *                    added -j, -J flags
  1222. X *
  1223. X */
  1224. X
  1225. /*
  1226. X * System dependencies:
  1227. X */
  1228. X
  1229. #ifdef VMS        /* VMS oddities isolated here */
  1230. X
  1231. #include <ssdef.h>    /* required for trnlog() */
  1232. #include <descrip.h>
  1233. X
  1234. #define HOME_DIR    "SYS$LOGIN"
  1235. #define DATEFILE    "calendar.dat"
  1236. #define MOONFILE    "moonXX.dat"    /* 'XX' replaced with year */
  1237. #define DEFAULT_OUTFILE    "calendar.ps"
  1238. #define START_PATH    '['
  1239. #define END_PATH    ']'
  1240. X
  1241. #define EXIT_SUCCESS    1        /* VMS exit() parameters */
  1242. #define EXIT_FAILURE    3
  1243. X
  1244. #else
  1245. #ifdef AMIGA        /* more oddities for Amiga */
  1246. X
  1247. #include <string.h>
  1248. X
  1249. #define PROTOS                /* compiler accepts prototypes */
  1250. #define STDLIB                /* system has <stdlib.h> */
  1251. #define HOME_DIR    "RAM:"
  1252. #define DATEFILE    "s:calendar.dat"
  1253. #define MOONFILE    "s:.moonXX"    /* 'XX' replaced with year */
  1254. #define DEFAULT_OUTFILE    "RAM:calendar.ps"
  1255. #define START_PATH    '/'
  1256. #define END_PATH    '/'
  1257. X
  1258. #else
  1259. #ifdef DOS        /* even more oddities for MS-DOS */
  1260. X
  1261. #define DATEFILE    "pcal.dat"
  1262. #define MOONFILE    "moonXX.dat"    /* 'XX' replaced with year */
  1263. #define START_PATH    '\\'
  1264. #define END_PATH    '\\'
  1265. #define HOME_DIR    "HOME"
  1266. #define ALT_DATEFILE    "calendar"    /* for backward compatibility */
  1267. X
  1268. #else            /* neither VMS, Amiga, nor MS-DOS - assume Un*x */
  1269. X
  1270. #define UNIXX        /* to distinguish from others (not used yet) */
  1271. X
  1272. #define HOME_DIR    "HOME"
  1273. #define DATEFILE    ".calendar"
  1274. #define ALT_DATEFILE    "calendar"    /* for backward compatibility */
  1275. #define MOONFILE    ".moonXX"    /* 'XX' replaced with year */
  1276. #define ALT_MOONFILE    "moonXX"    /* analogous to ALT_DATEFILE */
  1277. #define START_PATH    '/'
  1278. #define END_PATH    '/'
  1279. X
  1280. #endif
  1281. #endif
  1282. #endif
  1283. X
  1284. /* define OUTFILE to DEFAULT_OUTFILE if defined, otherwise to "" (stdout) */
  1285. X
  1286. #ifdef DEFAULT_OUTFILE
  1287. #define OUTFILE        DEFAULT_OUTFILE
  1288. #else
  1289. #define OUTFILE        ""
  1290. #endif
  1291. X
  1292. /* PROTOS may be defined independently of __STDC__ for compilers which
  1293. X * support function prototypes but are not fully ANSI-compliant
  1294. X */
  1295. X
  1296. #if defined(__STDC__) && ! defined(PROTOS)
  1297. #define PROTOS    
  1298. #endif
  1299. X
  1300. /* STDLIB may be defined independently of __STDC__ for systems which
  1301. X * support <stdlib.h> but are not fully ANSI-compliant
  1302. X */
  1303. X
  1304. #if defined(__STDC__) && ! defined(STDLIB)
  1305. #define STDLIB            /* cf. {no}protos.h */
  1306. #endif
  1307. X
  1308. #ifdef STDLIB            /* include <stdlib.h> if known to exist */
  1309. #include <stdlib.h>
  1310. #endif
  1311. X
  1312. /* EXIT_SUCCESS and EXIT_FAILURE should be defined in <stdlib.h>
  1313. X * (or above if non-standard); define here if necessary
  1314. X */
  1315. X
  1316. #ifndef EXIT_SUCCESS
  1317. #define EXIT_SUCCESS    0
  1318. #endif
  1319. #ifndef EXIT_FAILURE
  1320. #define EXIT_FAILURE    1
  1321. #endif
  1322. X
  1323. /* definition of NULL (if needed) */
  1324. #ifndef NULL
  1325. #define NULL    0
  1326. #endif
  1327. X
  1328. /*
  1329. X * Environment variables (global symbol, logical name on VMS):
  1330. X */
  1331. X
  1332. #define PCAL_OPTS    "PCAL_OPTS"    /* command-line flags */
  1333. #define PCAL_DIR    "PCAL_DIR"    /* calendar file directory */
  1334. X
  1335. /*
  1336. X * Function-like macros:
  1337. X */
  1338. X
  1339. #define FPR        (void)fprintf
  1340. #define PRT        (void)printf
  1341. X
  1342. #define PUTCHAR(_c) \
  1343. X    PRT((_c) == ' ' || isalnum(_c) ? "%c" : "\\%03o" , (_c) & 0377)
  1344. #define PUTSTR(_s)  \
  1345. X    if (1) { char *_p; for (_p = _s; *_p; _p++) PUTCHAR(*_p); } else
  1346. X
  1347. #define IS_LEAP(y)    ((y) % 4 == 0 && ((y) % 100 != 0 || (y) % 400 == 0))
  1348. #define LENGTH_OF(m, y) (month_len[(m)-1] + ((m) == FEB && IS_LEAP(y)))
  1349. #define YEAR_LEN(y)    (IS_LEAP(y) ? 366 : 365)
  1350. #define DAY_OF_YEAR(m, d, y) ((month_off[(m)-1] + ((m) > FEB && IS_LEAP(y))) + d)
  1351. #define OFFSET_OF(m, y) ((month_off[(m)-1] + ((m) > FEB && IS_LEAP(y))) % 7)
  1352. #define FIRST_OF(m, y)    calc_weekday(m, 1, y)
  1353. X
  1354. #define PREV_MONTH(m, y) ((m) == JAN ? DEC : (m) - 1)
  1355. #define PREV_YEAR(m, y)  ((m) == JAN ? (y) - 1 : (y))
  1356. #define NEXT_MONTH(m, y) ((m) == DEC ? JAN : (m) + 1)
  1357. #define NEXT_YEAR(m, y)  ((m) == DEC ? (y) + 1 : (y))
  1358. X
  1359. #define INIT_COLORS    memcpy(day_color, default_color, sizeof(day_color))
  1360. X
  1361. #define P_LASTCHAR(p)    ((p) && *(p) ? (p) + strlen(p) - 1 : NULL)
  1362. #define LASTCHAR(p)    (p)[strlen(p) - 1]
  1363. X
  1364. #define IS_NUMERIC(p)    ((p)[strspn((p), DIGITS)] == '\0')
  1365. #define IS_WILD(w)    ((w) >= WILD_FIRST && (w) <= WILD_LAST)
  1366. X
  1367. #define MAKE_DATE(dt, m, d, y) \
  1368. X    if (1) { (dt).mm = m; (dt).dd = d; (dt).yy = y; } else
  1369. X
  1370. #define ERR(errmsg) \
  1371. X    FPR(stderr, E_ILL_LINE, progname, errmsg, filename, line);
  1372. X
  1373. #ifdef __STDC__
  1374. #define TOLOWER(c)    tolower(c)
  1375. #else
  1376. #define TOLOWER(c)    (isupper(c) ? tolower(c) : (c))
  1377. #endif
  1378. X
  1379. #ifndef isodigit            /* rare */
  1380. #define isodigit(c)    ((c) >= '0' && (c) <= '7')
  1381. #endif
  1382. #ifndef isxdigit            /* ANSI standard */
  1383. #define isxdigit(c) \
  1384. X    (isdigit(c) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F'))
  1385. #endif
  1386. X
  1387. X
  1388. /* preprocessor token codes - cf. get_token(), pcallang.h */
  1389. X
  1390. #define PP_DEFINE     0
  1391. #define PP_ELSE         1
  1392. #define PP_ENDIF     2
  1393. #define PP_IFDEF     3
  1394. #define PP_IFNDEF     4
  1395. #define PP_INCLUDE     5
  1396. #define PP_UNDEF     6
  1397. #define PP_OTHER    -1    /* not pp token */
  1398. X
  1399. /* ordinal number codes - cf. get_ordinal(), pcallang.h */
  1400. X
  1401. #define ORD_NEGNUM    -1    /* negative ordinal (-2nd == next to last) */
  1402. #define ORD_POSNUM     1    /* positive ordinal */
  1403. #define ORD_ODD         2    /* special codes for "odd" and "even" */
  1404. #define ORD_EVEN     3
  1405. #define ORD_ALL         4    /* special code for "all" used as ordinal */
  1406. #define ORD_OTHER     0    /* not ordinal token */
  1407. X
  1408. /* moon phase codes - cf. pcallang.h and moonphas.c */
  1409. X
  1410. #define MOON_NM         0    /* new moon */
  1411. #define MOON_1Q         1    /* first quarter */
  1412. #define MOON_FM          2    /* full moon */
  1413. #define MOON_3Q         3    /* last quarter */
  1414. #define MOON_OTHER    -1    /* unrecognizable */
  1415. X
  1416. /* date type codes - cf. date_type(), get_keywd(), and pcallang.h */
  1417. X
  1418. #define DT_ALL         0    /* "all" keyword" */
  1419. #define DT_NOTE         1    /* "note" keyword */
  1420. #define DT_OPT         2    /* "opt" keyword */
  1421. #define DT_YEAR         3    /* "year" keyword */
  1422. #define DT_MONTH     4    /* name of month */
  1423. #define DT_DATE         5    /* date of form dd/mm{/yy} or mm/dd{/yy} */
  1424. #define DT_EURDATE     6    /* European date of form dd <month> */
  1425. #define DT_ORDINAL     7    /* ordinal (first, 1st, ... last) */
  1426. #define DT_WEEKDAY     8    /* weekday name */
  1427. #define DT_OTHER    -1    /* unrecognizable first token */
  1428. X
  1429. /* preposition token codes - cf. get_prep(), pcallang.h */
  1430. X
  1431. #define PR_BEFORE     0
  1432. #define PR_ON_BEFORE     1
  1433. #define PR_AFTER     2
  1434. #define PR_ON_AFTER     3
  1435. #define PR_OTHER    -1    /* not a preposition */
  1436. X
  1437. X
  1438. /*
  1439. X * Miscellaneous other constants:
  1440. X */
  1441. X
  1442. #define FALSE        0    /* pseudo-Booleans */
  1443. #define TRUE        1
  1444. X
  1445. #define MAX_NESTING    10    /* maximum nesting level for file inclusion */
  1446. X
  1447. #define MAX_PP_SYMS    100    /* number of definable preprocessor symbols */
  1448. #define PP_SYM_UNDEF     -1    /* flag for undefined symbol */
  1449. X
  1450. #define EXPR_ERR    -1    /* expression parsing error */
  1451. X
  1452. #define MIN_YR        1900    /* significant years (calendar limits) */
  1453. #define MAX_YR        9999
  1454. X
  1455. #define CENTURY        1900    /* default century for two-digit years */
  1456. X
  1457. #define JAN         1    /* significant months */
  1458. #define FEB         2
  1459. #define DEC        12
  1460. #define NOT_MONTH    -1    /* not valid month */
  1461. #define ALL_MONTHS     0    /* select all months */
  1462. #define ENTIRE_YEAR    13    /* select entire year as one entity */
  1463. X
  1464. #define SUN         0    /* significant weekdays */
  1465. #define SAT         6
  1466. #define NOT_WEEKDAY    -1    /* not valid weekday */
  1467. X
  1468. #define SCREENWIDTH    72    /* command-line message in usage() */
  1469. X
  1470. #define FEB_29_OK    1    /* if != 0, ignore 2/29 of common year */
  1471. X
  1472. /* wildcards - cf. days[] in pcallang.h and pdatefcn[] in pcal.c */
  1473. X
  1474. #define ANY_DAY         7    /* special - matches any day */
  1475. #define ANY_WEEKDAY     8    /* matches any weekday (including holidays) */
  1476. #define ANY_WORKDAY     9    /* matches any weekday (excluding holidays) */
  1477. #define ANY_HOLIDAY    10    /* matches any holiday */
  1478. #define ANY_NONWEEKDAY    11    /* converses of above three */
  1479. #define ANY_NONWORKDAY    12
  1480. #define ANY_NONHOLIDAY    13
  1481. X
  1482. #define WILD_FIRST    ANY_DAY
  1483. #define WILD_LAST    ANY_NONHOLIDAY
  1484. X
  1485. #define DAY_TEXT    0    /* types of text in data structure */
  1486. #define HOLIDAY_TEXT    1
  1487. #define NOTE_TEXT    2
  1488. X
  1489. #define NOTE_DAY    32    /* dummy day for notes text */
  1490. X
  1491. #define MAX_DATES    366    /* maximum "wildcard" dates */
  1492. X
  1493. #define MAXWORD        100    /* maximum words in date file line */
  1494. #define STRSIZ        200    /* size of misc. strings */
  1495. #define LINSIZ        512    /* size of source line buffer */
  1496. X
  1497. #define MAXARGS        3    /* numeric command-line args */
  1498. X
  1499. #define WHITESPACE    " \t"    /* token delimiters in date file */
  1500. #define DIGITS        "0123456789"
  1501. X
  1502. /* passes where flags may be recognized (cf. get_args(), pcallang.h) */
  1503. #define P_ENV    1    /* parsed from environment variable */
  1504. #define P_CMD1    2    /* parsed in first command-line pass */
  1505. #define P_OPT    4    /* parsed on "opt" lines in date file */
  1506. #define P_CMD2    8    /* parsed in second command-line pass */
  1507. X
  1508. /*
  1509. X * Defaults for calendar layout:
  1510. X */
  1511. X
  1512. #define DAYFONT        "Times-Bold"    /* default font names */
  1513. #define TITLEFONT    "Times-Bold"
  1514. #define NOTESFONT    "Helvetica-Narrow"
  1515. X
  1516. #define LFOOT         ""              /* default foot strings */
  1517. #define CFOOT         ""
  1518. #define RFOOT         ""
  1519. X
  1520. #define LANDSCAPE      90        /* degrees to rotate */
  1521. #define PORTRAIT         0
  1522. #define ROTATE           LANDSCAPE    /* default */
  1523. X
  1524. /* scaling/translation factors based on 8.5 x 11 inch (612 x 792 point) page */
  1525. X
  1526. #define XSVAL_L        "1"        /* scale/translate values (landscape) */
  1527. #define YSVAL_L        "1"
  1528. #define XTVAL_L        "46"        /* (792 - 700) / 2 = 46 */
  1529. #define YTVAL_L        "-120"
  1530. #define XSVAL_P        "0.773"        /* scale/translate values (portrait) */
  1531. #define YSVAL_P        "0.773"        /* 612/792 */
  1532. #define XTVAL_P        "46"
  1533. #define YTVAL_P        "492"        /* 612 - 120 = 492 */
  1534. X
  1535. #if (ROTATE == LANDSCAPE)        /* select appropriate defaults */
  1536. #define XSVAL        XSVAL_L
  1537. #define YSVAL        YSVAL_L
  1538. #define XTVAL        XTVAL_L
  1539. #define YTVAL        YTVAL_L
  1540. #else
  1541. #define XSVAL        XSVAL_P
  1542. #define YSVAL        YSVAL_P
  1543. #define XTVAL        XTVAL_P
  1544. #define YTVAL        YTVAL_P
  1545. #endif
  1546. X
  1547. #define USA_DATES    0        /* date styles */
  1548. #define EUR_DATES    1
  1549. #define DATE_STYLE    USA_DATES    /* default */
  1550. X
  1551. #define FIRST_DAY    SUN        /* first day of logical week */
  1552. X
  1553. #define BLACK        0        /* colors for dates */
  1554. #define GRAY        1
  1555. #define DAY_COLOR    { GRAY, BLACK, BLACK, BLACK, BLACK, BLACK, GRAY }
  1556. X
  1557. #define NO_DATEFILE     0        /* date file (if any) to use */
  1558. #define USER_DATEFILE    1
  1559. #define SYS_DATEFILE    2
  1560. X
  1561. /* values below must be in sync with conditionals[] in pcal.c */
  1562. #define NO_MOONS    0        /* no moon icons */
  1563. #define ALL_MOONS    1        /* moon icon on every day */
  1564. #define SOME_MOONS    2        /* icons on full, half, new moons */
  1565. #define DRAW_MOONS    NO_MOONS    /* default */
  1566. X
  1567. #define NO_JULIANS    0        /* no Julian dates */
  1568. #define ALL_JULIANS    1        /* Julian date + days left */
  1569. #define SOME_JULIANS    2        /* just Julian dates */
  1570. #define JULIAN_DATES    NO_JULIANS    /* default: none */
  1571. X
  1572. /*
  1573. X * Global typedef declarations for data structure (cf. readfile.c)
  1574. X */
  1575. X
  1576. /*
  1577. X * The internal data structure consists of a series of linked lists as 
  1578. X * pictured below (for clarity, only one instance of each node is shown):
  1579. X *
  1580. X *
  1581. X * head
  1582. X *  |
  1583. X *  |        year_info
  1584. X *  |    -----------------           month_info
  1585. X *   -->| year            |       -----------------            day_info
  1586. X *      | month_info*[0]  |----->| holidays        |       ----------------
  1587. X *      |   ...           |      | day_info*[0]    |----->| is_holiday     |
  1588. X *      | month_info*[11] |--->  |   ...           |      | text_string*   |--->
  1589. X *      | next year_info* |--    | day_info*[30]   |--->  | next day_info* |-- 
  1590. X *       -----------------   |   | day_info*[NOTE] |--->   ----------------   |
  1591. X *                           |    -----------------                           |
  1592. X *                           |                                                |
  1593. X *             ...        <--                                     ...      <--
  1594. X *
  1595. X * 
  1596. X * Each year_info node consists of the year, 12 pointers (Jan .. Dec) to
  1597. X * month_info nodes, and a pointer to the next year_info node in the chain.
  1598. X * (The year_info chain is maintained in ascending order by year.)
  1599. X *
  1600. X * Each month_info node consists of a bitmap of the holidays for that month, 
  1601. X * a pointer to the day_info chain for all 31 possible days of the month, and
  1602. X * an additional pointer to the day_info chain for the "Notes" pseudo-day. 
  1603. X * (A day_info chain is a linked list of all the text entries for a given
  1604. X * day, in the order in which they were encountered in the date file.)
  1605. X *
  1606. X * Each day_info node consists of a flag indicating whether the associated
  1607. X * text string is holiday or non-holiday text (any given day may have both),
  1608. X * a pointer to the text string itself, and a pointer to the next day_info 
  1609. X * node in the chain.
  1610. X *
  1611. X */
  1612. X
  1613. typedef struct d_i {
  1614. X    int is_holiday;
  1615. X    char *text;
  1616. X    struct d_i *next;
  1617. X    } day_info;
  1618. X
  1619. typedef struct m_i {
  1620. X    unsigned long holidays;
  1621. X    day_info *day[32];    /* including NOTE_DAY */
  1622. X    } month_info;
  1623. X
  1624. typedef struct y_i {
  1625. X    int year;
  1626. X    month_info *month[12];
  1627. X    struct y_i *next;
  1628. X    } year_info;
  1629. X
  1630. /*
  1631. X * Global typedef declarations for keyword descriptors (cf. pcallang.h)
  1632. X */
  1633. X
  1634. typedef struct {
  1635. X    char *name;
  1636. X    int   code;
  1637. X    } KWD;
  1638. X
  1639. typedef struct {
  1640. X    char *name;
  1641. X    int   code;
  1642. X    int   value;
  1643. X    } KWD_O;        /* keyword plus ordinal value */
  1644. X
  1645. typedef struct {
  1646. X    char *name;
  1647. X    int   code;
  1648. #ifdef PROTOS
  1649. X    int (*pfcn)(char *);
  1650. #else
  1651. X    int (*pfcn)();
  1652. #endif
  1653. X    } KWD_F;        /* keyword plus dispatch function */
  1654. X
  1655. /*
  1656. X * Global typedef declaration for date structure (cf. parse_ord())
  1657. X */
  1658. X
  1659. typedef struct {
  1660. X    int mm;
  1661. X    int dd;
  1662. X    int yy;
  1663. } DATE;
  1664. X
  1665. /* 
  1666. X * Global typedef declaration for flag usage struct (cf. pcallang.h, get_args())
  1667. X */
  1668. X
  1669. typedef struct {
  1670. X    char flag;        /* name of flag */
  1671. X    char has_arg;        /* TRUE if flag takes (optional) arg */
  1672. X    char passes;        /* "or" of P_xxx for relevant passes */
  1673. X    } FLAG_USAGE;
  1674. X
  1675. /*
  1676. X * Global typedef declarations for usage message (cf. pcallang.h, usage())
  1677. X */
  1678. X
  1679. typedef struct {
  1680. X    char flag;        /* name of flag */
  1681. X    char *meta;        /* metaname for argument (if any) */
  1682. X    char *text;        /* associated text */
  1683. X    char *def;        /* default value (if any) */
  1684. X    } FLAG_MSG;
  1685. X
  1686. typedef struct {
  1687. X    char *desc;        /* description of param */
  1688. X    char *text;        /* associated text */
  1689. X    } PARAM_MSG;
  1690. X
  1691. typedef char *DATE_MSG;        /* date file syntax message */
  1692. X
  1693. SHAR_EOF
  1694. chmod 0666 pcaldefs.h ||
  1695. echo 'restore of pcaldefs.h failed'
  1696. Wc_c="`wc -c < 'pcaldefs.h'`"
  1697. test 14453 -eq "$Wc_c" ||
  1698.     echo 'pcaldefs.h: original size 14453, current size' "$Wc_c"
  1699. fi
  1700. # ============= pcalglob.h ==============
  1701. if test -f 'pcalglob.h' -a X"$1" != X"-c"; then
  1702.     echo 'x - skipping pcalglob.h (File already exists)'
  1703. else
  1704. echo 'x - extracting pcalglob.h (Text)'
  1705. sed 's/^X//' << 'SHAR_EOF' > 'pcalglob.h' &&
  1706. /*
  1707. X * pcalglob.h - definitions and declarations of globals used throughout Pcal
  1708. X *
  1709. X * Revision history:
  1710. X *
  1711. X *    4.0    AWR    01/28/91    Added support for -b and -w flags
  1712. X *
  1713. X *            01/15/91    Extracted from pcal.c
  1714. X *
  1715. X */
  1716. X
  1717. #ifdef PROTOS
  1718. #include "protos.h"
  1719. #else
  1720. #include "noprotos.h"
  1721. #endif
  1722. X
  1723. /*
  1724. X * Definitions and/or declarations of globals
  1725. X */
  1726. X
  1727. #ifdef MAIN_MODULE
  1728. X
  1729. /*
  1730. X * Misc. globals
  1731. X */
  1732. X
  1733. year_info *head = NULL;        /* head of internal data structure */
  1734. int curr_year;            /* current default year for date file entries */
  1735. char *words[MAXWORD];        /* maximum number of words per date file line */
  1736. char lbuf[LINSIZ];        /* date file source line buffer */
  1737. char progname[STRSIZ];        /* program name (for error messages) */
  1738. char version[20];        /* program version (for info messages) */
  1739. X
  1740. /* lengths and offsets of months in common year */
  1741. char month_len[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
  1742. short month_off[12] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
  1743. X
  1744. #ifdef PROTOS
  1745. int (*pdatefcn[])(int, int, int) = {
  1746. #else
  1747. int (*pdatefcn[])() = {
  1748. #endif
  1749. X    is_anyday, is_weekday, is_workday, is_holiday, not_weekday,
  1750. X    not_workday, not_holiday };
  1751. X
  1752. /*
  1753. X * Default values for command-line options:
  1754. X */
  1755. X
  1756. char default_color[] = DAY_COLOR;     /* -b, -g */
  1757. char day_color[7];
  1758. X
  1759. int datefile_type = SYS_DATEFILE;    /* -e, -f */
  1760. char datefile[STRSIZ] = "";
  1761. X
  1762. int rotate = ROTATE;            /* -l, -p */
  1763. X
  1764. int draw_moons = DRAW_MOONS;        /* -m, -M */
  1765. X
  1766. char dayfont[STRSIZ] = DAYFONT;        /* -d, -t, -n */
  1767. char titlefont[STRSIZ] = TITLEFONT;
  1768. char notesfont[STRSIZ] = NOTESFONT;
  1769. X
  1770. char lfoot[STRSIZ] = LFOOT;             /* -L, -C, -R */
  1771. char cfoot[STRSIZ] = CFOOT;
  1772. char rfoot[STRSIZ] = RFOOT;
  1773. X
  1774. int first_day_of_week = FIRST_DAY;    /* -F */
  1775. X
  1776. int date_style = DATE_STYLE;        /* -A, -E */
  1777. X
  1778. char outfile[STRSIZ] = OUTFILE;        /* -o */
  1779. X
  1780. char xsval[12] = XSVAL;            /* -x, -y, -X, -Y */
  1781. char ysval[12] = YSVAL;
  1782. char xtval[12] = XTVAL;
  1783. char ytval[12] = YTVAL;
  1784. X
  1785. int julian_dates = JULIAN_DATES;    /* -j */
  1786. X
  1787. int do_whole_year = FALSE;        /* -w */
  1788. X
  1789. int blank_boxes = FALSE;        /* -B */
  1790. X
  1791. int outline_nums = FALSE;        /* -O */
  1792. X
  1793. #else
  1794. X
  1795. /*
  1796. X * Misc. globals
  1797. X */
  1798. X
  1799. extern year_info *head;        /* head of internal data structure */
  1800. extern int curr_year;        /* current default year for date file entries */
  1801. extern char *words[];        /* maximum number of words per date file line */
  1802. extern char lbuf[];        /* date file source line buffer */
  1803. extern char progname[];        /* program name (for error messages) */
  1804. extern char version[];        /* program version (for info messages) */
  1805. X
  1806. /* lengths and offsets of months in common year */
  1807. extern char month_len[];
  1808. extern short month_off[];
  1809. X
  1810. /* dispatch functions and table for wildcard processing */
  1811. extern int (*pdatefcn[])(); 
  1812. X
  1813. /*
  1814. X * Default values for command-line options:
  1815. X */
  1816. X
  1817. extern char default_color[];         /* -b, -g */
  1818. extern char day_color[];
  1819. X
  1820. extern int datefile_type;        /* -e, -f */
  1821. extern char datefile[];
  1822. X
  1823. extern int rotate;            /* -l, -p */
  1824. X
  1825. extern int draw_moons;            /* -m, -M */
  1826. X
  1827. extern char dayfont[];            /* -d, -t, -n */
  1828. extern char titlefont[];
  1829. extern char notesfont[];
  1830. X
  1831. extern char lfoot[];            /* -L, -C, -R */
  1832. extern char cfoot[];
  1833. extern char rfoot[];
  1834. X
  1835. extern int first_day_of_week;        /* -F */
  1836. X
  1837. extern int date_style;            /* -A, -E */
  1838. X
  1839. extern char outfile[];            /* -o */
  1840. X
  1841. extern char xsval[];            /* -x, -y, -X, -Y */
  1842. extern char ysval[];
  1843. extern char xtval[];
  1844. extern char ytval[];
  1845. X
  1846. extern int julian_dates;        /* -j */
  1847. X
  1848. extern int do_whole_year;        /* -w */
  1849. X
  1850. extern int blank_boxes;            /* -B */
  1851. X
  1852. extern int outline_nums;        /* -O */
  1853. X
  1854. #endif
  1855. X
  1856. SHAR_EOF
  1857. chmod 0666 pcalglob.h ||
  1858. echo 'restore of pcalglob.h failed'
  1859. Wc_c="`wc -c < 'pcalglob.h'`"
  1860. test 3493 -eq "$Wc_c" ||
  1861.     echo 'pcalglob.h: original size 3493, current size' "$Wc_c"
  1862. fi
  1863. true || echo 'restore of pcalinit.c failed'
  1864. echo End of part 3, continue with part 4
  1865. exit 0
  1866.