Make conns and directions read-only after creation; replace makefile with build script

master
y5nw 2021-08-24 13:51:51 +02:00
parent 7fb0e91f96
commit 854580be14
3 changed files with 9 additions and 18 deletions

View File

@ -1,14 +0,0 @@
LISP ?= sbcl
default: build
# https://lispcookbook.github.io/cl-cookbook/scripting.html
build:
$(LISP) --eval '(require :asdf)' \
--eval '(load "ywatds.asd")' \
--eval '(asdf:load-system "ywatds")' \
--eval '(asdf:make :ywatds)' \
--eval '(quit)'
clean:
-rm ywatds *~ *.backup API.md

5
build.lisp Normal file
View File

@ -0,0 +1,5 @@
(require :asdf)
(load "ywatds.asd")
(asdf:load-system :ywatds)
(asdf:make :ywatds)
(quit)

View File

@ -4,8 +4,8 @@
(defparameter *conns-shared* nil)
(defstruct trackside
(:pos (error "no coordinates specified") :type aux:v3d)
(:side (error "no side specified") :type (integer 0 15)))
(:pos (error "no coordinates specified") :type aux:v3d :read-only t)
(:side (error "no side specified") :type (integer 0 15) :read-only t))
(defmacro trackside (pos side)
(alexandria:once-only
@ -22,8 +22,8 @@
(json:encode-json (list (cons "p" p) (cons "s" side)))))
(defstruct dir
(:c 0 :type (integer 0 15))
(:r 0 :type (integer 0 1)))
(:c 0 :type (integer 0 15) :read-only t)
(:r 0 :type (integer 0 1) :read-only t))
(defmethod print-object ((obj dir) s)
(print-unreadable-object (obj s)