X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Ftoplevel.lisp;h=99d3b390f4758bf2123dea07d592021a53f8781b;hb=4efabd20920397dd776864189550a8a87e666152;hp=04423d36ed39af93b772a58a85d327e1676f45e1;hpb=7ac8be51e59d3d209b6e37204f6b139b26c6d912;p=jscl.git diff --git a/src/toplevel.lisp b/src/toplevel.lisp index 04423d3..99d3b39 100644 --- a/src/toplevel.lisp +++ b/src/toplevel.lisp @@ -16,6 +16,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with JSCL. If not, see . +(/debug "loading toplevel.lisp!") (defun eval (x) (js-eval (ls-compile-toplevel x t))) @@ -249,14 +250,16 @@ (setq *package* *user-package*) +(defvar *root* (%js-vref "window")) + ;;; Set some external entry point to the Lisp implementation to the ;;; console. It would not be necessary when FFI is finished. -(js-eval "var lisp") -(%js-vset "lisp" (new)) -(%js-vset "lisp.read" #'ls-read-from-string) -(%js-vset "lisp.print" #'prin1-to-string) -(%js-vset "lisp.eval" #'eval) -(%js-vset "lisp.compile" (lambda (s) (ls-compile-toplevel s t))) -(%js-vset "lisp.evalString" (lambda (str) (eval (ls-read-from-string str)))) -(%js-vset "lisp.evalInput" (lambda (str) (eval-interactive (ls-read-from-string str)))) -(%js-vset "lisp.compileString" (lambda (str) (ls-compile-toplevel (ls-read-from-string str) t))) +(let ((*root* #j:lisp)) + (setf #j:read #'ls-read-from-string) + (setf #j:print #'prin1-to-string) + (setf #j:eval #'eval) + (setf #j:compile (lambda (s) (ls-compile-toplevel s t))) + (setf #j:evalString (lambda (str) (eval (ls-read-from-string str)))) + (setf #j:evalInput (lambda (str) (eval-interactive (ls-read-from-string str)))) + (setf #j:compileString (lambda (str) (ls-compile-toplevel (ls-read-from-string str) t)))) +