(defun bootstrap ()
- (let ((*package* (find-package "JSCL")))
+ (let ((*features* (cons :jscl *features*))
+ (*package* (find-package "JSCL")))
(setq *environment* (make-lexenv))
(setq *literal-table* nil)
(setq *variable-counter* 0
(incf index))
output)))
-#+common-lisp
+#-jscl
(defun indent (&rest string)
(with-output-to-string (*standard-output*)
(with-input-from-string (input (apply #'code string))
;;; evaluated. For this reason we define a valid macro-function for
;;; this symbol.
(defvar *magic-unquote-marker* (gensym "MAGIC-UNQUOTE"))
-#+common-lisp
+#-jscl
(setf (macro-function *magic-unquote-marker*)
(lambda (form &optional environment)
(declare (ignore environment))
(code "l" (incf *literal-counter*)))
(defun dump-symbol (symbol)
- #+common-lisp
+ #-jscl
(let ((package (symbol-package symbol)))
(if (eq package (find-package "KEYWORD"))
(code "(new Symbol(" (dump-string (symbol-name symbol)) ", " (dump-string (package-name package)) "))")
`(%js-vref ,var))))
-#+common-lisp
+#-jscl
(defvar *macroexpander-cache*
(make-hash-table :test #'eq))
(if (and b (eq (binding-type b) 'macro))
(let ((expander (binding-value b)))
(cond
- #+common-lisp
+ #-jscl
((gethash b *macroexpander-cache*)
(setq expander (gethash b *macroexpander-cache*)))
((listp expander)
;; function with the compiled one.
;;
#+jscl (setf (binding-value b) compiled)
- #+common-lisp (setf (gethash b *macroexpander-cache*) compiled)
+ #-jscl (setf (gethash b *macroexpander-cache*) compiled)
(setq expander compiled))))
expander)
nil)))
(concat (translate-function function) arglist))
((and (symbolp function)
#+jscl (eq (symbol-package function) (find-package "COMMON-LISP"))
- #+common-lisp t)
+ #-jscl t)
(code (ls-compile `',function) ".fvalue" arglist))
(t
(code (ls-compile `#',function) arglist)))))
((string= cname "tab") #\tab)
((string= cname "newline") #\newline)
(t (char cname 0)))))
- ((char= ch #\+)
+ ((or (char= ch #\+)
+ (char= ch #\-))
(let ((feature (let ((symbol (ls-read stream eof-error-p eof-value t)))
(unless (symbolp symbol)
(error "Invalid feature ~S" symbol))
(intern (string symbol) "KEYWORD"))))
- (ecase feature
- (:common-lisp
- (ls-read stream)
- (ls-read stream eof-error-p eof-value t))
- (:jscl
- (ls-read stream eof-error-p eof-value t))
- (:nil
- (ls-read stream)
- (ls-read stream eof-error-p eof-value t)))))
+ (if (eql (char= ch #\+)
+ (and (find feature *features*) t))
+ (ls-read stream eof-error-p eof-value t)
+ (prog2 (ls-read stream)
+ (ls-read stream eof-error-p eof-value t)))))
((and ch (digit-char-p ch))
(let ((id (digit-char-p ch)))
(while (and (%peek-char stream)