Changeset 876
- Timestamp:
- 06/27/07 03:03:57 (2 years ago)
- Files:
-
- 1 modified
-
trunk/jahtools/jbatch/jstack.py (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/jahtools/jbatch/jstack.py
r852 r876 94 94 if op.input is None: 95 95 uri = op.uri 96 if not self.objects.has_key( uri ): 97 self.objects[ uri ] = [ ] 98 instances = self.objects[ uri ] 96 if self.objects.has_key( uri ): 97 instances = self.objects[ uri ] 98 else: 99 instances = [] 99 100 if len( instances ) > 0: 100 101 result = instances.pop( ) 102 if result is not None: 103 result.use_count += 1 101 104 elif uri.find( "var:" ) == 0: 102 105 result = operands.input_operand( unicode( uri[ 4: ] ), op ) … … 107 110 elif uri.find( "filter:" ) == 0: 108 111 result = openmedialib.create_filter( str( uri[ 7: ] ) ) 112 if result is not None: 113 result.use_count = 1 109 114 else: 110 115 # Special case for images … … 117 122 if result is None or result.get_frames( ) == 0: 118 123 result = None 124 else: 125 result.use_count = 1 126 119 127 if result is not None: 120 128 properties.update_prop( result, "rpn_uri", str( uri ) ) 121 result.use_count = 0122 129 else: 123 130 result = operands.input_operand( unicode( uri ), op ) 124 result.use_count = 0125 131 else: 126 132 result = op.input … … 128 134 129 135 def deposit( self, input ): 136 if input is None or not hasattr( input, "use_count" ): 137 return 138 uri = str( properties.retrieve_uri( input ) ) 130 139 if input is not None and input.use_count == 0: 131 140 i = 0 … … 135 144 i += 1 136 145 if input.reuse( ): 137 uri = properties.retrieve_uri( input ) 146 uri = str( properties.retrieve_uri( input ) ) 147 if not self.objects.has_key( uri ): 148 self.objects[ uri ] = [ ] 138 149 if input not in self.objects[ uri ]: 139 150 properties.update_prop( input, "rpn_uri", str( uri ) ) 140 151 self.objects[ uri ].append( input ) 141 elif input is not None:142 input.use_count -= 1143 152 144 153 def clear( self, **args ): … … 236 245 if name.find( "var:" ) == 0: name = name[ 4: ] 237 246 if name in self.locals[ -1 ].keys( ): 247 if hasattr( self.locals[ -1 ][ name ], "use_count" ): self.locals[ -1 ][ name ].use_count -= 1 238 248 self.deposit( self.locals[ -1 ][ name ] ) 239 249 self.locals[ -1 ][ name ] = value 250 if hasattr( value, "use_count" ): value.use_count += 1 240 251 241 252 def delete_frame( self ): … … 247 258 op = self.pop( ) 248 259 tos = self.pop( ) 249 tos.use_count += 1250 260 self.assign_( op.uri, tos ) 251 261 … … 253 263 op = self.pop( ) 254 264 tos = self.pop( ) 255 tos.use_count += 2265 tos.use_count += 1 256 266 self.push_input( tos ) 257 267 self.assign_( op.uri, tos ) … … 418 428 419 429 def push_input( self, input, incref = True, **args ): 420 if incref andhasattr( input, "use_count" ): input.use_count += 1430 if hasattr( input, "use_count" ): input.use_count += 1 421 431 id = properties.retrieve_uri( input ) 422 432 self.stack.append( operands.operand( id, input ) ) … … 435 445 while slot > 0: 436 446 slot -= 1 437 if result.fetch_slot( slot ) is not None: 438 self.push_input( result.fetch_slot( slot ) ) 439 result.connect( self.pop( ), slot ) 447 if result.fetch_slot( slot ) is None: 448 result.connect( self.pop( ), slot ) 440 449 op.assign( result ) 441 450 properties.update_prop( result, "rpn_length", result.get_frames( ) ) 442 451 properties.update_prop( result, "rpn_props", [] + op.properties ) 443 452 result.register( op.callback ) 453 if hasattr( result, "use_count" ): result.use_count -= 1 444 454 else: 445 455 result = operands.input_operand( op.uri, op )
