-
Notifications
You must be signed in to change notification settings - Fork 17
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
Suppress warnings on julia v0.6 #26
Changes from 5 commits
cdb51fc
4a7bebb
f2e2a43
e194e2e
c933069
d4cbe72
07755e5
aa29cfc
33c6ec3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ os: | |
- linux | ||
- osx | ||
julia: | ||
- 0.4 | ||
- 0.5 | ||
- nightly | ||
notifications: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
julia 0.4 | ||
julia 0.5 | ||
DataFrames 0.7 | ||
DataArrays 0.3 | ||
FileIO 0.1.2 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 = UTF8String # default String container for R string | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should just be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I propose There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will change it to |
||
const Hash = Dict{RString, Any} | ||
|
||
const emptyhash = Hash() | ||
const emptyhashkey = RString("\0") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,34 @@ | ||
""" | ||
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 | ||
fmtver::UInt32 # format version | ||
fmtver::Int32 # format version | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why change the internal field type? Would the format version ever be negative? If not, unsigned seems fine. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The constructor used There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, well whatever you think is better. I was mostly curious as to why this was changed. The option that would cause the least visible breakage would be good. |
||
Rver::VersionNumber # R version used to write the file | ||
Rmin::VersionNumber # minimal R version to read the file | ||
|
||
kwdict::Dict{Symbol,Any} # options defining RDA deserialization behaviour | ||
|
||
# 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) | ||
function RDAContext{T<:RDAIO}(io::T, kwoptions::Vector{Any}=Any[]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe the old inner constructor was added in the first place to ensure the fields are valid? It so, you can keep it using the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure I understand. In what way would the inner constructor ensure validity of fields that the external constructor would not? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because when the inner ctor is explicitly defined, the default implicit inner ctor (which takes the value for every field) is not generated. So any creation of the object would have to go through the explicitly provided inner ctor. Inner Constructors in the Julia manual. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't feel confident in making this change. Could someone else do it, please? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this outer ctor version is fine. Initializing the fields from |
||
fmtver = readint32(io) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be 4 space indents instead of 2 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was switching back and forth between editing code and JSON files and must have left the indent at the wrong setting. Will fix. |
||
rver = readint32(io) | ||
rminver = readint32(io) | ||
kwdict = Dict{Symbol,Any}(kwoptions) | ||
RDAContext(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 | ||
|
||
""" | ||
Registers R object, so that it could be referenced later | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ | |
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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
end | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,29 +4,21 @@ | |
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, Array{UInt8}(1024)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
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) | ||
v = read(io.sub, Int32, n) | ||
map!(ntoh, v, v) | ||
end | ||
readintorNA(io::XDRIO, n::RVecLength) = [readint32(io) for _ in 1:n] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm afraid the new version is less efficient since it allocates a copy for the new vector. What's the problem with the old version? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was trying to avoid the separate |
||
|
||
# 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)) | ||
end | ||
readfloatorNA(io::XDRIO, n::RVecLength) = [readfloat64(io) for _ in 1:n] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as for |
||
|
||
readuint8(io::XDRIO, n::RVecLength) = readbytes(io.sub, n) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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, Array{Any}(Int(nrefs))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd make this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Force of habit - In the old days we couldn't use |
||
end | ||
|
||
const BYTECODELANG_Types = Set([BCREPREF, BCREPDEF, LANGSXP, LISTSXP, ATTRLANGSXP, ATTRLISTSXP]) | ||
|
@@ -231,7 +231,7 @@ function readbytecodeconsts(bctx::BytecodeContext) | |
readitem(bctx.ctx) | ||
end | ||
end | ||
return RList(v) | ||
return RList(v, Hash()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Without that
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was it with the old There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was with the old one. The new one fixed it. |
||
end | ||
|
||
function readbytecodecontents(bctx::BytecodeContext) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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. | ||
|
@@ -98,27 +98,26 @@ 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. | ||
""" | ||
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) | ||
end | ||
RVector{T}(v::Vector{T} = T[]) = RVector(v, Hash()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would keep the inner ctor version as it wouldn't allow creation of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay. I see that making the change also cured the above issue. |
||
|
||
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. | ||
|
@@ -129,12 +128,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} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll also need to raise the minimum version of Compat in this file to 0.17 (I think that's it) to allow
@compat abstract type
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, will do.