Click on any highlighted date in the calendar below to move to" print "the events scheduled for that date, or click" print " here" print "to move directly to the chronological list of events.

" # # Emit a leading calendar with links to the events: the first event on each # date has an associated anchor with the date as its name. # # Determine the dates of the first day of the month of the first event and # last day of the month of the last event. # startMonth = substr(head, 1, 2) startYear = substr(head, 5, 2) wday = dow(startMonth "01" startYear) for(date = head; nxt[date]; date = nxt[date]); endMonth = substr(date, 1, 2) endYear = substr(date, 5, 2) # # Loop on all the days in all the months within the range of all the events # that are listed. Collect the output in cal[" for(i = 1; i < mdx; i += 2) { for(j = 1; (i,j) in cal || (i+1,j) in cal; j++) { if((i,j) in cal) filler = substr(blanks, 1, 5) else filler = substr(blanks, 1, 26) print cal[i,j] filler cal[i+1,j] } print } print "" print # # Now, emit the events. # print "

" body[date,i,j] "

" print } # end loop on paragraphs } # end loop on events } # end loop on dates print "" print "" } # # cmpDate() # # Compare dates, returning 0 if they are equal, 1 if 'one' is later than # 'two', and -1 if 'one' is earlier than 'two'. Special case: if the day # field of date 'one' is zero, return -2. # function cmpDate(one, two) { # # Compare the years. # if((diff = substr(one, 5) - substr(two, 5)) > 0) rval = 1 else if(diff < 0) rval = -1 # # Compare the months. # else if((diff = substr(one, 1, 2) - substr(two, 1, 2)) > 0) rval = 1 else if(diff < 0) rval = -1 # # Compare the days. # else if((diff = (dayOne = substr(one, 3, 2)) - substr(two, 3, 2)) > 0) rval = 1 else if(dayOne == "00") rval = -2 else if(diff < 0) rval = -1 else rval = 0 # if(debug) # print "Compared " one " with " two ", returned " rval > "/dev/stderr" return rval } # end cmpDates() # # ldom() # # Return the last day of the month. Valid for years 1901-2199. # function ldom(month, year) { if(month == "01") return "31" else if(month == "02") { if(year % 4 == 0) return 29 else return 28 } else if(month == "03") return "31" else if(month == "04") return "30" else if(month == "05") return "31" else if(month == "06") return "30" else if(month == "07") return "31" else if(month == "08") return "31" else if(month == "09") return "30" else if(month == "10") return "31" else if(month == "11") return "30" else return "31" } # end ldom() # # incr() # # Auto-increment for a two-digit decimal string. # function incr(i) { return sprintf("%02d", i+1) } # end incr() # # dow() # # Returns the day of the week-- as a digit between 1 and 7-- for any date # on or after 010194-- using the fact that that date was a Saturday (coded # as a 7) and the lame algorithm of determining how many days have since # passed. # function dow(date) { since = 0 year = substr(date, 5, 2) for(i = "94"; i < year; i = incr(i)) if(i % 4 == 0) since += 366 else since += 365 month = substr(date, 1, 2) for(i = "01"; i < month; i = incr(i)) since += ldom(i, year) day = substr(date, 3, 2) since += day-1 return (rVal = (since % 7)) ? rVal : 7 } # end dow()