| 99 | return output |
| 100 | |
| 101 | def process_word(self): |
| 102 | output = '' |
| 103 | if self.buffer[0] == ord('i'): |
| 104 | self.i = min(99, int(self.buffer[1:] or 0)) # set input length |
| 105 | elif self.buffer[0] == ord('o'): |
| 106 | self.o = min(99, int(self.buffer[1:] or 0)) # set output length |
| 107 | else: |
| 108 | output = self.buffer.decode('ascii') |
| 109 | if len(output) < self.o: |
| 110 | output += '-'*self.o # pad out with hyphens |
| 111 | if self.o: |
| 112 | output = output[:self.o] # truncate to output length |
| 113 | output += '.' |
| 114 | self.buffer = bytearray() |
| 115 | return output |
| 116 | |
| 117 | codecEnabled = False |
| 118 | |