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
5b035fce
Commit
5b035fce
authored
31 years ago
by
ram
Browse files
Options
Downloads
Patches
Plain Diff
Changed stuff to use EOF-OR-LOSE for signalling EOF.
parent
e144bd66
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/fd-stream.lisp
+22
-35
22 additions, 35 deletions
code/fd-stream.lisp
with
22 additions
and
35 deletions
code/fd-stream.lisp
+
22
−
35
View file @
5b035fce
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
;;; Scott Fahlman or slisp-group@cs.cmu.edu.
;;; Scott Fahlman or slisp-group@cs.cmu.edu.
;;;
;;;
(
ext:file-comment
(
ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/fd-stream.lisp,v 1.2
5
1993/06/
08 11:20:31 wlott
Exp $"
)
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/fd-stream.lisp,v 1.2
6
1993/06/
24 13:48:47 ram
Exp $"
)
;;;
;;;
;;; **********************************************************************
;;; **********************************************************************
;;;
;;;
...
@@ -510,22 +510,20 @@
...
@@ -510,22 +510,20 @@
(
let
((
stream-var
(
gensym
))
(
let
((
stream-var
(
gensym
))
(
element-var
(
gensym
)))
(
element-var
(
gensym
)))
`
(
let
((
,
stream-var
,
stream
))
`
(
let
((
,
stream-var
,
stream
))
(
if
(
fd-stream-unread
,
stream
)
(
if
(
fd-stream-unread
,
stream-var
)
(
prog1
(
prog1
(
fd-stream-unread
,
stream
)
(
fd-stream-unread
,
stream-var
)
(
setf
(
fd-stream-unread
,
stream
)
nil
)
(
setf
(
fd-stream-unread
,
stream-var
)
nil
)
(
setf
(
fd-stream-listen
,
stream
)
nil
))
(
setf
(
fd-stream-listen
,
stream-var
)
nil
))
(
let
((
,
element-var
(
let
((
,
element-var
(
catch
'eof-input-catcher
(
catch
'eof-input-catcher
(
input-at-least
,
stream-var
,
bytes
)
(
input-at-least
,
stream-var
,
bytes
)
,@
read-forms
)))
,@
read-forms
)))
(
cond
(
,
element-var
(
cond
(
,
element-var
(
incf
(
fd-stream-ibuf-head
,
stream-var
)
,
bytes
)
(
incf
(
fd-stream-ibuf-head
,
stream-var
)
,
bytes
)
,
element-var
)
,
element-var
)
(
,
eof-error
(
t
(
error
"EOF while reading ~S"
stream
))
(
eof-or-lose
,
stream-var
,
eof-error
,
eof-value
))))))))
(
t
,
eof-value
)))))))
;;; DEF-INPUT-ROUTINE -- internal
;;; DEF-INPUT-ROUTINE -- internal
;;;
;;;
...
@@ -662,16 +660,9 @@ non-server method is also significantly more efficient for large reads.
...
@@ -662,16 +660,9 @@ non-server method is also significantly more efficient for large reads.
(decf bytes copy))
(decf bytes copy))
(when (zerop bytes)
(when (zerop bytes)
(return requested))))))
(return requested))))))
(cond (result)
(or result
((not eof-error-p)
(eof-or-lose stream eof-error-p
(- requested (/ bytes elsize)))
(- requested (/ bytes elsize))))))
(t
(error "Hit eof on ~S after reading ~D ~D~2:*-bit byte~P~*, ~
but ~D~2:* ~D-bit byte~P~:* ~[were~;was~:;were~] requested."
stream
(- requested (/ bytes elsize))
(* elsize 8)
requested)))))
|#
|#
...
@@ -741,10 +732,8 @@ non-server method is also significantly more efficient for large reads.
...
@@ -741,10 +732,8 @@ non-server method is also significantly more efficient for large reads.
(
error
"Error reading ~S: ~A"
stream
(
error
"Error reading ~S: ~A"
stream
(
unix:get-unix-error-msg
err
)))
(
unix:get-unix-error-msg
err
)))
(
when
(
<
count
now-needed
)
(
when
(
<
count
now-needed
)
(
if
eof-error-p
(
return
(
eof-or-lose
stream
eof-error-p
(
when
(
zerop
count
)
(
-
requested
now-needed
))))
(
error
"Unexpected eof on ~S."
stream
))
(
return
(
-
requested
now-needed
))))
(
decf
now-needed
count
)
(
decf
now-needed
count
)
(
when
(
zerop
now-needed
)
(
return
requested
))
(
when
(
zerop
now-needed
)
(
return
requested
))
(
incf
offset
count
)))))
(
incf
offset
count
)))))
...
@@ -759,10 +748,8 @@ non-server method is also significantly more efficient for large reads.
...
@@ -759,10 +748,8 @@ non-server method is also significantly more efficient for large reads.
(
unix:get-unix-error-msg
err
)))
(
unix:get-unix-error-msg
err
)))
(
incf
(
fd-stream-ibuf-tail
stream
)
count
)
(
incf
(
fd-stream-ibuf-tail
stream
)
count
)
(
when
(
<
count
now-needed
)
(
when
(
<
count
now-needed
)
(
if
eof-error-p
(
return
(
eof-or-lose
stream
eof-error-p
(
when
(
zerop
count
)
(
-
requested
now-needed
))))
(
error
"Unexpected eof on ~S."
stream
))
(
return
(
-
requested
now-needed
))))
(
let*
((
copy
(
min
now-needed
count
))
(
let*
((
copy
(
min
now-needed
count
))
(
copy-bits
(
*
copy
vm:byte-bits
))
(
copy-bits
(
*
copy
vm:byte-bits
))
(
buffer-start-bits
(
buffer-start-bits
...
...
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