-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathload.lisp
52 lines (43 loc) · 1.54 KB
/
load.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
(in-package :cl-user)
(ql:quickload :iota)
;; It's possible to directly load the translated code, but that gets really
;; tedious. Loading a compiled file is much faster.
(defun compile-and-load (path &key force)
"Compile and load PATH.
The file will only be recompiled if the source is newer than the output file, or if FORCE is true."
(let ((compiled (compile-file-pathname path)))
(when (or force
(not (probe-file compiled))
(<= (file-write-date compiled) (file-write-date path)))
(format t "; Compiling ~S~%" path)
(ignore-errors (delete-file compiled))
(compile-file path))
(format t "; Loading ~S~%" compiled)
(load compiled)))
(defpackage :prboom
(:use :cl :llvm-runtime)
(:export #:make-context))
(compile-and-load "prboom.lisp")
(defun run-prboom (&rest arguments)
(llvm-runtime:main-1
(prboom:make-context)
(list* "prboom" arguments)
(list (format nil "HOME=~A" (namestring (user-homedir-pathname))))))
(defpackage :sdlquake
(:use :cl :llvm-runtime)
(:export #:make-context))
(compile-and-load "sdlquake.lisp")
(defun run-sdlquake (&rest arguments)
(llvm-runtime:main-1
(sdlquake:make-context)
(list* "sdlquake" arguments)
(list (format nil "HOME=~A" (namestring (user-homedir-pathname))))))
;; Disable floating point traps for Quake.
#+sbcl
(sb-int:set-floating-point-modes :traps '())
#+ccl
(ccl:set-fpu-mode :overflow nil
:underflow nil
:division-by-zero nil
:invalid nil
:inexact nil)