Skip to content

Commit 783b822

Browse files
committed
Merge pull request #3874 from stevengj/writable
spelling consistency: writeable -> writable; deprecate iswriteable
2 parents 1ffed5d + 7491030 commit 783b822

9 files changed

+35
-34
lines changed

base/deprecated.jl

+1
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ export PipeString
148148

149149
# 0.2
150150

151+
@deprecate iswriteable iswritable
151152
@deprecate localize localpart
152153
@deprecate logb exponent
153154
@deprecate ilogb exponent

base/exports.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,7 @@ export
10501050
fdio,
10511051
isreadonly,
10521052
UV_READABLE,
1053-
UV_WRITEABLE,
1053+
UV_WRITABLE,
10541054
flush,
10551055
getaddrinfo,
10561056
gethostname,
@@ -1177,7 +1177,7 @@ export
11771177
issetgid,
11781178
issticky,
11791179
isreadable,
1180-
iswriteable,
1180+
iswritable,
11811181
isexecutable,
11821182
uperm,
11831183
gperm,

base/io.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ else
2222
error("seriously? what is this machine?")
2323
end
2424

25-
isreadonly(s) = isreadable(s) && !iswriteable(s)
25+
isreadonly(s) = isreadable(s) && !iswritable(s)
2626

2727
## binary I/O ##
2828

@@ -245,7 +245,7 @@ close(s::IOStream) = ccall(:ios_close, Void, (Ptr{Void},), s.ios)
245245
isopen(s::IOStream) = bool(ccall(:ios_isopen, Cint, (Ptr{Void},), s.ios))
246246
flush(s::IOStream) = ccall(:ios_flush, Void, (Ptr{Void},), s.ios)
247247
isreadonly(s::IOStream) = bool(ccall(:ios_get_readonly, Cint, (Ptr{Void},), s.ios))
248-
iswriteable(s::IOStream) = !isreadonly(s)
248+
iswritable(s::IOStream) = !isreadonly(s)
249249
isreadable(s::IOStream) = true
250250

251251
truncate(s::IOStream, n::Integer) =

base/iobuffer.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ end
7474
read{T}(from::IOBuffer, ::Type{Ptr{T}}) = convert(Ptr{T}, read(from, Uint))
7575

7676
isreadable(io::IOBuffer) = io.readable
77-
iswriteable(io::IOBuffer) = io.writable
77+
iswritable(io::IOBuffer) = io.writable
7878

7979
# TODO: IOBuffer is not iterable, so doesn't really have a length.
8080
# This should maybe be sizeof() instead.

base/poll.jl

+12-12
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ end
2121
close(t::FileMonitor) = ccall(:jl_close_uv,Void,(Ptr{Void},),t.handle)
2222

2323
const UV_READABLE = 1
24-
const UV_WRITEABLE = 2
24+
const UV_WRITABLE = 2
2525

2626
convert(::Type{Int32},fd::RawFD) = fd.fd
2727

@@ -107,9 +107,9 @@ function fdw_wait_cb(fdw::FDWatcher,status,events)
107107
end
108108
end
109109

110-
function _wait(fdw::FDWatcher,readable,writeable)
110+
function _wait(fdw::FDWatcher,readable,writable)
111111
events = (readable ? UV_READABLE : 0) |
112-
(writeable ? UV_WRITEABLE : 0)
112+
(writable ? UV_WRITABLE : 0)
113113
if events == 0
114114
error("Must be watching for at least one event")
115115
end
@@ -121,7 +121,7 @@ function _wait(fdw::FDWatcher,readable,writeable)
121121
while true
122122
events = wait(fdw.notify)
123123
if (readable && (events & UV_READABLE) != 0) ||
124-
(writeable && (events & UV_WRITEABLE) != 0)
124+
(writable && (events & UV_WRITABLE) != 0)
125125
break
126126
end
127127
end
@@ -145,7 +145,7 @@ let
145145
fdwatcher_array = Array(FDWatcher,0)
146146
end
147147

148-
function wait(fd::RawFD; readable=false, writeable=false)
148+
function wait(fd::RawFD; readable=false, writable=false)
149149
old_length = length(fdwatcher_array)
150150
if fd.fd+1 > old_length
151151
resize!(fdwatcher_array,fd.fd+1)
@@ -154,7 +154,7 @@ let
154154
if is(fdwatcher_array[fd.fd+1],empty_watcher)
155155
fdwatcher_array[fd.fd+1] = FDWatcher(fd)
156156
end
157-
_wait(fdwatcher_array[fd.fd+1],readable,writeable)
157+
_wait(fdwatcher_array[fd.fd+1],readable,writable)
158158
end
159159
end
160160
@windows_only begin
@@ -163,15 +163,15 @@ let
163163
fdwatcher_array = Dict{WindowsRawSocket,FDWatcher}()
164164
end
165165

166-
function wait(fd::RawFD; readable=false, writeable=false)
167-
wait(_get_osfhandle(fd); readable=readable, writeable=writeable)
166+
function wait(fd::RawFD; readable=false, writable=false)
167+
wait(_get_osfhandle(fd); readable=readable, writable=writable)
168168
end
169169

170-
function wait(socket::WindowsRawSocket; readable=false, writeable=false)
170+
function wait(socket::WindowsRawSocket; readable=false, writable=false)
171171
if !has(fdwatcher_array,socket.handle)
172172
fdwatcher_array[fd.handle] = FDWatcher(socket)
173173
end
174-
_wait(fdwatcher_array[fd.handle],readable,writeable)
174+
_wait(fdwatcher_array[fd.handle],readable,writable)
175175
end
176176
end
177177
end
@@ -258,10 +258,10 @@ end
258258
_uv_hook_close(uv::FileMonitor) = (uv.handle = 0; nothing)
259259
_uv_hook_close(uv::UVPollingWatcher) = (uv.handle = 0; nothing)
260260

261-
function poll_fd(s, seconds::Real; readable=false, writeable=false)
261+
function poll_fd(s, seconds::Real; readable=false, writable=false)
262262
wt = Condition()
263263

264-
@schedule (args = wait(s; readable=readable, writeable=writeable); notify(wt,(:poll,args)))
264+
@schedule (args = wait(s; readable=readable, writable=writable); notify(wt,(:poll,args)))
265265
@schedule (sleep(seconds); notify(wt,(:timeout,0)))
266266

267267
_, ret = wait(wt)

base/stat.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ issetgid(mode::Unsigned) = (mode & 0o2000) > 0
7272
issticky(mode::Unsigned) = (mode & 0o1000) > 0
7373

7474
isreadable(mode::Unsigned) = (mode & 0o444) > 0
75-
iswriteable(mode::Unsigned) = (mode & 0o222) > 0
75+
iswritable(mode::Unsigned) = (mode & 0o222) > 0
7676
isexecutable(mode::Unsigned) = (mode & 0o111) > 0
7777

7878
uperm(mode::Unsigned) = uint8(mode >> 6) & 0x7
@@ -94,7 +94,7 @@ for f in {
9494
:issetgid
9595
:issticky
9696
:isreadable
97-
:iswriteable
97+
:iswritable
9898
:isexecutable
9999
:uperm
100100
:gperm

base/stream.jl

+12-12
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,11 @@ type PipeServer <: UVServer
126126
false,Condition())
127127
end
128128

129-
function init_pipe!(pipe::Union(NamedPipe,PipeServer);readable::Bool=false,writeable=false,julia_only=true)
129+
function init_pipe!(pipe::Union(NamedPipe,PipeServer);readable::Bool=false,writable=false,julia_only=true)
130130
if pipe.handle == C_NULL || pipe.status != StatusUninit
131131
error("Failed to initialize pipe")
132132
end
133-
uv_error("init_pipe",ccall(:jl_init_pipe, Cint, (Ptr{Void},Int32,Int32,Int32,Any), pipe.handle, writeable,readable,julia_only,pipe))
133+
uv_error("init_pipe",ccall(:jl_init_pipe, Cint, (Ptr{Void},Int32,Int32,Int32,Any), pipe.handle, writable,readable,julia_only,pipe))
134134
pipe.status = StatusInit
135135
pipe
136136
end
@@ -177,11 +177,11 @@ function TTY(fd::RawFD; readable::Bool = false)
177177
ret
178178
end
179179

180-
# note that uv_is_readable/writeable work for any subtype of
180+
# note that uv_is_readable/writable work for any subtype of
181181
# uv_stream_t, including uv_tty_t and uv_pipe_t
182182
isreadable(io::Union(NamedPipe,PipeServer,TTY)) =
183183
bool(ccall(:uv_is_readable, Cint, (Ptr{Void},), io.handle))
184-
iswriteable(io::Union(NamedPipe,PipeServer,TTY)) =
184+
iswritable(io::Union(NamedPipe,PipeServer,TTY)) =
185185
bool(ccall(:uv_is_writable, Cint, (Ptr{Void},), io.handle))
186186

187187
show(io::IO,stream::TTY) = print(io,"TTY(",uv_status_string(stream),", ",
@@ -499,36 +499,36 @@ end
499499

500500
## pipe functions ##
501501
malloc_pipe() = c_malloc(_sizeof_uv_named_pipe)
502-
function link_pipe(read_end::Ptr{Void},readable_julia_only::Bool,write_end::Ptr{Void},writeable_julia_only::Bool,readpipe::AsyncStream,writepipe::AsyncStream)
502+
function link_pipe(read_end::Ptr{Void},readable_julia_only::Bool,write_end::Ptr{Void},writable_julia_only::Bool,readpipe::AsyncStream,writepipe::AsyncStream)
503503
#make the pipe an unbuffered stream for now
504504
#TODO: this is probably not freeing memory properly after errors
505505
uv_error("init_pipe",ccall(:jl_init_pipe, Cint, (Ptr{Void},Int32,Int32,Int32,Any), read_end, 0, 1, readable_julia_only, readpipe))
506-
uv_error("init_pipe(2)",ccall(:jl_init_pipe, Cint, (Ptr{Void},Int32,Int32,Int32,Any), write_end, 1, 0, writeable_julia_only, writepipe))
506+
uv_error("init_pipe(2)",ccall(:jl_init_pipe, Cint, (Ptr{Void},Int32,Int32,Int32,Any), write_end, 1, 0, writable_julia_only, writepipe))
507507
uv_error("pipe_link",ccall(:uv_pipe_link, Int32, (Ptr{Void}, Ptr{Void}), read_end, write_end))
508508
end
509509

510-
function link_pipe(read_end2::NamedPipe,readable_julia_only::Bool,write_end::Ptr{Void},writeable_julia_only::Bool)
510+
function link_pipe(read_end2::NamedPipe,readable_julia_only::Bool,write_end::Ptr{Void},writable_julia_only::Bool)
511511
if read_end2.handle == C_NULL
512512
read_end2.handle = malloc_pipe()
513513
end
514-
link_pipe(read_end2.handle,readable_julia_only,write_end,writeable_julia_only,read_end2,read_end2)
514+
link_pipe(read_end2.handle,readable_julia_only,write_end,writable_julia_only,read_end2,read_end2)
515515
read_end2.status = StatusOpen
516516
end
517-
function link_pipe(read_end::Ptr{Void},readable_julia_only::Bool,write_end::NamedPipe,writeable_julia_only::Bool)
517+
function link_pipe(read_end::Ptr{Void},readable_julia_only::Bool,write_end::NamedPipe,writable_julia_only::Bool)
518518
if write_end.handle == C_NULL
519519
write_end.handle = malloc_pipe()
520520
end
521-
link_pipe(read_end,readable_julia_only,write_end.handle,writeable_julia_only,write_end,write_end)
521+
link_pipe(read_end,readable_julia_only,write_end.handle,writable_julia_only,write_end,write_end)
522522
write_end.status = StatusOpen
523523
end
524-
function link_pipe(read_end::NamedPipe,readable_julia_only::Bool,write_end::NamedPipe,writeable_julia_only::Bool)
524+
function link_pipe(read_end::NamedPipe,readable_julia_only::Bool,write_end::NamedPipe,writable_julia_only::Bool)
525525
if write_end.handle == C_NULL
526526
write_end.handle = malloc_pipe()
527527
end
528528
if read_end.handle == C_NULL
529529
read_end.handle = malloc_pipe()
530530
end
531-
link_pipe(read_end.handle,readable_julia_only,write_end.handle,writeable_julia_only,read_end,write_end)
531+
link_pipe(read_end.handle,readable_julia_only,write_end.handle,writable_julia_only,read_end,write_end)
532532
write_end.status = StatusOpen
533533
read_end.status = StatusOpen
534534
nothing

test/file.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ touch(file)
1818
@test isfile(file) == true
1919
@test islink(file) == false
2020
@test isreadable(file) == true
21-
@test iswriteable(file) == true
21+
@test iswritable(file) == true
2222
# Here's something else that might be UNIX-specific?
2323
run(`chmod -w $file`)
24-
@test iswriteable(file) == false
24+
@test iswritable(file) == false
2525
run(`chmod +w $file`)
2626
@test isexecutable(file) == false
2727
@test filesize(file) == 0

test/pollfd.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function test_read(slval)
3232
tr = consume(t)
3333
t_elapsed = toq()
3434

35-
@test tr == UV_READABLE || (UV_READABLE | UV_WRITEABLE)
35+
@test tr == UV_READABLE || (UV_READABLE | UV_WRITABLE)
3636

3737
dout = Array(Uint8, 1)
3838
@test 1 == ccall(:read, Csize_t, (Cint, Ptr{Uint8},Csize_t), pipe_fds[1], dout, 1)

0 commit comments

Comments
 (0)