Carp/lisp/boot.carp

42 lines
1.2 KiB
Plaintext
Raw Normal View History

(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"))
(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 "")
(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)
;; ~~~ CORE ~~~
(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"))
(when carp-dev
(load-lisp (str carp-dir "lisp/core_tests.carp")))
;; ~~~ COMPILER ~~~
(load-lisp (str carp-dir "lisp/compiler.carp"))
2016-01-13 16:09:27 +03:00
(when carp-dev
(do
(time (load-lisp (str carp-dir "lisp/compiler_tests.carp")))
(load-lisp (str carp-dir "lisp/examples.carp"))
(load-lisp (str carp-dir "lisp/glfw_test.carp"))))
;;(load-lisp (str carp-dir "lisp/improved_core.carp"))
;; ~~~ USER BOOT FILES ~~~
(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"))