June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
|
|
@ -1,5 +1,5 @@
|
|||
procedure main(A)
|
||||
printCalendar(\A[1]|1969)
|
||||
printCalendar(\A[1]|1969)
|
||||
end
|
||||
|
||||
procedure printCalendar(year) #: Print a 3 column x 80 char calendar
|
||||
|
|
@ -12,12 +12,12 @@ procedure printCalendar(year) #: Print a 3 column x 80 char calendar
|
|||
write(center("[Snoopy Picture]",cols * 24 + 4)) # mandatory ..
|
||||
write(center(year,cols * 24 + 4), "\n") # ... headers
|
||||
|
||||
M := list(cols) # coexpr container
|
||||
M := list(cols) # coexpr container
|
||||
every mon := 0 to 9 by cols do { # go through months by cols
|
||||
writes(" ")
|
||||
every i := 1 to cols do {
|
||||
writes(center(mons[mon+i],24)) # header months
|
||||
M[i] := create CalendarFormatWeek(1969,mon + i) # formatting coexpr
|
||||
M[i] := create CalendarFormatWeek(year,mon + i) # formatting coexpr
|
||||
}
|
||||
write()
|
||||
every 1 to 7 do { # 1 to max rows
|
||||
|
|
@ -28,17 +28,18 @@ procedure printCalendar(year) #: Print a 3 column x 80 char calendar
|
|||
write()
|
||||
}
|
||||
}
|
||||
return
|
||||
end
|
||||
|
||||
link datetime
|
||||
|
||||
procedure CalendarFormatWeek(year,m) #: Format Week for Calendar
|
||||
static D
|
||||
initial D := [31,28,31,30,31,30,31,31,30,31,30,31]
|
||||
static D
|
||||
initial D := [31,28,31,30,31,30,31,31,30,31,30,31]
|
||||
|
||||
every suspend "Su"|"Mo"|"Tu"|"We"|"Th"|"Fr"|"Sa" # header
|
||||
every 1 to (d := (julian(m,1,year)+1)%7) do suspend "" # lead day alignment
|
||||
every suspend 1 to D[m] do d +:= 1 # days
|
||||
if m = 2 & IsLeapYear(year) then suspend (d +:= 1, 29) # LY adjustment
|
||||
every d to (6*7) do suspend "" # trailer alignment
|
||||
every suspend "Su"|"Mo"|"Tu"|"We"|"Th"|"Fr"|"Sa" # header
|
||||
every 1 to (d := (julian(m,1,year)+1)%7) do suspend "" # lead day alignment
|
||||
every suspend 1 to D[m] do d +:= 1 # days
|
||||
if m = 2 & IsLeapYear(year) then suspend (d +:= 1, 29) # LY adjustment
|
||||
every d to (6*7) do suspend "" # trailer alignment
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue