Example #1
0
def print_as_hex(block_codepoints):
    line = ""
    for block in block_codepoints:
        byte_no = bits2codepoint(block)
        character = chr(byte_no)
        line += hex(byte_no)
    print line
Example #2
0
def print_block_table(block_codepoints):
    for block in block_codepoints:
        byte_no = bits2codepoint(block)
        character = chr(byte_no)
        print "%s %4s %3s %s" % (
            list2str(block), hex(byte_no), byte_no, repr(character)
        )
Example #3
0
def print_as_hex(block_codepoints):
    line = ""
    for block in block_codepoints:
        byte_no = bits2codepoint(block)
        character = chr(byte_no)
        line += hex(byte_no)
    print line
Example #4
0
    def write_codepoint(self, codepoints):
        written_codepoints = []
        bits = []
        for bit in codepoints2bitstream(codepoints):
            bits.append(bit)
            if len(bits) == 8:
                written_codepoints.append(bits2codepoint(bits))
                bits = []
                
            if bit == 0:
#                 wavefile.writeframes(self.bit_nul_samples)
                self.wavefile.writeframes(self.bit_nul_samples)
            elif bit == 1:
#                 wavefile.writeframes(self.bit_one_samples)
                self.wavefile.writeframes(self.bit_one_samples)
            else:
                raise TypeError
        log.debug("Written at %s: %s" % (
            self.pformat_pos(), ",".join([hex(x) for x in written_codepoints])
        ))
Example #5
0
def print_block_table(block_codepoints):
    for block in block_codepoints:
        byte_no = bits2codepoint(block)
        character = chr(byte_no)
        print "%s %4s %3s %s" % (list2str(block), hex(byte_no), byte_no,
                                 repr(character))