Export main functions read, eval and evalString to a object lisp.
authorDavid Vazquez <davazp@gmail.com>
Sat, 22 Dec 2012 05:13:03 +0000 (05:13 +0000)
committerDavid Vazquez <davazp@gmail.com>
Sat, 22 Dec 2012 05:13:03 +0000 (05:13 +0000)
test.lisp

index 5687aa9..737165a 100644 (file)
--- a/test.lisp
+++ b/test.lisp
 
 
 (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.
     (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*))