Skip to content

Commit

Permalink
implement encode memory wtf8
Browse files Browse the repository at this point in the history
  • Loading branch information
xujuntwt95329 committed Oct 16, 2023
1 parent ae746d6 commit fcc84c6
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions runtime-library/stringref/stringref_qjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,17 @@ wasm_stringref_obj_encode_with_8bit_memory(struct WASMExecEnv *exec_env,
WASMStringrefObjectRef stringref_obj,
encoding_flag flag)
{
wasm_module_inst_t module_inst = wasm_exec_env_get_module_inst(exec_env);
wasm_runtime_set_exception(module_inst, "unimplemented");
return 0;
dyn_ctx_t dyn_ctx = dyntype_get_context();
dyn_value_t str_obj =
(dyn_value_t)wasm_stringref_obj_get_value(stringref_obj);
uint32_t str_len = 0;

char *str = NULL;
dyntype_to_cstring(dyn_ctx, str_obj, &str);
str_len = strlen(str);

bh_memcpy_s(maddr, str_len, str, str_len);
return str_len;
}

/* string.encode_wtf16 */
Expand Down

0 comments on commit fcc84c6

Please sign in to comment.