Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Zach Beane
zacl
Commits
0bf8b8a8
Commit
0bf8b8a8
authored
Nov 29, 2016
by
Zach Beane
Browse files
Consistently save and apply the stream-external-format to streams, sockets.
Should fix issue
#3
.
parent
4d6a6552
Changes
2
Hide whitespace changes
Inline
Side-by-side
package-excl.lisp
View file @
0bf8b8a8
...
...
@@ -8,6 +8,7 @@
(
defparameter
*external-format-translations*
'
((
:octets
.
:latin1
)
(
:latin1-base
.
:latin1
)
(
:utf-8
.
:utf-8
)
(
nil
.
:latin1
)))
(
defun
translate-external-format
(
external-format
)
...
...
@@ -183,8 +184,7 @@ values otherwise."
(
defun
excl:find-external-format
(
name
&key
errorp
)
(
declare
(
ignore
errorp
))
(
declare
(
ignore
name
))
:latin-1
)
(
translate-external-format
name
))
(
defun
excl:crlf-base-ef
(
external-format
)
external-format
)
...
...
@@ -364,7 +364,7 @@ values otherwise."
(
excl::oc-state
)
(
external-format
:initarg
:external-format
:initform
:
default
:initform
:
latin1
:accessor
zacl-cl:stream-external-format
)))
(
defmethod
shared-initialize
:after
((
stream
...
...
@@ -399,7 +399,8 @@ values otherwise."
(
defmethod
stream-write-string
((
stream
excl:single-channel-simple-stream
)
string
&optional
start
end
)
(
unless
start
(
setf
start
0
))
(
unless
end
(
setf
end
(
length
string
)))
(
let
((
buffer
(
string-to-octets
string
:start
start
:end
end
)))
(
let
((
buffer
(
string-to-octets
string
:start
start
:end
end
:external-format
(
zacl-cl:stream-external-format
stream
))))
(
excl:device-write
stream
buffer
0
(
length
buffer
)
nil
)))
(
defmethod
stream-write-sequence
((
stream
excl:single-channel-simple-stream
)
sequence
start
end
&key
&allow-other-keys
)
...
...
package-socket.lisp
View file @
0bf8b8a8
...
...
@@ -35,7 +35,12 @@
(
bytes-written
:initarg
:bytes-written
:initform
0
:accessor
bytes-written
)))
:accessor
bytes-written
)
(
external-format
:initarg
:external-format
:initform
:latin-1
:reader
socket-ef
:accessor
zacl-cl:stream-external-format
)))
(
defmethod
stream-write-byte
:after
((
stream
zacl-socket
)
byte
)
(
declare
(
ignore
byte
))
...
...
@@ -47,7 +52,7 @@
(
defmethod
stream-write-char
((
stream
zacl-socket
)
char
)
(
map
nil
(
lambda
(
octet
)
(
stream-write-byte
stream
octet
))
(
string-to-octets
(
string
char
))))
(
string-to-octets
(
string
char
)
:external-format
(
socket-ef
stream
)
)))
(
defmethod
stream-write-sequence
:after
((
stream
zacl-socket
)
sequence
start
end
&key
&allow-other-keys
)
...
...
@@ -63,7 +68,8 @@
(
defmethod
stream-write-sequence
((
stream
zacl-socket
)
sequence
start
end
&key
&allow-other-keys
)
(
when
(
typep
sequence
'string
)
(
setf
sequence
(
string-to-octets
sequence
:start
start
:end
end
))
(
setf
sequence
(
string-to-octets
sequence
:start
start
:end
end
:external-format
(
socket-ef
stream
)))
(
setf
start
0
)
(
setf
end
(
length
sequence
)))
(
write-sequence
sequence
(
real-stream
stream
)
:start
start
:end
end
))
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment