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

  1. From: jbr0@cbnews.att.com (joseph.a.brownlee)
  2. Newsgroups: alt.sources
  3. Subject: Pcal v4.0, part 1 of 5
  4. Message-ID: <1991Mar14.124402.9081@cbnews.att.com>
  5. Date: 14 Mar 91 12:44:02 GMT
  6.  
  7. This is "pcal", the Postscript calendar program, version 4.0.
  8.  
  9. The major version number change reflects several new features, a complete
  10. re-work of the source code, and support for MS-DOS and the Amiga in addition
  11. to UNIX and VMS.
  12.  
  13. Normally, I post the list of changes from the ReadMe file, but they are so
  14. extensive that I will only give a digest here.  The ReadMe is the first file
  15. in the distribution; see it for further details.  Changes include:
  16.  
  17.     .    Break-up of pcal.c into a suite of source files.
  18.     .    ANSI function prototypes are included
  19.     .    All calendar calculations are done in C rather than Postscript
  20.     .    Enlarged the numbers for the "small" calendars
  21.     .    Supports whole-year calendars on a single page
  22.     .    Ability to leave usued boxes blank (rather than gray)
  23.     .    May select outlined numbers rather than "greyed"
  24.     .    "Pre-processor" now supports boolean operators
  25.     .    Support for "every other week" type events
  26.     .    May specify ordinal dates relative to the year (i.e. 100th day of year)
  27.     .    May specify dates relative to the end of a month or year
  28.     .    Date file supports C-style backslash escapes
  29.     .    Phase of moon datae may be specified using a file
  30.     .    Search path for date file now includes same directory as the executable
  31.     .    Several bug fixes
  32.  
  33. Pcal 4.0 has been more of a collaborative effort than usual.  The team included
  34. Richard Dyson doing the VMS support files, Bill Hogsett doing the Amiga port,
  35. Floyd Miller doing the MS-DOS port, and Andrew Rogers who did the lion's share
  36. of the programming and integration work.  Thanks one and all for your help.
  37.  
  38. Although they probably wouldn't recognize the current version, countless
  39. others worked on Pcal long before any of us ever heard of it; see the
  40. Orig.ReadMe file and topline comments in pcal.c.
  41.  
  42. Enjoy!
  43.  
  44.    -      _   Joe Brownlee, Analysts International Corporation @ AT&T Bell Labs
  45.   /_\  @ / `  471 E Broad St, Suite 1610, Columbus, Ohio 43215   (614) 860-7461
  46.  /   \ | \_,  E-mail: jbr@cblph.att.com     Who pays attention to what _I_ say?
  47.  "Scotty, we need warp drive in 3 minutes or we're all dead!" --- James T. Kirk
  48.  
  49. ------------------------------ 8< cut here >8 ----------------------------------
  50. #!/bin/sh
  51. # This is a shell archive (produced by shar 3.49)
  52. # To extract the files from this archive, save it to a file, remove
  53. # everything above the "!/bin/sh" line above, and type "sh file_name".
  54. #
  55. # existing files will NOT be overwritten unless -c is specified
  56. #
  57. # This shar contains:
  58. # length  mode       name
  59. # ------ ---------- ------------------------------------------
  60. #   6728 -rw-r--r-- ReadMe
  61. #   2893 -rw-r--r-- Make_Pcal.com
  62. #   1155 -rw-r--r-- Makefile
  63. #   1010 -rw-r--r-- Makefile.Amiga
  64. #   1023 -rw-r--r-- Makefile.DOS
  65. #   2238 -rw-r--r-- Makefile.VMS
  66. #    984 -rw-r--r-- Orig.ReadMe
  67. #  22115 -rw-r--r-- Pcal.hlp
  68. #    670 -rw-r--r-- SetUp.com
  69. #     31 -rw-r--r-- VaxCtrl.opt
  70. #   7374 -rw-rw-rw- calendar
  71. #   8311 -rw-rw-rw- exprpars.c
  72. #   3095 -rw-rw-rw- moon91
  73. #   9127 -rw-rw-rw- moonphas.c
  74. #   1978 -rw-rw-rw- noprotos.h
  75. #  33851 -rw-rw-rw- pcal.c
  76. #  17774 -rw-r--r-- pcal.man
  77. #  20982 -rw-r--r-- pcal.tex
  78. #  14453 -rw-rw-rw- pcaldefs.h
  79. #   3493 -rw-rw-rw- pcalglob.h
  80. #   3975 -rw-r--r-- pcalinit.c
  81. #  13415 -rw-rw-rw- pcalinit.ps
  82. #  23965 -rw-rw-rw- pcallang.h
  83. #  14737 -rw-r--r-- pcalutil.c
  84. #   3428 -rw-rw-rw- protos.h
  85. #  27599 -rw-r--r-- readfile.c
  86. #   9889 -rw-r--r-- writefil.c
  87. #
  88. # ============= ReadMe ==============
  89. if test -f 'ReadMe' -a X"$1" != X"-c"; then
  90.     echo 'x - skipping ReadMe (File already exists)'
  91. else
  92. echo 'x - extracting ReadMe (Text)'
  93. sed 's/^X//' << 'SHAR_EOF' > 'ReadMe' &&
  94. "Pcal" Version 4.0
  95. X
  96. This is yet another version of "Pcal", the PostScript calendar program.  Since
  97. the changes to program structure and functionality were so extensive, it has
  98. been given a new release number.
  99. X
  100. Major changes:
  101. X
  102. X    1) Of interest to Pcal hackers and installers:
  103. X
  104. X      .    You will notice several new files.  Pcal was getting so large that
  105. X    it was in imminent danger of breaking some mailers; consequently
  106. X    it has been split into six .c files and three new .h files:
  107. X
  108. X        pcal.c        main, arg parsing, usage message
  109. X        pcalutil.c    misc. utility routines
  110. X        readfile.c    reading and parsing of date file
  111. X        writefil.c    output of PostScript code
  112. X        moonphas.c*    phase-of-moon calculations
  113. X        exprpars.c*    parse Boolean expressions in "if{n}def"
  114. X
  115. X        pcalglob.h    global variables
  116. X        protos.h*    ANSI-style function prototypes
  117. X        noprotos.h*    K&R-style function declarations
  118. X
  119. X        * all-new for v4.0
  120. X
  121. X    (Note that encapsulating all of the PostScript output routines into
  122. X    a single file, writefil.c, facilitates porting PostScript to other
  123. X    typesetting packages, e.g., troff.  Any takers?)
  124. X
  125. X      . All of the routines now have ANSI function prototypes in addition
  126. X    to the older K&R-style declarations, selected automagically by a
  127. X    macro PROTOS which is defined whenever __STDC__ is present (or which
  128. X    may be explicitly defined for compilers which accept prototypes but
  129. X    are not fully ANSI-conformant).  Similarly, a macro STDLIB controls
  130. X    inclusion of <stdlib.h>, an ANSI standard header which exists on
  131. X    some (but not all) non-ANSI systems.
  132. X
  133. X      .    Pcal now runs on the Commodore Amiga and under MS-DOS, thanks to the
  134. X    respective efforts of Bill Hogsett and Floyd Miller.
  135. X
  136. X      . All of the calendar calculations are now performed in pcal.c; the
  137. X    PostScript code merely prints what it is told to.  PostScript
  138. X    output now contains a comment identifying the version of Pcal and
  139. X    the name of the date file (if any) used.
  140. X
  141. X      .    The title inside the "notes" box has been moved from pcalinit.ps to
  142. X    pcallang.h so it may be easily translated to languages other than
  143. X    English.
  144. X
  145. X      .    The month/year title and dates in the small calendars have been
  146. X    enlarged (from 48 points to 60 and 54, respectively).  The font sizes
  147. X    for the small, medium, and large calendars are now in arrays to
  148. X    facilitate further tweaking.
  149. X
  150. X      .    Pcalinit strips trailing comments (and the spaces preceding them) and
  151. X    allows <FF> in the input text.  The logic of pcalinit.c has been
  152. X    revised for clarity, and the source has been documented.  An optional
  153. X    parameter has been added to allow the user to specify the name of
  154. X    the string array in the output file.
  155. X
  156. X
  157. X    2) New command-line options:
  158. X
  159. X      .    The "-w" option has been added to print calendars for a whole year
  160. X    on a single page.  This option effectively disables the -M|m (moons)
  161. X    and -J|j (Julian dates) flags, and also suppresses the text in the
  162. X    calendar boxes.  The numeric parameters work slightly differently:
  163. X
  164. X        yy        print Jan/yy .. Dec/yy
  165. X        mm yy        print 12 months starting with mm/yy
  166. X        mm yy n        print n months (rounded up to multiple of 12)
  167. X                    starting with mm/yy
  168. X        (default)    print Jan .. Dec of current year
  169. X
  170. X    Note that "-w" in conjunction with "-p" overrides any Y-scale factor
  171. X    (default or set with "-y") in order to use the full portrait page.
  172. X
  173. X      .    The "-B" option has been added; this directs Pcal to leave unused
  174. X    calendar boxes blank.
  175. X
  176. X      .    The "-O" option has been added; this directs Pcal to print all "gray"
  177. X    dates as outlined characters.
  178. X
  179. X
  180. X    3) New date file functionality:
  181. X
  182. X      .    The Pcal "preprocessor" now accepts Boolean expressions in "if{n}def"
  183. X    directives.  These expressions consist of symbol names joined
  184. X    by Boolean operators !, &, ^, and | (in order of precedence, high
  185. X    to low).  Parentheses may be used to alter the precedence; && and
  186. X    || are accepted as synonyms for & and |.  A symbol name evaluates
  187. X    to TRUE if currently defined, FALSE if not; thus, "ifdef A | B | C"
  188. X    is TRUE if any of the symbols A, B, and C is defined, and
  189. X    "ifdef A & B & C" is true if they all are.
  190. X
  191. X    "ifndef <expr>" is equivalent to "ifdef !( <expr> )".
  192. X
  193. X      .    Pcal supports "odd" and "even" - meaning "alternate, starting with
  194. X    first" and "alternate, starting with second" - as ordinals and "year"
  195. X    to refer to the entire year as an entity (as opposed to "all", which
  196. X    refers to each individual month).  Thus "odd Thursdays in year" expands
  197. X    to 1/3/91, 1/17, 1/31, 2/14, 2/28... while "odd Thursdays in all"
  198. X    expands to 1/3, 1/17, 1/31, 2/7, 2/21... .
  199. X
  200. X      .    Pcal supports all ordinal numbers (e.g., "100th day of year"),
  201. X    although only "first" .. "fifth" may be spelled out (as before).
  202. X    It even supports negative ordinals; "-2nd" means "next to last".
  203. X
  204. X      .    Pcal now allows C-style escape sequences ('\' followed by a character,
  205. X    1-3 octal digits, or 'x' followed by 1-2 hexadecimal digits) in the
  206. X    date file.  Escaped whitespace (including <NL>) and the standard
  207. X    ANSI character escapes ('\a', '\b', '\f', '\n', '\r', '\t', '\v')
  208. X    are all replaced by a single blank.
  209. X
  210. X      .    Pcal now reads phase-of-the-moon information from file .moonXX (where
  211. X    XX is the last two digits in the current year) if such a file exists
  212. X    in the same directory as the .calendar file.  If no such file exists,
  213. X    Pcal calculates the approximate phase for each date (as before).  (The
  214. X    file name may vary between systems.)
  215. X
  216. X
  217. X    4) Other new functionality:
  218. X
  219. X      . If Pcal cannot find the date file in the standard search places
  220. X    (PCAL_DIR and HOME), it makes one last attempt to find it in the
  221. X    directory where the Pcal executable resides.
  222. X
  223. X
  224. X    5) Bug fixes:
  225. X
  226. X      .    "1 << n" has been rewritten as "1L << n" throughout; this caused 
  227. X    problems on some machines where "int" is 16 bits.
  228. X
  229. X      .    Fixed loadwords() to correctly handle single- and double-quoted
  230. X    strings, including those containing escaped quotes.
  231. X
  232. X      .    In response to popular demand, revised enter_day_info() to silently 
  233. X    ignore Feb 29 of common years (this may be disabled by setting
  234. X    FEB_29_OK to 0 in pcaldefs.h).
  235. X
  236. X      .    The -f flag works correctly in conjunction with PCAL_DIR.
  237. X
  238. X      .    Pcalinit correctly escapes backslashes and double quotes.
  239. X
  240. X
  241. X
  242. Credit where credit is due:
  243. X
  244. Pcal 4.0 has been more of a collaborative effort than usual.  The following
  245. people contributed in some way to its final form:
  246. X
  247. X    Overall coordinator, man page, useful ideas:    Joe Brownlee
  248. X    VMS support:                    Richard Dyson
  249. X    Amiga support, prototypes:            Bill Hogsett
  250. X    DOS support, executable path search        Floyd Miller
  251. X    Other C and PostScript code:            Andrew Rogers
  252. Although they probably wouldn't recognize the current version, countless
  253. others worked on Pcal long before any of us ever heard of it; see the
  254. Orig.ReadMe file and topline comments in pcal.c.
  255. SHAR_EOF
  256. chmod 0644 ReadMe ||
  257. echo 'restore of ReadMe failed'
  258. Wc_c="`wc -c < 'ReadMe'`"
  259. test 6728 -eq "$Wc_c" ||
  260.     echo 'ReadMe: original size 6728, current size' "$Wc_c"
  261. fi
  262. # ============= Make_Pcal.com ==============
  263. if test -f 'Make_Pcal.com' -a X"$1" != X"-c"; then
  264.     echo 'x - skipping Make_Pcal.com (File already exists)'
  265. else
  266. echo 'x - extracting Make_Pcal.com (Text)'
  267. sed 's/^X//' << 'SHAR_EOF' > 'Make_Pcal.com' &&
  268. $ If F$Mode () .eqs. "INTERACTIVE"
  269. $   Then
  270. $       VERIFY = F$Verify (0)
  271. $   Else
  272. $       VERIFY = F$Verify (1)
  273. $ EndIf
  274. $!========================================================================
  275. $!
  276. $!  Name      : MAKE_PCAL.COM
  277. $!
  278. $!  Purpose   : Compile and Link pcal under VMS
  279. $!
  280. $!  Arguments : P1/P2 = DATE_DEBUG: compile with DEBUG info
  281. $!              P1/P2 = LINK : link only
  282. $!
  283. $!  Created: 13-SEP-1990 Rick Dyson
  284. $!  Updated: 20-SEP-1990 pcal v2.3
  285. $!  Updated:  2-OCT-1990 pcal v2.4
  286. $!  Updated:  8-OCT-1990 pcal v2.5
  287. $!  Updated:  2-JAN-1991 pcal v3.0
  288. $!  Updated: 15-FEB-1991 pcal v3.1
  289. $!  Updated:  1-MAR-1991 pcal v4.0
  290. $!
  291. $!========================================================================
  292. $   THIS_PATH = F$Element (0, "]", F$Environment ("PROCEDURE")) + "]"
  293. $   Set Default 'THIS_PATH'
  294. $   On Error     Then GoTo FINISH
  295. $   On Control_Y Then GoTo FINISH
  296. $   If P1 .eqs. "DATE_DEBUG" .or. P2 .eqs. "DATE_DEBUG"
  297. $       Then
  298. $           CC      := Cc /Debug /NoOptimize /NoList /Define = (VMS)
  299. $           LINK    := Link /Debug /NoMap
  300. $       Else
  301. $           CC      := Cc /NoList /Define = (VMS)
  302. $           LINK    := Link /NoMap
  303. $   EndIf
  304. $   If P1 .eqs. "LINK" .or. P2 .eqs. "LINK" Then GoTo LINK
  305. $   Write Sys$Output "Making pcalinit..."
  306. $   CC PCALINIT
  307. $   LINK PCALINIT,VAXCRTL.OPT /Option
  308. $   PCALINIT := $ 'THIS_PATH'PCALINIT.EXE
  309. $   Write Sys$Output "Executing pcalinit..."
  310. $   PCALINIT PCALINIT.PS PCALINIT.H
  311. $   Write Sys$Output "Compiling pcal programs..."
  312. $   CC PCAL.C
  313. $   CC EXPRPARS.C
  314. $   CC MOONPHAS.C
  315. $   CC PCALUTIL.C
  316. $   CC READFILE.C
  317. $   CC WRITEFIL.C
  318. $LINK:
  319. $   Write Sys$Output "Linking pcal..."
  320. $   LINK PCAL,EXPRPARS,MOONPHAS,PCALUTIL,READFILE,WRITEFIL,VAXCRTL.OPT /Opt
  321. $EXIT:
  322. $   If .not. $Status Then GoTo FINISH
  323. $   Set NoOn
  324. $   Set Protection = Owner:RWED *.OBJ;*,PCAL.EXE;-1,PCALINIT.EXE
  325. $   Delete /Log /NoConfirm *.OBJ;,PCALINIT.EXE;
  326. $   Purge /Log /NoConfirm PCAL.EXE
  327. $   If F$Search ("PCAL.HLB") .eqs. ""
  328. $       Then
  329. $           Write Sys$Output "Creating a help library for Pcal..."
  330. $           Library /Log /Help /Create PCAL PCAL
  331. $       Else
  332. $           Write Sys$Output "Updating help library for Pcal..."
  333. $           Library /Log /Help PCAL PCAL
  334. $   EndIf
  335. $   Set File /Truncate PCAL.HLB
  336. $   LIB = "Hlp$Library"
  337. $   X = F$Trnlnm (LIB, "Lnm$Process")
  338. $   If X .eqs. "" Then GoTo INSERT
  339. $   If X .eqs. "''THIS_PATH'PCAL.HLB" Then GoTo FINISH
  340. $   BASE = LIB + "_"
  341. $   N = 1
  342. $NEXTLIB:
  343. $   LIB := 'BASE''N'
  344. $   X = F$Trnlnm (LIB, "Lnm$Process")
  345. $   If X .eqs. "" Then GoTo INSERT
  346. $   If X .eqs. "''THIS_PATH'PCAL.HLB" Then GoTo FINISH
  347. $   N = N + 1
  348. $   GoTo NEXTLIB
  349. $INSERT:
  350. $   Define 'LIB' 'THIS_PATH'PCAL.HLB
  351. $FINISH:
  352. $   Set Protection = Owner:RWED CALENDAR.,MOON91.
  353. $   Rename CALENDAR. SAMPLE_CALENDAR.DAT
  354. $   Rename MOON91. MOON91.DAT
  355. $   Set Protection = (S:RWE, O:RWE, G:RE, W:RE) *.*
  356. $   If VERIFY Then Set Verify
  357. $   Exit
  358. SHAR_EOF
  359. chmod 0644 Make_Pcal.com ||
  360. echo 'restore of Make_Pcal.com failed'
  361. Wc_c="`wc -c < 'Make_Pcal.com'`"
  362. test 2893 -eq "$Wc_c" ||
  363.     echo 'Make_Pcal.com: original size 2893, current size' "$Wc_c"
  364. fi
  365. # ============= Makefile ==============
  366. if test -f 'Makefile' -a X"$1" != X"-c"; then
  367.     echo 'x - skipping Makefile (File already exists)'
  368. else
  369. echo 'x - extracting Makefile (Text)'
  370. sed 's/^X//' << 'SHAR_EOF' > 'Makefile' &&
  371. #
  372. # Makefile for Pcal v4.0 under UNIX
  373. #
  374. X
  375. # Set the configuration variables below to taste.
  376. X
  377. CC    = /bin/cc
  378. MANDIR    = /usr/man
  379. COPTS    =
  380. OBJECTS = pcal.o exprpars.o moonphas.o pcalutil.o readfile.o writefil.o
  381. X
  382. pcal:    $(OBJECTS)
  383. X    $(CC) $(LDFLAGS) -o pcal $(OBJECTS)
  384. X    @ echo "Build of pcal complete"
  385. X
  386. exprpars.o:    exprpars.c pcaldefs.h
  387. X    $(CC) $(CFLAGS) $(COPTS) -c exprpars.c
  388. X
  389. moonphas.o:    moonphas.c pcaldefs.h pcalglob.h
  390. X    $(CC) $(CFLAGS) $(COPTS) -c moonphas.c
  391. X
  392. pcal.o:        pcal.c pcaldefs.h pcalglob.h pcallang.h
  393. X    $(CC) $(CFLAGS) $(COPTS) -c pcal.c
  394. X
  395. pcalutil.o:    pcalutil.c pcaldefs.h pcalglob.h pcallang.h
  396. X    $(CC) $(CFLAGS) $(COPTS) -c pcalutil.c
  397. X
  398. readfile.o:    readfile.c pcaldefs.h pcalglob.h pcallang.h
  399. X    $(CC) $(CFLAGS) $(COPTS) -c readfile.c
  400. X
  401. writefil.o:    writefil.c pcaldefs.h pcalglob.h pcallang.h pcalinit.h
  402. X    $(CC) $(CFLAGS) $(COPTS) -c writefil.c
  403. X
  404. pcalinit: pcalinit.c
  405. X    $(CC) $(CFLAGS) $(LDFLAGS) $(COPTS) -o pcalinit pcalinit.c
  406. X
  407. pcalinit.h: pcalinit pcalinit.ps
  408. X    pcalinit pcalinit.ps pcalinit.h
  409. X
  410. pcalglob.h: protos.h noprotos.h
  411. X
  412. clean:
  413. X    rm -f $(OBJECTS) pcal pcalinit pcalinit.h
  414. X
  415. man:    pcal.man
  416. X    nroff -man pcal.man > pcal.1
  417. X    pack pcal.1
  418. #    mv pcal.1.z $(MANDIR)
  419. SHAR_EOF
  420. chmod 0644 Makefile ||
  421. echo 'restore of Makefile failed'
  422. Wc_c="`wc -c < 'Makefile'`"
  423. test 1155 -eq "$Wc_c" ||
  424.     echo 'Makefile: original size 1155, current size' "$Wc_c"
  425. fi
  426. # ============= Makefile.Amiga ==============
  427. if test -f 'Makefile.Amiga' -a X"$1" != X"-c"; then
  428.     echo 'x - skipping Makefile.Amiga (File already exists)'
  429. else
  430. echo 'x - extracting Makefile.Amiga (Text)'
  431. sed 's/^X//' << 'SHAR_EOF' > 'Makefile.Amiga' &&
  432. #   Makefile for the Amiga.
  433. #
  434. #   Set the configuration variables below to taste.
  435. X
  436. CC    = lc:lc
  437. LDFLAGS = -cufirst -v -d0 -m3s -O
  438. OBJECTS = pcal.o exprpars.o moonphas.o pcalutil.o readfile.o writefil.o
  439. X
  440. pcal:    $(OBJECTS)
  441. X    blink from lib:c.o $(OBJECTS) to pcal lib lib:lcm.lib lib:lc.lib SC SD VERBOSE ND
  442. X    @ echo "+ Build of pcal complete!"
  443. X
  444. exprpars.o:    exprpars.c pcaldefs.h
  445. X    $(CC) $(LDFLAGS) >bugs-$> exprpars.c
  446. X
  447. moonphas.o:    moonphas.c pcaldefs.h pcalglob.h
  448. X    $(CC) $(LDFLAGS) >bugs-$> moonphas.c
  449. X
  450. pcal.o:        pcal.c pcaldefs.h pcalglob.h pcallang.h
  451. X    $(CC) $(LDFLAGS) >bugs-$> pcal.c
  452. X
  453. pcalutil.o:    pcalutil.c pcaldefs.h pcalglob.h pcallang.h
  454. X    $(CC) $(LDFLAGS) >bugs-$> pcalutil.c
  455. X
  456. readfile.o:    readfile.c pcaldefs.h pcalglob.h pcallang.h
  457. X    $(CC) $(LDFLAGS) >bugs-$> readfile.c
  458. X
  459. writefil.o:    writefil.c pcaldefs.h pcalglob.h pcallang.h 
  460. X    $(CC) $(LDFLAGS) >bugs-$> writefil.c
  461. X
  462. pcalinit: pcalinit.c
  463. X    $(CC) $(LDFLAGS) >bugs-$> -Lscsdndver pcalinit pcalinit.c
  464. X
  465. pcalinit.h: pcalinit pcalinit.ps
  466. X    DH0:pcal/pcalinit pcalinit.ps
  467. SHAR_EOF
  468. chmod 0644 Makefile.Amiga ||
  469. echo 'restore of Makefile.Amiga failed'
  470. Wc_c="`wc -c < 'Makefile.Amiga'`"
  471. test 1010 -eq "$Wc_c" ||
  472.     echo 'Makefile.Amiga: original size 1010, current size' "$Wc_c"
  473. fi
  474. # ============= Makefile.DOS ==============
  475. if test -f 'Makefile.DOS' -a X"$1" != X"-c"; then
  476.     echo 'x - skipping Makefile.DOS (File already exists)'
  477. else
  478. echo 'x - extracting Makefile.DOS (Text)'
  479. sed 's/^X//' << 'SHAR_EOF' > 'Makefile.DOS' &&
  480. # PCAL v4.0 MAKEFILE for MS-DOS.
  481. # Uses TurboC command line compiler.
  482. X
  483. CC    = tcc
  484. CFLAGS    = -DDOS
  485. OBJECTS = pcal.obj exprpars.obj moonphas.obj pcalutil.obj readfile.obj writefil.obj
  486. X
  487. pcal.exe:    $(OBJECTS)
  488. X    $(CC) $(LDFLAGS) $(OBJECTS)
  489. X    @ echo + Build of pcal complete!
  490. X
  491. exprpars.obj:    exprpars.c pcaldefs.h
  492. X    $(CC) $(CFLAGS) $(COPTS) -c exprpars.c
  493. X
  494. moonphas.obj:    moonphas.c pcaldefs.h pcalglob.h
  495. X    $(CC) $(CFLAGS) $(COPTS) -c moonphas.c
  496. X
  497. pcal.obj:        pcal.c pcaldefs.h pcalglob.h pcallang.h
  498. X    $(CC) $(CFLAGS) $(COPTS) -c pcal.c
  499. X
  500. pcalutil.obj:    pcalutil.c pcaldefs.h pcalglob.h pcallang.h
  501. X    $(CC) $(CFLAGS) $(COPTS) -c pcalutil.c
  502. X
  503. readfile.obj:    readfile.c pcaldefs.h pcalglob.h pcallang.h
  504. X    $(CC) $(CFLAGS) $(COPTS) -c readfile.c
  505. X
  506. writefil.obj:    writefil.c pcaldefs.h pcalglob.h pcallang.h pcalinit.h
  507. X    $(CC) $(CFLAGS) $(COPTS) -c writefil.c
  508. X
  509. pcalinit.exe: pcalinit.c
  510. X    $(CC) $(CFLAGS) $(LDFLAGS) $(COPTS) pcalinit.c
  511. X
  512. pcalinit.h: pcalinit.exe pcalinit.ps
  513. X    pcalinit pcalinit.ps pcalinit.h
  514. X
  515. clean:
  516. X    del *.obj
  517. X    del pcalinit.exe
  518. X    del pcalinit.h
  519. SHAR_EOF
  520. chmod 0644 Makefile.DOS ||
  521. echo 'restore of Makefile.DOS failed'
  522. Wc_c="`wc -c < 'Makefile.DOS'`"
  523. test 1023 -eq "$Wc_c" ||
  524.     echo 'Makefile.DOS: original size 1023, current size' "$Wc_c"
  525. fi
  526. # ============= Makefile.VMS ==============
  527. if test -f 'Makefile.VMS' -a X"$1" != X"-c"; then
  528.     echo 'x - skipping Makefile.VMS (File already exists)'
  529. else
  530. echo 'x - extracting Makefile.VMS (Text)'
  531. sed 's/^X//' << 'SHAR_EOF' > 'Makefile.VMS' &&
  532. #   This is a makfile for the public domain VMS version of MAKE by Nelson
  533. #   H.F. Beebe dated 20-Feb-88.  Below you will find a paragraph cut out
  534. #   of the MAKE.DOC file.  If you have this program and want to use it
  535. #   instead of the MAKE_PCAL.COM, rename this file from MAKEFILE.VMS to
  536. #   MAKEFILE.  and type
  537. #       MAKE pcal               ! for the program
  538. #       MAKE help               ! for the help library
  539. #
  540. #   The original version of MAKE  was done by Stuart Feldman  in
  541. #   1978.  This  multi-operating-system version  is based  on  a
  542. #   public-domain posting  of 3-Dec-86  to the  Usenet  bulletin
  543. #   board  mod.sources,  its  author  known  only  by  an  EMAIL
  544. #   address: Caret@FAIRLIGHT.OZ.  It contained support for Unix,
  545. #   OS9, and  EON  operating  systems.  The  TOPS-20,  VMS,  and
  546. #   MS-DOS   support   was   added   by   Nelson   H.F.    Beebe
  547. #   (BEEBE@UTAH-SCIENCE).
  548. #
  549. X
  550. # Set the configuration variables below to taste.
  551. X
  552. CFLAGS    = /NoList
  553. COPTS    = VAXCRTL.OPT /Option
  554. OBJECTS = exprpars.obj moonphas.obj pcalutil.obj readfile.obj writefil.obj
  555. OBJLIST = exprpars,moonphas,pcalutil,readfile,writefil
  556. X
  557. pcal:    pcal.exe
  558. X
  559. pcal.exe:    pcal.obj $(OBJECTS)
  560. X    $(CC) $(CFLAGS) pcal
  561. X    Link pcal,$(OBJLIST),$(COPTS)
  562. X    Rename CALENDAR. SAMPLE_CALENDAR.DAT
  563. X    Rename MOON91. MOON91.DAT
  564. X    Set Protection = (System:RWE, Owner:RWE, Group:RE, World:RE) *.*
  565. X
  566. exprpars.obj:    exprpars.c pcaldefs.h
  567. X    $(CC) $(CFLAGS) exprpars.c
  568. X
  569. moonphas.obj:    moonphas.c pcaldefs.h pcalglob.h
  570. X    $(CC) $(CFLAGS) moonphas.c
  571. X
  572. pcal.obj:    pcal.c pcaldefs.h pcalglob.h pcallang.h
  573. X    $(CC) $(CFLAGS) pcal.c
  574. X
  575. pcalutil.obj:    pcalutil.c pcaldefs.h pcalglob.h pcallang.h
  576. X    $(CC) $(CFLAGS) pcalutil.c
  577. X
  578. readfile.obj:    readfile.c pcaldefs.h pcalglob.h pcallang.h
  579. X    $(CC) $(CFLAGS) readfile.c
  580. X
  581. writefil.obj:    writefil.c pcaldefs.h pcalglob.h pcallang.h pcalinit.h
  582. X    $(CC) $(CFLAGS) writefil.c
  583. X
  584. pcalinit:    pcalinit.exe
  585. X
  586. pcalinit.exe:    pcalinit.c
  587. X    $(CC) $(CFLAGS) pcalinit.c
  588. X    Link $(LDFLAGS) pcalinit,$(COPTS)
  589. X
  590. pcalinit.h:    pcalinit.exe pcalinit.ps
  591. X    MCR Sys$$Disk:[]pcalinit pcalinit.ps pcalinit.h
  592. X
  593. help:    pcal.hlb
  594. X
  595. pcal.hlb:    pcal.hlp
  596. X    Library /Log /Create /Help PCAL.HLB PCAL.HLP
  597. X
  598. clean:
  599. X    Purge /NoConfirm pcal.exe,pcalinit.exe
  600. X    Delete /NoConfirm *.obj;*
  601. X    Delete /NoConfirm pcalinit.h;
  602. SHAR_EOF
  603. chmod 0644 Makefile.VMS ||
  604. echo 'restore of Makefile.VMS failed'
  605. Wc_c="`wc -c < 'Makefile.VMS'`"
  606. test 2238 -eq "$Wc_c" ||
  607.     echo 'Makefile.VMS: original size 2238, current size' "$Wc_c"
  608. fi
  609. # ============= Orig.ReadMe ==============
  610. if test -f 'Orig.ReadMe' -a X"$1" != X"-c"; then
  611.     echo 'x - skipping Orig.ReadMe (File already exists)'
  612. else
  613. echo 'x - extracting Orig.ReadMe (Text)'
  614. sed 's/^X//' << 'SHAR_EOF' > 'Orig.ReadMe' &&
  615. "Pcal" is a program to print PostScript calendars for any month and year.
  616. By default, it looks for a file in the home directory named "calendar"
  617. for entries with leading dates matching dates on the calendar, and prints
  618. any following text under the appropriate day.
  619. X
  620. The program may be a little System V flavored (getopt, time routines)
  621. but should be easily portable to other vintages of UNIX.
  622. X
  623. Pcal is the combined effort of several people, most notably Patrick Wood
  624. of Pipeline Associates, Inc. for the original PostScript code and Bill
  625. Vogel of AT&T for the calendar file mechanism.  My part was simple
  626. translation to a "C" program, the addition of a couple options and a more
  627. generalized date searching routine (oh yes, and a manual page :-).
  628. X
  629. The original calendar PostScript was Copyright (c) 1987 by Patrick Wood
  630. and Pipeline Associates, Inc. with permission to modify and redistribute.
  631. Please retain this README file with the package.
  632. X
  633. X
  634. Ken Keirnan
  635. Pacific Bell
  636. San Ramon, CA.
  637. SHAR_EOF
  638. chmod 0644 Orig.ReadMe ||
  639. echo 'restore of Orig.ReadMe failed'
  640. Wc_c="`wc -c < 'Orig.ReadMe'`"
  641. test 984 -eq "$Wc_c" ||
  642.     echo 'Orig.ReadMe: original size 984, current size' "$Wc_c"
  643. fi
  644. # ============= Pcal.hlp ==============
  645. if test -f 'Pcal.hlp' -a X"$1" != X"-c"; then
  646.     echo 'x - skipping Pcal.hlp (File already exists)'
  647. else
  648. echo 'x - extracting Pcal.hlp (Text)'
  649. sed 's/^X//' << 'SHAR_EOF' > 'Pcal.hlp' &&
  650. 1 PCAL
  651. X        Pcal generates PostScript  to  produce  landscape  or portrait
  652. X    calendars for any month  and  year.  The arguments month,year, and
  653. X    nmonths, if provided, should be  numeric.   The month value should
  654. X    be in the range 1 -  12, and the year value should be specified as
  655. X    1  or 2 digits or as the  full  4  digit  year.    If  no  numeric
  656. X    arguments  are  provided, the calendar for the current  month  and
  657. X    year will be generated.
  658. X
  659. X        If one numeric argument is provided, it is interpreted  as the
  660. X    year  value, and calendars for the entire year will be  generated.
  661. X    Otherwise,  nmonth  months,  starting with month and year, will be
  662. X    generated.
  663. X
  664. X        For whole-year calendars (i.e.  the  -w  option is given), the
  665. X    command line arguments are interpreted somewhat differently.    By
  666. X    default, all months in the current year are printed, starting with
  667. X    January.  If the month argument alone is given,  it is expected to
  668. X    be the desired year to print, and prints all of  the months in the
  669. X    given year.  If both month and year are given, then 12 consecutive
  670. X    months  are printed starting at the given month and year.  If  the
  671. X    month,  year, and nmonths  arguments  are  all  present,  printing
  672. X    begins  with the given month  and  year  and  nmonths  months  are
  673. X    printed, rounded up to the nearest multiple of 12.
  674. X    
  675. X        VMS Version
  676. X        Execution format:
  677. X
  678. X            pcal [options] [mm yy] [n]
  679. X
  680. 2 parameters
  681. X  mm yy n
  682. X        "mm" and "yy"  are numeric values of the month (1-12) and year
  683. X    (0-99) (i.e., July 1990  would  be 7 90).  If you just include the
  684. X    "yy" option, an entire 12  months  of calendars will be generated.
  685. X    A specific month can be produced  by including the "mm" parameter.
  686. X    The  "n"  parameter will  produce the "n"  consecutive  months  of
  687. X    calendars starting with the requested month.
  688. X
  689. X        The following  flags  may be specified (in increasing order of
  690. X    precedence) in global symbol PCAL_OPTS, in "opt" lines in the date
  691. X    file (all but -e,  -f,  -"D",  -"U"), or on the command line.  Any
  692. X    flag which normally takes an argument may be specified without the
  693. X    argument;  this resets its value  to  the  program default.  (-"D"
  694. X    alone thus clears all defined symbols;  -"U" alone has no effect.)
  695. X
  696. X        The '-' flag has  been added to  disambiguate  cases  where an
  697. X    argument-less flag has been specified immediately before a numeric
  698. X    parameter:
  699. X
  700. X        pcal -t - 9 90
  701. X
  702. 2 options
  703. X        Pcal  accepts  several  command  line  options  (or  from  the
  704. X    CALENDAR.DAT file).   The  uppercase options should be enclosed in
  705. X    quotes as the VMS command line parser will not distinguish between
  706. X    the case otherwise.  The quoted strings  are  not  needed  if  the
  707. X    options are included within the CALENDAR.DAT file.
  708. X
  709. 3 -e
  710. X        Print an  empty  calendar (i.e., do not  print entries  from a
  711. X    CALENDAR.DAT file.)
  712. X
  713. 3 -f <FILE>
  714. X        Directs pcal to use the  file name <FILE> as the input file in
  715. X    place  of the  default  CALENDAR.DAT  file  in  the  callers  home
  716. X    directory or in the  directory specified by logical name PCAL_DIR.
  717. X
  718. 3 -o <FILE>
  719. X        Directs  pcal to  write  the  PostScript  calendar  into  FILE
  720. X    (default: CALENDAR.PS in the current directory.)
  721. X
  722. 3 -j
  723. X        Directs pcal to print  the  Julian  (Day Of Year, DOY) in each
  724. X    calendar box.
  725. X
  726. 3 -"J"
  727. X        Directs pcal to print the Julian  (Day  Of  Year, DOY) and the
  728. X    number of days remaining in the year in each calendar box.
  729. X
  730. 3 -l
  731. X        This will cause the  output  to  come  out  in  landscape mode
  732. X    (This is the default).
  733. X
  734. 3 -p
  735. X        This will cause  the  output  to  come  out  in  portrait mode
  736. X    instead of landscape mode.
  737. X
  738. 3 -m
  739. X        This option causes a  moon to be printed on days corresponding
  740. X    to a full, half, or new moon (default: no moons).
  741. X
  742. 3 -"M"
  743. X        This option causes a  moon to be printed on all days (default:
  744. X    no moons).
  745. X
  746. 3 -b <DAY> | all
  747. X        This  will cause  all dates  on weekday  DAY to be  printed in
  748. X    black;  "-b all" causes  all dates  to be printed  in black unless
  749. X    explicitly flagged as a holiday.
  750. X
  751. 3 -g <DAY> | all
  752. X        This  will cause  all dates  on weekday  DAY to be  printed in
  753. X    gray; "-g all" causes all dates to be printed in gray.  Default is
  754. X    to print Saturdays  and Sundays in gray and  other dates in black.
  755. X
  756. 3 -"F" <DAY>
  757. X        This will cause  the weekday  DAY  to be the first day of each
  758. X    week;  weekday  DAY  will appear in  the left-most  column of each
  759. X    calendar.
  760. X
  761. 3 -"A" | -"E"
  762. X        Directs  pcal    to  use  either  American  or  European  date
  763. X    conventions.  Use  one  of these options to select the date format
  764. X    for the calendar file.    The  -"A"  option  (the default) selects
  765. X    American-style dates like "10/19/90" or  "Sep  19 1990", while the
  766. X    -"E" option selects European-style dates like  "17/10/90"  or  "19
  767. X    Sep 1990".
  768. X
  769. 3 -t <FONT>
  770. X        This option can be used  to  change  the  font  the  title  is
  771. X    printed in  (ie. pcal -t Times-Roman).  The default is Times-Bold.
  772. X
  773. 3 -d <FONT>
  774. X        This option is the same as  -t  except  that  the font used to
  775. X    print the  day  numbers is  changed.  The  default is  Times-Bold.
  776. X
  777. 3 -n <FONT>
  778. X        This option is the same as  -n  except  that  the font used to
  779. X    print the notes in the calendar boxes is  changed.  The default is
  780. X    Helvetica-Narrow.
  781. X
  782. 3 -"L" <STRING>
  783. X        This will cause STRING to be printed as a left footer.
  784. X
  785. 3 -"C" <STRING>
  786. X        This will cause STRING to be printed as a center footer.
  787. X
  788. 3 -"R" <STRING>
  789. X        This will cause STRING to be printed as a right footer.
  790. X
  791. 3 -"D" <SYM>
  792. X        This will define symbol SYM prior to  reading  the  date file;
  793. X    -"D" alone clears all defined symbols.
  794. X
  795. 3 -"U" <SYM>
  796. X        This will undefine symbol  SYM prior to reading the date file.
  797. X
  798. 3 -x xscale
  799. X        Specifies the x-axis scaling factor for the calendar size.
  800. X
  801. 3 -y yscale
  802. X        Specifies the y-axis scaling factor for the calendar size.
  803. X
  804. 3 -"X" xtrans
  805. X        Specifies  the  x-axis  translation  value for positioning the
  806. X    output on the page.
  807. X
  808. 3 -"Y" ytrans
  809. X        Specifies  the  y-axis  translation  value for positioning the
  810. X    output on the page.
  811. X
  812. 3 -"I"
  813. X        Resets all parameters to the program defaults.
  814. X
  815. 3 -"O"
  816. X        Causes  pcal  to  print  "gray"  dates  as outlined characters
  817. X    instead.
  818. X
  819. 3 -"B"
  820. X        Causes pcal to leave  unused  calendar boxes blank (default is
  821. X    gray).
  822. X
  823. 3 -w
  824. X        Causes pcal  to print a calendar for 12 consecutive months:  3
  825. X    rows / 4 columns in landscape mode, 4 rows / 3 columns in portrait
  826. X    mode.  This option  effectively  disables  the  -"M"|m (moons) and
  827. X    -"J"|j (Julian dates) flags, and  also  suppresses the text in the
  828. X    calendar boxes.  The numeric parameters work slightly differently:
  829. X
  830. X            yy              print Jan/yy .. Dec/yy
  831. X            mm yy           print 12 months starting with mm/yy
  832. X            mm yy n         print n months (rounded up to multiple of 12)
  833. X                                starting with mm/yy
  834. X            (default)       print Jan .. Dec of current year
  835. X
  836. X        Note that "-w" in conjunction with "-p" overrides any  Y-scale
  837. X    factor  (default  or  set  with  "-y")  in order to use  the  full
  838. X    portrait page.
  839. X
  840. 3 -h
  841. X        This prints version and usage information only.
  842. X
  843. 2 Calendar_File
  844. X        By default,  pcal  simply  prints an empty calendar.  Its real
  845. X    power is in  its  ability to place "events" in appropriate days on
  846. X    the  calendar,  thus allowing  the  user  to  create  personalized
  847. X    calendars.  This is achieved through the use of the "date file".
  848. X
  849. X        The date file is named  CALENDAR.DAT Pcal will look in several
  850. X    places for such a file.   First,  if  a  file  called CALENDAR.DAT
  851. X    exists in the caller's home directory, it  is used.  Next, if such
  852. X    a  file  exists  in the directory indicated by  the  logical  name
  853. X    PCAL_DIR  (or  the  current  directory  if  no  such  variable  is
  854. X    defined),  it  is  used.    Finally, the directory where the  pcal
  855. X    executable resides will be checked.  If no date file is  found, an
  856. X    empty calendar is printed.
  857. X
  858. X        If  a  date file is found, it will be searched for lines  with
  859. X    leading dates matching  the  requested  month  and year.  Any text
  860. X    following the dates found  will  be  printed on the calendar under
  861. X    the appropriate day of the  month.  Dates in the CALENDAR.DAT file
  862. X    may be expressed in any of several formats:
  863. X
  864. X          <ordinal> <day_spec> in <month_spec>{*} {<text>}
  865. X          <day_spec> <prep> <date_spec>{*} {<text>}
  866. X          <date_spec>{*} {<text>}
  867. X
  868. X    Where:
  869. X
  870. X      <month_spec>  := first 3+ characters of name of month or "all"
  871. X      <day_spec>    := first 3+ characters of name of weekday, "day",
  872. X                       "weekday", "workday", "holiday",
  873. X                       "nonweekday", "nonworkday", or "nonholiday"
  874. X      <ordinal>     := "first", "1st", ... "fifth", "5th",
  875. X                       "last", "odd", "even", or "all"
  876. X      <prep>        := "before", "preceding", "after", "following",
  877. X                       "on_or_before" ("oob"), or
  878. X                       "on_or_after" ("ooa")
  879. X      <sep>         := 1 or more non-numeric, non-space, non-'*' characters
  880. X      <month>       := day of month (1-31)
  881. X      <day>         := a numeric month (1-12)
  882. X      <year>        := a numeric year
  883. X
  884. X     If the -"A" option (American date formats, the default) is given:
  885. X
  886. X      <date_spec>   := [<month_spec><day> | <month><sep><day>{<sep><year>}]
  887. X
  888. X     If the -"E" option (European date formats) is given:
  889. X
  890. X      <date_spec>   := [<day><month_spec> | <day><sep><month>{<sep><year>}]
  891. X
  892. X        Any  non-numeric  character  may  separate    numeric   dates.
  893. X    Holidays may be flagged by following the date immediately with `*'
  894. X    as in the examples above;   this will cause the date to be printed
  895. X    in gray.  "Each" and "every" are  accepted  as synonyms for "all",
  896. X    and any word may be used in place  of  "in".    The  abbreviations
  897. X    "oob"  and  "ooa"  may  be  used  in  place  of    the    keywords
  898. X    "on_or_before" and "on_or_after", respectively.
  899. X
  900. X        Wildcard  day  names are also provided.  The keyword "weekday"
  901. X    applies to  any  days  which  are normally printed in black on the
  902. X    calendar.  The keyword "workday" is the same, but does not include
  903. X    any holidays.  The  keyword  "holiday"  includes  only  those days
  904. X    flagged as holidays.  The keywords "nonweekday", "nonworkday", and
  905. X    "nonholiday" are also recognized as negations  of  the above.  See
  906. X    the Caveats below for important notes on using these keywords.
  907. X
  908. X        Ordinal  day  numbers may be used  to  specify  dates,  either
  909. X    relative to the month or to the  year.    Either  words or numeric
  910. X    abbreviations  may  be used for "first" through "fifth";    higher
  911. X    numbers must be given using the numeric equivalent (e.g.   100th).
  912. X    Negative  ordinal numbers may even be used.  For example,  "-2nd"
  913. X    means "next to last".
  914. X
  915. X        "Odd" and "even" do not refer  to  the  actual date;  instead,
  916. X    "odd" means "alternate, starting with the first", and "even" means
  917. X    "alternate,  starting  with  the second".  Thus, "odd  Fridays  in
  918. X    March" refers to the first, third, and (if present)  fifth Fridays
  919. X    in March - not to those Fridays falling on odd dates.
  920. X
  921. X        "All" refers to each individual month;    "year" refers to the
  922. X    year as an entity.  Thus "odd Fridays in all" refers to the first,
  923. X    third, and fifth Friday of each month, while "odd Fridays in year"
  924. X    refers  to  the  first  Friday of January and every  other  Friday
  925. X    thereafter.
  926. X
  927. X        Text in the date file may use C-like escape sequences (i.e.  a
  928. X    `\' followed by a character, 1--3 octal digits, or `x' followed by
  929. X    1--2 hexadecimal digits).  Escaped  whitespace (including newline)
  930. X    and the standard ANSI character escapes  (`\a',  `\b', `\f', `\n',
  931. X    `\r', `\t', `\v') are all replaced by a single blank.
  932. X
  933. X        Lines in the CALENDAR.DAT file consisting  of year XXXX (where
  934. X    XXXX is a numeric year) can be  used to set the year for following
  935. X    entries.  This assumes that the following entries do not contain a
  936. X    year;  any date entries containing year information will  set  the
  937. X    remembered year to that year.
  938. X
  939. X        Lines in the CALENDAR.DAT file consisting of opt <options> can
  940. X    be used to override the  defaults  for  any  command-line  options
  941. X    except -e, -f, -h, -"D", and  -"U".  Any options specified in this
  942. X    manner are, in turn, overridden by those  specified  explicitly on
  943. X    the command line.  Note that the upper  case letter options do NOT
  944. X    need to be enclosed in quotes if they are  put in the CALENDAR.DAT
  945. X    file.  Enclose the upper case letters in quotes only when they are
  946. X    used on the DCL.
  947. X
  948. X        Lines in the CALENDAR.DAT file consisting of note  <month> can
  949. X    be used to place notes regarding the entire month  is  one  of the
  950. X    unused  blocks  of  the  calendar.   The <month> indicator may  be
  951. X    either  a  number  1  through  12  or an alphabetic month name  as
  952. X    described above;  "note all" will place the associated text in the
  953. X    notes block for each month in the current year.
  954. X
  955. X        Comments  are   supported  in  the  CALENDAR.DAT  file.    Any
  956. X    characters following a  `#'  character through the end of the line
  957. X    are ignored.
  958. X
  959. X        Pcal  supports rudimentary cpp-like functionality in the  date
  960. X    file, allowing the following constructs:  define | undef, if{n}def
  961. X    ...  {else ...} endif,  and  include.    Note  that  these are not
  962. X    preceded  by  `#' as they are in C.  Symbol  names  defined  using
  963. X    these  keywords (or via the -"D" option) are case-insensitive.  It
  964. X    is not  an  error  to  undef  an undefined symbol, nor to define a
  965. X    previously-defined one.   An  ifdef  alone  is  always  false;  an
  966. X    ifndef alone is always true.
  967. X
  968. X        The  name  of the file in the include directive may optionally
  969. X    be surrounded by either "" or <>, both of which are ignored.    If
  970. X    the  name  is not an absolute path, it is taken to be relative  to
  971. X    the directory where the file containing the directive is located.
  972. X
  973. X        In  addition  to  pre-processing keywords, pcal  also  accepts
  974. X    boolean  expressions in if{n}def directives.    These  expressions
  975. X    consist of symbol names joined by  the  boolean operators !, &, ^,
  976. X    and |, in order of precedence, high to low.   Parentheses  may  be
  977. X    used to alter the precedence.  The synonyms && and || are accepted
  978. X    for  &  and  |.    A  symbol  name evaluates to true if  currently
  979. X    defined, false if not;  thus:
  980. X
  981. X                              ifdef A | B | C
  982. X
  983. X    ...is true if any of the symbols A, B, and C is defined, and:
  984. X
  985. X                              ifdef A & B & C
  986. X
  987. X    ...is true if they all are.  Note that ifndef <expr> is equivalent
  988. X    to ifdef !( <expr> ).
  989. X
  990. 3 notes
  991. X        Pcal allows the user to print  additional  notes  in an unused
  992. X    calendar box via lines of the form  "note  <month>  <text>", where
  993. X    <month>  specifies  the  month  (numeric  or alphabetic form)  and
  994. X    <text>  is the text to add.  All such  text  will  appear  in  the
  995. X    "Thursday" box on the last line (next to the small calendars).
  996. X
  997. 3 Example
  998. X    Date File Example:
  999. X
  1000. X    # A sample "opt" line to change the fonts and output file names,
  1001. X    # to print only Sundays in gray, and to print moons on all days:
  1002. X    #
  1003. X    opt -d Helvetica-Bold -t Helvetica-Bold -o myfile.ps -b all -g sun -M
  1004. X
  1005. X    year 1990               # set year explicitly
  1006. X    1/1*                    New Year's Day
  1007. X    ifndef Arizona
  1008. X        3rd Mon in Jan*     Martin Luther King's Birthday
  1009. X    endif
  1010. X    2/2                     Groundhog Day
  1011. X    Feb 14                  Valentine's Day
  1012. X    3rd Monday in Feb*      Presidents' Day
  1013. X    3/17                    St. Patrick's Day
  1014. X    last Monday in May*     Memorial Day
  1015. X    7/4*                    Independence Day
  1016. X    1st Monday in Sep*      Labor Day
  1017. X    second Monday in Oct*   Columbus Day (observed)
  1018. X    10/12                   Columbus Day (traditional)
  1019. X    10/31                   Halloween
  1020. X    Tue after first Mon in Nov      Election Day
  1021. X    second Monday in Nov*           Veterans' Day (observed)
  1022. X    11/11*                          Veterans' Day (traditional)
  1023. X    fourth Thu in Nov*              Thanksgiving
  1024. X    day after fourth Thu in Nov*
  1025. X    12/24*                  Christmas Eve
  1026. X    12/25*                  Christmas
  1027. X    last day in Dec*        New Year's Eve
  1028. X    last workday in all     Status reports due
  1029. X    note Dec                Office closed throughout week of Christmas
  1030. X    1/1/91*                 New Year's Day      # set new year implicitly
  1031. X
  1032. 2 Moon_File
  1033. X        If  a  file  of the name MOONxx.DAT (where xx is the last  two
  1034. X    digits  of  the calendar year) exists in the same directory as the
  1035. X    date file, pcal uses the information contained within to calculate
  1036. X    the phase of  the  moon.    If  no  such file exists, pcal uses an
  1037. X    approximate algorithm.
  1038. X
  1039. X        Entries in the moon file must conform to the following syntax:
  1040. X
  1041. X        If the -"A" option  (American  date  formats,  the default) is
  1042. X    given:
  1043. X
  1044. X              <quarter> <month><sep><day> {<hour><sep><min>}
  1045. X
  1046. X        If the -"E" option (European date formats) is given:
  1047. X
  1048. X              <quarter> <day><sep><month> {<hour><sep><min>}
  1049. X
  1050. X        Where:
  1051. X
  1052. X            <quarter>   := "nm", "fq" or "1q", "fm", "3q" or "lq"
  1053. X                           (new moon,first quarter,full moon,last quarter)
  1054. X            <hour>      := number 0-23 (24-hour clock)
  1055. X            <min>       := number 0-59
  1056. X
  1057. X        This file must contain entries for  all  quarter  moons in the
  1058. X    year, in chronological order;  if any errors are encountered, pcal
  1059. X    will revert to using its default algorithm.
  1060. X
  1061. X        As in the date file, comments start with  '#'  and run through
  1062. X    end-of-line.
  1063. X
  1064. 3 Example
  1065. X        The following  is  a  short example of an European style (-"E)
  1066. X    moon data file.    It  is  taken from the MOON91.DAT file supplied
  1067. X    with pcal.
  1068. X
  1069. X        3q 01/07 13:37        # third quarter
  1070. X        nm 01/15 18:51        # new moon
  1071. X        1q 01/23 09:23        # first quarter
  1072. X        fm 01/30 01:10        # full moon
  1073. X
  1074. 2 Logical_Names
  1075. X        Pcal optionally uses two (2)  logical  names during execution.
  1076. X    A user may define them or let the administrator set them up.
  1077. X
  1078. 3 Pcal_Dir
  1079. X        Pcal logical name for the location  of the directory for input
  1080. X    and output files.  In this way,  a  user can over-ride the current
  1081. X    default location for the source  of  the  CALENDAR.DAT input file,
  1082. X    MOONxx.DAT, and the CALENDAR.PS output file.
  1083. X
  1084. 3 Pcal_Opts
  1085. X        Pcal  also  looks for a logical name "Pcal_Opts;  if  defined,
  1086. X    its contents  are  parsed  as command-line flags.  These over-ride
  1087. X    the program defaults,  but  are  over-ridden  by any specified via
  1088. X    "opt" lines in the date file or on the command line.  Example:
  1089. X
  1090. X        Define Pcal_Opts "-n Helvetica -D meetings"     ! login.com
  1091. X        pcal -"U" meetings 9 90       ! un-define symbol at runtime
  1092. X
  1093. 2 Caveats
  1094. X        The "workday" and "holiday" keywords are aware  of  only those
  1095. X    holidays which have already been flagged at the  point  where they
  1096. X    appear.  For example, consider January 1990:
  1097. X
  1098. X                        January 1990
  1099. X                     S  M Tu  W Th  F  S
  1100. X                        1  2  3  4  5  6
  1101. X                     7  8  9 10 11 12 13
  1102. X                    14 15 16 17 18 19 20
  1103. X                    21 22 23 24 25 26 27
  1104. X                    28 29 30 31
  1105. X
  1106. X        If the CALENDAR.DAT file looked like this:
  1107. X
  1108. X            workday on_or_before all 15 payday
  1109. X            3rd Mon in Jan* MLK day
  1110. X
  1111. X    then Pcal would mark the 15th as "payday" since  at  that point in
  1112. X    the CALENDAR.DAT file it has no way of knowing that  January  15th
  1113. X    will  later  be  flagged  as  a  holiday.  If the two  lines  were
  1114. X    reversed, such that  the  holiday preceded the "workday" wildcard,
  1115. X    then Pcal would work  as  intended,  marking  instead  the 12th as
  1116. X    "payday".    Also, beware of  year  boundaries  which  affect  the
  1117. X    handling of all of the day  wildcard  keywords.  In general, it is
  1118. X    best to place monthly wildcards such as  the  example above at the
  1119. X    end of each year to acheive the desired effect.
  1120. X
  1121. X        When the -w and -p options are used together, pcal revises the
  1122. X    y-scale   factor  in  order  to  use  the  entire  portrait  page;
  1123. X    therefore, the user should avoid using use  the  -y using both the
  1124. X    -w and -p options.  Use of the  -w  option in any case effectively
  1125. X    disables the -m, -"M", -j, and -"J" options.
  1126. X
  1127. 2 Authors
  1128. X        The original PostScript code  to  generate  the  calendars was
  1129. X    written by Patrick Wood (Copyright  (c)  1987  by  Patrick Wood of
  1130. X    Pipeline  Associates,  Inc.),  and authorized for modification and
  1131. X    redistribution.      The  CALENDAR.DAT  file  inclusion  code  was
  1132. X    originally written in  "bs(1)"  by  Bill Vogel of AT&T.  Patrick's
  1133. X    original PostScript was modified  and  enhanced  several  times by
  1134. X    others whose names have regrettably  been  lost.    Ken Keirnan of
  1135. X    Pacific Bell assembled the original "C" version upon which this is
  1136. X    based;  additional modifications and enhancements were the work of
  1137. X    Joseph P.  Larson, Ed Hand, Andrew W.    Rogers,  Mark Kantrowitz,
  1138. X    Joe Brownlee, Jamie Zawinski and Floyd Miller.  The  moon routines
  1139. X    were   originally  written  by  Mark  Hanson,  were  improved  and
  1140. X    incorporated  into  this  version  by  Jamie  Zawinski,  and  were
  1141. X    translated from PostScript  to  C  by  Andrew  Rogers.    This VMS
  1142. X    support was provided by  Richard  Dyson  and  updated by Andrew W.
  1143. X    Rogers and Joe Brownlee.   The  Amiga support was supplied by Bill
  1144. X    Hogsett.
  1145. X
  1146. 2 Version
  1147. X        This help file currently  reflects pcal v4.0 dated 24-FEB-1991
  1148. X    and was updated by Richard Dyson on 3-MAR-1991.
  1149. SHAR_EOF
  1150. chmod 0644 Pcal.hlp ||
  1151. echo 'restore of Pcal.hlp failed'
  1152. Wc_c="`wc -c < 'Pcal.hlp'`"
  1153. test 22115 -eq "$Wc_c" ||
  1154.     echo 'Pcal.hlp: original size 22115, current size' "$Wc_c"
  1155. fi
  1156. # ============= SetUp.com ==============
  1157. if test -f 'SetUp.com' -a X"$1" != X"-c"; then
  1158.     echo 'x - skipping SetUp.com (File already exists)'
  1159. else
  1160. echo 'x - extracting SetUp.com (Text)'
  1161. sed 's/^X//' << 'SHAR_EOF' > 'SetUp.com' &&
  1162. $ Write Sys$Output "SETting UP Pcal (v4.0)..."
  1163. $ THIS_PATH = F$Element (0, "]", F$Environment ("PROCEDURE")) + "]"
  1164. $ PCAL :== $ 'THIS_PATH'PCAL.EXE
  1165. $ Define Pcal_Dir 'THIS_PATH'
  1166. $!
  1167. $!  Put the help library into the next available help library slot
  1168. $!
  1169. $ LIB = "Hlp$Library"
  1170. $ X = F$Trnlnm (LIB, "Lnm$Process")
  1171. $ If X .eqs. "" Then GoTo INSERT
  1172. $ If X .eqs. "''THIS_PATH'PCAL.HLB" Then GoTo EXIT
  1173. $ BASE = LIB + "_"
  1174. $ N = 1
  1175. $NEXTLIB:
  1176. $   LIB := 'BASE''N'
  1177. $   X = F$Trnlnm (LIB, "Lnm$Process")
  1178. $   If X .eqs. "" Then GoTo INSERT
  1179. $   If X .eqs. "''THIS_PATH'PCAL.HLB" Then GoTo EXIT
  1180. $   N = N + 1
  1181. $   GoTo NEXTLIB
  1182. $INSERT:
  1183. $   Define 'LIB' 'THIS_PATH'PCAL.HLB
  1184. $EXIT:
  1185. $   Exit
  1186. SHAR_EOF
  1187. chmod 0644 SetUp.com ||
  1188. echo 'restore of SetUp.com failed'
  1189. Wc_c="`wc -c < 'SetUp.com'`"
  1190. test 670 -eq "$Wc_c" ||
  1191.     echo 'SetUp.com: original size 670, current size' "$Wc_c"
  1192. fi
  1193. # ============= VaxCtrl.opt ==============
  1194. if test -f 'VaxCtrl.opt' -a X"$1" != X"-c"; then
  1195.     echo 'x - skipping VaxCtrl.opt (File already exists)'
  1196. else
  1197. echo 'x - extracting VaxCtrl.opt (Text)'
  1198. sed 's/^X//' << 'SHAR_EOF' > 'VaxCtrl.opt' &&
  1199. Sys$Library:VAXCRTL.EXE /Share
  1200. SHAR_EOF
  1201. chmod 0644 VaxCtrl.opt ||
  1202. echo 'restore of VaxCtrl.opt failed'
  1203. Wc_c="`wc -c < 'VaxCtrl.opt'`"
  1204. test 31 -eq "$Wc_c" ||
  1205.     echo 'VaxCtrl.opt: original size 31, current size' "$Wc_c"
  1206. fi
  1207. # ============= calendar ==============
  1208. if test -f 'calendar' -a X"$1" != X"-c"; then
  1209.     echo 'x - skipping calendar (File already exists)'
  1210. else
  1211. echo 'x - extracting calendar (Text)'
  1212. sed 's/^X//' << 'SHAR_EOF' > 'calendar' &&
  1213. # Sample date file for Pcal: this should be called .calendar for Un*x,
  1214. # CALENDAR.DAT for VMS, and should live in the user's home directory.
  1215. #
  1216. # Date file syntax:
  1217. #    
  1218. #    The following rules describe the syntax of date file entries:
  1219. #    
  1220. #      year <year>
  1221. #    
  1222. #      opt <options>
  1223. #    
  1224. #      note <month_spec> <text>
  1225. #      note <month> <text>
  1226. #    
  1227. #      if -A flag (American date formats) specified:
  1228. #        <month_name> <day>{*} {<text>}
  1229. #        <month><sep><day>{<sep><year>}{*} {<text>}
  1230. #    
  1231. #      if -E flag (European date formats) specified:
  1232. #        <day> <month_name>{*} {<text>}
  1233. #        <day><sep><month>{<sep><year>}{*} {<text>}
  1234. #    
  1235. #      <ordinal> <day_spec> in <month_spec>{*} {<text>}
  1236. #      <day_spec> <prep> <date_spec>
  1237. #    
  1238. #    where
  1239. #    
  1240. #      {x}          means x is optional
  1241. #    
  1242. #      <date_spec> := any of the above date specs (not year, note, or opt)
  1243. #      <month_name> := first 3+ characters of name of month, or "all"
  1244. #      <month_spec> := <month_name>, or "year"
  1245. #      <day_name> := first 3+ characters of name of weekday, "day",
  1246. #                    "weekday", "workday", "holiday", "nonweekday",
  1247. #                    "nonworkday", or "nonholiday"
  1248. #      <ordinal> := ordinal number ("1st", "2nd", etc.), "first" .. "fifth",
  1249. #                    "last", "even", "odd", or "all"
  1250. #      <prep> := "before", "preceding", "after", "following", "on_or_before",
  1251. #                    or "on_or_after"
  1252. #      <sep> := one or more non-numeric, non-space, non-'*' characters
  1253. #      <month>, <day>, <year> are the numeric forms
  1254. #    
  1255. #      <options> := any command-line option except -e, -f, -h, -D, -U
  1256. #    
  1257. #    Comments start with '#' and run through end-of-line.
  1258. #    
  1259. #    Holidays may be flagged by specifying '*' as the last character of
  1260. #    the date field(s), e.g. "10/12* Columbus Day", "July 4* Independence
  1261. #    Day", etc.  Any dates flagged as holidays will be printed in gray, and
  1262. #    any associated text will appear adjacent to the date.
  1263. #    
  1264. #    Note that the numeric date formats (mm/dd{/yy}, dd.mm{.yy}) support
  1265. #    an optional year, which will become the subsequent default year.  The
  1266. #    alphabetic date formats (month dd, dd month) do not support a year
  1267. #    field; the "year yy" command is provided to reset the default year.
  1268. #    
  1269. #    "Floating" days may be specified in the date file as "first Mon in 
  1270. #    Sep", "last Mon in May", "4th Thu in Nov", etc.; any word may be
  1271. #    used in place of "in".  "Relative floating" days (e.g. "Fri after 4th 
  1272. #    Thu in Nov") are also accepted; they may span month/year bounds.
  1273. #    Pcal also accepts date specs such as "all Friday{s} in October", "last
  1274. #    Thursday in all", etc., and produces the expected results; "each" and
  1275. #    "every" are accepted as synonyms for "all".  Negative ordinals are
  1276. #    allowed; "-2nd" means "next to last".
  1277. #    
  1278. #    The words "day", "weekday", "workday", and "holiday" may be used as
  1279. #    wildcards: "day" matches any day, "weekday" matches any day normally
  1280. #    printed in black, "workday" matches any day normally printed in black
  1281. #    and not explicitly flagged as a holiday, and "holiday" matches any
  1282. #    day explicitly flagged as a holiday.  "Nonweekday", "nonworkday",
  1283. #    and "nonholiday" are also supported and have the obvious meanings.
  1284. #    
  1285. #    "Odd" and "even" do not refer to the actual date; instead, "odd"
  1286. #    means "alternate, starting with the first"; "even" means "alternate,
  1287. #    starting with the second".  Thus, "odd Fridays in March" refers to
  1288. #    the first, third, and (if present) fifth Fridays in March - not to
  1289. #    those Fridays falling on odd dates.
  1290. #    
  1291. #    "All" refers to each individual month; "year" refers to the year
  1292. #    as an entity.  Thus "odd Fridays in all" refers to the first/third/
  1293. #    fifth Friday of each month, while "odd Fridays in year" refers to
  1294. #    the first Friday of January and every other Friday thereafter.
  1295. #    
  1296. #    Additional notes may be propagated to an empty calendar box by the
  1297. #    inclusion of one or more lines of the form "note <month> <text>",
  1298. #    where <month> may be numeric or alphabetic; "note all <text>"
  1299. #    propagates <text> to each month in the current year.
  1300. #    
  1301. #    Simple cpp-like functionality is provided.  The date file may include
  1302. #    the following commands, which work like their cpp counterparts:
  1303. #    
  1304. #            define <sym>
  1305. #            undef <sym>
  1306. #    
  1307. #            if{n}def <expr>
  1308. #               ...
  1309. #            { else
  1310. #               ... }
  1311. #            endif
  1312. #    
  1313. #            include <file>
  1314. #    
  1315. #    Note that these do not start with '#', which is reserved as a comment
  1316. #    character.
  1317. #    
  1318. #    <sym> is a symbol name consisting of a letter followed by zero or
  1319. #    more letters, digits, or underscores ('_').  Symbol names are always
  1320. #    treated in a case-insensitive manner.
  1321. #    
  1322. #    <expr> is an expression consisting of symbol names joined by the logical
  1323. #    operators (in order of precedence, high to low) '!' (unary negate), '&'
  1324. #    (and), '^' (exclusive or), and '|' (inclusive or).  '&&' and '||' are
  1325. #    accepted as synonyms for '&' and '|' respectively; the order of
  1326. #    evaluation may be altered by the use of parentheses.  A symbol whose
  1327. #    name is currently defined evaluates to TRUE; one whose name is not
  1328. #    currently defined evaluates to FALSE.  Thus "ifdef A | B | C" is TRUE
  1329. #    if any of the symbols A, B, and C is currently defined, and
  1330. #    "ifdef A & B & C" is TRUE if all of them are.
  1331. #    
  1332. #    "ifndef A | B | C" is equivalent to "ifdef !(A | B | C)" (or, using
  1333. #    DeMorgan's Law, "ifdef !A & !B & !C") - in other words, TRUE if none of
  1334. #    the symbols A, B, and C is currently defined.
  1335. #    
  1336. #    "define" alone deletes all the current definitions; "ifdef" alone is
  1337. #    always false; "ifndef" alone is always true.
  1338. #    
  1339. #    The file name in the "include" directive may optionally be surrounded
  1340. #    by "" or <>.  In any case, path names are taken to be relative to
  1341. #    the location of the file containing the "include" directive.
  1342. X
  1343. X
  1344. # "opt" lines to override program defaults
  1345. X
  1346. opt -d Helvetica-Bold -t Helvetica-Bold -n Helvetica    # override default fonts
  1347. opt -M                             # moon icons on all days
  1348. opt -O                            # print outlined characters
  1349. X
  1350. year 1991            # set year explicitly
  1351. X
  1352. # note to be propagated to "Notes" box for all months
  1353. X
  1354. note all            Eng II Staff Meeting every Tuesday, 1:30 PM
  1355. X
  1356. # some sample holidays (flagged by '*') and other days of note
  1357. X
  1358. 1/1*                New Year's Day
  1359. X
  1360. # if "AZ", "NH", or "MT" defined, holiday definition will be skipped
  1361. ifndef AZ ||    \
  1362. X       NH ||    \
  1363. X       MT
  1364. 3rd Monday in Jan*        Martin Luther King Day (except AZ, NH, MT)
  1365. endif
  1366. X
  1367. 3rd Monday in Feb        Presidents' Day
  1368. Feb 14                Valentine's Day
  1369. X
  1370. # any Pcal users in Alaska?
  1371. ifdef AK
  1372. first Sat in March        Iditarod starts
  1373. endif
  1374. X
  1375. 3/17                St. Patrick's Day
  1376. X
  1377. # another local holiday - included only if "MA" or "ME" defined
  1378. ifdef MA || ME
  1379. 3rd Monday in Apr        Patriots' Day (MA, ME)
  1380. endif
  1381. X
  1382. last Monday in May*        Memorial Day
  1383. X
  1384. 6/14                Flag Day
  1385. X
  1386. 7/4*                Independence Day
  1387. X
  1388. 1st Monday in Sep*        Labor Day
  1389. X
  1390. second Monday in Oct        Columbus Day (observed)
  1391. 10/31                Halloween
  1392. X
  1393. Tue after first Mon in Nov    Election Day
  1394. second Mon in Nov        Veterans' Day # (observed)
  1395. fourth Thu in Nov*        Thanksgiving
  1396. day after fourth Thu in Nov*
  1397. X
  1398. 12/24*                Christmas Eve
  1399. 12/25*                Christmas
  1400. last day in Dec*        New Year's Eve
  1401. X
  1402. # if the symbol "paydays" has been defined, print text on alternate
  1403. # Fridays (starting with the first Friday of the year)
  1404. ifdef paydays
  1405. odd Fridays in year        Pay Day
  1406. endif
  1407. X
  1408. # if the symbol "meetings" has been defined, print text on the next-to-last
  1409. # Monday of each month
  1410. ifdef meetings
  1411. -2nd Monday in all        Monthly staff meeting
  1412. endif
  1413. X
  1414. 1/1/92*                New Year's Day        # reset year implicitly
  1415. SHAR_EOF
  1416. chmod 0666 calendar ||
  1417. echo 'restore of calendar failed'
  1418. Wc_c="`wc -c < 'calendar'`"
  1419. test 7374 -eq "$Wc_c" ||
  1420.     echo 'calendar: original size 7374, current size' "$Wc_c"
  1421. fi
  1422. true || echo 'restore of exprpars.c failed'
  1423. echo End of part 1, continue with part 2
  1424. exit 0
  1425.