unf_ext 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/README.md +1 -1
- data/Rakefile +12 -1
- data/VERSION +1 -1
- data/ext/unf_ext/extconf.rb +25 -0
- data/{unf → ext/unf_ext/unf}/normalizer.hh +6 -6
- data/ext/unf_ext/unf/table.hh +13542 -0
- data/{unf → ext/unf_ext/unf}/trie/char_stream.hh +0 -0
- data/{unf → ext/unf_ext/unf}/trie/node.hh +0 -8
- data/{unf → ext/unf_ext/unf}/trie/searcher.hh +29 -21
- data/{unf → ext/unf_ext/unf}/util.hh +0 -0
- data/{unf.cc → ext/unf_ext/unf.cc} +2 -2
- data/lib/unf_ext.rb +5 -0
- data/unf_ext.gemspec +15 -11
- metadata +30 -13
- data/extconf.rb +0 -4
- data/unf/table.hh +0 -19004
data/Gemfile
CHANGED
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -22,10 +22,21 @@ Jeweler::Tasks.new do |gem|
|
|
22
22
|
gem.email = "knu@idaemons.org"
|
23
23
|
gem.authors = ["Takeru Ohta", "Akinori MUSHA"]
|
24
24
|
# dependencies defined in Gemfile
|
25
|
-
gem.extensions << "extconf.rb"
|
26
25
|
end
|
27
26
|
Jeweler::RubygemsDotOrgTasks.new
|
28
27
|
|
28
|
+
def generated_gemspec
|
29
|
+
eval(File.read(Rake.application.jeweler.gemspec_helper.path))
|
30
|
+
rescue
|
31
|
+
nil
|
32
|
+
end
|
33
|
+
|
34
|
+
require 'rake/extensiontask'
|
35
|
+
Rake::ExtensionTask.new('unf_ext', generated_gemspec) do |ext|
|
36
|
+
ext.cross_compile = true
|
37
|
+
ext.cross_platform = 'x86-mingw32'
|
38
|
+
end
|
39
|
+
|
29
40
|
require 'rake/testtask'
|
30
41
|
Rake::TestTask.new(:test) do |test|
|
31
42
|
test.libs << 'lib' << 'test'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'mkmf'
|
2
|
+
have_library('stdc++')
|
3
|
+
have_header('ruby/encoding.h')
|
4
|
+
create_makefile 'unf_ext'
|
5
|
+
|
6
|
+
unless CONFIG['CXX']
|
7
|
+
case CONFIG['CC']
|
8
|
+
when %r{((?:.*[-/])?)gcc([-0-9.]*)$}
|
9
|
+
cxx = $1 + 'g++' + $2
|
10
|
+
when %r{((?:.*[-/])?)clang([-0-9.]*)$}
|
11
|
+
cxx = $1 + 'clang++' + $2
|
12
|
+
else
|
13
|
+
cxx = CONFIG['CC']
|
14
|
+
end
|
15
|
+
|
16
|
+
warn "CXX is automatically set to #{cxx}"
|
17
|
+
|
18
|
+
new_mf = <<-EOF << File.read('Makefile')
|
19
|
+
CXX=#{cxx}
|
20
|
+
EOF
|
21
|
+
|
22
|
+
File.open('Makefile', 'w') { |mf|
|
23
|
+
mf.print new_mf
|
24
|
+
}
|
25
|
+
end
|
@@ -17,12 +17,12 @@ namespace UNF {
|
|
17
17
|
|
18
18
|
public:
|
19
19
|
Normalizer()
|
20
|
-
: nf_d(TABLE::
|
21
|
-
nf_kd(TABLE::
|
22
|
-
nf_c(TABLE::
|
23
|
-
nf_c_qc(TABLE::
|
24
|
-
nf_kc_qc(TABLE::
|
25
|
-
ccc(TABLE::
|
20
|
+
: nf_d(TABLE::NODES, TABLE::CANONICAL_DECOM_ROOT, TABLE::STRINGS),
|
21
|
+
nf_kd(TABLE::NODES, TABLE::COMPATIBILITY_DECOM_ROOT, TABLE::STRINGS),
|
22
|
+
nf_c(TABLE::NODES, TABLE::CANONICAL_COM_ROOT, TABLE::STRINGS),
|
23
|
+
nf_c_qc(TABLE::NODES, TABLE::NFC_ILLEGAL_ROOT),
|
24
|
+
nf_kc_qc(TABLE::NODES, TABLE::NFKC_ILLEGAL_ROOT),
|
25
|
+
ccc(TABLE::NODES, TABLE::CANONICAL_CLASS_ROOT)
|
26
26
|
{}
|
27
27
|
|
28
28
|
const char* normalize(const char* src, Form form) {
|