Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix remaining $ uses

  • Loading branch information...
commit efca015345014372ca310caffca9c933449441cd 1 parent ad5361b
@JeffBezanson JeffBezanson authored
View
48 extras/Rmath.jl
@@ -115,14 +115,14 @@ macro _jl_libRmath_1par_0d(base)
quote
global $dd, $pp, $qq, $rr
($dd)(x::Number, p1::Number, give_log::Bool) =
- ccall(dlsym(_jl_libRmath,$string(dd)), Float64, (Float64,Float64,Int32), x, p1, give_log)
+ ccall(dlsym(_jl_libRmath,$(string(dd))), Float64, (Float64,Float64,Int32), x, p1, give_log)
($dd){T<:Number}(x::AbstractArray{T}, p1::Number, give_log::Bool) =
reshape([ ($dd)(x[i], p1, give_log) for i=1:numel(x) ], size(x))
($dd)(x::Number, p1::Number) = ($dd)(x, p1, false)
@vectorize_2arg Number $dd
($pp)(q::Number, p1::Number, lower_tail::Bool, log_p::Bool) =
- ccall(dlsym(_jl_libRmath,$string(pp)), Float64, (Float64,Float64,Int32,Int32), q, p1, lower_tail, log_p)
+ ccall(dlsym(_jl_libRmath,$(string(pp))), Float64, (Float64,Float64,Int32,Int32), q, p1, lower_tail, log_p)
($pp){T<:Number}(q::AbstractArray{T}, p1::Number, lower_tail::Bool, log_p::Bool) =
reshape([ ($pp)(q[i], p1, lower_tail, log_p) for i=1:numel(q) ], size(q))
($pp)(q::Number, p1::Number, lower_tail::Bool) = ($pp)(q, p1, lower_tail, false)
@@ -131,7 +131,7 @@ macro _jl_libRmath_1par_0d(base)
@vectorize_2arg Number $pp
($qq)(p::Number, p1::Number, lower_tail::Bool, log_p::Bool) =
- ccall(dlsym(_jl_libRmath,$string(qq)), Float64, (Float64,Float64,Int32,Int32), p, p1, lower_tail, log_p)
+ ccall(dlsym(_jl_libRmath,$(string(qq))), Float64, (Float64,Float64,Int32,Int32), p, p1, lower_tail, log_p)
($qq){T<:Number}(p::AbstractArray{T}, p1::Number, lower_tail::Bool, log_p::Bool) =
reshape([ ($qq)(p[i], p1, lower_tail, log_p) for i=1:numel(p) ], size(p))
($qq)(p::Number, p1::Number, lower_tail::Bool) = ($qq)(p, p1, lower_tail, false)
@@ -140,7 +140,7 @@ macro _jl_libRmath_1par_0d(base)
@vectorize_2arg Number $qq
($rr)(nn::Integer, p1::Number) =
- [ ccall(dlsym(_jl_libRmath,$string(rr)), Float64, (Float64,), p1) for i=1:nn ]
+ [ ccall(dlsym(_jl_libRmath,$(string(rr))), Float64, (Float64,), p1) for i=1:nn ]
end
end
@@ -158,7 +158,7 @@ macro _jl_libRmath_1par_1d(base, d1)
quote
global $dd, $pp, $qq, $rr
($dd)(x::Number, p1::Number, give_log::Bool) =
- ccall(dlsym(_jl_libRmath,$string(dd)), Float64, (Float64,Float64,Int32), x, p1, give_log)
+ ccall(dlsym(_jl_libRmath,$(string(dd))), Float64, (Float64,Float64,Int32), x, p1, give_log)
($dd){T<:Number}(x::AbstractArray{T}, p1::Number, give_log::Bool) =
reshape([ ($dd)(x[i], p1, give_log) for i=1:numel(x) ], size(x))
($dd)(x::Number, give_log::Bool) = ($dd)(x, $d1, give_log)
@@ -169,7 +169,7 @@ macro _jl_libRmath_1par_1d(base, d1)
($dd){T<:Number}(x::AbstractArray{T}) = ($dd)(x, $d1, false)
($pp)(q::Number, p1::Number, lower_tail::Bool, log_p::Bool) =
- ccall(dlsym(_jl_libRmath,$string(pp)), Float64, (Float64,Float64,Int32,Int32), q, p1, lower_tail, log_p)
+ ccall(dlsym(_jl_libRmath,$(string(pp))), Float64, (Float64,Float64,Int32,Int32), q, p1, lower_tail, log_p)
($pp){T<:Number}(q::AbstractArray{T}, p1::Number, lower_tail::Bool, log_p::Bool) =
reshape([ ($pp)(q[i], p1, lower_tail, log_p) for i=1:numel(q) ], size(q))
($pp)(q::Number, lower_tail::Bool, log_p::Bool) = ($pp)(q, $d1, lower_tail, log_p)
@@ -184,7 +184,7 @@ macro _jl_libRmath_1par_1d(base, d1)
($pp){T<:Number}(q::AbstractArray{T}) = ($pp)(q, $d1, true, false)
($qq)(p::Number, p1::Number, lower_tail::Bool, log_p::Bool) =
- ccall(dlsym(_jl_libRmath,$string(qq)), Float64, (Float64,Float64,Int32,Int32), p, p1, lower_tail, log_p)
+ ccall(dlsym(_jl_libRmath,$(string(qq))), Float64, (Float64,Float64,Int32,Int32), p, p1, lower_tail, log_p)
($qq){T<:Number}(p::AbstractArray{T}, p1::Number, lower_tail::Bool, log_p::Bool) =
reshape([ ($qq)(p[i], p1, lower_tail, log_p) for i=1:numel(p) ], size(p))
($qq)(p::Number, lower_tail::Bool, log_p::Bool) = ($qq)(p, $d1, lower_tail, log_p)
@@ -199,7 +199,7 @@ macro _jl_libRmath_1par_1d(base, d1)
($qq){T<:Number}(p::AbstractArray{T}) = ($qq)(p, $d1, true, false)
($rr)(nn::Integer, p1::Number) =
- [ ccall(dlsym(_jl_libRmath,$string(rr)), Float64, (Float64,), p1) for i=1:nn ]
+ [ ccall(dlsym(_jl_libRmath,$(string(rr))), Float64, (Float64,), p1) for i=1:nn ]
($rr)(nn::Integer) = ($rr)(nn, $d1)
end
end
@@ -216,14 +216,14 @@ macro _jl_libRmath_2par_0d(base)
quote
global $dd, $pp, $qq, $rr
($dd)(x::Number, p1::Number, p2::Number, give_log::Bool) =
- ccall(dlsym(_jl_libRmath,$string(dd)), Float64, (Float64,Float64,Float64,Int32), x, p1, p2, give_log)
+ ccall(dlsym(_jl_libRmath,$(string(dd))), Float64, (Float64,Float64,Float64,Int32), x, p1, p2, give_log)
($dd){T<:Number}(x::AbstractArray{T}, p1::Number, p2::Number, give_log::Bool) =
reshape([ ($dd)(x[i], p1, p2, give_log) for i=1:numel(x) ], size(x))
($dd)(x::Number, p1::Number, p2::Number) = ($dd)(x, p1, p2, false)
@_jl_libRmath_vectorize_3arg $dd
($pp)(q::Number, p1::Number, p2::Number, lower_tail::Bool, log_p::Bool) =
- ccall(dlsym(_jl_libRmath,$string(pp)), Float64, (Float64,Float64,Float64,Int32,Int32), q, p1, p2, lower_tail, log_p)
+ ccall(dlsym(_jl_libRmath,$(string(pp))), Float64, (Float64,Float64,Float64,Int32,Int32), q, p1, p2, lower_tail, log_p)
($pp){T<:Number}(q::AbstractArray{T}, p1::Number, p2::Number, lower_tail::Bool, log_p::Bool) =
reshape([ ($pp)(q[i], p1, p2, lower_tail, log_p) for i=1:numel(q) ], size(q))
($pp)(q::Number, p1::Number, p2::Number, lower_tail::Bool) = ($pp)(q, p1, p2, lower_tail, false)
@@ -233,7 +233,7 @@ macro _jl_libRmath_2par_0d(base)
@_jl_libRmath_vectorize_3arg $pp
($qq)(p::Number, p1::Number, p2::Number, lower_tail::Bool, log_p::Bool) =
- ccall(dlsym(_jl_libRmath,$string(qq)), Float64, (Float64,Float64,Float64,Int32,Int32), p, p1, p2, lower_tail, log_p)
+ ccall(dlsym(_jl_libRmath,$(string(qq))), Float64, (Float64,Float64,Float64,Int32,Int32), p, p1, p2, lower_tail, log_p)
($qq){T<:Number}(p::AbstractArray{T}, p1::Number, p2::Number, lower_tail::Bool, log_p::Bool) =
reshape([ ($qq)(p[i], p1, p2, lower_tail, log_p) for i=1:numel(p) ], size(p))
($qq)(p::Number, p1::Number, p2::Number, lower_tail::Bool) = ($qq)(p, p1, p2, lower_tail, false)
@@ -243,7 +243,7 @@ macro _jl_libRmath_2par_0d(base)
@_jl_libRmath_vectorize_3arg $qq
($rr)(nn::Integer, p1::Number, p2::Number) =
- [ ccall(dlsym(_jl_libRmath,$string(rr)), Float64, (Float64,Float64), p1, p2) for i=1:nn ]
+ [ ccall(dlsym(_jl_libRmath,$(string(rr))), Float64, (Float64,Float64), p1, p2) for i=1:nn ]
end
end
@@ -263,7 +263,7 @@ macro _jl_libRmath_2par_1d(base, d2)
quote
global $dd, $pp, $qq, $rr
($dd)(x::Number, p1::Number, p2::Number, give_log::Bool) =
- ccall(dlsym(_jl_libRmath,$string(dd)), Float64, (Float64,Float64,Float64,Int32), x, p1, p2, give_log)
+ ccall(dlsym(_jl_libRmath,$(string(dd))), Float64, (Float64,Float64,Float64,Int32), x, p1, p2, give_log)
($dd){T<:Number}(x::AbstractArray{T}, p1::Number, p2::Number, give_log::Bool) =
reshape([ ($dd)(x[i], p1, p2, give_log) for i=1:numel(x) ], size(x))
($dd)(x::Number, p1::Number, give_log::Bool) = ($dd)(x, p1, $d2, give_log)
@@ -274,7 +274,7 @@ macro _jl_libRmath_2par_1d(base, d2)
@vectorize_2arg Number $dd
($pp)(q::Number, p1::Number, p2::Number, lower_tail::Bool, log_p::Bool) =
- ccall(dlsym(_jl_libRmath,$string(pp)), Float64, (Float64,Float64,Float64,Int32,Int32), q, p1, p2, lower_tail, log_p)
+ ccall(dlsym(_jl_libRmath,$(string(pp))), Float64, (Float64,Float64,Float64,Int32,Int32), q, p1, p2, lower_tail, log_p)
($pp)(q::Number, p1::Number, lower_tail::Bool, log_p::Bool) = ($pp)(q, p1, $d2, lower_tail, log_p)
($pp){T<:Number}(q::AbstractArray{T}, p1::Number, p2::Number, lower_tail::Bool, log_p::Bool) =
reshape([ ($pp)(q[i], p1, p2, lower_tail, log_p) for i=1:numel(q) ], size(q))
@@ -289,7 +289,7 @@ macro _jl_libRmath_2par_1d(base, d2)
@vectorize_2arg Number $pp
($qq)(p::Number, p1::Number, p2::Number, lower_tail::Bool, log_p::Bool) =
- ccall(dlsym(_jl_libRmath,$string(qq)), Float64, (Float64,Float64,Float64,Int32,Int32), p, p1, p2, lower_tail, log_p)
+ ccall(dlsym(_jl_libRmath,$(string(qq))), Float64, (Float64,Float64,Float64,Int32,Int32), p, p1, p2, lower_tail, log_p)
($qq)(p::Number, p1::Number, lower_tail::Bool, log_p::Bool) = ($qq)(p, p1, $d2, lower_tail, log_p)
($qq){T<:Number}(p::AbstractArray{T}, p1::Number, p2::Number, lower_tail::Bool, log_p::Bool) =
reshape([ ($qq)(p[i], p1, p2, lower_tail, log_p) for i=1:numel(p) ], size(p))
@@ -304,7 +304,7 @@ macro _jl_libRmath_2par_1d(base, d2)
@vectorize_2arg Number $qq
($rr)(nn::Integer, p1::Number, p2::Number) =
- [ ccall(dlsym(_jl_libRmath,$string(rr)), Float64, (Float64,Float64), p1, p2) for i=1:nn ]
+ [ ccall(dlsym(_jl_libRmath,$(string(rr))), Float64, (Float64,Float64), p1, p2) for i=1:nn ]
($rr)(nn::Integer, p1::Number) = ($rr)(nn, p1, $d2)
end
end
@@ -326,7 +326,7 @@ macro _jl_libRmath_2par_2d(base, d1, d2)
quote
global $dd, $pp, $qq, $rr
($dd)(x::Number, p1::Number, p2::Number, give_log::Bool) =
- ccall(dlsym(_jl_libRmath,$string(ddsym)), Float64, (Float64,Float64,Float64,Int32), x, p1, p2, give_log)
+ ccall(dlsym(_jl_libRmath,$(string(ddsym))), Float64, (Float64,Float64,Float64,Int32), x, p1, p2, give_log)
($dd){T<:Number}(x::AbstractArray{T}, p1::Number, p2::Number, give_log::Bool) =
reshape([ ($dd)(x[i], p1, p2, give_log) for i=1:numel(x) ], size(x))
($dd)(x::Number, p1::Number, give_log::Bool) = ($dd)(x, p1, $d2, give_log)
@@ -342,7 +342,7 @@ macro _jl_libRmath_2par_2d(base, d1, d2)
($pp)(q::Number, p1::Number, p2::Number, lower_tail::Bool, log_p::Bool) =
- ccall(dlsym(_jl_libRmath,$string(ppsym)), Float64, (Float64,Float64,Float64,Int32,Int32), q, p1, p2, lower_tail, log_p)
+ ccall(dlsym(_jl_libRmath,$(string(ppsym))), Float64, (Float64,Float64,Float64,Int32,Int32), q, p1, p2, lower_tail, log_p)
($pp){T<:Number}(q::AbstractArray{T}, p1::Number, p2::Number, lower_tail::Bool, log_p::Bool) =
reshape([ ($pp)(q[i], p1, p2, lower_tail, log_p) for i=1:numel(q) ], size(q))
($pp)(q::Number, p1::Number, lower_tail::Bool, log_p::Bool) = ($pp)(q, p1, $d2, lower_tail, log_p)
@@ -363,7 +363,7 @@ macro _jl_libRmath_2par_2d(base, d1, d2)
($pp){T<:Number}(q::AbstractArray{T}) = ($pp)(q, $d1, $d2, true, false)
($qq)(p::Number, p1::Number, p2::Number, lower_tail::Bool, log_p::Bool) =
- ccall(dlsym(_jl_libRmath,$string(qqsym)), Float64, (Float64,Float64,Float64,Int32,Int32), p, p1, p2, lower_tail, log_p)
+ ccall(dlsym(_jl_libRmath,$(string(qqsym))), Float64, (Float64,Float64,Float64,Int32,Int32), p, p1, p2, lower_tail, log_p)
($qq){T<:Number}(p::AbstractArray{T}, p1::Number, p2::Number, lower_tail::Bool, log_p::Bool) =
reshape([ ($qq)(p[i], p1, p2, lower_tail, log_p) for i=1:numel(p) ], size(p))
($qq)(p::Number, p1::Number, lower_tail::Bool, log_p::Bool) = ($qq)(p, p1, $d2, lower_tail, log_p)
@@ -384,7 +384,7 @@ macro _jl_libRmath_2par_2d(base, d1, d2)
($qq){T<:Number}(p::AbstractArray{T}) = ($qq)(p, $d1, $d2, true, false)
($rr)(nn::Integer, p1::Number, p2::Number) =
- [ ccall(dlsym(_jl_libRmath,$string(rr)), Float64, (Float64,Float64), p1, p2) for i=1:nn ]
+ [ ccall(dlsym(_jl_libRmath,$(string(rr))), Float64, (Float64,Float64), p1, p2) for i=1:nn ]
($rr)(nn::Integer, p1::Number) = ($rr)(nn, p1, $d2)
($rr)(nn::Integer) = ($rr)(nn, $d1, $d2)
end
@@ -405,14 +405,14 @@ macro _jl_libRmath_3par_0d(base)
quote
global $dd, $pp, $qq, $rr
($dd)(x::Number, p1::Number, p2::Number, p3::Number, give_log::Bool) =
- ccall(dlsym(_jl_libRmath,$string(dd)), Float64, (Float64,Float64,Float64,Float64,Int32), x, p1, p2, p3, give_log)
+ ccall(dlsym(_jl_libRmath,$(string(dd))), Float64, (Float64,Float64,Float64,Float64,Int32), x, p1, p2, p3, give_log)
($dd){T<:Number}(x::AbstractArray{T}, p1::Number, p2::Number, p3::Number, give_log::Bool) =
reshape([ ($dd)(x[i], p1, p2, p3, give_log) for i=1:numel(x) ], size(x))
($dd)(x::Number, p1::Number, p2::Number, p3::Number) = ($dd)(x, p1, p2, p3, false)
@_jl_libRmath_vectorize_4arg $dd
($pp)(q::Number, p1::Number, p2::Number, p3::Number, lower_tail::Bool, log_p::Bool) =
- ccall(dlsym(_jl_libRmath,$string(pp)), Float64, (Float64,Float64,Float64,Float64,Int32,Int32), q, p1, p2, p3, lower_tail, log_p)
+ ccall(dlsym(_jl_libRmath,$(string(pp))), Float64, (Float64,Float64,Float64,Float64,Int32,Int32), q, p1, p2, p3, lower_tail, log_p)
($pp){T<:Number}(q::AbstractArray{T}, p1::Number, p2::Number, p3::Number, lower_tail::Bool, log_p::Bool) =
reshape([ ($pp)(q[i], p1, p2, p3, lower_tail, log_p) for i=1:numel(q) ], size(q))
($pp)(q::Number, p1::Number, p2::Number, p3::Number, lower_tail::Bool) = ($pp)(q, p1, p2, p3, lower_tail, false)
@@ -422,7 +422,7 @@ macro _jl_libRmath_3par_0d(base)
@_jl_libRmath_vectorize_4arg $pp
($qq)(p::Number, p1::Number, p2::Number, p3::Number, lower_tail::Bool, log_p::Bool) =
- ccall(dlsym(_jl_libRmath,$string(qq)), Float64, (Float64,Float64,Float64,Float64,Int32,Int32), p, p1, p2, p3, lower_tail, log_p)
+ ccall(dlsym(_jl_libRmath,$(string(qq))), Float64, (Float64,Float64,Float64,Float64,Int32,Int32), p, p1, p2, p3, lower_tail, log_p)
($qq){T<:Number}(p::AbstractArray{T}, p1::Number, p2::Number, p3::Number, lower_tail::Bool, log_p::Bool) =
reshape([ ($qq)(p[i], p1, p2, p3, lower_tail, log_p) for i=1:numel(p) ], size(p))
($qq)(p::Number, p1::Number, p2::Number, p3::Number, lower_tail::Bool) = ($qq)(p, p1, p2, p3, lower_tail, false)
@@ -432,7 +432,7 @@ macro _jl_libRmath_3par_0d(base)
@_jl_libRmath_vectorize_4arg $qq
($rr)(nn::Integer, p1::Number, p2::Number, p3::Number) =
- [ ccall(dlsym(_jl_libRmath,$string(rr)), Float64, (Float64,Float64,Float64), p1, p2, p3) for i=1:nn ]
+ [ ccall(dlsym(_jl_libRmath,$(string(rr))), Float64, (Float64,Float64,Float64), p1, p2, p3) for i=1:nn ]
end
end
View
40 extras/bitarray.jl
@@ -1,10 +1,10 @@
# prelimnary definitions: constants, macros
# and functions used throughout the code
const _msk64 = ~uint64(0)
-macro _mskr(l) quote _msk64 >>> (64-$esc(l)) end end
-macro _div64(l) quote $esc(l) >>> 6 end end
-macro _mod64(l) quote $esc(l) & 63 end end
-macro _msk_end(l) quote @_mskr @_mod64 $esc(l) end end
+macro _mskr(l) quote _msk64 >>> (64-$(esc(l))) end end
+macro _div64(l) quote $(esc(l)) >>> 6 end end
+macro _mod64(l) quote $(esc(l)) & 63 end end
+macro _msk_end(l) quote @_mskr @_mod64 $(esc(l)) end end
_jl_num_bit_chunks(n::Int) = @_div64 (n+63)
function _jl_check_is_valid_bit{T}(x::T)
if !(isequal(x, zero(T)) || isequal(x, one(T)))
@@ -1210,13 +1210,13 @@ end
# implemented as a macro to improve performance
macro _jl_reverse_bits(dest, src)
quote
- z = $esc(src)
+ z = $(esc(src))
z = ((z >>> 1) & 0x5555555555555555) | ((z << 1) & 0xaaaaaaaaaaaaaaaa)
z = ((z >>> 2) & 0x3333333333333333) | ((z << 2) & 0xcccccccccccccccc)
z = ((z >>> 4) & 0x0f0f0f0f0f0f0f0f) | ((z << 4) & 0xf0f0f0f0f0f0f0f0)
z = ((z >>> 8) & 0x00ff00ff00ff00ff) | ((z << 8) & 0xff00ff00ff00ff00)
z = ((z >>> 16) & 0x0000ffff0000ffff) | ((z << 16) & 0xffff0000ffff0000)
- $esc(dest) = ((z >>> 32) & 0x00000000ffffffff) | ((z << 32) & 0xffffffff00000000)
+ $(esc(dest)) = ((z >>> 32) & 0x00000000ffffffff) | ((z << 32) & 0xffffffff00000000)
end
end
@@ -1346,7 +1346,7 @@ end
let findn_cache = nothing
function findn_one(ivars)
- s = { quote I[$i][count] = $ivars[i] end for i = 1:length(ivars)}
+ s = { quote I[$i][count] = $(ivars[i]) end for i = 1:length(ivars)}
quote
Bind = B[$(ivars...)]
if Bind != z
@@ -1398,19 +1398,19 @@ function gen_bitareduce_func(n, f)
setlims = { quote
# each dim of reduction is either 1:sizeA or ivar:ivar
if contains(region,$i)
- $lo[i] = 1
- $hi[i] = size(A,$i)
+ $(lo[i]) = 1
+ $(hi[i]) = size(A,$i)
else
- $lo[i] = $hi[i] = $ivars[i]
+ $(lo[i]) = $(hi[i]) = $(ivars[i])
end
end for i=1:n }
- rranges = { :( ($lo[i]):($hi[i]) ) for i=1:n } # lo:hi for all dims
+ rranges = { :( $(lo[i]):$(hi[i]) ) for i=1:n } # lo:hi for all dims
body =
quote
_tot = v0
$(setlims...)
- $make_loop_nest(rvars, rranges,
- :(_tot = ($f)(_tot, A[$(rvars...)])))
+ $(make_loop_nest(rvars, rranges,
+ :(_tot = ($f)(_tot, A[$(rvars...)]))))
R[_ind] = _tot
_ind += 1
end
@@ -1418,7 +1418,7 @@ function gen_bitareduce_func(n, f)
local _F_
function _F_(f, A, region, R, v0)
_ind = 1
- $make_loop_nest(ivars, { :(1:size(R,$i)) for i=1:n }, body)
+ $(make_loop_nest(ivars, { :(1:size(R,$i)) for i=1:n }, body))
end
_F_
end
@@ -1526,13 +1526,13 @@ transpose(B::BitVector) = reshape(copy(B), 1, length(B))
# implemented as a macro to improve performance
macro _jl_transpose8x8(x)
quote
- y = $esc(x)
+ y = $(esc(x))
t = (y $ (y >>> 7)) & 0x00aa00aa00aa00aa;
y = y $ t $ (t << 7)
t = (y $ (y >>> 14)) & 0x0000cccc0000cccc
y = y $ t $ (t << 14)
t = (y $ (y >>> 28)) & 0x00000000f0f0f0f0
- $esc(x) = y $ t $ (t << 28)
+ $(esc(x)) = y $ t $ (t << 28)
end
end
@@ -1649,25 +1649,25 @@ function permute(B::BitArray, perm)
tmp = counts[end]
toReturn[len+1] = quote
ind = 1
- $tmp = $stridenames[len]
+ $tmp = $(stridenames[len])
end
#inner most loop
toReturn[1] = quote
P[ind] = B[+($(counts...))+offset]
ind+=1
- $counts[1]+= $stridenames[1]
+ $(counts[1]) += $(stridenames[1])
end
for i = 1:len-1
tmp = counts[i]
val = i
toReturn[(i+1)] = quote
- $tmp = $stridenames[val]
+ $tmp = $(stridenames[val])
end
tmp2 = counts[i+1]
val = i+1
toReturn[(i+1)+(len+1)] = quote
- $tmp2 += $stridenames[val]
+ $tmp2 += $(stridenames[val])
end
end
toReturn
View
10 extras/enum.jl
@@ -2,15 +2,15 @@ macro enum(T,syms...)
N = int(Int.nbits)
T = esc(T)
sh = expr(:block,
- {:(if x===$sym return print($string(sym)) end) for sym in syms})
+ {:(if x===$sym return print($(string(sym))) end) for sym in syms})
blk = quote
bitstype ($N) ($T)
- ($esc(:symbols))(_::Type{$T}) = $syms
- ($esc(:isequal))(a::($T), b::($T)) = eq_int(unbox($T,a),unbox($T,b))
- ($esc(:show))(io::IO, x::($T)) = $sh
+ $(esc(:symbols))(_::Type{$T}) = $syms
+ $(esc(:isequal))(a::($T), b::($T)) = eq_int(unbox($T,a),unbox($T,b))
+ $(esc(:show))(io::IO, x::($T)) = $sh
end
for (sym,i) in enumerate(syms)
- push(blk.args, :(const ($esc(sym)) = box($T,unbox(Int,$(i-1)))))
+ push(blk.args, :(const $(esc(sym)) = box($T,unbox(Int,$(i-1)))))
end
push(blk.args, :nothing)
blk.head = :toplevel
View
8 test/runtests.jl
@@ -16,7 +16,7 @@ end
macro assert_approx_eq(a, b)
quote
- check_approx_eq($esc(a), $esc(b), $string(a), $string(b))
+ check_approx_eq($(esc(a)), $(esc(b)), $(string(a)), $(string(b)))
end
end
@@ -24,7 +24,7 @@ macro timeit(ex,name)
quote
t = Inf
for i=1:5
- t = min(t, @elapsed $esc(ex))
+ t = min(t, @elapsed $(esc(ex)))
end
println(rpad(strcat($name,":"), 20), t)
end
@@ -34,12 +34,12 @@ macro assert_fails(expr)
quote
ok = false
try
- $esc(expr)
+ $(esc(expr))
catch
ok = true
end
if !ok
- error(strcat("assertion failed: expected ",$string(expr)," to fail"))
+ error(strcat("assertion failed: expected ",$(string(expr))," to fail"))
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.