2016 Update

This commit is contained in:
Tina Müller 2016-12-05 22:15:40 +01:00
parent 948b86eafa
commit dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions

View file

@ -1,23 +1,23 @@
/*REXX program times the generation of 100 frames of random black&white image.*/
parse arg sw sd im . /*obtain optional args from the C.L. */
if sw==',' | sw=='' then sw=320 /*SW specified? No, then use default.*/
if sd==',' | sd=='' then sd=240 /*SD " " " " " */
if im==',' | im=='' then im=100 /*IM " " " " " */
call time 'R' /*reset the REXX elapsed (clock) timer.*/
do frame=1 for im /*generate IM number of images. */
call genFrame sw,sd /*generate single image of size SW x SD*/
/* say frame */ /*do (or don't) display the frame num. */
end /*frame*/ /*generate, but don't display the image*/
/*measures ↓ elapsed time in seconds.*/
say 'The average frames/second: ' format(im/time("E"),,2) /*show FPS stat.*/
exit /*stick a fork in it, we're all done. */
/*────────────────────────────────────────────────────────────────────────────*/
genFrame: parse arg x,y; @.0='ff000000'x /*hex: black. */
@.1='ffffffff'x /*hex: white. */
$= /*nullify image*/
do y; _= /*nullify a row*/
do x; ?=random(0,1); _=_ || @.? /*black │ white*/
end /*x*/
$=$ || _ /*append to $. */
end /*y*/
return
/*REXX program times (elapsed) the generation of 100 frames of random black&white image.*/
parse arg sw sd im . /*obtain optional args from the C.L. */
if sw=='' | sw=="," then sw=320 /*SW specified? No, then use default.*/
if sd=='' | sd=="," then sd=240 /*SD " " " " " */
if im=='' | im=="," then im=100 /*IM " " " " " */
call time 'R' /*reset the REXX elapsed (clock) timer.*/
do im /*generate IM number of images. */
call genFrame sw, sd /*generate single image of size SW x SD*/
/*■■■ display frame here ■■■*/ /*do (or don't) display the frame num. */
end /*im*/ /*generate, but don't display the image*/
/*measures ↓ elapsed time in seconds.*/
say 'The average frames/second: ' format(im/time("E"), , 2) /*show frames/second.*/
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
genFrame: parse arg x,y; @.0= 'ff000000'x /*hex: the color black. */
@.1= 'ffFFffFF'x /* " " " white. */
$= /*nullify image string. */
do y; _= /*nullify an output row. */
do x; ?=random(0,1); _=_ || @.? /*color is black │ white.*/
end /*x*/ /* [↑] build a whole row*/
$=$ || _ /*append row to $ string.*/
end /*y*/ /* [↑] build the image. */
return