Skip to content

Commit

Permalink
Merge pull request #138 from YingboMa/master
Browse files Browse the repository at this point in the history
Compatibility with Julia 1.0
  • Loading branch information
isuruf authored Aug 11, 2018
2 parents cddd993 + c6ff8f4 commit 29c86a3
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 65 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ sudo: false
julia:
- 0.6
- 0.7
- 1.0
- nightly
os:
- linux
Expand Down
1 change: 1 addition & 0 deletions REQUIRE
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ julia 0.6
Compat 0.63.0
RecipesBase 0.0.6
BinaryProvider 0.3.0
SpecialFunctions
44 changes: 17 additions & 27 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
environment:
matrix:
- 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://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"
- julia_version: 0.6
- julia_version: 0.7
- julia_version: 1
- julia_version: nightly

platform:
- x86 # 32-bit
- x64 # 64-bit

matrix:
allow_failures:
- 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"
- julia_version: nightly

notifications:
- provider: Email
Expand All @@ -18,26 +20,14 @@ notifications:
on_build_status_changed: false

install:
- ps: "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12"
# if there's a newer build queued for the same PR, cancel this one
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
throw "There are newer queued builds for this pull request, failing early." }
# Download most recent Julia Windows binary
- ps: (new-object net.webclient).DownloadFile(
$env:JULIA_URL,
"C:\projects\julia-binary.exe")
# Run installer silently, output to C:\projects\julia
- C:\projects\julia-binary.exe /S /D=C:\projects\julia
- set "APPVEYOR_PROJECT_NAME=SymEngine"
- ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1"))

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();
Pkg.clone(pwd(), \"SymEngine\"); Pkg.build(\"SymEngine\")"
- echo "%JL_BUILD_SCRIPT%"
- C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%"

test_script:
- C:\projects\julia\bin\julia -e "Pkg.test(\"SymEngine\")"
#on_finish:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- echo "%JL_TEST_SCRIPT%"
- C:\julia\bin\julia -e "%JL_TEST_SCRIPT%"

3 changes: 3 additions & 0 deletions src/SymEngine.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ export free_symbols, get_args
export ascii_art
export subs, lambdify, N, cse
export series
if VERSION >= v"1.0.0-rc1"
export expand
end

const deps_file = joinpath(dirname(@__FILE__), "..", "deps", "deps.jl")
const deps_in_file = joinpath(dirname(@__FILE__), "..", "deps", "deps.jl.in")
Expand Down
16 changes: 13 additions & 3 deletions src/ctypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,19 @@ function Base.convert(::Type{Vector}, x::CVecBasic)
[x[i-1] for i in 1:n]
end

Base.start(s::CVecBasic) = 0
Base.done(s::CVecBasic, i) = (i == Base.length(s))
Base.next(s::CVecBasic, i) = s[i], i+1
start(s::CVecBasic) = 0
done(s::CVecBasic, i) = (i == Base.length(s))
next(s::CVecBasic, i) = s[i], i+1
if VERSION < v"0.7.0-rc1"
Base.start(s::CVecBasic) = start(s)
Base.done(s::CVecBasic, i) = done(s, i)
Base.next(s::CVecBasic, i) = next(s, i)
else
function Base.iterate(s::CVecBasic, i=start(s))
done(s, i) && return nothing
next(s, i)
end
end

## CMapBasicBasic
mutable struct CMapBasicBasic
Expand Down
70 changes: 36 additions & 34 deletions src/mathfuns.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using SpecialFunctions

function IMPLEMENT_ONE_ARG_FUNC(meth, symnm; lib=:basic_)
@eval begin
function ($meth)(b::SymbolicType)
Expand All @@ -21,39 +23,41 @@ end

## import from base one argument functions
## these are from cwrapper.cpp, one arg func
for (meth, libnm) in [
(:abs,:abs),
(:sin,:sin),
(:cos,:cos),
(:tan,:tan),
(:csc,:csc),
(:sec,:sec),
(:cot,:cot),
(:asin,:asin),
(:acos,:acos),
(:asec,:asec),
(:acsc,:acsc),
(:atan,:atan),
(:acot,:acot),
(:sinh,:sinh),
(:cosh,:cosh),
(:tanh,:tanh),
(:csch,:csch),
(:sech,:sech),
(:coth,:coth),
(:asinh,:asinh),
(:acosh,:acosh),
(:asech,:asech),
(:acsch,:acsch),
(:atanh,:atanh),
(:acoth,:acoth),
(:gamma,:gamma),
(:log,:log),
(:sqrt,:sqrt),
(:exp,:exp),
for (meth, libnm, modu) in [
(:abs,:abs,:Base),
(:sin,:sin,:Base),
(:cos,:cos,:Base),
(:tan,:tan,:Base),
(:csc,:csc,:Base),
(:sec,:sec,:Base),
(:cot,:cot,:Base),
(:asin,:asin,:Base),
(:acos,:acos,:Base),
(:asec,:asec,:Base),
(:acsc,:acsc,:Base),
(:atan,:atan,:Base),
(:acot,:acot,:Base),
(:sinh,:sinh,:Base),
(:cosh,:cosh,:Base),
(:tanh,:tanh,:Base),
(:csch,:csch,:Base),
(:sech,:sech,:Base),
(:coth,:coth,:Base),
(:asinh,:asinh,:Base),
(:acosh,:acosh,:Base),
(:asech,:asech,:Base),
(:acsch,:acsch,:Base),
(:atanh,:atanh,:Base),
(:acoth,:acoth,:Base),
(:gamma,:gamma,:SpecialFunctions),
(:log,:log,:Base),
(:sqrt,:sqrt,:Base),
(:exp,:exp,:Base),
(:eta,:dirichlet_eta,:SpecialFunctions),
(:zeta,:zeta,:SpecialFunctions),
]
eval(Expr(:import, :Base, meth))
IMPLEMENT_ONE_ARG_FUNC(:(Base.$meth), libnm)
eval(Expr(:import, modu, meth))
IMPLEMENT_ONE_ARG_FUNC(:($modu.$meth), libnm)
end
Base.abs2(x::SymEngine.Basic) = abs(x)^2

Expand All @@ -65,8 +69,6 @@ end
# export not import
for (meth, libnm) in [
(:lambertw,:lambertw), # in add-on packages, not base
(:eta,:dirichlet_eta),
(:zeta,:zeta),
]
IMPLEMENT_ONE_ARG_FUNC(meth, libnm)
eval(Expr(:export, meth))
Expand Down
4 changes: 3 additions & 1 deletion src/simplify.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import Base: expand
if VERSION < v"1.0.0-rc1"
import Base.expand
end
IMPLEMENT_ONE_ARG_FUNC(:expand, :expand)

if get_symbol(:basic_cse) != C_NULL
Expand Down

0 comments on commit 29c86a3

Please sign in to comment.