;; You should have received a copy of the GNU General Public License
;; along with JSCL. If not, see <http://www.gnu.org/licenses/>.
+(/debug "loading array.lisp!")
+
(defun upgraded-array-element-type (typespec &optional environment)
(declare (ignore environment))
(if (eq typespec 'character)
;; You should have received a copy of the GNU General Public License
;; along with JSCL. If not, see <http://www.gnu.org/licenses/>.
+(/debug "loading backquote.lisp!")
+
;;; Backquote implementation.
;;;
;;; Author: Guy L. Steele Jr. Date: 27 December 1985
;;; Lisp world from scratch. This code has to define enough language
;;; to the compiler to be able to run.
+(/debug "loading boot.lisp!")
+
(eval-when-compile
(let ((defmacro-macroexpander
'#'(lambda (form)
+(/debug "loading char.lisp!")
+
;; These comparison functions heavily borrowed from SBCL/CMUCL (public domain).
(defun char= (character &rest more-characters)
(eval-when-compile
(defun concat (&rest strs)
(apply #'concatenate 'string strs)))
+
+(defun /debug (x)
+ (write-line x))
;;; It is intended to be used with the new compiler. However, it is
;;; quite independent so it has been integrated early in JSCL.
+(/debug "loading compiler-codegen.lisp!")
+
(defvar *js-output* t)
;;; Two seperate functions are needed for escaping strings:
;;;; Compiler
+(/debug "loading compiler.lisp!")
+
;;; Translate the Lisp code to Javascript. It will compile the special
;;; forms. Some primitive functions are compiled as special forms
;;; too. The respective real functions are defined in the target (see
,@(mapcar (lambda (form)
`(code "vs = " ,(ls-compile form t) ";"
"if (typeof vs === 'object' && 'multiple-value' in vs)"
- (code "args = args.concat(vs);" )
- "else"
+ (code " args = args.concat(vs);" )
+ " else "
(code "args.push(vs);" )))
forms))
"args[1] = args.length-2;"
(t (let ((v (format nil "x~d" (incf counter))))
(push v fargs)
(push `(code "var " ,v " = " ,(ls-compile x) ";"
- "if (typeof " v " !== 'number') throw 'Not a number!';"
- )
+ "if (typeof " ,v " !== 'number') throw 'Not a number!';")
prelude)))))
(js!selfcall
`(code ,@(reverse prelude))
(define-builtin %write-string (x)
`(code "lisp.write(" ,x ")"))
+(define-builtin /debug (x)
+ `(code "console.log(xstring(" ,x "))"))
+
;;; Storage vectors. They are used to implement arrays and (in the
;;; future) structures.
;; You should have received a copy of the GNU General Public License
;; along with JSCL. If not, see <http://www.gnu.org/licenses/>.
+(/debug "loading defstruct.lisp!")
+
;; A very simple defstruct built on lists. It supports just slot with
;; an optional default initform, and it will create a constructor,
;; predicate and accessors for you.
;; You should have received a copy of the GNU General Public License
;; along with JSCL. If not, see <http://www.gnu.org/licenses/>.
+(/debug "loading ffi.lisp!")
+
(define-setf-expander oget (object key &rest keys)
(let* ((keys (cons key keys))
(g!object (gensym))
;; You should have received a copy of the GNU General Public License
;; along with JSCL. If not, see <http://www.gnu.org/licenses/>.
+(/debug "loading lambda-list.lisp!")
+
+
(defvar !lambda-list-keywords
'(&optional &rest &key &aux &allow-other-keys &body &optional))
;; You should have received a copy of the GNU General Public License
;; along with JSCL. If not, see <http://www.gnu.org/licenses/>.
+(/debug "loading list.lisp!")
+
;;;; Various list functions
(defun cons (x y) (cons x y))
;; You should have received a copy of the GNU General Public License
;; along with JSCL. If not, see <http://www.gnu.org/licenses/>.
+(/debug "loading misc.lisp!")
+
(defparameter *features* '(:jscl :common-lisp))
(defun lisp-implementation-type ()
;; You should have received a copy of the GNU General Public License
;; along with JSCL. If not, see <http://www.gnu.org/licenses/>.
+(/debug "loading numbers.lisp!")
+
;;;; Various numeric functions and constants
(macrolet ((def (operator initial-value)
;; You should have received a copy of the GNU General Public License
;; along with JSCL. If not, see <http://www.gnu.org/licenses/>.
+(/debug "loading package.lisp!")
+
(defvar *package-list* nil)
(defun list-all-packages ()
;; You should have received a copy of the GNU General Public License
;; along with JSCL. If not, see <http://www.gnu.org/licenses/>.
+(/debug "loading print.lisp!")
+
;;; Printer
(defun lisp-escape-string (string)
;; You should have received a copy of the GNU General Public License
;; along with JSCL. If not, see <http://www.gnu.org/licenses/>.
+(/debug "loading read.lisp!")
;;;; Reader
;; You should have received a copy of the GNU General Public License
;; along with JSCL. If not, see <http://www.gnu.org/licenses/>.
+(/debug "loading sequence.lisp!")
+
(defun not-seq-error (thing)
(error "`~S' is not of type SEQUENCE" thing))
;;; TODO: Use structures to represent streams, but we would need
;;; inheritance.
+(/debug "loading stream.lisp!")
+
(defvar *standard-output*
(vector 'stream
(lambda (ch) (%write-string (string ch)))
;; You should have received a copy of the GNU General Public License
;; along with JSCL. If not, see <http://www.gnu.org/licenses/>.
+(/debug "loading string.lisp!")
+
(defun stringp (s)
(stringp s))
;; You should have received a copy of the GNU General Public License
;; along with JSCL. If not, see <http://www.gnu.org/licenses/>.
+(/debug "loading toplevel.lisp!")
(defun eval (x)
(js-eval (ls-compile-toplevel x t)))
;; You should have received a copy of the GNU General Public License
;; along with JSCL. If not, see <http://www.gnu.org/licenses/>.
+(/debug "loading utils.lisp!")
+
(defvar *newline* "
")