Calendar - for "REAL" programmers: Difference between revisions

m
→‎{{header|Phix}}: use pygments
(→‎{{header|C}}: More notes)
m (→‎{{header|Phix}}: use pygments)
 
(19 intermediate revisions by 12 users not shown)
Line 1:
[[Category:Handicap]]
{{task|Date and time}}
 
Line 32 ⟶ 33:
'''Trivia:''' The terms uppercase and lowercase date back to the early days of the mechanical printing press. Individual metal alloy casts of each needed letter, or punctuation symbol, were meticulously added to a press block, by hand, before rolling out copies of a page. These metal casts were stored and organized in wooden cases. The more often needed ''minuscule'' letters were placed closer to hand, in the lower cases of the work bench. The less often needed, capitalized, ''majuscule'' letters, ended up in the harder to reach upper cases.
<br><br>
 
=={{header|360 Assembly}}==
<!-- Calendar for real programmers -->
This is for real programmers who code only in assembler :). The code could have been run in april 1964, punched on
80-column cards, read on a card reader, and printed with a 132-column line printer on fan-folded paper with perforated edges.
<langsyntaxhighlight lang="360asm">* CALENDAR FOR REAL PROGRAMMERS 05/03/2017
CALENDAR CSECT
USING CALENDAR,R13 BASE REGISTER
Line 217:
DA DS 12CL144
YREGS
END CALENDAR</langsyntaxhighlight>
{{out}}
<pre> INSERT SNOOPY HERE
Line 237:
28 29 30 31 25 26 27 28 29 30 31 29 30 27 28 29 30 31 24 25 26 27 28 29 30 29 30 31
</pre>
 
=={{header|Ada}}==
 
Line 243 ⟶ 242:
Instead of doing that, the implementation below reuses the package "PRINTABLE_CALENDAR" (same as "Printable_Calendar" or "printable_calendar") from [[Calendar#Ada|the calendar task]]:
 
<langsyntaxhighlight Adalang="ada">WITH PRINTABLE_CALENDAR;
 
PROCEDURE REAL_CAL IS
Line 263 ⟶ 262:
C.NEW_LINE;
C.PRINT(1969, "NINETEEN-SIXTY-NINE");
END REAL_CAL;</langsyntaxhighlight>
 
{{out}}
Line 288 ⟶ 287:
 
To change the output to 80-character devices, replace "INIT_132" by "INIT_80".
 
=={{header|ALGOL 68}}==
{{works with|ALGOL 68|Revision 1 - no extensions to language used}}
Line 296 ⟶ 294:
 
Note: to run this code with [[ALGOL 68G]] you need to use the '''--quote-stropping''' option.
<langsyntaxhighlight lang="algol68">'PR' QUOTE 'PR'
'PROC' PRINT CALENDAR = ('INT' YEAR, PAGE WIDTH)'VOID': 'BEGIN'
Line 403 ⟶ 401:
LINE PRINTER WIDTH = 132; # AS AT 1969! #
PRINT CALENDAR(MANKIND STEPPED ON THE MOON, LINE PRINTER WIDTH)
'END'</langsyntaxhighlight>
{{out}}
<pre>
Line 426 ⟶ 424:
31 30
</pre>
 
=={{header|AutoHotkey}}==
<langsyntaxhighlight AutoHotkeylang="autohotkey">CALENDAR(YR){
LASTDAY := [], DAY := []
TITLES =
Line 466 ⟶ 463:
STRINGREPLACE, RES, RES,%A_SPACE%0,%A_SPACE%%A_SPACE%, ALL
RETURN RES
}</langsyntaxhighlight>
Examples:<langsyntaxhighlight AutoHotkeylang="autohotkey">EXAMPLES:
GUI, FONT,S8, COURIER
GUI, ADD, EDIT, VYR W40 R1 LIMIT4 NUMBER, 1969
Line 482 ⟶ 479:
GUICLOSE:
EXITAPP
RETURN</langsyntaxhighlight>
{{out}}
<pre> 1969
Line 522 ⟶ 519:
30
</pre>
=={{header|BASIC}}==
 
==={{header|BaCon}}===
Choosing 132 character output. Same as the "Calendar" from [[Calendar#BaCon|the calendar task]] but using all capitals:
<langsyntaxhighlight lang="freebasic">DECLARE MON$[] = { "JANUARY", "FEBRUARY", "MARCH", "APRIL", "MAY", "JUNE", "JULY", "AUGUST", "SEPTEMBER", "OCTOBER", "NOVEMBER", "DECEMBER" }
DECLARE MON[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
Y$ = "1969"
Line 557 ⟶ 554:
PRINT D;
NEXT
NEXT</langsyntaxhighlight>
 
{{out}}
Line 580 ⟶ 577:
</pre>
 
==={{header|BBC BASIC}}===
{{works with|BBC BASIC for Windows}}
<langsyntaxhighlight lang="bbcbasic"> VDU 23,22,1056;336;8,16,16,128
YEAR = 1969
Line 625 ⟶ 622:
DEF FNDIM(M%,Y%)
CASE M% OF
WHEN 2: = 28 -+ (Y%MOD4=0) +- (Y%MOD100=0) -+ (Y%MOD400=0)
WHEN 4,6,9,11: = 30
OTHERWISE = 31
ENDCASE</langsyntaxhighlight>
{{out}}
<pre>
Line 651 ⟶ 648:
27 28 29 30 31 24 25 26 27 28 29 30 28 29 30 26 27 28 29 30 31 23 24 25 26 27 28 29 28 29 30 31
31 30</pre>
 
 
=={{header|C}}==
<b>Note:</b> Historically, some UNIX systems were connected to upper-case only terminals, and users of those systems needed to write C programs. One could configure the terminal using the "stty" command, setting the olcuc and iuclc options to translate uppercase to lowercase on input, and convert lowercase to uppercase on output (although typically the setting was applied by the "getty" program so that logging in would be possible).
Line 671 ⟶ 666:
tcc -DSTRUCT=struct -DCONST=const -DINT=int -DCHAR=char -DVOID=void -DMAIN=main -DIF=if -DELSE=else -DWHILE=while -DFOR=for -DDO=do -DBREAK=break -DRETURN=return -DPUTCHAR=putchar UCCALENDAR.c
</pre>
<langsyntaxhighlight lang="c">/* UPPER CASE ONLY VERSION OF THE ORIGINAL CALENDAR.C, CHANGES MOSTLY TO AVOID NEEDING #INCLUDES */
/* ERROR MESSAGES GO TO STDOUT TO SLIGHTLY SIMPLIFY THE I/O HANDLING */
/* WHEN COMPILING THIS, THE COMMAND LINE SHOULD SPECIFY -D OPTIONS FOR THE FOLLOWING WORDS: */
Line 836 ⟶ 831:
}
RETURN RESULT;
}</langsyntaxhighlight>
 
=={{header|COBOL}}==
Although it seems to be missing the pinup of Snoopy, see [[Calendar#COBOL|COBOL Calendar task entry]]
where the code, and output, is already an example of a "REAL programmer" calendar; even down to the 6 character, all uppercase, program name ''CALEND''.
 
=={{header|Common Lisp}}==
<langsyntaxhighlight lang="lisp">(QL:QUICKLOAD '(DATE-CALC))
 
(DEFPARAMETER *DAY-ROW* "SU MO TU WE TH FR SA")
Line 917 ⟶ 910:
(LAMBDA (&REST HEADS)
(FORMAT T FORMAT-STRING HEADS))
ROW))))</langsyntaxhighlight>
{{out}}
<pre>CL-USER> (PRINT-CALENDAR 1969)
Line 956 ⟶ 949:
30
NIL</pre>
 
=={{header|D}}==
D keywords are lower case, so this silly solution uses the whole Calendar Task code, with small changes and all in upper case, in a text file named "CALENDAR":
Line 1,013 ⟶ 1,005:
 
Then in another source code file there is a little loader, that imports it and mixes-in it (for safety this program must be compiled with <code>-Jsomepath</code>):
<langsyntaxhighlight lang="d">import std.string;mixin(import("CALENDAR").toLower);void main(){}</langsyntaxhighlight>
{{out}}
<pre> [Snoopy Picture]
Line 1,053 ⟶ 1,045:
26 27 28 29 30 31 23 24 25 26 27 28 29 28 29 30 31
30 </pre>
 
=={{header|Elena}}==
ELENA 56.0x :
<langsyntaxhighlight lang="elena">import system'text;
import system'routines;
import system'calendar;
Line 1,062 ⟶ 1,053:
import extensions'routines;
 
const MonthNames = new string[]{"JANUARY","FEBRUARY","MARCH","APRIL","MAY","JUNE","JULY","AUGUST","SEPTEMBER","OCTOBER","NOVEMBER","DECEMBER"};
"NOVEMBER","DECEMBER"};
const DayNames = new string[]{"MO", "TU", "WE", "TH", "FR", "SA", "SU"};
 
class CalendarMonthPrinter
{
Date theDate _date;
TextBuilder theLine _line;
int theMonth _month;
int theYear _year;
refReference<int> theRow_row;
constructor(year, month)
{
theMonth_month := month;
theYear_year := year;
theLine_line := new TextBuilder();
theRow_row := 0;
}
 
writeTitle()
{
theRow_row.Value := 0;
theDate_date := Date.new(theYear_year, theMonth_month, 1);
 
DayNames.forEach:(name)
{ theLineDayNames.printforEach::(" ",name) }
{ _line.print(" ",name) }
}
}
writeLine()
{
theLine_line.clear();
 
if (theDate_date.Month == theMonth_month)
{
var dw := theDate_date.DayOfWeek;
 
theLine_line.writeCopies(" ",theDate_date.DayOfWeek == 0 ? 6 : (theDate_date.DayOfWeek - 1));
 
do
{
theLine_line.writePaddingLeft(theDate_date.Day.toPrintable(), $32, 3);
 
theDate_date := theDate_date.addDays:(1)
}
until(theDate_date.Month != theMonth_month || theDate_date.DayOfWeek == 1)
};
 
int length := theLine_line.Length;
if (length < 21)
{ theLine_line.writeCopies(" ", 21 - length) };
 
theRow_row.append(1)
}
indexer() = new Indexer
{
bool Available = theRow_row < 7;
 
int Index
{
get() = theRow_row.Value;
set(int index)
{
if (index <= theRow_row)
{ self.writeTitle() };
while (index > theRow_row)
{ self.writeLine() }
}
}
 
appendIndex(int index)
{
this self.Index := theRow_row.Value + index
}
get int Length() { ^ 7 }
 
get getValue() = self;
set setValue(o) { NotSupportedException.raise() }
};
printTitleTo(output)
{
output.writePadding(MonthNames[theMonth_month - 1], $32, 21)
}
printTo(output)
{
output.write(theLine_line.Value)
}
}
 
class Calendar
{
int theYear_year;
int theRowLength_rowLength;
constructor new(int year)
{
theYear_year := year;
theRowLength_rowLength := 3
}
printTo(output)
{
output.writePadding("[SNOOPY]", $32, theRowLength_rowLength * 25);
output.writeLine();
output.writePadding(theYear_year.toPrintable(), $32, theRowLength_rowLength * 25);
output.writeLine().writeLine();
var rowCount := 12 / theRowLength_rowLength;
var months := Array.allocate(rowCount).populate::(i =>
Array.allocate(theRowLength_rowLength)
.populate::(j =>
new CalendarMonthPrinter(theYear_year, i * theRowLength_rowLength + j + 1)));
months.forEach::(row)
{
var r := row;
row.forEach::(month)
{
month.printTitleTo:(output);
output.write:(" ")
};
output.writeLine();
ParallelEnumerator.new(row).forEach::(line)
{
line.forEach::(printer)
{
lineprinter.forEach:printTo(printeroutput);
{
printer.printTo:output;
 
output.write:(" ")
};
 
output.writeLine()
}
}
}
}
 
public program()
{
var calender := Calendar.new(console.write:("ENTER THE YEAR:").readLine().toInt());
calender.printTo:(console);
 
console.readChar()
}</langsyntaxhighlight>
{{out}}
<pre>
Line 1,255 ⟶ 1,246:
27 28 29 30 31 24 25 26 27 28 29 30 29 30 31
</pre>
=={{header|Forth}}==
<syntaxhighlight lang="forth">
: WEEKDAY ( D M Y -- U )
OVER 3 < IF SWAP 12 + SWAP 1- THEN
DUP 4 / OVER 100 / - OVER 400 / + + SWAP 1+ 13 * 5 / + + 2 - 7 MOD ;
 
: MDAYS ( M Y -- MSIZE MDAY )
OVER 12 = IF 31 1 2SWAP WEEKDAY NEGATE EXIT THEN
2>R 1 2R@ WEEKDAY 1 2R> SWAP 1+ SWAP WEEKDAY OVER -
7 + 7 MOD 28 + SWAP NEGATE ;
 
: .WEEK ( MSIZE MDAY -- MSIZE MDAY' )
7 0 DO DUP 0< IF 1+ 3 SPACES ELSE
2DUP > IF 1+ DUP 2 .R SPACE ELSE 3 SPACES THEN THEN LOOP ;
 
: .3MONTHS ( Y M -- )
3 0 DO ." MO TU WE TH FR SA SU " LOOP CR
3 OVER + SWAP DO I OVER MDAYS ROT LOOP DROP
6 0 DO 2ROT .WEEK 2 SPACES 2ROT .WEEK 2 SPACES 2ROT .WEEK CR LOOP
2DROP 2DROP 2DROP ;
 
: CAL ( Y -- )
30 SPACES ." [SNOOPY]" CR
32 SPACES DUP . CR
." JANUARY FEBRUARY MARCH" CR
DUP 1 .3MONTHS
." APRIL MAY JUNE" CR
DUP 4 .3MONTHS
." JULY AUGUST SEPTEMBER" CR
DUP 7 .3MONTHS
." OCTOBER NOVEMBER DECEMBER" CR
10 .3MONTHS ;
 
1969 CAL
</syntaxhighlight>
{{out}}
<pre>
[SNOOPY]
1969
JANUARY FEBRUARY MARCH
MO TU WE TH FR SA SU MO TU WE TH FR SA SU MO TU WE TH FR SA SU
1 2 3 4 5 1 2 1 2
6 7 8 9 10 11 12 3 4 5 6 7 8 9 3 4 5 6 7 8 9
13 14 15 16 17 18 19 10 11 12 13 14 15 16 10 11 12 13 14 15 16
20 21 22 23 24 25 26 17 18 19 20 21 22 23 17 18 19 20 21 22 23
27 28 29 30 31 24 25 26 27 28 24 25 26 27 28 29 30
31
APRIL MAY JUNE
MO TU WE TH FR SA SU MO TU WE TH FR SA SU MO TU WE TH FR SA SU
1 2 3 4 5 6 1 2 3 4 1
7 8 9 10 11 12 13 5 6 7 8 9 10 11 2 3 4 5 6 7 8
14 15 16 17 18 19 20 12 13 14 15 16 17 18 9 10 11 12 13 14 15
21 22 23 24 25 26 27 19 20 21 22 23 24 25 16 17 18 19 20 21 22
28 29 30 26 27 28 29 30 31 23 24 25 26 27 28 29
30
JULY AUGUST SEPTEMBER
MO TU WE TH FR SA SU MO TU WE TH FR SA SU MO TU WE TH FR SA SU
1 2 3 4 5 6 1 2 3 1 2 3 4 5 6 7
7 8 9 10 11 12 13 4 5 6 7 8 9 10 8 9 10 11 12 13 14
14 15 16 17 18 19 20 11 12 13 14 15 16 17 15 16 17 18 19 20 21
21 22 23 24 25 26 27 18 19 20 21 22 23 24 22 23 24 25 26 27 28
28 29 30 31 25 26 27 28 29 30 31 29 30
OCTOBER NOVEMBER DECEMBER
MO TU WE TH FR SA SU MO TU WE TH FR SA SU MO TU WE TH FR SA SU
1 2 3 4 5 1 2 1 2 3 4 5 6 7
6 7 8 9 10 11 12 3 4 5 6 7 8 9 8 9 10 11 12 13 14
13 14 15 16 17 18 19 10 11 12 13 14 15 16 15 16 17 18 19 20 21
20 21 22 23 24 25 26 17 18 19 20 21 22 23 22 23 24 25 26 27 28
27 28 29 30 31 24 25 26 27 28 29 30 29 30 31
</pre>
=={{header|Fortran}}==
Alas, the header "FORTRAN" is not recognised - REAL programmers were absent that day? Even upon the apperance of lower case, I have preferred to use shouting for programme source, and normal upper/lower case for commentary. Aside from petty details such as 1 and l being nowhere as distinct as 1 and L, this allows the two sorts of blather to be identifiably different without ratiocination as the hours drag past. Further, the names of variables can easily be distinguished from the same word in discussion, as in ... the text in TEXT will be printed as the subtitle to the text in TITLE ... Anyway, in the spirit of old, herewith the source without tedious commentary:
<syntaxhighlight lang="fortran">
<lang FORTRAN>
MODULE DATEGNASH
 
Line 1,434 ⟶ 1,495:
END DO
END
</syntaxhighlight>
</lang>
 
And for output, the wide form:
Line 1,457 ⟶ 1,518:
</pre>
Actual lineprinters offer the opportunity of overprinting lines so double (or triple) printing of the same text gave a '''bold''' effect if with some blurring due to wobble. Further decoration was possible: via underlines (and for overlines, an underline on the previous line) the appearance can be improved. Vertical bars can also be used, and more advanced lineprinters (IBM1403 etc. using the "TN" chain) or dot-matrix printers also supplied "corner" glyphs so that boxes would not have leaks.
 
 
=={{header|FreeBASIC}}==
<langsyntaxhighlight lang="freebasic">' VERSION 16-03-2016
' COMPILE WITH: FBC -S CONSOLE
 
Line 1,555 ⟶ 1,617:
PRINT : PRINT "HIT ANY KEY TO END PROGRAM"
SLEEP
END</langsyntaxhighlight>
{{out}}
<pre> INSERT YOUR SNOOPY PICTURE HERE
Line 1,576 ⟶ 1,638:
21 22 23 24 25 26 27 18 19 20 21 22 23 24 22 23 24 25 26 27 28 20 21 22 23 24 25 26 17 18 19 20 21 22 23 22 23 24 25 26 27 28
28 29 30 31 25 26 27 28 29 30 31 29 30 27 28 29 30 31 24 25 26 27 28 29 30 29 30 31 </pre>
 
 
=={{header|FutureBasic}}==
REAL PROGRAMMERS USE THE COMMAND LINE. (ALL UPPERCASE...UGH! =:^0 )
<syntaxhighlight lang="futurebasic">
INCLUDE "NSLOG.INCL"
 
LOCAL FN RUNTERMINALCOMMAND( CMD AS CFSTRINGREF ) AS CFSTRINGREF
CFSTRINGREF OUTPUTSTR = NULL
TASKREF TASK = FN TASKINIT
TASKSETEXECUTABLEURL( TASK, FN URLFILEURLWITHPATH( FN STRINGLOWERCASESTRING( @"/BIN/ZSH" ) ) )
CFSTRINGREF CMDSTR = FN STRINGWITHFORMAT( @"%@", FN STRINGLOWERCASESTRING( CMD ) )
CFARRAYREF ARGS = FN ARRAYWITHOBJECTS( FN STRINGLOWERCASESTRING( @"-C" ), CMDSTR, NULL )
TASKSETARGUMENTS( TASK, ARGS )
PIPEREF P = FN PIPEINIT
TASKSETSTANDARDOUTPUT( TASK, P )
TASKSETSTANDARDERROR( TASK, P )
FILEHANDLEREF FH = FN PIPEFILEHANDLEFORREADING( P )
FN TASKLAUNCH( TASK, NULL )
TASKWAITUNTILEXIT( TASK )
ERRORREF ERR
CFDATAREF DTA = FN FILEHANDLEREADDATATOENDOFFILE( FH, @ERR )
IF ERR THEN NSLOG( @"%@", FN ERRORLOCALIZEDDESCRIPTION( ERR ) ) : EXIT FN
OUTPUTSTR = FN STRINGWITHDATA( DTA, NSUTF8STRINGENCODING )
OUTPUTSTR = FN STRINGUPPERCASESTRING( OUTPUTSTR )
END FN = OUTPUTSTR
 
VOID LOCAL FN BUILDSNOOPYCALENDAR
CFSTRINGREF CALSTR = FN STRINGWITHFORMAT( FN STRINGLOWERCASESTRING( @"\n%37S\n\n%@" ), FN STRINGUTF8STRING( @"[SNOOPY HERE]" ), FN RUNTERMINALCOMMAND( FN STRINGLOWERCASESTRING( @"CAL 1969" ) ) )
NSLOG( @"%@", CALSTR )
END FN
 
FN BUILDSNOOPYCALENDAR
 
HANDLEEVENTS
</syntaxhighlight>
{{output}}
<pre style="font-size: 12px">
 
[SNOOPY HERE]
 
1969
JANUARY FEBRUARY MARCH
SU MO TU WE TH FR SA SU MO TU WE TH FR SA SU MO TU WE TH FR SA
1 2 3 4 1 1
5 6 7 8 9 10 11 2 3 4 5 6 7 8 2 3 4 5 6 7 8
12 13 14 15 16 17 18 9 10 11 12 13 14 15 9 10 11 12 13 14 15
19 20 21 22 23 24 25 16 17 18 19 20 21 22 16 17 18 19 20 21 22
26 27 28 29 30 31 23 24 25 26 27 28 23 24 25 26 27 28 29
30 31
 
APRIL MAY JUNE
SU MO TU WE TH FR SA SU MO TU WE TH FR SA SU MO TU WE TH FR SA
1 2 3 4 5 1 2 3 1 2 3 4 5 6 7
6 7 8 9 10 11 12 4 5 6 7 8 9 10 8 9 10 11 12 13 14
13 14 15 16 17 18 19 11 12 13 14 15 16 17 15 16 17 18 19 20 21
20 21 22 23 24 25 26 18 19 20 21 22 23 24 22 23 24 25 26 27 28
27 28 29 30 25 26 27 28 29 30 31 29 30
 
JULY AUGUST SEPTEMBER
SU MO TU WE TH FR SA SU MO TU WE TH FR SA SU MO TU WE TH FR SA
1 2 3 4 5 1 2 1 2 3 4 5 6
6 7 8 9 10 11 12 3 4 5 6 7 8 9 7 8 9 10 11 12 13
13 14 15 16 17 18 19 10 11 12 13 14 15 16 14 15 16 17 18 19 20
20 21 22 23 24 25 26 17 18 19 20 21 22 23 21 22 23 24 25 26 27
27 28 29 30 31 24 25 26 27 28 29 30 28 29 30
31
 
OCTOBER NOVEMBER DECEMBER
SU MO TU WE TH FR SA SU MO TU WE TH FR SA SU MO TU WE TH FR SA
1 2 3 4 1 1 2 3 4 5 6
5 6 7 8 9 10 11 2 3 4 5 6 7 8 7 8 9 10 11 12 13
12 13 14 15 16 17 18 9 10 11 12 13 14 15 14 15 16 17 18 19 20
19 20 21 22 23 24 25 16 17 18 19 20 21 22 21 22 23 24 25 26 27
26 27 28 29 30 31 23 24 25 26 27 28 29 28 29 30 31
30
</pre>
 
=={{header|Go}}==
Line 1,585 ⟶ 1,729:
 
This is realcal_UC.txt:
<langsyntaxhighlight lang="go">PACKAGE MAIN
IMPORT (
Line 1,655 ⟶ 1,799:
FMT.PRINTLN()
}
}</langsyntaxhighlight>
 
and this is realcal.go:
<langsyntaxhighlight lang="go">package main
 
import (
Line 1,697 ⟶ 1,841:
cmd.Stderr = os.Stderr
check(cmd.Run())
}</langsyntaxhighlight>
 
which produces (as expected) this output:
Line 1,741 ⟶ 1,885:
30
</pre>
 
=={{header|GUISS}}==
 
In Graphical User Interface Support Script, we utilize applications that are already written. So for this task, we shall just display the calendar that sets the system clock.
 
<langsyntaxhighlight lang="guiss">RIGHTCLICK:CLOCK,ADJUST DATE AND TIME,BUTTON:CANCEL</langsyntaxhighlight>
 
=={{header|Icon}} and {{header|Unicon}}==
Icon and Unicon don't lend themselves to ''REAL'' programming in the sense of this task easily. And initially this task was marked ''omit'' because the primary declarations, reserved words, and the name of the ''main'' procedure are all in lowercase. However, getting in the spirit of the task real programmers do not give up and a number of solutions are possible:
Line 1,769 ⟶ 1,911:
Also it makes me go all nostalgic for my old [[WATFIVE]] compiler. And an IBM 129 keypunch. And 5 hole paper tape.
 
<langsyntaxhighlight Uniconlang="unicon">$include "REALIZE.ICN"
 
LINK DATETIME
Line 1,817 ⟶ 1,959:
IF M = 2 & ISLEAPYEAR(YEAR) THEN SUSPEND (DAY +:= 1, 29)
EVERY DAY TO (6*7) DO SUSPEND ""
END</langsyntaxhighlight>
 
Where REALIZE.ICN would be something like this (this example is incomplete but sufficient for this program):
 
<langsyntaxhighlight Iconlang="icon">$define PROCEDURE procedure
$define END end
$define WRITE write
Line 1,847 ⟶ 1,989:
$define BY by
$define DATETIME datetime
$define RETURN return</langsyntaxhighlight>
 
{{libheader|Icon Programming Library}}
[http://www.cs.arizona.edu/icon/library/src/procs/DATETIME.ICN DATETIME.ICN provides IsLeapYear and julian]
 
=={{header|J}}==
For added "real"ness, we also only use 1 character names:
 
<langsyntaxhighlight Jlang="j">B=: + 4 100 400 -/@:<.@:%~ <:
M=: 28+ 3, (10$5$3 2),~ 0 ~:/@:= 4 100 400 | ]
R=: (7 -@| B+ 0, +/\@}:@M) |."0 1 (0,#\#~41) (]&:>: *"1 >/)~ M
Line 1,864 ⟶ 2,005:
L=: |."0 1~ +/ .(*./\@:=)"1&' '
E=: (|."0 1~ _2 <.@%~ +/ .(*./\.@:=)"1&' ')@:({."1) L
F=: 0 _1 }. 0 1 }. (2+[) E '[INSERT SNOOPY HERE]', ":@], D</langsyntaxhighlight>
 
B: given a year returns a number which when added to numeric values indexing days that year, mod 7, index the proper day names within a week. (In other words 7 | 0 + B 1969 gives the day of week index for the first day of 1969.)
Line 1,886 ⟶ 2,027:
Here's an example calendar (the first line <code>132 F 1969</code> being the command that build this calendar):
 
<syntaxhighlight lang="text"> 132 F 1969
[INSERT SNOOPY HERE]
1969
Line 1,908 ⟶ 2,049:
│ │31 │ │ │30 │ │
└────────────────────┴────────────────────┴────────────────────┴────────────────────┴────────────────────┴────────────────────┘
</syntaxhighlight>
</lang>
 
Note that this version of F will work fine with a left argument of 20 (why anyone felt that this was important to mention is perhaps best thought of as an issue lost in history).
 
=={{header|Julia}}==
Julia code is a valid data type in Julia. Executable code can be created from a String with Meta.parse() and run with eval.
This example does require a small function with Julia's lowercase keywords, perhaps loaded on startup from a separate file.
<langsyntaxhighlight lang="julia">
# IF THIS SMALL FUNCTION IS PLACED IN THE STARTUP.JL
# FILE, IT WILL BE LOADED ON STARTUP. THE REST OF
Line 1,973 ⟶ 2,113:
 
RUNUPPERCASECODE(CODE)
</langsyntaxhighlight> {{output}} <pre>
1969
JANUARY FEBRUARY MARCH APRIL MAY JUNE
Line 1,995 ⟶ 2,135:
 
</pre>
 
=={{header|Kotlin}}==
Kotlin is case-sensitive: all its keywords and packages are lower case, all its library classes are mixed case and its library functions are either lower case or mixed case. Consequently, it is impossible to run an upper case version of the Calendar task program as it stands. So what I've done instead (and similar to what several other languages in the same boat have done) is:
Line 2,005 ⟶ 2,144:
This is calendar_UC.txt:
 
<langsyntaxhighlight lang="scala">IMPORT JAVA.TEXT.*
IMPORT JAVA.UTIL.*
IMPORT JAVA.IO.PRINTSTREAM
Line 2,056 ⟶ 2,195:
FUN MAIN(ARGS: ARRAY<STRING>) {
SYSTEM.OUT.PRINTCALENDAR(1969, 3, LOCALE.US)
}</langsyntaxhighlight>
 
and this is real_calendar.kt:
 
<langsyntaxhighlight lang="scala">// version 1.1.3
 
import java.io.File
Line 2,143 ⟶ 2,282:
br.close()
println(out.toString())
}</langsyntaxhighlight>
 
which generates (on disk) calendar_NC.kt:
 
<langsyntaxhighlight lang="scala">import java.text.*
import java.util.*
import java.io.PrintStream
Line 2,198 ⟶ 2,337:
fun main(args: Array<String>) {
System.out.PRINTCALENDAR(1969, 3, Locale.US)
}</langsyntaxhighlight>
 
which when compiled and run produces output of:
Line 2,242 ⟶ 2,381:
30
</pre>
 
=={{header|Lua}}==
Tested with Lua 5.3.2
Line 2,250 ⟶ 2,388:
The upper case Lua source - stored in a file called UCCALENDAR.LUU:
<br>
<langsyntaxhighlight lang="lua">FUNCTION PRINT_CAL(YEAR)
LOCAL MONTHS={"JANUARY","FEBRUARY","MARCH","APRIL","MAY","JUNE",
"JULY","AUGUST","SEPTEMBER","OCTOBER","NOVEMBER","DECEMBER"}
Line 2,313 ⟶ 2,451:
PRINT_CAL(1969)
</syntaxhighlight>
</lang>
The following "one-liner" standard Lua source will down-case and run the program in the source file specified as it's parameter (file luu.lua):
<langsyntaxhighlight lang="lua">do io.input( arg[ 1 ] ); local s = io.read( "*a" ):lower(); io.close(); assert( load( s ) )() end
</syntaxhighlight>
</lang>
The following command will execute the UCCALENDAR.LUU source (replace lua532 with the appropriate command for your system):
<br>
Line 2,365 ⟶ 2,503:
</pre>
 
=={{header|M2000 Interpreter}}==
Console 132 characters by 43 lines. Six columns for months.
 
<syntaxhighlight lang="m2000 interpreter">
<lang M2000 Interpreter>
\\ Calendar - for "REAL" programmers
\\ All statements in UPPERCASE
\\ Output to 132 characters console - as a line printer
\\ USE COURIER NEW (FONT "COURIER NEW")
 
\\ CHANGE THE VALUE OF PRINT_IT TO TRUE FOR PRINTING
GLOBAL CONST PRINT_IT AS BOOLEAN=FALSE
MODULE GLOBAL SNOOPY {
Line 2,451 ⟶ 2,593:
FOR I=1 TO 6 {
MONTH=I+J*6
PRINT PART @((I-1)*22+1), $(2,21), UCASE$(LOCALE$(55+MONTH))
}
PRINT
Line 2,462 ⟶ 2,604:
COUNT(I)=GETMAX(YEAR, MONTH)
}
PRINT
IF PRINT_IT ELSE REFRESH 1000
FOR I=1 TO 6 {
IF I>1 THEN PRINT " ";
Line 2,474 ⟶ 2,617:
}
PRINT
IF PRINT_IT ELSE REFRESH 1000
PRINT @(0)
FOR M=1 TO 5 {
Line 2,485 ⟶ 2,629:
}
}
PRINT
IF PRINT_IT ELSE REFRESH 1000
}
}
}
WHILE INKEY$<>"" : END WHILE
IF PRINT_IT THEN PRINTING ON ELSE REFRESH 1000
FONT "COURIER NEW"
PEN 0
Line 2,497 ⟶ 2,642:
CALENDAR 1966, 1032 ' GREEK
GOSUB WAITKEY_OR_MOUSE
FOR I=20192020 TO 20252026
CALENDAR I, 1033 ' ENGLISH
GOSUB WAITKEY_OR_MOUSE
NEXT I
IF PRINT_IT THEN PRINTING OFF ELSE REFRESH 50
CLEAR ' CLEAR VARIABLES FROM THIS MODULE
KEYBOARD "INFO"+CHR$(13)
END
WAITKEY_OR_MOUSE:
Line 2,510 ⟶ 2,654:
END WHILE
RETURN
</syntaxhighlight>
=={{header|Nim}}==
Nim is a peculiar language regarding case sensitivity. First, keywords are all in lowercase. Second, Nim is case sensitive regarding the first character only. That means that ''Thing'' is different of ''thing'' but identical to ''THING''. There are several conventions regarding the style. For instance, the first character of a type should be in uppercase while the first character of a procedure or a variable should be in lowercase. Nim is also style-insensitive which means that "myvar", "myVar" and "my_var" are equivalent identifiers.
 
This makes impossible to write a valid program with only uppercase characters. So, we have built a program which reads the text written in uppercase, transforms it to valid Nim code, writes it into a file and includes this file. That means that in only one step, the uppercase text is read, transformed and compiled.
 
Instead of using the command <code>nim c file.txt</code> which would not work, we use the command <code>nim c file.nim</code> which, in fact, compiles “nim.txt” after is has been transformed.
</lang>
 
Here is the helper program:
 
<syntaxhighlight lang="text">import strutils
 
const progUpper = staticRead("calendar_upper.txt")
 
proc transformed(s: string): string {.compileTime.} =
## Return a transformed version (which can compile) of a program in uppercase.
 
let upper = s.toLower() # Convert all to lowercase.
var inString = false # Text in string should be in uppercase…
var inBraces = false # … except if this is in an expression to interpolate.
for ch in upper:
case ch
of '"':
inString = not inString
of '{':
if inString: inBraces = true
of '}':
if inString: inBraces = false
of 'a'..'z':
if inString and not inBraces:
result.add(ch.toUpperAscii()) # Restore content of strings to uppercase.
continue
else:
discard
result.add(ch)
 
const prog = progUpper.transformed()
 
static: writeFile("calendar_transformed.nim", prog)
 
include "calendar_transformed.nim"</syntaxhighlight>
 
Here is the actual program in uppercase.
 
<syntaxhighlight lang="text">IMPORT TIMES
IMPORT STRFORMAT
PROC PRINTCALENDAR(YEAR, NCOLS: INT) =
VAR ROWS = 12 DIV NCOLS
VAR DATE = INITDATETIME(1, MJAN, YEAR, 0, 0, 0, UTC())
IF ROWS MOD NCOLS != 0:
INC ROWS
VAR OFFS = GETDAYOFWEEK(DATE.MONTHDAY, DATE.MONTH, DATE.YEAR).INT
VAR MONS: ARRAY[12, ARRAY[8, STRING]]
FOR M IN 0..11:
MONS[M][0] = &"{$DATE.MONTH:^21}"
MONS[M][1] = " SU MO TU WE TH FR SA"
VAR DIM = GETDAYSINMONTH(DATE.MONTH, DATE.YEAR)
FOR D IN 1..42:
VAR DAY = D > OFFS AND D <= OFFS + DIM
VAR STR = IF DAY: &" {D-OFFS:2}" ELSE: " "
MONS[M][2 + (D - 1) DIV 7] &= STR
OFFS = (OFFS + DIM) MOD 7
DATE = DATE + MONTHS(1)
VAR SNOOPYSTRING, YEARSTRING: STRING
FORMATVALUE(SNOOPYSTRING, "[SNOOPY PICTURE]", "^" & $(NCOLS * 24 + 4))
FORMATVALUE(YEARSTRING, $YEAR, "^" & $(NCOLS * 24 + 4))
ECHO SNOOPYSTRING, "\N" , YEARSTRING, "\N"
FOR R IN 0..<ROWS:
VAR S: ARRAY[8, STRING]
FOR C IN 0..<NCOLS:
IF R * NCOLS + C > 11:
BREAK
FOR I, LINE IN MONS[R * NCOLS + C]:
S[I] &= &" {LINE}"
FOR LINE IN S:
IF LINE == "":
BREAK
ECHO LINE
ECHO ""
PRINTCALENDAR(1969, 5)</syntaxhighlight>
 
{{out}}
The program allows to choose the number of columns. Five is the maximum which can fit with 132 columns.
 
<pre> [SNOOPY PICTURE]
1969
 
January February March April May
SU MO TU WE TH FR SA SU MO TU WE TH FR SA SU MO TU WE TH FR SA SU MO TU WE TH FR SA SU MO TU WE TH FR SA
1 2 3 4 5 1 2 1 2 1 2 3 4 5 6 1 2 3 4
6 7 8 9 10 11 12 3 4 5 6 7 8 9 3 4 5 6 7 8 9 7 8 9 10 11 12 13 5 6 7 8 9 10 11
13 14 15 16 17 18 19 10 11 12 13 14 15 16 10 11 12 13 14 15 16 14 15 16 17 18 19 20 12 13 14 15 16 17 18
20 21 22 23 24 25 26 17 18 19 20 21 22 23 17 18 19 20 21 22 23 21 22 23 24 25 26 27 19 20 21 22 23 24 25
27 28 29 30 31 24 25 26 27 28 24 25 26 27 28 29 30 28 29 30 26 27 28 29 30 31
31
 
June July August September October
SU MO TU WE TH FR SA SU MO TU WE TH FR SA SU MO TU WE TH FR SA SU MO TU WE TH FR SA SU MO TU WE TH FR SA
1 1 2 3 4 5 6 1 2 3 1 2 3 4 5 6 7 1 2 3 4 5
2 3 4 5 6 7 8 7 8 9 10 11 12 13 4 5 6 7 8 9 10 8 9 10 11 12 13 14 6 7 8 9 10 11 12
9 10 11 12 13 14 15 14 15 16 17 18 19 20 11 12 13 14 15 16 17 15 16 17 18 19 20 21 13 14 15 16 17 18 19
16 17 18 19 20 21 22 21 22 23 24 25 26 27 18 19 20 21 22 23 24 22 23 24 25 26 27 28 20 21 22 23 24 25 26
23 24 25 26 27 28 29 28 29 30 31 25 26 27 28 29 30 31 29 30 27 28 29 30 31
30
 
November December
SU MO TU WE TH FR SA SU MO TU WE TH FR SA
1 2 1 2 3 4 5 6 7
3 4 5 6 7 8 9 8 9 10 11 12 13 14
10 11 12 13 14 15 16 15 16 17 18 19 20 21
17 18 19 20 21 22 23 22 23 24 25 26 27 28
24 25 26 27 28 29 30 29 30 31
</pre>
=={{header|Perl}}==
Since we can't use <code>eval</code> or <code>print</code> (or any other keywords)
at the top level, we need to abuse backticks in order to print anything, as in [http://www.perlmonks.org/?node_id=43797 the infamous JAPH with no letters or numbers]. Consequently, the calendar is printed to standard error instead of standard output.
 
<langsyntaxhighlight lang="perl">$PROGRAM = '\'
 
MY @START_DOW = (3, 6, 6, 2, 4, 0,
Line 2,561 ⟶ 2,816:
$L = ',' | '@';
 
`${E}${C}${H}${O} $PROGRAM | ${T}${R} A-Z ${A}-${Z} | ${P}${E}${R}${L}`;</langsyntaxhighlight>
Although, if we are abusing the backticks and other innocent programs, why not just: <langsyntaxhighlight Perllang="perl">$_=$ARGV[0]//1969;`\143\141\154 $_ >&2`</langsyntaxhighlight>
 
=={{header|Phix}}==
OK, I'm not going to take this too seriously butand thisinstead istreat it as a good an opportunity as I'll ever get to showcase how trivial it is to make some rather fundamental changes to the compiler. So, the first task is to take a copy of [[Calendar#Phix|Calendar]] and make it output uppercase. Change the line in routine centre:
<syntaxhighlight lang="phix">
 
--return repeat(' ',left)&s&repeat(' ',right)
So, the first task is to take a copy of [[Calendar#Phix|Calendar]] and make it output uppercase. Change the line
<lang Phix>return repeat(' ',left)&upper(s)&repeat(' ',right)</lang>
</syntaxhighlight>
in routine centre to:
(That's that done.) Now, Phix is case-sensitive, and many of the keywords and builtins are in lower case, which presents a bit of a challenge - but we can cope. It is too tedious and not particularly helpful to present a completed solution, instead I shall outline the (relatively simple) steps this would require. I have limited my tests to INCLUDE and INTEGER. In psym.e you can find the line
<lang Phix>return repeat(' ',left)&upper(s)&repeat(' ',right)</lang>
<syntaxhighlight lang="phix">
(That's that done.) Now, Phix is case-sensitive, and many of the keywords and builtins are in lower case, which presents a bit of a challenge - but we can cope.<br>
initialSymEntry("integer", S_Type,"TI",opInt, E_none) -- #01 / 0b0001 integer
It is too tedious and not particularly helpful to present a completed solution, instead I shall outline the (relatively simple) steps this would require. I have limited my tests to INCLUDE and INTEGER.
</syntaxhighlight>
 
In psym.e you can find the line
<lang Phix>initialSymEntry("integer", S_Type,"TI",opInt, E_none) -- #01 / 0b0001 integer</lang>
Immediately after that (it should now be there commented out) add:
<syntaxhighlight lang="phix">
<lang Phix>Alias("INTEGER",symlimit)</lang>
Alias("INTEGER",symlimit)
 
</syntaxhighlight>
Add similar lines for length, floor, repeat, upper, day_of_week, sequence, string, sprintf, append, printf, join, at the appropriate places.
Add similar lines for length, floor, repeat, upper, day_of_week, sequence, string, sprintf, append, printf, join, at the appropriate places. Keywords are handled slightly differently: In pttree.e we need a new alias routine (you should find this one commented out, from when I was testing all this):
 
<syntaxhighlight lang="phix">
Keywords are handled slightly differently: In pttree.e we need a new alias routine (you should find this one commented out, from when I was testing all this):
<lang Phix>procedure tt_stringA(sequence text, integer alias)
tt_string(text,-2)
tt[pcurr] = alias
end procedure</lang>
</syntaxhighlight>
and you can find the line
<syntaxhighlight lang="phix">
<lang Phix>global constant T_include = 596 tt_stringF("include",T_include)</lang>
global constant T_include = 596 tt_stringF("include",T_include)
</syntaxhighlight>
Sometime after that, in fact after the very last use of tt_stringF, add (likewise you should find this one commented out):
<syntaxhighlight lang="phix">
<lang Phix>tt_stringA("INCLUDE",T_include)</lang>
tt_stringA("INCLUDE",T_include)
</syntaxhighlight>
 
Add similar lines for function, end, iff, for, to, do, if, or, then, else, return, procedure, but this time all some ways away from the originals. Quickly run "p p" and make sure you get a normal prompt, without any "T_include should be 624(not 596)" or suchlike (which would happen <i>alot</i> if you put the aliases anywhere other than last).
 
Currently ptok.e recognises <code>\n</code> but not <code>\N</code>. Search for all references to <code>escchar</code> (there should be one definition and two references) and make sure the character being
checked is mapped to lower case, ie change (twice)
<syntaxhighlight lang="phix">
<lang Phix>Ch = find(Ch,escchar)</lang>
--Ch = find(Ch,escchar)
to
<lang Phix>Ch = find(lower(Ch),escchar)</lang>
</syntaxhighlight>
 
Lastly, the calendar example includes builtins\timedate.e, which contains some lower-case definitions. So copy it to (say) TIMEDATEUPPER.E and change adjust_timedate, timedelta, days (the 2nd param to timedelta), and format_timedate to their uppercase equivalents, and of course change that include to <code>INCLUDE BUILTINS\TIMEDATEUPPER.E</code>.
 
There isare probably someeven changesimpler inchanges to ptok.e/pttree.e even simpler than the steps outlined above that makeswould make everything case insensitive, but locating thatthose is left as an exercise for the reader. Likewise the changes that would be needed to pwa/p2js have been left as an exercise for the reader, but are assumed similarly trivial.
 
You don't actually have to repackage (p -c p) to test this, just run p p test.exw - percentagewise it might be ten timestechnically slower (asby p.exwa issecond muchor bigger than test.exw),so but it'll still only bereally anoticeable fraction of a secondlong-term.
 
Finally, you can take that copy of [[Calendar#Phix|Calendar]] and make it all uppercase. In Edita (shipped with Phix) that is just <Ctrl A><Alt U>.
Line 2,610 ⟶ 2,868:
While PHP functions are case-sensitive (aside of <code>_()</code>), this isn't the case for language constructs.
 
<langsyntaxhighlight lang="php"><?PHP
ECHO <<<REALPROGRAMMERSTHINKINUPPERCASEANDCHEATBYUSINGPRINT
JANUARY FEBRUARY MARCH APRIL MAY JUNE
Line 2,629 ⟶ 2,887:
28 29 30 31 25 26 27 28 29 30 31 29 30 27 28 29 30 31 24 25 26 27 28 29 30 29 30 31
REALPROGRAMMERSTHINKINUPPERCASEANDCHEATBYUSINGPRINT
; // MAGICAL SEMICOLON</langsyntaxhighlight>
 
=={{header|PicoLisp}}==
The "CALENDAR.L" source file:
<langsyntaxhighlight PicoLisplang="picolisp">(DE CAL (YEAR)
(PRINL "====== " YEAR " ======")
(FOR DAT (RANGE (DATE YEAR 1 1) (DATE YEAR 12 31))
Line 2,646 ⟶ 2,903:
 
(CAL 1969)
(BYE)</langsyntaxhighlight>
Then it can be executed with this command line:
<pre>$ pil -'load (list "awk" "{print tolower($0)}" "CALENDAR.L")'</pre>
Line 2,674 ⟶ 2,931:
30 Tue
31 Wed</pre>
 
=={{header|PL/I}}==
<langsyntaxhighlight PLlang="pl/Ii">(SUBRG, SIZE, FOFL):
CALENDAR: PROCEDURE (YEAR) OPTIONS (MAIN);
DECLARE YEAR CHARACTER (4) VARYING;
Line 2,727 ⟶ 2,983:
END PREPARE_MONTH;
 
END CALENDAR;</langsyntaxhighlight>
See CALENDAR for result.
 
=={{header|Racket}}==
<langsyntaxhighlight lang="racket">
#CI(MODULE NAME-OF-THIS-FILE RACKET
(REQUIRE RACKET/DATE)
Line 2,767 ⟶ 3,022:
 
(CALENDAR 1969))
</syntaxhighlight>
</lang>
 
=={{header|Raku}}==
(formerly Perl 6)
Uppercase is no challenge, who needs letters at all?
[Requires the year to be supplied as a command-line argument, and Unixish <i>cal</i> command.]
<syntaxhighlight lang="raku" perl6line>$_="\0".."~";<
115 97 121 32 34 91 73 78 83 69 82 84 32 83 78 79 79 80 89 32 72 69 82 69 93 34
59 114 117 110 32 60 99 97 108 62 44 64 42 65 82 71 83 91 48 93 47 47 49 57 54 57
>."$_[99]$_[104]$_[114]$_[115]"()."$_[69]$_[86]$_[65]$_[76]"()</langsyntaxhighlight>
 
=={{header|REXX}}==
This is essentially the same REXX program as for the CALENDAR task, but written entirely in uppercase. Indeed,
Line 2,799 ⟶ 3,052:
(but the second REXX version sure as heck looks
<br>like it was beat with a big ole ugly stick ─── and pardon the strong language).
<langsyntaxhighlight lang="rexx">/*REXX PROGRAM TO SHOW ANY YEAR'S (MONTHLY) CALENDAR (WITH/WITHOUT GRID)*/
@ABC=
PARSE VALUE SCRSIZE() WITH SD SW .
Line 2,971 ⟶ 3,224:
PUT:_=ARG(1);_=TRANSLATE(_,,'_'CHK);IF \GRID THEN _=UNGRID(_);IF LOWERCASE THEN _=LOWER(_);IF UPPERCASE THEN UPPER _;IF SHORTEST&_=' ' THEN RETURN;CALL TELL _;RETURN
TELL:SAY ARG(1);RETURN
UNGRID:RETURN TRANSLATE(ARG(1),,"│║─═┤┐└┴┬├┼┘┌╔╗╚╝╟╢╞╡╫╪╤╧╥╨╠╣")</langsyntaxhighlight>
Programming note: &nbsp; This REXX program makes use of &nbsp; '''SCRSIZE''' &nbsp; REXX program (or
BIF) which is used to determine the screen
Line 3,078 ⟶ 3,331:
└────┴────┴────┴────┴────┴────┴────┘
</pre>
 
=={{header|Ring}}==
<langsyntaxhighlight lang="ring">
# PROJECT : CALENDAR - FOR "REAL" PROGRAMMERS
# DATE : 2018/06/28
Line 3,239 ⟶ 3,491:
NEXT
NEXT
</syntaxhighlight>
</lang>
Output:
 
[https://www.dropbox.com/s/lb7rnqdb30a72kc/CalmoSoftRealCalendar.jpg?dl=0 CALENDAR - FOR "REAL" PROGRAMMERS]
 
=={{header|Ruby}}==
UPPERCASE RUBY is normally impossible, because Ruby is sensitive to case, and most methods and keywords have lowercase letters. To solve this task, we wrote a new program loader for UPPERCASE RUBY programs.
Line 3,250 ⟶ 3,501:
 
* <code>loadup.rb</code> is the program loader.
<langsyntaxhighlight lang="ruby"># loadup.rb - run UPPERCASE RUBY program
 
class Object
Line 3,275 ⟶ 3,526:
_PROGRAM = ARGV.SHIFT
_PROGRAM || ABORT("USAGE: #{$0} PROGRAM.RB ARGS...")
LOAD($0 = _PROGRAM)</langsyntaxhighlight>
 
* <code>CAL.RB</code> is an UPPERCASE RUBY translation of [[Calendar#Ruby]].
{{works with|Ruby|1.8.7}}
<langsyntaxhighlight lang="ruby"># CAL.RB - CALENDAR
REQUIRE 'DATE'.DOWNCASE
 
Line 3,362 ⟶ 3,613:
PROC {80}) }) })
 
PUTS CAL(ARGV[0].TO_I, _COLUMNS)</langsyntaxhighlight>
 
* A local variable must start with a lowercase letter or an underscore, so we have many leading underscores (_YEAR, _COLUMN, _DATE and so on).
Line 3,389 ⟶ 3,640:
27 28 29 30 31 24 25 26 27 28 29 30 28 29 30 26 27 28 29 30 31 23 24 25 26 27 28 29 28 29 30 31
31 30 </pre>
 
=={{header|Seed7}}==
Seed7 keywords are lower case, so this silly solution uses the whole Calendar Task code, with small changes and all in upper case, in a text file named "CALENDAR.TXT":
Line 3,447 ⟶ 3,697:
 
Then in another program the file CALENDAR.TXT is [http://seed7.sourceforge.net/libraries/getf.htm#getf%28in_string%29 read], converted, [http://seed7.sourceforge.net/libraries/progs.htm#parseStri%28in_string,in_parseOptions,in_array_string,in_string%29 parsed] and [http://seed7.sourceforge.net/libraries/progs.htm#execute%28in_program,in_array_string,in_parseOptions,in_string%29 executed]:
<langsyntaxhighlight lang="seed7">$ include "seed7_05.s7i";
include "getf.s7i";
include "progs.s7i";
Line 3,459 ⟶ 3,709:
source := replace(source, "daysinmonth", "daysInMonth");
execute(parseStri(source));
end func;</langsyntaxhighlight>
 
{{out}}
Line 3,500 ⟶ 3,750:
27 28 29 30 31 24 25 26 27 28 29 30 29 30 31
</pre>
 
=={{header|Sidef}}==
<langsyntaxhighlight lang="ruby">-> DT { ('DATE'.("\LWC") + 'TIME'.("\LWC")).("\LREQUIRE") }
 
-> MONTHS_PER_COL { 6 }
Line 3,560 ⟶ 3,809:
}
 
FMT_YEAR(ARGV ? ARGV[0].("\LTO_I") : 1969).("\LPRINT")</langsyntaxhighlight>
{{out}}
<pre>
Line 3,580 ⟶ 3,829:
28 29 30 31 25 26 27 28 29 30 31 29 30 27 28 29 30 31 24 25 26 27 28 29 30 29 30 31
</pre>
 
=={{header|Tcl}}==
The program starts implementing aliases for all built-in commands. This is done without using any letters at all ;).
CALENDER takes arguments of year and optional terminal width to use.
<langsyntaxhighlight lang="tcl">
\146\157\162\145\141\143\150 42 [\151\156\146\157 \143\157\155\155\141\156\144\163] {
\145\166\141\154 "
Line 3,633 ⟶ 3,881:
CALENDAR
</syntaxhighlight>
</lang>
{{out}}
<pre>
Line 3,672 ⟶ 3,920:
27 28 29 30 31 24 25 26 27 28 29 30 29 30 31
</pre>
 
=={{header|UNIX Shell}}==
 
<lang shell>CAL=CAL
===Using Bash Case-Converting Parameter Expansion===
<syntaxhighlight lang="shell">CAL=CAL
TR=TR
A=A
Z=Z
LANG=C ${CAL,,} 1969 | ${TR,,} ${A,}-${Z,} A-Z</langsyntaxhighlight>
{{out}}
<pre>
Line 3,715 ⟶ 3,964:
27 28 29 30 31 24 25 26 27 28 29 30 29 30 31
</pre>
 
===HISTORICALLY REAL WAY: INFORM UNIX YOUR TTY ONLY SUPPORTS CAPS===
 
<pre>sun-go:~$ stty olcuc
SUN-GO:~$ PS AUX | GREP PS
KERNOOPS 1159 0.0 0.0 10240 64 ? SS JUL04 3:59 /USR/SBIN/KERNELOOPS --TEST
KERNOOPS 1161 0.0 0.0 10240 64 ? SS JUL04 3:59 /USR/SBIN/KERNELOOPS
KAZ 2279 0.0 0.2 111724 5340 TTY2 SNL+ JUL04 0:00 /USR/LIB/TRACKER/TRACKER-MINER-APPS
ROOT 9404 0.0 0.3 19092 7600 ? SS 00:09 0:00 /USR/SBIN/CUPSD -L
ROOT 9406 0.0 0.4 44248 9772 ? SSL 00:09 0:00 /USR/SBIN/CUPS-BROWSED
KAZ 30121 4.0 0.1 8760 3072 PTS/3 R+ 09:38 0:00 PS AUX
KAZ 30122 0.0 0.0 6520 788 PTS/3 S+ 09:38 0:00 GREP PS
SUN-GO:~$ GREP ROOT /ETC/PASSWD
ROOT:X:0:0:ROOT:/ROOT:/BIN/BASH
SUN-GO:~$ CAL 1969
1969
JANUARY FEBRUARY MARCH
SU MO TU WE TH FR SA SU MO TU WE TH FR SA SU MO TU WE TH FR SA
1 2 3 4 1 1
5 6 7 8 9 10 11 2 3 4 5 6 7 8 2 3 4 5 6 7 8
12 13 14 15 16 17 18 9 10 11 12 13 14 15 9 10 11 12 13 14 15
19 20 21 22 23 24 25 16 17 18 19 20 21 22 16 17 18 19 20 21 22
26 27 28 29 30 31 23 24 25 26 27 28 23 24 25 26 27 28 29
30 31
 
APRIL MAY JUNE
SU MO TU WE TH FR SA SU MO TU WE TH FR SA SU MO TU WE TH FR SA
1 2 3 4 5 1 2 3 1 2 3 4 5 6 7
6 7 8 9 10 11 12 4 5 6 7 8 9 10 8 9 10 11 12 13 14
13 14 15 16 17 18 19 11 12 13 14 15 16 17 15 16 17 18 19 20 21
20 21 22 23 24 25 26 18 19 20 21 22 23 24 22 23 24 25 26 27 28
27 28 29 30 25 26 27 28 29 30 31 29 30
 
JULY AUGUST SEPTEMBER
SU MO TU WE TH FR SA SU MO TU WE TH FR SA SU MO TU WE TH FR SA
1 2 3 4 5 1 2 1 2 3 4 5 6
6 7 8 9 10 11 12 3 4 5 6 7 8 9 7 8 9 10 11 12 13
13 14 15 16 17 18 19 10 11 12 13 14 15 16 14 15 16 17 18 19 20
20 21 22 23 24 25 26 17 18 19 20 21 22 23 21 22 23 24 25 26 27
27 28 29 30 31 24 25 26 27 28 29 30 28 29 30
31
 
OCTOBER NOVEMBER DECEMBER
SU MO TU WE TH FR SA SU MO TU WE TH FR SA SU MO TU WE TH FR SA
1 2 3 4 1 1 2 3 4 5 6
5 6 7 8 9 10 11 2 3 4 5 6 7 8 7 8 9 10 11 12 13
12 13 14 15 16 17 18 9 10 11 12 13 14 15 14 15 16 17 18 19 20
19 20 21 22 23 24 25 16 17 18 19 20 21 22 21 22 23 24 25 26 27
26 27 28 29 30 31 23 24 25 26 27 28 29 28 29 30 31
30
SUN-GO:~$ STTY SANE
sun-go:~$</pre>
 
=={{header|Vedit macro language}}==
Line 3,723 ⟶ 4,025:
Vedit macro language is case insensitive, but it is normal practice to write short commands in upper case.
 
<langsyntaxhighlight lang="vedit">BS(BF)
CFT(22)
#3 = 6 // NUMBER OF MONTHS PER LINE
Line 3,787 ⟶ 4,089:
REG_EMPTY(#20)
NUM_POP(4,20)
RETURN </langsyntaxhighlight>
 
<pre>
Line 3,813 ⟶ 4,115:
28 29 30 31 25 26 27 28 29 30 31 29 30 27 28 29 30 31 24 25 26 27 28 29 30 29 30 31
</pre>
 
=={{header|Visual Basic .NET}}==
'''Compiler:''' Roslyn Visual Basic (language version >= 15.8)
Line 3,820 ⟶ 4,121:
Copied from [[Calendar#Visual_Basic_.NET]] and converted to uppercase. See entry there for description.
 
<langsyntaxhighlight lang="vbnet">OPTION COMPARE BINARY
OPTION EXPLICIT ON
OPTION INFER ON
Line 4,150 ⟶ 4,451:
RETURN S.PADLEFT(((TOTALWIDTH - S.LENGTH) \ 2) + S.LENGTH, PADDINGCHAR).PADRIGHT(TOTALWIDTH, PADDINGCHAR)
END FUNCTION
END MODULE</langsyntaxhighlight>
 
{{out|input=COLS:132 ROWS:25 MS/ROW:6 HSTRETCH:FALSE VSTRETCH:FALSE}}
Line 4,176 ⟶ 4,477:
</pre>
=={{header|Wren}}==
Strictly speaking, ''real'' programming is impossible in Wren which is case sensitive and keywords, library classes, methods etc. never use all upper case letters.
 
We therefore do what other languages in a similar predicament have done and begin by creating an all upper case version of the calendar program called ''calendar_real_uc.txt'':
 
{{libheader|Wren-date}}
{{libheader|Wren-fmt}}
{{libheader|Wren-seq}}
<syntaxhighlight lang="text">IMPORT "./DATE" FOR DATE
IMPORT "./FMT" FOR FMT
IMPORT "./SEQ" FOR LST
 
VAR CALENDAR = FN.NEW { |YEAR|
VAR SNOOPY = "🐶"
VAR DAYS = "SU MO TU WE TH FR SA"
VAR MONTHS = [
"JANUARY", "FEBRUARY", "MARCH", "APRIL", "MAY", "JUNE",
"JULY", "AUGUST", "SEPTEMBER", "OCTOBER", "NOVEMBER", "DECEMBER"
]
FMT.PRINT("$70M", SNOOPY)
VAR YEARSTR = "--- %(YEAR) ---"
FMT.PRINT("$70M\N", YEARSTR)
VAR FIRST = LIST.FILLED(3, 0)
VAR MLEN = LIST.FILLED(3, 0)
VAR C = 0
FOR (CHUNK IN LST.CHUNKS(MONTHS, 3)) {
FOR (I IN 0..2) FMT.WRITE("$20M ", CHUNK[I])
SYSTEM.PRINT()
FOR (I IN 0..2) SYSTEM.WRITE("%(DAYS) ")
SYSTEM.PRINT()
FIRST[0] = DATE.NEW(YEAR, C*3 + 1, 1).DAYOFWEEK % 7
FIRST[1] = DATE.NEW(YEAR, C*3 + 2, 1).DAYOFWEEK % 7
FIRST[2] = DATE.NEW(YEAR, C*3 + 3, 1).DAYOFWEEK % 7
MLEN[0] = DATE.MONTHLENGTH(YEAR, C*3 + 1)
MLEN[1] = DATE.MONTHLENGTH(YEAR, C*3 + 2)
MLEN[2] = DATE.MONTHLENGTH(YEAR, C*3 + 3)
FOR (I IN 0..5) {
FOR (J IN 0..2) {
VAR START = 1 + 7 * I - FIRST[J]
FOR (K IN START..START+6) {
IF (K >= 1 && K <= MLEN[J]) {
FMT.WRITE("$2D ", K)
} ELSE {
SYSTEM.WRITE(" ")
}
}
SYSTEM.WRITE(" ")
}
SYSTEM.PRINT()
}
SYSTEM.PRINT()
C = C + 1
}
}
 
CALENDAR.CALL(1969)</syntaxhighlight>
 
We then create a script called ''calendar_real.wren'' which takes the above text file as input, changes those items which cannot be upper case into their normal casing and compiles and runs the result:
 
{{libheader|Wren-str}}
<syntaxhighlight lang="wren">import "io" for File
import "./str" for Str
import "meta" for Meta
 
var keywords = ["import", "for", "var", "in", "if", "else"]
var modules = ["/date", "/fmt", "/seq"]
var classes = ["Date", "Fmt", "Lst", "Fn", "List", "System"]
var methods = ["print", "filled", "chunks", "write", "new", "dayOfWeek", "monthLength", "call"]
var formats = ["$70m", "\\n", "$20m", "$2d"]
 
var text = File.read("calendar_real_uc.txt")
for (keyword in keywords) text = text.replace(Str.upper(keyword) + " ", keyword + " ")
for (module in modules) text = text.replace(Str.upper(module), module)
for (clazz in classes) text = text.replace(Str.upper(clazz), clazz)
for (method in methods) text = text.replace("." + Str.upper(method), "." + method)
for (format in formats) text = text.replace(Str.upper(format), format)
 
Meta.compile(text).call()</syntaxhighlight>
 
{{out}}
<pre>
🐶
--- 1969 ---
 
JANUARY FEBRUARY MARCH
SU MO TU WE TH FR SA SU MO TU WE TH FR SA SU MO TU WE TH FR SA
1 2 3 4 1 1
5 6 7 8 9 10 11 2 3 4 5 6 7 8 2 3 4 5 6 7 8
12 13 14 15 16 17 18 9 10 11 12 13 14 15 9 10 11 12 13 14 15
19 20 21 22 23 24 25 16 17 18 19 20 21 22 16 17 18 19 20 21 22
26 27 28 29 30 31 23 24 25 26 27 28 23 24 25 26 27 28 29
30 31
 
APRIL MAY JUNE
SU MO TU WE TH FR SA SU MO TU WE TH FR SA SU MO TU WE TH FR SA
1 2 3 4 5 1 2 3 1 2 3 4 5 6 7
6 7 8 9 10 11 12 4 5 6 7 8 9 10 8 9 10 11 12 13 14
13 14 15 16 17 18 19 11 12 13 14 15 16 17 15 16 17 18 19 20 21
20 21 22 23 24 25 26 18 19 20 21 22 23 24 22 23 24 25 26 27 28
27 28 29 30 25 26 27 28 29 30 31 29 30
 
JULY AUGUST SEPTEMBER
SU MO TU WE TH FR SA SU MO TU WE TH FR SA SU MO TU WE TH FR SA
1 2 3 4 5 1 2 1 2 3 4 5 6
6 7 8 9 10 11 12 3 4 5 6 7 8 9 7 8 9 10 11 12 13
13 14 15 16 17 18 19 10 11 12 13 14 15 16 14 15 16 17 18 19 20
20 21 22 23 24 25 26 17 18 19 20 21 22 23 21 22 23 24 25 26 27
27 28 29 30 31 24 25 26 27 28 29 30 28 29 30
31
 
OCTOBER NOVEMBER DECEMBER
SU MO TU WE TH FR SA SU MO TU WE TH FR SA SU MO TU WE TH FR SA
1 2 3 4 1 1 2 3 4 5 6
5 6 7 8 9 10 11 2 3 4 5 6 7 8 7 8 9 10 11 12 13
12 13 14 15 16 17 18 9 10 11 12 13 14 15 14 15 16 17 18 19 20
19 20 21 22 23 24 25 16 17 18 19 20 21 22 21 22 23 24 25 26 27
26 27 28 29 30 31 23 24 25 26 27 28 29 28 29 30 31
30
</pre>
 
Line 4,181 ⟶ 4,602:
ASSEMBLE WITH: TASM CALENDAR; TLINK /t CALENDAR
 
<langsyntaxhighlight lang="asm"> .MODEL TINY
.CODE
.486
Line 4,367 ⟶ 4,788:
DAYS DB 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
DAY DB ?, ?, ?, ?, ?, ?
END START</langsyntaxhighlight>
 
{{Out}}
Line 4,392 ⟶ 4,813:
31 30
</pre>
 
=={{header|XLISP}}==
XLISP isn't case-sensitive, so in principle it would be possible just to reproduce the solution given in the "ordinary" Calendar task. But that program makes use of recursion, "fancy" data structures, long variable names, pretty-printy indentation, and a whole host of other features that I don't think REAL programmers like any better than they like lower case: so, instead, here is a version using only global variables and "<tt>DO</tt> loops like God meant them to be".
<langsyntaxhighlight lang="lisp">(SETQ YR 1969)
(SETQ M #("JANUARY" "FEBRUARY" "MARCH" "APRIL" "MAY" "JUNE" "JULY" "AUGUST" "SEPTEMBER" "OCTOBER" "NOVEMBER" "DECEMBER"))
(SETQ ML #(31 28 31 30 31 30 31 31 30 31 30 31))
Line 4,430 ⟶ 4,850:
(SETQ D (+ D 1))
(IF (> D 6) (TERPRI))
(IF (> D 6) (SETQ D 0))))</langsyntaxhighlight>
{{out}}
<pre> SNOOPY CALENDAR 1969
Line 4,522 ⟶ 4,942:
21 22 23 24 25 26 27
28 29 30 31</pre>
 
=={{header|zkl}}==
{{trans|D}}
Line 4,528 ⟶ 4,947:
 
The calendar code, file UPCAL.zkl (upper cased version of [[Calendar#zkl]]):
<langsyntaxhighlight lang="zkl">VAR [CONST] D=TIME.DATE, DAYS="SU MO TU WE TH FR SA";
 
FCN CENTER(TEXT,M) { STRING(" "*((M-TEXT.LEN())/2),TEXT) }
Line 4,539 ⟶ 4,958:
.PUMP(LIST,T(VOID.READ,DAYS.LEN()/3,FALSE),STRING.CREATE));
}
...</langsyntaxhighlight>
And the pre-processor, hand rolled for the above code (file bbb.zkl):
<langsyntaxhighlight lang="zkl">code:=File(vm.arglist[0]).read();
code=Data(Void,code.text.toLower());
mixed:=T("string","String", "list","List", " t("," T(",",t(",",T(",
Line 4,551 ⟶ 4,970:
);
mixed.pump(Void,Void.Read,'wrap(up,down){ code.replace(up,down) });
Compiler.Compiler.compileText(code)();</langsyntaxhighlight>
{{out}}
<pre>
Line 4,564 ⟶ 4,983:
...
</pre>
 
{{omit from|C sharp|keywords are lower case}}
{{omit from|C++}}
{{omit from|Clojure|Clojure's keywords are lower case}}
{{omit from|D|D's keywords are lower case}}
Line 4,571 ⟶ 4,990:
{{omit from|Haskell|Haskell reserves words starting with uppercase letters for datatypes.}}
{{omit from|Java|Java's keywords are lower case}}
{{omit from|Mathematica}}
{{omit from|Processing|Processing's keywords are lower case}}
{{omit from|Mathematica}}
{{omit from|Python}}
{{omit from|Stata|keywords are lower case}}
{{omit from|zkl|boogers to upper case}}
[[Category:Handicap]]
7,796

edits