Skip to content
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

Changed is_windows to Sys.iswindows #43

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
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
11 changes: 5 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@ os:
- linux
- osx
julia:
- 0.4
- 0.5
- 0.6
- 0.7
- 1.0
- nightly
notifications:
email: false
sudo: false
script:
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
- julia -e 'Pkg.clone(pwd())'
- julia -e 'Pkg.test("LibCURL", coverage=true)'
- julia -e 'using Pkg; Pkg.clone(pwd())'
- julia -e 'using Pkg; Pkg.test("LibCURL", coverage=true)'
after_success:
- julia -e 'cd(Pkg.dir("LibCURL")); Pkg.add("Coverage"); using Coverage; Codecov.submit(process_folder())'
- julia -e 'using Pkg; cd(Pkg.dir("LibCURL")); Pkg.add("Coverage"); using Coverage; Codecov.submit(process_folder())'

9 changes: 9 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name = "LibCURL"
uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21"
version = "v0.2.3"

[deps]
BinDeps = "9e28174c-4ba2-5203-b857-d8d62c4213ee"
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
WinRPM = "c17dfb99-b4f7-5aad-8812-456da1ad7187"
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1)


# setup the callback function to recv data
function curl_write_cb(curlbuf::Ptr{Void}, s::Csize_t, n::Csize_t, p_ctxt::Ptr{Void})
function curl_write_cb(curlbuf::Ptr{Nothing}, s::Csize_t, n::Csize_t, p_ctxt::Ptr{Nothing})
sz = s * n
data = Array{UInt8}(sz)

ccall(:memcpy, Ptr{Void}, (Ptr{Void}, Ptr{Void}, UInt64), data, curlbuf, sz)
ccall(:memcpy, Ptr{Nothing}, (Ptr{Nothing}, Ptr{Nothing}, UInt64), data, curlbuf, sz)
println("recd: ", String(data))

sz::Csize_t
end

c_curl_write_cb = cfunction(curl_write_cb, Csize_t, (Ptr{Void}, Csize_t, Csize_t, Ptr{Void}))
c_curl_write_cb = cfunction(curl_write_cb, Csize_t, (Ptr{Nothing}, Csize_t, Csize_t, Ptr{Nothing}))
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, c_curl_write_cb)


Expand Down
14 changes: 6 additions & 8 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
environment:
matrix:
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.4/julia-0.4-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.4/julia-0.4-latest-win64.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.5/julia-0.5-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.5/julia-0.5-latest-win64.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.7/julia-0.7-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.7/julia-0.7-latest-win64.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/1.0/julia-1.0-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/1.0/julia-1.0-latest-win64.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"

Expand All @@ -32,8 +30,8 @@ install:
build_script:
# Need to convert from shallow to complete for Pkg.clone to work
- IF EXIST .git\shallow (git fetch --unshallow)
- C:\projects\julia\bin\julia -e "versioninfo();
- C:\projects\julia\bin\julia -e "using Pkg; versioninfo();
Pkg.clone(pwd(), \"LibCURL\"); Pkg.build(\"LibCURL\")"

test_script:
- C:\projects\julia\bin\julia -e "Pkg.test(\"LibCURL\")"
- C:\projects\julia\bin\julia -e "using Pkg; Pkg.test(\"LibCURL\")"
4 changes: 2 additions & 2 deletions deps/build.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using BinDeps
import Compat: is_windows
import Compat: Sys.iswindows

@BinDeps.setup

if is_windows()
if Sys.iswindows()
# note that there is a 32-bit version of libcurl.dll
# included with Git, which will not work with 64 bit Julia

Expand Down
14 changes: 7 additions & 7 deletions src/LibCURL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ isdefined(Base, :__precompile__) && __precompile__()

module LibCURL

import Compat: is_windows
import Compat: Sys.iswindows

const time_t = Int
const size_t = Csize_t
Expand All @@ -11,25 +11,25 @@ const curl_off_t = Int64
include("lC_exports_h.jl")
include("lC_common_h.jl")

const libcurl = if is_windows()
const libcurl = if Sys.iswindows()
Pkg.dir("WinRPM","deps","usr","$(Sys.ARCH)-w64-mingw32","sys-root","mingw","bin","libcurl-4")
else
"libcurl"
end

include("lC_curl_h.jl")

curl_easy_setopt(handle, opt, ptrval::Array) = ccall((:curl_easy_setopt, libcurl), CURLcode, (Ptr{CURL}, CURLoption, Ptr{Void}), handle, opt, pointer(ptrval))
curl_easy_setopt(handle, opt, ptrval::Array) = ccall((:curl_easy_setopt, libcurl), CURLcode, (Ptr{CURL}, CURLoption, Ptr{Nothing}), handle, opt, pointer(ptrval))
curl_easy_setopt(handle, opt, ptrval::Integer) = ccall((:curl_easy_setopt, libcurl), CURLcode, (Ptr{CURL}, CURLoption, Clong), handle, opt, ptrval)
curl_easy_setopt{T}(handle, opt, ptrval::Ptr{T}) = ccall((:curl_easy_setopt, libcurl), CURLcode, (Ptr{CURL}, CURLoption, Ptr{T}), handle, opt, ptrval)
curl_easy_setopt(handle, opt, ptrval::Ptr{T}) where T = ccall((:curl_easy_setopt, libcurl), CURLcode, (Ptr{CURL}, CURLoption, Ptr{T}), handle, opt, ptrval)
curl_easy_setopt(handle, opt, ptrval::AbstractString) = ccall((:curl_easy_setopt, libcurl), CURLcode, (Ptr{CURL}, CURLoption, Ptr{UInt8}), handle, opt, ptrval)

curl_multi_setopt(handle, opt, ptrval::Array) = ccall((:curl_multi_setopt, libcurl), CURLMcode, (Ptr{CURLM}, CURLMoption, Ptr{Void}), handle, opt, pointer(ptrval))
curl_multi_setopt(handle, opt, ptrval::Array) = ccall((:curl_multi_setopt, libcurl), CURLMcode, (Ptr{CURLM}, CURLMoption, Ptr{Nothing}), handle, opt, pointer(ptrval))
curl_multi_setopt(handle, opt, ptrval::Integer) = ccall((:curl_multi_setopt, libcurl), CURLMcode, (Ptr{CURLM}, CURLMoption, Clong), handle, opt, ptrval)
curl_multi_setopt{T}(handle, opt, ptrval::Ptr{T}) = ccall((:curl_multi_setopt, libcurl), CURLMcode, (Ptr{CURLM}, CURLMoption, Ptr{T}), handle, opt, ptrval)
curl_multi_setopt(handle, opt, ptrval::Ptr{T}) where T = ccall((:curl_multi_setopt, libcurl), CURLMcode, (Ptr{CURLM}, CURLMoption, Ptr{T}), handle, opt, ptrval)
curl_multi_setopt(handle, opt, ptrval::AbstractString) = ccall((:curl_multi_setopt, libcurl), CURLMcode, (Ptr{CURLM}, CURLMoption, Ptr{UInt8}), handle, opt, ptrval)

curl_easy_getinfo(handle, opt, ptrval::Array) = ccall((:curl_easy_getinfo, libcurl), CURLcode, (Ptr{CURL}, CURLoption, Ptr{Void}), handle, opt, pointer(ptrval))
curl_easy_getinfo(handle, opt, ptrval::Array) = ccall((:curl_easy_getinfo, libcurl), CURLcode, (Ptr{CURL}, CURLoption, Ptr{Nothing}), handle, opt, pointer(ptrval))
curl_easy_getinfo(handle, opt, ptrval::AbstractString) = ccall((:curl_easy_getinfo, libcurl), CURLcode, (Ptr{CURL}, CURLoption, Ptr{UInt8}), handle, opt, ptrval)

include("lC_defines_h.jl")
Expand Down
86 changes: 43 additions & 43 deletions src/lC_common_h.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ end

@ctypedef CURL Union{}
@ctypedef curl_socket_t Int32
type curl_httppost
next::Ptr{Void}
mutable struct curl_httppost
next::Ptr{Nothing}
name::Ptr{UInt8}
namelength::Int32
contents::Ptr{UInt8}
contentslength::Int32
buffer::Ptr{UInt8}
bufferlength::Int32
contenttype::Ptr{UInt8}
contentheader::Ptr{Void}
more::Ptr{Void}
contentheader::Ptr{Nothing}
more::Ptr{Nothing}
flags::Int32
showfilename::Ptr{UInt8}
userp::Ptr{Void}
userp::Ptr{Nothing}
end
@ctypedef curl_progress_callback Ptr{Void}
@ctypedef curl_write_callback Ptr{Void}
@ctypedef curl_progress_callback Ptr{Nothing}
@ctypedef curl_write_callback Ptr{Nothing}
# enum curlfiletype
const CURLFILETYPE_FILE = 0
const CURLFILETYPE_DIRECTORY = 1
Expand All @@ -42,7 +42,7 @@ const CURLFILETYPE_DOOR = 7
const CURLFILETYPE_UNKNOWN = 8
# end
@ctypedef curlfiletype Int32
type curl_fileinfo
mutable struct curl_fileinfo
filename::Ptr{UInt8}
filetype::curlfiletype
time::time_t
Expand All @@ -51,32 +51,32 @@ type curl_fileinfo
gid::Int32
size::curl_off_t
hardlinks::Int32
strings::Void
strings::Nothing
flags::UInt32
b_data::Ptr{UInt8}
b_size::size_t
b_used::size_t
end
@ctypedef curl_chunk_bgn_callback Ptr{Void}
@ctypedef curl_chunk_end_callback Ptr{Void}
@ctypedef curl_fnmatch_callback Ptr{Void}
@ctypedef curl_seek_callback Ptr{Void}
@ctypedef curl_read_callback Ptr{Void}
@ctypedef curl_chunk_bgn_callback Ptr{Nothing}
@ctypedef curl_chunk_end_callback Ptr{Nothing}
@ctypedef curl_fnmatch_callback Ptr{Nothing}
@ctypedef curl_seek_callback Ptr{Nothing}
@ctypedef curl_read_callback Ptr{Nothing}
# enum curlsocktype
const CURLSOCKTYPE_IPCXN = 0
const CURLSOCKTYPE_LAST = 1
# end
@ctypedef curlsocktype Int32
@ctypedef curl_sockopt_callback Ptr{Void}
type curl_sockaddr
@ctypedef curl_sockopt_callback Ptr{Nothing}
mutable struct curl_sockaddr
family::Int32
socktype::Int32
protocol::Int32
addrlen::UInt32
addr::Void
addr::Nothing
end
@ctypedef curl_opensocket_callback Ptr{Void}
@ctypedef curl_closesocket_callback Ptr{Void}
@ctypedef curl_opensocket_callback Ptr{Nothing}
@ctypedef curl_closesocket_callback Ptr{Nothing}
# enum curlioerr
const CURLIOE_OK = 0
const CURLIOE_UNKNOWNCMD = 1
Expand All @@ -90,12 +90,12 @@ const CURLIOCMD_RESTARTREAD = 1
const CURLIOCMD_LAST = 2
# end
@ctypedef curliocmd Int32
@ctypedef curl_ioctl_callback Ptr{Void}
@ctypedef curl_malloc_callback Ptr{Void}
@ctypedef curl_free_callback Ptr{Void}
@ctypedef curl_realloc_callback Ptr{Void}
@ctypedef curl_strdup_callback Ptr{Void}
@ctypedef curl_calloc_callback Ptr{Void}
@ctypedef curl_ioctl_callback Ptr{Nothing}
@ctypedef curl_malloc_callback Ptr{Nothing}
@ctypedef curl_free_callback Ptr{Nothing}
@ctypedef curl_realloc_callback Ptr{Nothing}
@ctypedef curl_strdup_callback Ptr{Nothing}
@ctypedef curl_calloc_callback Ptr{Nothing}
# enum curl_infotype
const CURLINFO_TEXT = 0
const CURLINFO_HEADER_IN = 1
Expand All @@ -107,7 +107,7 @@ const CURLINFO_SSL_DATA_OUT = 6
const CURLINFO_END = 7
# end
@ctypedef curl_infotype Int32
@ctypedef curl_debug_callback Ptr{Void}
@ctypedef curl_debug_callback Ptr{Nothing}
# enum CURLcode
const CURLE_OK = 0
const CURLE_UNSUPPORTED_PROTOCOL = 1
Expand Down Expand Up @@ -201,8 +201,8 @@ const CURLE_CHUNK_FAILED = 88
const CURL_LAST = 89
# end
@ctypedef CURLcode Int32
@ctypedef curl_conv_callback Ptr{Void}
@ctypedef curl_ssl_ctx_callback Ptr{Void}
@ctypedef curl_conv_callback Ptr{Nothing}
@ctypedef curl_ssl_ctx_callback Ptr{Nothing}
# enum curl_proxytype
const CURLPROXY_HTTP = 0
const CURLPROXY_HTTP_1_0 = 1
Expand All @@ -212,7 +212,7 @@ const CURLPROXY_SOCKS4A = 6
const CURLPROXY_SOCKS5_HOSTNAME = 7
# end
@ctypedef curl_proxytype Int32
type curl_khkey
mutable struct curl_khkey
key::Ptr{UInt8}
len::size_t
keytype::Int32
Expand All @@ -230,7 +230,7 @@ const CURLKHMATCH_MISMATCH = 1
const CURLKHMATCH_MISSING = 2
const CURLKHMATCH_LAST = 3
# end
@ctypedef curl_sshkeycallback Ptr{Void}
@ctypedef curl_sshkeycallback Ptr{Nothing}
# enum curl_usessl
const CURLUSESSL_NONE = 0
const CURLUSESSL_TRY = 1
Expand Down Expand Up @@ -520,7 +520,7 @@ const CURLFORM_STREAM = 19
const CURLFORM_LASTENTRY = 20
# end
@ctypedef CURLformoption Int32
type curl_forms
mutable struct curl_forms
option::CURLformoption
value::Ptr{UInt8}
end
Expand All @@ -536,14 +536,14 @@ const CURL_FORMADD_DISABLED = 7
const CURL_FORMADD_LAST = 8
# end
@ctypedef CURLFORMcode Int32
@ctypedef curl_formget_callback Ptr{Void}
type curl_slist
@ctypedef curl_formget_callback Ptr{Nothing}
mutable struct curl_slist
data::Ptr{UInt8}
next::Ptr{Void}
next::Ptr{Nothing}
end
type curl_certinfo
mutable struct curl_certinfo
num_of_certs::Int32
certinfo::Ptr{Ptr{Void}}
certinfo::Ptr{Ptr{Nothing}}
end
# enum CURLINFO
const CURLINFO_NONE = 0
Expand Down Expand Up @@ -619,8 +619,8 @@ const CURL_LOCK_ACCESS_SINGLE = 2
const CURL_LOCK_ACCESS_LAST = 3
# end
@ctypedef curl_lock_access Int32
@ctypedef curl_lock_function Ptr{Void}
@ctypedef curl_unlock_function Ptr{Void}
@ctypedef curl_lock_function Ptr{Nothing}
@ctypedef curl_unlock_function Ptr{Nothing}
@ctypedef CURLSH Union{}
# enum CURLSHcode
const CURLSHE_OK = 0
Expand Down Expand Up @@ -650,7 +650,7 @@ const CURLVERSION_FOURTH = 3
const CURLVERSION_LAST = 4
# end
@ctypedef CURLversion Int32
type curl_version_info_data
mutable struct curl_version_info_data
age::CURLversion
version::Ptr{UInt8}
version_num::UInt32
Expand Down Expand Up @@ -685,13 +685,13 @@ const CURLMSG_DONE = 1
const CURLMSG_LAST = 2
# end
@ctypedef CURLMSG Int32
type CURLMsg
mutable struct CURLMsg
msg::CURLMSG
easy_handle::Ptr{CURL}
data::Void
data::Nothing
end
@ctypedef curl_socket_callback Ptr{Void}
@ctypedef curl_multi_timer_callback Ptr{Void}
@ctypedef curl_socket_callback Ptr{Nothing}
@ctypedef curl_multi_timer_callback Ptr{Nothing}
# enum CURLMoption
const CURLMOPT_SOCKETFUNCTION = 20001
const CURLMOPT_SOCKETDATA = 10002
Expand Down
24 changes: 12 additions & 12 deletions src/lC_curl_h.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@

@c Cint curl_strequal (Ptr{UInt8}, Ptr{UInt8}) libcurl
@c Cint curl_strnequal (Ptr{UInt8}, Ptr{UInt8}, size_t) libcurl
@c CURLFORMcode curl_formadd (Ptr{Ptr{Void}}, Ptr{Ptr{Void}}) libcurl
@c Cint curl_formget (Ptr{Void}, Ptr{Void}, curl_formget_callback) libcurl
@c Void curl_formfree (Ptr{Void},) libcurl
@c CURLFORMcode curl_formadd (Ptr{Ptr{Nothing}}, Ptr{Ptr{Nothing}}) libcurl
@c Cint curl_formget (Ptr{Nothing}, Ptr{Nothing}, curl_formget_callback) libcurl
@c Nothing curl_formfree (Ptr{Nothing},) libcurl
@c Ptr{UInt8} curl_getenv (Ptr{UInt8},) libcurl
@c Ptr{UInt8} curl_version () libcurl
@c Ptr{UInt8} curl_easy_escape (Ptr{CURL}, Ptr{UInt8}, Cint) libcurl
@c Ptr{UInt8} curl_escape (Ptr{UInt8}, Cint) libcurl
@c Ptr{UInt8} curl_easy_unescape (Ptr{CURL}, Ptr{UInt8}, Cint, Ptr{Cint}) libcurl
@c Ptr{UInt8} curl_unescape (Ptr{UInt8}, Cint) libcurl
@c Void curl_free (Ptr{Void},) libcurl
@c Nothing curl_free (Ptr{Nothing},) libcurl
@c CURLcode curl_global_init (Cint,) libcurl
@c CURLcode curl_global_init_mem (Cint, curl_malloc_callback, curl_free_callback, curl_realloc_callback, curl_strdup_callback, curl_calloc_callback) libcurl
@c Void curl_global_cleanup () libcurl
@c Ptr{Void} curl_slist_append (Ptr{Void}, Ptr{UInt8}) libcurl
@c Void curl_slist_free_all (Ptr{Void},) libcurl
@c Nothing curl_global_cleanup () libcurl
@c Ptr{Nothing} curl_slist_append (Ptr{Nothing}, Ptr{UInt8}) libcurl
@c Nothing curl_slist_free_all (Ptr{Nothing},) libcurl
@c time_t curl_getdate (Ptr{UInt8}, Ptr{time_t}) libcurl
@c Ptr{CURLSH} curl_share_init () libcurl
@c CURLSHcode curl_share_setopt (Ptr{CURLSH}, CURLSHoption) libcurl
Expand All @@ -29,12 +29,12 @@
@c Ptr{CURL} curl_easy_init () libcurl
@c CURLcode curl_easy_setopt (Ptr{CURL}, CURLoption) libcurl
@c CURLcode curl_easy_perform (Ptr{CURL},) libcurl
@c Void curl_easy_cleanup (Ptr{CURL},) libcurl
@c Nothing curl_easy_cleanup (Ptr{CURL},) libcurl
@c CURLcode curl_easy_getinfo (Ptr{CURL}, CURLINFO) libcurl
@c Ptr{CURL} curl_easy_duphandle (Ptr{CURL},) libcurl
@c Void curl_easy_reset (Ptr{CURL},) libcurl
@c CURLcode curl_easy_recv (Ptr{CURL}, Ptr{Void}, size_t, Ptr{size_t}) libcurl
@c CURLcode curl_easy_send (Ptr{CURL}, Ptr{Void}, size_t, Ptr{size_t}) libcurl
@c Nothing curl_easy_reset (Ptr{CURL},) libcurl
@c CURLcode curl_easy_recv (Ptr{CURL}, Ptr{Nothing}, size_t, Ptr{size_t}) libcurl
@c CURLcode curl_easy_send (Ptr{CURL}, Ptr{Nothing}, size_t, Ptr{size_t}) libcurl
@c Ptr{CURLM} curl_multi_init () libcurl
@c CURLMcode curl_multi_add_handle (Ptr{CURLM}, Ptr{CURL}) libcurl
@c CURLMcode curl_multi_remove_handle (Ptr{CURLM}, Ptr{CURL}) libcurl
Expand All @@ -48,5 +48,5 @@
@c CURLMcode curl_multi_socket_all (Ptr{CURLM}, Ptr{Cint}) libcurl
@c CURLMcode curl_multi_timeout (Ptr{CURLM}, Ptr{Cint}) libcurl
@c CURLMcode curl_multi_setopt (Ptr{CURLM}, CURLMoption) libcurl
@c CURLMcode curl_multi_assign (Ptr{CURLM}, curl_socket_t, Ptr{Void}) libcurl
@c CURLMcode curl_multi_assign (Ptr{CURLM}, curl_socket_t, Ptr{Nothing}) libcurl