(defun concat (&rest strs)
(!reduce #'concat-two strs :initial-value ""))
-
(defun values-list (list)
(values-array (list-to-vector list)))
(defun aset (array idx value)
(setf (aref array idx) value))
-(defun concat (&rest strs)
- (apply #'concatenate 'string strs))
+(eval-when-compile
+ (defun concat (&rest strs)
+ (apply #'concatenate 'string strs)))
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
-(eval-when (:load-toplevel :compile-toplevel :execute)
- (defvar *source*
- '(("boot.lisp" :target)
- ("compat" :host)
- ("utils.lisp" :both)
- ("print.lisp" :both)
- ("read.lisp" :both)
- ("compiler.lisp" :both)
- ("toplevel.lisp" :target)))
+(defvar *source*
+ '(("boot" :target)
+ ("compat" :host)
+ ("utils" :both)
+ ("print" :target)
+ ("read" :both)
+ ("compiler" :both)
+ ("toplevel" :target)))
+;;; Compile ecmalisp into the host
+(with-compilation-unit ()
(dolist (input *source*)
(when (member (cadr input) '(:host :both))
- (load (car input)))))
+ (compile-file (car input)))))
+
+;;; Load ecmalisp into the host
+(dolist (input *source*)
+ (when (member (cadr input) '(:host :both))
+ (load (car input))))
(defun read-whole-file (filename)
(with-open-file (in filename)
(write-string (read-whole-file "prelude.js") out)
(dolist (input *source*)
(when (member (cadr input) '(:target :both))
- (ls-compile-file (car input) out)))))
+ (let ((file (make-pathname :type "lisp" :defaults (car input))))
+ (ls-compile-file file out))))))
;;; Printer
-(defvar *newline* (string (code-char 10)))
-
-(defun !print1-to-string (form)
+(defun prin1-to-string (form)
(cond
((symbolp form)
(multiple-value-bind (symbol foundp)
(t
(concat "#<javascript object>"))))
+(defun write-line (x)
+ (write-string x)
+ (write-string *newline*)
+ x)
-#+ecmalisp
-(progn
- (defun prin1-to-string (form)
- (!print1-to-string form))
-
- (defun write-line (x)
- (write-string x)
- (write-string *newline*)
- x)
-
- (defun warn (string)
- (write-string "WARNING: ")
- (write-line string))
+(defun warn (string)
+ (write-string "WARNING: ")
+ (write-line string))
- (defun print (x)
- (write-line (prin1-to-string x))
- x))
+(defun print (x)
+ (write-line (prin1-to-string x))
+ x)
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+(defvar *newline* (string (code-char 10)))
+
(defmacro concatf (variable &body form)
`(setq ,variable (concat ,variable (progn ,@form))))