libscheme48.scm 864 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. ; Part of Scheme 48 1.9. See file COPYING for notices and license.
  2. ; Authors: Martin Gasbichler, Mike Sperber
  3. ; To use libscheme48, do this from a vanilla command prompt:
  4. ; ,open libscheme48
  5. ; <load anything else you want to access from C>
  6. ; (dump-libscheme48-image "scheme48-command.image")
  7. ; Now you can link a C application against libscheme48, and do
  8. ; something like this:
  9. ;
  10. ; #include <stdio.h>
  11. ; #include "scheme48.h"
  12. ;
  13. ; int main(int argc, char ** argv)
  14. ; {
  15. ; char* a[] = {"scheme48", "-i", "scheme48-command.image"};
  16. ;
  17. ; s48_main(3, a);
  18. ;
  19. ; s48_call_scheme(...);
  20. ;
  21. ; return 0;
  22. ; }
  23. (define (start-libscheme48 args)
  24. (return-from-vm 0))
  25. (define null-continuation #f)
  26. (define (return-from-vm n)
  27. (with-continuation null-continuation (lambda () n)))
  28. (define (dump-libscheme48-image filename)
  29. (build-image start-libscheme48 filename))