Calendar - for "REAL" programmers: Difference between revisions

m
syntax highlighting fixup automation
m (syntax highlighting fixup automation)
Line 37:
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 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]]:
 
<langsyntaxhighlight lang=Ada>WITH PRINTABLE_CALENDAR;
 
PROCEDURE REAL_CAL IS
Line 263:
C.NEW_LINE;
C.PRINT(1969, "NINETEEN-SIXTY-NINE");
END REAL_CAL;</langsyntaxhighlight>
 
{{out}}
Line 296:
 
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:
LINE PRINTER WIDTH = 132; # AS AT 1969! #
PRINT CALENDAR(MANKIND STEPPED ON THE MOON, LINE PRINTER WIDTH)
'END'</langsyntaxhighlight>
{{out}}
<pre>
Line 428:
 
=={{header|AutoHotkey}}==
<langsyntaxhighlight lang=AutoHotkey>CALENDAR(YR){
LASTDAY := [], DAY := []
TITLES =
Line 466:
STRINGREPLACE, RES, RES,%A_SPACE%0,%A_SPACE%%A_SPACE%, ALL
RETURN RES
}</langsyntaxhighlight>
Examples:<langsyntaxhighlight lang=AutoHotkey>EXAMPLES:
GUI, FONT,S8, COURIER
GUI, ADD, EDIT, VYR W40 R1 LIMIT4 NUMBER, 1969
Line 482:
GUICLOSE:
EXITAPP
RETURN</langsyntaxhighlight>
{{out}}
<pre> 1969
Line 525:
=={{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:
PRINT D;
NEXT
NEXT</langsyntaxhighlight>
 
{{out}}
Line 582:
=={{header|BBC BASIC}}==
{{works with|BBC BASIC for Windows}}
<langsyntaxhighlight lang=bbcbasic> VDU 23,22,1056;336;8,16,16,128
YEAR = 1969
Line 628:
WHEN 4,6,9,11: = 30
OTHERWISE = 31
ENDCASE</langsyntaxhighlight>
{{out}}
<pre>
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
</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 835:
}
RETURN RESULT;
}</langsyntaxhighlight>
 
=={{header|COBOL}}==
Line 842:
 
=={{header|Common Lisp}}==
<langsyntaxhighlight lang=lisp>(QL:QUICKLOAD '(DATE-CALC))
 
(DEFPARAMETER *DAY-ROW* "SU MO TU WE TH FR SA")
Line 916:
(LAMBDA (&REST HEADS)
(FORMAT T FORMAT-STRING HEADS))
ROW))))</langsyntaxhighlight>
{{out}}
<pre>CL-USER> (PRINT-CALENDAR 1969)
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>):
<langsyntaxhighlight lang=d>import std.string;mixin(import("CALENDAR").toLower);void main(){}</langsyntaxhighlight>
{{out}}
<pre> [Snoopy Picture]
Line 1,055:
=={{header|Elena}}==
ELENA 5.0 :
<langsyntaxhighlight lang=elena>import system'text;
import system'routines;
import system'calendar;
Line 1,215:
console.readChar()
}</langsyntaxhighlight>
{{out}}
<pre>
Line 1,257:
=={{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:
<langsyntaxhighlight lang=FORTRAN>
MODULE DATEGNASH
 
Line 1,433:
END DO
END
</syntaxhighlight>
</lang>
 
And for output, the wide form:
Line 1,458:
 
=={{header|FreeBASIC}}==
<langsyntaxhighlight lang=freebasic>' VERSION 16-03-2016
' COMPILE WITH: FBC -S CONSOLE
 
Line 1,554:
PRINT : PRINT "HIT ANY KEY TO END PROGRAM"
SLEEP
END</langsyntaxhighlight>
{{out}}
<pre> INSERT YOUR SNOOPY PICTURE HERE
Line 1,584:
 
This is realcal_UC.txt:
<langsyntaxhighlight lang=go>PACKAGE MAIN
IMPORT (
Line 1,654:
FMT.PRINTLN()
}
}</langsyntaxhighlight>
 
and this is realcal.go:
<langsyntaxhighlight lang=go>package main
 
import (
Line 1,696:
cmd.Stderr = os.Stderr
check(cmd.Run())
}</langsyntaxhighlight>
 
which produces (as expected) this output:
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.
 
<langsyntaxhighlight lang=guiss>RIGHTCLICK:CLOCK,ADJUST DATE AND TIME,BUTTON:CANCEL</langsyntaxhighlight>
 
=={{header|Icon}} and {{header|Unicon}}==
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.
 
<langsyntaxhighlight lang=Unicon>$include "REALIZE.ICN"
 
LINK DATETIME
Line 1,816:
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 lang=Icon>$define PROCEDURE procedure
$define END end
$define WRITE write
Line 1,846:
$define BY by
$define DATETIME datetime
$define RETURN return</langsyntaxhighlight>
 
{{libheader|Icon Programming Library}}
Line 1,854:
For added "real"ness, we also only use 1 character names:
 
<langsyntaxhighlight lang=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,863:
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,885:
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,907:
│ │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).
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.
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,972:
 
RUNUPPERCASECODE(CODE)
</langsyntaxhighlight> {{output}} <pre>
1969
JANUARY FEBRUARY MARCH APRIL MAY JUNE
Line 2,004:
This is calendar_UC.txt:
 
<langsyntaxhighlight lang=scala>IMPORT JAVA.TEXT.*
IMPORT JAVA.UTIL.*
IMPORT JAVA.IO.PRINTSTREAM
Line 2,055:
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,142:
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,197:
fun main(args: Array<String>) {
System.out.PRINTCALENDAR(1969, 3, Locale.US)
}</langsyntaxhighlight>
 
which when compiled and run produces output of:
Line 2,249:
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,312:
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,368:
Console 132 characters by 43 lines. Six columns for months.
 
<langsyntaxhighlight lang=M2000 Interpreter>
\\ Calendar - for "REAL" programmers
\\ All statements in UPPERCASE
Line 2,516:
END WHILE
RETURN
</syntaxhighlight>
</lang>
 
=={{header|Nim}}==
Line 2,527:
Here is the helper program:
 
<syntaxhighlight lang=text>import strutils
 
const progUpper = staticRead("calendar_upper.txt")
Line 2,557:
static: writeFile("calendar_transformed.nim", prog)
 
include "calendar_transformed.nim"</langsyntaxhighlight>
 
Here is the actual program in uppercase.
 
<syntaxhighlight lang=text>IMPORT TIMES
IMPORT STRFORMAT
Line 2,598:
ECHO ""
PRINTCALENDAR(1969, 5)</langsyntaxhighlight>
 
{{out}}
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.
 
<langsyntaxhighlight lang=perl>$PROGRAM = '\'
 
MY @START_DOW = (3, 6, 6, 2, 4, 0,
Line 2,680:
$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 lang=Perl>$_=$ARGV[0]//1969;`\143\141\154 $_ >&2`</langsyntaxhighlight>
 
=={{header|Phix}}==
Line 2,687:
 
So, the first task is to take a copy of [[Calendar#Phix|Calendar]] and make it output uppercase. Change the line
<!--<langsyntaxhighlight 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>
<!--</langsyntaxhighlight>-->
in routine centre to:
<!--<langsyntaxhighlight 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>
<!--</langsyntaxhighlight>-->
(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.
 
In psym.e you can find the line
<!--<langsyntaxhighlight 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>
<!--</langsyntaxhighlight>-->
Immediately after that (it should now be there commented out) add:
<!--<langsyntaxhighlight 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>
<!--</langsyntaxhighlight>-->
 
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):
<!--<langsyntaxhighlight 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: #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: #008080;">end</span> <span style="color: #008080;">procedure</span>
<!--</langsyntaxhighlight>-->
and you can find the line
<!--<langsyntaxhighlight 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>
<!--</langsyntaxhighlight>-->
Sometime after that, in fact after the very last use of tt_stringF, add (likewise you should find this one commented out):
<!--<langsyntaxhighlight 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>
<!--</langsyntaxhighlight>-->
 
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:
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)
<!--<langsyntaxhighlight 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>
<!--</langsyntaxhighlight>-->
to
<!--<langsyntaxhighlight 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>
<!--</langsyntaxhighlight>-->
 
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:
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,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
REALPROGRAMMERSTHINKINUPPERCASEANDCHEATBYUSINGPRINT
; // MAGICAL SEMICOLON</langsyntaxhighlight>
 
=={{header|PicoLisp}}==
The "CALENDAR.L" source file:
<langsyntaxhighlight lang=PicoLisp>(DE CAL (YEAR)
(PRINL "====== " YEAR " ======")
(FOR DAT (RANGE (DATE YEAR 1 1) (DATE YEAR 12 31))
Line 2,784:
 
(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,814:
 
=={{header|PL/I}}==
<langsyntaxhighlight lang=PL/I>(SUBRG, SIZE, FOFL):
CALENDAR: PROCEDURE (YEAR) OPTIONS (MAIN);
DECLARE YEAR CHARACTER (4) VARYING;
Line 2,865:
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,905:
 
(CALENDAR 1969))
</syntaxhighlight>
</lang>
 
=={{header|Raku}}==
Line 2,911:
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}}==
Line 2,937:
(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 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
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,218:
 
=={{header|Ring}}==
<langsyntaxhighlight lang=ring>
# PROJECT : CALENDAR - FOR "REAL" PROGRAMMERS
# DATE : 2018/06/28
Line 3,377:
NEXT
NEXT
</syntaxhighlight>
</lang>
Output:
 
Line 3,388:
 
* <code>loadup.rb</code> is the program loader.
<langsyntaxhighlight lang=ruby># loadup.rb - run UPPERCASE RUBY program
 
class Object
Line 3,413:
_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,500:
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,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]:
<langsyntaxhighlight lang=seed7>$ include "seed7_05.s7i";
include "getf.s7i";
include "progs.s7i";
Line 3,597:
source := replace(source, "daysinmonth", "daysInMonth");
execute(parseStri(source));
end func;</langsyntaxhighlight>
 
{{out}}
Line 3,640:
 
=={{header|Sidef}}==
<langsyntaxhighlight lang=ruby>-> DT { ('DATE'.("\LWC") + 'TIME'.("\LWC")).("\LREQUIRE") }
 
-> MONTHS_PER_COL { 6 }
Line 3,698:
}
 
FMT_YEAR(ARGV ? ARGV[0].("\LTO_I") : 1969).("\LPRINT")</langsyntaxhighlight>
{{out}}
<pre>
Line 3,722:
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,771:
CALENDAR
</syntaxhighlight>
</lang>
{{out}}
<pre>
Line 3,812:
 
=={{header|UNIX Shell}}==
<langsyntaxhighlight lang=shell>CAL=CAL
TR=TR
A=A
Z=Z
LANG=C ${CAL,,} 1969 | ${TR,,} ${A,}-${Z,} A-Z</langsyntaxhighlight>
{{out}}
<pre>
Line 3,861:
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,925:
REG_EMPTY(#20)
NUM_POP(4,20)
RETURN </langsyntaxhighlight>
 
<pre>
Line 3,958:
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,288:
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,324:
{{libheader|Wren-fmt}}
{{libheader|Wren-seq}}
<langsyntaxhighlight lang=ecmascript>IMPORT "/DATE" FOR DATE
IMPORT "/FMT" FOR FMT
IMPORT "/SEQ" FOR LST
Line 4,371:
}
 
CALENDAR.CALL(1969)</langsyntaxhighlight>
 
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}}
<langsyntaxhighlight lang=ecmascript>import "io" for File
import "/str" for Str
import "meta" for Meta
Line 4,393:
for (format in formats) text = text.replace(Str.upper(format), format)
 
Meta.compile(text).call()</langsyntaxhighlight>
 
{{out}}
Line 4,440:
ASSEMBLE WITH: TASM CALENDAR; TLINK /t CALENDAR
 
<langsyntaxhighlight lang=asm> .MODEL TINY
.CODE
.486
Line 4,626:
DAYS DB 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
DAY DB ?, ?, ?, ?, ?, ?
END START</langsyntaxhighlight>
 
{{Out}}
Line 4,654:
=={{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,689:
(SETQ D (+ D 1))
(IF (> D 6) (TERPRI))
(IF (> D 6) (SETQ D 0))))</langsyntaxhighlight>
{{out}}
<pre> SNOOPY CALENDAR 1969
Line 4,787:
 
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,798:
.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,810:
);
mixed.pump(Void,Void.Read,'wrap(up,down){ code.replace(up,down) });
Compiler.Compiler.compileText(code)();</langsyntaxhighlight>
{{out}}
<pre>
10,327

edits