Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
cmucl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Carl Shapiro
cmucl
Commits
e7459829
Commit
e7459829
authored
2 years ago
by
Raymond Toy
Browse files
Options
Downloads
Patches
Plain Diff
Fix
#140
: External format for streams that are not file-streams
parent
6764053d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/code/stream.lisp
+13
-5
13 additions, 5 deletions
src/code/stream.lisp
src/general-info/release-21e.md
+1
-0
1 addition, 0 deletions
src/general-info/release-21e.md
tests/issues.lisp
+47
-0
47 additions, 0 deletions
tests/issues.lisp
with
61 additions
and
5 deletions
src/code/stream.lisp
+
13
−
5
View file @
e7459829
...
...
@@ -290,13 +290,21 @@
(
stream-dispatch
stream
;; simple-stream
(
stream::%stream-external-format
stream
)
;; lisp-stream
(
typecase
stream
;; lisp-stream
. For unsupported streams, signal a type error.
(
e
typecase
stream
#+
unicode
(
fd-stream
(
fd-stream-external-format
stream
))
(
synonym-stream
(
stream-external-format
(
symbol-value
(
synonym-stream-symbol
stream
))))
(
t
:default
))
(
broadcast-stream
;; See http://www.lispworks.com/documentation/HyperSpec/Body/t_broadc.htm
(
let
((
components
(
broadcast-stream-streams
stream
)))
(
if
(
null
components
)
:default
(
stream-external-format
(
car
(
last
components
))))))
(
synonym-stream
;; Not defined by CLHS. What should happen if
;; (synonym-stream-symbol stream) is unbound?
(
stream-external-format
(
symbol-value
(
synonym-stream-symbol
stream
)))))
;; fundamental-stream
:default
))
...
...
This diff is collapsed.
Click to expand it.
src/general-info/release-21e.md
+
1
−
0
View file @
e7459829
...
...
@@ -60,6 +60,7 @@ public domain.
*
~~#134~~ Handle the case of
`(expt complex complex-rational)`
*
~~#136~~
`ensure-directories-exist`
should return the given pathspec
*
#139
`*default-external-format*`
defaults to
`:utf-8`
*
~~#140~~ External format for streams that are not
`file-stream`
's
*
~~#141~~ Disallow locales that are pathnames to a localedef file
*
~~#142~~
`(random 0)`
signals incorrect error
*
~~#147~~
`stream-line-column`
method missing for
`fundamental-character-output-stream`
...
...
This diff is collapsed.
Click to expand it.
tests/issues.lisp
+
47
−
0
View file @
e7459829
...
...
@@ -745,6 +745,53 @@
(
assert-equal
(
map
'list
#'
char-name
string
)
(
map
'list
#'
char-name
(
read-line
s
))))))
;;; Test stream-external-format for various types of streams.
(
define-test
issue.140.two-way-stream
(
:tag
:issues
)
(
with-open-file
(
in
(
merge-pathnames
"issues.lisp"
cmucl-test-runner::*load-path*
)
:direction
:input
:external-format
:utf-8
)
(
with-open-file
(
out
"/tmp/output.tst"
:direction
:output
:external-format
:utf-8
:if-exists
:supersede
)
(
let
((
two-way-stream
(
make-two-way-stream
in
out
)))
(
assert-error
'type-error
(
stream-external-format
two-way-stream
))))))
;; Test synonym-stream returns the format of the underlying stream.
(
define-test
issue.140.synonym-stream
(
:tag
:issues
)
(
with-open-file
(
s
(
merge-pathnames
"issues.lisp"
cmucl-test-runner::*load-path*
)
:direction
:input
:external-format
:iso8859-1
)
(
let
((
syn
(
make-synonym-stream
'*syn-stream*
)))
(
setf
syn
s
)
(
assert-equal
:iso8859-1
(
stream-external-format
syn
)))))
(
define-test
issue.140.broadcast-stream
(
:tag
:issues
)
;; Create 3 output streams. The exact external formats aren't
;; really important here as long as they're different for each file
;; so we can tell if we got the right answer.
(
with-open-file
(
s1
"/tmp/broad-1"
:direction
:output
:if-exists
:supersede
:external-format
:latin1
)
(
with-open-file
(
s2
"/tmp/broad-2"
:direction
:output
:if-exists
:supersede
:external-format
:utf-8
)
(
with-open-file
(
s3
"/tmp/broad-3"
:direction
:output
:if-exists
:supersede
:external-format
:utf-16
)
;; The format must be the value from the last stream.
(
assert-equal
:utf-16
(
stream-external-format
(
make-broadcast-stream
s1
s2
s3
)))))))
(
define-test
issue.150
(
:tag
:issues
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment