summaryrefslogtreecommitdiffstats
path: root/transcode_data.h
Commit message (Collapse)AuthorAgeFilesLines
* * transcode_data.h (rb_transcoder_stateful_type_t): defined.akr2008-08-151-0/+8
| | | | | | | | | | | | | | | | | (rb_transcoder): add field: stateful_type. * tool/transcode-tblgen.rb: generate stateful_type field as stateless_converter. * enc/trans/iso2022.trans: follow rb_transcoder change. * enc/trans/newline.trans: ditto. * enc/trans/utf_16_32.trans: ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/encoding.h (rb_econv_output): declared.akr2008-08-141-1/+2
| | | | | | | | | | | | | | | | | | * transcode_data.h (rb_transcoder): add resetsize_func field. * enc/trans/iso2022.trans (iso2022jp_reset_sequence_size): defined. (rb_EUC_JP_to_ISO_2022_JP): provede resetsize_func. * tool/transcode-tblgen.rb: set NULL for resetsize_func. * transcode.c (rb_econv_output): new function for inserting output. (output_replacement_character): use rb_econv_output. (transcode_loop): check return value of output_replacement_character. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/encoding.h (rb_econv_result_t): moved fromakr2008-08-141-27/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | transcode_data.h. (rb_econv_elem_t): ditto. (rb_econv_t): ditto. source_encoding and destination_encoding field is added. (rb_econv_open): declared. (rb_econv_convert): ditto. (rb_econv_close): ditto. * transcode.c (rb_econv_open_by_transcoder_entries): initialize source_encoding and destination_encoding field as NULL. (rb_econv_open): make it external linkage. (rb_econv_close): ditto. (rb_econv_convert): ditto. renamed from rb_econv_conv. (make_encoding): new function. (econv_init): use make_encoding and store rb_encoding* in rb_econv_t. (econv_source_encoding): new method Encoding::Converter#source_encoding. (econv_destination_encoding): new method Encoding::Converter#destination_encoding. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode_data.h (rb_econv_result_t): change enumerationakr2008-08-141-6/+6
| | | | | | | | | constant's prefix: transcode_ to econv_. * transcode.c: follow the constant prefix change. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode_data.h (transcode_invalid_byte_sequence): renamed fromakr2008-08-141-8/+8
| | | | | | | | | | | | | | | | | | | | transcode_invalid_input. (transcode_destination_buffer_full): renamed from transcode_obuf_full. (transcode_source_buffer_empty): renamed from transcode_ibuf_empty. (rb_econv_result_t): renamed from rb_trans_result_t. (rb_econv_elem_t): renamed from rb_trans_elem_t. (rb_econv_t): renamed from rb_trans_t. * transcode.c (UNIVERSAL_NEWLINE_DECODER): renamed from UNIVERSAL_NEWLINE. (CRLF_NEWLINE_ENCODER): renamed from CRLF_NEWLINE. (CR_NEWLINE_ENCODER): renamed from CR_NEWLINE. (rb_econv_open): renamed from rb_trans_open. (rb_econv_close): renamed from rb_trans_close. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode_data.h (rb_trans_result_t): new enumeration constant:akr2008-08-141-0/+1
| | | | | | | | | | | | | | | | transcode_output_followed_by_input. * transcode.c (OUTPUT_FOLLOWED_BY_INPUT): new flag. (transcode_restartable0): suspend when output followed by input if OUTPUT_FOLLOWED_BY_INPUT is specified. (trans_sweep): check OUTPUT_FOLLOWED_BY_INPUT. (rb_trans_conv): support OUTPUT_FOLLOWED_BY_INPUT. (econv_primitive_convert): return :output_followed_by_input for transcode_output_followed_by_input. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode_data.h (rb_transcoding): add fields: writebuf_off,akr2008-08-131-1/+13
| | | | | | | | | | | | | | writebuf_len and writebuf. (TRANSCODING_WRITEBUF): new macro. * transcode.c (transcode_restartable0): output until output buffer is really full. (rb_transcoding_open_by_transcoder): initialize writebuf_len, writebuf_off and writebuf. (rb_transcoding_close): finalize writebuf. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enc/trans/newline.trans: new file.akr2008-08-131-0/+1
| | | | | | | | | | | | | | | | | | | | * transcode_data.h (rb_trans_t): add last_tc field. * transcode.c (UNIVERSAL_NEWLINE): defined. (CRLF_NEWLINE): defined. (CR_NEWLINE): defined. (rb_trans_open_by_transcoder_entries): initialize last_tc. (trans_open_i): allocate one more room for newline converter. (rb_trans_open): universal newline implemented. (more_output_buffer): take max_output argument instead ts. (output_replacement_character): take tc argument instead of ts. (transcode_loop): use last_tc field. (econv_init): add flags argument for rb_trans_open. (Init_transcode): Encoding::Converter::UNIVERSAL_NEWLINE defined. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode_data.h (rb_trans_elem_t): new field: from and to.akr2008-08-121-0/+2
| | | | | | | | * transcode.c (trans_open_i): just record from and to. (rb_trans_open): load transcodings. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode_data.h (TRANSCODE_ERROR): removed.akr2008-08-121-2/+0
| | | | | | | | | | | * tool/transcode-tblgen.rb: 8bit byte of ASCII-8BIT is a valid (but unique to ASCII-8BIT) character. * transcode.c (rb_eConversionUndefined): new error. (rb_eInvalidByteSequence): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode_data.h (rb_transcoder): add resetstate_func field forakr2008-08-111-0/+1
| | | | | | | | | | | | | | | | resetting a state of stateful encoding. * enc/trans/iso2022.trans (rb_EUC_JP_to_ISO_2022_JP): specify finish_eucjp_to_iso2022jp for resetstate_func. * tool/transcode-tblgen.rb: specify NULL for resetstate_func. * transcode.c (output_replacement_character): call resetstate_func before appending the replacement character. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode_data.h (rb_transcoder): typedef at first.akr2008-08-111-3/+5
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode_data.h (rb_trans_result_t): new type.akr2008-08-111-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | (rb_trans_elem_t): new type. (rb_trans_t): new type. * transcode.c (transcode_dispatch_cb): removed. (transcode_dispatch): removed. (rb_transcoding_result_t): moved to rb_trans_result_t in transcode_data.h. (transcode_restartable0): goto follow_info when FUNsi. (rb_transcoding_open): use get_transcoder_entry. (rb_trans_open): new function. (rb_trans_conv): ditto. (rb_trans_close): ditto. (trans_open_i): ditto. (trans_sweep): ditto. (more_output_buffer): take rb_trans_t instead of rb_transcoding as an argument. (transcode_loop): take from_encoding and to_encoding instead of tr as arguments. use rb_trans_open/rb_trans_conv/rb_trans_close. (str_transcode): don't use transcode_dispatch. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode_data.h (rb_transcoding): rename fields.akr2008-08-111-3/+3
| | | | | | | | | | readlen -> recognized_len. feedlen -> readagain_len. * transcode.c: follow the field renaming. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18481 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode_data.h (rb_transcoding): new field: flags.akr2008-08-101-0/+2
| | | | | | | | | | | | | | * transcode.c (load_transcoder): extracted from transcode_dispatch_cb. (rb_transcoding_result_t): renamed from transcode_result_t. (rb_transcoding_open): new function. (rb_transcoding_convert): ditto. (rb_transcoding_close): ditto. (transcode_loop): use rb_transcoding_open, rb_transcoding_convert and rb_transcoding_close. (str_transcode): don't need rb_transcoding. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode_data.h (rb_transcoding): add feedlen field.akr2008-08-101-2/+3
| | | | | | | | | | | | | | | * transcode.c (transcode_restartable0): renamed from transcode_restartable. save input buffer into feed buffer if next character is started the point before input buffer. for example, "\x00\xd8\x01" then "\x02" in UTF-16LE. \x02 causes invalid and next character is started from \x01. (transcode_restartable): new function to call transcode_restartable0. if feed buffer is not empty, convert it at first. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18467 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c (transcode_loop): take destination and resize functionakr2008-08-091-3/+0
| | | | | | | | | | | | | | | as parameters. (more_output_buffer): ditto. (str_transcoding_resize): argument changed from rb_transcoding* to VALUE. (str_transcode): call transcode_loop with destination string and its resize function. * transcode_data.h (rb_transcoding): move ruby_string_dest and flush_func to transcode_loop parameters. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18458 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode_data.h (rb_transcoding): new fields: next_info and next_byte.akr2008-08-091-0/+2
| | | | | | | | | * transcode.c (transcode_restartable): save/restore next_info and next_byte. sync readlen and in_p when invalid. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18454 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode_data.h (rb_transcoding): add fields for restartable akr2008-08-091-1/+14
| | | | | | | | | | | | | | | | | | | | | | transcoding. (rb_transcoder): add max_input field. from_unit_length field is renamed to input_unit_length. * tool/transcode-tblgen.rb: generate max_input field. * enc/trans/iso2022.erb.c: follow rb_transcoder change. * enc/trans/utf_16_32.erb.c: ditto. * transcode.c (PARTIAL_INPUT): new constant. (transcode_char_start): new function. (transcode_result_t): new type. (transcode_restartable): new function. (more_output_buffer): new function. (transcode_loop): use transcode_restartable. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode_data.h (rb_transcoder): from_unit_length field added.akr2008-08-081-1/+1
| | | | | | | | | | | | | | | | | | | | from_utf8 field removed. * tool/transcode-tblgen.rb: generate offsets range. follow rb_transcoder change. * transcode.c (transcode_loop): don't use from_utf8. make invalid region from_unit_length wise. * enc/trans/iso2022.erb.c: follow rb_transcoder and transcode_generate_node change. * enc/trans/utf_16_32.erb.c: follow rb_transcoder and transcode_generate_node change. explicit :invalid map removed. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode_data.h (rb_transcoding): new field "stateful".akr2008-08-071-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (rb_transcoder): preprocessor and postprocessor field removed. change arguments of func_ii, func_si, func_io and func_so. new field "finish_func". * tool/transcode-tblgen.rb: make FUNii, FUNsi and FUNio generatable. * transcode.c (transcoder_lib_table): removed. (transcoder_table): change structure. (transcoder_key): removed because the above structure change. (make_transcoder_entry): new function. (get_transcoder_entry): ditto. (rb_register_transcoder): follow the structure change. (declare_transcoder): ditto. (transcode_search_path): new function for breadth first search to find a list of converters. (transcode_search_path_i): new function. (transcode_dispatch_cb): ditto. (transcode_dispatch): use transcode_search_path. (transcode_loop): follow the argument change. (str_transcode): preprocessor and postprocessor stuff removed. * enc/trans/iso2022.erb.c: new file. ISO-2022-JP conversion re-implemented. * enc/trans/japanese.erb.c: ISO-2022-JP stuff removed. nute(23:52:53)% head -40 ChangeLog Thu Aug 7 23:43:11 2008 Tanaka Akira <akr@fsij.org> * transcode_data.h (rb_transcoding): new field "stateful". (rb_transcoder): preprocessor and postprocessor field removed. change arguments of func_ii, func_si, func_io and func_so. new field "finish_func". * tool/transcode-tblgen.rb: make FUNii, FUNsi and FUNio generatable. * transcode.c (transcoder_lib_table): removed. (transcoder_table): change structure. (transcoder_key): removed because the above structure change. (make_transcoder_entry): new function. (get_transcoder_entry): ditto. (rb_register_transcoder): follow the structure change. (declare_transcoder): ditto. (transcode_search_path): new function for breadth first search to find a list of converters. (transcode_search_path_i): new function. (transcode_dispatch_cb): ditto. (transcode_dispatch): use transcode_search_path. (transcode_loop): follow the argument change. (str_transcode): preprocessor and postprocessor stuff removed. * enc/trans/iso2022.erb.c: new file. ISO-2022-JP conversion re-implemented. * enc/trans/japanese.erb.c: ISO-2022-JP stuff removed. * enc/trans/utf_16_32.erb.c: follow argument change of FUNso. [ruby-dev:35798] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18419 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode_data.h (TRANSCODE_ERROR): common transcode failurenobu2008-08-051-0/+2
| | | | | | | | | | exception, would be changed later. * enc/trans/japanese.c (UNSUPPORTED_MODE): unsupported mode transition exception. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18363 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c (transcode_loop): constified.nobu2008-07-141-2/+2
| | | | | | | | | | | | * transcode.c (str_transcode): rb_str_set_len() sets a delimiter. * transcode_data.h (rb_transcoder): constified preprocessor and postprocessor input. * enc/trans/japanese.c: ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c (str_transcode): initialize transcoder innobu2008-01-211-1/+1
| | | | | | | | | rb_transcoding. [ruby-dev:33234] * transcode_data.h (rb_transcoding): transcoder constified. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c (transcode_loop, str_transcoding_resize): use unsignednobu2008-01-211-8/+7
| | | | | | | | | | | | | | char. [ruby-dev:33232] * transcode_data.h (rb_transcoding, rb_transcoder): removed callback parameters. * enc/trans/japanese.c: ditto. * enc/trans/utf_16_32.c: parenthesized bit-or operands. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c (transcode_dispatch): constified return value.nobu2008-01-201-8/+8
| | | | | | | | | | | | | * transcode_data.h (rb_transcoding): include pointer to rb_transcoder and auxiliary data. * transcode_data.h (rb_transcoder): all callback functions shoud have their own parameters. * enc/trans/{japanese,single_byte}.c: constified. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Sun Jan 20 15:08:08 2008 Martin Duerst <duerst@it.aoyama.ac.jp>duerst2008-01-201-1/+7
| | | | | | | | | | | | | | | * enc/trans/utf_16_32.c: new file, currently implementing UTF-16BE conversions only. * test/ruby/test_transcode.rb: Added tests for UTF-16BE; made check_both_ways() use force_encoding differently. * transcode_data.h, transcode.c: Support for more conversion functions. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * $Date$ keyword removed to avoid inclusion of locale dependentakr2008-01-061-1/+0
| | | | | | | string. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fri Dec 28 01:55:04 2007 Martin Duerst <duerst@it.aoyama.ac.jp>duerst2007-12-281-18/+22
| | | | | | | | | | | | | | | | | | | | | * transcode.c (transcode_dispatch): reverted some of the changes in r14746. * transcode.c, enc/trans/single_byte.c: Added conversions to/from US-ASCII and ASCII-8BIT (using data tables). * enc/trans/single_byte.c: Some spacing/ordering changes due to automatic data file generation. * transcode_data.h, transcode.c: Preliminary code for using micro-conversion functions. * test/ruby/test_transcode.rb: Added some tests for US-ASCII and ASCII-8BIT conversions. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y, transcode_data.h, transcode.c: change "illegal" toakr2007-12-271-1/+1
| | | | | | | | "invalid" in a context which doesn' t against a law. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * common.mk (COMMONOBJS): transcode_data_*.c moved under enc/trans.nobu2007-12-251-11/+11
| | | | | | | | | | | | | | | | | | * transcode_data.h (rb_transcoding, rb_transcoder): prefixed. * transcode.c (rb_register_transcoder, rb_declare_transcoder): split declaration and registration. [ruby-dev:32704] * transcode.c (transcode_dispatch): autoload pre-declared transcoder. * transcode.c (str_transcode): use rb_define_dummy_encoding(). * transcode.c (Init_transcode): initialize transcoder tables. * enc/trans/single_byte.c, enc/trans/japanese.c: moved from top. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transocode.c: register_functional_transcoder() added.naruse2007-12-241-0/+39
| | | | | | | | | | | | | (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.c (str_transcode, transcode_dispatch): added two-stepmatz2007-12-151-4/+4
| | | | | | | | | | | | | | * trancode.c: some minor formatting fixes * transcode_data.h, transcode_data_iso_8859.c: Shortened extremely frequently used macros to shorten file length. * test/ruby/test_transcode.rb: Fixed name of test class; added setup method to ensure all necessary encodings exist; split tests into more test methods; added tests; fixed ordering of arguments in assert_equal to have expected result first. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_tmp_new): creates hidden temporary buffer.nobu2007-12-101-7/+6
| | | | | | | | | | | | | | * transcode.c (transcoding): added a pointer to function to flush. * transcode.c (transcode_loop): do not use string internal. [ruby-dev:32512] * transcode.c (str_transcode): allow Encoding objects. * transcode_data.h (BYTE_LOOKUP): use actual struct name. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14176 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c: new file to provide encoding conversion features.matz2007-12-101-0/+40
code contributed by Martin Duerst. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e