Calendar - for "REAL" programmers: Difference between revisions
Content added Content deleted
(Merge omitted languages at bottom and add Processing) |
|||
Line 1,047: | Line 1,047: | ||
=={{header|Elena}}== |
=={{header|Elena}}== |
||
ELENA |
ELENA 5.0 : |
||
<lang elena>import system'text; |
<lang elena>import system'text; |
||
import system'routines; |
import system'routines; |
||
Line 1,054: | Line 1,054: | ||
import extensions'routines; |
import extensions'routines; |
||
const MonthNames = new string[] |
const MonthNames = new string[]{"JANUARY","FEBRUARY","MARCH","APRIL","MAY","JUNE","JULY","AUGUST","SEPTEMBER","OCTOBER", |
||
"NOVEMBER","DECEMBER"}; |
|||
const DayNames = new string[] |
const DayNames = new string[]{"MO", "TU", "WE", "TH", "FR", "SA", "SU"}; |
||
class CalendarMonthPrinter |
class CalendarMonthPrinter |
||
Line 1,087: | Line 1,088: | ||
if (theDate.Month == theMonth) |
if (theDate.Month == theMonth) |
||
{ |
{ |
||
var dw := theDate.DayOfWeek; |
|||
theLine.writeCopies(" ",theDate.DayOfWeek == 0 ? 6 : (theDate.DayOfWeek - 1)); |
|||
do |
do |
||
{ |
{ |
||
theLine.writePaddingLeft(theDate.Day. |
theLine.writePaddingLeft(theDate.Day.toPrintable(), $32, 3); |
||
theDate := theDate.addDays:1 |
theDate := theDate.addDays:1 |
||
} |
} |
||
until |
until(theDate.Month != theMonth || theDate.DayOfWeek == 1) |
||
}; |
}; |
||
Line 1,105: | Line 1,108: | ||
} |
} |
||
indexer() = new Indexer |
indexer() = new Indexer |
||
{ |
{ |
||
bool Available = theRow < 7; |
bool Available = theRow < 7; |
||
⚫ | |||
readIndexTo(ref int retVal) { theRow.readValueTo(ref retVal) } |
|||
⚫ | |||
{ |
{ |
||
get() = theRow.Value; |
|||
set(int index) |
|||
{ |
|||
if (index <= theRow) |
|||
{ self.writeTitle() }; |
|||
while (index > theRow) |
|||
{ self.writeLine() } |
|||
} |
|||
} |
} |
||
appendIndex(int index) |
appendIndex(int index) |
||
{ |
|||
this self.Index := theRow.Value + index |
|||
} |
|||
get int Length() { ^ 7 } |
|||
get() = self; |
get() = self; |
||
Line 1,156: | Line 1,164: | ||
output.writePadding("[SNOOPY]", $32, theRowLength * 25); |
output.writePadding("[SNOOPY]", $32, theRowLength * 25); |
||
output.writeLine(); |
output.writeLine(); |
||
output.writePadding(theYear. |
output.writePadding(theYear.toPrintable(), $32, theRowLength * 25); |
||
output.writeLine().writeLine(); |
output.writeLine().writeLine(); |
||