Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
57
Task/Calendar/Lingo/calendar-1.lingo
Normal file
57
Task/Calendar/Lingo/calendar-1.lingo
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
----------------------------------------
|
||||
-- @desc Class "Calendar"
|
||||
-- @file parent script "Calendar"
|
||||
----------------------------------------
|
||||
property _months
|
||||
property _weekdayStr
|
||||
property _refDateObj
|
||||
property _year
|
||||
property _calStr
|
||||
|
||||
on new (me)
|
||||
me._months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
|
||||
me._weekdayStr = "Mo Tu We Th Fr Sa Su"
|
||||
me._refDateObj = date(1905,1,2)
|
||||
return me
|
||||
end
|
||||
|
||||
on make (me, year)
|
||||
me._year = year
|
||||
me._calStr = ""
|
||||
-- prefill cal string with spaces
|
||||
emptyLine = bytearray(68,32).readRawString(68)&RETURN
|
||||
repeat with i = 1 to 38
|
||||
put emptyLine after _calStr
|
||||
end repeat
|
||||
me._write (string(year), 32, 1)
|
||||
repeat with i = 1 to 12
|
||||
me._writeMonth(i)
|
||||
end repeat
|
||||
return me._calStr
|
||||
end
|
||||
|
||||
on _writeMonth (me, monthNum)
|
||||
xOffset = (monthNum-1) mod 3 * 24
|
||||
yOffset = (monthNum-1)/3 * 9 + 2
|
||||
pre = (20 - me._months[monthNum].length)/2
|
||||
me._write(me._months[monthNum], 1+xOffset+pre, 1+yOffset)
|
||||
me._write(me._weekdayStr, 1+xOffset, 2+yOffset)
|
||||
y = 3
|
||||
x = ((date(me._year, monthNum, 1) - me._refDateObj) mod 7)+1
|
||||
repeat with i = 1 to 31
|
||||
if date(me._year, monthNum, i).month<>monthNum then exit repeat
|
||||
dayStr = string(i)
|
||||
if i<10 then put " " before dayStr
|
||||
me._write(dayStr, x*3-2+xOffset, y+yOffset)
|
||||
if x=7 then
|
||||
y = y+1
|
||||
x = 1
|
||||
else
|
||||
x = x+1
|
||||
end if
|
||||
end repeat
|
||||
end
|
||||
|
||||
on _write (me, str, x, y)
|
||||
put str into char x to x+str.length-1 of line y of _calStr
|
||||
end
|
||||
3
Task/Calendar/Lingo/calendar-2.lingo
Normal file
3
Task/Calendar/Lingo/calendar-2.lingo
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
calObj = script("Calendar").new()
|
||||
calStr = calObj.make(1969)
|
||||
put calStr
|
||||
Loading…
Add table
Add a link
Reference in a new issue