From d1c3b753f9ad703fbd33142ead6611c76503d9c3 Mon Sep 17 00:00:00 2001 From: David Anthoff Date: Wed, 2 Jan 2019 17:38:31 -0800 Subject: [PATCH] Add write support --- src/C_interface.jl | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/C_interface.jl b/src/C_interface.jl index c906908..569e1aa 100644 --- a/src/C_interface.jl +++ b/src/C_interface.jl @@ -26,3 +26,39 @@ end function readstat_variable_get_index(variable::Ptr{Nothing}) return ccall((:readstat_variable_get_index, libreadstat), Cint, (Ptr{Nothing},), variable) end + +function readstat_writer_init() + return ccall((:readstat_writer_init, libreadstat), Ptr{Cvoid}, ()) +end + +function readstat_set_data_writer(writer, data_writer) + return ccall((:readstat_set_data_writer, libreadstat), Cvoid, (Ptr{Cvoid},Ptr{Cvoid}), (writer, data_writer)) +end + +function readstat_add_variable(writer, name, typ) + return ccall((:readstat_add_variable, libreadstat), Ptr{Cvoid}, (Ptr{Cvoid}, Cstring, UInt), writer, name, typ) +end + +function readstat_begin_writing_dta(writer, user_ctx, row_count) + return ccall((:readstat_begin_writing_dta, libreadstat), UInt, (Ptr{Cvoid}, Ptr{Cvoid}, Clong), writer, user_ctx, row_count) +end + +function readstat_begin_row(writer) + return ccall((:readstat_begin_row, libreadstat), UInt, (Ptr{Cvoid},), writer) +end + +function readstat_insert_double_value(writer, variable, value) + return ccall((:readstat_insert_double_value, libreadstat), UInt, (Ptr{Cvoid},Ptr{Cvoid},Cdouble), writer, variable, value) +end + +function readstat_end_row(writer) + return ccall((:readstat_end_row, libreadstat), UInt, (Ptr{Cvoid},), writer) +end + +function readstat_end_writing(writer) + return ccall((:readstat_end_writing, libreadstat), UInt, (Ptr{Cvoid},), writer) +end + +function readstat_writer_free(writer) + return ccall((:readstat_writer_free, libreadstat), UInt, (Ptr{Cvoid},), writer) +end \ No newline at end of file