Commit b7443c97 authored by Raymond Toy's avatar Raymond Toy
Browse files

Fix #16: Use named-readtables

To make it easier for users to select the oct readtable, require the
use of named-readtables.  We're using
https://github.com/melisgl/named-readtables to implement the
readtables.

Thus use `(named-readtables:in-readtable oct:oct-readtable)` to set
up the appropriate readtable to support #q.  To go back to the
standard table, use `(named-readtables:in-readtable :standard)`.
parent 3373bd8e
Pipeline #2318 failed with stage
in 14 seconds
......@@ -38,7 +38,7 @@
:licence "MIT"
:version "2020.11.27" ; Just use the date
:in-order-to ((test-op (test-op "oct/tests")))
:depends-on (octi)
:depends-on (octi named-readtables)
:components
((:module "src"
:components
......
......@@ -237,4 +237,6 @@
;; CMUCL supports infinities.
#+cmu
(:export #:+quad-double-float-positive-infinity+
#:+quad-double-float-negative-infinity+))
#:+quad-double-float-negative-infinity+)
;;
(:export #:oct-readtable))
......@@ -25,8 +25,7 @@
(in-package #:oct)
(eval-when (:compile-toplevel :load-toplevel :execute)
(setf *readtable* *oct-readtable*))
(named-readtables:in-readtable oct-readtable))
(defmethod add1 ((a qd-complex))
(make-instance 'qd-complex
......
......@@ -24,8 +24,7 @@
(in-package #:oct)
(eval-when (:compile-toplevel :load-toplevel :execute)
(setf *readtable* *oct-readtable*))
(named-readtables:in-readtable oct-readtable))
(declaim (inline descending-transform ascending-transform))
......
......@@ -25,8 +25,7 @@
(in-package #:oct)
(eval-when (:compile-toplevel :load-toplevel :execute)
(setf *readtable* *oct-readtable*))
(named-readtables:in-readtable oct-readtable))
(defun qd-scale-exponent (original-x)
(let* ((x original-x))
......
......@@ -24,8 +24,7 @@
(in-package #:oct)
(eval-when (:compile-toplevel :load-toplevel :execute)
(setf *readtable* *oct-readtable*))
(named-readtables:in-readtable oct-readtable))
;; For log-gamma we use the asymptotic formula
;;
......
......@@ -50,9 +50,8 @@
(warn "Numeric argument ignored in #~DQ" arg))
(read-qd-real-or-complex stream))
(defvar *oct-readtable*
(let ((rt (copy-readtable nil)))
(set-dispatch-macro-character #\# #\Q #'qd-class-reader rt)
rt)
"Readtable that extends the standard readtable to include #q for
reading QD-REAL and QD-COMPLEX numbers")
;; Readtable that extends the standard readtable to include #q for
;; reading QD-REAL and QD-COMPLEX numbers
(named-readtables:defreadtable oct:oct-readtable
(:merge :standard)
(:dispatch-macro-char #\# #\Q #'qd-class-reader))
......@@ -24,8 +24,7 @@
(in-package #:oct)
(eval-when (:compile-toplevel :load-toplevel :execute)
(setf *readtable* *oct-readtable*))
(named-readtables:in-readtable oct-readtable))
;; Theta functions
;;
......
......@@ -25,8 +25,7 @@
(in-package #:oct)
(eval-when (:compile-toplevel :load-toplevel :execute)
(setf *readtable* *oct-readtable*))
(named-readtables:in-readtable oct:oct-readtable))
;; For the tests, we need to turn off underflow for clisp.
#+clisp
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment