diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-24 13:51:19 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-24 13:51:19 +0000 |
commit | be86e3de339e31d532bd40233458c4ca30e0a418 (patch) | |
tree | 074b37d990f87c4f8ee116acf24c6a259abd2d86 /transcode_data.h | |
parent | f23bc6b2b5228f39a55d798079fe0db514695ba6 (diff) |
* transocode.c: register_functional_transcoder() added.
(init_transcoder_table(: register ISO-2022-JP.
(str_transcode): add preprocessor and postprocessor.
* transcode_data_japanese.c: add ISO-2022-JP support.
* transcode_data.h: moved transcoder and transcoding difinition from
transcode.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14607 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'transcode_data.h')
-rw-r--r-- | transcode_data.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/transcode_data.h b/transcode_data.h index dc90c92a51..3131877a41 100644 --- a/transcode_data.h +++ b/transcode_data.h @@ -1,3 +1,20 @@ +/********************************************************************** + + transcode_data.h - + + $Author$ + $Date$ + created at: Mon 10 Dec 2007 14:01:47 JST 2007 + + Copyright (C) 2007 Martin Duerst + +**********************************************************************/ + +#include "ruby/ruby.h" + +#ifndef RUBY_TRANSCODE_DATA_H +#define RUBY_TRANSCODE_DATA_H 1 + typedef unsigned char base_element; typedef struct byte_lookup { @@ -37,3 +54,25 @@ typedef struct byte_lookup { #define TWOTRAIL /* legal but undefined if two more trailing UTF-8 */ #define THREETRAIL /* legal but undefined if three more trailing UTF-8 */ +/* dynamic structure, one per conversion (similar to iconv_t) */ +/* may carry conversion state (e.g. for iso-2022-jp) */ +typedef struct transcoding { + VALUE ruby_string_dest; /* the String used as the conversion destination, + or NULL if something else is being converted */ + char *(*flush_func)(struct transcoding*, int, int); +} transcoding; + +/* static structure, one per supported encoding pair */ +typedef struct transcoder_st{ + const char *from_encoding; + const char *to_encoding; + const BYTE_LOOKUP *conv_tree_start; + int max_output; + int from_utf8; + void (*preprocessor)(char**, char**, char*, char*, + struct transcoder_st *transcoder, struct transcoding*); + void (*postprocessor)(char**, char**, char*, char*, + struct transcoder_st *transcoder, struct transcoding*); +} transcoder; + +#endif /* RUBY_TRANSCODE_DATA_H */ |