;;; compiler.lisp ---
-;; Copyright (C) 2012, 2013 David Vazquez
+;; copyright (C) 2012, 2013 David Vazquez
;; Copyright (C) 2012 Raimon Grau
;; This program is free software: you can redistribute it and/or
;;; of this function are available, because the Ecmalisp version is
;;; very slow and bootstraping was annoying.
-#+ecmalisp
+#+jscl
(defun indent (&rest string)
(let ((input (apply #'code string)))
(let ((output "")
(let ((b (global-binding name 'variable 'variable)))
(push 'constant (binding-declarations b)))))))
-#+ecmalisp
+#+jscl
(fset 'proclaim #'!proclaim)
(defun %define-symbol-macro (name expansion)
(push-to-lexenv b *environment* 'variable)
name))
-#+ecmalisp
+#+jscl
(defmacro define-symbol-macro (name expansion)
`(%define-symbol-macro ',name ',expansion))
(code "{name: \"" (escape-string (symbol-name sexp))
"\", 'package': '" (package-name package) "'}")
(code "{name: \"" (escape-string (symbol-name sexp)) "\"}")))
- #+ecmalisp
+ #+jscl
(let ((package (symbol-package sexp)))
(if (null package)
(code "{name: \"" (escape-string (symbol-name sexp)) "\"}")
;; us replace the list representation version of the
;; function with the compiled one.
;;
- #+ecmalisp (setf (binding-value macro-binding) compiled)
+ #+jscl (setf (binding-value macro-binding) compiled)
#+common-lisp (setf (gethash macro-binding *macroexpander-cache*) compiled)
(setq expander compiled))))
(values (apply expander (cdr form)) t))
(defun compile-funcall (function args)
(let* ((values-funcs (if *multiple-value-p* "values" "pv"))
(arglist (concat "(" (join (cons values-funcs (mapcar #'ls-compile args)) ", ") ")")))
+ (unless (or (symbolp function)
+ (and (consp function)
+ (eq (car function) 'lambda)))
+ (error "Bad function"))
(cond
((translate-function function)
(concat (translate-function function) arglist))
((and (symbolp function)
- #+ecmalisp (eq (symbol-package function) (find-package "COMMON-LISP"))
+ #+jscl (eq (symbol-package function) (find-package "COMMON-LISP"))
#+common-lisp t)
(code (ls-compile `',function) ".fvalue" arglist))
(t
(t
(ls-compile `(symbol-value ',sexp))))))
((integerp sexp) (integer-to-string sexp))
+ ((floatp sexp) (float-to-string sexp))
((stringp sexp) (code "\"" (escape-string sexp) "\""))
((arrayp sexp) (literal sexp))
((listp sexp)