Colour bars/Display: Difference between revisions

Content added Content deleted
No edit summary
m (→‎{{header|REXX}}: changed/added comments and whitespace, changed indentations.)
Line 858: Line 858:
{{works with|R4}}
{{works with|R4}}
{{works with|ROO}}
{{works with|ROO}}
Programming note:   because of the way the REXX interpreters (being used for this example) ensure screen output fidelity, if ninety characters are displayed on a ninety-byte wide screen, REXX apparently forces an extra blank, causing to what appears to be a blank line after the line displayed.   Because of this, the last color bar   ('''_.8''')   has been shortened by one byte.


<br>
<lang rexx>/*REXX program displays eight colored vertical bars on the full screen. */
Programming note: &nbsp; because of the way the REXX interpreters &nbsp; (being used for this example) &nbsp; ensure screen output fidelity, &nbsp; if ninety characters are displayed on a ninety-byte wide screen, &nbsp; REXX apparently forces an extra blank, &nbsp; causing to what appears to be a blank line after the line displayed. &nbsp; Because of this, &nbsp; the last color bar &nbsp; ('''_.8''') &nbsp; has been shortened by one byte.
parse value scrsize() with sd sw . /*screen depth,width.*/

barWidth=sw%8 /*calculate bar width*/
_.=copies('db'x,barWidth) /*the bar, full width*/
<lang rexx>/*REXX program displays eight colored vertical bars on a full screen. */
_.8=left(_.,barWidth-1) /*last bar width. */
parse value scrsize() with sd sw . /*the screen depth and width. */
barWidth=sw%8 /*calculate the bar width. */
$ = x2c('1b5b73') || x2c('1b5b313b33376d') /* preamble, header. */
hdr.1 = x2c('1b5b303b33306d') /* the color black. */
_.=copies('db'x, barWidth) /*the bar, full width. */
hdr.2 = x2c('1b5b313b33316d') /* the color red. */
_.8=left(_.,barWidth-1) /*the last bar width, less one. */
hdr.3 = x2c('1b5b313b33326d') /* the color green. */
$ = x2c('1b5b73') || x2c("1b5b313b33376d") /* the preamble, and the header. */
hdr.4 = x2c('1b5b313b33346d') /* the color blue. */
hdr.1 = x2c('1b5b303b33306d') /* " color black. */
hdr.5 = x2c('1b5b313b33356d') /* the color magenta.*/
hdr.2 = x2c('1b5b313b33316d') /* " color red. */
hdr.6 = x2c('1b5b313b33366d') /* the color cyan. */
hdr.3 = x2c('1b5b313b33326d') /* " color green. */
hdr.7 = x2c('1b5b313b33336d') /* the color yellow. */
hdr.4 = x2c('1b5b313b33346d') /* " color blue. */
hdr.8 = x2c('1b5b313b33376d') /* the color white. */
hdr.5 = x2c('1b5b313b33356d') /* " color magenta. */
hdr.6 = x2c('1b5b313b33366d') /* " color cyan. */
tail = x2c('1b5b751b5b303b313b33363b34303b306d') /* epilogue, trailer.*/
/* [↓] last bar width is shrunk.*/
hdr.7 = x2c('1b5b313b33336d') /* " color yellow. */
do j=1 for 8 /*build the line, color by color.*/
hdr.8 = x2c('1b5b313b33376d') /* " color white. */
tail = x2c('1b5b751b5b303b313b33363b34303b306d') /* " epilogue, and the trailer.*/
$=$ || hdr.j || _.j /*append the color header + bar. */
end /*j*/ /* [] color order is the list. */
/* [] last bar width is shrunk. */
/* [↓] the tail is overkill. */
do j=1 for 8 /*build the line, color by color. */
$=$ || tail /*append the epilogue (trailer). */
$=$ || hdr.j || _.j /*append the color header + bar. */
/* [] show full screen of bars.*/
end /*j*/ /* [] color order is the list. */
do k=1 for sd /*SD = screen depth (from above).*/
/* [↓] the tail is overkill. */
say $ /*have REXX display line of bars.*/
$=$ || tail /*append the epilogue (trailer). */
end /*k*/ /* [] Note: SD could be zero.*/
/* [] show full screen of bars. */
/*stick a fork in it, we're done.*/</lang>
do k=1 for sd /*SD = screen depth (from above). */
say $ /*have REXX display line of bars. */
'''output''' appears identical to the output for &nbsp; '''Icon and Unicon''', &nbsp; '''Mathematica''', &nbsp; and &nbsp; '''R''' &nbsp; examples.
end /*k*/ /* [↑] Note: SD could be zero. */
/*stick a fork in it, we're done. */</lang>
'''output''' &nbsp; appears identical to the output for &nbsp; '''Icon and Unicon''', &nbsp; '''Mathematica''', &nbsp; and &nbsp; '''R''' &nbsp; examples.


=={{header|Ring}}==
=={{header|Ring}}==