/
utils.jl
62 lines (51 loc) · 1.11 KB
/
utils.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
function jsonify_details(details::Union{Dict{String,Any},Nothing})::String
details_json::String = ""
if !isnothing(details)
details_json = JSON.json(details)
end
return details_json
end
function unsafe_string_and_free(cstring::Cstring, length::Union{Ref{Csize_t}, Nothing}=nothing)::String
if isnothing(length)
str = unsafe_string(cstring)
else
str = unsafe_string(pointer(cstring), length[])
end
ccall((:free_ptr, librdkitcffi), Cvoid, (Cstring,), cstring)
return str
end
"""
version()::String
Get RDKit version.
# Examples
```julia
version = version()
```
"""
function version()::String
val = ccall((:version, librdkitcffi), Cstring, ())
version = unsafe_string_and_free(val)
return version
end
"""
enable_logging()
Enable RDKit logging.
# Examples
```julia
enable_logging()
```
"""
function enable_logging()
ccall((:enable_logging, librdkitcffi), Cvoid, ())
end
"""
disable_logging()
Disable RDKit logging.
# Examples
```julia
disable_logging()
```
"""
function disable_logging()
ccall((:disable_logging, librdkitcffi), Cvoid, ())
end