feat(compiler): Add support for targeting WebAssembly.

The working principle is similar as before with x86, but instead of outputting .asm, it outputs .wat. This can be compiled into .wasm by using the wat2wasm assembler.
This commit is contained in:
Veikko Sariola
2020-12-26 23:16:18 +02:00
parent 7e4bcf18e4
commit e4490faa2e
32 changed files with 2138 additions and 170 deletions

View File

@ -34,6 +34,17 @@ int main(int argc, char* argv[]) {
su_render_song(buf);
#if defined (_WIN32)
CreateDirectory(actual_output_folder, NULL);
#else
mkdir(actual_output_folder, 0777);
#endif
snprintf(filename, sizeof filename, "%s%s%s", actual_output_folder, test_name, ".raw");
f = fopen(filename, "wb");
fwrite((void*)buf, sizeof(SUsample), SU_BUFFER_LENGTH, f);
fclose(f);
snprintf(filename, sizeof filename, "%s%s%s", expected_output_folder, test_name, ".raw");
f = fopen(filename, "rb");
@ -79,16 +90,6 @@ int main(int argc, char* argv[]) {
printf("Warning: Sointu rendered almost correct wave, but a small maximum error of %f\n",max_diff);
}
#if defined (_WIN32)
CreateDirectory(actual_output_folder, NULL);
#else
mkdir(actual_output_folder, 0777);
#endif
snprintf(filename, sizeof filename, "%s%s%s", actual_output_folder, test_name, ".raw");
f = fopen(filename, "wb");
fwrite((void*)buf, sizeof(SUsample), SU_BUFFER_LENGTH, f);
fclose(f);
return 0;
fail: