From b793b0d12e37a37c32dbd616d23b70f3be5a4d8c Mon Sep 17 00:00:00 2001 From: Andrew Keller Date: Tue, 26 Jul 2016 23:47:55 -0700 Subject: [PATCH] Minor docs update; hopefully fix deepcopying of segments and styles on julia 0.4 --- docs/build/index.md | 2 +- docs/build/paths.md | 2 +- docs/src/index.md | 7 +++++-- src/paths/Paths.jl | 1 + src/paths/Segments.jl | 14 +++++++++++--- src/paths/Styles.jl | 10 +++++++++- 6 files changed, 28 insertions(+), 8 deletions(-) diff --git a/docs/build/index.md b/docs/build/index.md index 415bccc..ef91895 100644 --- a/docs/build/index.md +++ b/docs/build/index.md @@ -35,7 +35,7 @@ We use a custom version of the Clipper package, which we will need for making po * `Pkg.checkout("Clipper", "pointinpoly")` -You will need to build the package to compile shared library / DLL files. This should just work on Mac OS X, and should also work on Windows provided you install Visual Studio and ensure that `vcvarsall.bat` and `cl.exe` are in your account's PATH variable. +You will need to build the package to compile shared library / DLL files. This should just work on Mac OS X, and should also work on Windows provided you install [Visual Studio](https://www.visualstudio.com/en-us/visual-studio-homepage-vs.aspx) and ensure that `vcvarsall.bat` and `cl.exe` are in your account's PATH variable. Probably these are located in: `C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC` and `C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin`, respectively. * `Pkg.build("Clipper")` diff --git a/docs/build/paths.md b/docs/build/paths.md index 4744a3f..b43d19a 100644 --- a/docs/build/paths.md +++ b/docs/build/paths.md @@ -148,7 +148,7 @@ type CompoundSegment{T<:Real} <: Segment{T} end ``` -Consider an array of segments as one contiguous segment. Useful e.g. for applying styles, uninterrupted over segment changes. The array of segments given to the constructor is deep-copied and retained by the compound segment. +Consider an array of segments as one contiguous segment. Useful e.g. for applying styles, uninterrupted over segment changes. The array of segments given to the constructor is copied and retained by the compound segment. diff --git a/docs/src/index.md b/docs/src/index.md index 4f543c8..ed1c743 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -26,8 +26,11 @@ compatible with GDS files. You will need to build the package to compile shared library / DLL files. This should just work on Mac OS X, and should also work on Windows provided you -install Visual Studio and ensure that `vcvarsall.bat` and `cl.exe` are in your -account's PATH variable. +install [Visual Studio](https://www.visualstudio.com/en-us/visual-studio-homepage-vs.aspx) +and ensure that `vcvarsall.bat` and `cl.exe` are in your +account's PATH variable. Probably these are located in: +`C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC` and +`C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin`, respectively. + `Pkg.build("Clipper")` diff --git a/src/paths/Paths.jl b/src/paths/Paths.jl index d8b3915..7dbbb30 100644 --- a/src/paths/Paths.jl +++ b/src/paths/Paths.jl @@ -6,6 +6,7 @@ using ..Cells import Base: convert, copy, + deepcopy_internal, start, done, next, diff --git a/src/paths/Segments.jl b/src/paths/Segments.jl index a342df1..51f762d 100644 --- a/src/paths/Segments.jl +++ b/src/paths/Segments.jl @@ -55,8 +55,16 @@ function length(s::Segment, verbose::Bool=false) val end -show(io::IO, s::Segment) = - print(io, summary(s)) +show(io::IO, s::Segment) = print(io, summary(s)) + +function deepcopy_internal(x::Segment, stackdict::ObjectIdDict) + if haskey(stackdict, x) + return stackdict[x] + end + y = copy(x) + stackdict[x] = y + return y +end """ ``` @@ -215,7 +223,7 @@ end Consider an array of segments as one contiguous segment. Useful e.g. for applying styles, uninterrupted over segment changes. -The array of segments given to the constructor is deep-copied and retained +The array of segments given to the constructor is copied and retained by the compound segment. """ type CompoundSegment{T<:Real} <: Segment{T} diff --git a/src/paths/Styles.jl b/src/paths/Styles.jl index 1e9e61e..d90dee4 100644 --- a/src/paths/Styles.jl +++ b/src/paths/Styles.jl @@ -1,3 +1,11 @@ +function deepcopy_internal(x::Style, stackdict::ObjectIdDict) + if haskey(stackdict, x) + return stackdict[x] + end + y = copy(x) + stackdict[x] = y + return y +end """ ``` type Trace <: Style @@ -131,7 +139,7 @@ Returns the function needed for a `CompoundStyle`. The segments array is shallow-copied for use in the function. """ function param{T<:Real}(seg::AbstractArray{Segment{T},1}) - segments = copy(Array(seg)) + segments = deepcopy(Array(seg)) isempty(segments) && error("Cannot parameterize with zero segments.") # Build up our piecewise parametric function