[前][次][番号順一覧][スレッド一覧]

ruby-changes:41685

From: duerst <ko1@a...>
Date: Sun, 7 Feb 2016 10:39:32 +0900 (JST)
Subject: [ruby-changes:41685] duerst:r53759 (trunk):

duerst	2016-02-07 10:39:26 +0900 (Sun, 07 Feb 2016)

  New Revision: 53759

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53759

  Log:


  Modified files:
    trunk/common.mk
    trunk/enc/unicode/case-folding.rb
Index: common.mk
===================================================================
--- common.mk	(revision 53758)
+++ common.mk	(revision 53759)
@@ -1047,6 +1047,12 @@ $(srcdir)/.unicode-tables.time: $(srcdir https://github.com/ruby/ruby/blob/trunk/common.mk#L1047
 		$(srcdir)/template/unicode_norm_gen.tmpl \
 		$(UNICODE_DATA_DIR) lib/unicode_normalize
 
+$(srcdir)/enc/unicode/casefold.h: $(srcdir)/enc/unicode/case-folding.rb \
+		$(UNICODE_SRC_DATA_DIR)/CaseFolding.txt
+	$(Q) $(BASERUBY) $(srcdir)/enc/unicode/case-folding.rb \
+		--output-file=$(srcdir)/enc/unicode/casefold.h \
+		$(UNICODE_SRC_DATA_DIR)/CaseFolding.txt
+
 download-extlibs:
 	$(Q) $(BASERUBY) -C $(srcdir) -w tool/extlibs.rb --download ext
 
Index: enc/unicode/case-folding.rb
===================================================================
--- enc/unicode/case-folding.rb	(revision 53758)
+++ enc/unicode/case-folding.rb	(revision 53759)
@@ -3,6 +3,9 @@ https://github.com/ruby/ruby/blob/trunk/enc/unicode/case-folding.rb#L3
 # Usage:
 #   $ wget http://www.unicode.org/Public/UNIDATA/CaseFolding.txt
 #   $ ruby case-folding.rb CaseFolding.txt -o casefold.h
+#  or:
+#   $ wget http://www.unicode.org/Public/UNIDATA/CaseFolding.txt
+#   $ ruby case-folding.rb -m . -o casefold.h
 
 class CaseFolding
   module Util
@@ -175,16 +178,29 @@ end https://github.com/ruby/ruby/blob/trunk/enc/unicode/case-folding.rb#L178
 if $0 == __FILE__
   require 'optparse'
   dest = nil
+  mapping_directory = nil
+  mapping_data = nil
   fold_1 = false
   ARGV.options do |opt|
     opt.banner << " [INPUT]"
     opt.on("--output-file=FILE", "-o", "output to the FILE instead of STDOUT") {|output|
       dest = (output unless output == '-')
     }
+    opt.on('--mapping-data-directory', '-m', 'data directory of mapping files') { |directory|
+      mapping_directory = directory
+    }
     opt.parse!
     abort(opt.to_s) if ARGV.size > 1
   end
-  filename = ARGV[0] || 'CaseFolding.txt'
+  if mapping_directory
+    if ARGV[0]
+      warn "Either specify directory or individual file, but not both."
+      exit
+    end
+    filename = File.expand_path("CaseFolding.txt", mapping_directory)
+  end
+  filename ||= ARGV[0] || 'CaseFolding.txt'
+  
   data = CaseFolding.load(filename)
   if dest
     open(dest, "wb") do |f|

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]