Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename String => AbstractString #8872

Merged
merged 1 commit into from
Nov 3, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ Library improvements

* The `machinefile` now supports an host count ([#7616]).

* `String` has been renamed to `AbstractString`.

Deprecated or removed
---------------------

Expand Down
6 changes: 3 additions & 3 deletions base/LineEdit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ function _clear_input_area(terminal, state::InputAreaState)
end

prompt_string(s::PromptState) = s.p.prompt
prompt_string(s::String) = s
prompt_string(s::AbstractString) = s

refresh_multi_line(termbuf::TerminalBuffer, s::PromptState) = s.ias =
refresh_multi_line(termbuf, terminal(s), buffer(s), s.ias, s, indent = s.indent)
Expand Down Expand Up @@ -457,7 +457,7 @@ end

# splice! for IOBuffer: convert from 0-indexed positions, update the size,
# and keep the cursor position stable with the text
function splice_buffer!{T<:Integer}(buf::IOBuffer, r::UnitRange{T}, ins::String = "")
function splice_buffer!{T<:Integer}(buf::IOBuffer, r::UnitRange{T}, ins::AbstractString = "")
pos = position(buf)
if !isempty(r) && pos in r
seek(buf, first(r))
Expand Down Expand Up @@ -652,7 +652,7 @@ write_prompt(terminal, s::ASCIIString) = write(terminal, s)

normalize_key(key::Char) = string(key)
normalize_key(key::Integer) = normalize_key(char(key))
function normalize_key(key::String)
function normalize_key(key::AbstractString)
'\0' in key && error("Matching \\0 not currently supported.")
buf = IOBuffer()
i = start(key)
Expand Down
22 changes: 11 additions & 11 deletions base/REPL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function eval_user_input(ast::ANY, backend::REPLBackend)
end
end

function parse_input_line(s::String)
function parse_input_line(s::AbstractString)
# s = bytestring(s)
# (expr, pos) = parse(s, 1)
# (ex, pos) = ccall(:jl_parse_string, Any,
Expand Down Expand Up @@ -232,11 +232,11 @@ end
type LineEditREPL <: AbstractREPL
t::TextTerminal
hascolor::Bool
prompt_color::String
input_color::String
answer_color::String
shell_color::String
help_color::String
prompt_color::AbstractString
input_color::AbstractString
answer_color::AbstractString
shell_color::AbstractString
help_color::AbstractString
no_history_file::Bool
in_shell::Bool
in_help::Bool
Expand Down Expand Up @@ -298,7 +298,7 @@ end


type REPLHistoryProvider <: HistoryProvider
history::Array{String,1}
history::Array{AbstractString,1}
history_file
cur_idx::Int
last_idx::Int
Expand All @@ -308,7 +308,7 @@ type REPLHistoryProvider <: HistoryProvider
modes::Array{Symbol,1}
end
REPLHistoryProvider(mode_mapping) =
REPLHistoryProvider(String[], nothing, 0, -1, IOBuffer(),
REPLHistoryProvider(AbstractString[], nothing, 0, -1, IOBuffer(),
nothing, mode_mapping, Uint8[])

const invalid_history_message = """
Expand Down Expand Up @@ -836,9 +836,9 @@ end

type StreamREPL <: AbstractREPL
stream::IO
prompt_color::String
input_color::String
answer_color::String
prompt_color::AbstractString
input_color::AbstractString
answer_color::AbstractString
waserror::Bool
StreamREPL(stream,pc,ic,ac) = new(stream,pc,ic,ac,false)
end
Expand Down
8 changes: 4 additions & 4 deletions base/REPLCompletions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function completes_global(x, name)
return beginswith(x, name) && !('#' in x)
end

function filtered_mod_names(ffunc::Function, mod::Module, name::String, all::Bool=false, imported::Bool=false)
function filtered_mod_names(ffunc::Function, mod::Module, name::AbstractString, all::Bool=false, imported::Bool=false)
ssyms = names(mod, all, imported)
filter!(ffunc, ssyms)
syms = UTF8String[string(s) for s in ssyms]
Expand Down Expand Up @@ -107,7 +107,7 @@ function complete_keyword(s::ByteString)
sorted_keywords[r]
end

function complete_path(path::String, pos)
function complete_path(path::AbstractString, pos)
dir, prefix = splitdir(path)
local files
try
Expand All @@ -133,7 +133,7 @@ function complete_path(path::String, pos)
matches, (nextind(path, pos-sizeof(prefix))):pos, length(matches) > 0
end

function complete_methods(input::String)
function complete_methods(input::AbstractString)
tokens = split(input, '.')
fn = Main
for token in tokens
Expand Down Expand Up @@ -254,7 +254,7 @@ function shell_completions(string, pos)
# Now look at the last thing we parsed
isempty(args.args[end].args) && return UTF8String[], 0:-1, false
arg = args.args[end].args[end]
if all(map(s -> isa(s, String), args.args[end].args))
if all(map(s -> isa(s, AbstractString), args.args[end].args))
# Treat this as a path (perhaps give a list of comands in the future as well?)
return complete_path(join(args.args[end].args), pos)
elseif isexpr(arg, :escape) && (isexpr(arg.args[1], :incomplete) || isexpr(arg.args[1], :error))
Expand Down
2 changes: 1 addition & 1 deletion base/Terminals.jl
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ write(t::UnixTerminal, p::Ptr{Uint8}) = write(t.out_stream, p)
write(t::UnixTerminal, p::Ptr{Uint8}, x::Integer) = write(t.out_stream, p, x)
write(t::UnixTerminal, x::Uint8) = write(t.out_stream, x)
read{T,N}(t::UnixTerminal, x::Array{T,N}) = read(t.in_stream, x)
readuntil(t::UnixTerminal, s::String) = readuntil(t.in_stream, s)
readuntil(t::UnixTerminal, s::AbstractString) = readuntil(t.in_stream, s)
readuntil(t::UnixTerminal, c::Char) = readuntil(t.in_stream, c)
readuntil(t::UnixTerminal, s) = readuntil(t.in_stream, s)
read(t::UnixTerminal, ::Type{Uint8}) = read(t.in_stream, Uint8)
Expand Down
2 changes: 1 addition & 1 deletion base/ascii.jl
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,4 @@ function convert(::Type{ASCIIString}, a::Array{Uint8,1}, invalids_as::ASCIIStrin
end
convert(ASCIIString, a)
end
convert(::Type{ASCIIString}, s::String) = ascii(bytestring(s))
convert(::Type{ASCIIString}, s::AbstractString) = ascii(bytestring(s))
18 changes: 9 additions & 9 deletions base/base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,36 +59,36 @@ cconvert(T, x) = convert(T, x)
# use the code in ccall.cpp to safely allocate temporary pointer arrays
cconvert{T}(::Type{Ptr{Ptr{T}}}, a::Array) = a
# convert strings to ByteString to pass as pointers
cconvert{P<:Union(Int8,Uint8)}(::Type{Ptr{P}}, s::String) = bytestring(s)
cconvert{P<:Union(Int8,Uint8)}(::Type{Ptr{P}}, s::AbstractString) = bytestring(s)

reinterpret{T,S}(::Type{T}, x::S) = box(T,unbox(S,x))

abstract IO

type ErrorException <: Exception
msg::String
msg::AbstractString
end

type SystemError <: Exception
prefix::String
prefix::AbstractString
errnum::Int32
SystemError(p::String, e::Integer) = new(p, int32(e))
SystemError(p::String) = new(p, errno())
SystemError(p::AbstractString, e::Integer) = new(p, int32(e))
SystemError(p::AbstractString) = new(p, errno())
end

type TypeError <: Exception
func::Symbol
context::String
context::AbstractString
expected::Type
got
end

type ParseError <: Exception
msg::String
msg::AbstractString
end

type ArgumentError <: Exception
msg::String
msg::AbstractString
end

#type UnboundError <: Exception
Expand All @@ -100,7 +100,7 @@ type KeyError <: Exception
end

type LoadError <: Exception
file::String
file::AbstractString
line::Int
error
end
Expand Down
8 changes: 4 additions & 4 deletions base/boot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export
Int32, Int64, Int128, Ptr, Real, Signed, Uint, Uint8, Uint16, Uint32,
Uint64, Uint128, Unsigned,
# string types
Char, ASCIIString, ByteString, DirectIndexString, String, UTF8String,
Char, ASCIIString, ByteString, DirectIndexString, AbstractString, UTF8String,
# errors
BoundsError, DivideError, DomainError, Exception,
InexactError, InterruptException, MemoryError, OverflowError,
Expand Down Expand Up @@ -214,8 +214,8 @@ type UndefVarError <: Exception
end
type InterruptException <: Exception end

abstract String
abstract DirectIndexString <: String
abstract AbstractString
abstract DirectIndexString <: AbstractString

type SymbolNode
name::Symbol
Expand All @@ -233,7 +233,7 @@ immutable ASCIIString <: DirectIndexString
data::Array{Uint8,1}
end

immutable UTF8String <: String
immutable UTF8String <: AbstractString
data::Array{Uint8,1}
end

Expand Down
12 changes: 6 additions & 6 deletions base/c.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ const RTLD_NOLOAD = 0x00000010
const RTLD_DEEPBIND = 0x00000020
const RTLD_FIRST = 0x00000040

function dlsym(hnd::Ptr, s::Union(Symbol,String))
function dlsym(hnd::Ptr, s::Union(Symbol,AbstractString))
hnd == C_NULL && error("NULL library handle")
ccall(:jl_dlsym, Ptr{Void}, (Ptr{Void}, Ptr{Uint8}), hnd, s)
end

function dlsym_e(hnd::Ptr, s::Union(Symbol,String))
function dlsym_e(hnd::Ptr, s::Union(Symbol,AbstractString))
hnd == C_NULL && error("NULL library handle")
ccall(:jl_dlsym_e, Ptr{Void}, (Ptr{Void}, Ptr{Uint8}), hnd, s)
end

dlopen(s::Symbol, flags::Integer = RTLD_LAZY | RTLD_DEEPBIND) =
dlopen(string(s), flags)

dlopen(s::String, flags::Integer = RTLD_LAZY | RTLD_DEEPBIND) =
dlopen(s::AbstractString, flags::Integer = RTLD_LAZY | RTLD_DEEPBIND) =
ccall(:jl_load_dynamic_library, Ptr{Void}, (Ptr{Uint8},Uint32), s, flags)

dlopen_e(s::String, flags::Integer = RTLD_LAZY | RTLD_DEEPBIND) =
dlopen_e(s::AbstractString, flags::Integer = RTLD_LAZY | RTLD_DEEPBIND) =
ccall(:jl_load_dynamic_library_e, Ptr{Void}, (Ptr{Uint8},Uint32), s, flags)

dlopen_e(s::Symbol, flags::Integer = RTLD_LAZY | RTLD_DEEPBIND) =
Expand Down Expand Up @@ -112,11 +112,11 @@ function find_library{T<:ByteString, S<:ByteString}(libnames::Array{T,1}, extrap
return ""
end

function ccallable(f::Function, rt::Type, argt::(Type...), name::Union(String,Symbol)=string(f))
function ccallable(f::Function, rt::Type, argt::(Type...), name::Union(AbstractString,Symbol)=string(f))
ccall(:jl_extern_c, Void, (Any, Any, Any, Ptr{Uint8}), f, rt, argt, name)
end

function ccallable(f::Function, argt::(Type...), name::Union(String,Symbol)=string(f))
function ccallable(f::Function, argt::(Type...), name::Union(AbstractString,Symbol)=string(f))
ccall(:jl_extern_c, Void, (Any, Ptr{Void}, Any, Ptr{Uint8}), f, C_NULL, argt, name)
end

Expand Down
10 changes: 5 additions & 5 deletions base/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function repl_cmd(cmd)
nothing
end

function repl_hook(input::String)
function repl_hook(input::AbstractString)
Expr(:call, :(Base.repl_cmd),
macroexpand(Expr(:macrocall,symbol("@cmd"),input)))
end
Expand Down Expand Up @@ -129,7 +129,7 @@ end

_repl_start = Condition()

function parse_input_line(s::String)
function parse_input_line(s::AbstractString)
# s = bytestring(s)
# (expr, pos) = parse(s, 1)
# (ex, pos) = ccall(:jl_parse_string, Any,
Expand Down Expand Up @@ -169,7 +169,7 @@ function incomplete_tag(ex::Expr)
end

# try to include() a file, ignoring if not found
try_include(path::String) = isfile(path) && include(path)
try_include(path::AbstractString) = isfile(path) && include(path)

function init_bind_addr(args::Vector{UTF8String})
# Treat --bind-to in a position independent manner in ARGS since
Expand Down Expand Up @@ -335,8 +335,8 @@ function load_juliarc()
try_include(abspath(homedir(),".juliarc.jl"))
end

function load_machine_file(path::String)
machines = String[]
function load_machine_file(path::AbstractString)
machines = AbstractString[]
for line in split(readall(path),'\n'; keep=false)
s = split(line,'*'; keep=false)
if length(s) > 1
Expand Down
Loading