September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -1,26 +1,24 @@
|
|||
/*REXX program to display (and also test/verify) some numbers as octets.*/
|
||||
/*REXX program displays (and also tests/verifies) some numbers as octets. */
|
||||
nums = x2d(200000) x2d(1fffff) 2097172 2097151
|
||||
#=words(nums)
|
||||
say ' number hex octet original'
|
||||
say '═════════ ═════════ ═════════ ═════════'
|
||||
say ' number hex octet original'
|
||||
say '══════════ ══════════ ══════════ ══════════'
|
||||
ok=1
|
||||
do j=1 for #; @.j=word(nums,j)
|
||||
do j=1 for #; @.j= word(nums,j)
|
||||
onum.j=octet(@.j)
|
||||
orig.j=x2d(space(onum.j,0))
|
||||
|
||||
say show(@.j) show(d2x(@.j)) show(onum.j) show(orig.j)
|
||||
orig.j= x2d( space(onum.j, 0) )
|
||||
w=10
|
||||
say center(@.j, w) center(d2x(@.j), w) center(onum.j, w) center(orig.j, w)
|
||||
if @.j\==orig.j then ok=0
|
||||
end /*j*/
|
||||
say
|
||||
if ok then say 'All' # "numbers are OK." /*all numbers good*/
|
||||
else say 'Trouble right here in River City.' /*some number ¬good*/
|
||||
exit /*stick a fork in it, we're done.*/
|
||||
/*──────────────────────────────────OCTET subroutine────────────────────*/
|
||||
octet: procedure; parse arg a,_ /*obtain A from the passed arg. */
|
||||
x=d2x(a) /*convert A to hexadecimal octet.*/
|
||||
do j=length(x) by -2 to 1 /*process the "little" end first.*/
|
||||
_=substr(x,j-1,2,0) _ /*pad odd hexcharacters with ··· */
|
||||
end /*j*/ /* ··· a zero on the left. */
|
||||
return _
|
||||
/*──────────────────────────────────SHOW subroutine─────────────────────*/
|
||||
show: return center(arg(1),9) /*justify via centering the text.*/
|
||||
if ok then say 'All ' # " numbers are OK." /*all of the numbers are good. */
|
||||
else say "Some numbers are not OK." /*some of the numbers are ¬good. */
|
||||
exit /*stick a fork in it, we're all done. */
|
||||
/*──────────────────────────────────────────────────────────────────────────────────────*/
|
||||
octet: procedure; parse arg z,$ /*obtain Z from the passed arguments.*/
|
||||
x=d2x(z) /*convert Z to a hexadecimal octet. */
|
||||
do j=length(x) by -2 to 1 /*process the "little" end first. */
|
||||
$= substr(x, j-1, 2, 0) $ /*pad odd hexadecimal characters with */
|
||||
end /*j*/ /* ··· a zero on the left. */
|
||||
return strip($)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue