2008-08-05 08:32:13 -04:00
|
|
|
#include "transcode_data.h"
|
|
|
|
|
|
|
|
<%
|
2008-08-31 03:37:10 -04:00
|
|
|
us_ascii_map = [["{00-7f}", :nomap]]
|
2008-08-05 08:32:13 -04:00
|
|
|
|
2008-08-31 13:35:00 -04:00
|
|
|
transcode_tblgen "US-ASCII", "UTF-8", us_ascii_map
|
|
|
|
transcode_tblgen "UTF-8", "US-ASCII", us_ascii_map
|
|
|
|
transcode_tblgen "ASCII-8BIT", "UTF-8", us_ascii_map
|
|
|
|
transcode_tblgen "UTF-8", "ASCII-8BIT", us_ascii_map
|
2008-08-05 08:32:13 -04:00
|
|
|
|
2008-10-30 01:47:01 -04:00
|
|
|
CONTROL1_TO_UCS_TBL = (0x80..0x9f).map {|c| ["%02X" % c, c] }
|
|
|
|
|
|
|
|
# Generate transcoding tables for single byte encoding from
|
|
|
|
# encoding name using table file.
|
|
|
|
#
|
|
|
|
# Conventions:
|
|
|
|
# name: encoding name as string, UPPER case, hyphens (e.g. 'ISO-8859-3')
|
|
|
|
# file name: lower case, hyphens, -tbl.rb suffix (e.g. iso-8859-3-tbl.rb)
|
|
|
|
# variable name: UPPER case, underscores, _TO_UCS_TBL suffix (e.g. ISO_8859_3_TO_UCS_TBL)
|
|
|
|
# If the name starts with "ISO-8859", the C1 control code area is added automatically.
|
|
|
|
def transcode_tblgen_singlebyte (name)
|
|
|
|
require(name.downcase + "-tbl")
|
|
|
|
control1_if_needed = (name =~ /^ISO-8859/) ? CONTROL1_TO_UCS_TBL : []
|
|
|
|
tbl_to_ucs = control1_if_needed + eval(name.gsub(/-/, '_') + "_TO_UCS_TBL")
|
2008-08-05 08:32:13 -04:00
|
|
|
code = ''
|
2010-03-15 08:25:20 -04:00
|
|
|
code << transcode_tblgen(name, "UTF-8", [["{00-7f}", :nomap], *tbl_to_ucs.reject {|a, b| a.length != 2 }], '{00-ff}')
|
2008-08-05 08:32:13 -04:00
|
|
|
code << "\n"
|
|
|
|
code << transcode_tblgen("UTF-8", name, [["{00-7f}", :nomap], *tbl_to_ucs.map {|a,b| [b,a] }])
|
|
|
|
code
|
|
|
|
end
|
2008-08-31 13:35:00 -04:00
|
|
|
|
2008-10-30 01:47:01 -04:00
|
|
|
transcode_tblgen_singlebyte "ISO-8859-1"
|
|
|
|
transcode_tblgen_singlebyte "ISO-8859-2"
|
|
|
|
transcode_tblgen_singlebyte "ISO-8859-3"
|
|
|
|
transcode_tblgen_singlebyte "ISO-8859-4"
|
|
|
|
transcode_tblgen_singlebyte "ISO-8859-5"
|
|
|
|
transcode_tblgen_singlebyte "ISO-8859-6"
|
|
|
|
transcode_tblgen_singlebyte "ISO-8859-7"
|
|
|
|
transcode_tblgen_singlebyte "ISO-8859-8"
|
|
|
|
transcode_tblgen_singlebyte "ISO-8859-9"
|
|
|
|
transcode_tblgen_singlebyte "ISO-8859-10"
|
|
|
|
transcode_tblgen_singlebyte "ISO-8859-11"
|
|
|
|
transcode_tblgen_singlebyte "ISO-8859-13"
|
|
|
|
transcode_tblgen_singlebyte "ISO-8859-14"
|
|
|
|
transcode_tblgen_singlebyte "ISO-8859-15"
|
2011-12-09 05:27:37 -05:00
|
|
|
transcode_tblgen_singlebyte "ISO-8859-16"
|
2008-10-30 01:47:01 -04:00
|
|
|
transcode_tblgen_singlebyte "WINDOWS-874"
|
|
|
|
transcode_tblgen_singlebyte "WINDOWS-1250"
|
|
|
|
transcode_tblgen_singlebyte "WINDOWS-1251"
|
|
|
|
transcode_tblgen_singlebyte "WINDOWS-1252"
|
|
|
|
transcode_tblgen_singlebyte "WINDOWS-1253"
|
|
|
|
transcode_tblgen_singlebyte "WINDOWS-1254"
|
|
|
|
transcode_tblgen_singlebyte "WINDOWS-1255"
|
|
|
|
transcode_tblgen_singlebyte "WINDOWS-1256"
|
|
|
|
transcode_tblgen_singlebyte "WINDOWS-1257"
|
* enc/trans/single_byte.trans, macgreek-tbl.rb, macroman-tbl.rb,
macromania-tbl.rb, macturkish-tbl.rb, macukraine-tbl.rb,
ibm437-tbl.rb, ibm852-tbl.rb, ibm855-tbl.rb, ibm857-tbl.rb,
ibm860-tbl.rb, ibm861-tbl.rb, ibm862-tbl.rb, ibm863-tbl.rb,
ibm865-tbl.rb, ibm866-tbl.rb, ibm869-tbl.rb, ibm775-tbl.rb:
new single-byte transcodings (from Yoshihiro Kambayashi)
* test/ruby/test_transcode.rb: added tests for the above
(from Yoshihiro Kambayashi)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-11 00:26:20 -05:00
|
|
|
transcode_tblgen_singlebyte "IBM437"
|
|
|
|
transcode_tblgen_singlebyte "IBM775"
|
2011-05-19 11:58:09 -04:00
|
|
|
transcode_tblgen_singlebyte "IBM737"
|
* enc/trans/single_byte.trans, macgreek-tbl.rb, macroman-tbl.rb,
macromania-tbl.rb, macturkish-tbl.rb, macukraine-tbl.rb,
ibm437-tbl.rb, ibm852-tbl.rb, ibm855-tbl.rb, ibm857-tbl.rb,
ibm860-tbl.rb, ibm861-tbl.rb, ibm862-tbl.rb, ibm863-tbl.rb,
ibm865-tbl.rb, ibm866-tbl.rb, ibm869-tbl.rb, ibm775-tbl.rb:
new single-byte transcodings (from Yoshihiro Kambayashi)
* test/ruby/test_transcode.rb: added tests for the above
(from Yoshihiro Kambayashi)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-11 00:26:20 -05:00
|
|
|
transcode_tblgen_singlebyte "IBM852"
|
|
|
|
transcode_tblgen_singlebyte "IBM855"
|
|
|
|
transcode_tblgen_singlebyte "IBM857"
|
|
|
|
transcode_tblgen_singlebyte "IBM860"
|
|
|
|
transcode_tblgen_singlebyte "IBM861"
|
|
|
|
transcode_tblgen_singlebyte "IBM862"
|
|
|
|
transcode_tblgen_singlebyte "IBM863"
|
|
|
|
transcode_tblgen_singlebyte "IBM865"
|
|
|
|
transcode_tblgen_singlebyte "IBM866"
|
|
|
|
transcode_tblgen_singlebyte "IBM869"
|
2008-10-31 05:07:21 -04:00
|
|
|
transcode_tblgen_singlebyte "MACCROATIAN"
|
|
|
|
transcode_tblgen_singlebyte "MACCYRILLIC"
|
* enc/trans/single_byte.trans, macgreek-tbl.rb, macroman-tbl.rb,
macromania-tbl.rb, macturkish-tbl.rb, macukraine-tbl.rb,
ibm437-tbl.rb, ibm852-tbl.rb, ibm855-tbl.rb, ibm857-tbl.rb,
ibm860-tbl.rb, ibm861-tbl.rb, ibm862-tbl.rb, ibm863-tbl.rb,
ibm865-tbl.rb, ibm866-tbl.rb, ibm869-tbl.rb, ibm775-tbl.rb:
new single-byte transcodings (from Yoshihiro Kambayashi)
* test/ruby/test_transcode.rb: added tests for the above
(from Yoshihiro Kambayashi)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-11 00:26:20 -05:00
|
|
|
transcode_tblgen_singlebyte "MACGREEK"
|
2008-10-31 05:07:21 -04:00
|
|
|
transcode_tblgen_singlebyte "MACICELAND"
|
* enc/trans/single_byte.trans, macgreek-tbl.rb, macroman-tbl.rb,
macromania-tbl.rb, macturkish-tbl.rb, macukraine-tbl.rb,
ibm437-tbl.rb, ibm852-tbl.rb, ibm855-tbl.rb, ibm857-tbl.rb,
ibm860-tbl.rb, ibm861-tbl.rb, ibm862-tbl.rb, ibm863-tbl.rb,
ibm865-tbl.rb, ibm866-tbl.rb, ibm869-tbl.rb, ibm775-tbl.rb:
new single-byte transcodings (from Yoshihiro Kambayashi)
* test/ruby/test_transcode.rb: added tests for the above
(from Yoshihiro Kambayashi)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-11 00:26:20 -05:00
|
|
|
transcode_tblgen_singlebyte "MACROMAN"
|
|
|
|
transcode_tblgen_singlebyte "MACROMANIA"
|
|
|
|
transcode_tblgen_singlebyte "MACTURKISH"
|
|
|
|
transcode_tblgen_singlebyte "MACUKRAINE"
|
2008-12-09 04:39:25 -05:00
|
|
|
transcode_tblgen_singlebyte "KOI8-U"
|
|
|
|
transcode_tblgen_singlebyte "KOI8-R"
|
|
|
|
transcode_tblgen_singlebyte "TIS-620"
|
|
|
|
transcode_tblgen_singlebyte "CP850"
|
|
|
|
transcode_tblgen_singlebyte "CP852"
|
|
|
|
transcode_tblgen_singlebyte "CP855"
|
2008-08-05 08:32:13 -04:00
|
|
|
%>
|
|
|
|
|
2008-08-31 13:35:00 -04:00
|
|
|
<%= transcode_generated_code %>
|
2008-08-05 08:32:13 -04:00
|
|
|
|
2012-05-16 01:39:06 -04:00
|
|
|
TRANS_INIT(single_byte)
|
2008-08-05 08:32:13 -04:00
|
|
|
{
|
|
|
|
<%= transcode_register_code %>
|
|
|
|
}
|
|
|
|
|