summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-16 05:32:42 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-16 05:32:42 +0000
commit7a0bea4fd327ec0f572f25a24adc7f0b2f9821e8 (patch)
tree63b4f0774952fcf345a764249c853c3415c1c793 /include
parent5f9c188d978d45cdeb81ec83dfdaddffe1b8996c (diff)
* include/ruby/encoding.h (rb_econv_t): add fields: in_buf_start,
in_data_start, in_data_end, in_buf_end and last_trans_index. (rb_econv_output): removed. (rb_econv_insert_output): declared. (rb_econv_encoding_to_insert_output): declared. * enc/trans/newline.trans (rb_universal_newline): stateful_type changed. * transcode.c (transcode_restartable0): initialize inchar_start, tc->recognized_len and next_table at beginning of the loop. (rb_econv_open_by_transcoder_entries): initialize new fields. (rb_econv_open): setup last_trans_index. (trans_sweep): last out_buf_start can be non-NULL now. (rb_econv_convert): check last out_buf_start and in_buf_start at first. (rb_econv_output_with_destination_encoding): removed. (econv_just_convert): removed. (rb_econv_output): removed. (econv_primitive_output): method removed. (rb_econv_encoding_to_insert_output): new function. (allocate_converted_string): new function. (rb_econv_insert_output): new function. (econv_primitive_insert_output): new method. (output_replacement_character): use rb_econv_insert_output. unused arguments removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include')
-rw-r--r--include/ruby/encoding.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/include/ruby/encoding.h b/include/ruby/encoding.h
index 008d5f953f..2d43ca354a 100644
--- a/include/ruby/encoding.h
+++ b/include/ruby/encoding.h
@@ -219,9 +219,14 @@ typedef struct {
} rb_econv_elem_t;
typedef struct {
+ unsigned char *in_buf_start;
+ unsigned char *in_data_start;
+ unsigned char *in_data_end;
+ unsigned char *in_buf_end;
rb_econv_elem_t *elems;
int num_trans;
int num_finished;
+ int last_trans_index; /* last trans, not including universal newline */
struct rb_transcoding *last_tc;
/* last error */
@@ -248,11 +253,13 @@ rb_econv_result_t rb_econv_convert(rb_econv_t *ec,
unsigned char **destination_buffer_ptr, unsigned char *destination_buffer_end,
int flags);
-/* result: 0:success -1:failure -2:conversion-failure-to-destination-encoding */
-int rb_econv_output(rb_econv_t *ec,
- const unsigned char *str, size_t len, const char *str_encoding,
- unsigned char **destination_buffer_ptr, unsigned char *destination_buffer_end,
- size_t *required_size);
+
+/* result: 0:success -1:failure */
+int rb_econv_insert_output(rb_econv_t *ec,
+ const unsigned char *str, size_t len, const char *str_encoding);
+
+/* encoding that rb_econv_insert_output doesn't need conversion */
+const char *rb_econv_encoding_to_insert_output(rb_econv_t *ec);
void rb_econv_close(rb_econv_t *ec);