From 53691676aeaac8cf1a765242e92b2a9e36d48928 Mon Sep 17 00:00:00 2001 From: naruse Date: Mon, 24 Dec 2007 13:51:19 +0000 Subject: * 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: http://svn.ruby-lang.org/repos/ruby/trunk@14607 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- transcode_data.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'transcode_data.h') diff --git a/transcode_data.h b/transcode_data.h index dc90c92a5..3131877a4 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 */ -- cgit