From 5ad8c5566d77be1d7ad37be2a9a2ce43671c5577 Mon Sep 17 00:00:00 2001 From: duerst Date: Sat, 22 Dec 2007 06:45:55 +0000 Subject: Sat Dec 22 15:45:45 2007 Martin Duerst * 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 --- transcode.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'transcode.c') 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); } -- cgit v1.2.3