Changeset 1448

Show
Ignore:
Timestamp:
05/04/04 06:39:26 (20 years ago)
Author:
jalet
Message:

Better PCL support

Location:
pykota/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/pkpgcounter

    r1447 r1448  
    2424# 
    2525# $Log$ 
     26# Revision 1.3  2004/05/04 04:39:26  jalet 
     27# Better PCL support 
     28# 
    2629# Revision 1.2  2004/05/04 03:14:26  jalet 
    2730# fixed copy&paste problem in pkpgcounter 
     
    8083    # Backported from C to Python by Jerome Alet 
    8184    #  
    82     tagsends = { "*b" : "W", "(s" : "W", ")s" : "W", "&p" : "X", "&l" : "X" }  
     85    tagsends = { "&n" : "W", "&b": "W", "*i" : "W", "*l" : "W", "*m" : "W", "*v": "W", "*c" : "W", "(f" : "W", "*b" : "VW", "(s" : "W", ")s" : "W", "&p" : "X", "&l" : "X" }  
    8386    copies = 1 
    8487    pagecount = 0 
     
    9295        elif char == "\033" :     
    9396            # 
    94             #     <ESC>*b###W -> Start of a binary block 
     97            #     <ESC>*b###W -> Start of a raster data row/block 
     98            #     <ESC>*b###V -> Start of a raster data plane 
     99            #     <ESC>*c###W -> Start of a user defined pattern 
     100            #     <ESC>*i###W -> Start of a viewing illuminant block 
     101            #     <ESC>*l###W -> Start of a color lookup table 
     102            #     <ESC>*m###W -> Start of a download dither matrix block 
     103            #     <ESC>*v###W -> Start of a configure image data block 
    95104            #     <ESC>(s###W -> Start of a characters description block 
    96105            #     <ESC>)s###W -> Start of a fonts description block 
     106            #     <ESC>(f###W -> Start of a symbol set block 
     107            #     <ESC>&b###W -> Start of configuration data block 
     108            #     <ESC>&l###X -> Number of copies 
     109            #     <ESC>&n###W -> Starts an alphanumeric string ID block 
    97110            #     <ESC>&p###X -> Start of a non printable characters block 
    98             #     <ESC>&l###X -> Number of copies 
    99111            # 
    100             tag = infile.read(2) 
     112            tagstart = infile.read(1) 
     113            if tagstart in "E9=YZ" : # one byte PCL tag 
     114                continue             # skip to next tag 
     115            tag = tagstart + infile.read(1) 
    101116            try : 
    102117                tagend = tagsends[tag] 
     
    111126                        break 
    112127                    size = (size * 10) + int(char)     
    113                 if char == tagend :     
     128                if char in tagend :     
    114129                    if tag == "&l" : 
    115130                        copies = size 
     
    118133                        # for unseekable streams.  
    119134                        # we just ignore the block anyway. 
     135                        if tag == "&n" :  
     136                            # we have to take care of the operation id byte 
     137                            # which is before the string itself 
     138                            size += 1 
    120139                        infile.read(size)  
    121140    return copies * pagecount         
  • pykota/trunk/NEWS

    r1447 r1448  
    2626        - a bad copy&paste prevented pkpgcounter to work at all, this 
    2727          is now fixed. 
     28           
     29        - improved PCL support in pkpgcounter.   
    2830           
    2931    - 1.19alpha3 :