Skip to content
Permalink
Browse files
Manually add newline.c to transcoder files to scan.
MRI generates this file into the root, rather than under enc/trans
like all the others. I'm not sure why. Manually processing it
since we know where it is.
  • Loading branch information
headius committed Nov 7, 2014
1 parent 3c9bf52 commit c87c399
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
@@ -83,7 +83,12 @@ def assert
transcoder_list = []
generic_list = []

Dir["#{trans_path}/*.c"].reject{|f| f =~ /transdb/}.each do |f|
transcoder_srcs = Dir["#{trans_path}/*.c"].reject{|f| f =~ /transdb/}

# newline.c generates into ruby root, for whatever reason
transcoder_srcs << "#{repo_path}/newline.c"

transcoder_srcs.each do |f|
src = open(f).read
defs = Hash[src.scan(/#define\s+(.*?)\s+(.*)/)]
src = src.gsub(/#define\s+(.*?)\s+(.*)/, "")
@@ -212,7 +212,10 @@ final class TranscoderList {
{"UTF-16", "UTF-8", "From_UTF_16"},
{"UTF-32", "UTF-8", "From_UTF_32"},
{"UTF-8", "UTF-16", "To_UTF_16"},
{"UTF-8", "UTF-32", "To_UTF_32"}
{"UTF-8", "UTF-32", "To_UTF_32"},
{"", "universal_newline", "Universal_newline"},
{"", "crlf_newline", null /*Crlf_newline*/},
{"", "cr_newline", null /*Cr_newline*/}
};

static final GenericTranscoderEntry[] GENERIC_LIST = new GenericTranscoderEntry[] {
@@ -405,6 +408,9 @@ final class TranscoderList {
new GenericTranscoderEntry("UTF-16", "UTF-8", 276, "Utf1632", 2, 4, 4, AsciiCompatibility.DECODER, 1),
new GenericTranscoderEntry("UTF-32", "UTF-8", 300, "Utf1632", 4, 4, 4, AsciiCompatibility.DECODER, 1),
new GenericTranscoderEntry("UTF-8", "UTF-16", 416, "Utf1632", 1, 4, 4, AsciiCompatibility.ENCODER, 1),
new GenericTranscoderEntry("UTF-8", "UTF-32", 416, "Utf1632", 1, 4, 4, AsciiCompatibility.ENCODER, 1)
new GenericTranscoderEntry("UTF-8", "UTF-32", 416, "Utf1632", 1, 4, 4, AsciiCompatibility.ENCODER, 1),
new GenericTranscoderEntry("", "universal_newline", 4, "Newline", 1, 1, 2, AsciiCompatibility.CONVERTER, 2),
new GenericTranscoderEntry("", "crlf_newline", 20, "Newline", 1, 1, 2, AsciiCompatibility.CONVERTER, 0),
new GenericTranscoderEntry("", "cr_newline", 36, "Newline", 1, 1, 1, AsciiCompatibility.CONVERTER, 0)
};
}

0 comments on commit c87c399

Please sign in to comment.