Ejemplo n.º 1
0
 def get_cells_from_buffer_regex(self, buffer):
     # seems slower, but may be more performant on some systems.
     # skip unknown:
     unknown = buffer[:4]
     cell_buffer = buffer[4:self.size]
     r = re.compile("(..)(.)" , re.DOTALL)
     self.cells = []
     packed = r.findall(cell_buffer)
     data = map(lambda x: (binary.word(x[0]), binary.byte(x[1])), packed)
     for cell in data:
         self.cells += [cell]
     self.unknown = unknown
Ejemplo n.º 2
0
 def get_statics_regexp(self, staticsfile):
     ret = []
     if self.length:
         # seek in the file to position we need
         staticsfile.seek( self.start )
         raw_data = staticsfile.read( self.length )
         r = re.compile("(..)(.)(.)(.)(..)" , re.DOTALL)
         packed = r.findall(raw_data)
         raw_data = map(lambda x: (binary.word(x[0]), binary.ubyte(x[1]), binary.ubyte(x[2]), binary.byte(x[3]), binary.word(x[4])), packed)
         for entry in raw_data:
             ret += [ StaticsEntry( entry[0], entry[1], entry[2], entry[3], entry[4] ) ]
         self.data= ret
         return ret
     return None