From 02a763007df4545d2601f9661cabf1499b1836e7 Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Sun, 27 Dec 2009 01:17:32 +0900 Subject: [PATCH] moving disasm to (chibi disasm) module --- Makefile | 3 ++- README | 5 ++++- eval.c | 18 ++++++++++-------- include/chibi/config.h | 6 ------ opt/debug.c => lib/chibi/disasm.c | 30 ++++++++++++++++++------------ lib/chibi/disasm.module | 4 ++++ lib/chibi/filesystem.scm | 2 +- opcodes.c | 3 --- 8 files changed, 39 insertions(+), 32 deletions(-) rename opt/debug.c => lib/chibi/disasm.c (83%) create mode 100644 lib/chibi/disasm.module diff --git a/Makefile b/Makefile index 01e3647c..89fce44a 100644 --- a/Makefile +++ b/Makefile @@ -83,7 +83,8 @@ all: chibi-scheme$(EXE) libs COMPILED_LIBS := lib/srfi/27/rand$(SO) lib/srfi/33/bit$(SO) \ lib/srfi/69/hash$(SO) lib/srfi/98/env$(SO) lib/chibi/ast$(SO) \ lib/chibi/net$(SO) lib/chibi/filesystem$(SO) lib/chibi/process$(SO) \ - lib/chibi/time$(SO) lib/chibi/system$(SO) lib/chibi/heap-stats$(SO) + lib/chibi/time$(SO) lib/chibi/system$(SO) lib/chibi/heap-stats$(SO) \ + lib/chibi/disasm$(SO) libs: $(COMPILED_LIBS) diff --git a/README b/README index 7c399df0..cfbdc524 100644 --- a/README +++ b/README @@ -72,7 +72,10 @@ The essential functions to remember are: A minimal module system is provided by default. Currently you can load the following SRFIs with (import (srfi N)): - 1, 2, 6, 8, 9, 11, 16, 26, 69 + 0, 1, 2, 6, 8, 9, 11, 16, 26, 27, 33, 46, 62, 69, 98 + +although 0, 46 and 62 are built into the default environment so +there's no need to import them. LOAD is extended to accept an optional environment argument, like EVAL. You can also LOAD shared libraries in addition to Scheme source diff --git a/eval.c b/eval.c index 0c87270d..e5cf340c 100644 --- a/eval.c +++ b/eval.c @@ -8,12 +8,16 @@ static int scheme_initialized_p = 0; -#if SEXP_USE_DEBUG -#include "opt/debug.c" -#else -#define print_stack(...) -#define print_bytecode(...) -#define sexp_disasm(...) +#if SEXP_USE_DEBUG_VM +static void sexp_print_stack (sexp ctx, sexp *stack, int top, int fp, sexp out) { + int i; + if (! sexp_oport(out)) out = sexp_current_error_port(ctx); + for (i=0; i