@@ -35,33 +35,6 @@ means that the endianess is determined by the dynamic value of *endian*."
35
35
" *endian* must be (dynamically) bound to either :big-endian or
36
36
:little-endian while reading endian-sensitive types." )
37
37
38
- ; ;; ----------------------------------------------------------------
39
- ; ;; Binary Types Namespace
40
- ; ;; ----------------------------------------------------------------
41
-
42
- (defvar *binary-type-namespace* (make-hash-table :test #' eq )
43
- " Maps binary type's names (which are symbols) to their binary-type class object." )
44
-
45
- (defun find-binary-type (name &optional (errorp t ))
46
- (or (gethash name *binary-type-namespace* )
47
- (if errorp
48
- (error " Unable to find binary type named ~S ." name)
49
- nil )))
50
-
51
- (defun (setf find-binary-type ) (value name)
52
- (check-type value binary-type)
53
- (let ((old-value (find-binary-type name nil )))
54
- (when (and old-value (not (eq (class-of value) (class-of old-value))))
55
- (warn " Redefining binary-type ~A from ~A to ~A ."
56
- name (type-of old-value) (type-of value))))
57
- (setf (gethash name *binary-type-namespace* ) value))
58
-
59
- (defun find-binary-type-name (type )
60
- (maphash #' (lambda (key val)
61
- (when (eq type val)
62
- (return-from find-binary-type-name key)))
63
- *binary-type-namespace* ))
64
-
65
38
; ;; ----------------------------------------------------------------
66
39
; ;; Base Binary Type (Abstract)
67
40
; ;; ----------------------------------------------------------------
@@ -102,6 +75,33 @@ means that the endianess is determined by the dynamic value of *endian*."
102
75
(print-unreadable-object (object stream :type ' binary-type)
103
76
(format stream " ~A " (binary-type-name object))))
104
77
78
+ ; ;; ----------------------------------------------------------------
79
+ ; ;; Binary Types Namespace
80
+ ; ;; ----------------------------------------------------------------
81
+
82
+ (defvar *binary-type-namespace* (make-hash-table :test #' eq )
83
+ " Maps binary type's names (which are symbols) to their binary-type class object." )
84
+
85
+ (defun find-binary-type (name &optional (errorp t ))
86
+ (or (gethash name *binary-type-namespace* )
87
+ (if errorp
88
+ (error " Unable to find binary type named ~S ." name)
89
+ nil )))
90
+
91
+ (defun (setf find-binary-type ) (value name)
92
+ (check-type value binary-type)
93
+ (let ((old-value (find-binary-type name nil )))
94
+ (when (and old-value (not (eq (class-of value) (class-of old-value))))
95
+ (warn " Redefining binary-type ~A from ~A to ~A ."
96
+ name (type-of old-value) (type-of value))))
97
+ (setf (gethash name *binary-type-namespace* ) value))
98
+
99
+ (defun find-binary-type-name (type )
100
+ (maphash #' (lambda (key val)
101
+ (when (eq type val)
102
+ (return-from find-binary-type-name key)))
103
+ *binary-type-namespace* ))
104
+
105
105
; ;; ----------------------------------------------------------------
106
106
; ;; Integer Type (Abstract)
107
107
; ;; ----------------------------------------------------------------
@@ -1042,6 +1042,8 @@ binding is shadowed."
1042
1042
(funcall , save-brb-var s)))))
1043
1043
,@ body)))
1044
1044
1045
+ ; ; Siebel, and SBCL, warn against this style. Consider making them
1046
+ ; ; all keyword parameters in the next release.
1045
1047
(defmacro with-binary-output-to-vector
1046
1048
((stream-var &optional (vector-or-size-form 0 )
1047
1049
&key (adjustable (and (integerp vector-or-size-form)
@@ -1153,7 +1155,7 @@ otherwise the value of BODY."
1153
1155
(check-type size (integer 1 * ))
1154
1156
(check-type endian endianess)
1155
1157
` (progn
1156
- (deftype , name () ' (ieee-754 , ( * 8 size)) )
1158
+ (deftype , name () ' float )
1157
1159
(setf (find-binary-type ' ,name)
1158
1160
(make-instance ' binary-float
1159
1161
' name ' ,name
0 commit comments