зеркало из https://github.com/github/ruby.git
* tool/transcode-tblgen.rb: added set_valid_byte_pattern
to reduce coupling between table generation script and specific encodings. * enc/trans/single_byte.trans: using set_valid_byte_pattern git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
da1ffe490d
Коммит
7adbfbb793
|
@ -1,3 +1,11 @@
|
||||||
|
Tue Oct 14 17:10:10 2008 Martin Duerst <duerst@it.aoyama.ac.jp>
|
||||||
|
|
||||||
|
* tool/transcode-tblgen.rb: added set_valid_byte_pattern
|
||||||
|
to reduce coupling between table generation script and
|
||||||
|
specific encodings.
|
||||||
|
|
||||||
|
* enc/trans/single_byte.trans: using set_valid_byte_pattern
|
||||||
|
|
||||||
Tue Oct 14 16:39:39 2008 Martin Duerst <duerst@it.aoyama.ac.jp>
|
Tue Oct 14 16:39:39 2008 Martin Duerst <duerst@it.aoyama.ac.jp>
|
||||||
|
|
||||||
* transcode.c: in transcode_search_path, elimintated a warning
|
* transcode.c: in transcode_search_path, elimintated a warning
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
transcode_tblgen "UTF-8", "ASCII-8BIT", us_ascii_map
|
transcode_tblgen "UTF-8", "ASCII-8BIT", us_ascii_map
|
||||||
|
|
||||||
def transcode_tblgen_singlebyte(name, tbl_to_ucs)
|
def transcode_tblgen_singlebyte(name, tbl_to_ucs)
|
||||||
|
set_valid_byte_pattern(name, '1byte')
|
||||||
code = ''
|
code = ''
|
||||||
code << transcode_tblgen(name, "UTF-8", [["{00-7f}", :nomap], *tbl_to_ucs])
|
code << transcode_tblgen(name, "UTF-8", [["{00-7f}", :nomap], *tbl_to_ucs])
|
||||||
code << "\n"
|
code << "\n"
|
||||||
|
|
|
@ -726,28 +726,23 @@ ValidEncoding = {
|
||||||
{81-fe}{30-39}{81-fe}{30-39}',
|
{81-fe}{30-39}{81-fe}{30-39}',
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
def set_valid_byte_pattern (encoding, pattern_or_label)
|
||||||
'ASCII-8BIT' => '1byte',
|
pattern =
|
||||||
'ISO-8859-1' => '1byte',
|
if ValidEncoding[pattern_or_label]
|
||||||
'ISO-8859-2' => '1byte',
|
ValidEncoding[pattern_or_label]
|
||||||
'ISO-8859-3' => '1byte',
|
else
|
||||||
'ISO-8859-4' => '1byte',
|
pattern_or_label
|
||||||
'ISO-8859-5' => '1byte',
|
end
|
||||||
'ISO-8859-6' => '1byte',
|
if ValidEncoding[encoding] and ValidEncoding[encoding]!=pattern
|
||||||
'ISO-8859-7' => '1byte',
|
raise ArgumentError, "trying to change valid byte pattern for encoding #{encoding} from #{ValidEncoding[encoding]} to #{pattern}"
|
||||||
'ISO-8859-8' => '1byte',
|
end
|
||||||
'ISO-8859-9' => '1byte',
|
ValidEncoding[encoding] = pattern
|
||||||
'ISO-8859-10' => '1byte',
|
end
|
||||||
'ISO-8859-11' => '1byte',
|
|
||||||
'ISO-8859-13' => '1byte',
|
# the following may be used in different places, so keep them here for the moment
|
||||||
'ISO-8859-14' => '1byte',
|
set_valid_byte_pattern 'ASCII-8BIT', '1byte'
|
||||||
'ISO-8859-15' => '1byte',
|
set_valid_byte_pattern 'Windows-31J', 'Shift_JIS'
|
||||||
'WINDOWS-1252' => '1byte',
|
set_valid_byte_pattern 'eucJP-ms', 'EUC-JP'
|
||||||
'Windows-31J' => 'Shift_JIS',
|
|
||||||
'eucJP-ms' => 'EUC-JP'
|
|
||||||
}.each {|k, v|
|
|
||||||
ValidEncoding[k] = ValidEncoding.fetch(v)
|
|
||||||
}
|
|
||||||
|
|
||||||
def make_signature(filename, src)
|
def make_signature(filename, src)
|
||||||
"src=#{filename.dump}, len=#{src.length}, checksum=#{src.sum}"
|
"src=#{filename.dump}, len=#{src.length}, checksum=#{src.sum}"
|
||||||
|
|
Загрузка…
Ссылка в новой задаче