1: #line 103 "sink_drivers.ipk" 2: import string 3: class sink_base: 4: __class_protocols__ = ['sink','file'] 5: def __init__(self, **kwds): 6: self.lines_written = 0 7: self.last_source_file = '' 8: self.last_source_line = -1 9: self.last_inhibit_sref = 1 10: self.closed = 0 11: for k in kwds.keys(): 12: self.__dict__[k]=kwds[k] 13: 14: def raw_close(self): pass 15: def raw_flush(self): pass 16: def raw_eol(self): self.raw_write('\n') 17: def isatty(self): return 0 18: 19: def raw_writeline(self,line): 20: self.raw_write(line) 21: self.raw_eol() 22: self.lines_written = self.lines_written + 1 23: 24: def writeline(self,line): 25: self.write(line + '\n') 26: 27: def raw_writelines(self,lines): 28: for line in lines: self.raw_writeline(line) 29: 30: def writelines(self,lines): 31: self.write(string.join(lines,'')) 32: 33: def get_sink_name(self): 34: return self.name 35: 36: def write(self,text): 37: lines = string.split(text,'\n') 38: for line in lines[:-1]: 39: self.raw_writeline(line) 40: self.raw_write(lines[-1]) 41: 42: def close(self): 43: self.closed = 1 44: self.raw_close() 45: 46: def flush(self): 47: self.raw_flush 48: