@@ -63,7 +63,7 @@ mutable struct ReadStatDataFrame
6363 measures:: Vector{Cint}
6464 alignments:: Vector{Cint}
6565 val_label_keys:: Vector{String}
66- val_label_dict:: Dict{String, Dict{Any,String}}
66+ val_label_dict:: Dict{String,Dict{Any,String}}
6767 rows:: Int
6868 columns:: Int
6969 filelabel:: String
@@ -72,9 +72,9 @@ mutable struct ReadStatDataFrame
7272 types_as_int:: Vector{Cint}
7373 hasmissings:: Vector{Bool}
7474
75- ReadStatDataFrame () =
75+ ReadStatDataFrame () =
7676 new (Any[], Symbol[], DataType[], String[], String[], Csize_t[], Cint[], Cint[],
77- String[], Dict {String, Dict{Any,String}} (), 0 , 0 , " " , Dates. unix2datetime (0 ), 0 , Cint[], Bool[])
77+ String[], Dict {String,Dict{Any,String}} (), 0 , 0 , " " , Dates. unix2datetime (0 ), 0 , Cint[], Bool[])
7878end
7979
8080include (" C_interface.jl" )
@@ -139,7 +139,7 @@ get_measure(variable::Ptr{Nothing}) = readstat_variable_get_measure(variable)
139139
140140get_alignment (variable:: Ptr{Nothing} ) = readstat_variable_get_measure (variable)
141141
142- function handle_variable! (var_index:: Cint , variable:: Ptr{Nothing} ,
142+ function handle_variable! (var_index:: Cint , variable:: Ptr{Nothing} ,
143143 val_label:: Cstring , ds_ptr:: Ptr{ReadStatDataFrame} )
144144 col = var_index + 1
145145 ds = unsafe_pointer_to_objref (ds_ptr):: ReadStatDataFrame
@@ -158,7 +158,7 @@ function handle_variable!(var_index::Cint, variable::Ptr{Nothing},
158158 push! (ds. storagewidths, get_storagewidth (variable))
159159 push! (ds. measures, get_measure (variable))
160160 push! (ds. alignments, get_alignment (variable))
161-
161+
162162 return Cint (0 )
163163end
164164
@@ -191,55 +191,55 @@ function handle_value!(obs_index::Cint, variable::Ptr{Nothing},
191191 readstat_value_is_missing (value, C_NULL )
192192 end
193193
194- if type_as_int== READSTAT_TYPE_DOUBLE
194+ if type_as_int == READSTAT_TYPE_DOUBLE
195195 col_float64 = data[var_index]:: DataValueVector{Float64}
196196
197197 if ismissing
198198 DataValues. unsafe_setindex_isna! (col_float64, true , obs_index + 1 )
199199 else
200200 readfield! (col_float64, obs_index + 1 , value)
201201 end
202- elseif type_as_int== READSTAT_TYPE_INT32
202+ elseif type_as_int == READSTAT_TYPE_INT32
203203 col_int32 = data[var_index]:: DataValueVector{Int32}
204204
205205 if ismissing
206206 DataValues. unsafe_setindex_isna! (col_int32, true , obs_index + 1 )
207207 else
208208 readfield! (col_int32, obs_index + 1 , value)
209209 end
210- elseif type_as_int== READSTAT_TYPE_STRING
210+ elseif type_as_int == READSTAT_TYPE_STRING
211211 col_string = data[var_index]:: DataValueVector{String}
212212
213213 if ismissing
214214 DataValues. unsafe_setindex_isna! (col_string, true , obs_index + 1 )
215215 else
216216 readfield! (col_string, obs_index + 1 , value)
217217 end
218- elseif type_as_int== READSTAT_TYPE_CHAR
218+ elseif type_as_int == READSTAT_TYPE_CHAR
219219 col_int8 = data[var_index]:: DataValueVector{Int8}
220220
221221 if ismissing
222222 DataValues. unsafe_setindex_isna! (col_int8, true , obs_index + 1 )
223223 else
224224 readfield! (col_int8, obs_index + 1 , value)
225225 end
226- elseif type_as_int== READSTAT_TYPE_INT16
226+ elseif type_as_int == READSTAT_TYPE_INT16
227227 col_int16 = data[var_index]:: DataValueVector{Int16}
228228
229229 if ismissing
230230 DataValues. unsafe_setindex_isna! (col_int16, true , obs_index + 1 )
231231 else
232232 readfield! (col_int16, obs_index + 1 , value)
233233 end
234- elseif type_as_int== READSTAT_TYPE_FLOAT
234+ elseif type_as_int == READSTAT_TYPE_FLOAT
235235 col_float32 = data[var_index]:: DataValueVector{Float32}
236236
237237 if ismissing
238238 DataValues. unsafe_setindex_isna! (col_float32, true , obs_index + 1 )
239239 else
240240 readfield! (col_float32, obs_index + 1 , value)
241241 end
242- else
242+ else
243243 col_untyped = data[var_index]
244244
245245 if ismissing
@@ -284,7 +284,7 @@ function handle_value_label!(val_labels::Cstring, value::Value, label::Cstring,
284284 ds = unsafe_pointer_to_objref (ds_ptr)
285285 dict = get! (ds. val_label_dict, unsafe_string (val_labels), Dict {Any,String} ())
286286 dict[as_native (value)] = unsafe_string (label)
287-
287+
288288 return Cint (0 )
289289end
290290
@@ -311,7 +311,7 @@ function Parser()
311311 ccall ((:readstat_set_value_handler , libreadstat), Int, (Ptr{Nothing}, Ptr{Nothing}), parser, val_fxn)
312312 ccall ((:readstat_set_value_label_handler , libreadstat), Int, (Ptr{Nothing}, Ptr{Nothing}), parser, label_fxn)
313313 return parser
314- end
314+ end
315315
316316function parse_data_file! (ds:: ReadStatDataFrame , parser:: Ptr{Nothing} , filename:: AbstractString , filetype:: Val )
317317 retval = readstat_parse (filename, filetype, parser, ds)
@@ -324,4 +324,4 @@ read_sav(filename::AbstractString) = read_data_file(filename, Val(:sav))
324324read_por (filename:: AbstractString ) = read_data_file (filename, Val (:por ))
325325read_sas7bdat (filename:: AbstractString ) = read_data_file (filename, Val (:sas7bdat ))
326326
327- end # module ReadStat
327+ end # module ReadStat
0 commit comments