Changeset 5354
- Timestamp:
- Oct 15, 2006, 4:51:59 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ccl/level-1/l1-streams.lisp (modified) (19 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ccl/level-1/l1-streams.lisp
r5335 r5354 289 289 t) 290 290 291 (defmethod stream-external-format ((x t)) 292 (report-bad-arg x 'stream)) 293 294 (defmethod stream-external-format ((s stream)) 295 nil) 296 297 298 (defmethod (setf stream-external-format) (new (s t)) 299 (check-type new 'external-format) 300 (report-bad-arg s 'stream)) 301 302 (defmethod (setf stream-external-format) (new (s t)) 303 (check-type new 'external-format) 304 (stream-external-format s)) 305 306 307 291 308 (defmethod stream-fresh-line ((stream output-stream)) 292 309 (terpri stream) … … 305 322 (defmethod stream-clear-input ((x t)) 306 323 (report-bad-arg x 'stream)) 324 307 325 (defmethod stream-clear-input ((stream input-stream)) nil) 308 326 … … 385 403 (write-char-without-translation-when-locked-function 'iblock-no-char-output) 386 404 (sharing nil) 387 ( reserved0nil)405 (line-termination nil) 388 406 (reserved1 nil) 389 407 (reserved2 nil) … … 1210 1228 (%ioblock-read-swapped-u16-encoded-char ioblock))) 1211 1229 1230 (declaim (inline %ioblock-read-u32-encoded-char)) 1231 (defun %ioblock-read-u32-encoded-char (ioblock) 1232 (declare (optimize (speed 3) (safety 0))) 1233 (let* ((ch (ioblock-untyi-char ioblock))) 1234 (if ch 1235 (prog1 ch 1236 (setf (ioblock-untyi-char ioblock) nil)) 1237 (let* ((1st-unit (%ioblock-read-u32-code-unit ioblock))) 1238 (if (eq 1st-unit :eof) 1239 1st-unit 1240 (locally 1241 (declare (type (unsigned-byte 16) 1st-unit)) 1242 (if (< 1st-unit 1243 (the (mod #x110000) (ioblock-literal-char-code-limit ioblock))) 1244 (code-char 1st-unit) 1245 (funcall (ioblock-decode-input-function ioblock) 1246 1st-unit 1247 #'%ioblock-read-u32-code-unit 1248 ioblock)))))))) 1249 1250 (defun %private-ioblock-read-u32-encoded-char (ioblock) 1251 (declare (optimize (speed 3) (safety 0))) 1252 (check-ioblock-owner ioblock) 1253 (%ioblock-read-u32-encoded-char ioblock)) 1254 1255 (defun %locked-ioblock-read-u32-encoded-char (ioblock) 1256 (declare (optimize (speed 3) (safety 0))) 1257 (with-ioblock-input-lock-grabbed (ioblock) 1258 (%ioblock-read-u32-encoded-char ioblock))) 1259 1260 (declaim (inline %ioblock-read-swapped-u32-encoded-char)) 1261 (defun %ioblock-read-swapped-u32-encoded-char (ioblock) 1262 (declare (optimize (speed 3) (safety 0))) 1263 (let* ((ch (ioblock-untyi-char ioblock))) 1264 (if ch 1265 (prog1 ch 1266 (setf (ioblock-untyi-char ioblock) nil)) 1267 (let* ((1st-unit (%ioblock-read-swapped-u32-code-unit ioblock))) 1268 (if (eq 1st-unit :eof) 1269 1st-unit 1270 (locally 1271 (declare (type (unsigned-byte 16) 1st-unit)) 1272 (if (< 1st-unit 1273 (the (mod #x110000) (ioblock-literal-char-code-limit ioblock))) 1274 (code-char 1st-unit) 1275 (funcall (ioblock-decode-input-function ioblock) 1276 1st-unit 1277 #'%ioblock-read-swapped-u32-code-unit 1278 ioblock)))))))) 1279 1280 (defun %private-ioblock-read-swapped-u32-encoded-char (ioblock) 1281 (declare (optimize (speed 3) (safety 0))) 1282 (check-ioblock-owner ioblock) 1283 (%ioblock-read-swapped-u32-encoded-char ioblock)) 1284 1285 (defun %locked-ioblock-read-swapped-u32-encoded-char (ioblock) 1286 (declare (optimize (speed 3) (safety 0))) 1287 (with-ioblock-input-lock-grabbed (ioblock) 1288 (%ioblock-read-swapped-u32-encoded-char ioblock))) 1289 1212 1290 (declaim (inline %ioblock-tyi-no-hang)) 1213 1291 (defun %ioblock-tyi-no-hang (ioblock) … … 1484 1562 (incf idx) 1485 1563 (when (= idx limit) 1564 (when (> idx count) 1565 (setf (io-buffer-count buf) idx)) 1486 1566 (%ioblock-force-output ioblock nil) 1487 1567 (setq idx 0 count 0)) … … 1516 1596 (incf idx) 1517 1597 (when (= idx limit) 1598 (when (> idx count) 1599 (setf (io-buffer-count buf) idx)) 1518 1600 (%ioblock-force-output ioblock nil) 1519 1601 (setq idx 0 count 0)) 1520 1602 (setf (aref vector idx) b0) 1603 (incf idx) 1604 (setf (io-buffer-idx buf) idx) 1605 (when (> idx count) 1606 (setf (io-buffer-count buf) idx)) 1607 (setf (ioblock-dirty ioblock) t) 1608 element)) 1609 1610 (declaim (inline %ioblock-write-u32-code-unit)) 1611 (defun %ioblock-write-u32-code-unit (ioblock element) 1612 (declare (optimize (speed 3) (safety 0)) 1613 (type (unsigned-byte 16) element)) 1614 (let* ((buf (ioblock-outbuf ioblock)) 1615 (idx (io-buffer-idx buf)) 1616 (count (io-buffer-count buf)) 1617 (limit (io-buffer-limit buf)) 1618 (vector (io-buffer-buffer buf)) 1619 (b0 #+big-endian-target (ldb (byte 8 24) element) 1620 #+little-endian-target (ldb (byte 8 0) element)) 1621 (b1 #+big-endian-target (ldb (byte 8 16) element) 1622 #+little-endian-target (ldb (byte 8 8) element)) 1623 (b2 #+big-endian-target (ldb (byte 8 8) element) 1624 #+little-endian-target (ldb (byte 8 16) element)) 1625 (b3 #+big-endian-target (ldb (byte 8 0) element) 1626 #+little-endian-target (ldb (byte 8 24) element))) 1627 (declare (fixnum idx limit count) 1628 (type (simple-array (unsigned-byte 8) (*)) vector) 1629 (type (unsigned-byte 8) b0 b1 b2 b3)) 1630 (when (= idx limit) 1631 (%ioblock-force-output ioblock nil) 1632 (setq idx 0 count 0)) 1633 (setf (aref vector idx) b0) 1634 (incf idx) 1635 (when (= idx limit) 1636 (when (> idx count) 1637 (setf (io-buffer-count buf) idx)) 1638 (%ioblock-force-output ioblock nil) 1639 (setq idx 0 count 0)) 1640 (setf (aref vector idx) b1) 1641 (incf idx) 1642 (when (= idx limit) 1643 (when (> idx count) 1644 (setf (io-buffer-count buf) idx)) 1645 (%ioblock-force-output ioblock nil) 1646 (setq idx 0 count 0)) 1647 (setf (aref vector idx) b2) 1648 (incf idx) 1649 (when (= idx limit) 1650 (when (> idx count) 1651 (setf (io-buffer-count buf) idx)) 1652 (%ioblock-force-output ioblock nil) 1653 (setq idx 0 count 0)) 1654 (setf (aref vector idx) b3) 1655 (incf idx) 1656 (setf (io-buffer-idx buf) idx) 1657 (when (> idx count) 1658 (setf (io-buffer-count buf) idx)) 1659 (setf (ioblock-dirty ioblock) t) 1660 element)) 1661 1662 (declaim (inline %ioblock-write-swapped-u32-code-unit)) 1663 (defun %ioblock-write-swapped-u32-code-unit (ioblock element) 1664 (declare (optimize (speed 3) (safety 0)) 1665 (type (unsigned-byte 16) element)) 1666 (let* ((buf (ioblock-outbuf ioblock)) 1667 (idx (io-buffer-idx buf)) 1668 (count (io-buffer-count buf)) 1669 (limit (io-buffer-limit buf)) 1670 (vector (io-buffer-buffer buf)) 1671 (b0 #+little-endian-target (ldb (byte 8 24) element) 1672 #+big-endian-target (ldb (byte 8 0) element)) 1673 (b1 #+little-endian-target (ldb (byte 8 16) element) 1674 #+big-endian-target (ldb (byte 8 8) element)) 1675 (b2 #+little-endian-target (ldb (byte 8 8) element) 1676 #+big-endian-target (ldb (byte 8 16) element)) 1677 (b3 #+little-endian-target (ldb (byte 8 0) element) 1678 #+big-endian-target (ldb (byte 8 24) element))) 1679 (declare (fixnum idx limit count) 1680 (type (simple-array (unsigned-byte 8) (*)) vector) 1681 (type (unsigned-byte 8) b0 b1 b2 b3)) 1682 (when (= idx limit) 1683 (%ioblock-force-output ioblock nil) 1684 (setq idx 0 count 0)) 1685 (setf (aref vector idx) b0) 1686 (incf idx) 1687 (when (= idx limit) 1688 (when (> idx count) 1689 (setf (io-buffer-count buf) idx)) 1690 (%ioblock-force-output ioblock nil) 1691 (setq idx 0 count 0)) 1692 (setf (aref vector idx) b1) 1693 (incf idx) 1694 (when (= idx limit) 1695 (when (> idx count) 1696 (setf (io-buffer-count buf) idx)) 1697 (%ioblock-force-output ioblock nil) 1698 (setq idx 0 count 0)) 1699 (setf (aref vector idx) b2) 1700 (incf idx) 1701 (when (= idx limit) 1702 (when (> idx count) 1703 (setf (io-buffer-count buf) idx)) 1704 (%ioblock-force-output ioblock nil) 1705 (setq idx 0 count 0)) 1706 (setf (aref vector idx) b3) 1521 1707 (incf idx) 1522 1708 (setf (io-buffer-idx buf) idx) … … 1719 1905 (when (ioblock-pending-byte-order-mark ioblock) 1720 1906 (setf (ioblock-pending-byte-order-mark ioblock) nil) 1721 (funcall (ioblock-encode-output-function ioblock) 1722 byte-order-mark 1723 #'%ioblock-write-u16-code-unit 1724 ioblock)) 1907 (%ioblock-write-u16-code-unit ioblock byte-order-mark)) 1725 1908 (if (eq char #\linefeed) 1726 1909 (setf (ioblock-charpos ioblock) 0) … … 1729 1912 (declare (type (mod #x110000) code)) 1730 1913 (if (< code (the fixnum (ioblock-literal-char-code-limit ioblock))) 1731 (%ioblock-write-u16- element ioblock code)1914 (%ioblock-write-u16-code-unit ioblock code) 1732 1915 (funcall (ioblock-encode-output-function ioblock) 1733 1916 char … … 1820 2003 1821 2004 2005 (declaim (inline %ioblock-write-u32-encoded-char)) 2006 (defun %ioblock-write-u32-encoded-char (ioblock char) 2007 (declare (optimize (speed 3) (safety 0))) 2008 (when (ioblock-pending-byte-order-mark ioblock) 2009 (setf (ioblock-pending-byte-order-mark ioblock) nil) 2010 (%ioblock-write-u32-code-unit ioblock byte-order-mark)) 2011 (if (eq char #\linefeed) 2012 (setf (ioblock-charpos ioblock) 0) 2013 (incf (ioblock-charpos ioblock))) 2014 (let* ((code (char-code char))) 2015 (declare (type (mod #x110000 code))) 2016 (if (< code (the fixnum (ioblock-literal-char-code-limit ioblock))) 2017 (%ioblock-write-u32-code-unit ioblock code) 2018 (funcall (ioblock-encode-output-function ioblock) 2019 code 2020 #'%ioblock-write-u32-code-unit 2021 ioblock)))) 2022 2023 (defun %private-ioblock-write-u32-encoded-char (ioblock char) 2024 (declare (optimize (speed 3) (safety 0))) 2025 (check-ioblock-owner ioblock) 2026 (%ioblock-write-u32-encoded-char ioblock char)) 2027 2028 (defun %locked-ioblock-write-u32-encoded-char (ioblock char) 2029 (declare (optimize (speed 3) (safety 0))) 2030 (with-ioblock-output-lock-grabbed (ioblock) 2031 (%ioblock-write-u32-encoded-char ioblock char))) 2032 2033 (defun %ioblock-write-u32-encoded-simple-string (ioblock string start-char num-chars) 2034 (declare (fixnum start-char num-chars) 2035 (simple-base-strng string) 2036 (optimize (speed 3) (safety 0))) 2037 (when (ioblock-pending-byte-order-mark ioblock) 2038 (setf (ioblock-pending-byte-order-mark ioblock) nil) 2039 (%ioblock-write-u32-code-unit ioblock byte-order-mark-char-code)) 2040 (do* ((i 0 (1+ i)) 2041 (col (ioblock-charpos ioblock)) 2042 (limit (ioblock-literal-char-code-limit ioblock)) 2043 (encode-function (ioblock-encode-output-function ioblock)) 2044 (start-char start-char (1+ start-char))) 2045 ((= i num-chars) (setf (ioblock-charpos ioblock) col) num-chars) 2046 (declare (fixnum i start-char limit)) 2047 (let* ((char (schar string start-char)) 2048 (code (char-code char))) 2049 (declare (type (mod #x110000) code)) 2050 (if (eq char #\newline) 2051 (setq col 0) 2052 (incf col)) 2053 (if (< code limit) 2054 (%ioblock-write-u32-code-unit ioblock code) 2055 (funcall encode-function char #'%ioblock-write-u32-code-unit ioblock))))) 2056 2057 2058 (declaim (inline %ioblock-write-swapped-u32-encoded-char)) 2059 (defun %ioblock-write-swapped-u32-encoded-char (ioblock char) 2060 (declare (optimize (speed 3) (safety 0))) 2061 (if (eq char #\linefeed) 2062 (setf (ioblock-charpos ioblock) 0) 2063 (incf (ioblock-charpos ioblock))) 2064 (let* ((code (char-code char))) 2065 (declare (type (mod #x110000 code))) 2066 (if (< code (the fixnum (ioblock-literal-char-code-limit ioblock))) 2067 (%ioblock-write-swapped-u32-code-unit ioblock code) 2068 (funcall (ioblock-encode-output-function ioblock) 2069 code 2070 #'%ioblock-write-swapped-u32-code-unit 2071 ioblock)))) 2072 2073 (defun %private-ioblock-write-swapped-u32-encoded-char (ioblock char) 2074 (declare (optimize (speed 3) (safety 0))) 2075 (check-ioblock-owner ioblock) 2076 (%ioblock-write-swapped-u32-encoded-char ioblock char)) 2077 2078 (defun %locked-ioblock-write-swapped-u32-encoded-char (ioblock char) 2079 (declare (optimize (speed 3) (safety 0))) 2080 (with-ioblock-output-lock-grabbed (ioblock) 2081 (%ioblock-write-swapped-u32-encoded-char ioblock char))) 2082 2083 (defun %ioblock-write-swapped-u32-encoded-simple-string (ioblock string start-char num-chars) 2084 (declare (fixnum start-char num-chars) 2085 (simple-base-strng string) 2086 (optimize (speed 3) (safety 0))) 2087 (do* ((i 0 (1+ i)) 2088 (col (ioblock-charpos ioblock)) 2089 (limit (ioblock-literal-char-code-limit ioblock)) 2090 (encode-function (ioblock-encode-output-function ioblock)) 2091 (start-char start-char (1+ start-char))) 2092 ((= i num-chars) (setf (ioblock-charpos ioblock) col) num-chars) 2093 (declare (fixnum i start-char limit)) 2094 (let* ((char (schar string start-char)) 2095 (code (char-code char))) 2096 (declare (type (mod #x110000) code)) 2097 (if (eq char #\newline) 2098 (setq col 0) 2099 (incf col)) 2100 (if (< code limit) 2101 (%ioblock-write-swapped-u32-code-unit ioblock code) 2102 (funcall encode-function char #'%ioblock-write-swapped-u32-code-unit ioblock))))) 2103 1822 2104 (declaim (inline %ioblock-write-u8-byte)) 1823 2105 (defun %ioblock-write-u8-byte (ioblock byte) … … 1950 2232 (defun %ioblock-unencoded-read-line (ioblock) 1951 2233 (let* ((inbuf (ioblock-inbuf ioblock))) 1952 (if (io-buffer-translate inbuf) 1953 (%ioblock-encoded-read-line ioblock) 1954 (let* ((string "") 1955 (len 0) 1956 (eof nil) 1957 (buf (io-buffer-buffer inbuf)) 1958 (newline (char-code #\newline))) 1959 (let* ((ch (ioblock-untyi-char ioblock))) 1960 (when ch 1961 (setf (ioblock-untyi-char ioblock) nil) 1962 (if (eql ch #\newline) 1963 (return-from %ioblock-unencoded-read-line 1964 (values string nil)) 2234 (let* ((string "") 2235 (len 0) 2236 (eof nil) 2237 (buf (io-buffer-buffer inbuf)) 2238 (newline (char-code #\newline))) 2239 (let* ((ch (ioblock-untyi-char ioblock))) 2240 (when ch 2241 (setf (ioblock-untyi-char ioblock) nil) 2242 (if (eql ch #\newline) 2243 (return-from %ioblock-unencoded-read-line 2244 (values string nil)) 2245 (progn 2246 (setq string (make-string 1) 2247 len 1) 2248 (setf (schar string 0) ch))))) 2249 (loop 2250 (let* ((more 0) 2251 (idx (io-buffer-idx inbuf)) 2252 (count (io-buffer-count inbuf))) 2253 (declare (fixnum idx count more)) 2254 (if (= idx count) 2255 (if eof 2256 (return (values string t)) 1965 2257 (progn 1966 (setq string (make-string 1) 1967 len 1) 1968 (setf (schar string 0) ch))))) 1969 (loop 1970 (let* ((more 0) 1971 (idx (io-buffer-idx inbuf)) 1972 (count (io-buffer-count inbuf))) 1973 (declare (fixnum idx count more)) 1974 (if (= idx count) 1975 (if eof 1976 (return (values string t)) 1977 (progn 1978 (setq eof t) 1979 (%ioblock-advance ioblock t))) 1980 (progn 1981 (setq eof nil) 1982 (let* ((pos (position newline buf :start idx :end count))) 1983 (when pos 1984 (locally (declare (fixnum pos)) 1985 (setf (io-buffer-idx inbuf) (the fixnum (1+ pos))) 1986 (setq more (- pos idx)) 1987 (unless (zerop more) 1988 (setq string 1989 (%extend-vector 1990 0 string (the fixnum (+ len more))))) 1991 (%copy-u8-to-string 1992 buf idx string len more) 1993 (return (values string nil)))) 1994 ;; No #\newline in the buffer. Read everything that's 1995 ;; there into the string, and fill the buffer again. 1996 (setf (io-buffer-idx inbuf) count) 1997 (setq more (- count idx) 1998 string (%extend-vector 1999 0 string (the fixnum (+ len more)))) 2000 (%copy-u8-to-string 2001 buf idx string len more) 2002 (incf len more)))))))))) 2258 (setq eof t) 2259 (%ioblock-advance ioblock t))) 2260 (progn 2261 (setq eof nil) 2262 (let* ((pos (position newline buf :start idx :end count))) 2263 (when pos 2264 (locally (declare (fixnum pos)) 2265 (setf (io-buffer-idx inbuf) (the fixnum (1+ pos))) 2266 (setq more (- pos idx)) 2267 (unless (zerop more) 2268 (setq string 2269 (%extend-vector 2270 0 string (the fixnum (+ len more))))) 2271 (%copy-u8-to-string 2272 buf idx string len more) 2273 (return (values string nil)))) 2274 ;; No #\newline in the buffer. Read everything that's 2275 ;; there into the string, and fill the buffer again. 2276 (setf (io-buffer-idx inbuf) count) 2277 (setq more (- count idx) 2278 string (%extend-vector 2279 0 string (the fixnum (+ len more)))) 2280 (%copy-u8-to-string 2281 buf idx string len more) 2282 (incf len more))))))))) 2003 2283 2004 2284 ;;; There are lots of ways of doing better here, but in the most general … … 2366 2646 (:private '%private-ioblock-read-swapped-u16-encoded-char) 2367 2647 (:lock '%locked-ioblock-read-swapped-u16-encoded-char) 2368 (t '%ioblock-read-swapped-u16-encoded-char)))))))) 2648 (t '%ioblock-read-swapped-u16-encoded-char))))) 2649 (32 2650 (if (character-encoding-native-endianness encoding) 2651 (progn 2652 (setf (ioblock-read-char-when-locked-function ioblock) 2653 #'%ioblock-read-u32-encoded-char) 2654 (case sharing 2655 (:private #'%private-ioblock-read-u32-encoded-char) 2656 (:lock #'%locked-ioblock-read-u32-encoded-char) 2657 (t #'%ioblock-read-u32-encoded-char))) 2658 (progn 2659 (setf (ioblock-read-char-when-locked-function ioblock) 2660 #'%ioblock-read-swapped-u32-encoded-char) 2661 (case sharing 2662 (:private '#'%private-ioblock-read-swapped-u16-encoded-char) 2663 (:lock #'%locked-ioblock-read-swapped-u32-encoded-char) 2664 (t #'%ioblock-read-swapped-u32-encoded-char)))))))) 2369 2665 (progn 2370 2666 (setf (ioblock-peek-char-function ioblock) '%ioblock-peek-char) … … 2532 2828 (:private '%private-ioblock-write-swapped-u16-encoded-char) 2533 2829 (:lock '%locked-ioblock-write-swapped-u16-encoded-char) 2534 (t '%ioblock-write-swapped-u16-encoded-char))))))) 2830 (t '%ioblock-write-swapped-u16-encoded-char))))) 2831 (32 2832 (if (character-encoding-native-endianness encoding) 2833 (progn 2834 (setf (ioblock-write-char-when-locked-function ioblock) 2835 #'%ioblock-write-u32-encoded-char) 2836 (case sharing 2837 (:private #'%private-ioblock-write-u32-encoded-char) 2838 (:lock #'%locked-ioblock-write-u32-encoded-char) 2839 (t #'%ioblock-write-u32-encoded-char))) 2840 (progn 2841 (setf (ioblock-write-char-when-locked-function ioblock) 2842 #'%ioblock-write-swapped-u32-encoded-char) 2843 (case sharing 2844 (:private #'%private-ioblock-write-swapped-u32-encoded-char) 2845 (:lock #'%locked-ioblock-write-swapped-u32-encoded-char) 2846 (t #'%ioblock-write-swapped-u32-encoded-char))))))) 2535 2847 (setf (ioblock-write-simple-string-function ioblock) 2536 2848 (ecase unit-size … … 2539 2851 (if (character-encoding-native-endianness encoding) 2540 2852 '%ioblock-write-u16-encoded-simple-string 2541 '%ioblock-write-swapped-u16-encoded-simple-string)))) 2853 '%ioblock-write-swapped-u16-encoded-simple-string)) 2854 (32 2855 (if (character-encoding-native-endianness encoding) 2856 #'%ioblock-write-u32-encoded-simple-string 2857 #'%ioblock-write-swapped-u32-encoded-simple-string)))) 2542 2858 (when (character-encoding-use-byte-order-mark encoding) 2543 2859 (setf (ioblock-pending-byte-order-mark ioblock) t))) … … 2733 3049 (when (eq sharing :lock) 2734 3050 (setf (ioblock-inbuf-lock ioblock) (make-lock))) 3051 (setf (ioblock-line-termination ioblock) line-termination) 2735 3052 (setup-ioblock-input ioblock character-p element-type sharing encoding line-termination) 2736 3053 (setf (ioblock-element-shift ioblock) (max 0 (ceiling (log (/ in-size-in-octets insize) 2)))) … … 2834 3151 (:private '%private-ioblock-read-swapped-u16-encoded-char) 2835 3152 (:lock '%locked-ioblock-read-swapped-u16-encoded-char) 3153 (t '%ioblock-read-swapped-u16-encoded-char))) 3154 (32 3155 (setf (ioblock-read-char-when-locked-function ioblock) 3156 '%ioblock-read-swapped-u32-encoded-char) 3157 (case sharing 3158 (:private '%private-ioblock-read-swapped-u32-encoded-char) 3159 (:lock '%locked-ioblock-read-swapped-u32-encoded-char) 2836 3160 (t '%ioblock-read-swapped-u16-encoded-char)))) 2837 3161 (when output-p … … 2845 3169 (t '%ioblock-write-swapped-u16-encoded-char)) 2846 3170 (setf (ioblock-write-simple-string-function ioblock) 2847 '%ioblock-write-swapped-u8-encoded-simple-string)))))))))) 3171 '%ioblock-write-swapped-u16-encoded-simple-string)) 3172 (32 3173 (setf (ioblock-write-char-when-locked-function ioblock) 3174 '%ioblock-write-swapped-u32-encoded-char) 3175 (case sharing 3176 (:private '%private-ioblock-write-swapped-u32-encoded-char) 3177 (:lock '%locked-ioblock-write-swapped-u32-encoded-char) 3178 (t '%ioblock-write-swapped-u32-encoded-char)) 3179 (setf (ioblock-write-simple-string-function ioblock) 3180 '%ioblock-write-swapped-u32-encoded-simple-string)))))))))) 2848 3181 2849 3182 … … 2973 3306 ()) 2974 3307 3308 (defmethod stream-external-format ((s character-stream)) 3309 (make-external-format :character-encoding #+big-endian-target :utf32-be #+little-endian-target :utf32-le :line-termination :unix)) 3310 3311 3312 (defmethod (setf stream-external-format) (new (s character-stream)) 3313 (check-type new 'external-format) 3314 (stream-external-format s)) 3315 3316 2975 3317 (defclass fundamental-character-stream (fundamental-stream character-stream) 2976 3318 ()) … … 3143 3485 (make-built-in-class 'basic-binary-io-stream 'basic-binary-input-stream 'basic-binary-output-stream) 3144 3486 3487 3488 (defun %ioblock-external-format (ioblock) 3489 (let* ((encoding (or (ioblock-encoding ioblock) 3490 (get-character-encoding nil))) 3491 (line-termination (or (ioblock-line-termination ioblock) 3492 :unix))) 3493 (make-external-format :character-encoding (character-encoding-name encoding) 3494 :line-termination line-termination))) 3145 3495 3146 3496 (defmethod input-stream-shared-resource ((s basic-input-stream)) … … 5002 5352 (stream-line-column stream))) 5003 5353 5004 5005 5354 5355 (defmethod stream-external-format ((s basic-character-stream)) 5356 (%ioblock-external-format (stream-ioblock s t))) 5357 5358 (defmethod stream-external-format ((s buffered-stream-mixin)) 5359 (%ioblock-external-format (stream-ioblock s t))) 5006 5360 5007 5361
Note:
See TracChangeset
for help on using the changeset viewer.
