Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
-- Superseded by: (find-angg "LUA/Calendar1.lua") -- «.run» (to "run") yeardays = {} months = {} addmonth = function (name, nome, ndays) tinsert(months, {name=name, nome=nome, dayzero=#yeardays, n=#months+1}) months[name] = months[#months] for i=1,ndays do tinsert(yeardays, {m=#months, day=i}) end end addmonth("jan", "jan", 31) addmonth("feb", "fev", 28) addmonth("mar", "mar", 31) addmonth("apr", "abr", 30) addmonth("may", "mai", 31) addmonth("jun", "jun", 30) addmonth("jul", "jul", 31) addmonth("aug", "ago", 31) addmonth("sep", "set", 30) addmonth("oct", "out", 31) addmonth("nov", "nov", 30) addmonth("dec", "dez", 31) -- PP(months) -- PP(yeardays) md_to_nday = function (m, d) return months[m].dayzero + d end nday_to_md = function (nday) local md = yeardays[nday]; return md.m, md.day end nday_to_mdstr = function (nday) local m, d = nday_to_md(nday) local mnome = months[m].nome return format("%02d/%3s", d, mnome) end foo = function (n, nday) return format("%d\170 aula (%s):", n, nday_to_mdstr(nday)) end nday0 = md_to_nday("aug", 9) -- day of the first class in 2010.2 printaulas = function (offset) -- offset=1 for consecutive days for i=0,17 do print(foo(i*2 + 1, nday0 + 7*i)) print(foo(i*2 + 2, nday0 + 7*i + offset)) print() end end --[==[ -- «run» (to ".run") * (eepitch-lua51) * (eepitch-kill) * (eepitch-lua51) dofile "puro-calendario2.lua" p1 = function (nday) print(nday_to_mdstr(nday)) end p = function (nday, k) print(nday_to_mdstr(nday), nday_to_mdstr(nday+k)) end p(5, 29) p(5+30, 14) p(5+30+15, 29) p(5+30+15+30, 14) p(201, 14) p(334, 29) * (eepitch-lua51) * (eepitch-kill) * (eepitch-lua51) dofile "puro-calendario2.lua" -- nday0 = md_to_nday("aug", 9) -- day of the first class in 2010.2 -- printaulas(2) nday0 = md_to_nday("mar", 16) -- day of the first class in 2011.1 printaulas(2) -- MD printaulas(1) -- GA * (eepitch-lua51) * (eepitch-kill) * (eepitch-lua51) dofile "puro-calendario2.lua" -- nday0 = md_to_nday("aug", 9) -- day of the first class in 2010.2 -- printaulas(2) nday0 = md_to_nday("mar", 16) -- day of the first class in 2011.1 * (eepitch-lua51) * (eepitch-kill) * (eepitch-lua51) dofile "puro-calendario2.lua" nday0 = md_to_nday("aug", 10) -- day of the first class in 2011.2 printaulas(2) -- GA printaulas(1) -- MD * (eepitch-lua51) * (eepitch-kill) * (eepitch-lua51) dofile "puro-calendario2.lua" nday0 = md_to_nday("mar", 7) -- day of the first class in 2012.1 printaulas(2) -- GA and MD --]==] -- Local Variables: -- coding: raw-text-unix -- ee-anchor-format: "«%s»" -- End: