Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
45
Task/Calendar/Icon/calendar.icon
Normal file
45
Task/Calendar/Icon/calendar.icon
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
procedure main(A)
|
||||
printCalendar(\A[1]|1969)
|
||||
end
|
||||
|
||||
procedure printCalendar(year) #: Print a 3 column x 80 char calendar
|
||||
cols := 3 # fixed width
|
||||
mons := [] # table of months
|
||||
"January February March April May June " ||
|
||||
"July August September October November December " ?
|
||||
while put(mons, tab(find(" "))) do move(1)
|
||||
|
||||
write(center("[Snoopy Picture]",cols * 24 + 4)) # mandatory ..
|
||||
write(center(year,cols * 24 + 4), "\n") # ... headers
|
||||
|
||||
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(year,mon + i) # formatting coexpr
|
||||
}
|
||||
write()
|
||||
every 1 to 7 do { # 1 to max rows
|
||||
every c := 1 to cols do { # for each column
|
||||
writes(" ")
|
||||
every 1 to 7 do writes(right(@M[c],3)) # each row day element
|
||||
}
|
||||
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]
|
||||
|
||||
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