Changeset 3502 for pkpgcounter

Show
Ignore:
Timestamp:
07/18/09 09:35:07 (15 years ago)
Author:
jerome
Message:

Doesn't check anymore if the current line ends with an EOL marker. From
what I understand from reading Python's documentation, this can only
occur on the very last line of the file anyway. Fixes #44.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pkpgcounter/trunk/pkpgpdls/plain.py

    r3474 r3502  
    5757        linecount = 0 
    5858        for line in self.infile : 
    59             if line.endswith("\n") : 
    60                 linecount += 1 
    61                 if (linecount > pagesize) : 
    62                     pagecount += 1 
     59            linecount += 1 
     60            if (linecount > pagesize) : 
     61                pagecount += 1 
     62                linecount = 0 
     63            else : 
     64                cnt = line.count("\f") 
     65                if cnt : 
     66                    pagecount += cnt 
    6367                    linecount = 0 
    64                 else : 
    65                     cnt = line.count("\f") 
    66                     if cnt : 
    67                         pagecount += cnt 
    68                         linecount = 0 
    69             else : 
    70                 raise pdlparser.PDLParserError, "Unsupported file format. Please send the file to %s" % version.__authoremail__ 
     68 
    7169        return pagecount + 1    # NB : empty files are catched in isValid()