summaryrefslogtreecommitdiff
path: root/transcode.c
diff options
context:
space:
mode:
authorduerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-22 06:45:55 +0000
committerduerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-22 06:45:55 +0000
commit5ad8c5566d77be1d7ad37be2a9a2ce43671c5577 (patch)
treeb8db557fde405b7b47d4ca46b2e5f5ea78ff0ce1 /transcode.c
parentc9bf41968448b09f7b33f3cf1c21090d23cdde50 (diff)
Sat Dec 22 15:45:45 2007 Martin Duerst <duerst@it.aoyama.ac.jp>
* transcode_data_one_byte: slightly optimized * transcode_data_japanese: new data file for EUC-JP and SHIFT_JIS (not yet optimized; tests to follow; data from http://nkf.sourceforge.jp/ucm/{SJIS|eucJP}-nkf.ucm) * common.mk, transcode.c: Adjusted for transcode_data_japanese git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'transcode.c')
-rw-r--r--transcode.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/transcode.c b/transcode.c
index 002024e104..a4cf6b3492 100644
--- a/transcode.c
+++ b/transcode.c
@@ -54,6 +54,12 @@ extern const BYTE_LOOKUP to_ISO_8859_13;
extern const BYTE_LOOKUP to_ISO_8859_14;
extern const BYTE_LOOKUP to_ISO_8859_15;
+extern const BYTE_LOOKUP from_SHIFT_JIS;
+extern const BYTE_LOOKUP from_EUC_JP;
+
+extern const BYTE_LOOKUP to_SHIFT_JIS;
+extern const BYTE_LOOKUP to_EUC_JP;
+
/* declarations probably need to go into separate header file, e.g. transcode.h */
@@ -69,7 +75,7 @@ typedef struct {
/* todo: dynamic structure, one per conversion (stream) */
/* in the future, add some mechanism for dynamically adding stuff here */
-#define MAX_TRANSCODERS 29 /* todo: fix: this number has to be adjusted by hand */
+#define MAX_TRANSCODERS 33 /* todo: fix: this number has to be adjusted by hand */
static transcoder transcoder_table[MAX_TRANSCODERS];
/* not sure why it's not possible to do relocatable initializations */
@@ -124,6 +130,12 @@ init_transcoder_table(void)
register_transcoder("UTF-8", "ISO-8859-13", &to_ISO_8859_13, 1, 1);
register_transcoder("UTF-8", "ISO-8859-14", &to_ISO_8859_14, 1, 1);
register_transcoder("UTF-8", "ISO-8859-15", &to_ISO_8859_15, 1, 1);
+
+ register_transcoder("SHIFT_JIS", "UTF-8", &from_SHIFT_JIS, 3, 0);
+ register_transcoder("EUC-JP", "UTF-8", &from_EUC_JP, 3, 0);
+ register_transcoder("UTF-8", "SHIFT_JIS", &to_SHIFT_JIS, 2, 1);
+ register_transcoder("UTF-8", "EUC-JP", &to_EUC_JP, 2, 1);
+
register_transcoder(NULL, NULL, NULL, 0, 0);
}