subr bprint,z ;prints out the bits in an integer array n=num_elem(z) ncase symdtype(z) { mask=0x7f nb=6 m2=0x80 } { mask=0x7fff nb=14 m2=0x8000 } { mask=0x7fffffff nb=30 m2=0x80000000 } else {t,'bogus symbol type (FP?) in BPRINT' return } endcase ncase symclass(z) { t,'bogus input' } { xq=z yq=z and mask s='' for i=0,nb do { s=s+istring(yq%2,1) yq=yq/2 } if (xq and m2) ne 0 then s=s+'1' else s=s+'0' print,s } { t,'bogus input' } { t,'bogus input' } { for j=0,n-1 do { xq=z(j) yq=xq and mask s='' for i=0,nb do { s=s+istring(yq%2,1) yq=yq/2 } if (xq and m2) ne 0 then s=s+'1' else s=s+'0' print,s } } endcase endsubr ;============================================================================== subr huffmanprint,z,len ;prints out the bit patterns for a Huffman code contained in z with the ;length of each pattern in the corresponding len n=num_elem(z) ncase symdtype(z) { mask=0x7f nb=6 m2=0x80 } { mask=0x7fff nb=14 m2=0x8000 } { mask=0x7fffffff nb=30 m2=0x80000000 } else {t,'bogus symbol type (FP?) in BPRINT' return } endcase ncase symclass(z) { t,'bogus input' } { xq=z yq=z and mask s='' for i=0,nb do { s=s+istring(yq%2,1) yq=yq/2 } if (xq and m2) ne 0 then s=s+'1' else s=s+'0' print,s(0:(len-1)) } { t,'bogus input' } { t,'bogus input' } { for j=0,n-1 do { xq=z(j) yq=xq and mask s='' for i=0,nb do { s=s+istring(yq%2,1) yq=yq/2 } if (xq and m2) ne 0 then s=s+'1' else s=s+'0' print,s(0:(len(j)-1))}} endcase endsubr