testing string debug

This commit is contained in:
Stewart Allen 2021-07-11 12:41:24 -04:00
commit aea377a0fa
3 changed files with 24 additions and 6 deletions

View file

@ -16,7 +16,7 @@ Uint8 debug = 0;
extern "C" {
extern void polygon(Uint32 points, Uint32 inners);
extern void point(Uint32 x, Uint32 y);
extern void abc(Uint32 a, Uint32 b, Uint32 c);
extern void ostr(Uint32 len, std::string str);
}
struct length16 {
@ -55,12 +55,10 @@ Uint32 readPoly(Path &path, Uint32 pos) {
Uint32 readPolys(Paths &paths, Uint32 pos, Uint32 count) {
Uint32 poly = 0;
// if (debug) abc(poly, count, pos);
while (count > 0) {
pos = readPoly(paths[poly++], pos);
count--;
}
// if (debug) abc(poly, count, pos);
return pos;
}
@ -193,3 +191,12 @@ __attribute__ ((export_name("set_debug")))
void set_debug(Uint8 value) {
debug = value;
}
__attribute__ ((export_name("test_string")))
void test_string(Uint8 value) {
// Creating a string from const char*
std::string str1 = "hello";
//std::string str1 = std::format("{} {}", "hello", value);
ostr(str1.length(), str1);
}

View file

@ -4,7 +4,7 @@ kiri-sla.wasm: kiri-sla.c
emcc --no-entry -o kiri-sla.wasm kiri-sla.c -O3 -s ERROR_ON_UNDEFINED_SYMBOLS=0
kiri-geo.wasm: kiri-geo.cpp
emcc --no-entry -o kiri-geo.wasm clipper.cpp kiri-geo.cpp -Oz -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s TOTAL_MEMORY=40mb
emcc --no-entry -o kiri-geo.wasm clipper.cpp kiri-geo.cpp -Oz -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s TOTAL_MEMORY=40mb -std=c++20
kiri-ani.wasm: kiri-ani.c
emcc --no-entry -o kiri-ani.wasm kiri-ani.c -O3 -s ERROR_ON_UNDEFINED_SYMBOLS=0