ensured that all keys in the \*models\* hash are uppercase
updated error messages in timecalc-logic:convert removed extrenuous function in timecalc-build
This commit is contained in:
parent
fc0b29493e
commit
e13d662f25
|
@ -18,16 +18,12 @@
|
|||
,@body))
|
||||
(push #',name *build-rules*))))
|
||||
|
||||
(defun run-rules ()
|
||||
"run all build rules"
|
||||
(mapcar #'funcall *build-rules*))
|
||||
|
||||
(defmethod asdf:output-files ((o timecalc-op) (c asdf:system))
|
||||
(values (list (asdf/system:component-build-pathname c))
|
||||
t))
|
||||
|
||||
(defmethod asdf:perform ((o timecalc-op) (c asdf:system))
|
||||
(run-rules)
|
||||
(mapcar #'funcall *build-rules*) ;; runs our build rules
|
||||
(apply #'uiop:dump-image
|
||||
(car (asdf:output-files o c))
|
||||
(append '(:executable t)
|
||||
|
@ -39,7 +35,7 @@
|
|||
;; BUILD RULES
|
||||
(define-build-rule
|
||||
;; load up all json files in {source-dir}/systems
|
||||
(let* ((dir (merge-pathnames "systems/" (asdf:system-source-directory :timecalc))))
|
||||
(let ((dir (merge-pathnames "systems/" (asdf:system-source-directory :timecalc))))
|
||||
(load-models (uiop:directory-files dir "*.system"))))
|
||||
|
||||
|
||||
|
|
10
logic.lisp
10
logic.lisp
|
@ -15,16 +15,16 @@
|
|||
"loads model FILES into memory"
|
||||
(loop :for f :in files
|
||||
:do (let ((file-def (jzon:parse f)))
|
||||
(setf (gethash (gethash "name" file-def) *models*)
|
||||
(setf (gethash (string-upcase (gethash "name" file-def)) *models*)
|
||||
file-def))))
|
||||
|
||||
(defun convert (time from to)
|
||||
(let ((from-model (gethash from *models*))
|
||||
(to-model (gethash to *models*)))
|
||||
(let ((from-model (gethash (string-upcase from) *models*))
|
||||
(to-model (gethash (string-upcase to) *models*)))
|
||||
(unless from-model
|
||||
(error "FROM system/planet doesn't exist in our database"))
|
||||
(error "FROM system doesn't exist in our database"))
|
||||
(unless to-model
|
||||
(error "TO system/planet doesn't exist in our database"))
|
||||
(error "TO system doesn't exist in our database"))
|
||||
;; okay so the process to convert from one time to another we need to convert
|
||||
;; to GTS first and then convert to the target system time
|
||||
;;
|
||||
|
|
Loading…
Reference in New Issue