Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define MZ_PRECISE_GC
- #include "scheme.h"
- #include "base.c"
- #include <stdio.h>
- #include <readline/readline.h>
- #include <readline/history.h>
- static int run(Scheme_Env *e, int argc, char *argv[])
- {
- mz_jmp_buf * volatile save = NULL, fresh;
- Scheme_Config *config = NULL;
- Scheme_Object * f, *r, * curout, *a[2] = {NULL, NULL}, *v;
- Scheme_Thread * volatile sct = scheme_get_current_thread();
- MZ_GC_DECL_REG(6);
- MZ_GC_VAR_IN_REG(0, curout);
- MZ_GC_VAR_IN_REG(1, save);
- MZ_GC_VAR_IN_REG(2, config);
- MZ_GC_VAR_IN_REG(3, r);
- MZ_GC_VAR_IN_REG(4, v);
- MZ_GC_VAR_IN_REG(5, e);
- MZ_GC_REG();
- declare_modules(e);
- v = scheme_intern_symbol("racket/base");
- scheme_namespace_require(v);
- save = sct->error_buf;
- sct->error_buf = &fresh;
- if (scheme_setjmp(fresh)) {
- printf("Error\n");
- } else {
- config = scheme_current_config();
- curout = scheme_get_param(config, MZCONFIG_OUTPUT_PORT);
- r = scheme_eval_string_all(readline("=> "), e, 1);
- if(!SCHEME_VOIDP(r))
- scheme_display(r, curout);
- scheme_display(scheme_make_char('\n'), curout);
- }
- sct->error_buf = save;
- MZ_GC_UNREG();
- return 0;
- }
- int main(int argc, char *argv[])
- {
- return scheme_main_setup(1, run, argc, argv);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement