User commands may read symbols from this dictionary, and may modify the objects to which the symbol names refer, but are protected from rebinding the names to other objects or values.
The organisation of the process frame is currently haphazard and may change from version to version.
Make an object to hold global variables that user objects can hang onto, to ensure these variables live during the execution of the object destructors.
1: #line 22 "process_frame.ipk" 2: # Note this definition must go here to avoid circular module imports 3: class process_fault(SystemExit): pass 4: 5: from interscript.frames.site import site_frame 6: from interscript.frames.platform import platform 7: from interscript.frames.masterf import master_frame 8: from interscript.drivers.sources.base import eoi 9: import sys 10: import traceback 11: import time 12: import string 13: 14: class process_frame: 15: def __init__(self, global_frame, process_options, argument_frames): 16: self.global_frame = global_frame 17: self.process_options = process_options 18: self.argument_frames = argument_frames 19: 20: self.trace = self.process_options.trace 21: self.break_on_error = process_options.break_on_error 22: self.debug_constructors = 0 23: self.debug_destructors = 0 24: self.update_files = 1 25: 26: self.site = site_frame(platform) 27: # self.site.print_install() 28: self.objects = {} 29: 30: def __del__(self): 31: #print 'PROCESS TERMINATING' 32: if self.objects: 33: print 'UNDELETED OBJECTS!!',self.objects 34: 35: def run(self): 36: oldstdout = sys.stdout 37: oldstderr = sys.stderr 38: f = self.process_options.logfile 39: m = self.process_options.logfile_mode 40: if self.process_options.logfile: 41: try: 42: sys.stderr = sys.stdout = open(f,m) 43: except IOError: 44: print 'Cannot open specified logfile',f 45: except: 46: print 'Weird error opening specified logfile',f 47: traceback.print_exc() 48: 49: reference_date = time.time() 50: local_time = time.localtime(reference_date) 51: local_time_string = time.strftime("%a %d %b, %Y %H:%M:%S (%Z)",local_time) 52: start_time = time.clock() 53: if m: print '<CDATA>' 54: print 55: print '---------------------------------' 56: print 'Interscript '+self.global_frame.version +\ 57: '['+str(self.global_frame.buildno)+'] Process',local_time_string 58: 59: try: 60: for argument_frame in self.argument_frames: 61: master_frame(self,argument_frame) 62: finally: 63: end_time = time.clock() 64: elapsed_time = end_time - start_time 65: print 'Elapsed Process Time',int(elapsed_time),'seconds' 66: print '================================' 67: print 68: sys.stdout = oldstdout 69: sys.stderr = oldstderr 70: 71: def get_process_frame(self): 72: "Get the current process frame" 73: return self 74: