Skip to content

Instantly share code, notes, and snippets.

@actondev
Created August 5, 2020 23:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save actondev/41067d7028051b7795b7f05c2d0f033b to your computer and use it in GitHub Desktop.
Save actondev/41067d7028051b7795b7f05c2d0f033b to your computer and use it in GitHub Desktop.
s7 wasm example
#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;
}
@actondev
Copy link
Author

actondev commented Aug 5, 2020

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

@iainctduncan
Copy link

Fantastic! Can't wait to try. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment