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

ruby-changes:41856

From: duerst <ko1@a...>
Date: Thu, 25 Feb 2016 19:04:17 +0900 (JST)
Subject: [ruby-changes:41856] duerst:r53930 (trunk): * enc/unicode/case-folding.rb: Adding possibility for debugging output

duerst	2016-02-25 19:04:59 +0900 (Thu, 25 Feb 2016)

  New Revision: 53930

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

  Log:
    * enc/unicode/case-folding.rb: Adding possibility for debugging output
      for TitleCase table in casefold.h.
      (with Kimihito Matsui)

  Modified files:
    trunk/ChangeLog
    trunk/enc/unicode/case-folding.rb
Index: enc/unicode/case-folding.rb
===================================================================
--- enc/unicode/case-folding.rb	(revision 53929)
+++ enc/unicode/case-folding.rb	(revision 53930)
@@ -245,11 +245,16 @@ class CaseMapping https://github.com/ruby/ruby/blob/trunk/enc/unicode/case-folding.rb#L245
     flags
   end
 
+  def debug!
+    @debug = true
+  end
+
   def titlecase_output
     "CodePointList3 TitleCase[] = {\n" +
     @titlecase.map do |item|
       chars = item.title.split(/ /)
-      "    {#{chars.length}, {" + chars.map {|c| "0x"+c }.join(', ') + "}},\n"
+      ct = ' /* ' + Array(chars).map{|c|[c.to_i(16)].pack("U*")}.join(", ") + ' */' if @debug
+      "    {#{chars.length}, {#{chars.map {|c| "0x"+c }.join(', ')}#{ct}}},\n"
     end.join + "};\n"
   end
 
@@ -264,6 +269,7 @@ class CaseMappingDummy https://github.com/ruby/ruby/blob/trunk/enc/unicode/case-folding.rb#L269
   end
 
   def titlecase_output()  ''  end
+  def debug!()  end
 end
 
 if $0 == __FILE__
@@ -299,7 +305,10 @@ if $0 == __FILE__ https://github.com/ruby/ruby/blob/trunk/enc/unicode/case-folding.rb#L305
   mapping_data ||= CaseMappingDummy.new
 
   data = CaseFolding.load(filename)
-  data.debug! if debug
+  if debug
+    data.debug!
+    mapping_data.debug!
+  end
   if dest
     open(dest, "wb") do |f|
       data.display(f, mapping_data)
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 53929)
+++ ChangeLog	(revision 53930)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Feb 25 19:04:13 2016  Martin Duerst  <duerst@i...>
+
+	* enc/unicode/case-folding.rb: Adding possibility for debugging output
+	  for TitleCase table in casefold.h.
+	  (with Kimihito Matsui)
+
 Wed Feb 24 22:31:13 2016  Martin Duerst  <duerst@i...>
 
 	* include/ruby/oniguruma.h: Rearranging flag assignments and making

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

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