Trailing-Edge - PDP-10 Archives - decuslib20-07 - decus/20-0171/weekly.doc
There is 1 other file named weekly.doc in the archive. Click here to see a list.

     WW     WW  EEEEEEE  EEEEEEE  KK   KK   LL     YY    YY
     WW     WW  EE       EE       KK  KK    LL      YY  YY
     WW  W  WW  EE       EE       KK KK     LL       YYYY
     WW WWW WW  EEEEE    EEEEE    KKKKK     LL        YY
     WWWW WWWW  EE       EE       KKK KK    LL        YY
     WWW   WWW  EE       EE       KK   KK   LL        YY
       WWWWW  WW       EE       EE  KKKK  KK       LLL  YYY
          W   W  WW     EEEE     EEEE     KKKKK  LLLLLLLL  YYY
             WWWWW  WW       EE       EE  KKK  KKK  LLLLL  YYYY


                     An Academic Calendar Program

                           Donald E. Barth

                             9 July 1983

                 WEEKLY, an Academic Calendar Program
                 ------  -- -------- -------- -------

     The WEEKLY program constructs a calendar of the events which
     are  scheduled  for  the coming weeks.  This calendar can be
     printed at 12 characters per inch on  15  inch  wide  paper.
     The  width  of  each line in the calendar is 157 characters.
     The events which appear in the  calendar  are  described  by
     files which which are created using an ordinary text editor.
     Some of these files describe the events which take place  on
     a  particular  day of the week, such as on every Monday, for
     several weeks.  Other files describe events which take place
     only  once.   The calendar includes 1 column for each of the
     weekdays Monday through Friday, and a single column for  the
     weekend.   Weekend events are labeled as to whether they are
     held both days or only on Saturday or only on  Sunday.   The
     calendar   includes  the  starting  time,  the  ending  time
     although this is not required, and a  short  description  of
     each  event.  All of the events which start at the same time
     appear on the  same  line.   A  line  is  ruled  across  the
     calendar  at  the start of each new hour.  The first line in
     each description of an event which occurs only on  a  single
     date is darkened to draw attention to the event.

     The WEEKLY program is written entirely in  FORTRAN,  but  is
     system  dependent  both  in the construction of the names of
     the files which it reads and in the use of 5 characters  per
     computer  word to store the calendar for a single week while
     this is being accumulated.  The distributed version  is  for
     the DECsystem10 and DECsystem20.  However, the conversion to
     other systems should be relatively easy.  The program  reads
     the  event  descriptions using a multiple of an A1 format so
     that the interpretation of the line can be done in a  system
     independent manner.  To save space, if the line contains the
     text of  a  description  of  the  event,  a  FORTRAN  ENCODE
     statement  is  used  to pack 5 characters per computer word.
     The packed  text  is  stored  in  a  large  array  which  is
     addressed  by  date  and line.  After all of the files which
     describe the events for a single date have  been  read,  the
     information  for  that date is sorted by starting and ending
     times.  The calendar for the week is written into the output
     file  after  the  information  for  all  6  columns has been

     The WEEKLY program reads many files,  some  with  predefined
     names  and  others  with  names  chosen  by  the  user.  The
     WEEKLY.TOP file contains the text of one or more lines to be
     written  across  the  top  of  each  weekly  calendar.   The
     WEEKLY.DAY file specifies the names  of  other  files  which
     describe  the events which occur on the same day of the week
     for several weeks.  The names of the  files  which  describe
     repeating  events  should be chosen so as to have meaning to
     the person who maintains them.  Events which occur only once
     are  specified  in  files  which  have  names  of  the  form
     DDMMM.YY, where DD is the 2 digit day of the month,  MMM  is
2                       WEEKLY, an Academic Calendar Program

the  3  letter  month  abbreviation,  and  YY is the right 2
digits of the year.

   The WEEKLY.DAY File, Establishing a Repeating Schedule
   --- ------ --- ----  ------------ - --------- --------

Schedules of events which are repeated on a weekly basis are
specified  by  the  file  named  WEEKLY.DAY.   This file can
specify several different schedules  to  be  applied  during
various  parts  of  the  year.   Each schedule is defined by
several lines which state the range of  dates  during  which
the  schedule  is  to  be  active and the names of the files
which for each day of the week describe the events  and  the
times  during the day when these are held.  The first of the
lines which defines the schedule must start with  either  of
the  words  REGULAR  or  SPECIAL  and  this must be followed
directly by a colon.  A list of  the  dates  and/or  of  the
ranges of dates when this schedule is to be used must appear
to the right of the colon.

There can be only one  regular  schedule  for  a  particular
date, but any number of special schedules.  If more than one
schedule beginning with the word REGULAR is specified in the
WEEKLY.DAY  file  for a particular date, then only the first
of these is used for that  date.   All  schedules  beginning
with  the  word  SPECIAL  for  a  particular  date  are used
regardless of whether there are schedules for the same  date
which begin with the word REGULAR.  The lines which define a
single schedule extend up to but do  not  include  the  next
line  which  starts  with  either  of  the  words REGULAR or
SPECIAL followed directly by a colon.

Spaces can follow  the  colon  after  the  word  REGULAR  or
SPECIAL,  and  can also appear between the dates.  Dates can
be specified  in  almost  any  customary  manner,  but  must
include  numeric  day  of  month,  month  name or number and
either all 4 digits of the year or the right 2 digits of the
year.   Single  dates  or  ranges  of dates can be separated
either by commas, by the words  AND  or  OR,  or  merely  by
spaces.    The  words  AND  and  OR  are  considered  to  be
equivalent.  Dates which are to be the starting  and  ending
dates  in  ranges  of  dates  can be separated either by the
words TO or THROUGH.  Both TO and THROUGH imply the range of
dates including the stated starting and ending dates.  Month
names are the only words which can be abbreviated  in  these
files,  but  THRU  is  accepted  as an alternate spelling of

The following date specifications are typical of those which
are allowed.
     WEEKLY, an Academic Calendar Program                       3

     OCTOBER 20 83     OCTOBER-20-83
     OCTOBER 20, 83    OCTOBER/20/83

     20 OCTOBER 83     20-OCT-83         10-20-83
     20 OCTOBER,83     20/OCT/83         10/20/83

     Each of the lines which follows that beginning with the word
     REGULAR  or  SPECIAL  specifies a particular day of the week
     and the name of the file which specifies the events for that
     day.   Like  the  words  REGULAR  and  SPECIAL, the day name
     cannot be abbreviated and must be followed immediately by  a
     colon.   The word WEEKDAY followed by a colon can be used to
     specify all of the days  Monday  through  Friday,  the  word
     WEEKEND can be used to specify both of the days Saturday and
     Sunday, and the word ALL can be used to specify all days  of
     the  week.  It is not necessary that a particular day of the
     week be specified, if it is not specified,  then  there  are
     merely  no  events  which  are specified for that day by the
     current schedule.  The file name  which  follows  the  colon
     must  be formed of 6 or fewer alphabetic letters A through Z
     and/or  digits.   A  file  name  extension  or   file   type
     consisting  of  a  period  and 3 or fewer alphabetic letters
     and/or digits can follow, but is not necessary.

     For example, if a particular class schedule  applies  during
     most  of  the  weeks  in a semester, but different schedules
     apply during  midterm  examination  week  and  during  final
     examination  week,  then  the examination schedules would be
     established  before  the  schedule  for  the  rest  of   the
     semester.  As long as the midterm week and final week do not
     overlap, either can be specified  first.   Such  a  schedule
     could  be  defined  by the following lines in the WEEKLY.DAY
     file.  The text appearing to the right  of  the  exclamation
     points is taken as a comment and is otherwise ignored.

     Regular: 25/Oct/82 through 10/29/82 !midterm week
     Monday:    monmid.fal
     Tuesday:   tuemid.fal
     Wednesday: wedmid.fal
     Thursday:  thumid.fal
     Friday:    frimid.fal

     Regular: 15 December 82 thru December/17/82 !final week

     Regular:7-Sep-82 to December 17, 82 !entire fall semester
     Monday:    mon.fal
     Tuesday:   tue.fal
     Wednesday: wed.fal
     Thursday:  thu.fal
     Friday:    fri.fal
     Saturday:  sat.fal
4                       WEEKLY, an Academic Calendar Program

                The Event Description Files
                --- ----- ----------- -----

The files which describe the events which are to  appear  in
the  calendar  all  have  a  similar format.  In addition to
those which are named directly by the WEEKLY.DAY file, there
can  be  a  separate file for each day describing the events
taking place on that day.  This separate  file  has  a  name
constructed  of  the  2  digit  day number, then the first 3
letters of the month name, followed  by  a  period  and  the
right  2  digits  of the year number.  For example, the file
named 21NOV.82 would describe the events  occurring  on  the
twenty-first of November 1982.

Each  event  description  must  start  with  a  line   which
specifies the starting time, or the starting and ending time
separated by a minus sign.  Times must be expressed  as  the
hour  followed immediately by a colon and the minutes.  Both
the colon and minutes are required.  A number which  appears
at  the  start  of  a  line is taken to be part of the event
description rather than a time if the colon and minutes  are
missing.   Hours  can be stated either in the 12 hour system
or the 24 hour system.  If the time does not bear either  an
AM or a PM suffix, then

              00:00 is the start of the day
00:01 through 11:59 is before noon
              12:00 is noon
12:01 through 23:59 is after noon
              24:00 is the end of the day

If the 12 hour system is used, then an AM suffix is required
for  times  before  1:00am  and  a PM suffix is required for
times of 1:00pm or later.  The AM suffix is not required  in
the  12  hour  system for times between 1:00am and noon.  If
either the AM or PM is  used  as  a  suffix,  then  it  must
directly  follow  the  minutes without an intervening space.
The AM or PM  can  appear  in  either  upper  case  (capital
letters)  or  lower  case (small letters), but a period must
not appear between the letters.  Noon should be  represented
either without a suffix or as 12:00m, where the m stands for
the latin word meridies, since 12:00am represents the  start
of  the  day or 12 hours before noon, and 12:00pm represents
the end of the day or 12 hours after noon.

The event descriptions in a particular file  can  appear  in
any  order  and  need  not  be sorted by starting time.  The
program will sort the entries by both  starting  and  ending
times.  The program allows a special notice to appear at the
top of the schedule for a particular date.  Such  a  special
notice  must  appear  at the start of one of the files which
describe the events  for  that  day  or  date,  without  any
preceding  timestamp,  since  once a timestamp is found in a
file, it applies to all of the  following  lines  until  the
next timestamp is encountered.
     WEEKLY, an Academic Calendar Program                       5

     If a date or a range of dates is specified to the  right  of
     the  time or time range, then these dates are the dates when
     the event is not held.  This is really only  useful  in  the
     files  specified  by the WEEKLY.DAY file to state exceptions
     to the repeating schedule.  The rules for  the  construction
     of  the  dates and/or ranges of dates are identical to those
     stated earlier for the WEEKLY.DAY file.

     All of the entries in these files have  a  form  similar  to
     that  shown  below.   The text appearing to the right of the
     exclamation points is taken as a comment  and  is  otherwise

          10:00am-11:45am 12 Nov 82 !date when event is not held
          First line of description !comment
          Second line
          Final line

     The first  line  of  the  description  can  be  at  most  25
     characters  long.  The subsequent lines should be limited to
     23 characters each, because these lines will be  indented  2
     spaces  to  the  right  in the calendar.  Long lines are not
     split or wrapped around, instead the excess  characters  are
     discarded.   There  can  be at most 500 lines of descriptive
     text, excluding timestamps, in the column for any particular

       An Example of a Calendar Produced by the WEEKLY Program
       -- ------- -- - -------- -------- -- --- ------ -------

     A set of typical files and the results which are produced by
     this program when these files are processed are shown below.
     Since the calendar which is produced is much wider than this
     document,  only  the  right  edge of calendar is shown.  The
     week  chosen  in  the  example  is   the   week   containing
     Thanksgiving  Day  in 1982.  The WEEKLY.DAY file specifies 2
     regular schedules, one for Thanksgiving itself, and  another
     for the rest of the year.  Since only 1 regular schedule can
     be used for any particular date, the  file  which  specifies
     the schedule for Thursday is not used on Thanksgiving Day.


     Regular:November 25, 82 !no classes on Thanksgiving day

     Regular:1-Jan-82 to 31-Dec-82
6                       WEEKLY, an Academic Calendar Program


8:30-9:00                     9:15
Early birds breakfast         Eastern European Finance
Cafeteria, east end           Room C19
9:00                          9:00-11:00
Plant Biology                 Advanced Basket weaving
Room A16                      John Smith House
                              Early birds breakfast
                              Cafeteria, east end
                              General anatomy
                              Room B56


8:00-12:00                    10:00
Saturday morning cartoons     Nondenominational service
Memorial Union Lounge         Old Chapel
(bring snacks)
Organic Chemistry
Advanced Lab
until dusk


Late birds brunch
Cafeteria, west end


Thanksgiving recess today     12:00
no classes are to be held     Dean's Lunch
                              Guest speaker:
                              Jim Smith


9:00                          9:00
Head of Charles Raft Race     Choir Practice
Anything that floats
Big Tag Sale, 55 Main St
Vendors wanted

The dialog between the user and the program when  the  files
listed  above  were  processed  is  listed  below.   The The
responses typed by the user  appear  to  the  right  of  the
question marks.
     WEEKLY, an Academic Calendar Program                       7

     Starting date (a Monday)? November 22, 1982
     Mon 22-Nov-1982
     Show how many weeks? 1
     Name of output file? test.out
     Answer 0 if on Decwriter, 1 if on Diablo
     Will calendar be printed on Decwriter or Diablo? 0
     Mon 22-Nov-1982, Lines:    0
     Tue 23-Nov-1982, Lines:    0
     Wed 24-Nov-1982, Lines:    0
     Thu 25-Nov-1982, Lines:    2
     Fri 26-Nov-1982, Lines:   11
     S/S 28-Nov-1982, Lines:   15

     The right edge of the resulting  calendar  is  shown  below.
     All  columns  to the left of the Thursday column were empty.
     Only  the  notice  about   classes   being   cancelled   for
     Thanksgiving appeared in the Thursday column.

                    Friday                   Saturday
                   26-Nov-82                and Sunday

     s today|                         |8:00-12:00 m  Saturday   |
     be held|                         |Saturday morning cartoons|
            |                         |  Memorial Union Lounge  |
            |                         |  (bring snacks)         |
            |8:30-9:00 am             |                         |
            |Early birds breakfast    |                         |
            |  Cafeteria, east end    |                         |
            |9:00 am                  |9:00 am  Saturday        |
            |General anatomy          |Head of Charles Raft Race|
            |  Room B56               |  Anything that floats   |
            |9:00-11:00 am            |Big Tag Sale, 55 Main St |
            |Advanced Basket weaving  |  Vendors wanted         |
            |  John Smith House       |9:00 am  Sunday          |
            |                         |Choir Practice           |
            |9:15 am                  |9:15 am  Saturday        |
            |Eastern European Finance |Organic Chemistry        |
            |  Room C19               |  Advanced Lab           |
            |                         |  until dusk             |
            |                         |10:00 am  Sunday         |
            |                         |Nondenominational service|
            |                         |  Old Chapel             |
            |                         |10:45-12:45 pm  Both days|
            |                         |Late birds brunch        |
            |                         |  Cafeteria, west end    |
            |12:00 m                  |                         |
            |Dean's Lunch             |                         |
            |  Guest speaker:         |                         |
            |  Jim Smith              |                         |