[wasm-api] Clean up debugprint

This commit is contained in:
Behdad Esfahbod 2023-02-23 10:22:12 -07:00
parent 63904538c8
commit 4c8a414a10
1 changed files with 12 additions and 9 deletions

View File

@ -46,12 +46,20 @@
#include "hb-wasm-font.hh" #include "hb-wasm-font.hh"
#ifdef HB_DEBUG_WASM
namespace hb { namespace wasm {
static void
debugprint (HB_WASM_EXEC_ENV
char *the_string, uint32_t len)
{
printf("%.*s", (int) len, the_string);
}
}}
#endif
#undef module_inst #undef module_inst
#undef HB_WASM_EXEC_ENV
static void debugprint(wasm_exec_env_t exec_env, char *the_string, uint8_t len) {
printf("%.*s", len, the_string);
}
/* Define an array of NativeSymbol for the APIs to be exported. /* Define an array of NativeSymbol for the APIs to be exported.
@ -65,12 +73,7 @@ static void debugprint(wasm_exec_env_t exec_env, char *the_string, uint8_t len)
{ {
NATIVE_SYMBOL ("(i)i", font_get_face), NATIVE_SYMBOL ("(i)i", font_get_face),
#ifdef HB_DEBUG_WASM #ifdef HB_DEBUG_WASM
{ NATIVE_SYMBOL ("($i)", debugprint),
"debugprint",
(void *) debugprint,
"($i)",
NULL
}
#endif #endif
}; };
#undef NATIVE_SYMBOL #undef NATIVE_SYMBOL