MCPcopy Create free account
hub / github.com/WebAssembly/wabt / Hexdump

Function Hexdump

test/utils.py:134–167  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

132
133
134def Hexdump(data):
135 DUMP_OCTETS_PER_LINE = 16
136 DUMP_OCTETS_PER_GROUP = 2
137
138 p = 0
139 end = len(data)
140 lines = []
141 while p < end:
142 line_start = p
143 line_end = p + DUMP_OCTETS_PER_LINE
144 line = '%07x: ' % p
145 while p < line_end:
146 for i in range(DUMP_OCTETS_PER_GROUP):
147 if p < end:
148 line += '%02x' % data[p]
149 else:
150 line += ' '
151 p += 1
152 line += ' '
153 line += ' '
154 p = line_start
155 for i in range(DUMP_OCTETS_PER_LINE):
156 if p >= end:
157 break
158 x = data[p]
159 if x >= 32 and x < 0x7f:
160 line += '%c' % x
161 else:
162 line += '.'
163 p += 1
164 line += '\n'
165 lines.append(line)
166
167 return lines
168
169
170def GetModuleFilenamesFromSpecJSON(json_filename):

Callers 1

mainFunction · 0.90

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected