Skip to content

Commit

Permalink
Showing 2 changed files with 14 additions and 3 deletions.
7 changes: 6 additions & 1 deletion scripts/ExtractTranscoders.rb
Original file line number Diff line number Diff line change
@@ -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+(.*)/, "")
10 changes: 8 additions & 2 deletions src/org/jcodings/transcode/TranscoderList.java
Original file line number Diff line number Diff line change
@@ -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.