Annotation of ntddk/src/print/toshiba/code.c, revision 1.1

1.1     ! root        1: /********************** Module Header **************************************
        !             2:  * code.c
        !             3:  *     Contains device specific code for Toshiba printers.  This involves
        !             4:  *     using only 6 bits per byte.
        !             5:  *
        !             6:  * HISTORY:
        !             7:  *  13:51 on Mon 13 Jan 1992   -by-    Lindsay Harris   [lindsayh]
        !             8:  *     Initial version.
        !             9:  *
        !            10:  *  Copyright (C) 1992  Microsoft Corporation.
        !            11:  *
        !            12:  **************************************************************************/
        !            13: 
        !            14: #include       <windows.h>
        !            15: 
        !            16: 
        !            17: #include        <ntmindrv.h>
        !            18: 
        !            19: 
        !            20: NTMD_INIT    ntmdInit;                 /* Function address in RasDD */
        !            21: 
        !            22: 
        !            23: 
        !            24: /*
        !            25:  *   Include the module initialisation function so that RasDD will
        !            26:  * recognise our module.
        !            27:  */
        !            28: 
        !            29: #define        _GET_FUNC_ADDR    1
        !            30: 
        !            31: #include       "modinit.c"
        !            32: 
        !            33: 
        !            34: #define        BBITS   8               /* Bits in a byte */
        !            35: 
        !            36: 
        !            37: /***************************** Function Header *****************************
        !            38:  * CBFilterGraphics
        !            39:  *     Manipulate output data before calling RasDD's buffering function.
        !            40:  *     This function is called with the raw bit data that is to be
        !            41:  *     sent to the printer.
        !            42:  *
        !            43:  * NOTE:  THIS FUNCTION OVERWRITES THE DATA IN THE BUFFER PASSED IN!!!
        !            44:  *
        !            45:  * RETURNS:
        !            46:  *     Value from WriteSpoolBuf
        !            47:  *
        !            48:  * HISTORY:
        !            49:  *  13:53 on Mon 13 Jan 1992   -by-    Lindsay Harris   [lindsayh]
        !            50:  *     Adapted from other drivers for Toshiba stuff.
        !            51:  *
        !            52:  *
        !            53:  ****************************************************************************/
        !            54: 
        !            55: int
        !            56: CBFilterGraphics( lpdv, lpBuf, len )
        !            57: void  *lpdv;
        !            58: BYTE  *lpBuf;
        !            59: int    len;
        !            60: {
        !            61: 
        !            62:     /*
        !            63:      *    Not hard to do - take the 3 bytes containing the 24 bits to
        !            64:      *  output,  transform them to 4 bytes (6 bits apiece) and send them
        !            65:      *  off to the output buffering function.
        !            66:      */
        !            67: 
        !            68: 
        !            69:     register  DWORD   rdw;
        !            70: 
        !            71:     int    cbSent;
        !            72: 
        !            73:     BYTE   bBuf[ 4 ];          /* Store data, transfer to WriteSpoolBuf */
        !            74: 
        !            75: 
        !            76:     cbSent = len;              /* Assume success */
        !            77:     while( (len -= 3) >= 0 )
        !            78:     {
        !            79:        rdw = 0;
        !            80: 
        !            81:        /*  Step 1:  Assemble the 3 bytes into a register  */
        !            82: 
        !            83:        rdw = (DWORD)*lpBuf++;
        !            84:        rdw = (rdw << BBITS) | (DWORD)*lpBuf++;
        !            85:        rdw = (rdw << BBITS) | (DWORD)*lpBuf++;
        !            86: 
        !            87: 
        !            88:        /*  Step 2:  Extract the data from the register 6 bits at a time */
        !            89: 
        !            90:        bBuf[ 3 ] = (BYTE)(rdw & 0x3f);         /* 6 bits only */
        !            91:        rdw >>= 6;                              /* The above bits */
        !            92: 
        !            93:        bBuf[ 2 ] = (BYTE)(rdw & 0x3f);
        !            94:        rdw >>= 6;
        !            95: 
        !            96:        bBuf[ 1 ] = (BYTE)(rdw & 0x3f);
        !            97:        rdw >>= 6;
        !            98: 
        !            99:        bBuf[ 0 ] = (BYTE)(rdw & 0x3f);
        !           100: 
        !           101:        ntmdInit.WriteSpoolBuf( lpdv, bBuf, 4 );
        !           102:     }
        !           103: 
        !           104: 
        !           105:     return  cbSent;            /* Silly, but compatible with WriteSpoolBuf */
        !           106: 
        !           107: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.