def treat_file(filename, outfp):
 try:
  fp = open(filename, 'r')
 except:
  sys.stderr.write(('Cannot open %s\n' % filename))
  return
 charno = 0
 lineno = 0
 tags = []
 size = 0
 while 1:
  line = fp.readline()
  if (not line):
   break
  lineno = (lineno + 1)
  m = matcher.search(line)
  if m:
   tag = (m.group(0) + ('\x7f%d,%d\n' % (lineno, charno)))
   tags.append(tag)
   size = (size + len(tag))
  charno = (charno + len(line))
 outfp.write(('\x0c\n%s,%d\n' % (filename, size)))
 for tag in tags:
  outfp.write(tag)

def treat_file ( filename , outfp ) : try : fp = open ( filename , 'r' ) except : sys . stderr . write ( ( 'Cannot open %s\n' % filename ) ) return charno = 0 lineno = 0 tags = [ ] size = 0 while 1 : line = fp . readline ( ) if ( not line ) : break lineno = ( lineno + 1 ) m = matcher . search ( line ) if m : tag = ( m . group ( 0 ) + ( '\x7f%d,%d\n' % ( lineno , charno ) ) ) tags . append ( tag ) size = ( size + len ( tag ) ) charno = ( charno + len ( line ) ) outfp . write ( ( '\x0c\n%s,%d\n' % ( filename , size ) ) ) for tag in tags : outfp . write ( tag )
append tags found in file named filename to the open file outfp .