45: #line 278 "tanglers.ipk"
46:
47: class c_string_tangler(tangler_base):
48: def __init__(self,sink,weaver,eol,width):
49: print 'Initialising c string tangler, eol=',eol,'width=',width
50: tangler_base.__init__(self,sink,weaver)
51: self.eol=eol
52: self.width=width
53: self.language = 'C string'
54:
55: def writeline(self,data,file,count,inhibit_sref=0):
56: data = string.rstrip(data)
57: if self.width > 0: data = string.ljust(data, self.width)
58: line = '"'
59: for ch in data:
60: if ch in '\\"': line = line + '\\' + ch
61: else: line = line + ch
62: line = line + self.eol + '"'
63: self._writeline(line)
64: self.weaver.writeline(data)
65: