static void putinit(unsigned int const cols, unsigned int const rows, unsigned int const depth) { unsigned int const cols32 = ((cols + 31 ) / 32) * 32; unsigned int i; /* Lispms are able to write bit files that are not mod32 wide, but we */ /* don't. This should be ok, since bit arrays which are not mod32 wide */ /* are pretty useless on a lispm (can't hand them to bitblt). */ if (rows > INT16MAX || cols > INT16MAX || cols32 > INT16MAX) pm_error("Input image is too large."); printf(LISPM_MAGIC); pm_writelittleshort(stdout, cols); pm_writelittleshort(stdout, rows); pm_writelittleshort(stdout, cols32); putchar(depth & 0xFF); for (i = 0; i < 9; ++i) putchar(0); /* pad bytes */ item = 0; bitsperitem = 0; maxbitsperitem = depth_to_word_size(depth); bitshift = 0; }
/* * Write out a two-byte little-endian word to the PCX file */ static void Putword(int const w, FILE * const fp) { int rc; rc = pm_writelittleshort(fp, w); if (rc != 0) pm_error("Error writing integer to output file"); }
static void PutShort(short const v) { if (pm_writelittleshort(ofp, v) == -1) pm_error("Unable to write short integer to output file"); }