summaryrefslogtreecommitdiffstats
path: root/transcode.c
Commit message (Collapse)AuthorAgeFilesLines
* * transcode.c (rb_econv_add_coverter): remove unnecessary NULL check.mame2008-10-091-2/+0
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/encoding.h (rb_str_encode): renamed fromakr2008-09-261-3/+3
| | | | | | | | | | | | | rb_str_transcode. [ruby-dev:36593] (rb_econv_has_convpath_p): renamed from rb_transcode_convertible. * transcode.c: follow the renaming. * io.c: ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19589 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * error.c (Init_Exception): introduce EncodingError which is amatz2008-09-261-3/+3
| | | | | | | | | superclass for all encoding related exception classes, e.g. Encoding::CompatibilityError. [ruby-dev:36371] * transcode.c (Init_transcode): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c, include/ruby/encoding.c (rb_transcode_convertible):usa2008-09-261-0/+14
| | | | | | | | new function. checking the existance of converter. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* update rdoc.akr2008-09-251-12/+12
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c (rb_eUndefinedConversionError): renamed fromakr2008-09-251-18/+18
| | | | | | | | | rb_eConversionUndefinedError. (rb_eConverterNotFoundError): renamed from rb_eNoConverterError. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* update rdoc.akr2008-09-251-10/+54
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* update rdoc.akr2008-09-241-0/+5
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c (enc_arg): must take pointer argument to avoid GCakr2008-09-181-8/+9
| | | | | | | | | | | | | | | | | | problem. StringValueCStr modifies the argument and it should be preserved while the string StringValueCStr returns is used. Since the string is used by caller, the modified argument should be hold by caller. Actually GC.stress = true def (o=Object.new).to_str() "universal"+"_newline" end "\u3042".encode(o, "")' causes curious warning: rb_define_const: invalid name `' for constant git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c: add "Error" suffix for Encoding exception classes.matz2008-09-181-41/+41
| | | | | | | | | | a patch from Tadashi Saito <shiba at mail2.accsnet.ne.jp> in [ruby-dev:36346]. * encoding.c (Init_Encoding): rename EncodingCompatibilityError to Encoding::CompatibilityError. [ruby-dev:36366] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c (enc_arg): revert last change. too early exceptionmatz2008-09-181-9/+23
| | | | | | | | raising. * transcode.c (enc_arg): need not to take pointer argument. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19406 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c (enc_arg): raise exception when unknown encoding isnaruse2008-09-161-18/+3
| | | | | | given. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19388 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode_data.h (STR1_LENGTH): defined.akr2008-09-151-4/+5
| | | | | | | | | | | | | | (makeSTR1LEN): defined. * tool/transcode-tblgen.rb: use makeSTR1LEN. generate STR1 for 4 to 259 bytes. * transcode.c (rb_transcoding): new field: output_index. (transcode_restartable0): use STR1_LENGTH. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c (econv_opts): don't use to_sym.akr2008-09-151-2/+4
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19363 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode_data.h: return output functions ssize_t.akr2008-09-141-6/+5
| | | | | | | | | | | | | | | | | | | * transcode.c (transcode_restartable0): don't need to cast the result of output functions. * enc/trans/newline.trans: follow the type change. * enc/trans/escape.trans: ditto. * enc/trans/utf_16_32.trans: ditto. * enc/trans/iso2022.trans: ditto. * enc/trans/japanese.trans: ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode_data.h: output function takes output buffer size.akr2008-09-141-6/+20
| | | | | | | | | | | | | | | | | | * transcode.c: give output buffer size for output functions. * enc/trans/newline.trans: follow the type change. * enc/trans/escape.trans: ditto. * enc/trans/utf_16_32.trans: ditto. * enc/trans/iso2022.trans: ditto. * enc/trans/japanese.trans: ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c (str_encode): returns duplicated string if nothingnobu2008-09-141-1/+6
| | | | | | | changed. [ruby-core:18578] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c (rb_transcoding): align state field.akr2008-09-131-5/+8
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c (DECORATOR_P): renamed from SUPPLEMENTAL_CONVERSION.akr2008-09-131-11/+11
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (make_writeconv): use rb_enc_name.akr2008-09-131-6/+6
| | | | | | | | | | | | | (make_readconv): ditto. * transcode.c (rb_econv_open_opts): ditto. (econv_args): ditto. (decorate_convpath): ditto. (econv_set_replacement): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c (rb_econv_prepare_opts): raise ArgumentError ifakr2008-09-121-1/+6
| | | | | | | a broken string is specified as a replacement. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19316 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c (rb_econv_prepare_opts): initialize *opt and return 0akr2008-09-121-2/+4
| | | | | | | if opthash is nil. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enc/trans/escape.trans: transcoder name renamed to use underscore.akr2008-09-121-9/+9
| | | | | | | | * transcode.c: follow the renaming. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19311 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c (rb_econv_init_by_convpath_i): new function.akr2008-09-121-10/+121
| | | | | | | | (rb_econv_init_by_convpath): new function. (econv_init): use rb_econv_init_by_convpath. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c (econv_args): take snamev_p and dnamev_p to preventakr2008-09-121-10/+13
| | | | | | | | possible GC problem. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c (enc_arg): take arg as VALUE * to prevent GC problem.akr2008-09-121-7/+10
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c (rb_econv_add_transcoder_at): fix loop condition.akr2008-09-121-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c (decorator_names): extracted from rb_econv_open.akr2008-09-121-59/+186
| | | | | | | | | | | | | (rb_econv_open): use decorator_names. (econv_args): extracted from econv_init. (econv_init): use econv_args. (decorate_convpath): new function. (search_convpath_i): new function. (econv_s_search_convpath): new method. (Init_transcode): new method defined. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19305 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c (rb_econv_t): new field: num_allocated.akr2008-09-121-56/+77
| | | | | | | | | | | | | | (rb_econv_alloc): extracted from rb_econv_open_by_transcoder_entries. (rb_econv_add_transcoder_at): extracted from rb_econv_decorate_at and generalized (rb_econv_open_by_transcoder_entries): use rb_econv_alloc and rb_econv_add_transcoder_at. (rb_econv_add_converter): extracted from rb_econv_decorate_at. (rb_econv_decorate_at): use rb_econv_add_converter. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c (rb_econv_t): new field: started.akr2008-09-121-1/+8
| | | | | | | | | | (rb_econv_open_by_transcoder_entries): initialize started field. (rb_econv_convert): set started field. (rb_econv_insert_output): ditto. (rb_econv_decorate_at): check started field instead of num_finished. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c (make_encoding): new function.akr2008-09-101-10/+25
| | | | | | | | | | | (make_encobj): new function. (econv_s_asciicompat_encoding): use make_encoding. (rb_econv_open_exc): use SUPPLEMENTAL_CONVERSION. (econv_convpath): use encoding object in the result. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c (econv_convpath): new method.akr2008-09-101-0/+41
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19286 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/encoding.h (econv_after_output): renamed fromakr2008-09-091-37/+37
| | | | | | | | | | | | | econv_output_followed_by_input. (ECONV_AFTER_OUTPUT): renamed from ECONV_OUTPUT_FOLLOWED_BY_INPUT. * transcode.c: follow the renaming. * io.c: ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c (get_replacement_character): don't return ASCIIakr2008-09-091-44/+9
| | | | | | | | | | incompatible replacements. (make_replacement): don't convert the result of get_replacement_character. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enc/trans/newline.trans (rb_universal_newline): swap src_encodingakr2008-09-091-4/+2
| | | | | | | | | | | | and dst_encoding. * transcode.c (rb_econv_decorate_at): call get_transcoder_entry only once. (rb_econv_binmode): follow universal_newline change. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19276 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/encoding.h (ECONV_DECORATOR_MASK): mergeakr2008-09-091-62/+62
| | | | | | | | | | | | | | | | | | | | | | | | ECONV_ENCODER_MASK and ECONV_DECORATOR_MASK. (ECONV_UNIVERSAL_NEWLINE_DECORATOR): renamed from ECONV_UNIVERSAL_NEWLINE_DECODER. (ECONV_CRLF_NEWLINE_DECORATOR): renamed from ECONV_CRLF_NEWLINE_ENCODER. (ECONV_CR_NEWLINE_DECORATOR): renamed from ECONV_CR_NEWLINE_ENCODER. (ECONV_XML_TEXT_DECORATOR): renamed from ECONV_XML_TEXT_ENCODER. (ECONV_XML_ATTR_CONTENT_DECORATOR): renamed from ECONV_XML_ATTR_CONTENT_ENCODER. (ECONV_STATEFUL_DECORATOR_MASK): renamed from ECONV_STATEFUL_ENCODER_MASK. (ECONV_XML_ATTR_QUOTE_DECORATOR): renamed from ECONV_XML_ATTR_CONTENT_DECORATOR. * io.c: follow the renaming. * transcode.c: ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c (rb_econv_open0): make it static.akr2008-09-091-23/+17
| | | | | | | | (rb_econv_open): place decorators at last. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c (rb_econv_t): last_trans_index removed.akr2008-09-091-16/+11
| | | | | | | | | | | | (rb_econv_open_by_transcoder_entries): follow the type change. (rb_econv_open0): ditto. (rb_econv_decorate_at): ditto. (rb_econv_binmode): ditto. (rb_econv_insert_output): simplified because there are no decorators at last. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19267 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c (rb_econv_open): reverse the order of decorders.akr2008-09-091-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c (rb_econv_open0): num_encoders and num_decoders removed.akr2008-09-091-16/+8
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/encoding.h (rb_econv_decorate_at_first): declared.akr2008-09-081-54/+146
| | | | | | | | | | | | | | | | | | | | (rb_econv_decorate_at_last): declared. * transcode.c (rb_econv_open_by_transcoder_entries): initialize replacement_enc. allocate outbuf for the last transcoder. (rb_econv_open0): extracted from rb_econv_open. (rb_econv_open): use rb_econv_open0 and decorate the result using rb_econv_decorate_at_first and rb_econv_decorate_at_last. (rb_econv_decorate_at): new function. (rb_econv_decorate_at_first): ditto. (rb_econv_decorate_at_last): ditto. (rb_econv_binmode): fix iteration end condition. (econv_init): don't set source_encoding_name and destination_encoding_name because they are set in rb_econv_open0. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c (rb_econv_open): make ec a local variable.akr2008-09-081-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c (rb_econv_asciicompat_encoding): check decoder.akr2008-09-081-21/+27
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c (rb_econv_t): last_error.partial_input removed.akr2008-09-081-3/+0
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/encoding.h (rb_econv_asciicompat_encoding): renamedakr2008-09-081-41/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | from rb_econv_stateless_encoding to apply stateless ASCII incompatible encodings such as UTF-16BE. * io.c (make_writeconv): use rb_econv_asciicompat_encoding. * transcode_data.h (rb_transcoder_asciicompat_type_t): renamed from rb_transcoder_stateful_type_t. (rb_transcoder): use rb_transcoder_asciicompat_type_t. * transcode.c: follow the type change. (asciicompat_encoding_i): renamed from stateless_encoding_i. (rb_econv_asciicompat_encoding): renamed from rb_econv_stateless_encoding. (econv_s_asciicompat_encoding): method renamed. * tool/transcode-tblgen.rb: follow the type change. * enc/trans/utf_16_32.trans: follow the type change. rb_from_UTF_16BE to UTF-8 is asciicompat_decoder. rb_from_UTF_16LE to UTF-8 is asciicompat_decoder. rb_from_UTF_32BE to UTF-8 is asciicompat_decoder. rb_from_UTF_32LE to UTF-8 is asciicompat_decoder. UTF-8 to rb_to_UTF_16BE is asciicompat_encoder. UTF-8 to rb_to_UTF_16LE is asciicompat_encoder. UTF-8 to rb_to_UTF_32BE is asciicompat_encoder. UTF-8 to rb_to_UTF_32LE is asciicompat_encoder. * enc/trans/newline.trans: follow the type change. universal newline decoder is asciicompat_converter. * enc/trans/escape.trans: follow the type change. * enc/trans/iso2022.trans: ditto. * enc/trans/japanese.trans: ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19249 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode.c (rb_econv_insert_output): "readagain" part should beakr2008-09-081-2/+2
| | | | | | | after replacement. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19247 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/encoding.h (rb_econv_set_replacement): renamed fromakr2008-09-071-3/+3
| | | | | | | | | | rb_econv_set_replacemenet. * transcode.c: follow the renaming. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19227 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rdoc update.akr2008-09-071-5/+4
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19223 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * transcode_data.h (STR1): defined for a string up to 255 bytes.akr2008-09-071-0/+8
| | | | | | | | | | | | | | | | (STR1_BYTEINDEX): defined. (makeSTR1): defined. * tool/transcode-tblgen.rb: generate STR1. * transcode.c (transcode_restartable0): interpret STR1. * enc/trans/escape.trans (fun_so_escape_xml_chref): removed. STR1 is used instead. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/encoding.h (ECONV_XML_ATTR_CONTENT_ENCODER): defined.akr2008-09-071-9/+19
| | | | | | | | | | | | | | | | | | | | (ECONV_STATEFUL_ENCODER_MASK): defined. (ECONV_XML_ATTR_QUOTE_ENCODER): defined. (ECONV_XML_ATTR_ENCODER): removed. * enc/trans/escape.trans (rb_escape_xml_attr_content): defined. (rb_escape_xml_attr_quote): defined. (rb_escape_xml_attr): removed. * io.c (NEED_WRITECONV): writeconv is required if supplemental converter is used. (make_writeconv): apply stateful encoder in writeconv. * transcode.c: follow the constant change. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e