<s> try : <EOL> import psyco <EOL> psyco . full ( ) <EOL> except ImportError : <EOL> pass <EOL> class LifeTime ( object ) : <EOL> __slots__ = "<STR_LIT>" . split ( ) <EOL> def __init__ ( self , typeid , address , size , varsize , birth , death = - <NUM_LIT:1> ) : <EOL> self . typeid = typeid <EOL> self . address = address <EOL> self . size = size <EOL> self . birth = birth <EOL> self . death = death <EOL> self . varsize = varsize <EOL> def parse_file ( f , callback ) : <EOL> unknown_lifetime = { } <EOL> current = <NUM_LIT:0> <EOL> for i , line in enumerate ( f ) : <EOL> if i % <NUM_LIT> == <NUM_LIT:0> : <EOL> print i <EOL> line = line . split ( ) <EOL> if line [ <NUM_LIT:0> ] == "<STR_LIT>" : <EOL> _ , typeid , address = line <EOL> typeid = int ( typeid ) <EOL> address = int ( address , <NUM_LIT:16> ) <EOL> unknown = unknown_lifetime . pop ( address ) <EOL> unknown . death = current <EOL> callback ( unknown ) <EOL> else : <EOL> if line [ <NUM_LIT:0> ] == "<STR_LIT>" : <EOL> varsize = True <EOL> else : <EOL> varsize = False <EOL> _ , typeid , size , address = line <EOL> size = int ( size ) <EOL> typeid = int ( typeid ) <EOL> address = int ( address , <NUM_LIT:16> ) <EOL> new = LifeTime ( typeid , address , size , varsize , current ) <EOL> unknown_lifetime [ address ] = new <EOL> current += size <EOL> for unknown in unknown_lifetime . itervalues ( ) : <EOL> unknown . death = current <EOL> callback ( unknown ) <EOL> def collect_all ( f ) : <EOL> all = [ ] <EOL> def callback ( obj ) : <EOL> all . append ( obj ) <EOL> parse_file ( f , callback ) <EOL> return all </s>
