[Jahshaka-cvs] jah/jahtools/jbatch jstack.py,1.11,1.12
Status: Beta
Brought to you by:
jahshaka
From: Charles Y. <lil...@us...> - 2007-04-29 14:34:35
|
Update of /cvsroot/jahshaka/jah/jahtools/jbatch In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv32489 Modified Files: jstack.py Log Message: + Corrects var assignment/use_count and the related function frame removal Index: jstack.py =================================================================== RCS file: /cvsroot/jahshaka/jah/jahtools/jbatch/jstack.py,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- jstack.py 17 Apr 2007 09:48:44 -0000 1.11 +++ jstack.py 29 Apr 2007 14:34:22 -0000 1.12 @@ -87,7 +87,7 @@ path, name = os.path.split( uri ) prefix, ext = os.path.splitext( name ) if ext != "" and self.is_image_extension( ext ): - real = str( real ) + "/sequence:" + real = str( real ) + "/sequence:fps=1,1" result = openmedialib.create_input( str( real ).replace( '\\', '/' ) ) if result is not None: properties.update_prop( result, "rpn_uri", str( uri ) ) @@ -108,8 +108,9 @@ i += 1 if input.reuse( ): uri = properties.retrieve_uri( input ) - properties.update_prop( input, "rpn_uri", str( uri ) ) - self.objects[ uri ].append( input ) + if input not in self.objects[ uri ]: + properties.update_prop( input, "rpn_uri", str( uri ) ) + self.objects[ uri ].append( input ) elif input is not None: input.use_count -= 1 @@ -204,13 +205,22 @@ self.swap( ) self.push_input( tos ) + def assign_( self, name, value ): + if name.find( "var:" ) == 0: name = name[ 4: ] + if name in self.locals[ -1 ].keys( ): + self.deposit( self.locals[ -1 ][ name ] ) + self.locals[ -1 ][ name ] = value + + def delete_frame( self ): + frame = self.locals.pop( -1 ) + for var in frame: + self.deposit( frame[ var ] ) + def assign( self ): op = self.pop( ) tos = self.pop( ) tos.use_count += 1 - uri = op.uri - if uri.find( "var:" ) == 0: uri = uri[ 4: ] - self.locals[ -1 ][ uri ] = tos + self.assign_( op.uri, tos ) def deref( self ): op = self.pop( ) @@ -224,7 +234,7 @@ def assign_decap( self ): op = self.stack.pop( ) tos = self.decap( ) - self.locals[ -1 ][ op.uri ] = tos + self.assign_( op.uri, tos ) def start( self ): self.defining = True @@ -297,7 +307,7 @@ elif id in self.functions.keys( ): self.locals.append( { } ) self.push_args( self.functions[ id ] ) - self.locals.pop( -1 ) + self.delete_frame( ) elif id in self.dict.keys( ): self.dict[ id ]( ) elif id in self.locals[ -1 ].keys( ): |