Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
helgee committed Mar 6, 2019
1 parent 5f22028 commit 0098eb8
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/c.jl
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ frame is found.
"""
function cnmfrm(cname, lenout=256)
frcode = Ref{SpiceInt}()
frname = Array{UInt8}(undef, lenout)
frname = Array{SpiceChar}(undef, lenout)
found = Ref{SpiceBoolean}()
ccall((:cnmfrm_c, libcspice), Cvoid,
(Cstring, SpiceInt, Ref{SpiceInt}, Ref{SpiceChar}, Ref{SpiceBoolean}),
Expand Down
8 changes: 4 additions & 4 deletions src/e.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1354,9 +1354,9 @@ Returns an output time string equivalent to the input epoch, in the specified fo
"""
function et2utc(et, format, prec)
lenout = 32
utcstr = Array{UInt8}(undef, lenout)
utcstr = Array{SpiceChar}(undef, lenout)
ccall((:et2utc_c, libcspice), Cvoid,
(SpiceDouble, Cstring, SpiceInt, SpiceInt, Ref{UInt8}),
(SpiceDouble, Cstring, SpiceInt, SpiceInt, Ref{SpiceChar}),
et, string(format), prec, lenout, utcstr)
handleerror()
chararray_to_string(utcstr)
Expand All @@ -1382,8 +1382,8 @@ Returns a standard calendar representation of `et`.
- [NAIF Documentation](https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/etcal_c.html)
"""
function etcal(et, lenout=128)
string = Array{UInt8}(undef, lenout)
ccall((:etcal_c, libcspice), Cvoid, (SpiceDouble, SpiceInt, Ref{UInt8}),
string = Array{SpiceChar}(undef, lenout)
ccall((:etcal_c, libcspice), Cvoid, (SpiceDouble, SpiceInt, Ref{SpiceChar}),
et, lenout, string)
chararray_to_string(string)
end
Expand Down
10 changes: 5 additions & 5 deletions src/g.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ Returns an array of values if the variable exists or `nothing` if not.
"""
function gcpool(name; start=1, room=100, lenout=128)
n = Ref{SpiceInt}()
values = Array{UInt8}(undef, lenout, room)
values = Array{SpiceChar}(undef, lenout, room)
found = Ref{SpiceInt}()
ccall((:gcpool_c, libcspice), Cvoid,
(Cstring, SpiceInt, SpiceInt, SpiceInt, Ref{SpiceInt}, Ref{UInt8}, Ref{SpiceBoolean}),
(Cstring, SpiceInt, SpiceInt, SpiceInt, Ref{SpiceInt}, Ref{SpiceChar}, Ref{SpiceBoolean}),
name, start - 1, room, lenout, n, values, found)
handleerror()
if Bool(found[])
Expand Down Expand Up @@ -193,14 +193,14 @@ Returns a tuple consisting of
- [NAIF Documentation](https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/getfov_c.html)
"""
function getfov(instid, room=10, shapelen=128, framelen=128)
shape = Array{UInt8}(undef, shapelen)
frame = Array{UInt8}(undef, framelen)
shape = Array{SpiceChar}(undef, shapelen)
frame = Array{SpiceChar}(undef, framelen)
bsight = Array{SpiceDouble}(undef, 3)
n = Ref{SpiceInt}()
bounds = Array{SpiceDouble}(undef, 3, room)
ccall((:getfov_c, libcspice), Cvoid,
(SpiceInt, SpiceInt, SpiceInt, SpiceInt,
Ref{UInt8}, Ref{UInt8}, Ref{SpiceDouble}, Ref{SpiceInt}, Ref{SpiceDouble}),
Ref{SpiceChar}, Ref{SpiceChar}, Ref{SpiceDouble}, Ref{SpiceInt}, Ref{SpiceDouble}),
instid, room, shapelen, framelen, shape, frame, bsight, n, bounds)
handleerror()
arr_bounds = cmatrix_to_array(bounds)
Expand Down
4 changes: 2 additions & 2 deletions src/h.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ into its equivalent double precision number.
function hx2dp(str)
dp = Ref{SpiceDouble}()
error = Ref{SpiceBoolean}()
errmsg = Array{UInt8}(undef, 46)
errmsg = Array{SpiceChar}(undef, 46)
ccall((:hx2dp_c, libcspice), Cvoid,
(Cstring, SpiceInt, Ref{SpiceDouble}, Ref{SpiceBoolean}, Ref{UInt8}),
(Cstring, SpiceInt, Ref{SpiceDouble}, Ref{SpiceBoolean}, Ref{SpiceChar}),
str, 46, dp, error, errmsg)
if Bool(error[])
throw(SpiceError(chararray_to_string(errmsg)))
Expand Down
20 changes: 10 additions & 10 deletions src/l.jl
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ Returns an array of surface points.
function latsrf(method, target, et, fixref, lonlat)
npts = length(lonlat)
lonlat_ = array_to_cmatrix(lonlat, n=2)
srfpts = Matrix{SpiceDouble}(undef, 3, npts)
srfpts = Array{SpiceDouble}(undef, 3, npts)
ccall((:latsrf_c, libcspice), Cvoid,
(Cstring, Cstring, SpiceDouble, Cstring, SpiceInt, Ref{SpiceDouble}, Ref{SpiceDouble}),
method, target, et, fixref, npts, lonlat_, srfpts)
Expand All @@ -175,8 +175,8 @@ end
_lcase(in) = _lcase(in,length(in)+1)

function _lcase(in,lenout)
out = Array{UInt8}(undef, lenout)
ccall((:lcase_c, libcspice), Cvoid, (Cstring, SpiceInt, Ref{UInt8}), in, lenout, out)
out = Array{SpiceChar}(undef, lenout)
ccall((:lcase_c, libcspice), Cvoid, (Cstring, SpiceInt, Ref{SpiceChar}), in, lenout, out)
handleerror()
chararray_to_string(out)
end
Expand Down Expand Up @@ -335,8 +335,8 @@ end
function _lparse(list, delim, nmax)
lenout = length(list)+1
n = Ref{SpiceInt}()
items = Array{UInt8}(undef, lenout, nmax)
ccall((:lparse_c, libcspice), Cvoid, (Cstring, Cstring, SpiceInt, SpiceInt, Ref{SpiceInt}, Ref{UInt8}),
items = Array{SpiceChar}(undef, lenout, nmax)
ccall((:lparse_c, libcspice), Cvoid, (Cstring, Cstring, SpiceInt, SpiceInt, Ref{SpiceInt}, Ref{SpiceChar}),
list, delim, nmax, lenout, n , items)
handleerror()
chararray_to_string(items, n[])
Expand All @@ -355,8 +355,8 @@ lparse
function _lparsm(list, delims, nmax)
lenout = length(list) + 1
n = Ref{SpiceInt}()
items = Array{UInt8}(undef, lenout, nmax)
ccall((:lparsm_c, libcspice), Cvoid, (Cstring, Cstring, SpiceInt, SpiceInt, Ref{SpiceInt}, Ref{UInt8}),
items = Array{SpiceChar}(undef, lenout, nmax)
ccall((:lparsm_c, libcspice), Cvoid, (Cstring, Cstring, SpiceInt, SpiceInt, Ref{SpiceInt}, Ref{SpiceChar}),
list, delims, nmax, lenout, n , items)
handleerror()
chararray_to_string(items, n[])
Expand All @@ -374,7 +374,7 @@ lparsm

function _lparss(list, delims)
items = SpiceCharCell(length(list), length(list))
ccall((:lparss_c, libcspice), Cvoid, (Cstring, Cstring, Ref{Cell{UInt8}}),
ccall((:lparss_c, libcspice), Cvoid, (Cstring, Cstring, Ref{Cell{SpiceChar}}),
list, delims, Ref(items.cell))
handleerror()
items
Expand Down Expand Up @@ -422,7 +422,7 @@ end
function _lstle(string::AbstractString, array)
n = length(array)
array_, n, lenvals = chararray(array)
out = ccall((:lstlec_c, libcspice), SpiceInt, (Cstring, SpiceInt, SpiceInt, Ref{UInt8}),
out = ccall((:lstlec_c, libcspice), SpiceInt, (Cstring, SpiceInt, SpiceInt, Ref{SpiceChar}),
string, n, lenvals, array_)
handleerror()
out + 1
Expand Down Expand Up @@ -467,7 +467,7 @@ lstlei
function _lstlt(string::AbstractString, array)
n = length(array)
array_, n, lenvals = chararray(array)
out = ccall((:lstltc_c, libcspice), SpiceInt, (Cstring, SpiceInt, SpiceInt, Ref{UInt8}),
out = ccall((:lstltc_c, libcspice), SpiceInt, (Cstring, SpiceInt, SpiceInt, Ref{SpiceChar}),
string, n, lenvals, array_)
handleerror()
out + 1
Expand Down
2 changes: 1 addition & 1 deletion src/p.jl
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ Insert character data into the kernel pool.
function pcpool(name, vals)
vals_, n, lenvals = chararray(vals)
ccall((:pcpool_c, libcspice), Cvoid,
(Cstring, SpiceInt, SpiceInt, Ref{UInt8}),
(Cstring, SpiceInt, SpiceInt, Ref{SpiceChar}),
name, n, lenvals, vals_)
handleerror()
end
Expand Down
14 changes: 7 additions & 7 deletions src/t.jl
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Returns the value associated with the default item.
"""
function timdef(action, item, value="")
lenout = 10
val = fill(UInt8(0), lenout)
val = fill(SpiceChar(0), lenout)
val[1:length(value)] .= collect(value)
ccall((:timdef_c, libcspice), Cvoid,
(Cstring, Cstring, SpiceInt, Ref{SpiceChar}),
Expand Down Expand Up @@ -152,7 +152,7 @@ Returns a string representation of the input epoch.
- [NAIF Documentation](https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/timout_c.html)
"""
function timout(et, pictur, lenout=128)
string = Array{UInt8}(undef, lenout)
string = Array{SpiceChar}(undef, lenout)
ccall((:timout_c, libcspice), Cvoid,
(Cdouble, Cstring, SpiceInt, Ref{SpiceChar}),
et, pictur, lenout, string)
Expand Down Expand Up @@ -252,9 +252,9 @@ Returns UTC expressed in seconds since J2000.
function tparse(string)
lenout = 128
sp2000 = Ref{SpiceDouble}()
errmsg = Array{UInt8}(undef, lenout)
errmsg = Array{SpiceChar}(undef, lenout)
ccall((:tparse_c, libcspice), Cvoid,
(Cstring, SpiceInt, Ref{SpiceDouble}, Ref{UInt8}),
(Cstring, SpiceInt, Ref{SpiceDouble}, Ref{SpiceChar}),
string, lenout, sp2000, errmsg)
msg = chararray_to_string(errmsg)
if !isempty(msg)
Expand Down Expand Up @@ -284,11 +284,11 @@ Returns a format picture that describes sample.
"""
function tpictr(sample, lenout=80)
lenerr = 128
pictur = Array{UInt8}(undef, lenout)
pictur = Array{SpiceChar}(undef, lenout)
ok = Ref{SpiceBoolean}()
errmsg = Array{UInt8}(undef, lenerr)
errmsg = Array{SpiceChar}(undef, lenerr)
ccall((:tpictr_c, libcspice), Cvoid,
(Cstring, SpiceInt, SpiceInt, Ref{UInt8}, Ref{SpiceBoolean}, Ref{UInt8}),
(Cstring, SpiceInt, SpiceInt, Ref{SpiceChar}, Ref{SpiceBoolean}, Ref{SpiceChar}),
sample, lenout, lenerr, pictur, ok, errmsg)
if !Bool(ok[])
throw(SpiceError(chararray_to_string(errmsg)))
Expand Down
2 changes: 1 addition & 1 deletion src/u.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export ucase,
function _ucase(in)
n = length(in) + 1
out = Array{SpiceChar}(undef, n)
ccall((:ucase_c, libcspice), Cvoid, (Cstring, SpiceInt, Ref{UInt8}),
ccall((:ucase_c, libcspice), Cvoid, (Cstring, SpiceInt, Ref{SpiceChar}),
in, n, out)
chararray_to_string(out)
end
Expand Down

0 comments on commit 0098eb8

Please sign in to comment.