| 2759 | return output |
| 2760 | |
| 2761 | def process_word(self): |
| 2762 | output = '' |
| 2763 | if self.buffer[0] == ord('i'): |
| 2764 | self.i = min(99, int(self.buffer[1:] or 0)) # set input length |
| 2765 | elif self.buffer[0] == ord('o'): |
| 2766 | self.o = min(99, int(self.buffer[1:] or 0)) # set output length |
| 2767 | else: |
| 2768 | output = self.buffer.decode('ascii') |
| 2769 | if len(output) < self.o: |
| 2770 | output += '-'*self.o # pad out with hyphens |
| 2771 | if self.o: |
| 2772 | output = output[:self.o] # truncate to output length |
| 2773 | output += '.' |
| 2774 | self.buffer = bytearray() |
| 2775 | return output |
| 2776 | |
| 2777 | codecEnabled = False |
| 2778 | |