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
d38cd132
Commit
d38cd132
authored
34 years ago
by
wlott
Browse files
Options
Downloads
Patches
Plain Diff
Fixed echo streams to no longer echo unread characters twice.
parent
fcdb9db6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
code/stream.lisp
+30
-14
30 additions, 14 deletions
code/stream.lisp
with
30 additions
and
14 deletions
code/stream.lisp
+
30
−
14
View file @
d38cd132
...
...
@@ -7,7 +7,7 @@
;;; Scott Fahlman (FAHLMAN@CMUC).
;;; **********************************************************************
;;;
;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/stream.lisp,v 1.
7
1991/01/1
2 15:50:40 ram
Exp $
;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/stream.lisp,v 1.
8
1991/01/1
3 01:34:20 wlott
Exp $
;;;
;;; Stream functions for Spice Lisp.
;;; Written by Skef Wholey and Rob MacLachlan.
...
...
@@ -686,16 +686,18 @@
(
misc
#'
echo-misc
)
(
n-bin
#'
ill-bin
))
(
:print-function
%print-echo-stream
)
(
:constructor
make-echo-stream
(
input-stream
output-stream
))))
(
:constructor
make-echo-stream
(
input-stream
output-stream
)))
unread-stuff
)
(
macrolet
((
in-fun
(
name
fun
out-slot
&rest
args
)
`
(
defun
,
name
(
stream
,@
args
)
(
let*
((
in
(
two-way-stream-input-stream
stream
))
(
out
(
two-way-stream-output-stream
stream
))
(
result
(
,
fun
in
,@
args
)))
(
funcall
(
,
out-slot
out
)
out
result
)
result
))))
(
or
(
pop
(
echo-stream-unread-stuff
stream
))
(
let*
((
in
(
echo-stream-input-stream
stream
))
(
out
(
echo-stream-output-stream
stream
))
(
result
(
,
fun
in
,@
args
)))
(
funcall
(
,
out-slot
out
)
out
result
)
result
)))))
(
in-fun
echo-in
read-char
stream-out
eof-errorp
eof-value
)
(
in-fun
echo-bin
read-byte
stream-bout
eof-errorp
eof-value
))
...
...
@@ -705,15 +707,29 @@
(
out
(
two-way-stream-output-stream
stream
))
(
out-method
(
stream-misc
out
)))
(
case
operation
(
:listen
(
or
(
/=
(
the
fixnum
(
stream-in-index
in
))
in-buffer-length
)
(
:listen
(
or
(
not
(
null
(
echo-stream-unread-stuff
stream
)))
(
/=
(
the
fixnum
(
stream-in-index
in
))
in-buffer-length
)
(
funcall
in-method
in
:listen
)))
(
:unread
(
push
arg1
(
echo-stream-unread-stuff
stream
)))
(
:read-line
(
multiple-value-bind
(
result
eofp
)
(
read-line
in
arg1
arg2
)
(
if
eofp
(
write-string
result
out
)
(
write-line
result
out
))
(
values
result
eofp
)))
(
let*
((
stuff
(
echo-stream-unread-stuff
stream
))
(
newline-pos
(
position
#\newline
stuff
)))
(
if
newline-pos
(
progn
(
setf
(
echo-stream-unread-stuff
stream
)
(
subseq
stuff
(
1+
newline-pos
)))
(
values
(
coerce
(
subseq
stuff
0
newline-pos
)
'simple-string
)
nil
))
(
multiple-value-bind
(
result
eofp
)
(
read-line
in
arg1
arg2
)
(
if
eofp
(
write-string
result
out
)
(
write-line
result
out
))
(
setf
(
echo-stream-unread-stuff
stream
)
nil
)
(
values
(
if
stuff
(
concatenate
'simple-string
stuff
result
)
result
)
eofp
)))))
(
:element-type
(
let
((
in-type
(
funcall
in-method
in
:element-type
))
(
out-type
(
funcall
out-method
out
:element-type
)))
...
...
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