Calendar - for "REAL" programmers: Difference between revisions

Content added Content deleted
m (syntax highlighting fixup automation)
Line 37: Line 37:
This is for real programmers who code only in assembler :). The code could have been run in april 1964, punched on
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.
80-column cards, read on a card reader, and printed with a 132-column line printer on fan-folded paper with perforated edges.
<lang 360asm>* CALENDAR FOR REAL PROGRAMMERS 05/03/2017
<syntaxhighlight lang=360asm>* CALENDAR FOR REAL PROGRAMMERS 05/03/2017
CALENDAR CSECT
CALENDAR CSECT
USING CALENDAR,R13 BASE REGISTER
USING CALENDAR,R13 BASE REGISTER
Line 217: Line 217:
DA DS 12CL144
DA DS 12CL144
YREGS
YREGS
END CALENDAR</lang>
END CALENDAR</syntaxhighlight>
{{out}}
{{out}}
<pre> INSERT SNOOPY HERE
<pre> INSERT SNOOPY HERE
Line 243: Line 243:
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]]:
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]]:


<lang Ada>WITH PRINTABLE_CALENDAR;
<syntaxhighlight lang=Ada>WITH PRINTABLE_CALENDAR;


PROCEDURE REAL_CAL IS
PROCEDURE REAL_CAL IS
Line 263: Line 263:
C.NEW_LINE;
C.NEW_LINE;
C.PRINT(1969, "NINETEEN-SIXTY-NINE");
C.PRINT(1969, "NINETEEN-SIXTY-NINE");
END REAL_CAL;</lang>
END REAL_CAL;</syntaxhighlight>


{{out}}
{{out}}
Line 296: Line 296:


Note: to run this code with [[ALGOL 68G]] you need to use the '''--quote-stropping''' option.
Note: to run this code with [[ALGOL 68G]] you need to use the '''--quote-stropping''' option.
<lang algol68>'PR' QUOTE 'PR'
<syntaxhighlight lang=algol68>'PR' QUOTE 'PR'
'PROC' PRINT CALENDAR = ('INT' YEAR, PAGE WIDTH)'VOID': 'BEGIN'
'PROC' PRINT CALENDAR = ('INT' YEAR, PAGE WIDTH)'VOID': 'BEGIN'
Line 403: Line 403:
LINE PRINTER WIDTH = 132; # AS AT 1969! #
LINE PRINTER WIDTH = 132; # AS AT 1969! #
PRINT CALENDAR(MANKIND STEPPED ON THE MOON, LINE PRINTER WIDTH)
PRINT CALENDAR(MANKIND STEPPED ON THE MOON, LINE PRINTER WIDTH)
'END'</lang>
'END'</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Line 428: Line 428:


=={{header|AutoHotkey}}==
=={{header|AutoHotkey}}==
<lang AutoHotkey>CALENDAR(YR){
<syntaxhighlight lang=AutoHotkey>CALENDAR(YR){
LASTDAY := [], DAY := []
LASTDAY := [], DAY := []
TITLES =
TITLES =
Line 466: Line 466:
STRINGREPLACE, RES, RES,%A_SPACE%0,%A_SPACE%%A_SPACE%, ALL
STRINGREPLACE, RES, RES,%A_SPACE%0,%A_SPACE%%A_SPACE%, ALL
RETURN RES
RETURN RES
}</lang>
}</syntaxhighlight>
Examples:<lang AutoHotkey>EXAMPLES:
Examples:<syntaxhighlight lang=AutoHotkey>EXAMPLES:
GUI, FONT,S8, COURIER
GUI, FONT,S8, COURIER
GUI, ADD, EDIT, VYR W40 R1 LIMIT4 NUMBER, 1969
GUI, ADD, EDIT, VYR W40 R1 LIMIT4 NUMBER, 1969
Line 482: Line 482:
GUICLOSE:
GUICLOSE:
EXITAPP
EXITAPP
RETURN</lang>
RETURN</syntaxhighlight>
{{out}}
{{out}}
<pre> 1969
<pre> 1969
Line 525: Line 525:
=={{header|BaCon}}==
=={{header|BaCon}}==
Choosing 132 character output. Same as the "Calendar" from [[Calendar#BaCon|the calendar task]] but using all capitals:
Choosing 132 character output. Same as the "Calendar" from [[Calendar#BaCon|the calendar task]] but using all capitals:
<lang freebasic>DECLARE MON$[] = { "JANUARY", "FEBRUARY", "MARCH", "APRIL", "MAY", "JUNE", "JULY", "AUGUST", "SEPTEMBER", "OCTOBER", "NOVEMBER", "DECEMBER" }
<syntaxhighlight 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 }
DECLARE MON[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
Y$ = "1969"
Y$ = "1969"
Line 557: Line 557:
PRINT D;
PRINT D;
NEXT
NEXT
NEXT</lang>
NEXT</syntaxhighlight>


{{out}}
{{out}}
Line 582: Line 582:
=={{header|BBC BASIC}}==
=={{header|BBC BASIC}}==
{{works with|BBC BASIC for Windows}}
{{works with|BBC BASIC for Windows}}
<lang bbcbasic> VDU 23,22,1056;336;8,16,16,128
<syntaxhighlight lang=bbcbasic> VDU 23,22,1056;336;8,16,16,128
YEAR = 1969
YEAR = 1969
Line 628: Line 628:
WHEN 4,6,9,11: = 30
WHEN 4,6,9,11: = 30
OTHERWISE = 31
OTHERWISE = 31
ENDCASE</lang>
ENDCASE</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Line 670: Line 670:
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
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>
</pre>
<lang c>/* UPPER CASE ONLY VERSION OF THE ORIGINAL CALENDAR.C, CHANGES MOSTLY TO AVOID NEEDING #INCLUDES */
<syntaxhighlight 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 */
/* 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: */
/* WHEN COMPILING THIS, THE COMMAND LINE SHOULD SPECIFY -D OPTIONS FOR THE FOLLOWING WORDS: */
Line 835: Line 835:
}
}
RETURN RESULT;
RETURN RESULT;
}</lang>
}</syntaxhighlight>


=={{header|COBOL}}==
=={{header|COBOL}}==
Line 842: Line 842:


=={{header|Common Lisp}}==
=={{header|Common Lisp}}==
<lang lisp>(QL:QUICKLOAD '(DATE-CALC))
<syntaxhighlight lang=lisp>(QL:QUICKLOAD '(DATE-CALC))


(DEFPARAMETER *DAY-ROW* "SU MO TU WE TH FR SA")
(DEFPARAMETER *DAY-ROW* "SU MO TU WE TH FR SA")
Line 916: Line 916:
(LAMBDA (&REST HEADS)
(LAMBDA (&REST HEADS)
(FORMAT T FORMAT-STRING HEADS))
(FORMAT T FORMAT-STRING HEADS))
ROW))))</lang>
ROW))))</syntaxhighlight>
{{out}}
{{out}}
<pre>CL-USER> (PRINT-CALENDAR 1969)
<pre>CL-USER> (PRINT-CALENDAR 1969)
Line 1,012: Line 1,012:


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>):
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>):
<lang d>import std.string;mixin(import("CALENDAR").toLower);void main(){}</lang>
<syntaxhighlight lang=d>import std.string;mixin(import("CALENDAR").toLower);void main(){}</syntaxhighlight>
{{out}}
{{out}}
<pre> [Snoopy Picture]
<pre> [Snoopy Picture]
Line 1,055: Line 1,055:
=={{header|Elena}}==
=={{header|Elena}}==
ELENA 5.0 :
ELENA 5.0 :
<lang elena>import system'text;
<syntaxhighlight lang=elena>import system'text;
import system'routines;
import system'routines;
import system'calendar;
import system'calendar;
Line 1,215: Line 1,215:
console.readChar()
console.readChar()
}</lang>
}</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Line 1,257: Line 1,257:
=={{header|Fortran}}==
=={{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:
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:
<lang FORTRAN>
<syntaxhighlight lang=FORTRAN>
MODULE DATEGNASH
MODULE DATEGNASH


Line 1,433: Line 1,433:
END DO
END DO
END
END
</syntaxhighlight>
</lang>


And for output, the wide form:
And for output, the wide form:
Line 1,458: Line 1,458:


=={{header|FreeBASIC}}==
=={{header|FreeBASIC}}==
<lang freebasic>' VERSION 16-03-2016
<syntaxhighlight lang=freebasic>' VERSION 16-03-2016
' COMPILE WITH: FBC -S CONSOLE
' COMPILE WITH: FBC -S CONSOLE


Line 1,554: Line 1,554:
PRINT : PRINT "HIT ANY KEY TO END PROGRAM"
PRINT : PRINT "HIT ANY KEY TO END PROGRAM"
SLEEP
SLEEP
END</lang>
END</syntaxhighlight>
{{out}}
{{out}}
<pre> INSERT YOUR SNOOPY PICTURE HERE
<pre> INSERT YOUR SNOOPY PICTURE HERE
Line 1,584: Line 1,584:


This is realcal_UC.txt:
This is realcal_UC.txt:
<lang go>PACKAGE MAIN
<syntaxhighlight lang=go>PACKAGE MAIN
IMPORT (
IMPORT (
Line 1,654: Line 1,654:
FMT.PRINTLN()
FMT.PRINTLN()
}
}
}</lang>
}</syntaxhighlight>


and this is realcal.go:
and this is realcal.go:
<lang go>package main
<syntaxhighlight lang=go>package main


import (
import (
Line 1,696: Line 1,696:
cmd.Stderr = os.Stderr
cmd.Stderr = os.Stderr
check(cmd.Run())
check(cmd.Run())
}</lang>
}</syntaxhighlight>


which produces (as expected) this output:
which produces (as expected) this output:
Line 1,745: Line 1,745:
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.
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.


<lang guiss>RIGHTCLICK:CLOCK,ADJUST DATE AND TIME,BUTTON:CANCEL</lang>
<syntaxhighlight lang=guiss>RIGHTCLICK:CLOCK,ADJUST DATE AND TIME,BUTTON:CANCEL</syntaxhighlight>


=={{header|Icon}} and {{header|Unicon}}==
=={{header|Icon}} and {{header|Unicon}}==
Line 1,768: Line 1,768:
Also it makes me go all nostalgic for my old [[WATFIVE]] compiler. And an IBM 129 keypunch. And 5 hole paper tape.
Also it makes me go all nostalgic for my old [[WATFIVE]] compiler. And an IBM 129 keypunch. And 5 hole paper tape.


<lang Unicon>$include "REALIZE.ICN"
<syntaxhighlight lang=Unicon>$include "REALIZE.ICN"


LINK DATETIME
LINK DATETIME
Line 1,816: Line 1,816:
IF M = 2 & ISLEAPYEAR(YEAR) THEN SUSPEND (DAY +:= 1, 29)
IF M = 2 & ISLEAPYEAR(YEAR) THEN SUSPEND (DAY +:= 1, 29)
EVERY DAY TO (6*7) DO SUSPEND ""
EVERY DAY TO (6*7) DO SUSPEND ""
END</lang>
END</syntaxhighlight>


Where REALIZE.ICN would be something like this (this example is incomplete but sufficient for this program):
Where REALIZE.ICN would be something like this (this example is incomplete but sufficient for this program):


<lang Icon>$define PROCEDURE procedure
<syntaxhighlight lang=Icon>$define PROCEDURE procedure
$define END end
$define END end
$define WRITE write
$define WRITE write
Line 1,846: Line 1,846:
$define BY by
$define BY by
$define DATETIME datetime
$define DATETIME datetime
$define RETURN return</lang>
$define RETURN return</syntaxhighlight>


{{libheader|Icon Programming Library}}
{{libheader|Icon Programming Library}}
Line 1,854: Line 1,854:
For added "real"ness, we also only use 1 character names:
For added "real"ness, we also only use 1 character names:


<lang J>B=: + 4 100 400 -/@:<.@:%~ <:
<syntaxhighlight lang=J>B=: + 4 100 400 -/@:<.@:%~ <:
M=: 28+ 3, (10$5$3 2),~ 0 ~:/@:= 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
R=: (7 -@| B+ 0, +/\@}:@M) |."0 1 (0,#\#~41) (]&:>: *"1 >/)~ M
Line 1,863: Line 1,863:
L=: |."0 1~ +/ .(*./\@:=)"1&' '
L=: |."0 1~ +/ .(*./\@:=)"1&' '
E=: (|."0 1~ _2 <.@%~ +/ .(*./\.@:=)"1&' ')@:({."1) L
E=: (|."0 1~ _2 <.@%~ +/ .(*./\.@:=)"1&' ')@:({."1) L
F=: 0 _1 }. 0 1 }. (2+[) E '[INSERT SNOOPY HERE]', ":@], D</lang>
F=: 0 _1 }. 0 1 }. (2+[) E '[INSERT SNOOPY HERE]', ":@], D</syntaxhighlight>


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.)
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,885: Line 1,885:
Here's an example calendar (the first line <code>132 F 1969</code> being the command that build this calendar):
Here's an example calendar (the first line <code>132 F 1969</code> being the command that build this calendar):


<lang> 132 F 1969
<syntaxhighlight lang=text> 132 F 1969
[INSERT SNOOPY HERE]
[INSERT SNOOPY HERE]
1969
1969
Line 1,907: Line 1,907:
│ │31 │ │ │30 │ │
│ │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).
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).
Line 1,914: Line 1,914:
Julia code is a valid data type in Julia. Executable code can be created from a String with Meta.parse() and run with eval.
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.
This example does require a small function with Julia's lowercase keywords, perhaps loaded on startup from a separate file.
<lang julia>
<syntaxhighlight lang=julia>
# IF THIS SMALL FUNCTION IS PLACED IN THE STARTUP.JL
# IF THIS SMALL FUNCTION IS PLACED IN THE STARTUP.JL
# FILE, IT WILL BE LOADED ON STARTUP. THE REST OF
# FILE, IT WILL BE LOADED ON STARTUP. THE REST OF
Line 1,972: Line 1,972:


RUNUPPERCASECODE(CODE)
RUNUPPERCASECODE(CODE)
</lang> {{output}} <pre>
</syntaxhighlight> {{output}} <pre>
1969
1969
JANUARY FEBRUARY MARCH APRIL MAY JUNE
JANUARY FEBRUARY MARCH APRIL MAY JUNE
Line 2,004: Line 2,004:
This is calendar_UC.txt:
This is calendar_UC.txt:


<lang scala>IMPORT JAVA.TEXT.*
<syntaxhighlight lang=scala>IMPORT JAVA.TEXT.*
IMPORT JAVA.UTIL.*
IMPORT JAVA.UTIL.*
IMPORT JAVA.IO.PRINTSTREAM
IMPORT JAVA.IO.PRINTSTREAM
Line 2,055: Line 2,055:
FUN MAIN(ARGS: ARRAY<STRING>) {
FUN MAIN(ARGS: ARRAY<STRING>) {
SYSTEM.OUT.PRINTCALENDAR(1969, 3, LOCALE.US)
SYSTEM.OUT.PRINTCALENDAR(1969, 3, LOCALE.US)
}</lang>
}</syntaxhighlight>


and this is real_calendar.kt:
and this is real_calendar.kt:


<lang scala>// version 1.1.3
<syntaxhighlight lang=scala>// version 1.1.3


import java.io.File
import java.io.File
Line 2,142: Line 2,142:
br.close()
br.close()
println(out.toString())
println(out.toString())
}</lang>
}</syntaxhighlight>


which generates (on disk) calendar_NC.kt:
which generates (on disk) calendar_NC.kt:


<lang scala>import java.text.*
<syntaxhighlight lang=scala>import java.text.*
import java.util.*
import java.util.*
import java.io.PrintStream
import java.io.PrintStream
Line 2,197: Line 2,197:
fun main(args: Array<String>) {
fun main(args: Array<String>) {
System.out.PRINTCALENDAR(1969, 3, Locale.US)
System.out.PRINTCALENDAR(1969, 3, Locale.US)
}</lang>
}</syntaxhighlight>


which when compiled and run produces output of:
which when compiled and run produces output of:
Line 2,249: Line 2,249:
The upper case Lua source - stored in a file called UCCALENDAR.LUU:
The upper case Lua source - stored in a file called UCCALENDAR.LUU:
<br>
<br>
<lang lua>FUNCTION PRINT_CAL(YEAR)
<syntaxhighlight lang=lua>FUNCTION PRINT_CAL(YEAR)
LOCAL MONTHS={"JANUARY","FEBRUARY","MARCH","APRIL","MAY","JUNE",
LOCAL MONTHS={"JANUARY","FEBRUARY","MARCH","APRIL","MAY","JUNE",
"JULY","AUGUST","SEPTEMBER","OCTOBER","NOVEMBER","DECEMBER"}
"JULY","AUGUST","SEPTEMBER","OCTOBER","NOVEMBER","DECEMBER"}
Line 2,312: Line 2,312:
PRINT_CAL(1969)
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):
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):
<lang lua>do io.input( arg[ 1 ] ); local s = io.read( "*a" ):lower(); io.close(); assert( load( s ) )() end
<syntaxhighlight 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):
The following command will execute the UCCALENDAR.LUU source (replace lua532 with the appropriate command for your system):
<br>
<br>
Line 2,368: Line 2,368:
Console 132 characters by 43 lines. Six columns for months.
Console 132 characters by 43 lines. Six columns for months.


<lang M2000 Interpreter>
<syntaxhighlight lang=M2000 Interpreter>
\\ Calendar - for "REAL" programmers
\\ Calendar - for "REAL" programmers
\\ All statements in UPPERCASE
\\ All statements in UPPERCASE
Line 2,516: Line 2,516:
END WHILE
END WHILE
RETURN
RETURN
</syntaxhighlight>
</lang>


=={{header|Nim}}==
=={{header|Nim}}==
Line 2,527: Line 2,527:
Here is the helper program:
Here is the helper program:


<lang>import strutils
<syntaxhighlight lang=text>import strutils


const progUpper = staticRead("calendar_upper.txt")
const progUpper = staticRead("calendar_upper.txt")
Line 2,557: Line 2,557:
static: writeFile("calendar_transformed.nim", prog)
static: writeFile("calendar_transformed.nim", prog)


include "calendar_transformed.nim"</lang>
include "calendar_transformed.nim"</syntaxhighlight>


Here is the actual program in uppercase.
Here is the actual program in uppercase.


<lang>IMPORT TIMES
<syntaxhighlight lang=text>IMPORT TIMES
IMPORT STRFORMAT
IMPORT STRFORMAT
Line 2,598: Line 2,598:
ECHO ""
ECHO ""
PRINTCALENDAR(1969, 5)</lang>
PRINTCALENDAR(1969, 5)</syntaxhighlight>


{{out}}
{{out}}
Line 2,637: Line 2,637:
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.
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.


<lang perl>$PROGRAM = '\'
<syntaxhighlight lang=perl>$PROGRAM = '\'


MY @START_DOW = (3, 6, 6, 2, 4, 0,
MY @START_DOW = (3, 6, 6, 2, 4, 0,
Line 2,680: Line 2,680:
$L = ',' | '@';
$L = ',' | '@';


`${E}${C}${H}${O} $PROGRAM | ${T}${R} A-Z ${A}-${Z} | ${P}${E}${R}${L}`;</lang>
`${E}${C}${H}${O} $PROGRAM | ${T}${R} A-Z ${A}-${Z} | ${P}${E}${R}${L}`;</syntaxhighlight>
Although, if we are abusing the backticks and other innocent programs, why not just: <lang Perl>$_=$ARGV[0]//1969;`\143\141\154 $_ >&2`</lang>
Although, if we are abusing the backticks and other innocent programs, why not just: <syntaxhighlight lang=Perl>$_=$ARGV[0]//1969;`\143\141\154 $_ >&2`</syntaxhighlight>


=={{header|Phix}}==
=={{header|Phix}}==
Line 2,687: Line 2,687:


So, the first task is to take a copy of [[Calendar#Phix|Calendar]] and make it output uppercase. Change the line
So, the first task is to take a copy of [[Calendar#Phix|Calendar]] and make it output uppercase. Change the line
<!--<lang Phix>(phixonline)-->
<!--<syntaxhighlight lang=Phix>(phixonline)-->
<span style="color: #008080;">return</span> <span style="color: #7060A8;">repeat</span><span style="color: #0000FF;">(</span><span style="color: #008000;">' '</span><span style="color: #0000FF;">,</span><span style="color: #000000;">left</span><span style="color: #0000FF;">)&</span><span style="color: #000000;">s</span><span style="color: #0000FF;">&</span><span style="color: #7060A8;">repeat</span><span style="color: #0000FF;">(</span><span style="color: #008000;">' '</span><span style="color: #0000FF;">,</span><span style="color: #000000;">right</span><span style="color: #0000FF;">)</span>
<span style="color: #008080;">return</span> <span style="color: #7060A8;">repeat</span><span style="color: #0000FF;">(</span><span style="color: #008000;">' '</span><span style="color: #0000FF;">,</span><span style="color: #000000;">left</span><span style="color: #0000FF;">)&</span><span style="color: #000000;">s</span><span style="color: #0000FF;">&</span><span style="color: #7060A8;">repeat</span><span style="color: #0000FF;">(</span><span style="color: #008000;">' '</span><span style="color: #0000FF;">,</span><span style="color: #000000;">right</span><span style="color: #0000FF;">)</span>
<!--</lang>-->
<!--</syntaxhighlight>-->
in routine centre to:
in routine centre to:
<!--<lang Phix>(phixonline)-->
<!--<syntaxhighlight lang=Phix>(phixonline)-->
<span style="color: #008080;">return</span> <span style="color: #7060A8;">repeat</span><span style="color: #0000FF;">(</span><span style="color: #008000;">' '</span><span style="color: #0000FF;">,</span><span style="color: #000000;">left</span><span style="color: #0000FF;">)&</span><span style="color: #7060A8;">upper</span><span style="color: #0000FF;">(</span><span style="color: #000000;">s</span><span style="color: #0000FF;">)&</span><span style="color: #7060A8;">repeat</span><span style="color: #0000FF;">(</span><span style="color: #008000;">' '</span><span style="color: #0000FF;">,</span><span style="color: #000000;">right</span><span style="color: #0000FF;">)</span>
<span style="color: #008080;">return</span> <span style="color: #7060A8;">repeat</span><span style="color: #0000FF;">(</span><span style="color: #008000;">' '</span><span style="color: #0000FF;">,</span><span style="color: #000000;">left</span><span style="color: #0000FF;">)&</span><span style="color: #7060A8;">upper</span><span style="color: #0000FF;">(</span><span style="color: #000000;">s</span><span style="color: #0000FF;">)&</span><span style="color: #7060A8;">repeat</span><span style="color: #0000FF;">(</span><span style="color: #008000;">' '</span><span style="color: #0000FF;">,</span><span style="color: #000000;">right</span><span style="color: #0000FF;">)</span>
<!--</lang>-->
<!--</syntaxhighlight>-->
(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>
(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>
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.
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
In psym.e you can find the line
<!--<lang Phix>(phixonline)-->
<!--<syntaxhighlight lang=Phix>(phixonline)-->
<span style="color: #000000;">initialSymEntry</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"integer"</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">S_Type</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"TI"</span><span style="color: #0000FF;">,</span><span style="color: #000000;">opInt</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">E_none</span><span style="color: #0000FF;">)</span> <span style="color: #000080;font-style:italic;">-- #01 / 0b0001 integer</span>
<span style="color: #000000;">initialSymEntry</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"integer"</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">S_Type</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"TI"</span><span style="color: #0000FF;">,</span><span style="color: #000000;">opInt</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">E_none</span><span style="color: #0000FF;">)</span> <span style="color: #000080;font-style:italic;">-- #01 / 0b0001 integer</span>
<!--</lang>-->
<!--</syntaxhighlight>-->
Immediately after that (it should now be there commented out) add:
Immediately after that (it should now be there commented out) add:
<!--<lang Phix>(phixonline)-->
<!--<syntaxhighlight lang=Phix>(phixonline)-->
<span style="color: #000000;">Alias</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"INTEGER"</span><span style="color: #0000FF;">,</span><span style="color: #000000;">symlimit</span><span style="color: #0000FF;">)</span>
<span style="color: #000000;">Alias</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"INTEGER"</span><span style="color: #0000FF;">,</span><span style="color: #000000;">symlimit</span><span style="color: #0000FF;">)</span>
<!--</lang>-->
<!--</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):
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>(phixonline)-->
<!--<syntaxhighlight lang=Phix>(phixonline)-->
<span style="color: #008080;">procedure</span> <span style="color: #000000;">tt_stringA</span><span style="color: #0000FF;">(</span><span style="color: #004080;">sequence</span> <span style="color: #000000;">text</span><span style="color: #0000FF;">,</span> <span style="color: #004080;">integer</span> <span style="color: #000000;">alias</span><span style="color: #0000FF;">)</span>
<span style="color: #008080;">procedure</span> <span style="color: #000000;">tt_stringA</span><span style="color: #0000FF;">(</span><span style="color: #004080;">sequence</span> <span style="color: #000000;">text</span><span style="color: #0000FF;">,</span> <span style="color: #004080;">integer</span> <span style="color: #000000;">alias</span><span style="color: #0000FF;">)</span>
<span style="color: #000000;">tt_string</span><span style="color: #0000FF;">(</span><span style="color: #000000;">text</span><span style="color: #0000FF;">,-</span><span style="color: #000000;">2</span><span style="color: #0000FF;">)</span>
<span style="color: #000000;">tt_string</span><span style="color: #0000FF;">(</span><span style="color: #000000;">text</span><span style="color: #0000FF;">,-</span><span style="color: #000000;">2</span><span style="color: #0000FF;">)</span>
<span style="color: #000000;">tt</span><span style="color: #0000FF;">[</span><span style="color: #000000;">pcurr</span><span style="color: #0000FF;">]</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">alias</span>
<span style="color: #000000;">tt</span><span style="color: #0000FF;">[</span><span style="color: #000000;">pcurr</span><span style="color: #0000FF;">]</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">alias</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">procedure</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">procedure</span>
<!--</lang>-->
<!--</syntaxhighlight>-->
and you can find the line
and you can find the line
<!--<lang Phix>(phixonline)-->
<!--<syntaxhighlight lang=Phix>(phixonline)-->
<span style="color: #008080;">global</span> <span style="color: #008080;">constant</span> <span style="color: #000000;">T_include</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">596</span> <span style="color: #000000;">tt_stringF</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"include"</span><span style="color: #0000FF;">,</span><span style="color: #000000;">T_include</span><span style="color: #0000FF;">)</span>
<span style="color: #008080;">global</span> <span style="color: #008080;">constant</span> <span style="color: #000000;">T_include</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">596</span> <span style="color: #000000;">tt_stringF</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"include"</span><span style="color: #0000FF;">,</span><span style="color: #000000;">T_include</span><span style="color: #0000FF;">)</span>
<!--</lang>-->
<!--</syntaxhighlight>-->
Sometime after that, in fact after the very last use of tt_stringF, add (likewise you should find this one commented out):
Sometime after that, in fact after the very last use of tt_stringF, add (likewise you should find this one commented out):
<!--<lang Phix>(phixonline)-->
<!--<syntaxhighlight lang=Phix>(phixonline)-->
<span style="color: #000000;">tt_stringA</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"INCLUDE"</span><span style="color: #0000FF;">,</span><span style="color: #000000;">T_include</span><span style="color: #0000FF;">)</span>
<span style="color: #000000;">tt_stringA</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"INCLUDE"</span><span style="color: #0000FF;">,</span><span style="color: #000000;">T_include</span><span style="color: #0000FF;">)</span>
<!--</lang>-->
<!--</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).
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).
Line 2,728: Line 2,728:
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
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)
checked is mapped to lower case, ie change (twice)
<!--<lang Phix>(phixonline)-->
<!--<syntaxhighlight lang=Phix>(phixonline)-->
<span style="color: #000000;">Ch</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">find</span><span style="color: #0000FF;">(</span><span style="color: #000000;">Ch</span><span style="color: #0000FF;">,</span><span style="color: #000000;">escchar</span><span style="color: #0000FF;">)</span>
<span style="color: #000000;">Ch</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">find</span><span style="color: #0000FF;">(</span><span style="color: #000000;">Ch</span><span style="color: #0000FF;">,</span><span style="color: #000000;">escchar</span><span style="color: #0000FF;">)</span>
<!--</lang>-->
<!--</syntaxhighlight>-->
to
to
<!--<lang Phix>(phixonline)-->
<!--<syntaxhighlight lang=Phix>(phixonline)-->
<span style="color: #000000;">Ch</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">find</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">lower</span><span style="color: #0000FF;">(</span><span style="color: #000000;">Ch</span><span style="color: #0000FF;">),</span><span style="color: #000000;">escchar</span><span style="color: #0000FF;">)</span>
<span style="color: #000000;">Ch</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">find</span><span style="color: #0000FF;">(</span><span style="color: #7060A8;">lower</span><span style="color: #0000FF;">(</span><span style="color: #000000;">Ch</span><span style="color: #0000FF;">),</span><span style="color: #000000;">escchar</span><span style="color: #0000FF;">)</span>
<!--</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>.
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>.
Line 2,748: Line 2,748:
While PHP functions are case-sensitive (aside of <code>_()</code>), this isn't the case for language constructs.
While PHP functions are case-sensitive (aside of <code>_()</code>), this isn't the case for language constructs.


<lang php><?PHP
<syntaxhighlight lang=php><?PHP
ECHO <<<REALPROGRAMMERSTHINKINUPPERCASEANDCHEATBYUSINGPRINT
ECHO <<<REALPROGRAMMERSTHINKINUPPERCASEANDCHEATBYUSINGPRINT
JANUARY FEBRUARY MARCH APRIL MAY JUNE
JANUARY FEBRUARY MARCH APRIL MAY JUNE
Line 2,767: Line 2,767:
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
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
REALPROGRAMMERSTHINKINUPPERCASEANDCHEATBYUSINGPRINT
; // MAGICAL SEMICOLON</lang>
; // MAGICAL SEMICOLON</syntaxhighlight>


=={{header|PicoLisp}}==
=={{header|PicoLisp}}==
The "CALENDAR.L" source file:
The "CALENDAR.L" source file:
<lang PicoLisp>(DE CAL (YEAR)
<syntaxhighlight lang=PicoLisp>(DE CAL (YEAR)
(PRINL "====== " YEAR " ======")
(PRINL "====== " YEAR " ======")
(FOR DAT (RANGE (DATE YEAR 1 1) (DATE YEAR 12 31))
(FOR DAT (RANGE (DATE YEAR 1 1) (DATE YEAR 12 31))
Line 2,784: Line 2,784:


(CAL 1969)
(CAL 1969)
(BYE)</lang>
(BYE)</syntaxhighlight>
Then it can be executed with this command line:
Then it can be executed with this command line:
<pre>$ pil -'load (list "awk" "{print tolower($0)}" "CALENDAR.L")'</pre>
<pre>$ pil -'load (list "awk" "{print tolower($0)}" "CALENDAR.L")'</pre>
Line 2,814: Line 2,814:


=={{header|PL/I}}==
=={{header|PL/I}}==
<lang PL/I>(SUBRG, SIZE, FOFL):
<syntaxhighlight lang=PL/I>(SUBRG, SIZE, FOFL):
CALENDAR: PROCEDURE (YEAR) OPTIONS (MAIN);
CALENDAR: PROCEDURE (YEAR) OPTIONS (MAIN);
DECLARE YEAR CHARACTER (4) VARYING;
DECLARE YEAR CHARACTER (4) VARYING;
Line 2,865: Line 2,865:
END PREPARE_MONTH;
END PREPARE_MONTH;


END CALENDAR;</lang>
END CALENDAR;</syntaxhighlight>
See CALENDAR for result.
See CALENDAR for result.


=={{header|Racket}}==
=={{header|Racket}}==
<lang racket>
<syntaxhighlight lang=racket>
#CI(MODULE NAME-OF-THIS-FILE RACKET
#CI(MODULE NAME-OF-THIS-FILE RACKET
(REQUIRE RACKET/DATE)
(REQUIRE RACKET/DATE)
Line 2,905: Line 2,905:


(CALENDAR 1969))
(CALENDAR 1969))
</syntaxhighlight>
</lang>


=={{header|Raku}}==
=={{header|Raku}}==
Line 2,911: Line 2,911:
Uppercase is no challenge, who needs letters at all?
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.]
[Requires the year to be supplied as a command-line argument, and Unixish <i>cal</i> command.]
<lang perl6>$_="\0".."~";<
<syntaxhighlight lang=raku line>$_="\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
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
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]"()</lang>
>."$_[99]$_[104]$_[114]$_[115]"()."$_[69]$_[86]$_[65]$_[76]"()</syntaxhighlight>


=={{header|REXX}}==
=={{header|REXX}}==
Line 2,937: Line 2,937:
(but the second REXX version sure as heck looks
(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).
<br>like it was beat with a big ole ugly stick ─── and pardon the strong language).
<lang rexx>/*REXX PROGRAM TO SHOW ANY YEAR'S (MONTHLY) CALENDAR (WITH/WITHOUT GRID)*/
<syntaxhighlight lang=rexx>/*REXX PROGRAM TO SHOW ANY YEAR'S (MONTHLY) CALENDAR (WITH/WITHOUT GRID)*/
@ABC=
@ABC=
PARSE VALUE SCRSIZE() WITH SD SW .
PARSE VALUE SCRSIZE() WITH SD SW .
Line 3,109: Line 3,109:
PUT:_=ARG(1);_=TRANSLATE(_,,'_'CHK);IF \GRID THEN _=UNGRID(_);IF LOWERCASE THEN _=LOWER(_);IF UPPERCASE THEN UPPER _;IF SHORTEST&_=' ' THEN RETURN;CALL TELL _;RETURN
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
TELL:SAY ARG(1);RETURN
UNGRID:RETURN TRANSLATE(ARG(1),,"│║─═┤┐└┴┬├┼┘┌╔╗╚╝╟╢╞╡╫╪╤╧╥╨╠╣")</lang>
UNGRID:RETURN TRANSLATE(ARG(1),,"│║─═┤┐└┴┬├┼┘┌╔╗╚╝╟╢╞╡╫╪╤╧╥╨╠╣")</syntaxhighlight>
Programming note: &nbsp; This REXX program makes use of &nbsp; '''SCRSIZE''' &nbsp; REXX program (or
Programming note: &nbsp; This REXX program makes use of &nbsp; '''SCRSIZE''' &nbsp; REXX program (or
BIF) which is used to determine the screen
BIF) which is used to determine the screen
Line 3,218: Line 3,218:


=={{header|Ring}}==
=={{header|Ring}}==
<lang ring>
<syntaxhighlight lang=ring>
# PROJECT : CALENDAR - FOR "REAL" PROGRAMMERS
# PROJECT : CALENDAR - FOR "REAL" PROGRAMMERS
# DATE : 2018/06/28
# DATE : 2018/06/28
Line 3,377: Line 3,377:
NEXT
NEXT
NEXT
NEXT
</syntaxhighlight>
</lang>
Output:
Output:


Line 3,388: Line 3,388:


* <code>loadup.rb</code> is the program loader.
* <code>loadup.rb</code> is the program loader.
<lang ruby># loadup.rb - run UPPERCASE RUBY program
<syntaxhighlight lang=ruby># loadup.rb - run UPPERCASE RUBY program


class Object
class Object
Line 3,413: Line 3,413:
_PROGRAM = ARGV.SHIFT
_PROGRAM = ARGV.SHIFT
_PROGRAM || ABORT("USAGE: #{$0} PROGRAM.RB ARGS...")
_PROGRAM || ABORT("USAGE: #{$0} PROGRAM.RB ARGS...")
LOAD($0 = _PROGRAM)</lang>
LOAD($0 = _PROGRAM)</syntaxhighlight>


* <code>CAL.RB</code> is an UPPERCASE RUBY translation of [[Calendar#Ruby]].
* <code>CAL.RB</code> is an UPPERCASE RUBY translation of [[Calendar#Ruby]].
{{works with|Ruby|1.8.7}}
{{works with|Ruby|1.8.7}}
<lang ruby># CAL.RB - CALENDAR
<syntaxhighlight lang=ruby># CAL.RB - CALENDAR
REQUIRE 'DATE'.DOWNCASE
REQUIRE 'DATE'.DOWNCASE


Line 3,500: Line 3,500:
PROC {80}) }) })
PROC {80}) }) })


PUTS CAL(ARGV[0].TO_I, _COLUMNS)</lang>
PUTS CAL(ARGV[0].TO_I, _COLUMNS)</syntaxhighlight>


* A local variable must start with a lowercase letter or an underscore, so we have many leading underscores (_YEAR, _COLUMN, _DATE and so on).
* 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,585: Line 3,585:


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]:
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]:
<lang seed7>$ include "seed7_05.s7i";
<syntaxhighlight lang=seed7>$ include "seed7_05.s7i";
include "getf.s7i";
include "getf.s7i";
include "progs.s7i";
include "progs.s7i";
Line 3,597: Line 3,597:
source := replace(source, "daysinmonth", "daysInMonth");
source := replace(source, "daysinmonth", "daysInMonth");
execute(parseStri(source));
execute(parseStri(source));
end func;</lang>
end func;</syntaxhighlight>


{{out}}
{{out}}
Line 3,640: Line 3,640:


=={{header|Sidef}}==
=={{header|Sidef}}==
<lang ruby>-> DT { ('DATE'.("\LWC") + 'TIME'.("\LWC")).("\LREQUIRE") }
<syntaxhighlight lang=ruby>-> DT { ('DATE'.("\LWC") + 'TIME'.("\LWC")).("\LREQUIRE") }


-> MONTHS_PER_COL { 6 }
-> MONTHS_PER_COL { 6 }
Line 3,698: Line 3,698:
}
}


FMT_YEAR(ARGV ? ARGV[0].("\LTO_I") : 1969).("\LPRINT")</lang>
FMT_YEAR(ARGV ? ARGV[0].("\LTO_I") : 1969).("\LPRINT")</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Line 3,722: Line 3,722:
The program starts implementing aliases for all built-in commands. This is done without using any letters at all ;).
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.
CALENDER takes arguments of year and optional terminal width to use.
<lang tcl>
<syntaxhighlight lang=tcl>
\146\157\162\145\141\143\150 42 [\151\156\146\157 \143\157\155\155\141\156\144\163] {
\146\157\162\145\141\143\150 42 [\151\156\146\157 \143\157\155\155\141\156\144\163] {
\145\166\141\154 "
\145\166\141\154 "
Line 3,771: Line 3,771:
CALENDAR
CALENDAR
</syntaxhighlight>
</lang>
{{out}}
{{out}}
<pre>
<pre>
Line 3,812: Line 3,812:


=={{header|UNIX Shell}}==
=={{header|UNIX Shell}}==
<lang shell>CAL=CAL
<syntaxhighlight lang=shell>CAL=CAL
TR=TR
TR=TR
A=A
A=A
Z=Z
Z=Z
LANG=C ${CAL,,} 1969 | ${TR,,} ${A,}-${Z,} A-Z</lang>
LANG=C ${CAL,,} 1969 | ${TR,,} ${A,}-${Z,} A-Z</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>
Line 3,861: Line 3,861:
Vedit macro language is case insensitive, but it is normal practice to write short commands in upper case.
Vedit macro language is case insensitive, but it is normal practice to write short commands in upper case.


<lang vedit>BS(BF)
<syntaxhighlight lang=vedit>BS(BF)
CFT(22)
CFT(22)
#3 = 6 // NUMBER OF MONTHS PER LINE
#3 = 6 // NUMBER OF MONTHS PER LINE
Line 3,925: Line 3,925:
REG_EMPTY(#20)
REG_EMPTY(#20)
NUM_POP(4,20)
NUM_POP(4,20)
RETURN </lang>
RETURN </syntaxhighlight>


<pre>
<pre>
Line 3,958: Line 3,958:
Copied from [[Calendar#Visual_Basic_.NET]] and converted to uppercase. See entry there for description.
Copied from [[Calendar#Visual_Basic_.NET]] and converted to uppercase. See entry there for description.


<lang vbnet>OPTION COMPARE BINARY
<syntaxhighlight lang=vbnet>OPTION COMPARE BINARY
OPTION EXPLICIT ON
OPTION EXPLICIT ON
OPTION INFER ON
OPTION INFER ON
Line 4,288: Line 4,288:
RETURN S.PADLEFT(((TOTALWIDTH - S.LENGTH) \ 2) + S.LENGTH, PADDINGCHAR).PADRIGHT(TOTALWIDTH, PADDINGCHAR)
RETURN S.PADLEFT(((TOTALWIDTH - S.LENGTH) \ 2) + S.LENGTH, PADDINGCHAR).PADRIGHT(TOTALWIDTH, PADDINGCHAR)
END FUNCTION
END FUNCTION
END MODULE</lang>
END MODULE</syntaxhighlight>


{{out|input=COLS:132 ROWS:25 MS/ROW:6 HSTRETCH:FALSE VSTRETCH:FALSE}}
{{out|input=COLS:132 ROWS:25 MS/ROW:6 HSTRETCH:FALSE VSTRETCH:FALSE}}
Line 4,324: Line 4,324:
{{libheader|Wren-fmt}}
{{libheader|Wren-fmt}}
{{libheader|Wren-seq}}
{{libheader|Wren-seq}}
<lang ecmascript>IMPORT "/DATE" FOR DATE
<syntaxhighlight lang=ecmascript>IMPORT "/DATE" FOR DATE
IMPORT "/FMT" FOR FMT
IMPORT "/FMT" FOR FMT
IMPORT "/SEQ" FOR LST
IMPORT "/SEQ" FOR LST
Line 4,371: Line 4,371:
}
}


CALENDAR.CALL(1969)</lang>
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:
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}}
{{libheader|Wren-str}}
<lang ecmascript>import "io" for File
<syntaxhighlight lang=ecmascript>import "io" for File
import "/str" for Str
import "/str" for Str
import "meta" for Meta
import "meta" for Meta
Line 4,393: Line 4,393:
for (format in formats) text = text.replace(Str.upper(format), format)
for (format in formats) text = text.replace(Str.upper(format), format)


Meta.compile(text).call()</lang>
Meta.compile(text).call()</syntaxhighlight>


{{out}}
{{out}}
Line 4,440: Line 4,440:
ASSEMBLE WITH: TASM CALENDAR; TLINK /t CALENDAR
ASSEMBLE WITH: TASM CALENDAR; TLINK /t CALENDAR


<lang asm> .MODEL TINY
<syntaxhighlight lang=asm> .MODEL TINY
.CODE
.CODE
.486
.486
Line 4,626: Line 4,626:
DAYS DB 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
DAYS DB 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
DAY DB ?, ?, ?, ?, ?, ?
DAY DB ?, ?, ?, ?, ?, ?
END START</lang>
END START</syntaxhighlight>


{{Out}}
{{Out}}
Line 4,654: Line 4,654:
=={{header|XLISP}}==
=={{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".
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".
<lang lisp>(SETQ YR 1969)
<syntaxhighlight lang=lisp>(SETQ YR 1969)
(SETQ M #("JANUARY" "FEBRUARY" "MARCH" "APRIL" "MAY" "JUNE" "JULY" "AUGUST" "SEPTEMBER" "OCTOBER" "NOVEMBER" "DECEMBER"))
(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))
(SETQ ML #(31 28 31 30 31 30 31 31 30 31 30 31))
Line 4,689: Line 4,689:
(SETQ D (+ D 1))
(SETQ D (+ D 1))
(IF (> D 6) (TERPRI))
(IF (> D 6) (TERPRI))
(IF (> D 6) (SETQ D 0))))</lang>
(IF (> D 6) (SETQ D 0))))</syntaxhighlight>
{{out}}
{{out}}
<pre> SNOOPY CALENDAR 1969
<pre> SNOOPY CALENDAR 1969
Line 4,787: Line 4,787:


The calendar code, file UPCAL.zkl (upper cased version of [[Calendar#zkl]]):
The calendar code, file UPCAL.zkl (upper cased version of [[Calendar#zkl]]):
<lang zkl>VAR [CONST] D=TIME.DATE, DAYS="SU MO TU WE TH FR SA";
<syntaxhighlight 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) }
FCN CENTER(TEXT,M) { STRING(" "*((M-TEXT.LEN())/2),TEXT) }
Line 4,798: Line 4,798:
.PUMP(LIST,T(VOID.READ,DAYS.LEN()/3,FALSE),STRING.CREATE));
.PUMP(LIST,T(VOID.READ,DAYS.LEN()/3,FALSE),STRING.CREATE));
}
}
...</lang>
...</syntaxhighlight>
And the pre-processor, hand rolled for the above code (file bbb.zkl):
And the pre-processor, hand rolled for the above code (file bbb.zkl):
<lang zkl>code:=File(vm.arglist[0]).read();
<syntaxhighlight lang=zkl>code:=File(vm.arglist[0]).read();
code=Data(Void,code.text.toLower());
code=Data(Void,code.text.toLower());
mixed:=T("string","String", "list","List", " t("," T(",",t(",",T(",
mixed:=T("string","String", "list","List", " t("," T(",",t(",",T(",
Line 4,810: Line 4,810:
);
);
mixed.pump(Void,Void.Read,'wrap(up,down){ code.replace(up,down) });
mixed.pump(Void,Void.Read,'wrap(up,down){ code.replace(up,down) });
Compiler.Compiler.compileText(code)();</lang>
Compiler.Compiler.compileText(code)();</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>