From 68d034d7ebacedca736f0f7eb44d838552bef317 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 13 Jun 2005 01:52:36 +0000 Subject: [PATCH] fix namespace bug in meta-interpreter --- TODO.FACTOR.txt | 1 - library/test/interpreter.factor | 21 +++++++++++++++++++++ library/tools/interpreter.factor | 5 +++-- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index af3e9616bf..5f6f3e5cce 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -7,7 +7,6 @@ http://clozure.com/cgi-bin/viewcvs.cgi/ccl/lisp-kernel/lisp-exceptions.c?rev=1.9&content-type=text/vnd.viewcvs-markup if write returns -1 and errno == EINTR then it's not a real error, you can try again -- single-stepper and variable access: wrong namespace? - http keep alive, and range get - sleep word - fix i/o on generic x86/ppc unix diff --git a/library/test/interpreter.factor b/library/test/interpreter.factor index ff82cf419e..c0e8ba49cd 100644 --- a/library/test/interpreter.factor +++ b/library/test/interpreter.factor @@ -1,4 +1,5 @@ IN: temporary +USING: unparser ; USE: vectors USE: interpreter USE: test @@ -63,6 +64,26 @@ USE: sequences [ 2 2 + ] test-interpreter ] unit-test +[ { 3 } ] [ + [ 3 "x" set "x" get ] test-interpreter +] unit-test + +[ { } ] [ + [ 2 2 + . ] test-interpreter +] unit-test + +[ { "hi\n" } ] [ + [ [ "hi" print ] with-string ] test-interpreter +] unit-test + +[ { "4\n" } ] [ + [ [ 2 2 + unparse print ] with-string ] test-interpreter +] unit-test + +[ { "4" } ] [ + [ [ 0 2 2 + prettyprint* drop ] with-string ] test-interpreter +] unit-test + [ { "4\n" } ] [ [ [ 2 2 + . ] with-string ] test-interpreter ] unit-test diff --git a/library/tools/interpreter.factor b/library/tools/interpreter.factor index 30443ef8c7..f61b01fba3 100644 --- a/library/tools/interpreter.factor +++ b/library/tools/interpreter.factor @@ -1,8 +1,8 @@ ! Copyright (C) 2004, 2005 Slava Pestov. ! See http://factor.sf.net/license.txt for BSD license. IN: interpreter -USING: errors kernel lists math namespaces prettyprint sequences -stdio strings vectors words ; +USING: errors kernel kernel-internals lists math namespaces +prettyprint sequences stdio strings vectors words ; ! A Factor interpreter written in Factor. Used by compiler for ! partial evaluation, also by the walker. @@ -93,5 +93,6 @@ SYMBOL: meta-executing \ call [ pop-d meta-call ] set-meta-word \ execute [ pop-d meta-word ] set-meta-word \ ifte [ pop-d pop-d pop-d [ nip ] [ drop ] ifte meta-call ] set-meta-word +\ dispatch [ pop-d pop-d swap nth meta-call ] set-meta-word \ set-meta-word forget