The pass loop moves the identifier list, input and output file lists, and table of contents from the pass frame to the master frame after each pass. This permits this data to be read by the next pass (while it is also regenerating the data for the pass after that).
Conceptually, the loop is said to converge when this data is the same twice in a row. However we do not test this yet because the state information is not complete.
To be complete, it must determine whether the input and output files have changed between passes. This will be done by comparing the file lists, and comparing the last modification dates on the files between passes.
Finally, output to simple files will be ignored. It is necessary to also add user controlled hooks into the convergence tests, because user script can have arbitrary side effects.
35: #line 80 "master_frame.ipk" 36: for passno in range(self.passes): 37: curpass = pass_frame(self, passno) 38: self.ids = curpass.ids # idlist 39: self.flist = curpass.flist # output file list 40: self.iflist = curpass.iflist # input file list 41: self.toc = curpass.toc # table of contents 42: self.include_files = curpass.include_files # include files 43: self.classes = curpass.classes # classes 44: self.functions = curpass.functions # functions 45: self.tests = curpass.tests # functions 46: 47: if self.sequence_limit == -1: 48: self.sequence_limit = curpass.sequence 49: elif self.sequence_limit != curpass.sequence: 50: print 'WARNING: SEQUENCE COUNTER DISPARITY BETWEEN PASSES' 51: ds = curpass.fdict 52: dd = self.fdict 53: 54: file_count = 0 55: stable_file_count = 0 56: unstable_file_count = 0 57: new_file_count = 0 58: for k in ds.keys(): 59: file_count = file_count + 1 60: if not dd.has_key(k): 61: dd[k]=(ds[k],passno) 62: new_file_count = new_file_count + 1 63: else: 64: if ds[k]=='unchanged': 65: stable_file_count = stable_file_count + 1 66: else: 67: unstable_file_count = unstable_file_count + 1 68: if ds[k]!='unchanged' or dd[k][0]!='unchanged': 69: dd[k]=(ds[k],passno) 70: converged = file_count == stable_file_count 71: if converged: 72: print 'All',file_count,'output files stable on pass',passno,' -- breaking' 73: break 74: else: 75: print 'Of',file_count,'files, only',stable_file_count,'were stable on pass',passno 76: print 'There were',new_file_count,'new files,' 77: print 'and',unstable_file_count,'unstable files.' 78: try: 79: cache = open(self.cache_name,'w') 80: pickle.dump(self.persistent_frames, cache) 81: cache.close() 82: del cache 83: print 'Pickled persistent frames in', self.cache_name 84: except: 85: print 'Pickle FAILURE' 86: 87: def get_master_frame(self): return self 88: 89: def get_persistent_frame(self, seq): 90: if not self.persistent_frames.has_key(seq): 91: self.persistent_frames[seq]={} 92: return self.persistent_frames[seq] 93: