Permalink
Browse files

Removed all unused READ- functions for reading Erlang terms.

  • Loading branch information...
1 parent fb47178 commit 4d4000870c97dbd5c9513ad019548ff42f37817b Markus Flambard committed Jul 17, 2011
View
@@ -93,98 +93,6 @@
)) )))
-(defun read-erlang-term (stream &optional (use-version-tag nil))
- (when use-version-tag
- (let ((version (read-byte stream)))
- (unless (= version +protocol-version+)
- (error 'unexpected-message-tag-error
- :received-tag version
- :expected-tags (list +protocol-version+)))))
- (let ((tag (read-byte stream)))
- (case tag
- (#.+new-float-ext+
- (read-external-new-float stream))
- (#.+bit-binary-ext+
- (read-external-bit-binary stream))
- (#.+atom-cache-ref+
- (read-external-atom-cache-ref stream))
- (#.+small-integer-ext+
- (read-external-small-integer stream))
- (#.+integer-ext+
- (read-external-integer stream))
- (#.+float-ext+
- (read-external-float stream))
- (#.+atom-ext+
- (read-external-atom stream))
- (#.+reference-ext+
- (read-external-reference stream))
- (#.+port-ext+
- (read-external-port stream))
- (#.+pid-ext+
- (read-external-pid stream))
- (#.+small-tuple-ext+
- (read-external-small-tuple stream))
- (#.+large-tuple-ext+
- (read-external-large-tuple stream))
- (#.+nil-ext+
- (read-external-nil stream))
- (#.+string-ext+
- (read-external-string stream))
- (#.+list-ext+
- (read-external-list stream))
- (#.+binary-ext+
- (read-external-binary stream))
- (#.+small-big-ext+
- (read-external-small-big stream))
- (#.+large-big-ext+
- (read-external-large-big stream))
- (#.+new-fun-ext+
- (read-external-new-fun stream))
- (#.+export-ext+
- (read-external-export stream))
- (#.+new-reference-ext+
- (read-external-new-reference stream))
- (#.+small-atom-ext+
- (read-external-small-atom stream))
- (#.+fun-ext+
- (read-external-fun stream))
- (#.+compressed-term+
- (read-compressed-erlang-term stream))
- (otherwise
- (error 'unexpected-message-tag-error
- :received-tag tag
- :expected-tags (list +new-float-ext+
- +bit-binary-ext+
- +atom-cache-ref+
- +small-integer-ext+
- +integer-ext+
- +float-ext+
- +atom-ext+
- +reference-ext+
- +port-ext+
- +pid-ext+
- +small-tuple-ext+
- +large-tuple-ext+
- +nil-ext+
- +string-ext+
- +list-ext+
- +binary-ext+
- +small-big-ext+
- +large-big-ext+
- +new-fun-ext+
- +export-ext+
- +new-reference-ext+
- +small-atom-ext+
- +fun-ext+
- +compressed-term+)
- )) )))
-
-(defun read-compressed-erlang-term (stream)
- (let ((uncompressed-size (read-uint32 stream)))
- (declare (ignore uncompressed-size))
- (error 'not-implemented-error
- :comment "Reading compressed Erlang terms is unsupported.")))
-
(defun decode-compressed-erlang-term (bytes &optional (pos 0))
(let ((uncompressed-size (bytes-to-uint32 bytes pos)))
(declare (ignore uncompressed-size))
View
@@ -41,32 +41,6 @@
(t
(encode-external-atom x)) ))) ))
-(defun read-erlang-atom (stream) ;; OBSOLETE?
- (let* ((tag (read-byte stream))
- (symbol (case tag
- (#.+atom-cache-ref+
- (read-external-atom-cache-ref stream))
- (#.+atom-ext+
- (read-external-atom stream))
- (#.+small-atom-ext+
- (read-external-small-atom stream))
- (#.+compressed-term+
- (read-compressed-erlang-term stream))
- (otherwise
- (error 'unexpected-message-tag-error
- :received-tag tag
- :expected-tags (list +atom-cache-ref+
- +atom-ext+
- +small-atom-ext+
- +compressed-term+))) )))
- (cond
- ((and (eq symbol '|true|) *erlang-true-is-lisp-t*)
- T)
- ((and (eq symbol '|false|) *erlang-false-is-lisp-nil*)
- NIL)
- (t
- symbol)) ))
-
(defun decode-erlang-atom (bytes &optional (pos 0))
(let ((tag (aref bytes pos)))
(multiple-value-bind (symbol pos2)
@@ -109,10 +83,6 @@
(vector +atom-cache-ref+)
(vector reference-index)))
-(defun read-external-atom-cache-ref (stream) ;; OBSOLETE?
- ;; Assume tag +atom-cache-ref+ is read
- (decode-external-atom-cache-ref (read-bytes 1 stream)))
-
(defun decode-external-atom-cache-ref (bytes &optional (pos 0))
(values (svref *cached-atoms* (aref bytes pos))
(1+ pos)))
@@ -133,14 +103,6 @@
(uint16-to-bytes (length (symbol-name atom)))
(string-to-bytes (symbol-name atom))))
-(defun read-external-atom (stream) ;; OBSOLETE?
- ;; Assume tag +atom-ext+ is read
- (let* ((length-bytes (read-bytes 2 stream))
- (length (bytes-to-uint16 length-bytes))
- (atom-text (read-bytes length stream)))
- (decode-external-atom
- (concatenate '(vector octet) length-bytes atom-text))))
-
(defun decode-external-atom (bytes &optional (pos 0))
(let ((length (bytes-to-uint16 bytes pos))
(pos2 (+ 2 pos)))
@@ -163,13 +125,6 @@
(vector (length (symbol-name atom)))
(string-to-bytes (symbol-name atom))))
-(defun read-external-small-atom (stream) ;; OBSOLETE?
- ;; Assume tag +atom-small-ext+ is read
- (let* ((length (read-byte stream))
- (atom-text (read-bytes length stream)))
- (decode-external-atom
- (concatenate '(vector octet) (vector length) atom-text))))
-
(defun decode-external-small-atom (bytes &optional (pos 0))
(let ((length (aref bytes pos))
(pos1 (1+ pos)))
View
@@ -81,12 +81,6 @@
(uint32-to-bytes (length bytes))
bytes)))
-(defun read-external-binary (stream) ;; OBSOLETE?
- ;; Assume tag +binary-ext+ is read
- (let* ((length (read-uint32 stream))
- (bytes (read-bytes length stream)))
- (make-instance 'erlang-binary :bytes bytes)))
-
(defun decode-external-binary (bytes &optional (pos 0))
(let ((length (bytes-to-uint32 bytes pos))
(pos4 (+ 4 pos)))
@@ -111,13 +105,6 @@
(vector bits)
bytes)))
-(defun read-external-bit-binary (stream) ;; OBSOLETE?
- ;; Assume tag +bit-binary-ext+ is read
- (let* ((length (read-uint32 stream)))
- (make-instance 'erlang-binary
- :bits (read-byte stream)
- :bytes (read-bytes length stream))))
-
(defun decode-external-bit-binary (bytes &optional (pos 0))
(let ((length (bytes-to-uint32 bytes pos))
(bits (aref bytes (+ 4 pos)))
View
@@ -34,10 +34,6 @@
(vector +new-float-ext+)
(double-float-to-bytes double-float)))
-(defun read-external-new-float (stream) ;; OBSOLETE?
- ;; Assume tag +new-float-ext+ is read
- (decode-external-new-float (read-bytes 8 stream)))
-
(defun decode-external-new-float (bytes &optional (pos 0))
(values (bytes-to-double-float (subseq bytes pos))
(+ 8 pos)))
@@ -58,10 +54,6 @@
(vector +float-ext+)
(string-to-bytes (format nil "~(~,20E~)" float))))
-(defun read-external-float (stream) ;; OBSOLETE?
- ;; Assume tag +float-ext+ is read
- (decode-external-float (read-bytes 31 stream)))
-
(defun decode-external-float (bytes &optional (pos 0))
(let ((string (bytes-to-string bytes 31 pos)))
(values (read-from-string string)
View
@@ -88,18 +88,6 @@
(encode uniq)
(list-contents-to-bytes free-vars))))
-(defun read-external-fun (stream) ;; OBSOLETE?
- ;; Assume tag +fun-ext+ is read
- (let ((free-vars-length (read-uint32 stream)))
- (make-instance 'erlang-old-internal-fun
- :pid (read-erlang-pid stream)
- :module (read-erlang-atom stream)
- :index (read-erlang-integer stream)
- :uniq (read-erlang-integer stream)
- :free-vars (loop
- repeat free-vars-length
- collect (read-erlang-term stream)))))
-
(defun decode-external-fun (bytes &optional (pos 0))
(let ((free-vars-length (bytes-to-uint32 bytes pos)))
(multiple-value-bind* (((pid pos1) (decode-erlang-pid bytes (+ pos 4)))
@@ -146,14 +134,6 @@
(uint32-to-bytes (+ 4 (length bytes)))
bytes))))
-(defun read-external-new-fun (stream) ;; OBSOLETE?
- ;; Assume tag +new-fun-ext+ is read
- (let ((size-bytes (read-bytes 4 stream)))
- (decode-external-new-fun
- (concatenate '(vector octet)
- size-bytes
- (read-bytes (- (bytes-to-uint32 size-bytes) 4) stream)))))
-
(defun decode-external-new-fun (bytes &optional (pos 0))
(let ((size (bytes-to-uint32 bytes pos))
(arity (aref bytes (+ 4 pos)))
@@ -201,13 +181,6 @@
(encode function)
(encode arity))))
-(defun read-external-export (stream) ;; OBSOLETE?
- ;; Assume tag +export-ext+ is read
- (make-instance 'erlang-external-fun
- :module (read-erlang-atom stream)
- :function (read-erlang-atom stream)
- :arity (read-erlang-integer stream)))
-
(defun decode-external-export (bytes &optional (pos 0))
(multiple-value-bind* (((module pos1) (decode-erlang-atom bytes pos))
((function pos2) (decode-erlang-atom bytes pos1))
View
@@ -27,28 +27,6 @@
(t
(encode-external-large-big x))))
-(defun read-erlang-integer (stream) ;; OBSOLETE?
- (let ((tag (read-byte stream)))
- (case tag
- (#.+small-integer-ext+
- (read-external-small-integer stream))
- (#.+integer-ext+
- (read-external-integer stream))
- (#.+small-big-ext+
- (read-external-small-big stream))
- (#.+large-big-ext+
- (read-external-large-big stream))
- (#'+compressed-term+
- (read-compressed-erlang-term stream))
- (otherwise
- (error 'unexpected-message-tag-error
- :received-tag tag
- :expected-tags (list +small-integer-ext+
- +integer-ext+
- +small-big-ext+
- +large-big-ext+
- +compressed-term+))) )))
-
(defun decode-erlang-integer (bytes &optional (pos 0))
(let ((tag (aref bytes pos)))
(case tag
@@ -83,10 +61,6 @@
(defun encode-external-small-integer (uint8) ;; (<= 0 X 255)
(vector +small-integer-ext+ uint8))
-(defun read-external-small-integer (stream) ;; OBSOLETE?
- ;; Assume tag +small-integer-ext+ is read
- (decode-external-small-integer (read-bytes 1 stream)))
-
(defun decode-external-small-integer (bytes &optional (pos 0))
(values (aref bytes pos)
(1+ pos)))
@@ -103,10 +77,6 @@
(defun encode-external-integer (int32) ;; (<= (- (expt 2 31)) X (1- (expt 2 31)))
(concatenate '(vector octet) (vector +integer-ext+) (uint32-to-bytes int32)))
-(defun read-external-integer (stream) ;; OBSOLETE?
- ;; Assume tag +integer-ext+ is read
- (decode-external-integer (read-bytes 4 stream)))
-
(defun decode-external-integer (bytes &optional (pos 0))
(values (bytes-to-signed-int32 bytes pos)
(+ 4 pos)))
@@ -131,14 +101,6 @@
(vector +small-big-ext+ length sign)
(bignum-to-bytes unsigned-bignum length))))
-(defun read-external-small-big (stream) ;; OBSOLETE?
- ;; Assume tag +small-big-ext+ is read
- (let ((length (read-byte stream)))
- (decode-external-small-big
- (concatenate '(vector octet)
- (vector length)
- (read-bytes (1+ length) stream)))))
-
(defun decode-external-small-big (bytes &optional (pos 0))
(let ((length (aref bytes pos))
(sign (if (= 1 (aref bytes (1+ pos))) -1 1))
@@ -168,14 +130,6 @@
(vector sign)
(bignum-to-bytes unsigned-bignum length))))
-(defun read-external-large-big (stream)
- ;; Assume tag +large-big-ext+ is read
- (let ((length-bytes (read-bytes 4 stream)))
- (decode-external-large-big
- (concatenate '(vector octet)
- length-bytes
- (read-bytes (bytes-to-uint32 length-bytes) stream)))))
-
(defun decode-external-large-big (bytes &optional (pos 0))
(let ((length (bytes-to-uint32 bytes pos))
(sign (if (= 1 (aref bytes (+ 4 pos))) -1 1))
View
@@ -34,10 +34,6 @@
(defun encode-external-nil ()
(vector +nil-ext+))
-(defun read-external-nil (stream)
- ;; Assume tag +nil-ext+ is read
- (decode-external-nil (read-bytes 0 stream)))
-
(defun decode-external-nil (bytes &optional (pos 0))
(declare (ignore bytes))
(values nil pos))
@@ -60,10 +56,6 @@
elements
tail)))
-(defun read-external-list (stream) ;; OBSOLETE?
- ;; Assume tag +list-ext+ is read
- (read-list-contents stream (read-uint32 stream)))
-
(defun decode-external-list (bytes &optional (pos 0))
(decode-list-contents bytes (bytes-to-uint32 bytes pos) (+ 4 pos)))
@@ -88,12 +80,6 @@
:atom-cache-entries atom-cache-entries))))
(return (values bytes tail-bytes length))) ))
-(defun read-list-contents (stream length)
- (if (= 0 length)
- (read-erlang-term stream)
- (cons (read-erlang-term stream)
- (read-list-contents stream (1- length)))))
-
(defun decode-list-contents (bytes length &optional (pos 0))
(if (= 0 length)
(decode bytes :start pos)
Oops, something went wrong.

0 comments on commit 4d40008

Please sign in to comment.