Created
August 5, 2020 23:40
-
-
Save actondev/41067d7028051b7795b7f05c2d0f033b to your computer and use it in GitHub Desktop.
s7 wasm example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "s7.h" | |
#include <stdio.h> | |
void _s7_print_stderr(s7_scheme *sc, uint8_t c, s7_pointer port) { | |
printf("%c", c); | |
} | |
int main() { | |
printf("hello, world!\n"); | |
s7_scheme* sc = s7_init(); | |
s7_set_current_output_port(sc, s7_open_output_function(sc, _s7_print_stderr)); | |
s7_eval_c_string(sc, "(format #t \"result is ~A\n\" (+ 1 2 3))"); | |
return 0; | |
} |
Or, the "fix" for popen (or throw some error actually)
static s7_pointer g_system(s7_scheme *sc, s7_pointer args)
{
#define H_system "(system command) executes the command. If the optional second argument is #t, \
system captures the output as a string and returns it."
#define Q_system s7_make_signature(sc, 3, s7_make_signature(sc, 2, sc->is_integer_symbol, sc->is_string_symbol), sc->is_string_symbol, sc->is_boolean_symbol)
+#ifdef __EMSCRIPTEN__
+ return s7_nil(sc);
+#else
Fantastic! Can't wait to try. :-)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
emcc -v