Fix wasm core spec 1.1 names test

extensions
Volodymyr Shymanskyy 4 years ago
parent 4faf3a12d3
commit 9708b5367e

@ -156,8 +156,8 @@ void unescape(char* buff)
case 't': *outp++ = '\t'; break;
case 'x': {
char hex[3] = { *(buff+2), *(buff+3), '\0' };
*outp++ = strtol(hex, NULL, 16);
buff += 2;
*outp = strtol(hex, NULL, 16);
buff += 2; outp += 1;
break;
}
// Otherwise just pass the letter
@ -284,7 +284,7 @@ int main (int i_argc, const char* i_argv[])
while (argRepl)
{
char cmd_buff[1024] = { 0, };
char cmd_buff[2048] = { 0, };
char* argv[32] = { 0, };
fprintf(stdout, "wasm3> ");
fflush(stdout);

@ -89,23 +89,14 @@ def binaryToFloat(num, t):
else:
fatal(f"Unknown type '{t}'")
def escape(s):
c = ord(s)
if c < 128 and s.isprintable() and not s in " \n\r\t\\":
return s
if c <= 0xff:
return r'\x{0:02x}'.format(c)
elif c <= 0xffff:
return r'\u{0:04x}'.format(c)
else:
return r'\U{0:08x}'.format(c)
def escape_str(s):
if s == "":
return r'\x00'
return ''.join(escape(c) for c in s)
if all((ord(c) < 128 and c.isprintable() and not c in " \n\r\t\\") for c in s):
return s
return '\\x' + '\\x'.join('{0:02x}'.format(x) for x in s.encode('utf-8'))
#
# Value format options

Loading…
Cancel
Save