do not return temporary track database; (SBCL) declare global variables as always bound
parent
0bdfb513b2
commit
222df8116d
|
@ -6,7 +6,6 @@
|
|||
;; Databases
|
||||
(defparameter *ildb* nil)
|
||||
(defparameter *trackdb* nil)
|
||||
(defparameter *trackdb-temp* nil)
|
||||
|
||||
;; Command-line arguments
|
||||
(defparameter *debugp* nil)
|
||||
|
@ -16,21 +15,25 @@
|
|||
(defparameter *server-port* nil)
|
||||
(defparameter *server* nil)
|
||||
|
||||
#+sbcl(declaim (sb-ext:always-bound *ildb* *trackdb*
|
||||
*debugp* *gcp* *world-path* *server-port* *server*))
|
||||
|
||||
(defmacro ensure-world-path (path)
|
||||
`(uiop:ensure-pathname ,path :defaults (uiop:getcwd) :ensure-directory t
|
||||
:want-existing t :ensure-absolute t))
|
||||
|
||||
(defmacro savefilepath (name)
|
||||
`(uiop:subpathname *world-path* (concatenate 'string "advtrains_" ,name)))
|
||||
`(uiop:subpathname *world-path* ,(if (stringp name)
|
||||
(concatenate 'string "advtrains_" name)
|
||||
`(concatenate 'string "advtrains_" ,name))))
|
||||
|
||||
(defun load-data ()
|
||||
(let* ((ildb (atil:load-ildb (savefilepath "interlocking.ls"))))
|
||||
(multiple-value-bind (tdb tdbtemp) (tracks:load-trackdb (savefilepath "ndb4.ls"))
|
||||
(if *debugp* (setf *trackdb-temp* tdbtemp))
|
||||
(psetf *ildb* ildb *trackdb* tdb)))
|
||||
(when *gcp*
|
||||
#+sbcl(sb-ext:gc :full t))
|
||||
(hunchentoot:acceptor-log-message *server* :info "Database updated"))
|
||||
(let* ((ildb (atil:load-ildb (savefilepath "interlocking.ls")))
|
||||
(tdb (tracks:load-trackdb (savefilepath "ndb4.ls"))))
|
||||
(psetf *ildb* ildb *trackdb* tdb)
|
||||
(when *gcp*
|
||||
#+sbcl(sb-ext:gc :full t))
|
||||
(hunchentoot:acceptor-log-message *server* :info "Database updated")))
|
||||
|
||||
(defmacro mainloop ()
|
||||
`(loop (load-data) (sleep 20)))
|
||||
|
|
|
@ -133,7 +133,7 @@
|
|||
(push adj (aref connects (dir-c i))))
|
||||
(setf (get-track tdb pos) (make-track :connects connects))))
|
||||
(optimize-track-database tdb)
|
||||
(values tdb tmpdb)))
|
||||
tdb))
|
||||
|
||||
(defun gvdump (tdb)
|
||||
(with-output-to-string (stream)
|
||||
|
|
Loading…
Reference in New Issue