Anonymous user
Calendar - for "REAL" programmers: Difference between revisions
Calendar - for "REAL" programmers (view source)
Revision as of 19:42, 14 September 2019
, 4 years ago→{{header|REXX}}: added support for determining width and depth, showed a calendar with a grid, used a smaller font size for the outputs.
m (→{{header|REXX}}: replaced the OUT template that replaced the original OUT with text. Also, reduced the output font size.) |
m (→{{header|REXX}}: added support for determining width and depth, showed a calendar with a grid, used a smaller font size for the outputs.) |
||
Line 2,766:
(from the command line), and a few simple tricks were used to accomplish this.
<br>[Note: the command line may also be all uppercase.]
This version automatically will use the depth and width of the terminal screen to determine which layout fits best.
<br>However, the depth and width can be overridden with the '''depth''' and '''width''' keywords.
In any case, both versions of the programs' output are identical
Line 2,772 ⟶ 2,775:
<lang rexx>/*REXX PROGRAM TO SHOW ANY YEAR'S (MONTHLY) CALENDAR (WITH/WITHOUT GRID)*/
@ABC=
PARSE VALUE SCRSIZE() WITH SD SW .
DO J=0 TO 255;_=D2C(J);IF DATATYPE(_,'L') THEN @ABC=@ABC||_;END
@ABCU=@ABC; UPPER @ABCU
Line 2,786 ⟶ 2,790:
END
CALFILL=' '; MC=12; _='1 3 1234567890' "FB"X
PARSE VAR _ GRID CALSPACES # CHK . CV_ DAYS.1 DAYS.2 DAYS.3 DAYSN
_=0; PARSE VAR _ COLS 1 JD 1 LOWERCASE 1 MAXKALPUTS 1 NARROW 1,
NARROWER 1 NARROWEST 1 SHORT 1 SHORTER 1 SHORTEST 1,
Line 2,829 ⟶ 2,833:
END /*DO WHILE OPTS\== ...*/
IF SD==0 THEN SD= 43; SD= SD-3
IF SW==0 THEN SW= 80; SW= SW-1
MC=INT(MC,'MONTHSCALENDER'); IF MC>0 THEN CAL=1
DAYS=' 'DAYS; MONTHS=' 'MONTHS
CYYYY=RIGHT(DATE(),4); HYY=LEFT(CYYYY,2); LYY=RIGHT(CYYYY,2)
DY.=31; _=30; PARSE VAR _ DY.4 1 DY.6 1 DY.9 1 DY.11; DY.2=28+LY(YYYY)
YY=RIGHT(YYYY,2);
IF SMALL THEN DO; NARROW=1 ; SHORT=1 ; END
IF SMALLER THEN DO; NARROWER=1 ; SHORTER=1 ; END
Line 2,940 ⟶ 2,946:
TELL:SAY ARG(1);RETURN
UNGRID:RETURN TRANSLATE(ARG(1),,"│║─═┤┐└┴┬├┼┘┌╔╗╚╝╟╢╞╡╫╪╤╧╥╨╠╣")</lang>
BIF) which is used to determine the screen
<br>width and depth of the terminal (console). Some REXXes don't
have this BIF.
here ───► [[SCRSIZE.REX]].
{{out|output|text= when using the input of: <tt> 1/1/1969 (NOGRID SHORTER NARROWER) </tt>}}
(Shown at <big>'''<sup>2</sup>/<sub>3</sub>'''</big> size.)
<pre style="font-size:67%">
January 1969 February 1969 March 1969 April 1969
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 1 1 1 2 3 4 5
5 6 7 8 9 10 11 2 3 4 5 6 7 8 2 3 4 5 6 7 8 6 7 8 9 10 11 12
12 13 14 15 16 17 18 9 10 11 12 13 14 15 9 10 11 12 13 14 15 13 14 15 16 17 18 19
19 20 21 22 23 24 25 16 17 18 19 20 21 22 16 17 18 19 20 21 22 20 21 22 23 24 25 26
26 27 28 29 30 31 23 24 25 26 27 28 23 24 25 26 27 28 29 27 28 29 30
30 31
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 6 7 8 9 10
11 12 13 14 15 16 17 15 16 17 18 19 20 21
18 19 20 21 22 23 24 22 23 24 25 26 27 28
25 26 27 28 29 30 31 29 30
Su Mo Tu We Th Fr Sa
1 2 3 4 5 6
7 8 9 10 11 12 13
28 29 30 26 27 28 29 30 31 23 24 25 26 27 28 29 28 29 30 31
</pre>
{{out|output|text= when using the input of: <tt> 1/1/1969 (SHORTER NARROWER) </tt>}}
(Shown at <big>'''<sup>2</sup>/<sub>3</sub>'''</big> size.)
<pre style="font-size:67%">
«Snoopy "picture" here»
┌──────────────────────────────────┐ ┌──────────────────────────────────┐ ┌──────────────────────────────────┐ ┌──────────────────────────────────┐
│ │ │ │ │ │ │ │
│ January 1969 │ │ February 1969 │ │ March 1969 │ │ April 1969 │
│ │ │ │ │ │ │ │
│ Sun Mon Tue Wed Thu Fri Sat│ │ Sun Mon Tue Wed Thu Fri Sat│ │ Sun Mon Tue Wed Thu Fri Sat│ │ Sun Mon Tue Wed Thu Fri Sat│
├────┬────┬────┬────┬────┬────┬────┤ ├────┬────┬────┬────┬────┬────┬────┤ ├────┬────┬────┬────┬────┬────┬────┤ ├────┬────┬────┬────┬────┬────┬────┤
│ │ │ │ 1 │ 2 │ 3 │ 4 │ │ │ │ │ │ │ │ 1 │ │ │ │ │ │ │ │ 1 │ │ │ │ 1 │ 2 │ 3 │ 4 │ 5 │
├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤
│ 5 │ 6 │ 7 │ 8 │ 9 │ 10 │ 11 │ │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ │ 6 │ 7 │ 8 │ 9 │ 10 │ 11 │ 12 │
├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤
│ 12 │ 13 │ 14 │ 15 │ 16 │ 17 │ 18 │ │ 9 │ 10 │ 11 │ 12 │ 13 │ 14 │ 15 │ │ 9 │ 10 │ 11 │ 12 │ 13 │ 14 │ 15 │ │ 13 │ 14 │ 15 │ 16 │ 17 │ 18 │ 19 │
├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤
│ 19 │ 20 │ 21 │ 22 │ 23 │ 24 │ 25 │ │ 16 │ 17 │ 18 │ 19 │ 20 │ 21 │ 22 │ │ 16 │ 17 │ 18 │ 19 │ 20 │ 21 │ 22 │ │ 20 │ 21 │ 22 │ 23 │ 24 │ 25 │ 26 │
├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤
│ 26 │ 27 │ 28 │ 29 │ 30 │ 31 │ │ │ 23 │ 24 │ 25 │ 26 │ 27 │ 28 │ │ │ 23 │ 24 │ 25 │ 26 │ 27 │ 28 │ 29 │ │ 27 │ 28 │ 29 │ 30 │ │ │ │
└────┴────┴────┴────┴────┴────┴────┘ └────┴────┴────┴────┴────┴────┴────┘ ├────┼────┼────┼────┼────┼────┼────┤ └────┴────┴────┴────┴────┴────┴────┘
│ 30 │ 31 │ │ │ │ │ │
└────┴────┴────┴────┴────┴────┴────┘
┌──────────────────────────────────┐ ┌──────────────────────────────────┐ ┌──────────────────────────────────┐ ┌──────────────────────────────────┐
│ │ │ │ │ │ │ │
│ May 1969 │ │ June 1969 │ │ July 1969 │ │ August 1969 │
│ │ │ │ │ │ │ │
│ Sun Mon Tue Wed Thu Fri Sat│ │ Sun Mon Tue Wed Thu Fri Sat│ │ Sun Mon Tue Wed Thu Fri Sat│ │ Sun Mon Tue Wed Thu Fri Sat│
├────┬────┬────┬────┬────┬────┬────┤ ├────┬────┬────┬────┬────┬────┬────┤ ├────┬────┬────┬────┬────┬────┬────┤ ├────┬────┬────┬────┬────┬────┬────┤
│ │ │ │ │ 1 │ 2 │ 3 │ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ │ │ │ 1 │ 2 │ 3 │ 4 │ 5 │ │ │ │ │ │ │ 1 │ 2 │
├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤
│ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 10 │ │ 8 │ 9 │ 10 │ 11 │ 12 │ 13 │ 14 │ │ 6 │ 7 │ 8 │ 9 │ 10 │ 11 │ 12 │ │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │
├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤
│ 11 │ 12 │ 13 │ 14 │ 15 │ 16 │ 17 │ │ 15 │ 16 │ 17 │ 18 │ 19 │ 20 │ 21 │ │ 13 │ 14 │ 15 │ 16 │ 17 │ 18 │ 19 │ │ 10 │ 11 │ 12 │ 13 │ 14 │ 15 │ 16 │
├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤
│ 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 │
├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤
│ 25 │ 26 │ 27 │ 28 │ 29 │ 30 │ 31 │ │ 29 │ 30 │ │ │ │ │ │ │ 27 │ 28 │ 29 │ 30 │ 31 │ │ │ │ 24 │ 25 │ 26 │ 27 │ 28 │ 29 │ 30 │
└────┴────┴────┴────┴────┴────┴────┘ └────┴────┴────┴────┴────┴────┴────┘ └────┴────┴────┴────┴────┴────┴────┘ ├────┼────┼────┼────┼────┼────┼────┤
│ 31 │ │ │ │ │ │ │
└────┴────┴────┴────┴────┴────┴────┘
┌──────────────────────────────────┐ ┌──────────────────────────────────┐ ┌──────────────────────────────────┐ ┌──────────────────────────────────┐
│ │ │ │ │ │ │ │
│ September 1969 │ │ October 1969 │ │ November 1969 │ │ December 1969 │
│ │ │ │ │ │ │ │
│ Sun Mon Tue Wed Thu Fri Sat│ │ Sun Mon Tue Wed Thu Fri Sat│ │ Sun Mon Tue Wed Thu Fri Sat│ │ Sun Mon Tue Wed Thu Fri Sat│
├────┬────┬────┬────┬────┬────┬────┤ ├────┬────┬────┬────┬────┬────┬────┤ ├────┬────┬────┬────┬────┬────┬────┤ ├────┬────┬────┬────┬────┬────┬────┤
│ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ │ │ │ │ 1 │ 2 │ 3 │ 4 │ │ │ │ │ │ │ │ 1 │ │ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │
├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤
│ 7 │ 8 │ 9 │ 10 │ 11 │ 12 │ 13 │ │ 5 │ 6 │ 7 │ 8 │ 9 │ 10 │ 11 │ │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ │ 7 │ 8 │ 9 │ 10 │ 11 │ 12 │ 13 │
├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤
│ 14 │ 15 │ 16 │ 17 │ 18 │ 19 │ 20 │ │ 12 │ 13 │ 14 │ 15 │ 16 │ 17 │ 18 │ │ 9 │ 10 │ 11 │ 12 │ 13 │ 14 │ 15 │ │ 14 │ 15 │ 16 │ 17 │ 18 │ 19 │ 20 │
├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤
│ 21 │ 22 │ 23 │ 24 │ 25 │ 26 │ 27 │ │ 19 │ 20 │ 21 │ 22 │ 23 │ 24 │ 25 │ │ 16 │ 17 │ 18 │ 19 │ 20 │ 21 │ 22 │ │ 21 │ 22 │ 23 │ 24 │ 25 │ 26 │ 27 │
├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤ ├────┼────┼────┼────┼────┼────┼────┤
│ 28 │ 29 │ 30 │ │ │ │ │ │ 26 │ 27 │ 28 │ 29 │ 30 │ 31 │ │ │ 23 │ 24 │ 25 │ 26 │ 27 │ 28 │ 29 │ │ 28 │ 29 │ 30 │ 31 │ │ │ │
└────┴────┴────┴────┴────┴────┴────┘ └────┴────┴────┴────┴────┴────┴────┘ ├────┼────┼────┼────┼────┼────┼────┤ └────┴────┴────┴────┴────┴────┴────┘
│ 30 │ │ │ │ │ │ │
└────┴────┴────┴────┴────┴────┴────┘
</pre>
|