Skip to content

Commit

Permalink
rename Uint => UInt (closes JuliaLang#8905)
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanKarpinski authored and waTeim committed Nov 23, 2014
1 parent ef7d382 commit ff6e5eb
Show file tree
Hide file tree
Showing 156 changed files with 1,844 additions and 1,808 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ New language features
Language changes
----------------

* `Uint` et al. are now spelled `UInt` ([#8905]).

* `String` has been renamed to `AbstractString` ([#8872]).

* `None` is deprecated; use `Union()` instead ([#8423]).
Expand Down
6 changes: 3 additions & 3 deletions base/REPL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ function parse_input_line(s::AbstractString)
# s = bytestring(s)
# (expr, pos) = parse(s, 1)
# (ex, pos) = ccall(:jl_parse_string, Any,
# (Ptr{Uint8},Int32,Int32),
# (Ptr{UInt8},Int32,Int32),
# s, int32(pos)-1, 1)
# if !is(ex,())
# throw(ParseError("extra input after end of expression"))
# end
# expr
ccall(:jl_parse_input_line, Any, (Ptr{Uint8},), s)
ccall(:jl_parse_input_line, Any, (Ptr{UInt8},), s)
end

function start_repl_backend(repl_channel::RemoteRef, response_channel::RemoteRef)
Expand Down Expand Up @@ -309,7 +309,7 @@ type REPLHistoryProvider <: HistoryProvider
end
REPLHistoryProvider(mode_mapping) =
REPLHistoryProvider(AbstractString[], nothing, 0, -1, IOBuffer(),
nothing, mode_mapping, Uint8[])
nothing, mode_mapping, UInt8[])

const invalid_history_message = """
Invalid history format. If you have a ~/.julia_history file left over from an older version of Julia, try renaming or deleting it.
Expand Down
12 changes: 6 additions & 6 deletions base/Terminals.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ abstract TextTerminal <: Base.IO

# INTERFACE
size(::TextTerminal) = error("Unimplemented")
writepos(t::TextTerminal, x, y, s::Array{Uint8,1}) = error("Unimplemented")
writepos(t::TextTerminal, x, y, s::Array{UInt8,1}) = error("Unimplemented")
cmove(t::TextTerminal, x, y) = error("Unimplemented")
getX(t::TextTerminal) = error("Unimplemented")
getY(t::TextTerminal) = error("Unimplemented")
Expand Down Expand Up @@ -74,7 +74,7 @@ hascolor(::TextTerminal) = false
# Utility Functions
function writepos{T}(t::TextTerminal, x, y, b::Array{T})
if isbits(T)
writepos(t, x, y, reinterpret(Uint8, b))
writepos(t, x, y, reinterpret(UInt8, b))
else
cmove(t, x, y)
invoke(write, (IO, Array), s, a)
Expand Down Expand Up @@ -183,14 +183,14 @@ clear_line(t::UnixTerminal) = write(t.out_stream, "\x1b[0G\x1b[0K")
#beep(t::UnixTerminal) = write(t.err_stream,"\x7")

write{T,N}(t::UnixTerminal, a::Array{T,N}) = write(t.out_stream, a)
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)
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::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)
read(t::UnixTerminal, ::Type{UInt8}) = read(t.in_stream, UInt8)
start_reading(t::UnixTerminal) = start_reading(t.in_stream)
stop_reading(t::UnixTerminal) = stop_reading(t.in_stream)

Expand Down
12 changes: 6 additions & 6 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,12 @@ for (f,t) in ((:char, Char),
(:int32, Int32),
(:int64, Int64),
(:int128, Int128),
(:uint, Uint),
(:uint8, Uint8),
(:uint16, Uint16),
(:uint32, Uint32),
(:uint64, Uint64),
(:uint128,Uint128))
(:uint, UInt),
(:uint8, UInt8),
(:uint16, UInt16),
(:uint32, UInt32),
(:uint64, UInt64),
(:uint128,UInt128))
@eval begin
($f)(x::AbstractArray{$t}) = x
($f)(x::AbstractArray{$t}) = x
Expand Down
42 changes: 21 additions & 21 deletions base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ isassigned(a::Array, i::Int...) = isdefined(a, i...)
## copy ##

function unsafe_copy!{T}(dest::Ptr{T}, src::Ptr{T}, N)
ccall(:memmove, Ptr{Void}, (Ptr{Void}, Ptr{Void}, Uint),
ccall(:memmove, Ptr{Void}, (Ptr{Void}, Ptr{Void}, UInt),
dest, src, N*sizeof(T))
return dest
end
Expand Down Expand Up @@ -150,7 +150,7 @@ function getindex{T<:Union(Char,Number)}(::Type{T}, r1::Range, rs::Range...)
return a
end

function fill!{T<:Union(Int8,Uint8)}(a::Array{T}, x::Integer)
function fill!{T<:Union(Int8,UInt8)}(a::Array{T}, x::Integer)
ccall(:memset, Ptr{Void}, (Ptr{Void}, Int32, Csize_t), a, x, length(a))
return a
end
Expand Down Expand Up @@ -402,7 +402,7 @@ function _growat!(a::Vector, i::Integer, delta::Integer)
end

function _growat_beg!(a::Vector, i::Integer, delta::Integer)
ccall(:jl_array_grow_beg, Void, (Any, Uint), a, delta)
ccall(:jl_array_grow_beg, Void, (Any, UInt), a, delta)
if i > 1
ccall(:memmove, Ptr{Void}, (Ptr{Void}, Ptr{Void}, Csize_t),
pointer(a, 1), pointer(a, 1+delta), (i-1)*elsize(a))
Expand All @@ -411,7 +411,7 @@ function _growat_beg!(a::Vector, i::Integer, delta::Integer)
end

function _growat_end!(a::Vector, i::Integer, delta::Integer)
ccall(:jl_array_grow_end, Void, (Any, Uint), a, delta)
ccall(:jl_array_grow_end, Void, (Any, UInt), a, delta)
n = length(a)
if n >= i+delta
ccall(:memmove, Ptr{Void}, (Ptr{Void}, Ptr{Void}, Csize_t),
Expand All @@ -438,7 +438,7 @@ function _deleteat_beg!(a::Vector, i::Integer, delta::Integer)
ccall(:memmove, Ptr{Void}, (Ptr{Void}, Ptr{Void}, Csize_t),
pointer(a, 1+delta), pointer(a, 1), (i-1)*elsize(a))
end
ccall(:jl_array_del_beg, Void, (Any, Uint), a, delta)
ccall(:jl_array_del_beg, Void, (Any, UInt), a, delta)
return a
end

Expand All @@ -448,7 +448,7 @@ function _deleteat_end!(a::Vector, i::Integer, delta::Integer)
ccall(:memmove, Ptr{Void}, (Ptr{Void}, Ptr{Void}, Csize_t),
pointer(a, i), pointer(a, i+delta), (n-i-delta+1)*elsize(a))
end
ccall(:jl_array_del_end, Void, (Any, Uint), a, delta)
ccall(:jl_array_del_end, Void, (Any, UInt), a, delta)
return a
end

Expand All @@ -457,27 +457,27 @@ end
function push!{T}(a::Array{T,1}, item)
# convert first so we don't grow the array if the assignment won't work
item = convert(T, item)
ccall(:jl_array_grow_end, Void, (Any, Uint), a, 1)
ccall(:jl_array_grow_end, Void, (Any, UInt), a, 1)
a[end] = item
return a
end

function push!(a::Array{Any,1}, item::ANY)
ccall(:jl_array_grow_end, Void, (Any, Uint), a, 1)
ccall(:jl_array_grow_end, Void, (Any, UInt), a, 1)
arrayset(a, item, length(a))
return a
end

function append!{T}(a::Array{T,1}, items::AbstractVector)
n = length(items)
ccall(:jl_array_grow_end, Void, (Any, Uint), a, n)
ccall(:jl_array_grow_end, Void, (Any, UInt), a, n)
copy!(a, length(a)-n+1, items, 1, n)
return a
end

function prepend!{T}(a::Array{T,1}, items::AbstractVector)
n = length(items)
ccall(:jl_array_grow_beg, Void, (Any, Uint), a, n)
ccall(:jl_array_grow_beg, Void, (Any, UInt), a, n)
if a === items
copy!(a, 1, items, n+1, n)
else
Expand All @@ -489,18 +489,18 @@ end
function resize!(a::Vector, nl::Integer)
l = length(a)
if nl > l
ccall(:jl_array_grow_end, Void, (Any, Uint), a, nl-l)
ccall(:jl_array_grow_end, Void, (Any, UInt), a, nl-l)
else
if nl < 0
throw(BoundsError())
end
ccall(:jl_array_del_end, Void, (Any, Uint), a, l-nl)
ccall(:jl_array_del_end, Void, (Any, UInt), a, l-nl)
end
return a
end

function sizehint(a::Vector, sz::Integer)
ccall(:jl_array_sizehint, Void, (Any, Uint), a, sz)
ccall(:jl_array_sizehint, Void, (Any, UInt), a, sz)
a
end

Expand All @@ -509,13 +509,13 @@ function pop!(a::Vector)
error("array must be non-empty")
end
item = a[end]
ccall(:jl_array_del_end, Void, (Any, Uint), a, 1)
ccall(:jl_array_del_end, Void, (Any, UInt), a, 1)
return item
end

function unshift!{T}(a::Array{T,1}, item)
item = convert(T, item)
ccall(:jl_array_grow_beg, Void, (Any, Uint), a, 1)
ccall(:jl_array_grow_beg, Void, (Any, UInt), a, 1)
a[1] = item
return a
end
Expand All @@ -525,7 +525,7 @@ function shift!(a::Vector)
error("array must be non-empty")
end
item = a[1]
ccall(:jl_array_del_beg, Void, (Any, Uint), a, 1)
ccall(:jl_array_del_beg, Void, (Any, UInt), a, 1)
return item
end

Expand Down Expand Up @@ -578,7 +578,7 @@ function deleteat!(a::Vector, inds)
@inbounds a[p] = a[q]
p += 1; q += 1
end
ccall(:jl_array_del_end, Void, (Any, Uint), a, n-p+1)
ccall(:jl_array_del_end, Void, (Any, UInt), a, n-p+1)
return a
end

Expand Down Expand Up @@ -640,7 +640,7 @@ function splice!{T<:Integer}(a::Vector, r::UnitRange{T}, ins=_default_splice)
end

function empty!(a::Vector)
ccall(:jl_array_del_end, Void, (Any, Uint), a, length(a))
ccall(:jl_array_del_end, Void, (Any, UInt), a, length(a))
return a
end

Expand Down Expand Up @@ -828,8 +828,8 @@ function complex{T<:Real}(A::Array{T}, B::Real)
end

# use memcmp for lexcmp on byte arrays
function lexcmp(a::Array{Uint8,1}, b::Array{Uint8,1})
c = ccall(:memcmp, Int32, (Ptr{Uint8}, Ptr{Uint8}, Uint),
function lexcmp(a::Array{UInt8,1}, b::Array{UInt8,1})
c = ccall(:memcmp, Int32, (Ptr{UInt8}, Ptr{UInt8}, UInt),
a, b, min(length(a),length(b)))
c < 0 ? -1 : c > 0 ? +1 : cmp(length(a),length(b))
end
Expand Down Expand Up @@ -1001,7 +1001,7 @@ function vcat{T}(arrays::Vector{T}...)
end
for a in arrays
nba = length(a)*elsz
ccall(:memcpy, Ptr{Void}, (Ptr{Void}, Ptr{Void}, Uint),
ccall(:memcpy, Ptr{Void}, (Ptr{Void}, Ptr{Void}, UInt),
ptr+offset, a, nba)
offset += nba
end
Expand Down
8 changes: 4 additions & 4 deletions base/ascii.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## from base/boot.jl:
#
# immutable ASCIIString <: DirectIndexString
# data::Array{Uint8,1}
# data::Array{UInt8,1}
# end
#

Expand All @@ -28,7 +28,7 @@ function string(c::ASCIIString...)
for s in c
n += length(s.data)
end
v = Array(Uint8,n)
v = Array(UInt8,n)
o = 1
for s in c
ls = length(s.data)
Expand Down Expand Up @@ -98,8 +98,8 @@ write(io::IO, s::ASCIIString) = write(io, s.data)
ascii(x) = convert(ASCIIString, x)
convert(::Type{ASCIIString}, s::ASCIIString) = s
convert(::Type{ASCIIString}, s::UTF8String) = ascii(s.data)
convert(::Type{ASCIIString}, a::Array{Uint8,1}) = is_valid_ascii(a) ? ASCIIString(a) : error("invalid ASCII sequence")
function convert(::Type{ASCIIString}, a::Array{Uint8,1}, invalids_as::ASCIIString)
convert(::Type{ASCIIString}, a::Array{UInt8,1}) = is_valid_ascii(a) ? ASCIIString(a) : error("invalid ASCII sequence")
function convert(::Type{ASCIIString}, a::Array{UInt8,1}, invalids_as::ASCIIString)
l = length(a)
idx = 1
iscopy = false
Expand Down
14 changes: 7 additions & 7 deletions base/base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ call(T::Type{UndefVarError}, var::Symbol) = Core.call(T, var)
call(T::Type{InterruptException}) = Core.call(T)
call(T::Type{SymbolNode}, name::Symbol, t::ANY) = Core.call(T, name, t)
call(T::Type{GetfieldNode}, value, name::Symbol, typ) = Core.call(T, value, name, typ)
call(T::Type{ASCIIString}, d::Array{Uint8,1}) = Core.call(T, d)
call(T::Type{UTF8String}, d::Array{Uint8,1}) = Core.call(T, d)
call(T::Type{ASCIIString}, d::Array{UInt8,1}) = Core.call(T, d)
call(T::Type{UTF8String}, d::Array{UInt8,1}) = Core.call(T, d)
call(T::Type{TypeVar}, args...) = Core.call(T, args...)
call(T::Type{TypeConstructor}, args...) = Core.call(T, args...)
call(T::Type{Expr}, args::ANY...) = _expr(args...)
Expand Down Expand Up @@ -59,7 +59,7 @@ 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::AbstractString) = 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))

Expand Down Expand Up @@ -127,8 +127,8 @@ ccall(:jl_get_system_hooks, Void, ())

int(x) = convert(Int, x)
int(x::Int) = x
uint(x) = convert(Uint, x)
uint(x::Uint) = x
uint(x) = convert(UInt, x)
uint(x::UInt) = x

# index colon
type Colon
Expand Down Expand Up @@ -164,14 +164,14 @@ function append_any(xs...)
for x in xs
for y in x
if i > l
ccall(:jl_array_grow_end, Void, (Any, Uint), out, 16)
ccall(:jl_array_grow_end, Void, (Any, UInt), out, 16)
l += 16
end
arrayset(out, y, i)
i += 1
end
end
ccall(:jl_array_del_end, Void, (Any, Uint), out, l-i+1)
ccall(:jl_array_del_end, Void, (Any, UInt), out, l-i+1)
out
end

Expand Down
Loading

0 comments on commit ff6e5eb

Please sign in to comment.