home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-11-03 | 27.6 KB | 1,059 lines |
- Newsgroups: comp.sources.misc
- From: tony@sdd.hp.com (Tony Parkhurst)
- Subject: v25i011: pclcomp - HP-PCL Compression Filter, Part02/02
- Message-ID: <1991Nov3.233755.10922@sparky.imd.sterling.com>
- X-Md4-Signature: ff5f11338b028d52a63b24ab669003af
- Date: Sun, 3 Nov 1991 23:37:55 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: tony@sdd.hp.com (Tony Parkhurst)
- Posting-number: Volume 25, Issue 11
- Archive-name: pclcomp/part02
- Environment: LaserJet
- Supersedes: pclcomp: Volume 19, Issue 13-14
-
- #!/bin/sh
- # this is Part.02 (part 2 of a multipart archive)
- # do not concatenate these parts, unpack them in order with /bin/sh
- # file pclcomp.c continued
- #
- if test ! -r _shar_seq_.tmp; then
- echo 'Please unpack part 1 first!'
- exit 1
- fi
- (read Scheck
- if test "$Scheck" != 2; then
- echo Please unpack part "$Scheck" next!
- exit 1
- else
- exit 0
- fi
- ) < _shar_seq_.tmp || exit 1
- if test ! -f _shar_wnt_.tmp; then
- echo 'x - still skipping pclcomp.c'
- else
- echo 'x - continuing file pclcomp.c'
- sed 's/^X//' << 'SHAR_EOF' >> 'pclcomp.c' &&
- X input_char; /* Byte to be replicated. */
- X
- X unsigned int
- X read_bytes, /* Local copy of input_bytes. */
- X write_bytes; /* Local copy of output_bytes. */
- X
- X int
- X replicate_count; /* Number of times to replicate data. */
- X
- X /* CODE */
- X
- X /* Initialize the local variables. */
- X
- X read_bytes = input_bytes;
- X write_bytes = output_bytes;
- X store_ptr = address;
- X
- X /* Check for an even input count. */
- X
- X if ((read_bytes % 2) == 0)
- X {
- X /* Even so input data is in pairs as required. So store the data. */
- X
- X while ((read_bytes != 0) && (write_bytes != 0))
- X {
- X /* First get the replicate count and the byte to store. */
- X
- X replicate_count = (unsigned char) Get_Character();
- X input_char = Get_Character();
- X read_bytes -= 2;
- X
- X /* Since write_bytes was 0 there is room to store the byte. */
- X
- X *store_ptr++ = input_char;
- X write_bytes--;
- X
- X /* Now make sure there is room for the replicated data. */
- X
- X if (replicate_count > write_bytes)
- X {
- X /* Too much so limit to the room available. */
- X
- X replicate_count = write_bytes;
- X }
- X
- X /* Update the amount to be written. */
- X
- X write_bytes -= replicate_count;
- X
- X /* Then replicate it. */
- X
- X while (replicate_count != 0)
- X {
- X /* Store the byte the decrement the count. */
- X
- X *store_ptr++ = input_char;
- X
- X replicate_count--;
- X }
- X }
- X
- X }
- X /* Discard any left over input. */
- X /* OR */
- X /* Discard all of the input data as odd byte count. */
- X
- X Discard_Block(read_bytes);
- X
- X read_bytes = store_ptr - address; /* how much was done? */
- X
- X /* zero fill if needed */
- X memset(store_ptr, 0, write_bytes);
- X
- X return(read_bytes);
- }
- X
- X
- /*-----------------------------------------------------------------------*\
- X | |
- X | Function Name: Mode_2_Graphics |
- X | |
- X | Description: |
- X | |
- X | This is the routine that handles a Mode 2 graphics block transfer |
- X | to the Formatter Module. Mode 2 graphics is a compacted mode. |
- X | The data in Mode 2 is of one of two types. The first type is a |
- X | class type and the second type is a data type. The class type is |
- X | a single byte which is a combination of replicate count and a sub |
- X | mode. There are two sub modes within mode 2, sub mode 0 and sub |
- X | mode 1. These sub modes are flagged by the MSB of the class type |
- X | byte. If the MSB = 0 then the replicate count is the value of the |
- X | class type byte. In sub mode 0 the replicate count ranges from 1 |
- X | to 127. In sub mode 0 the next byte and then the replicate count |
- X | of bytes are of the data type and stored. If the MSB = 1 then the |
- X | sub mode is 1 and the replicate count is the negative value of the |
- X | class type. In sub mode 1 the replicate count is stored in 2s |
- X | compliment form and ranges from -1 to -127. In sub mode 1 the |
- X | next byte is of the data type and is stored. That data byte is |
- X | then replicated and stored the replicate count. If the class type |
- X | byte is 128 then there is no data type byte. |
- X | |
- \*-----------------------------------------------------------------------*/
- X
- /* FUNCTION */
- X
- Mode_2_Graphics(input_bytes, output_bytes, address)
- X
- unsigned int
- X input_bytes, /* Count of bytes to be read. */
- X output_bytes; /* Count of bytes to be stored. */
- X
- unsigned char
- X *address; /* Pointer to where to store bytes. */
- X
- {
- X /* LOCAL VARIABLES */
- X
- X unsigned char
- X *store_ptr, /* Pointer to where to store the byte. */
- X input_char, /* Byte to be replicated. */
- X sub_mode; /* Flag if sub mode is 0 or 1. */
- X
- X unsigned int
- X read_bytes, /* Local copy of input_bytes. */
- X write_bytes; /* Local copy of output_bytes. */
- X
- X int
- X replicate_count; /* Number of times to replicate data. */
- X
- X /* CODE */
- X
- X /* Initialize the local variables. */
- X
- X read_bytes = input_bytes;
- X write_bytes = output_bytes;
- X store_ptr = address;
- X
- X while ((read_bytes > 1) && (write_bytes != 0))
- X {
- X /* First get the class type byte and the first data type byte. */
- X
- X replicate_count = Get_Character();
- X
- X /* First check that this not an ignore class type. */
- X
- X if (replicate_count != 128)
- X {
- X /* Not ignore so get the data class byte. */
- X
- X input_char = Get_Character();
- X read_bytes -= 2;
- X
- X /* Since write_bytes wasn't 0 there is room to store the byte. */
- X
- X *store_ptr++ = input_char;
- X write_bytes--;
- X
- X /* Determine the sub mode. */
- X
- X if (replicate_count > 128)
- X {
- X /* Sub mode 1. */
- X
- X sub_mode = 1;
- X /* replicate count was unsigned char */
- X replicate_count = 256 - replicate_count;
- X }
- X else
- X {
- X /* Sub mode 0. */
- X
- X sub_mode = 0;
- X
- X /* See if there is enoungh input left for the data byte count. */
- X
- X if (replicate_count > read_bytes)
- X {
- X /* Too many data bytes so limit to the input left. */
- X
- X replicate_count = read_bytes;
- X }
- X }
- X
- X /* Now make sure there is room for the replicated data. */
- X
- X if (replicate_count > write_bytes)
- X {
- X /* Too much so limit to the room available. */
- X
- X replicate_count = write_bytes;
- X }
- X
- X /* Update the amount to be written. */
- X
- X write_bytes -= replicate_count;
- X
- X /* Then replicate it. */
- X
- X if (sub_mode == 0)
- X {
- X /* Sub mode 0 so get the replicate count of data bytes. */
- X
- X Transfer_Block(replicate_count, store_ptr);
- X
- X read_bytes -= replicate_count;
- X
- X /* Find the last byte stored. */
- X
- X store_ptr += replicate_count;
- X }
- X else
- X {
- X /* Sub mode 1 so just duplicate the original byte. */
- X
- X while (replicate_count != 0)
- X {
- X /* Store the byte the decrement the count. */
- X
- X *store_ptr++ = input_char;
- X
- X replicate_count--;
- X }
- X }
- X }
- X else
- X {
- X /* Ignore class so don't get the data class byte. */
- X
- X read_bytes--;
- X }
- X }
- X
- X /* Now discard any left over input. */
- X
- X Discard_Block(read_bytes);
- X
- X read_bytes = store_ptr - address;
- X
- X /* zero fill if needed */
- X memset(store_ptr, 0, write_bytes);
- X
- X
- X return(read_bytes);
- }
- X
- X
- /*-----------------------------------------------------------------------*\
- X | |
- X | Function Name: Mode_3_Graphics |
- X | |
- X | Description: |
- X | |
- X | This is the routine that handles a Mode 3 graphics block transfer |
- X | to the Formatter Module. Mode 3 graphics is a compacted mode. |
- X | Mode 3 data is a difference from one row to the next. In order to |
- X | work, each row must be saved to be a seed for the next. This |
- X | mode is used in conjuction with other compaction modes when the |
- X | data remains fairly constant between pairs of rows. |
- X | The data is in the form: |
- X | <command byte>[<optional offset bytes>]<1 to 8 replacement bytes> |
- X | The command byte is in the form: |
- X | Bits 5-7: Number of bytes to replace (1 - 8) |
- X | Bits 0-4: Relative offset from last byte. |
- X | (If the offset is 31, then add the following bytes for offset |
- X | until an offset byte of less then 255 (but inclusive) |
- X | |
- \*-----------------------------------------------------------------------*/
- X
- /* FUNCTION */
- X
- Mode_3_Graphics(input_bytes, output_bytes, address)
- X
- unsigned int
- X input_bytes, /* Count of bytes to be read. */
- X output_bytes; /* Count of bytes to be stored. */
- X
- unsigned char
- X *address; /* Pointer to where to store bytes. */
- X
- {
- X /* LOCAL VARIABLES */
- X
- X unsigned char
- X *store_ptr, /* Pointer to where to store the byte. */
- X input_char; /* Byte to be changed. */
- X
- X unsigned int
- X read_bytes, /* Local copy of input_bytes. */
- X write_bytes; /* Local copy of output_bytes. */
- X
- X unsigned int
- X replace, /* number of bytes to replace, 1-8 */
- X offset; /* relative offset */
- X
- #if BITFIELDS
- X union comtype {
- X unsigned char comchar; /* command byte as char */
- X struct btype {
- X unsigned repcount:3; /* replace count 1-8 */
- X unsigned roff:5; /* relative offset 0-30 */
- X } bitf;
- X } command;
- #else
- X unsigned char command;
- #endif
- X
- X /* CODE */
- X
- X /* Initialize the local variables. */
- X
- X read_bytes = input_bytes;
- X write_bytes = output_bytes;
- X store_ptr = address;
- X
- /* read_bytes has to be at least 2 to be valid */
- X
- X while ( read_bytes > 1 && write_bytes > 0 ){
- X
- X /* start by getting the command byte */
- X
- X read_bytes--;
- X
- #if BITFIELDS
- X command.comchar = Get_Character();
- X
- X replace = command.bitf.repcount + 1; /* replace count 1-8 */
- X
- X offset = command.bitf.roff; /* offset 0-30, 31= extend */
- #else
- X command = Get_Character();
- X replace = (command >> 5) + 1;
- X offset = command & 0x1f;
- #endif
- X
- X store_ptr += offset;
- X write_bytes -= offset;
- X
- X if ( offset == 31 ) /* get more offsets */
- X do{
- X
- X offset = Get_Character();
- X
- X read_bytes--;
- X if ( read_bytes == 0 ) /* premature finish? */
- X return; /* no zero fill wih 3 */
- X
- X store_ptr += offset;
- X write_bytes -= offset;
- X
- X } while (offset == 255); /* 255 = keep going */
- X
- X /* now do the byte replacement */
- X
- X while ( replace-- && write_bytes > 0 && read_bytes > 0 ){
- X
- X *store_ptr++ = Get_Character();
- X
- X read_bytes--;
- X write_bytes--;
- X }
- X }
- X
- X /* don't do any zero fill with mode 3 */
- X
- X /* discard any leftover input */
- X
- X Discard_Block(read_bytes);
- X
- X return( store_ptr - address );
- }
- X
- X
- Discard_Block(count)
- unsigned int count;
- {
- X while ( count-- )
- X getchar();
- }
- X
- Transfer_Block( count, dest )
- unsigned int count;
- unsigned char *dest;
- {
- X fread(dest, 1, count, stdin);
- }
- X
- X
- /*
- ** Output_0() does mode 0 compression (which is a no compression).
- */
- X
- Output_0(src, dest, count)
- unsigned char *src, *dest;
- int count;
- {
- X memcpy(dest, src, count);
- X
- X if ( zerostrip )
- X while ( count && dest[count-1] == 0 )
- X count--;
- X
- X return(count);
- X
- }
- X
- X
- X
- /*
- ** Output_1() does mode 1 compression (run length encoding)
- */
- X
- Output_1(src, dest, count)
- unsigned char *src, *dest;
- register int count;
- {
- X unsigned char *optr = dest, *iptr;
- X int k,c;
- X
- X if ( zerostrip ) /* strip zeros */
- X {
- X iptr = src + count - 1; /* point to end of data */
- X
- X while ( count > 0 && *iptr-- == 0 ) /* hunt thru 0's */
- X count--;
- X }
- X
- X iptr = src;
- X
- X while ( count ){
- X
- X c = *iptr++; /* get value to work with */
- X count--;
- X
- X k = 0;
- X
- X while ( *iptr == c && k < 255 && count ){
- X k++;
- X iptr++;
- X count--;
- X }
- X
- X *optr++ = k; /* output repeat count */
- X *optr++ = c; /* output value */
- X }
- X
- X count = optr - dest; /* for return value */
- X
- X return ( count );
- }
- X
- X
- /*
- ******************************************************************************
- **
- ** Output_2() does PCL compression mode 2 on the data.
- ** This mode is a combination of modes 0 and 1.
- **
- ******************************************************************************
- */
- X
- Output_2(src, dest, count)
- unsigned char *src, *dest;
- register int count;
- {
- X unsigned char *outptr, *inptr;
- X unsigned char *saveptr;
- X
- X unsigned char data; /* data byte */
- X unsigned char lastbyte; /* last byte */
- X int repcount; /* repeat count */
- X int litcount; /* literal count */
- X
- X /*
- X ** src points to the intput data.
- X ** dest points to the output buffer.
- X ** count is the number of intput bytes.
- X */
- X
- X inptr = src;
- X outptr = dest;
- X
- X /*
- X ** Start loop thru data. Check for possible repeat at beginning.
- X */
- X
- X while ( count )
- X {
- X data = *inptr++; /* get value to work with */
- X count--;
- X
- X repcount = 0; /* no repeat count yet */
- X
- X
- X /*
- X ** Check for repeat, since we are not in the middle
- X ** of a literal run, it does not have to be more than
- X ** two bytes of similar data.
- X */
- X
- X while ( count && *inptr == data )
- X {
- X repcount++;
- X inptr++;
- X count--;
- X }
- X
- X /*
- X ** Now, if we are out of data (count == 0), then
- X ** if the repeated byte was zero, then ignore it
- X ** completely (don't bother outputing the trailing zeros).
- X **
- X ** To always strip zero's, simply remove the "zerostrip"
- X ** from the test.
- X */
- X
- X if ( count == 0 && data == 0 && zerostrip)
- X break; /* done */
- X
- X
- X /*
- X ** If there was a repeat (repcount > 0), then we
- X ** can output the command here, otherwise, we
- X ** need to go into literal run mode.
- X **
- X ** Note: This is a while loop because the repeat count
- X ** may actually be greater than 127.
- X */
- X
- X if ( repcount >= 1 ) /* repeat mode */
- X {
- X while (repcount > 127)
- X {
- X *outptr++ = 129; /* count 127 */
- X *outptr++ = data; /* value */
- X repcount-= 128; /* offset */
- X }
- X
- X if (repcount > 0)
- X {
- X *outptr++ = 256 - repcount; /* count */
- X *outptr++ = data; /* value */
- X
- X /*
- X ** Now pop to the top of the loop
- X ** looking for more repeat counts.
- X */
- X
- X continue; /* top of loop */
- X }
- X
- X /*
- X ** Special case. If we have arrived at this point,
- X ** then repcount is now equal to 0. This means
- X ** that when we entered this section, repcount
- X ** was a multiple of 128 (i.e. 128 :-).
- X **
- X ** This means that there were 129 identical bytes,
- X ** so the output does a replicate of 127 which
- X ** gives 128 bytes, and we now have one byte left
- X ** over which should NOT be output as a repeat
- X ** run, rather it should be merged into the following
- X ** literal run (if it exists).
- X **
- X ** So, we will simply fall thru to the next section
- X ** of code which assumes that we are working on
- X ** a literal run.
- X */
- X
- X }
- X
- X /*
- X ** Literal run. At this point, the current data byte
- X ** does NOT match the following byte. We will transfer
- X ** these non-identical bytes until:
- X **
- X ** 1) we run out of input data (count == 0).
- X ** 2) we run out of room in this output block (128)
- X ** 3) we come across a value which occurs at least
- X ** three times in a row. A value occuring only
- X ** twice in a row does NOT justify dropping
- X ** out of a literal run.
- X **
- X ** Special case: If we run out of room in the output block
- X ** (which is 128 bytes), the last two values are the same,
- X ** AND there is more input, it makes sense to restart
- X ** the repeat detector in case the following bytes are
- X ** repeats of the two. A simple check of the following
- X ** byte will determine this.
- X ** (This case falls out with the test for triples below).
- X **
- X ** Special case: If we run out of room in the output block
- X ** (which is 128 bytes), the last value is the same as
- X ** the next one on the input, then it is better to let
- X ** that byte be used in a possible replicate run following
- X ** the literal run. If the last byte matches ONLY the
- X ** following byte, (and not the one after that, it is
- X ** a wash, but for best results, we will test the
- X ** following two bytes.
- X **
- X */
- X
- X litcount = 0;
- X saveptr = outptr++; /* save location of the command byte */
- X
- X *outptr++ = data; /* save the first byte. */
- X
- X lastbyte = data; /* remember for testing */
- X
- X while ( count && litcount < 127 )
- X {
- X data = *inptr++;
- X count--;
- X litcount++;
- X *outptr++ = data;
- X
- X /*
- X ** Test to see if this byte matched the last one.
- X ** If so, check the next one for a triple.
- X */
- X
- X if ( lastbyte == data && count && *inptr == data )
- X {
- X /*
- X ** We have a triple, adjust accordingly.
- X **
- X ** Add two bytes back onto the input.
- X */
- X
- X count += 2;
- X inptr -= 2;
- X outptr -= 2;
- X litcount -= 2;
- X
- X break; /* out of loop */
- X }
- X
- X lastbyte = data; /* save data byte */
- X }
- X
- X /*
- X ** Check the special case number 2 above.
- X */
- X
- X if ( litcount == 127 && count > 1 && data == *inptr
- X && data == inptr[1] )
- X {
- X /* Restore the last byte to the input stream */
- X
- X count += 1;
- X inptr -= 1;
- X outptr -= 1;
- X litcount -= 1;
- X }
- X
- X
- X /*
- X ** Save the literal run count.
- X */
- X
- X *saveptr = litcount;
- X
- X /*
- X ** Now go back to the top and look for repeats.
- X */
- X }
- X
- X count = outptr - dest; /* for return value */
- X
- X return ( count );
- }
- X
- X
- X
- /*
- ** Output_3() does mode 3 compression (delta row encoding).
- */
- X
- Output_3(seed, new, dest, count)
- unsigned char *seed, *new, *dest;
- int count;
- {
- X unsigned char *sptr=seed, *nptr=new, *dptr=dest;
- X int i,j;
- X
- X
- #if BITFIELDS
- X union comtype {
- X unsigned char comchar; /* command byte as char */
- X struct btype {
- X unsigned repcount:3; /* replace count 1-8 */
- X unsigned roff:5; /* relative offset 0-30 */
- X } bitf;
- X } command;
- #else
- X unsigned char command;
- #endif
- X
- X while ( count > 0 ){
- X i = 0;
- X
- X /* find first diff */
- X while ( *sptr == *nptr && i < count ){
- X i++;
- X sptr++;
- X nptr++;
- X }
- X
- X if ( i >= count ) /* too far to find diff */
- X return(dptr - dest); /* bail */
- X
- X count -= i;
- X
- X /* now count how many bytes to change */
- X
- X for ( j = 1; j < 8; j++) /* j == 0 is already known */
- X if ( j > count || sptr[j] == nptr[j] )
- X break;
- X
- X j--; /* adjust */
- X
- #if BITFIELDS
- X command.bitf.repcount = j; /* 0-7 ==> 1-8 */
- X
- X command.bitf.roff = MIN ( i, 31 );
- X
- X *dptr++ = command.comchar; /* output command */
- #else
- X command = (j << 5);
- X command += MIN( i, 31 );
- X *dptr++ = command;
- #endif
- X
- X if ( i == 31 )
- X *dptr++ = 0;
- X
- X i -= MIN (i, 31);
- X
- X while( i ){
- X *dptr++ = MIN ( i, 255 );
- X
- X if ( i == 255 )
- X *dptr++ = 0;
- X
- X i -= MIN ( i, 255 );
- X }
- X
- X while (j-- >= 0){
- X *dptr++ = *nptr++;
- X sptr++;
- X count--;
- X }
- X }
- X
- X return ( dptr - dest );
- }
- X
- X
- /*----------------------------------------------------------------------*\
- X * This is here in case <ESC>*rU is sent after <ESC>*r#A, in which case *
- X * we must deallocate the memory to provide for a different amount of *
- X * planes when graphics are sent. *
- \*----------------------------------------------------------------------*/
- X
- free_mem()
- {
- X int r;
- X
- X
- X if ( !memflag )
- X return; /* no memory to free */
- X
- X free(new_row);
- X
- X for(r = MAXMODES -1; r >= 0; r--)
- X free(out_row[r]);
- X
- X for(r = num_planes - 1; r >= 0; r--)
- X free(seed_row[r]);
- X
- X memflag = FALSE;
- }
- X
- /*
- ** Get_Frac() simply gets the fractional part of a value. This is here
- ** because scanf() will consume a trailing 'e' or 'E', which is a problem
- ** in PCL.
- */
- X
- static float Get_Frac()
- {
- X float result = 0.0;
- X int c;
- X float position = 10.0;
- X
- X while ( (c = getchar()) != EOF )
- X {
- X /*
- X ** Do we have a digit?
- X */
- X
- X if ( !isdigit(c) ) /* not a digit */
- X {
- X ungetc( c, stdin ); /* put it back */
- X break; /* quit */
- X }
- X
- X result += ((c - '0') / position);
- X
- X position *= 10.0;
- X }
- X
- X return ( result );
- }
- SHAR_EOF
- echo 'File pclcomp.c is complete' &&
- chmod 0444 pclcomp.c ||
- echo 'restore of pclcomp.c failed'
- Wc_c="`wc -c < 'pclcomp.c'`"
- test 64599 -eq "$Wc_c" ||
- echo 'pclcomp.c: original size 64599, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= pclcomp.man ==============
- if test -f 'pclcomp.man' -a X"$1" != X"-c"; then
- echo 'x - skipping pclcomp.man (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting pclcomp.man (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'pclcomp.man' &&
- X
- X
- X
- X PCLCOMP(1) PCLCOMP(1)
- X
- X
- X
- X NAME
- X pclcomp - Compress PCL graphics files.
- X
- X SYNOPSIS
- X pclcomp [ -0123drsvxz ] [ -n num ] [ inputfile [ outputfile ]]
- X
- X
- X DESCRIPTION
- X Pclcomp compresses (or decompresses) HP-PCL (Printer Control
- X Language) graphics data. The supported compression modes
- X are 0 (uncompressed), 1, 2 and 3. Pclcomp will read files
- X using any of the modes 0 through 3, and will output using
- X the modes which will give the best compression. This
- X compressed version of the file may be sent directly to a PCL
- X compatible printer, thus reducing I/O bandwidth. Pictures
- X may also be saved in compressed form, reducing disk usage.
- X In addition, PCL "imaging" files for the PaintJet XL are
- X also supported.
- X
- X The options to pclcomp control the compression modes. By
- X default, pclcomp will use modes 0, 2 and 3, but the user may
- X restrict which output modes it uses by specifying them on
- X the command line with the -0, -1, -2 and -3 options. To
- X decompress a file, simply specify -0 as the only mode to use
- X for output. Mode 0 ( -0 ) should always be allowed since
- X modes 1, 2 and 3 cannot be guaranteed to be better than mode
- X 0 for all types of pictures.
- X
- X The -z option disables the zero "strip" feature. Since most
- X printers do zero "filling", pclcomp, by default, "strips"
- X the trailing zeros of each row (or plane) of data. Some
- X printers or programs may require that zero "stripping" be
- X disabled.
- X
- X By default, pclcomp expects the input raster width to be
- X 2400 pixels (8" at 300 dpi), and if it is different (e.g.
- X PaintJet), then the raster width should be specified by the
- X Source Raster Width escape sequence <esc*r#S>. However, many
- X applications do not set the width and assume a default,
- X therefore, the user may use the -n option to pclcomp to
- X specify a new default raster width. For PaintJet (8" at 180
- X dpi), the number should be 1440. If the PCL file contains
- X the Source Raster Width escape sequence, it will override
- X this default. If pclcomp thinks that more data is coming in
- X than the specified width, it will generate a warning, and
- X continue processing (and perhaps truncating) data.
- X
- X The -x option will cause pclcomp to remove any horizontal
- X offset sequences from the data. Only use this option if
- X white is defined to be zero (as with LaserJets). This will
- X shrink the data more if modes 2 or 3 are used.
- X
- X
- X
- X
- X - 1 -Formatted: September 10, 1991
- X
- X
- X
- X
- X
- X
- X PCLCOMP(1) PCLCOMP(1)
- X
- X
- X
- X The -r option causes pclcomp to append a reset sequence
- X (<esc>E) to the end of the job.
- X
- X Use the -d option to pclcomp if the output is to be sent to
- X a DeskJet printer.
- X
- X Some applications erroneously send <esc>*rB and <esc>*rA
- X sequences between every row of graphics data. The -s option
- X to pclcomp will "strip" all <esc>*rB sequences, and all
- X <esc>*rA sequences after the first occurrence of this
- X sequence. In addition, text and control characters residing
- X between <esc>*rA and <esc>*rB sequences will be discarded.
- X While this will work well for many jobs, it may have
- X problems on multi-page or complex jobs.
- X
- X The -v option simply gives statistics to stderr about which
- X compression modes were used.
- X
- X EXAMPLES
- X To compress a PCL file for LaserJet III, use:
- X pclcomp infile outfile
- X
- X To compress a PCL file for the PaintJet (A size page at 180 dpi), use:
- X pclcomp -01 -n 1440 infile outfile
- X
- X To compress a PCL file for DeskJet, use:
- X pclcomp -d012 infile outfile
- X
- X To fully decompress a PCL file, use:
- X pclcomp -0z < infile > outfile
- X
- X WARNINGS
- X The -z option can cause the output to be larger than the
- X input.
- X
- X The -s option is useful, but it can cause erroneous output.
- X
- X The -x option can cause black areas on the left side of the
- X picture on color printers.
- X
- X AUTHOR
- X Tony Parkhurst, Hewlett-Packard, San Diego Division
- X (tony@sdd.hp.com)
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X - 2 -Formatted: September 10, 1991
- X
- X
- X
- SHAR_EOF
- chmod 0664 pclcomp.man ||
- echo 'restore of pclcomp.man failed'
- Wc_c="`wc -c < 'pclcomp.man'`"
- test 4059 -eq "$Wc_c" ||
- echo 'pclcomp.man: original size 4059, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= printer.note ==============
- if test -f 'printer.note' -a X"$1" != X"-c"; then
- echo 'x - skipping printer.note (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting printer.note (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'printer.note' &&
- X
- X
- Here is a list of printers and the compression modes they support:
- X
- X
- X
- Printer Modes
- ------- -----
- X
- LaserJet 0
- LaserJet+ 0
- LaserJet 500 0
- LaserJet 2000 0
- LaserJet II 0
- LaserJet IIP 0 1 2
- LaserJet III 0 1 2 3
- LaserJet IIIP 0 1 2 3 5 (Method 5 is not supported by pclcomp)
- X
- DeskJet 0 1 2
- DeskJet+ 0 1 2
- DeskJet 500 0 1 2 3
- X
- PaintJet 0 1
- PaintJet XL 0 1 2 3
- X
- X
- Mode 0 is uncompressed graphics data.
- SHAR_EOF
- chmod 0664 printer.note ||
- echo 'restore of printer.note failed'
- Wc_c="`wc -c < 'printer.note'`"
- test 415 -eq "$Wc_c" ||
- echo 'printer.note: original size 415, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- rm -f _shar_seq_.tmp
- echo You have unpacked the last part
- exit 0
- exit 0 # Just in case...
- --
- Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM
- Sterling Software, IMD UUCP: uunet!sparky!kent
- Phone: (402) 291-8300 FAX: (402) 291-4362
- Please send comp.sources.misc-related mail to kent@uunet.uu.net.
-