Skip to content

Commit 8b885d4

Browse files
authored
Merge pull request #3 from JuliaString/spj/v7update
Further updates for v0.7
2 parents 575bbbe + 9c88179 commit 8b885d4

File tree

4 files changed

+70
-52
lines changed

4 files changed

+70
-52
lines changed

.travis.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,19 @@ os:
44
- linux
55
- osx
66
julia:
7-
- release
7+
- 0.6
88
- nightly
99
notifications:
1010
email: false
11+
git:
12+
depth: 99999999
13+
14+
## uncomment the following lines to allow failures on nightly julia
15+
## (tests will run but not make your overall status red)
16+
#matrix:
17+
# allow_failures:
18+
# - julia: nightly
19+
1120
# uncomment the following lines to override the default test script
1221
script:
1322
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi

REQUIRE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
julia 0.5
1+
julia 0.6
22
StrTables

appveyor.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
environment:
22
matrix:
3-
- JULIAVERSION: "julialang/bin/winnt/x86/0.5/julia-0.5-latest-win32.exe"
4-
- JULIAVERSION: "julialang/bin/winnt/x64/0.5/julia-0.5-latest-win64.exe"
5-
- JULIAVERSION: "julianightlies/bin/winnt/x86/julia-latest-win32.exe"
6-
- JULIAVERSION: "julianightlies/bin/winnt/x64/julia-latest-win64.exe"
3+
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe"
4+
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe"
5+
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
6+
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"
7+
8+
## uncomment the following lines to allow failures on nightly julia
9+
## (tests will run but not make your overall status red)
10+
#matrix:
11+
# allow_failures:
12+
# - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
13+
# - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"
714

815
branches:
916
only:
@@ -17,9 +24,15 @@ notifications:
1724
on_build_status_changed: false
1825

1926
install:
27+
- ps: "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12"
28+
# If there's a newer build queued for the same PR, cancel this one
29+
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
30+
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
31+
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
32+
throw "There are newer queued builds for this pull request, failing early." }
2033
# Download most recent Julia Windows binary
2134
- ps: (new-object net.webclient).DownloadFile(
22-
$("http://s3.amazonaws.com/"+$env:JULIAVERSION),
35+
$env:JULIA_URL,
2336
"C:\projects\julia-binary.exe")
2437
# Run installer silently, output to C:\projects\julia
2538
- C:\projects\julia-binary.exe /S /D=C:\projects\julia

deps/build.jl

Lines changed: 41 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# License is MIT: https://github.com/JuliaString/LaTeX_Entities/LICENSE.md
1+
# License is MIT: https://github.com/JuliaString/HTML_Entities/LICENSE.md
22
#
33
# Mapping from HTML entities to the corresponding Unicode codepoint.
44

@@ -8,7 +8,9 @@ using StrTables
88

99
VER = UInt32(1)
1010

11-
include("htmlnames.jl")
11+
const inpname = "htmlnames.jl"
12+
13+
include(inpname)
1214

1315
const disp = [false]
1416

@@ -17,62 +19,50 @@ const datapath = joinpath(Pkg.dir(), "HTML_Entities", "data")
1719

1820
const empty_str = ""
1921

20-
function sortsplit!{T}(index::Vector{UInt16}, vec::Vector{Tuple{T, UInt16}}, base)
21-
sort!(vec)
22-
len = length(vec)
23-
valvec = Vector{T}(len)
24-
indvec = Vector{UInt16}(len)
25-
for (i, val) in enumerate(vec)
26-
valvec[i], ind = val
27-
indvec[i] = ind
28-
index[ind] = UInt16(base + i)
29-
end
30-
base += len
31-
valvec, indvec, base
32-
end
33-
3422
function make_tables()
35-
symnam = Vector{String}()
36-
symval = Vector{String}()
23+
symnam = String[]
24+
symval = Vector{UInt32}[]
3725

38-
for pair in htmlonechar
39-
push!(symnam, pair[1])
40-
push!(symval, string(Char(pair[2])))
26+
for (nam, val) in htmlonechar
27+
push!(symnam, nam)
28+
push!(symval, [val])
4129
end
42-
for pair in htmlnonbmp
43-
push!(symnam, pair[1])
44-
push!(symval, string(Char(0x10000+pair[2])))
30+
for (nam, val) in htmlnonbmp
31+
push!(symnam, nam)
32+
push!(symval, [0x10000+val])
4533
end
46-
for pair in htmltwochar
47-
push!(symnam, pair[1])
48-
p = pair[2]
49-
push!(symval, string(Char(p[1]), Char(p[2])))
34+
for (nam, val) in htmltwochar
35+
push!(symnam, nam)
36+
push!(symval, UInt32[val...])
5037
end
5138

5239
# We want to build a table of all the names, sort them, then create a StrTable out of them
5340
srtnam = sortperm(symnam)
5441
srtval = symval[srtnam] # Values, sorted the same as srtnam
5542

5643
# BMP characters
57-
l16 = Vector{Tuple{UInt16, UInt16}}()
44+
l16 = Tuple{UInt16, UInt16}[]
5845
# non-BMP characters (in range 0x10000 - 0x1ffff)
59-
l32 = Vector{Tuple{UInt16, UInt16}}()
46+
l32 = Tuple{UInt16, UInt16}[]
6047
# two characters packed into UInt32, first character in high 16-bits
61-
l2c = Vector{Tuple{UInt32, UInt16}}()
48+
l2c = Tuple{UInt32, UInt16}[]
6249

6350
for i in eachindex(srtnam)
64-
chrs = convert(Vector{Char}, srtval[i])
65-
length(chrs) > 2 && error("Too long sequence of characters $chrs")
66-
if length(chrs) == 2
67-
(chrs[1] > '\uffff' || chrs[2] > '\uffff') &&
68-
error("Character $(chrs[1]) or $(chrs[2]) > 0xffff")
69-
push!(l2c, (chrs[1]%UInt32<<16 | chrs[2]%UInt32, i))
70-
elseif chrs[1] > '\U1ffff'
71-
error("Character $(chrs[1]) too large: $(UInt32(chrs[1]))")
72-
elseif chrs[1] > '\uffff'
73-
push!(l32, ((chrs[1]-0x10000)%UInt32, i))
51+
chrs = srtval[i]
52+
len = length(chrs)
53+
len > 2 && error("Too long sequence of characters $chrs")
54+
ch1 = chrs[1]
55+
if len == 2
56+
ch2 = chrs[end]
57+
(ch1 > 0x0ffff || ch2 > 0x0ffff) &&
58+
error("Character $ch1 or $ch2 > 0xffff")
59+
push!(l2c, (ch1<<16 | ch2, i))
60+
elseif ch1 > 0x1ffff
61+
error("Character $ch1 too large")
62+
elseif ch1 > 0x0ffff
63+
push!(l32, (ch1%UInt16, i))
7464
else
75-
push!(l16, (chrs[1]%UInt16, i))
65+
push!(l16, (ch1%UInt16, i))
7666
end
7767
end
7868

@@ -84,18 +74,24 @@ function make_tables()
8474
# in each table to the index into the name table (so that we can find multiple names for
8575
# each character)
8676

87-
indvec = Vector{UInt16}(length(srtnam))
77+
indvec = create_vector(UInt16, length(srtnam))
8878
vec16, ind16, base32 = sortsplit!(indvec, l16, 0)
8979
vec32, ind32, base2c = sortsplit!(indvec, l32, base32)
9080
vec2c, ind2c, basefn = sortsplit!(indvec, l2c, base2c)
9181

92-
(VER, string(now()), "loaded from htmlnames.jl",
82+
(VER, string(now()), "loaded from $inpname",
9383
base32%UInt32, base2c%UInt32, StrTable(symnam[srtnam]), indvec,
9484
vec16, ind16, vec32, ind32, vec2c, ind2c)
9585
end
9686

9787
println("Creating tables")
98-
tup = make_tables()
88+
tup = nothing
89+
try
90+
global tup
91+
tup = make_tables()
92+
catch ex
93+
println(sprint(showerror, ex, catch_backtrace()))
94+
end
9995
savfile = joinpath(datapath, fname)
10096
println("Saving tables to ", savfile)
10197
StrTables.save(savfile, tup)

0 commit comments

Comments
 (0)