Skip to content

Commit 3238b36

Browse files
committed
Deprecate is_<os> functions in favor of is<os>
This makes them consistent with the vast majority of Base predicates, which simply prefix with `is` rather than `is_`.
1 parent ef9ab60 commit 3238b36

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+275
-268
lines changed

base/LineEdit.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ function refresh_multi_line(termbuf::TerminalBuffer, terminal::UnixTerminal, buf
204204
write_prompt(termbuf, prompt)
205205
prompt = prompt_string(prompt)
206206
# Count the '\n' at the end of the line if the terminal emulator does (specific to DOS cmd prompt)
207-
miscountnl = @static is_windows() ? (isa(Terminals.pipe_reader(terminal), Base.TTY) && !Base.ispty(Terminals.pipe_reader(terminal))) : false
207+
miscountnl = @static iswindows() ? (isa(Terminals.pipe_reader(terminal), Base.TTY) && !Base.ispty(Terminals.pipe_reader(terminal))) : false
208208
lindent = strwidth(prompt)
209209

210210
# Now go through the buffer line by line
@@ -1577,7 +1577,7 @@ function run_interface(terminal, m::ModalInterface)
15771577
while !s.aborted
15781578
buf, ok, suspend = prompt!(terminal, m, s)
15791579
while suspend
1580-
@static if is_unix(); ccall(:jl_repl_raise_sigtstp, Cint, ()); end
1580+
@static if isunix(); ccall(:jl_repl_raise_sigtstp, Cint, ()); end
15811581
buf, ok, suspend = prompt!(terminal, m, s)
15821582
end
15831583
eval(Main,
@@ -1629,7 +1629,7 @@ function prompt!(term, prompt, s = init_state(term, prompt))
16291629
elseif state === :done
16301630
return buffer(s), true, false
16311631
elseif state === :suspend
1632-
if is_unix()
1632+
if isunix()
16331633
return buffer(s), true, true
16341634
end
16351635
else

base/REPLCompletions.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function complete_keyword(s::String)
101101
end
102102

103103
function complete_path(path::AbstractString, pos; use_envpath=false)
104-
if Base.is_unix() && ismatch(r"^~(?:/|$)", path)
104+
if Base.isunix() && ismatch(r"^~(?:/|$)", path)
105105
# if the path is just "~", don't consider the expanded username as a prefix
106106
if path == "~"
107107
dir, prefix = homedir(), ""
@@ -129,13 +129,13 @@ function complete_path(path::AbstractString, pos; use_envpath=false)
129129
if startswith(file, prefix)
130130
id = try isdir(joinpath(dir, file)) catch; false end
131131
# joinpath is not used because windows needs to complete with double-backslash
132-
push!(matches, id ? file * (@static is_windows() ? "\\\\" : "/") : file)
132+
push!(matches, id ? file * (@static iswindows() ? "\\\\" : "/") : file)
133133
end
134134
end
135135

136136
if use_envpath && length(dir) == 0
137137
# Look for files in PATH as well
138-
local pathdirs = split(ENV["PATH"], @static is_windows() ? ";" : ":")
138+
local pathdirs = split(ENV["PATH"], @static iswindows() ? ";" : ":")
139139

140140
for pathdir in pathdirs
141141
local actualpath

base/Terminals.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ cmove_line_up(t::UnixTerminal, n) = (cmove_up(t, n); cmove_col(t, 1))
115115
cmove_line_down(t::UnixTerminal, n) = (cmove_down(t, n); cmove_col(t, 1))
116116
cmove_col(t::UnixTerminal, n) = (write(t.out_stream, '\r'); n > 1 && cmove_right(t, n - 1))
117117

118-
if is_windows()
118+
if iswindows()
119119
function raw!(t::TTYTerminal,raw::Bool)
120120
check_open(t.in_stream)
121121
if Base.ispty(t.in_stream)
@@ -152,7 +152,7 @@ function Base.displaysize(t::UnixTerminal)
152152
return displaysize(t.out_stream)
153153
end
154154

155-
if is_windows()
155+
if iswindows()
156156
hascolor(t::TTYTerminal) = true
157157
else
158158
function hascolor(t::TTYTerminal)

base/c.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Equivalent to the native `char` c-type.
1818
"""
1919
Cchar
2020

21-
if is_windows()
21+
if iswindows()
2222
const Clong = Int32
2323
const Culong = UInt32
2424
const Cwchar_t = UInt16
@@ -49,7 +49,7 @@ Equivalent to the native `wchar_t` c-type ([`Int32`](@ref)).
4949
"""
5050
Cwchar_t
5151

52-
if !is_windows()
52+
if !iswindows()
5353
const sizeof_mode_t = ccall(:jl_sizeof_mode_t, Cint, ())
5454
if sizeof_mode_t == 2
5555
const Cmode_t = Int16
@@ -118,7 +118,7 @@ end
118118
# symbols are guaranteed not to contain embedded NUL
119119
convert(::Type{Cstring}, s::Symbol) = Cstring(unsafe_convert(Ptr{Cchar}, s))
120120

121-
if is_windows()
121+
if iswindows()
122122
"""
123123
Base.cwstring(s)
124124

base/client.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,15 @@ function repl_cmd(cmd, out)
102102
end
103103
cd(ENV["OLDPWD"])
104104
else
105-
cd(@static is_windows() ? dir : readchomp(`$shell -c "echo $(shell_escape(dir))"`))
105+
cd(@static iswindows() ? dir : readchomp(`$shell -c "echo $(shell_escape(dir))"`))
106106
end
107107
else
108108
cd()
109109
end
110110
ENV["OLDPWD"] = new_oldpwd
111111
println(out, pwd())
112112
else
113-
run(ignorestatus(@static is_windows() ? cmd : (isa(STDIN, TTY) ? `$shell -i -c "$(shell_wrap_true(shell_name, cmd))"` : `$shell -c "$(shell_wrap_true(shell_name, cmd))"`)))
113+
run(ignorestatus(@static iswindows() ? cmd : (isa(STDIN, TTY) ? `$shell -i -c "$(shell_wrap_true(shell_name, cmd))"` : `$shell -c "$(shell_wrap_true(shell_name, cmd))"`)))
114114
end
115115
nothing
116116
end
@@ -380,7 +380,7 @@ function _start()
380380
global is_interactive |= !isa(STDIN, Union{File, IOStream})
381381
color_set || (global have_color = false)
382382
else
383-
term = Terminals.TTYTerminal(get(ENV, "TERM", @static is_windows() ? "" : "dumb"), STDIN, STDOUT, STDERR)
383+
term = Terminals.TTYTerminal(get(ENV, "TERM", @static iswindows() ? "" : "dumb"), STDIN, STDOUT, STDERR)
384384
global is_interactive = true
385385
color_set || (global have_color = Terminals.hascolor(term))
386386
quiet || REPL.banner(term,term)

base/dSFMT.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ end
163163

164164
## Windows entropy
165165

166-
if is_windows()
166+
if iswindows()
167167
function win32_SystemFunction036!(a::Array)
168168
ccall((:SystemFunction036, :Advapi32), stdcall, UInt8, (Ptr{Void}, UInt32), a, sizeof(a))
169169
end

base/datafmt.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ readdlm_auto(input::IO, dlm::Char, T::Type, eol::Char, auto::Bool; opts...) =
120120
readdlm_string(readstring(input), dlm, T, eol, auto, val_opts(opts))
121121
function readdlm_auto(input::AbstractString, dlm::Char, T::Type, eol::Char, auto::Bool; opts...)
122122
optsd = val_opts(opts)
123-
use_mmap = get(optsd, :use_mmap, is_windows() ? false : true)
123+
use_mmap = get(optsd, :use_mmap, iswindows() ? false : true)
124124
fsz = filesize(input)
125125
if use_mmap && fsz > 0 && fsz < typemax(Int)
126126
a = open(input, "r") do f

base/deprecated.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,6 +1350,13 @@ end
13501350
@deprecate srand(filename::AbstractString, n::Integer=4) srand(read!(filename, Array{UInt32}(Int(n))))
13511351
@deprecate MersenneTwister(filename::AbstractString) srand(MersenneTwister(0), read!(filename, Array{UInt32}(Int(4))))
13521352

1353+
# Part of the underscore audit
1354+
@deprecate is_apple isapple
1355+
@deprecate is_bsd isbsd
1356+
@deprecate is_linux islinux
1357+
@deprecate is_unix isunix
1358+
@deprecate is_windows iswindows
1359+
13531360
# END 0.7 deprecations
13541361

13551362
# BEGIN 1.0 deprecations

base/distributed/cluster.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,7 @@ end
960960
function disable_nagle(sock)
961961
# disable nagle on all OSes
962962
ccall(:uv_tcp_nodelay, Cint, (Ptr{Void}, Cint), sock.handle, 1)
963-
@static if is_linux()
963+
@static if islinux()
964964
# tcp_quickack is a linux only option
965965
if ccall(:jl_tcp_quickack, Cint, (Ptr{Void}, Cint), sock.handle, 1) < 0
966966
warn_once("Networking unoptimized ( Error enabling TCP_QUICKACK : ", Libc.strerror(Libc.errno()), " )")

base/distributed/managers.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -455,11 +455,11 @@ end
455455
const client_port = Ref{Cushort}(0)
456456

457457
function socket_reuse_port()
458-
@static if is_linux() || is_apple()
458+
@static if islinux() || isapple()
459459
s = TCPSocket(delay = false)
460460

461461
# Linux requires the port to be bound before setting REUSEPORT, OSX after.
462-
is_linux() && bind_client_port(s)
462+
islinux() && bind_client_port(s)
463463
rc = ccall(:jl_tcp_reuseport, Int32, (Ptr{Void},), s.handle)
464464
if rc > 0 # SO_REUSEPORT is unsupported, just return the ephemerally bound socket
465465
return s
@@ -470,7 +470,7 @@ function socket_reuse_port()
470470
# provide a clean new socket
471471
return TCPSocket()
472472
end
473-
is_apple() && bind_client_port(s)
473+
isapple() && bind_client_port(s)
474474
return s
475475
else
476476
return TCPSocket()

0 commit comments

Comments
 (0)