;/**
; * Copyright (c) Rich Hickey. All rights reserved.
; * The use and distribution terms for this software are covered by the
; * Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
; * which can be found in the file CPL.TXT at the root of this distribution.
; * By using this software in any fashion, you are agreeing to be bound by
; * the terms of this license.
; * You must not remove this notice, or any other, from this software.
; **/
(defpackage "clojure"
(:export :load-types :*namespace-separator*
:newobj :@ :compile-to :*clojure-source-path* :*clojure-target-path*
"in-module"
"defn*" "def" "defn" "fn"
"if" "and" "or" "not" "when" "unless"
"block" "let" "let*" "letfn"
"set" "pset" "set*" "do"))
(in-package "clojure")
(defvar *namespace-separator* nil
"set to #\/ for JVM, #\. for CLI")
(defconstant +MAX-POSITIONAL-ARITY+ 5)
(defvar *host* nil) ; :jvm or :cli
(defvar *clojure-source-path*)
(defvar *clojure-target-path*)
(defvar *symbols*)
(defvar *keywords*)
(defvar *vars*)
(defvar *accessors*)
(defvar *defvars*)
(defvar *defns*)
(defvar *quoted-aggregates*)
(defvar *nested-fn-bindings*)
(defvar *var-env* nil)
(defvar *frame* nil)
(defvar *next-id*)
;dynamic functions
(defvar *reference-var*)
#|
(let ((*clojure-source-path* #p"/dev/clojure/src/lisp/")
(*clojure-target-path* #p"/dev/clojure/classes/"))
(compile-to :jvm "org.clojure" "Clojure"
"test.lisp"))
(let ((*clojure-source-path* #p"/dev/clojure/src/lisp/")
(*clojure-target-path* #p"/dev/clojure/classes/test/"))
(compile-to :cli "org.clojure" "Clojure"
"test.lisp"))
;build the library
(let ((*clojure-source-path* #p"/dev/clojure/")
(*clojure-target-path* #p"/dev/gen/clojure/"))
(compile-to :jvm "org.clojure" "Clojure"
"arrays.lisp"
"conditions.lisp"
"conses.lisp"
"data-and-control-flow.lisp"
"hash-tables.lisp"
"numbers.lisp"
"printer.lisp"
"sequences.lisp"
"symbols.lisp"
"impl.lisp"))
(let ((*clojure-source-path* #p"/dev/")
(*clojure-target-path* #p"/dev/clojure/"))
(compile-to :java "org.clojure.user" "TestArrays"
"test-arrays.lisp"))
(let ((*clojure-source-path* #p"/dev/")
(*clojure-target-path* #p"/dev/clojure/"))
(compile-to :java "org.clojure.user" "TestHash"
"test-hash.lisp"))
|#
; a simple attribute object lib
(defun newobj (&rest attrs)
(let ((obj (make-hash-table)))
(do* ((attrs attrs (nthcdr 2 attrs)))
((null attrs))
(let ((attr (first attrs))
(val (second attrs)))
(setf (gethash attr obj) val)))
obj))
(defmacro @ (attr obj)
`(gethash ',attr ,obj))
(defun file-type ()
(ecase *host*
(:jvm "java")
(:cli "cs")))
;from c.l.l.
(defun