Skip to content

Commit

Permalink
Suppress warnings on julia v0.6 (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmbates authored and ararslan committed Apr 10, 2017
1 parent e2b9b67 commit 54d3385
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 59 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ os:
- linux
- osx
julia:
- 0.4
- 0.5
- nightly
notifications:
Expand Down
4 changes: 2 additions & 2 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
julia 0.4
julia 0.5
DataFrames 0.7
DataArrays 0.3
FileIO 0.1.2
GZip 0.2
Compat 0.8
Compat 0.17
2 changes: 0 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
environment:
matrix:
- JULIAVERSION: "julialang/bin/winnt/x86/0.4/julia-0.4-latest-win32.exe"
- JULIAVERSION: "julialang/bin/winnt/x64/0.4/julia-0.4-latest-win64.exe"
- JULIAVERSION: "julialang/bin/winnt/x86/0.5/julia-0.5-latest-win32.exe"
- JULIAVERSION: "julialang/bin/winnt/x64/0.5/julia-0.5-latest-win64.exe"
- JULIAVERSION: "julianightlies/bin/winnt/x86/julia-latest-win32.exe"
Expand Down
4 changes: 2 additions & 2 deletions src/RData.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module RData
using Compat, DataFrames, GZip, FileIO
import DataArrays: data
import DataFrames: identifier
import Compat: UTF8String, unsafe_string
import Compat: unsafe_string
import FileIO: load

export
Expand All @@ -19,7 +19,7 @@ include("sxtypes.jl")
"""
Abstract RDA format IO stream wrapper.
"""
abstract RDAIO
@compat abstract type RDAIO end

include("io/XDRIO.jl")
include("io/ASCIIIO.jl")
Expand Down
10 changes: 3 additions & 7 deletions src/config.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,10 @@ const R_NA_STRING = "NA"

const LONG_VECTOR_SUPPORT = (Sys.WORD_SIZE > 32) # disable long vectors support on 32-bit machines

if LONG_VECTOR_SUPPORT
typealias RVecLength Int64
else
typealias RVecLength Int
end
const RVecLength = LONG_VECTOR_SUPPORT ? Int64 : Int

typealias RString UTF8String # default String container for R string
typealias Hash Dict{RString, Any}
const RString = String # default String container for R string
const Hash = Dict{RString, Any}

const emptyhash = Hash()
const emptyhashkey = RString("\0")
31 changes: 11 additions & 20 deletions src/context.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
"""
RDA (R data archive) reading context.
* Stores flags that define how R objects are read and converted
into Julia objects.
* Maintains the list of R objects that could be referenced later in
the RDA stream.
* Stores flags that define how R objects are read and converted into Julia objects.
* Maintains the list of R objects that could be referenced later in the RDA stream.
"""
type RDAContext{T <: RDAIO}
type RDAContext{T<:RDAIO}
io::T # RDA input stream

# RDA format properties
Expand All @@ -18,22 +16,15 @@ type RDAContext{T <: RDAIO}

# intermediate data
ref_tab::Vector{RSEXPREC} # SEXP array for references

function RDAContext(io::T, kwoptions::Vector{Any})
fmtver = readint32(io)
rver = readint32(io)
rminver = readint32(io)
kwdict = Dict{Symbol,Any}(kwoptions)
new(io,
fmtver,
VersionNumber(div(rver,65536), div(rver%65536, 256), rver%256),
VersionNumber(div(rminver,65536), div(rminver%65536, 256), rminver%256),
kwdict,
RSEXPREC[])
end
end

RDAContext{T <: RDAIO}(io::T, kwoptions::Vector{Any}) = RDAContext{T}(io, kwoptions)
int2ver(v::Integer) = VersionNumber(v >> 16, (v >> 8) & 0xff, v & 0xff)
function RDAContext{T<:RDAIO}(io::T, kwoptions::Vector{Any}=Any[])
fmtver = readuint32(io)
rver = int2ver(readint32(io))
rminver = int2ver(readint32(io))
kwdict = Dict{Symbol,Any}(kwoptions)
RDAContext(io, fmtver, rver, rminver, kwdict, RSEXPREC[])
end

"""
Registers R object, so that it could be referenced later
Expand Down
3 changes: 1 addition & 2 deletions src/io/ASCIIIO.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
type ASCIIIO{T<:IO} <: RDAIO
sub::T # underlying IO stream

ASCIIIO(io::T) = new(io)
@compat (::Type{ASCIIIO}){T<:IO}(io::T) = new{T}(io)
(::Type{ASCIIIO}){T<:IO}(io::T) = new{T}(io)
end

readint32(io::ASCIIIO) = parse(Int32, readline(io.sub))
Expand Down
4 changes: 1 addition & 3 deletions src/io/NativeIO.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,5 @@
"""
type NativeIO{T<:IO} <: RDAIO
sub::T # underlying IO stream

NativeIO(io::T) = new(io)
@compat (::Type{NativeIO}){T<:IO}(io::T) = new{T}(io)
(::Type{NativeIO}){T<:IO}(io::T) = new{T}(io)
end
9 changes: 3 additions & 6 deletions src/io/XDRIO.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,22 @@
type XDRIO{T<:IO} <: RDAIO
sub::T # underlying IO stream
buf::Vector{UInt8} # buffer for strings

XDRIO(io::T) = new(io, Array(UInt8, 1024))
@compat (::Type{XDRIO}){T <: IO}(io::T) = new{T}(io, Array(UInt8, 1024))
@compat (::Type{XDRIO}){T <: IO}(io::T) = new{T}(io, Vector{UInt8}(1024))
end

readint32(io::XDRIO) = ntoh(read(io.sub, Int32))
readuint32(io::XDRIO) = ntoh(read(io.sub, UInt32))
readfloat64(io::XDRIO) = ntoh(read(io.sub, Float64))
readfloat64(io::XDRIO) = reinterpret(Float64, ntoh(read(io.sub, Int64)))

readintorNA(io::XDRIO) = readint32(io)
function readintorNA(io::XDRIO, n::RVecLength)
function readintorNA(io::XDRIO, n::RVecLength)
v = read(io.sub, Int32, n)
map!(ntoh, v, v)
end

# this method have Win32 ABI issues, see JuliaStats/RData.jl#5
# R's NA is silently converted to NaN when the value is loaded in the register(?)
#readfloatorNA(io::XDRIO) = readfloat64(io)

function readfloatorNA(io::XDRIO, n::RVecLength)
v = read(io.sub, UInt64, n)
reinterpret(Float64, map!(ntoh, v, v))
Expand Down
4 changes: 2 additions & 2 deletions src/readers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ immutable BytecodeContext
ctx::RDAContext # parent RDA context
ref_tab::Vector{Any} # table of bytecode references

BytecodeContext(ctx::RDAContext, nrefs::Int32) = new(ctx, Array(Any, Int(nrefs)))
BytecodeContext(ctx::RDAContext, nrefs::Int32) = new(ctx, Vector{Any}(Int(nrefs)))
end

const BYTECODELANG_Types = Set([BCREPREF, BCREPDEF, LANGSXP, LISTSXP, ATTRLANGSXP, ATTRLISTSXP])
Expand Down Expand Up @@ -254,7 +254,7 @@ end
Definition of R type.
"""
immutable SXTypeInfo
name::UTF8String # R type name
name::String # R type name
reader::Function # function to deserialize R type from RDA stream
end

Expand Down
24 changes: 12 additions & 12 deletions src/sxtypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const ATTRLISTSXP = 0xEF
##
##############################################################################

typealias RDATag UInt32
const RDATag = UInt32

isobj(fl::RDATag) = (fl & 0x00000100) != 0
hasattr(fl::RDATag) = (fl & 0x00000200) != 0
Expand All @@ -85,7 +85,7 @@ sxtype(fl::RDATag) = fl % UInt8
Base class for RData internal representation of all R types.
`SEXPREC` stands for S (R predecessor) expression record.
"""
abstract RSEXPREC{S}
@compat abstract type RSEXPREC{S} end

"""
R symbol.
Expand All @@ -98,12 +98,12 @@ end
"""
Base class for all R types (objects) that can have attributes.
"""
abstract ROBJ{S} <: RSEXPREC{S}
@compat abstract type ROBJ{S} <: RSEXPREC{S} end

"""
Base class for all R vector-like objects.
"""
abstract RVEC{T, S} <: ROBJ{S}
@compat abstract type RVEC{T, S} <: ROBJ{S} end

"""
R vector object.
Expand All @@ -112,13 +112,13 @@ type RVector{T, S} <: RVEC{T, S}
data::Vector{T}
attr::Hash # collection of R object attributes

RVector(v::Vector{T} = T[], attr::Hash = Hash()) = new(v, attr)
(::Type{RVector{T,S}}){T,S}(v::Vector{T}=T[], attr::Hash=Hash()) = new{T,S}(v, attr)
end

typealias RLogicalVector RVector{Int32, LGLSXP}
typealias RIntegerVector RVector{Int32, INTSXP}
typealias RNumericVector RVector{Float64, REALSXP}
typealias RComplexVector RVector{Complex128, CPLXSXP}
const RLogicalVector = RVector{Int32, LGLSXP}
const RIntegerVector = RVector{Int32, INTSXP}
const RNumericVector = RVector{Float64, REALSXP}
const RComplexVector = RVector{Complex128, CPLXSXP}

"""
R vector object with explicit NA values.
Expand All @@ -129,12 +129,12 @@ immutable RNullableVector{T, S} <: RVEC{T, S}
attr::Hash # collection of R object attributes
end

typealias RStringVector RNullableVector{RString,STRSXP}
typealias RList RVector{RSEXPREC,VECSXP} # "list" in R == Julia cell array
const RStringVector = RNullableVector{RString,STRSXP}
const RList = RVector{RSEXPREC,VECSXP} # "list" in R == Julia cell array

"""
Representation of R's paired list-like structures (`LISTSXP`, `LANGSXP`).
Unlike R that represents it as singly-linked list,
Unlike R which represents these as singly-linked list,
`RPairList` uses vector representation.
"""
immutable RPairList <: ROBJ{LISTSXP}
Expand Down

0 comments on commit 54d3385

Please sign in to comment.