Skip to content

Commit

Permalink
Complete and clean c
Browse files Browse the repository at this point in the history
  • Loading branch information
helgee committed Mar 4, 2019
1 parent 06c71d6 commit d274d2c
Show file tree
Hide file tree
Showing 4 changed files with 549 additions and 231 deletions.
28 changes: 26 additions & 2 deletions src/SPICE.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,38 @@ function handleerror()
nothing
end

macro checkdims(m::Int, n::Int, arr::Symbol)
name = string(arr)
quote
m1, n1 = size($(esc(arr)))
if (m1, n1) != ($m, $n)
throw(ArgumentError("`$($name)` must be a $($m)x$($n) matrix but is $($m1)x$($n1)."))
end
nothing
end
end

macro checkdims(len, arr::Symbol...)
ex = :()
for a in arr
name = string(a)
expr = quote
n = length($(esc(a)))
if n != $(esc(len))
throw(ArgumentError("`$($name)` must have $($(esc(len))) elements but has $n."))
end
end
push!(ex.args, expr)
end
:($ex; nothing)
end

# CSPICE data types
const SpiceBoolean = Cint
const SpiceChar = UInt8
const SpiceDouble = Cdouble
const SpiceInt = Cint

const LENOUT = 256

function chararray(strings)
m = length(strings)
# Longest string + terminator
Expand Down
Loading

0 comments on commit d274d2c

Please sign in to comment.