Pcal v4.0, part 1 of 5
joseph.a.brownlee
jbr0 at cbnews.att.com
Thu Mar 14 22:44:02 AEST 1991
This is "pcal", the Postscript calendar program, version 4.0.
The major version number change reflects several new features, a complete
re-work of the source code, and support for MS-DOS and the Amiga in addition
to UNIX and VMS.
Normally, I post the list of changes from the ReadMe file, but they are so
extensive that I will only give a digest here. The ReadMe is the first file
in the distribution; see it for further details. Changes include:
. Break-up of pcal.c into a suite of source files.
. ANSI function prototypes are included
. All calendar calculations are done in C rather than Postscript
. Enlarged the numbers for the "small" calendars
. Supports whole-year calendars on a single page
. Ability to leave usued boxes blank (rather than gray)
. May select outlined numbers rather than "greyed"
. "Pre-processor" now supports boolean operators
. Support for "every other week" type events
. May specify ordinal dates relative to the year (i.e. 100th day of year)
. May specify dates relative to the end of a month or year
. Date file supports C-style backslash escapes
. Phase of moon datae may be specified using a file
. Search path for date file now includes same directory as the executable
. Several bug fixes
Pcal 4.0 has been more of a collaborative effort than usual. The team included
Richard Dyson doing the VMS support files, Bill Hogsett doing the Amiga port,
Floyd Miller doing the MS-DOS port, and Andrew Rogers who did the lion's share
of the programming and integration work. Thanks one and all for your help.
Although they probably wouldn't recognize the current version, countless
others worked on Pcal long before any of us ever heard of it; see the
Orig.ReadMe file and topline comments in pcal.c.
Enjoy!
- _ Joe Brownlee, Analysts International Corporation @ AT&T Bell Labs
/_\ @ / ` 471 E Broad St, Suite 1610, Columbus, Ohio 43215 (614) 860-7461
/ \ | \_, E-mail: jbr at cblph.att.com Who pays attention to what _I_ say?
"Scotty, we need warp drive in 3 minutes or we're all dead!" --- James T. Kirk
------------------------------ 8< cut here >8 ----------------------------------
#!/bin/sh
# This is a shell archive (produced by shar 3.49)
# To extract the files from this archive, save it to a file, remove
# everything above the "!/bin/sh" line above, and type "sh file_name".
#
# existing files will NOT be overwritten unless -c is specified
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 6728 -rw-r--r-- ReadMe
# 2893 -rw-r--r-- Make_Pcal.com
# 1155 -rw-r--r-- Makefile
# 1010 -rw-r--r-- Makefile.Amiga
# 1023 -rw-r--r-- Makefile.DOS
# 2238 -rw-r--r-- Makefile.VMS
# 984 -rw-r--r-- Orig.ReadMe
# 22115 -rw-r--r-- Pcal.hlp
# 670 -rw-r--r-- SetUp.com
# 31 -rw-r--r-- VaxCtrl.opt
# 7374 -rw-rw-rw- calendar
# 8311 -rw-rw-rw- exprpars.c
# 3095 -rw-rw-rw- moon91
# 9127 -rw-rw-rw- moonphas.c
# 1978 -rw-rw-rw- noprotos.h
# 33851 -rw-rw-rw- pcal.c
# 17774 -rw-r--r-- pcal.man
# 20982 -rw-r--r-- pcal.tex
# 14453 -rw-rw-rw- pcaldefs.h
# 3493 -rw-rw-rw- pcalglob.h
# 3975 -rw-r--r-- pcalinit.c
# 13415 -rw-rw-rw- pcalinit.ps
# 23965 -rw-rw-rw- pcallang.h
# 14737 -rw-r--r-- pcalutil.c
# 3428 -rw-rw-rw- protos.h
# 27599 -rw-r--r-- readfile.c
# 9889 -rw-r--r-- writefil.c
#
# ============= ReadMe ==============
if test -f 'ReadMe' -a X"$1" != X"-c"; then
echo 'x - skipping ReadMe (File already exists)'
else
echo 'x - extracting ReadMe (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'ReadMe' &&
"Pcal" Version 4.0
X
This is yet another version of "Pcal", the PostScript calendar program. Since
the changes to program structure and functionality were so extensive, it has
been given a new release number.
X
Major changes:
X
X 1) Of interest to Pcal hackers and installers:
X
X . You will notice several new files. Pcal was getting so large that
X it was in imminent danger of breaking some mailers; consequently
X it has been split into six .c files and three new .h files:
X
X pcal.c main, arg parsing, usage message
X pcalutil.c misc. utility routines
X readfile.c reading and parsing of date file
X writefil.c output of PostScript code
X moonphas.c* phase-of-moon calculations
X exprpars.c* parse Boolean expressions in "if{n}def"
X
X pcalglob.h global variables
X protos.h* ANSI-style function prototypes
X noprotos.h* K&R-style function declarations
X
X * all-new for v4.0
X
X (Note that encapsulating all of the PostScript output routines into
X a single file, writefil.c, facilitates porting PostScript to other
X typesetting packages, e.g., troff. Any takers?)
X
X . All of the routines now have ANSI function prototypes in addition
X to the older K&R-style declarations, selected automagically by a
X macro PROTOS which is defined whenever __STDC__ is present (or which
X may be explicitly defined for compilers which accept prototypes but
X are not fully ANSI-conformant). Similarly, a macro STDLIB controls
X inclusion of <stdlib.h>, an ANSI standard header which exists on
X some (but not all) non-ANSI systems.
X
X . Pcal now runs on the Commodore Amiga and under MS-DOS, thanks to the
X respective efforts of Bill Hogsett and Floyd Miller.
X
X . All of the calendar calculations are now performed in pcal.c; the
X PostScript code merely prints what it is told to. PostScript
X output now contains a comment identifying the version of Pcal and
X the name of the date file (if any) used.
X
X . The title inside the "notes" box has been moved from pcalinit.ps to
X pcallang.h so it may be easily translated to languages other than
X English.
X
X . The month/year title and dates in the small calendars have been
X enlarged (from 48 points to 60 and 54, respectively). The font sizes
X for the small, medium, and large calendars are now in arrays to
X facilitate further tweaking.
X
X . Pcalinit strips trailing comments (and the spaces preceding them) and
X allows <FF> in the input text. The logic of pcalinit.c has been
X revised for clarity, and the source has been documented. An optional
X parameter has been added to allow the user to specify the name of
X the string array in the output file.
X
X
X 2) New command-line options:
X
X . The "-w" option has been added to print calendars for a whole year
X on a single page. This option effectively disables the -M|m (moons)
X and -J|j (Julian dates) flags, and also suppresses the text in the
X calendar boxes. The numeric parameters work slightly differently:
X
X yy print Jan/yy .. Dec/yy
X mm yy print 12 months starting with mm/yy
X mm yy n print n months (rounded up to multiple of 12)
X starting with mm/yy
X (default) print Jan .. Dec of current year
X
X Note that "-w" in conjunction with "-p" overrides any Y-scale factor
X (default or set with "-y") in order to use the full portrait page.
X
X . The "-B" option has been added; this directs Pcal to leave unused
X calendar boxes blank.
X
X . The "-O" option has been added; this directs Pcal to print all "gray"
X dates as outlined characters.
X
X
X 3) New date file functionality:
X
X . The Pcal "preprocessor" now accepts Boolean expressions in "if{n}def"
X directives. These expressions consist of symbol names joined
X by Boolean operators !, &, ^, and | (in order of precedence, high
X to low). Parentheses may be used to alter the precedence; && and
X || are accepted as synonyms for & and |. A symbol name evaluates
X to TRUE if currently defined, FALSE if not; thus, "ifdef A | B | C"
X is TRUE if any of the symbols A, B, and C is defined, and
X "ifdef A & B & C" is true if they all are.
X
X "ifndef <expr>" is equivalent to "ifdef !( <expr> )".
X
X . Pcal supports "odd" and "even" - meaning "alternate, starting with
X first" and "alternate, starting with second" - as ordinals and "year"
X to refer to the entire year as an entity (as opposed to "all", which
X refers to each individual month). Thus "odd Thursdays in year" expands
X to 1/3/91, 1/17, 1/31, 2/14, 2/28... while "odd Thursdays in all"
X expands to 1/3, 1/17, 1/31, 2/7, 2/21... .
X
X . Pcal supports all ordinal numbers (e.g., "100th day of year"),
X although only "first" .. "fifth" may be spelled out (as before).
X It even supports negative ordinals; "-2nd" means "next to last".
X
X . Pcal now allows C-style escape sequences ('\' followed by a character,
X 1-3 octal digits, or 'x' followed by 1-2 hexadecimal digits) in the
X date file. Escaped whitespace (including <NL>) and the standard
X ANSI character escapes ('\a', '\b', '\f', '\n', '\r', '\t', '\v')
X are all replaced by a single blank.
X
X . Pcal now reads phase-of-the-moon information from file .moonXX (where
X XX is the last two digits in the current year) if such a file exists
X in the same directory as the .calendar file. If no such file exists,
X Pcal calculates the approximate phase for each date (as before). (The
X file name may vary between systems.)
X
X
X 4) Other new functionality:
X
X . If Pcal cannot find the date file in the standard search places
X (PCAL_DIR and HOME), it makes one last attempt to find it in the
X directory where the Pcal executable resides.
X
X
X 5) Bug fixes:
X
X . "1 << n" has been rewritten as "1L << n" throughout; this caused
X problems on some machines where "int" is 16 bits.
X
X . Fixed loadwords() to correctly handle single- and double-quoted
X strings, including those containing escaped quotes.
X
X . In response to popular demand, revised enter_day_info() to silently
X ignore Feb 29 of common years (this may be disabled by setting
X FEB_29_OK to 0 in pcaldefs.h).
X
X . The -f flag works correctly in conjunction with PCAL_DIR.
X
X . Pcalinit correctly escapes backslashes and double quotes.
X
X
X
Credit where credit is due:
X
Pcal 4.0 has been more of a collaborative effort than usual. The following
people contributed in some way to its final form:
X
X Overall coordinator, man page, useful ideas: Joe Brownlee
X VMS support: Richard Dyson
X Amiga support, prototypes: Bill Hogsett
X DOS support, executable path search Floyd Miller
X Other C and PostScript code: Andrew Rogers
X
Although they probably wouldn't recognize the current version, countless
others worked on Pcal long before any of us ever heard of it; see the
Orig.ReadMe file and topline comments in pcal.c.
SHAR_EOF
chmod 0644 ReadMe ||
echo 'restore of ReadMe failed'
Wc_c="`wc -c < 'ReadMe'`"
test 6728 -eq "$Wc_c" ||
echo 'ReadMe: original size 6728, current size' "$Wc_c"
fi
# ============= Make_Pcal.com ==============
if test -f 'Make_Pcal.com' -a X"$1" != X"-c"; then
echo 'x - skipping Make_Pcal.com (File already exists)'
else
echo 'x - extracting Make_Pcal.com (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'Make_Pcal.com' &&
$ If F$Mode () .eqs. "INTERACTIVE"
$ Then
$ VERIFY = F$Verify (0)
$ Else
$ VERIFY = F$Verify (1)
$ EndIf
$!========================================================================
$!
$! Name : MAKE_PCAL.COM
$!
$! Purpose : Compile and Link pcal under VMS
$!
$! Arguments : P1/P2 = DATE_DEBUG: compile with DEBUG info
$! P1/P2 = LINK : link only
$!
$! Created: 13-SEP-1990 Rick Dyson
$! Updated: 20-SEP-1990 pcal v2.3
$! Updated: 2-OCT-1990 pcal v2.4
$! Updated: 8-OCT-1990 pcal v2.5
$! Updated: 2-JAN-1991 pcal v3.0
$! Updated: 15-FEB-1991 pcal v3.1
$! Updated: 1-MAR-1991 pcal v4.0
$!
$!========================================================================
$ THIS_PATH = F$Element (0, "]", F$Environment ("PROCEDURE")) + "]"
$ Set Default 'THIS_PATH'
$ On Error Then GoTo FINISH
$ On Control_Y Then GoTo FINISH
$ If P1 .eqs. "DATE_DEBUG" .or. P2 .eqs. "DATE_DEBUG"
$ Then
$ CC := Cc /Debug /NoOptimize /NoList /Define = (VMS)
$ LINK := Link /Debug /NoMap
$ Else
$ CC := Cc /NoList /Define = (VMS)
$ LINK := Link /NoMap
$ EndIf
$ If P1 .eqs. "LINK" .or. P2 .eqs. "LINK" Then GoTo LINK
$ Write Sys$Output "Making pcalinit..."
$ CC PCALINIT
$ LINK PCALINIT,VAXCRTL.OPT /Option
$ PCALINIT := $ 'THIS_PATH'PCALINIT.EXE
$ Write Sys$Output "Executing pcalinit..."
$ PCALINIT PCALINIT.PS PCALINIT.H
$ Write Sys$Output "Compiling pcal programs..."
$ CC PCAL.C
$ CC EXPRPARS.C
$ CC MOONPHAS.C
$ CC PCALUTIL.C
$ CC READFILE.C
$ CC WRITEFIL.C
$LINK:
$ Write Sys$Output "Linking pcal..."
$ LINK PCAL,EXPRPARS,MOONPHAS,PCALUTIL,READFILE,WRITEFIL,VAXCRTL.OPT /Opt
$EXIT:
$ If .not. $Status Then GoTo FINISH
$ Set NoOn
$ Set Protection = Owner:RWED *.OBJ;*,PCAL.EXE;-1,PCALINIT.EXE
$ Delete /Log /NoConfirm *.OBJ;,PCALINIT.EXE;
$ Purge /Log /NoConfirm PCAL.EXE
$ If F$Search ("PCAL.HLB") .eqs. ""
$ Then
$ Write Sys$Output "Creating a help library for Pcal..."
$ Library /Log /Help /Create PCAL PCAL
$ Else
$ Write Sys$Output "Updating help library for Pcal..."
$ Library /Log /Help PCAL PCAL
$ EndIf
$ Set File /Truncate PCAL.HLB
$ LIB = "Hlp$Library"
$ X = F$Trnlnm (LIB, "Lnm$Process")
$ If X .eqs. "" Then GoTo INSERT
$ If X .eqs. "''THIS_PATH'PCAL.HLB" Then GoTo FINISH
$ BASE = LIB + "_"
$ N = 1
$NEXTLIB:
$ LIB := 'BASE''N'
$ X = F$Trnlnm (LIB, "Lnm$Process")
$ If X .eqs. "" Then GoTo INSERT
$ If X .eqs. "''THIS_PATH'PCAL.HLB" Then GoTo FINISH
$ N = N + 1
$ GoTo NEXTLIB
$INSERT:
$ Define 'LIB' 'THIS_PATH'PCAL.HLB
$FINISH:
$ Set Protection = Owner:RWED CALENDAR.,MOON91.
$ Rename CALENDAR. SAMPLE_CALENDAR.DAT
$ Rename MOON91. MOON91.DAT
$ Set Protection = (S:RWE, O:RWE, G:RE, W:RE) *.*
$ If VERIFY Then Set Verify
$ Exit
SHAR_EOF
chmod 0644 Make_Pcal.com ||
echo 'restore of Make_Pcal.com failed'
Wc_c="`wc -c < 'Make_Pcal.com'`"
test 2893 -eq "$Wc_c" ||
echo 'Make_Pcal.com: original size 2893, current size' "$Wc_c"
fi
# ============= Makefile ==============
if test -f 'Makefile' -a X"$1" != X"-c"; then
echo 'x - skipping Makefile (File already exists)'
else
echo 'x - extracting Makefile (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'Makefile' &&
#
# Makefile for Pcal v4.0 under UNIX
#
X
# Set the configuration variables below to taste.
X
CC = /bin/cc
MANDIR = /usr/man
COPTS =
OBJECTS = pcal.o exprpars.o moonphas.o pcalutil.o readfile.o writefil.o
X
pcal: $(OBJECTS)
X $(CC) $(LDFLAGS) -o pcal $(OBJECTS)
X @ echo "Build of pcal complete"
X
exprpars.o: exprpars.c pcaldefs.h
X $(CC) $(CFLAGS) $(COPTS) -c exprpars.c
X
moonphas.o: moonphas.c pcaldefs.h pcalglob.h
X $(CC) $(CFLAGS) $(COPTS) -c moonphas.c
X
pcal.o: pcal.c pcaldefs.h pcalglob.h pcallang.h
X $(CC) $(CFLAGS) $(COPTS) -c pcal.c
X
pcalutil.o: pcalutil.c pcaldefs.h pcalglob.h pcallang.h
X $(CC) $(CFLAGS) $(COPTS) -c pcalutil.c
X
readfile.o: readfile.c pcaldefs.h pcalglob.h pcallang.h
X $(CC) $(CFLAGS) $(COPTS) -c readfile.c
X
writefil.o: writefil.c pcaldefs.h pcalglob.h pcallang.h pcalinit.h
X $(CC) $(CFLAGS) $(COPTS) -c writefil.c
X
pcalinit: pcalinit.c
X $(CC) $(CFLAGS) $(LDFLAGS) $(COPTS) -o pcalinit pcalinit.c
X
pcalinit.h: pcalinit pcalinit.ps
X pcalinit pcalinit.ps pcalinit.h
X
pcalglob.h: protos.h noprotos.h
X
clean:
X rm -f $(OBJECTS) pcal pcalinit pcalinit.h
X
man: pcal.man
X nroff -man pcal.man > pcal.1
X pack pcal.1
# mv pcal.1.z $(MANDIR)
SHAR_EOF
chmod 0644 Makefile ||
echo 'restore of Makefile failed'
Wc_c="`wc -c < 'Makefile'`"
test 1155 -eq "$Wc_c" ||
echo 'Makefile: original size 1155, current size' "$Wc_c"
fi
# ============= Makefile.Amiga ==============
if test -f 'Makefile.Amiga' -a X"$1" != X"-c"; then
echo 'x - skipping Makefile.Amiga (File already exists)'
else
echo 'x - extracting Makefile.Amiga (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'Makefile.Amiga' &&
# Makefile for the Amiga.
#
# Set the configuration variables below to taste.
X
CC = lc:lc
LDFLAGS = -cufirst -v -d0 -m3s -O
OBJECTS = pcal.o exprpars.o moonphas.o pcalutil.o readfile.o writefil.o
X
pcal: $(OBJECTS)
X blink from lib:c.o $(OBJECTS) to pcal lib lib:lcm.lib lib:lc.lib SC SD VERBOSE ND
X @ echo "+ Build of pcal complete!"
X
exprpars.o: exprpars.c pcaldefs.h
X $(CC) $(LDFLAGS) >bugs-$> exprpars.c
X
moonphas.o: moonphas.c pcaldefs.h pcalglob.h
X $(CC) $(LDFLAGS) >bugs-$> moonphas.c
X
pcal.o: pcal.c pcaldefs.h pcalglob.h pcallang.h
X $(CC) $(LDFLAGS) >bugs-$> pcal.c
X
pcalutil.o: pcalutil.c pcaldefs.h pcalglob.h pcallang.h
X $(CC) $(LDFLAGS) >bugs-$> pcalutil.c
X
readfile.o: readfile.c pcaldefs.h pcalglob.h pcallang.h
X $(CC) $(LDFLAGS) >bugs-$> readfile.c
X
writefil.o: writefil.c pcaldefs.h pcalglob.h pcallang.h
X $(CC) $(LDFLAGS) >bugs-$> writefil.c
X
pcalinit: pcalinit.c
X $(CC) $(LDFLAGS) >bugs-$> -Lscsdndver pcalinit pcalinit.c
X
pcalinit.h: pcalinit pcalinit.ps
X DH0:pcal/pcalinit pcalinit.ps
SHAR_EOF
chmod 0644 Makefile.Amiga ||
echo 'restore of Makefile.Amiga failed'
Wc_c="`wc -c < 'Makefile.Amiga'`"
test 1010 -eq "$Wc_c" ||
echo 'Makefile.Amiga: original size 1010, current size' "$Wc_c"
fi
# ============= Makefile.DOS ==============
if test -f 'Makefile.DOS' -a X"$1" != X"-c"; then
echo 'x - skipping Makefile.DOS (File already exists)'
else
echo 'x - extracting Makefile.DOS (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'Makefile.DOS' &&
# PCAL v4.0 MAKEFILE for MS-DOS.
# Uses TurboC command line compiler.
X
CC = tcc
CFLAGS = -DDOS
OBJECTS = pcal.obj exprpars.obj moonphas.obj pcalutil.obj readfile.obj writefil.obj
X
pcal.exe: $(OBJECTS)
X $(CC) $(LDFLAGS) $(OBJECTS)
X @ echo + Build of pcal complete!
X
exprpars.obj: exprpars.c pcaldefs.h
X $(CC) $(CFLAGS) $(COPTS) -c exprpars.c
X
moonphas.obj: moonphas.c pcaldefs.h pcalglob.h
X $(CC) $(CFLAGS) $(COPTS) -c moonphas.c
X
pcal.obj: pcal.c pcaldefs.h pcalglob.h pcallang.h
X $(CC) $(CFLAGS) $(COPTS) -c pcal.c
X
pcalutil.obj: pcalutil.c pcaldefs.h pcalglob.h pcallang.h
X $(CC) $(CFLAGS) $(COPTS) -c pcalutil.c
X
readfile.obj: readfile.c pcaldefs.h pcalglob.h pcallang.h
X $(CC) $(CFLAGS) $(COPTS) -c readfile.c
X
writefil.obj: writefil.c pcaldefs.h pcalglob.h pcallang.h pcalinit.h
X $(CC) $(CFLAGS) $(COPTS) -c writefil.c
X
pcalinit.exe: pcalinit.c
X $(CC) $(CFLAGS) $(LDFLAGS) $(COPTS) pcalinit.c
X
pcalinit.h: pcalinit.exe pcalinit.ps
X pcalinit pcalinit.ps pcalinit.h
X
clean:
X del *.obj
X del pcalinit.exe
X del pcalinit.h
SHAR_EOF
chmod 0644 Makefile.DOS ||
echo 'restore of Makefile.DOS failed'
Wc_c="`wc -c < 'Makefile.DOS'`"
test 1023 -eq "$Wc_c" ||
echo 'Makefile.DOS: original size 1023, current size' "$Wc_c"
fi
# ============= Makefile.VMS ==============
if test -f 'Makefile.VMS' -a X"$1" != X"-c"; then
echo 'x - skipping Makefile.VMS (File already exists)'
else
echo 'x - extracting Makefile.VMS (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'Makefile.VMS' &&
# This is a makfile for the public domain VMS version of MAKE by Nelson
# H.F. Beebe dated 20-Feb-88. Below you will find a paragraph cut out
# of the MAKE.DOC file. If you have this program and want to use it
# instead of the MAKE_PCAL.COM, rename this file from MAKEFILE.VMS to
# MAKEFILE. and type
# MAKE pcal ! for the program
# MAKE help ! for the help library
#
# The original version of MAKE was done by Stuart Feldman in
# 1978. This multi-operating-system version is based on a
# public-domain posting of 3-Dec-86 to the Usenet bulletin
# board mod.sources, its author known only by an EMAIL
# address: Caret at FAIRLIGHT.OZ. It contained support for Unix,
# OS9, and EON operating systems. The TOPS-20, VMS, and
# MS-DOS support was added by Nelson H.F. Beebe
# (BEEBE at UTAH-SCIENCE).
#
X
# Set the configuration variables below to taste.
X
CFLAGS = /NoList
COPTS = VAXCRTL.OPT /Option
OBJECTS = exprpars.obj moonphas.obj pcalutil.obj readfile.obj writefil.obj
OBJLIST = exprpars,moonphas,pcalutil,readfile,writefil
X
pcal: pcal.exe
X
pcal.exe: pcal.obj $(OBJECTS)
X $(CC) $(CFLAGS) pcal
X Link pcal,$(OBJLIST),$(COPTS)
X Rename CALENDAR. SAMPLE_CALENDAR.DAT
X Rename MOON91. MOON91.DAT
X Set Protection = (System:RWE, Owner:RWE, Group:RE, World:RE) *.*
X
exprpars.obj: exprpars.c pcaldefs.h
X $(CC) $(CFLAGS) exprpars.c
X
moonphas.obj: moonphas.c pcaldefs.h pcalglob.h
X $(CC) $(CFLAGS) moonphas.c
X
pcal.obj: pcal.c pcaldefs.h pcalglob.h pcallang.h
X $(CC) $(CFLAGS) pcal.c
X
pcalutil.obj: pcalutil.c pcaldefs.h pcalglob.h pcallang.h
X $(CC) $(CFLAGS) pcalutil.c
X
readfile.obj: readfile.c pcaldefs.h pcalglob.h pcallang.h
X $(CC) $(CFLAGS) readfile.c
X
writefil.obj: writefil.c pcaldefs.h pcalglob.h pcallang.h pcalinit.h
X $(CC) $(CFLAGS) writefil.c
X
pcalinit: pcalinit.exe
X
pcalinit.exe: pcalinit.c
X $(CC) $(CFLAGS) pcalinit.c
X Link $(LDFLAGS) pcalinit,$(COPTS)
X
pcalinit.h: pcalinit.exe pcalinit.ps
X MCR Sys$$Disk:[]pcalinit pcalinit.ps pcalinit.h
X
help: pcal.hlb
X
pcal.hlb: pcal.hlp
X Library /Log /Create /Help PCAL.HLB PCAL.HLP
X
clean:
X Purge /NoConfirm pcal.exe,pcalinit.exe
X Delete /NoConfirm *.obj;*
X Delete /NoConfirm pcalinit.h;
SHAR_EOF
chmod 0644 Makefile.VMS ||
echo 'restore of Makefile.VMS failed'
Wc_c="`wc -c < 'Makefile.VMS'`"
test 2238 -eq "$Wc_c" ||
echo 'Makefile.VMS: original size 2238, current size' "$Wc_c"
fi
# ============= Orig.ReadMe ==============
if test -f 'Orig.ReadMe' -a X"$1" != X"-c"; then
echo 'x - skipping Orig.ReadMe (File already exists)'
else
echo 'x - extracting Orig.ReadMe (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'Orig.ReadMe' &&
"Pcal" is a program to print PostScript calendars for any month and year.
By default, it looks for a file in the home directory named "calendar"
for entries with leading dates matching dates on the calendar, and prints
any following text under the appropriate day.
X
The program may be a little System V flavored (getopt, time routines)
but should be easily portable to other vintages of UNIX.
X
Pcal is the combined effort of several people, most notably Patrick Wood
of Pipeline Associates, Inc. for the original PostScript code and Bill
Vogel of AT&T for the calendar file mechanism. My part was simple
translation to a "C" program, the addition of a couple options and a more
generalized date searching routine (oh yes, and a manual page :-).
X
The original calendar PostScript was Copyright (c) 1987 by Patrick Wood
and Pipeline Associates, Inc. with permission to modify and redistribute.
Please retain this README file with the package.
X
X
Ken Keirnan
Pacific Bell
San Ramon, CA.
SHAR_EOF
chmod 0644 Orig.ReadMe ||
echo 'restore of Orig.ReadMe failed'
Wc_c="`wc -c < 'Orig.ReadMe'`"
test 984 -eq "$Wc_c" ||
echo 'Orig.ReadMe: original size 984, current size' "$Wc_c"
fi
# ============= Pcal.hlp ==============
if test -f 'Pcal.hlp' -a X"$1" != X"-c"; then
echo 'x - skipping Pcal.hlp (File already exists)'
else
echo 'x - extracting Pcal.hlp (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'Pcal.hlp' &&
1 PCAL
X Pcal generates PostScript to produce landscape or portrait
X calendars for any month and year. The arguments month,year, and
X nmonths, if provided, should be numeric. The month value should
X be in the range 1 - 12, and the year value should be specified as
X 1 or 2 digits or as the full 4 digit year. If no numeric
X arguments are provided, the calendar for the current month and
X year will be generated.
X
X If one numeric argument is provided, it is interpreted as the
X year value, and calendars for the entire year will be generated.
X Otherwise, nmonth months, starting with month and year, will be
X generated.
X
X For whole-year calendars (i.e. the -w option is given), the
X command line arguments are interpreted somewhat differently. By
X default, all months in the current year are printed, starting with
X January. If the month argument alone is given, it is expected to
X be the desired year to print, and prints all of the months in the
X given year. If both month and year are given, then 12 consecutive
X months are printed starting at the given month and year. If the
X month, year, and nmonths arguments are all present, printing
X begins with the given month and year and nmonths months are
X printed, rounded up to the nearest multiple of 12.
X
X VMS Version
X Execution format:
X
X pcal [options] [mm yy] [n]
X
2 parameters
X mm yy n
X "mm" and "yy" are numeric values of the month (1-12) and year
X (0-99) (i.e., July 1990 would be 7 90). If you just include the
X "yy" option, an entire 12 months of calendars will be generated.
X A specific month can be produced by including the "mm" parameter.
X The "n" parameter will produce the "n" consecutive months of
X calendars starting with the requested month.
X
X The following flags may be specified (in increasing order of
X precedence) in global symbol PCAL_OPTS, in "opt" lines in the date
X file (all but -e, -f, -"D", -"U"), or on the command line. Any
X flag which normally takes an argument may be specified without the
X argument; this resets its value to the program default. (-"D"
X alone thus clears all defined symbols; -"U" alone has no effect.)
X
X The '-' flag has been added to disambiguate cases where an
X argument-less flag has been specified immediately before a numeric
X parameter:
X
X pcal -t - 9 90
X
2 options
X Pcal accepts several command line options (or from the
X CALENDAR.DAT file). The uppercase options should be enclosed in
X quotes as the VMS command line parser will not distinguish between
X the case otherwise. The quoted strings are not needed if the
X options are included within the CALENDAR.DAT file.
X
3 -e
X Print an empty calendar (i.e., do not print entries from a
X CALENDAR.DAT file.)
X
3 -f <FILE>
X Directs pcal to use the file name <FILE> as the input file in
X place of the default CALENDAR.DAT file in the callers home
X directory or in the directory specified by logical name PCAL_DIR.
X
3 -o <FILE>
X Directs pcal to write the PostScript calendar into FILE
X (default: CALENDAR.PS in the current directory.)
X
3 -j
X Directs pcal to print the Julian (Day Of Year, DOY) in each
X calendar box.
X
3 -"J"
X Directs pcal to print the Julian (Day Of Year, DOY) and the
X number of days remaining in the year in each calendar box.
X
3 -l
X This will cause the output to come out in landscape mode
X (This is the default).
X
3 -p
X This will cause the output to come out in portrait mode
X instead of landscape mode.
X
3 -m
X This option causes a moon to be printed on days corresponding
X to a full, half, or new moon (default: no moons).
X
3 -"M"
X This option causes a moon to be printed on all days (default:
X no moons).
X
3 -b <DAY> | all
X This will cause all dates on weekday DAY to be printed in
X black; "-b all" causes all dates to be printed in black unless
X explicitly flagged as a holiday.
X
3 -g <DAY> | all
X This will cause all dates on weekday DAY to be printed in
X gray; "-g all" causes all dates to be printed in gray. Default is
X to print Saturdays and Sundays in gray and other dates in black.
X
3 -"F" <DAY>
X This will cause the weekday DAY to be the first day of each
X week; weekday DAY will appear in the left-most column of each
X calendar.
X
3 -"A" | -"E"
X Directs pcal to use either American or European date
X conventions. Use one of these options to select the date format
X for the calendar file. The -"A" option (the default) selects
X American-style dates like "10/19/90" or "Sep 19 1990", while the
X -"E" option selects European-style dates like "17/10/90" or "19
X Sep 1990".
X
3 -t <FONT>
X This option can be used to change the font the title is
X printed in (ie. pcal -t Times-Roman). The default is Times-Bold.
X
3 -d <FONT>
X This option is the same as -t except that the font used to
X print the day numbers is changed. The default is Times-Bold.
X
3 -n <FONT>
X This option is the same as -n except that the font used to
X print the notes in the calendar boxes is changed. The default is
X Helvetica-Narrow.
X
3 -"L" <STRING>
X This will cause STRING to be printed as a left footer.
X
3 -"C" <STRING>
X This will cause STRING to be printed as a center footer.
X
3 -"R" <STRING>
X This will cause STRING to be printed as a right footer.
X
3 -"D" <SYM>
X This will define symbol SYM prior to reading the date file;
X -"D" alone clears all defined symbols.
X
3 -"U" <SYM>
X This will undefine symbol SYM prior to reading the date file.
X
3 -x xscale
X Specifies the x-axis scaling factor for the calendar size.
X
3 -y yscale
X Specifies the y-axis scaling factor for the calendar size.
X
3 -"X" xtrans
X Specifies the x-axis translation value for positioning the
X output on the page.
X
3 -"Y" ytrans
X Specifies the y-axis translation value for positioning the
X output on the page.
X
3 -"I"
X Resets all parameters to the program defaults.
X
3 -"O"
X Causes pcal to print "gray" dates as outlined characters
X instead.
X
3 -"B"
X Causes pcal to leave unused calendar boxes blank (default is
X gray).
X
3 -w
X Causes pcal to print a calendar for 12 consecutive months: 3
X rows / 4 columns in landscape mode, 4 rows / 3 columns in portrait
X mode. This option effectively disables the -"M"|m (moons) and
X -"J"|j (Julian dates) flags, and also suppresses the text in the
X calendar boxes. The numeric parameters work slightly differently:
X
X yy print Jan/yy .. Dec/yy
X mm yy print 12 months starting with mm/yy
X mm yy n print n months (rounded up to multiple of 12)
X starting with mm/yy
X (default) print Jan .. Dec of current year
X
X Note that "-w" in conjunction with "-p" overrides any Y-scale
X factor (default or set with "-y") in order to use the full
X portrait page.
X
3 -h
X This prints version and usage information only.
X
2 Calendar_File
X By default, pcal simply prints an empty calendar. Its real
X power is in its ability to place "events" in appropriate days on
X the calendar, thus allowing the user to create personalized
X calendars. This is achieved through the use of the "date file".
X
X The date file is named CALENDAR.DAT Pcal will look in several
X places for such a file. First, if a file called CALENDAR.DAT
X exists in the caller's home directory, it is used. Next, if such
X a file exists in the directory indicated by the logical name
X PCAL_DIR (or the current directory if no such variable is
X defined), it is used. Finally, the directory where the pcal
X executable resides will be checked. If no date file is found, an
X empty calendar is printed.
X
X If a date file is found, it will be searched for lines with
X leading dates matching the requested month and year. Any text
X following the dates found will be printed on the calendar under
X the appropriate day of the month. Dates in the CALENDAR.DAT file
X may be expressed in any of several formats:
X
X <ordinal> <day_spec> in <month_spec>{*} {<text>}
X <day_spec> <prep> <date_spec>{*} {<text>}
X <date_spec>{*} {<text>}
X
X Where:
X
X <month_spec> := first 3+ characters of name of month or "all"
X <day_spec> := first 3+ characters of name of weekday, "day",
X "weekday", "workday", "holiday",
X "nonweekday", "nonworkday", or "nonholiday"
X <ordinal> := "first", "1st", ... "fifth", "5th",
X "last", "odd", "even", or "all"
X <prep> := "before", "preceding", "after", "following",
X "on_or_before" ("oob"), or
X "on_or_after" ("ooa")
X <sep> := 1 or more non-numeric, non-space, non-'*' characters
X <month> := day of month (1-31)
X <day> := a numeric month (1-12)
X <year> := a numeric year
X
X If the -"A" option (American date formats, the default) is given:
X
X <date_spec> := [<month_spec><day> | <month><sep><day>{<sep><year>}]
X
X If the -"E" option (European date formats) is given:
X
X <date_spec> := [<day><month_spec> | <day><sep><month>{<sep><year>}]
X
X Any non-numeric character may separate numeric dates.
X Holidays may be flagged by following the date immediately with `*'
X as in the examples above; this will cause the date to be printed
X in gray. "Each" and "every" are accepted as synonyms for "all",
X and any word may be used in place of "in". The abbreviations
X "oob" and "ooa" may be used in place of the keywords
X "on_or_before" and "on_or_after", respectively.
X
X Wildcard day names are also provided. The keyword "weekday"
X applies to any days which are normally printed in black on the
X calendar. The keyword "workday" is the same, but does not include
X any holidays. The keyword "holiday" includes only those days
X flagged as holidays. The keywords "nonweekday", "nonworkday", and
X "nonholiday" are also recognized as negations of the above. See
X the Caveats below for important notes on using these keywords.
X
X Ordinal day numbers may be used to specify dates, either
X relative to the month or to the year. Either words or numeric
X abbreviations may be used for "first" through "fifth"; higher
X numbers must be given using the numeric equivalent (e.g. 100th).
X Negative ordinal numbers may even be used. For example, "-2nd"
X means "next to last".
X
X "Odd" and "even" do not refer to the actual date; instead,
X "odd" means "alternate, starting with the first", and "even" means
X "alternate, starting with the second". Thus, "odd Fridays in
X March" refers to the first, third, and (if present) fifth Fridays
X in March - not to those Fridays falling on odd dates.
X
X "All" refers to each individual month; "year" refers to the
X year as an entity. Thus "odd Fridays in all" refers to the first,
X third, and fifth Friday of each month, while "odd Fridays in year"
X refers to the first Friday of January and every other Friday
X thereafter.
X
X Text in the date file may use C-like escape sequences (i.e. a
X `\' followed by a character, 1--3 octal digits, or `x' followed by
X 1--2 hexadecimal digits). Escaped whitespace (including newline)
X and the standard ANSI character escapes (`\a', `\b', `\f', `\n',
X `\r', `\t', `\v') are all replaced by a single blank.
X
X Lines in the CALENDAR.DAT file consisting of year XXXX (where
X XXXX is a numeric year) can be used to set the year for following
X entries. This assumes that the following entries do not contain a
X year; any date entries containing year information will set the
X remembered year to that year.
X
X Lines in the CALENDAR.DAT file consisting of opt <options> can
X be used to override the defaults for any command-line options
X except -e, -f, -h, -"D", and -"U". Any options specified in this
X manner are, in turn, overridden by those specified explicitly on
X the command line. Note that the upper case letter options do NOT
X need to be enclosed in quotes if they are put in the CALENDAR.DAT
X file. Enclose the upper case letters in quotes only when they are
X used on the DCL.
X
X Lines in the CALENDAR.DAT file consisting of note <month> can
X be used to place notes regarding the entire month is one of the
X unused blocks of the calendar. The <month> indicator may be
X either a number 1 through 12 or an alphabetic month name as
X described above; "note all" will place the associated text in the
X notes block for each month in the current year.
X
X Comments are supported in the CALENDAR.DAT file. Any
X characters following a `#' character through the end of the line
X are ignored.
X
X Pcal supports rudimentary cpp-like functionality in the date
X file, allowing the following constructs: define | undef, if{n}def
X ... {else ...} endif, and include. Note that these are not
X preceded by `#' as they are in C. Symbol names defined using
X these keywords (or via the -"D" option) are case-insensitive. It
X is not an error to undef an undefined symbol, nor to define a
X previously-defined one. An ifdef alone is always false; an
X ifndef alone is always true.
X
X The name of the file in the include directive may optionally
X be surrounded by either "" or <>, both of which are ignored. If
X the name is not an absolute path, it is taken to be relative to
X the directory where the file containing the directive is located.
X
X In addition to pre-processing keywords, pcal also accepts
X boolean expressions in if{n}def directives. These expressions
X consist of symbol names joined by the boolean operators !, &, ^,
X and |, in order of precedence, high to low. Parentheses may be
X used to alter the precedence. The synonyms && and || are accepted
X for & and |. A symbol name evaluates to true if currently
X defined, false if not; thus:
X
X ifdef A | B | C
X
X ...is true if any of the symbols A, B, and C is defined, and:
X
X ifdef A & B & C
X
X ...is true if they all are. Note that ifndef <expr> is equivalent
X to ifdef !( <expr> ).
X
3 notes
X Pcal allows the user to print additional notes in an unused
X calendar box via lines of the form "note <month> <text>", where
X <month> specifies the month (numeric or alphabetic form) and
X <text> is the text to add. All such text will appear in the
X "Thursday" box on the last line (next to the small calendars).
X
3 Example
X Date File Example:
X
X # A sample "opt" line to change the fonts and output file names,
X # to print only Sundays in gray, and to print moons on all days:
X #
X opt -d Helvetica-Bold -t Helvetica-Bold -o myfile.ps -b all -g sun -M
X
X year 1990 # set year explicitly
X 1/1* New Year's Day
X ifndef Arizona
X 3rd Mon in Jan* Martin Luther King's Birthday
X endif
X 2/2 Groundhog Day
X Feb 14 Valentine's Day
X 3rd Monday in Feb* Presidents' Day
X 3/17 St. Patrick's Day
X last Monday in May* Memorial Day
X 7/4* Independence Day
X 1st Monday in Sep* Labor Day
X second Monday in Oct* Columbus Day (observed)
X 10/12 Columbus Day (traditional)
X 10/31 Halloween
X Tue after first Mon in Nov Election Day
X second Monday in Nov* Veterans' Day (observed)
X 11/11* Veterans' Day (traditional)
X fourth Thu in Nov* Thanksgiving
X day after fourth Thu in Nov*
X 12/24* Christmas Eve
X 12/25* Christmas
X last day in Dec* New Year's Eve
X last workday in all Status reports due
X note Dec Office closed throughout week of Christmas
X 1/1/91* New Year's Day # set new year implicitly
X
2 Moon_File
X If a file of the name MOONxx.DAT (where xx is the last two
X digits of the calendar year) exists in the same directory as the
X date file, pcal uses the information contained within to calculate
X the phase of the moon. If no such file exists, pcal uses an
X approximate algorithm.
X
X Entries in the moon file must conform to the following syntax:
X
X If the -"A" option (American date formats, the default) is
X given:
X
X <quarter> <month><sep><day> {<hour><sep><min>}
X
X If the -"E" option (European date formats) is given:
X
X <quarter> <day><sep><month> {<hour><sep><min>}
X
X Where:
X
X <quarter> := "nm", "fq" or "1q", "fm", "3q" or "lq"
X (new moon,first quarter,full moon,last quarter)
X <hour> := number 0-23 (24-hour clock)
X <min> := number 0-59
X
X This file must contain entries for all quarter moons in the
X year, in chronological order; if any errors are encountered, pcal
X will revert to using its default algorithm.
X
X As in the date file, comments start with '#' and run through
X end-of-line.
X
3 Example
X The following is a short example of an European style (-"E)
X moon data file. It is taken from the MOON91.DAT file supplied
X with pcal.
X
X 3q 01/07 13:37 # third quarter
X nm 01/15 18:51 # new moon
X 1q 01/23 09:23 # first quarter
X fm 01/30 01:10 # full moon
X
2 Logical_Names
X Pcal optionally uses two (2) logical names during execution.
X A user may define them or let the administrator set them up.
X
3 Pcal_Dir
X Pcal logical name for the location of the directory for input
X and output files. In this way, a user can over-ride the current
X default location for the source of the CALENDAR.DAT input file,
X MOONxx.DAT, and the CALENDAR.PS output file.
X
3 Pcal_Opts
X Pcal also looks for a logical name "Pcal_Opts; if defined,
X its contents are parsed as command-line flags. These over-ride
X the program defaults, but are over-ridden by any specified via
X "opt" lines in the date file or on the command line. Example:
X
X Define Pcal_Opts "-n Helvetica -D meetings" ! login.com
X pcal -"U" meetings 9 90 ! un-define symbol at runtime
X
2 Caveats
X The "workday" and "holiday" keywords are aware of only those
X holidays which have already been flagged at the point where they
X appear. For example, consider January 1990:
X
X January 1990
X S M Tu W Th F S
X 1 2 3 4 5 6
X 7 8 9 10 11 12 13
X 14 15 16 17 18 19 20
X 21 22 23 24 25 26 27
X 28 29 30 31
X
X If the CALENDAR.DAT file looked like this:
X
X workday on_or_before all 15 payday
X 3rd Mon in Jan* MLK day
X
X then Pcal would mark the 15th as "payday" since at that point in
X the CALENDAR.DAT file it has no way of knowing that January 15th
X will later be flagged as a holiday. If the two lines were
X reversed, such that the holiday preceded the "workday" wildcard,
X then Pcal would work as intended, marking instead the 12th as
X "payday". Also, beware of year boundaries which affect the
X handling of all of the day wildcard keywords. In general, it is
X best to place monthly wildcards such as the example above at the
X end of each year to acheive the desired effect.
X
X When the -w and -p options are used together, pcal revises the
X y-scale factor in order to use the entire portrait page;
X therefore, the user should avoid using use the -y using both the
X -w and -p options. Use of the -w option in any case effectively
X disables the -m, -"M", -j, and -"J" options.
X
2 Authors
X The original PostScript code to generate the calendars was
X written by Patrick Wood (Copyright (c) 1987 by Patrick Wood of
X Pipeline Associates, Inc.), and authorized for modification and
X redistribution. The CALENDAR.DAT file inclusion code was
X originally written in "bs(1)" by Bill Vogel of AT&T. Patrick's
X original PostScript was modified and enhanced several times by
X others whose names have regrettably been lost. Ken Keirnan of
X Pacific Bell assembled the original "C" version upon which this is
X based; additional modifications and enhancements were the work of
X Joseph P. Larson, Ed Hand, Andrew W. Rogers, Mark Kantrowitz,
X Joe Brownlee, Jamie Zawinski and Floyd Miller. The moon routines
X were originally written by Mark Hanson, were improved and
X incorporated into this version by Jamie Zawinski, and were
X translated from PostScript to C by Andrew Rogers. This VMS
X support was provided by Richard Dyson and updated by Andrew W.
X Rogers and Joe Brownlee. The Amiga support was supplied by Bill
X Hogsett.
X
2 Version
X This help file currently reflects pcal v4.0 dated 24-FEB-1991
X and was updated by Richard Dyson on 3-MAR-1991.
SHAR_EOF
chmod 0644 Pcal.hlp ||
echo 'restore of Pcal.hlp failed'
Wc_c="`wc -c < 'Pcal.hlp'`"
test 22115 -eq "$Wc_c" ||
echo 'Pcal.hlp: original size 22115, current size' "$Wc_c"
fi
# ============= SetUp.com ==============
if test -f 'SetUp.com' -a X"$1" != X"-c"; then
echo 'x - skipping SetUp.com (File already exists)'
else
echo 'x - extracting SetUp.com (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'SetUp.com' &&
$ Write Sys$Output "SETting UP Pcal (v4.0)..."
$ THIS_PATH = F$Element (0, "]", F$Environment ("PROCEDURE")) + "]"
$ PCAL :== $ 'THIS_PATH'PCAL.EXE
$ Define Pcal_Dir 'THIS_PATH'
$!
$! Put the help library into the next available help library slot
$!
$ LIB = "Hlp$Library"
$ X = F$Trnlnm (LIB, "Lnm$Process")
$ If X .eqs. "" Then GoTo INSERT
$ If X .eqs. "''THIS_PATH'PCAL.HLB" Then GoTo EXIT
$ BASE = LIB + "_"
$ N = 1
$NEXTLIB:
$ LIB := 'BASE''N'
$ X = F$Trnlnm (LIB, "Lnm$Process")
$ If X .eqs. "" Then GoTo INSERT
$ If X .eqs. "''THIS_PATH'PCAL.HLB" Then GoTo EXIT
$ N = N + 1
$ GoTo NEXTLIB
$INSERT:
$ Define 'LIB' 'THIS_PATH'PCAL.HLB
$EXIT:
$ Exit
SHAR_EOF
chmod 0644 SetUp.com ||
echo 'restore of SetUp.com failed'
Wc_c="`wc -c < 'SetUp.com'`"
test 670 -eq "$Wc_c" ||
echo 'SetUp.com: original size 670, current size' "$Wc_c"
fi
# ============= VaxCtrl.opt ==============
if test -f 'VaxCtrl.opt' -a X"$1" != X"-c"; then
echo 'x - skipping VaxCtrl.opt (File already exists)'
else
echo 'x - extracting VaxCtrl.opt (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'VaxCtrl.opt' &&
Sys$Library:VAXCRTL.EXE /Share
SHAR_EOF
chmod 0644 VaxCtrl.opt ||
echo 'restore of VaxCtrl.opt failed'
Wc_c="`wc -c < 'VaxCtrl.opt'`"
test 31 -eq "$Wc_c" ||
echo 'VaxCtrl.opt: original size 31, current size' "$Wc_c"
fi
# ============= calendar ==============
if test -f 'calendar' -a X"$1" != X"-c"; then
echo 'x - skipping calendar (File already exists)'
else
echo 'x - extracting calendar (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'calendar' &&
# Sample date file for Pcal: this should be called .calendar for Un*x,
# CALENDAR.DAT for VMS, and should live in the user's home directory.
#
# Date file syntax:
#
# The following rules describe the syntax of date file entries:
#
# year <year>
#
# opt <options>
#
# note <month_spec> <text>
# note <month> <text>
#
# if -A flag (American date formats) specified:
# <month_name> <day>{*} {<text>}
# <month><sep><day>{<sep><year>}{*} {<text>}
#
# if -E flag (European date formats) specified:
# <day> <month_name>{*} {<text>}
# <day><sep><month>{<sep><year>}{*} {<text>}
#
# <ordinal> <day_spec> in <month_spec>{*} {<text>}
# <day_spec> <prep> <date_spec>
#
# where
#
# {x} means x is optional
#
# <date_spec> := any of the above date specs (not year, note, or opt)
# <month_name> := first 3+ characters of name of month, or "all"
# <month_spec> := <month_name>, or "year"
# <day_name> := first 3+ characters of name of weekday, "day",
# "weekday", "workday", "holiday", "nonweekday",
# "nonworkday", or "nonholiday"
# <ordinal> := ordinal number ("1st", "2nd", etc.), "first" .. "fifth",
# "last", "even", "odd", or "all"
# <prep> := "before", "preceding", "after", "following", "on_or_before",
# or "on_or_after"
# <sep> := one or more non-numeric, non-space, non-'*' characters
# <month>, <day>, <year> are the numeric forms
#
# <options> := any command-line option except -e, -f, -h, -D, -U
#
# Comments start with '#' and run through end-of-line.
#
# Holidays may be flagged by specifying '*' as the last character of
# the date field(s), e.g. "10/12* Columbus Day", "July 4* Independence
# Day", etc. Any dates flagged as holidays will be printed in gray, and
# any associated text will appear adjacent to the date.
#
# Note that the numeric date formats (mm/dd{/yy}, dd.mm{.yy}) support
# an optional year, which will become the subsequent default year. The
# alphabetic date formats (month dd, dd month) do not support a year
# field; the "year yy" command is provided to reset the default year.
#
# "Floating" days may be specified in the date file as "first Mon in
# Sep", "last Mon in May", "4th Thu in Nov", etc.; any word may be
# used in place of "in". "Relative floating" days (e.g. "Fri after 4th
# Thu in Nov") are also accepted; they may span month/year bounds.
# Pcal also accepts date specs such as "all Friday{s} in October", "last
# Thursday in all", etc., and produces the expected results; "each" and
# "every" are accepted as synonyms for "all". Negative ordinals are
# allowed; "-2nd" means "next to last".
#
# The words "day", "weekday", "workday", and "holiday" may be used as
# wildcards: "day" matches any day, "weekday" matches any day normally
# printed in black, "workday" matches any day normally printed in black
# and not explicitly flagged as a holiday, and "holiday" matches any
# day explicitly flagged as a holiday. "Nonweekday", "nonworkday",
# and "nonholiday" are also supported and have the obvious meanings.
#
# "Odd" and "even" do not refer to the actual date; instead, "odd"
# means "alternate, starting with the first"; "even" means "alternate,
# starting with the second". Thus, "odd Fridays in March" refers to
# the first, third, and (if present) fifth Fridays in March - not to
# those Fridays falling on odd dates.
#
# "All" refers to each individual month; "year" refers to the year
# as an entity. Thus "odd Fridays in all" refers to the first/third/
# fifth Friday of each month, while "odd Fridays in year" refers to
# the first Friday of January and every other Friday thereafter.
#
# Additional notes may be propagated to an empty calendar box by the
# inclusion of one or more lines of the form "note <month> <text>",
# where <month> may be numeric or alphabetic; "note all <text>"
# propagates <text> to each month in the current year.
#
# Simple cpp-like functionality is provided. The date file may include
# the following commands, which work like their cpp counterparts:
#
# define <sym>
# undef <sym>
#
# if{n}def <expr>
# ...
# { else
# ... }
# endif
#
# include <file>
#
# Note that these do not start with '#', which is reserved as a comment
# character.
#
# <sym> is a symbol name consisting of a letter followed by zero or
# more letters, digits, or underscores ('_'). Symbol names are always
# treated in a case-insensitive manner.
#
# <expr> is an expression consisting of symbol names joined by the logical
# operators (in order of precedence, high to low) '!' (unary negate), '&'
# (and), '^' (exclusive or), and '|' (inclusive or). '&&' and '||' are
# accepted as synonyms for '&' and '|' respectively; the order of
# evaluation may be altered by the use of parentheses. A symbol whose
# name is currently defined evaluates to TRUE; one whose name is not
# currently defined evaluates to FALSE. Thus "ifdef A | B | C" is TRUE
# if any of the symbols A, B, and C is currently defined, and
# "ifdef A & B & C" is TRUE if all of them are.
#
# "ifndef A | B | C" is equivalent to "ifdef !(A | B | C)" (or, using
# DeMorgan's Law, "ifdef !A & !B & !C") - in other words, TRUE if none of
# the symbols A, B, and C is currently defined.
#
# "define" alone deletes all the current definitions; "ifdef" alone is
# always false; "ifndef" alone is always true.
#
# The file name in the "include" directive may optionally be surrounded
# by "" or <>. In any case, path names are taken to be relative to
# the location of the file containing the "include" directive.
X
X
# "opt" lines to override program defaults
X
opt -d Helvetica-Bold -t Helvetica-Bold -n Helvetica # override default fonts
opt -M # moon icons on all days
opt -O # print outlined characters
X
year 1991 # set year explicitly
X
# note to be propagated to "Notes" box for all months
X
note all Eng II Staff Meeting every Tuesday, 1:30 PM
X
# some sample holidays (flagged by '*') and other days of note
X
1/1* New Year's Day
X
# if "AZ", "NH", or "MT" defined, holiday definition will be skipped
ifndef AZ || \
X NH || \
X MT
3rd Monday in Jan* Martin Luther King Day (except AZ, NH, MT)
endif
X
3rd Monday in Feb Presidents' Day
Feb 14 Valentine's Day
X
# any Pcal users in Alaska?
ifdef AK
first Sat in March Iditarod starts
endif
X
3/17 St. Patrick's Day
X
# another local holiday - included only if "MA" or "ME" defined
ifdef MA || ME
3rd Monday in Apr Patriots' Day (MA, ME)
endif
X
last Monday in May* Memorial Day
X
6/14 Flag Day
X
7/4* Independence Day
X
1st Monday in Sep* Labor Day
X
second Monday in Oct Columbus Day (observed)
10/31 Halloween
X
Tue after first Mon in Nov Election Day
second Mon in Nov Veterans' Day # (observed)
fourth Thu in Nov* Thanksgiving
day after fourth Thu in Nov*
X
12/24* Christmas Eve
12/25* Christmas
last day in Dec* New Year's Eve
X
# if the symbol "paydays" has been defined, print text on alternate
# Fridays (starting with the first Friday of the year)
ifdef paydays
odd Fridays in year Pay Day
endif
X
# if the symbol "meetings" has been defined, print text on the next-to-last
# Monday of each month
ifdef meetings
-2nd Monday in all Monthly staff meeting
endif
X
1/1/92* New Year's Day # reset year implicitly
SHAR_EOF
chmod 0666 calendar ||
echo 'restore of calendar failed'
Wc_c="`wc -c < 'calendar'`"
test 7374 -eq "$Wc_c" ||
echo 'calendar: original size 7374, current size' "$Wc_c"
fi
true || echo 'restore of exprpars.c failed'
echo End of part 1, continue with part 2
exit 0
More information about the Alt.sources
mailing list