Skip to content

WIP Add write support #42

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions src/C_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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