From 69d775b3d3a8f5bdb920630c7bdf6ec1b264b203 Mon Sep 17 00:00:00 2001 From: Uko Kokņevičs Date: Fri, 24 Oct 2025 08:09:46 +0300 Subject: Configure a custom readtable explicitly --- ocicl.csv | 10 ++++++++++ src/inline-bots.lisp | 6 +++--- src/main.lisp | 6 +++--- src/readtable.lisp | 14 ++++++++++++++ src/rw-lock.lisp | 8 ++++---- src/state.lisp | 6 +++--- src/tg/method-macros.lisp | 7 +++---- src/tg/type-macros.lisp | 9 ++++----- 8 files changed, 44 insertions(+), 22 deletions(-) create mode 100644 src/readtable.lisp diff --git a/ocicl.csv b/ocicl.csv index 176d9fe..177add3 100644 --- a/ocicl.csv +++ b/ocicl.csv @@ -1,4 +1,5 @@ alexandria, ghcr.io/ocicl/alexandria@sha256:e433c2e076ed3bcf8641b97b00192680db2201d305efac9293539dee88c7fbf7, alexandria-20240503-8514d8e/alexandria.asd +autoload, ghcr.io/ocicl/mgl-pax-bootstrap@sha256:3139a60412c5b3f8817e251c5a774149b8b19bfee2dc279833034bddb2480866, mgl-pax-20251022-c1c1edb/autoload/autoload.asd babel, ghcr.io/ocicl/babel@sha256:9d9fcde71acc2b5c39572de4f11756a08c1d8801caa86c581b85dabaa35928b3, babel-20250905-4eaf3f2/babel.asd babel-streams, ghcr.io/ocicl/babel@sha256:9d9fcde71acc2b5c39572de4f11756a08c1d8801caa86c581b85dabaa35928b3, babel-20250905-4eaf3f2/babel-streams.asd babel-tests, ghcr.io/ocicl/babel@sha256:9d9fcde71acc2b5c39572de4f11756a08c1d8801caa86c581b85dabaa35928b3, babel-20250905-4eaf3f2/babel-tests.asd @@ -32,6 +33,9 @@ dexador, ghcr.io/ocicl/dexador@sha256:defc8d669790e22ac9a9eccf52fe14b10cf986402c dexador-test, ghcr.io/ocicl/dexador@sha256:defc8d669790e22ac9a9eccf52fe14b10cf986402c7b32c0049df45f64a039e1, dexador-20250825-4db4b93/dexador-test.asd dexador-usocket, ghcr.io/ocicl/dexador@sha256:defc8d669790e22ac9a9eccf52fe14b10cf986402c7b32c0049df45f64a039e1, dexador-20250825-4db4b93/dexador-usocket.asd documentation-utils, ghcr.io/ocicl/documentation-utils@sha256:b2a1b3f3bcd1a738af85ae2b0168d408c177661eab6d6bbebb254e394d983f54, documentation-utils-20230511-98630dd/documentation-utils.asd +dref, ghcr.io/ocicl/mgl-pax-bootstrap@sha256:3139a60412c5b3f8817e251c5a774149b8b19bfee2dc279833034bddb2480866, mgl-pax-20251022-c1c1edb/dref/dref.asd +dref-test, ghcr.io/ocicl/mgl-pax-bootstrap@sha256:3139a60412c5b3f8817e251c5a774149b8b19bfee2dc279833034bddb2480866, mgl-pax-20251022-c1c1edb/dref/dref-test.asd +dref-test-package-inferred, ghcr.io/ocicl/mgl-pax-bootstrap@sha256:3139a60412c5b3f8817e251c5a774149b8b19bfee2dc279833034bddb2480866, mgl-pax-20251022-c1c1edb/dref/test/data/dref-test-package-inferred.asd fast-http, ghcr.io/ocicl/fast-http@sha256:44e98b5239c0ded4921dc0b04ae272cff00583d93797a657543db782979eb50c, fast-http-20240503-2232fc9/fast-http.asd fast-http-test, ghcr.io/ocicl/fast-http@sha256:44e98b5239c0ded4921dc0b04ae272cff00583d93797a657543db782979eb50c, fast-http-20240503-2232fc9/fast-http-test.asd fast-io, ghcr.io/ocicl/fast-io@sha256:7ba35a0eddf00b3c25656b3c5a93e95460f6cb8f807afbc04ef4f50076d95aff, fast-io-20240503-a4c5ad6/fast-io.asd @@ -60,7 +64,13 @@ log4cl, ghcr.io/ocicl/log4cl@sha256:bd33f6e5ad346892e852492e7101bc18d263f9ef2ba6 log4cl-examples, ghcr.io/ocicl/log4cl@sha256:bd33f6e5ad346892e852492e7101bc18d263f9ef2ba6192178568d1b20337112, log4cl-20240503-fe3da51/log4cl-examples.asd log4cl.log4slime, ghcr.io/ocicl/log4cl@sha256:bd33f6e5ad346892e852492e7101bc18d263f9ef2ba6192178568d1b20337112, log4cl-20240503-fe3da51/log4cl.log4slime.asd log4cl.log4sly, ghcr.io/ocicl/log4cl@sha256:bd33f6e5ad346892e852492e7101bc18d263f9ef2ba6192178568d1b20337112, log4cl-20240503-fe3da51/log4cl.log4sly.asd +mgl-pax, ghcr.io/ocicl/mgl-pax-bootstrap@sha256:3139a60412c5b3f8817e251c5a774149b8b19bfee2dc279833034bddb2480866, mgl-pax-20251022-c1c1edb/mgl-pax.asd +mgl-pax-bootstrap, ghcr.io/ocicl/mgl-pax-bootstrap@sha256:3139a60412c5b3f8817e251c5a774149b8b19bfee2dc279833034bddb2480866, mgl-pax-20251022-c1c1edb/mgl-pax-bootstrap.asd +mgl-pax-test, ghcr.io/ocicl/mgl-pax-bootstrap@sha256:3139a60412c5b3f8817e251c5a774149b8b19bfee2dc279833034bddb2480866, mgl-pax-20251022-c1c1edb/mgl-pax-test.asd +mgl-pax.asdf, ghcr.io/ocicl/mgl-pax-bootstrap@sha256:3139a60412c5b3f8817e251c5a774149b8b19bfee2dc279833034bddb2480866, mgl-pax-20251022-c1c1edb/mgl-pax.asdf.asd multilang-documentation-utils, ghcr.io/ocicl/documentation-utils@sha256:b2a1b3f3bcd1a738af85ae2b0168d408c177661eab6d6bbebb254e394d983f54, documentation-utils-20230511-98630dd/multilang-documentation-utils.asd +named-readtables, ghcr.io/ocicl/named-readtables@sha256:c6380ffa68acf18ba97ef7b88e84ea174fc5605c8a9b23d80ef2583b44f68017, named-readtables-20250524-8bd0045/named-readtables.asd +named-readtables-test, ghcr.io/ocicl/named-readtables@sha256:c6380ffa68acf18ba97ef7b88e84ea174fc5605c8a9b23d80ef2583b44f68017, named-readtables-20250524-8bd0045/named-readtables-test.asd net.didierverna.asdf-flv, ghcr.io/ocicl/net.didierverna.asdf-flv@sha256:e5cd087d41cf24302a92d9bac426a925f8868b554be2414c0f012c961e3ddb8c, asdf-flv-20240503-3f1de41/net.didierverna.asdf-flv.asd parse-declarations-1.0, ghcr.io/ocicl/parse-declarations-1.0@sha256:9305fa9624205b16fd1fc51cb1cc4282a18e50eee9ac75b66a14f6f2c5df9518, parse-declarations-20240503-549aebb/parse-declarations-1.0.asd parse-number, ghcr.io/ocicl/parse-number@sha256:11f3f9f512871e1f96cea6b8260aa3610e34e8fd7272bbcdb210fd3c5dd8025c, parse-number-20240503-cb9e487/parse-number.asd diff --git a/src/inline-bots.lisp b/src/inline-bots.lisp index f4d8a8d..db9d8ff 100644 --- a/src/inline-bots.lisp +++ b/src/inline-bots.lisp @@ -3,16 +3,16 @@ (defpackage :ukkoclot/src/inline-bots (:documentation "This package deals with removing unwanted inline bot usage") (:use :c2cl :ukkoclot/src/tg) - (:import-from :com.dieggsy.f-string :enable-f-strings) (:import-from :conf) (:import-from :log) + (:import-from :named-readtables :in-readtable) (:import-from :serapeum :->) (:import-from :state) + (:import-from :ukkoclot/src/readtable :readtable) (:local-nicknames (:db :ukkoclot/src/db)) (:export :blacklist-inline-bot :on-inline-bot :whitelist-inline-bot)) (in-package :ukkoclot/src/inline-bots) - -(enable-f-strings) +(in-readtable readtable) (-> blacklist-inline-bot (integer) (values &optional)) (defun blacklist-inline-bot (inline-bot-id) diff --git a/src/main.lisp b/src/main.lisp index 13da5af..f435bf3 100644 --- a/src/main.lisp +++ b/src/main.lisp @@ -5,12 +5,13 @@ (:nicknames :ukkoclot) (:use :c2cl :iterate :ukkoclot/src/inline-bots :ukkoclot/src/tg) (:import-from :alexandria :when-let) - (:import-from :com.dieggsy.f-string :enable-f-strings) (:import-from :conf) (:import-from :log) + (:import-from :named-readtables :in-readtable) (:import-from :serapeum :-> :drop) (:import-from :state :*state* :make-state) (:import-from :str) + (:import-from :ukkoclot/src/readtable :readtable) (:import-from :ukkoclot/src/db :with-db) (:import-from :ukkoclot/src/serializing :fixup-value) (:import-from :ukkoclot/src/strings :escape-xml :is-tg-whitespace :is-tg-whitespace-str) @@ -18,8 +19,7 @@ (:jzon :com.inuoe.jzon)) (:export :main)) (in-package :ukkoclot/src/main) - -(enable-f-strings) +(in-readtable readtable) (defvar *in-prod* nil) diff --git a/src/readtable.lisp b/src/readtable.lisp new file mode 100644 index 0000000..ee5af0a --- /dev/null +++ b/src/readtable.lisp @@ -0,0 +1,14 @@ +;; SPDX-License-Identifier: EUPL-1.2 +;; SPDX-FileCopyrightText: 2025 Uko Kokņevičs +(defpackage :ukkoclot/src/readtable + (:documentation "Defines the custom readtable used within this project.") + (:use :c2cl) + (:import-from :named-readtables :defreadtable) + (:import-from :com.dieggsy.f-string :f-string-reader) + (:export :readtable)) +(in-package :ukkoclot/src/readtable) + +(defreadtable readtable + (:merge :standard) + (:dispatch-macro-char #\# #\f #'f-string-reader) + (:case :upcase)) diff --git a/src/rw-lock.lisp b/src/rw-lock.lisp index b8d08b1..2a5e2c3 100644 --- a/src/rw-lock.lisp +++ b/src/rw-lock.lisp @@ -4,10 +4,12 @@ (:documentation "Implementation of a shared/read-write lock.") (:use :c2cl :bt2 :iterate) (:import-from :alexandria :whichever :with-gensyms) - (:import-from :com.dieggsy.f-string :enable-f-strings) + (:import-from :named-readtables :in-readtable) + ;; These imports make this SBCL-dependent, but technically speaking we could live without them. (:import-from :sb-sys :allow-with-interrupts :with-local-interrupts :without-interrupts) (:import-from :serapeum :->) + (:import-from :ukkoclot/src/readtable :readtable) (:export #:rw-lock #:rw-lock-p @@ -19,9 +21,7 @@ #:release-write-lock #:with-write-lock)) (in-package :ukkoclot/src/rw-lock) - -(eval-when (:compile-toplevel :load-toplevel :execute) - (enable-f-strings)) +(in-readtable readtable) ;; TODO: Use atomic-integer in best-case for read locks to decrease contention (defstruct (rw-lock (:constructor make-rw-lock%)) diff --git a/src/state.lisp b/src/state.lisp index 9f1a38f..e2052e3 100644 --- a/src/state.lisp +++ b/src/state.lisp @@ -4,10 +4,11 @@ (:documentation "Holds the global state") (:nicknames :state) (:use :c2cl :ukkoclot/src/rw-lock) - (:import-from :com.dieggsy.f-string :enable-f-strings) (:import-from :conf :config :*config* :bot-token) + (:import-from :named-readtables :in-readtable) (:import-from :serapeum :->) (:import-from :ukkoclot/src/db :db) + (:import-from :ukkoclot/src/readtable :readtable) (:export #:*state* #:state @@ -22,8 +23,7 @@ #:id% #:set-id%)) (in-package :ukkoclot/src/state) - -(enable-f-strings) +(in-readtable readtable) (defstruct (state (:constructor make-state%)) (lock (make-rw-lock :name "state's lock") :type rw-lock :read-only t) diff --git a/src/tg/method-macros.lisp b/src/tg/method-macros.lisp index 9ab9e89..17903df 100644 --- a/src/tg/method-macros.lisp +++ b/src/tg/method-macros.lisp @@ -4,16 +4,15 @@ (:documentation "Macros for easy defining TG methods.") (:use :c2cl :iterate) (:import-from :alexandria :make-keyword :with-gensyms) - (:import-from :com.dieggsy.f-string :enable-f-strings) + (:import-from :named-readtables :in-readtable) (:import-from :serapeum :-> :take) (:import-from :state) (:import-from :str) + (:import-from :ukkoclot/src/readtable :readtable) (:import-from :ukkoclot/src/transport :do-call :http-method) (:export :define-tg-method)) (in-package :ukkoclot/src/tg/method-macros) - -(eval-when (:compile-toplevel :load-toplevel :execute) - (enable-f-strings)) +(in-readtable readtable) (eval-when (:compile-toplevel :load-toplevel :execute) (defstruct (param (:constructor make-param%)) name type default skip-if-default) diff --git a/src/tg/type-macros.lisp b/src/tg/type-macros.lisp index 02437ec..97cce1c 100644 --- a/src/tg/type-macros.lisp +++ b/src/tg/type-macros.lisp @@ -4,18 +4,17 @@ (:documentation "Macros for easy defining TG types.") (:use :c2cl :iterate) (:import-from :alexandria :make-keyword :symbolicate :with-gensyms) - (:import-from :com.dieggsy.f-string :enable-f-strings) + (:import-from :named-readtables :in-readtable) (:import-from :serapeum :->) (:import-from :str) - (:import-from :ukkoclot/src/serializing :parse-value) (:import-from :ukkoclot/src/hash-tables :gethash-lazy) + (:import-from :ukkoclot/src/readtable :readtable) + (:import-from :ukkoclot/src/serializing :parse-value) (:local-nicknames (:jzon :com.inuoe.jzon)) (:export :define-tg-type)) (in-package :ukkoclot/src/tg/type-macros) - -(eval-when (:compile-toplevel :load-toplevel :execute) - (enable-f-strings)) +(in-readtable readtable) (eval-when (:compile-toplevel :load-toplevel :execute) (defstruct (field (:constructor make-field%)) name type default skip-if-default) -- cgit v1.2.3