about summary refs log tree commit diff
path: root/third_party/lisp
diff options
context:
space:
mode:
authorsterni <sternenseemann@systemli.org>2024-12-05T12·57+0100
committerclbot <clbot@tvl.fyi>2024-12-05T14·00+0000
commita31af5233c2b874aa502429eb9cce097e0b84289 (patch)
tree94c89debfd3da5d21e2ef30761a42051e2e3156e /third_party/lisp
parent856886f01d64ebfe8e4602bcce842f555edb1bed (diff)
chore(3p/lisp/mime4cl): remove MIME-PART-SIZE and MIME-BODY-SIZE r/8985
These functions are not very useful—as far as I'm aware at least—, are
not implemented very efficiently and totally untested. Remove them for
now. See also r/8978.

Change-Id: If9d277b460c3ed728a171bc29dd626c4c5fc0313
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12868
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Diffstat (limited to 'third_party/lisp')
-rw-r--r--third_party/lisp/mime4cl/default.nix5
-rw-r--r--third_party/lisp/mime4cl/ex-sclf.lisp12
-rw-r--r--third_party/lisp/mime4cl/mime.lisp51
-rw-r--r--third_party/lisp/mime4cl/package.lisp2
4 files changed, 2 insertions, 68 deletions
diff --git a/third_party/lisp/mime4cl/default.nix b/third_party/lisp/mime4cl/default.nix
index c83d5e4ffce1..042eb6981940 100644
--- a/third_party/lisp/mime4cl/default.nix
+++ b/third_party/lisp/mime4cl/default.nix
@@ -42,9 +42,4 @@ depot.nix.buildLisp.library {
 
     expression = "(rtest:do-tests)";
   };
-
-  # limited by sclf
-  brokenOn = [
-    "ecl"
-  ];
 }
diff --git a/third_party/lisp/mime4cl/ex-sclf.lisp b/third_party/lisp/mime4cl/ex-sclf.lisp
index 8b71a2f2c6c9..e6246c1499f4 100644
--- a/third_party/lisp/mime4cl/ex-sclf.lisp
+++ b/third_party/lisp/mime4cl/ex-sclf.lisp
@@ -63,8 +63,6 @@
    #:save-file-excursion
    #:read-file
 
-   #:file-size
-
    #:promise
    #:make-promise
    #:lazy
@@ -267,16 +265,6 @@ ELEMENT-TYPE."
           seq)
         default)))
 
-;; FILES
-
-;; FILE-LENGTH is a bit idiosyncratic in this respect.  Besides, Unix
-;; allows to get to know the file size without being able to open a
-;; file; just ask politely.
-(defun file-size (pathname)
-  #+sbcl (sb-posix:stat-size (sb-posix:stat pathname))
-  #+ccl (ccl:file-data-size pathname)
-  #-(or sbcl ccl) (error "nyi"))
-
 ;; LAZY
 
 (defstruct promise
diff --git a/third_party/lisp/mime4cl/mime.lisp b/third_party/lisp/mime4cl/mime.lisp
index 18c9e7bbb029..657c1fd86238 100644
--- a/third_party/lisp/mime4cl/mime.lisp
+++ b/third_party/lisp/mime4cl/mime.lisp
@@ -204,24 +204,6 @@ because they are stored in dedicated slots in MIME-PART.")
 (defun mime-body-stream (mime-part)
   (make-input-adapter (mime-body mime-part)))
 
-(defun mime-body-length (mime-part)
-  (let ((body (mime-body mime-part)))
-    ;; here the stream type is missing on purpose, because we may not
-    ;; be able to size the length of a stream
-    (etypecase body
-      (string
-       (length body))
-      (vector
-       (length body))
-      (pathname
-       (file-size body))
-      (file-portion
-       (with-open-stream (in (open-decoded-file-portion body))
-         (loop
-            for byte = (read-byte in nil)
-            while byte
-            count byte))))))
-
 (defmacro with-input-from-mime-body-stream ((stream part) &body forms)
   `(with-open-stream (,stream (mime-body-stream ,part))
      ,@forms))
@@ -386,10 +368,6 @@ that may change this.")
     (:multipart mime-multipart)
     (:message mime-message)))
 
-(defgeneric mime-part-size (part)
-  (:documentation
-   "Return the size in bytes of the body of a MIME part."))
-
 (defgeneric print-mime-part (part stream)
   (:documentation
    "Output to STREAM one of the possible human-readable representation
@@ -847,31 +825,6 @@ returns a MIME-MESSAGE object."
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-;; fall back method
-(defmethod mime-part-size ((part mime-part))
-  (let ((body (mime-body part)))
-    (typecase body
-      (pathname
-       (file-size body))
-      (string
-       (length body))
-      (vector
-       (length body))
-      (t nil))))
-
-(defmethod mime-part-size ((part mime-multipart))
-  (loop
-     for p in (mime-parts part)
-     for size = (mime-part-size p)
-     unless size
-     return nil
-     sum size))
-
-(defmethod mime-part-size ((part mime-message))
-  (mime-part-size (mime-body part)))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
 (defmethod print-mime-part ((part mime-multipart) (out stream))
   (case (mime-subtype part)
     (:alternative
@@ -916,8 +869,8 @@ returns a MIME-MESSAGE object."
     (print-mime-part (mime-body part) out)))
 
 (defmethod print-mime-part ((part mime-part) (out stream))
-  (format out "~&[ ~A subtype=~A ~@[description=~S ~]~@[size=~A~] ]~%"
-          (type-of part) (mime-subtype part) (mime-description part) (mime-part-size part)))
+  (format out "~&[ ~A subtype=~A ~@[description=~S ~]]~%"
+          (type-of part) (mime-subtype part) (mime-description part)))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
diff --git a/third_party/lisp/mime4cl/package.lisp b/third_party/lisp/mime4cl/package.lisp
index 94b9e6b39053..8af53fabf91a 100644
--- a/third_party/lisp/mime4cl/package.lisp
+++ b/third_party/lisp/mime4cl/package.lisp
@@ -44,11 +44,9 @@
            #:mime-application
            #:mime-video
            #:mime-description
-           #:mime-part-size
            #:mime-subtype
            #:mime-body
            #:mime-body-stream
-           #:mime-body-length
            #:mime-parts
            #:mime-part-p
            #:mime-type