define TABSTOP 15 # BITPRINT -- Print the bits that differ in the current pixel # # B.Simon 15-Feb-89 Original procedure bitprint (ndim, pixvec, nbit, bitvec) int ndim # i: Dimensionality of images int pixvec[ARB] # i: Current pixel number int nbit # i: Number of bits in a pixel int bitvec[ARB] # io: Vector of bits that differ between images #-- int ic, idim, ibit, jbit pointer sp, line int itoc() begin # Allocate dynamic memory for output string call smark (sp) call salloc (line, SZ_LINE, TY_CHAR) # Convert the pixel number to a string: "[i,j,k]" Memc[line] = '[' ic = 1 do idim = 1, ndim { ic = itoc (pixvec[idim], Memc[line+ic], SZ_LINE - ic) + ic Memc[line+ic] = ',' ic = ic + 1 } Memc[line+ic-1] = ']' # Add blanks to separate pixel number from bit list repeat { Memc[line+ic] = ' ' ic = ic + 1 } until (mod (ic, TABSTOP) == 0) # Create a list of bits differing btw images: "i,j-k,l,m" jbit = 0 do ibit = 1, nbit { # jbit is > 0 if we are in a region of 1's if (jbit <= 0) { if (bitvec[ibit] == 1) jbit = ibit } else { # Add to string when a 0 is found following a range of 1's if (bitvec[ibit] == 0) { if (ibit - jbit > 1) { ic = itoc (jbit, Memc[line+ic], SZ_LINE - ic) + ic Memc[line+ic] = '-' ic = ic + 1 } ic = itoc (ibit-1, Memc[line+ic], SZ_LINE - ic) + ic Memc[line+ic] = ',' ic = ic + 1 jbit = - ibit } } } # Add trailing newline and end of string marker Memc[line+ic-1] = '\n' Memc[line+ic] = EOS # Don't print string if no bits are different if (jbit != 0) call putline (STDOUT, Memc[line]) # Zero out bit vector call amovki (0, bitvec, nbit) call sfree (sp) end