Skip to content

Instantly share code, notes, and snippets.

Created September 21, 2012 23:39
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save anonymous/3764529 to your computer and use it in GitHub Desktop.
simple racket 3m embed
#include <stdio.h>
#include "scheme.h"
static __declspec(thread) void *tls_space;
static int run(Scheme_Env *e, int argc, char *argv[])
{
Scheme_Object *curout = NULL, *v = NULL, *a[2] = {NULL, NULL};
Scheme_Config *config = NULL;
int i;
mz_jmp_buf * volatile save = NULL, fresh;
MZ_GC_DECL_REG(8);
MZ_GC_VAR_IN_REG(0, e);
MZ_GC_VAR_IN_REG(1, curout);
MZ_GC_VAR_IN_REG(2, save);
MZ_GC_VAR_IN_REG(3, config);
MZ_GC_VAR_IN_REG(4, v);
MZ_GC_ARRAY_VAR_IN_REG(5, a, 2);
MZ_GC_REG();
Scheme_Object * collectPath = scheme_make_path("%RACKETDIR%\\collects");
Scheme_Object * collectPathList = scheme_build_list(1, &collectPath);
scheme_init_collection_paths(e, collectPathList);
v = scheme_intern_symbol("racket/base");
scheme_namespace_require(v);
MZ_GC_UNREG();
return 0;
}
int main(int argc, char *argv[])
{
scheme_register_tls_space(&tls_space, 0);
return scheme_main_setup(1, run, argc, argv);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment