2016-03-15 17:59:15 +03:00
|
|
|
(def env-variable-true?
|
|
|
|
(fn [v]
|
|
|
|
(and (not (= "" v))
|
|
|
|
(not (= "0" v))
|
|
|
|
(not (= "false" v)))))
|
|
|
|
|
2016-01-13 16:09:27 +03:00
|
|
|
(def carp-dir (getenv "CARP_DIR"))
|
2016-03-15 17:59:15 +03:00
|
|
|
(def carp-dev (env-variable-true? (getenv "CARP_DEV")))
|
2016-01-13 16:09:27 +03:00
|
|
|
|
2016-02-22 18:20:59 +03:00
|
|
|
(if (= carp-dir "")
|
2016-03-15 17:59:15 +03:00
|
|
|
(do (println (str "Environment variable 'CARP_DIR' is not set, did you run 'carp-repl' directly?\n"
|
|
|
|
"Please use the carp shell script instead."))
|
2016-02-22 18:20:59 +03:00
|
|
|
(exit -1))
|
|
|
|
nil)
|
|
|
|
|
2016-03-15 17:59:15 +03:00
|
|
|
;; ~~~ CORE ~~~
|
2016-01-15 12:17:26 +03:00
|
|
|
(load-lisp (str carp-dir "lisp/core.carp"))
|
2016-03-14 16:16:34 +03:00
|
|
|
(load-lisp (str carp-dir "lisp/builtins.carp"))
|
|
|
|
(load-lisp (str carp-dir "lisp/signatures.carp"))
|
2016-01-18 15:43:59 +03:00
|
|
|
|
|
|
|
(when carp-dev
|
|
|
|
(load-lisp (str carp-dir "lisp/core_tests.carp")))
|
|
|
|
|
2016-03-15 17:59:15 +03:00
|
|
|
;; ~~~ COMPILER ~~~
|
2016-01-15 12:17:26 +03:00
|
|
|
(load-lisp (str carp-dir "lisp/compiler.carp"))
|
2016-01-13 16:09:27 +03:00
|
|
|
|
2016-01-18 15:43:59 +03:00
|
|
|
(when carp-dev
|
|
|
|
(do
|
2016-03-14 13:21:40 +03:00
|
|
|
(time (load-lisp (str carp-dir "lisp/compiler_tests.carp")))
|
2016-02-05 11:34:24 +03:00
|
|
|
(load-lisp (str carp-dir "lisp/examples.carp"))
|
2016-03-15 17:59:15 +03:00
|
|
|
(load-lisp (str carp-dir "lisp/glfw_test.carp"))))
|
2016-03-14 19:09:00 +03:00
|
|
|
|
|
|
|
;;(load-lisp (str carp-dir "lisp/improved_core.carp"))
|
2016-01-18 16:27:46 +03:00
|
|
|
|
2016-03-15 17:59:15 +03:00
|
|
|
;; ~~~ USER BOOT FILES ~~~
|
2016-01-18 16:27:46 +03:00
|
|
|
(let [user-boot-file (str (getenv "HOME") "/.carp/user.carp")]
|
|
|
|
(when (file-exists? user-boot-file)
|
|
|
|
(load-lisp user-boot-file)))
|
|
|
|
|
|
|
|
(when (file-exists? "project.carp")
|
|
|
|
(load-lisp "project.carp"))
|