Calendar - for "REAL" programmers: Difference between revisions

Content added Content deleted
m (→‎{{header|REXX}}: re-did the section header comments, change output templete, removed extra blank lines. -- ~~~~)
Line 496: Line 496:


=={{header|REXX}}==
=={{header|REXX}}==
This is essentially the same REXX program as for the CALENDAR task, but written entirely
This is essentially the same REXX program as for the CALENDAR task, but written entirely in uppercase. Indeed,
<br>in uppercase. Indeed, it could be written without any Latin (or any language) letters
<br>it could be written without any Latin (or any language) letters of any kind for the REXX program's variables.
<br><br>From the task's description, I took it to mean the program was to be in all uppercase, but the output was
<br>of any kind for the REXX program's variables.
<br>still supposed to look pretty (that is, partly in lowercase). Even so, on the (line) printers that were used
<br><br>From the task's description, I took it to mean the program was to be in all uppercase, but
<br>long ago, the printers (if not supporting lowercase), would print lowercase as uppercase (with the FOLD option).
<br>the output was still supposed to look pretty. Even so, on the printers that I grew up on,
<br><br>The other REXX program made use of lowercase letters for determining the minimum length of any of the options
<br>the printers (if not supporting lowercase), would print lowercase as uppercase (the FOLD option).
<br>(from the command line), and a few simple tricks were used to accomplish this.
<br><br>The other REXX program made use of lowercase letters for determining the minimum length of
<br>any of the options (from the command line), and a few stupid tricks were used to accomplish this.
<br>[Note: the command line may also be all uppercase.]
<br>[Note: the command line may also be all uppercase.]
<br>In any case, both versions of the programs' output are identical (but the second REXX program
<br><br>In any case, both versions of the programs' output are identical (but the second REXX version sure as heck looks
<br>sure as heck looks it was beat with an 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)*/
<lang rexx>
/*REXX PROGRAM TO SHOW ANY YEAR'S (MONTHLY) CALENDAR (WITH/WITHOUT GRID)*/

@ABC=
@ABC=
DO J=0 TO 255;_=D2C(J);IF DATATYPE(_,'L') THEN @ABC=@ABC||_;END
DO J=0 TO 255;_=D2C(J);IF DATATYPE(_,'L') THEN @ABC=@ABC||_;END
Line 678: Line 675:
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),,"│║─═┤┐└┴┬├┼┘┌╔╗╚╝╟╢╞╡╫╪╤╧╥╨╠╣")
UNGRID:RETURN TRANSLATE(ARG(1),,"│║─═┤┐└┴┬├┼┘┌╔╗╚╝╟╢╞╡╫╪╤╧╥╨╠╣")</lang>
'''output''' when using the input of: <tt> 1/1/1969 (noGrid shortest narrowest)
</lang>
Output when using the input of: <tt> 1/1/1969 (noGrid shortest narrowest)
<pre style="height:40ex;overflow:scroll">
<pre style="height:40ex;overflow:scroll">
«Snoopy "picture" here»
«Snoopy "picture" here»