From 50ab2379541037d18ecceae85e059dbf9d40d8f4 Mon Sep 17 00:00:00 2001 From: David Vazquez Date: Sat, 22 Dec 2012 05:13:03 +0000 Subject: [PATCH] Export main functions read, eval and evalString to a object lisp. --- test.lisp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/test.lisp b/test.lisp index 5687aa9..737165a 100644 --- a/test.lisp +++ b/test.lisp @@ -946,7 +946,10 @@ (defun eval (x) - (js-eval (ls-compile x nil nil))) + (let ((code + (with-compilation-unit + (ls-compile-toplevel x nil nil)))) + (js-eval code))) ;; Set the initial global environment to be equal to the host global ;; environment at this point of the compilation. @@ -956,5 +959,11 @@ (setq *toplevel-compilations* (append *toplevel-compilations* (list c1 c2))))) -(with-compilation-unit - (debug (lookup-function 'eval nil))) + +(js-eval + (concat "var lisp = {};" + "lisp.eval = " (lookup-function-translation 'eval nil) ";" *newline* + "lisp.read = " (lookup-function-translation 'ls-read-from-string nil) ";" *newline* + "lisp.evalString = function(str){" *newline* + " return lisp.eval(lisp.read(str));" *newline* + "}" *newline*)) -- 1.7.10.4