Skip to content

Commit

Permalink
add restart to reload MPFR if it couldn't be
Browse files Browse the repository at this point in the history
Co-authored by: Phoebe Goldman <[email protected]>
  • Loading branch information
stylewarning committed Oct 11, 2023
1 parent 52fb08f commit 9211b6e
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions library/big-float/impl-sbcl.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,38 @@
;;;;
;;;; Arbitrary precision floats using SBCL's MPFR library.

(in-package #:cl-user)

#-sbcl
(error "This file is hopelessly SBCL specific.")

#+sbcl
(eval-when (:compile-toplevel :load-toplevel)
(loop :until (uiop:featurep :sb-mpfr)
:do (restart-case (error "SB-MPFR failed to load, for some reason. ~
This is probably due to the shared library ~
not existing, or the system being unable ~
to find it. If you do not wish to install it, ~
re-compile Coalton from scratch with the ~
environment variable ~
~
COALTON_PORTABLE_BIGFLOAT=1 ~
~
set, or add the feature ~
:COALTON-PORTABLE-BIGFLOAT.")
(reload-sb-mpfr ()
:report "Reload the MPFR library"
(handler-case (sb-mpfr::load-mpfr)
(simple-warning (e) (declare (ignore e))))))))


(in-package #:coalton-library/big-float)

(named-readtables:in-readtable coalton:coalton)

#+coalton-release
(cl:declaim #.coalton-impl/settings:*coalton-optimize-library*)

#-sbcl (error "This file is hopelessly SBCL specific.")
#-sb-mpfr (error "SB-MPFR failed to load, for some reason. ~
This is probably due to the shared library ~
not existing, or the system being unable ~
to find it. ~
Set COALTON_PORTABLE_BIGFLOAT=1 or ~
add the feature :coalton-portable-bigfloat.")

;;; Preliminary patched functionality for SB-MPFR
;;;
;;; This functionality has been submitted upstream as a patch to
Expand Down

0 comments on commit 9211b6e

Please sign in to comment.