Граф коммитов

372 Коммитов

Автор SHA1 Сообщение Дата
nobu 8761467727 * io.c (validate_enc_binmode, rb_io_extract_modeenc): set newline
decorator according to open mode.
* transcode.c (rb_econv_prepare_options): new function, to prepare
  econv options with newline flags.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-26 15:55:21 +00:00
nobu 3b937bbdc4 * include/ruby/encoding.h (ECONV_NEWLINE_DECORATOR_MASK): add.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-26 15:54:14 +00:00
nobu 7140c8f0cd * transcode.c (econv_init): fix rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31353 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-26 15:52:35 +00:00
nobu e9cc518446 * transcode.c (encoded_dup): extract.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-05 00:38:15 +00:00
akr 41c93065da * transcode.c: parenthesize macro arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-09 11:38:55 +00:00
drbrain 457e481b20 Alter comment on String#encode for better wording and ri output
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-16 19:20:51 +00:00
nobu 5bf72d1fa6 * transcode.c (transcode_loop): call default handler of the given
hash, method, proc or [] method as fallback.  [ruby-dev:42692]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-07 13:05:26 +00:00
nobu 23e8deaf0d * array.c, gc.c, hash.c, object.c, string.c, struct.c,
transcode.c, variable.c, vm.c, vm_insnhelper.c, vm_method.c:
  replace calls to rb_error_frozen() with rb_check_frozen().  a
  patch from Run Paint Run Run at [ruby-core:32014]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-24 08:14:05 +00:00
nobu 671b498070 Commit miss.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-19 03:25:29 +00:00
nobu 12cbb58819 * test/ruby/test_sprintf.rb: fix ML ref. [ruby-core:32848]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-19 03:22:03 +00:00
knu 82abe79b9f * class.c (rb_scan_args): Add support for optional keyword
argument hash.

* README.EXT, README.EXT.ja: Update documentation accordingly.

* dir.c (dir_initialize): Make use of the new rb_scan_args()
  feature.

* io.c (rb_io_s_popen, rb_scan_open_args, rb_io_initialize)
  (rb_io_s_pipe, open_key_args, io_s_foreach, io_s_readlines)
  (rb_io_s_read, rb_io_set_encoding): Ditto.

* transcode.c (str_transcode, econv_args)
  (econv_primitive_convert): Ditto.

* ext/zlib/zlib.c (rb_gzreader_initialize): Ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-10 07:51:58 +00:00
nobu 25b9eb5e57 * include/ruby/ruby.h (rb_data_type_t): restructured. [ruby-dev:41862]
add parent member.

* error.c (rb_typeddata_inherited_p): new function.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-18 07:31:54 +00:00
usa 4df965f4ed * file.c (rb_str_encode_ospath): when the encoding of the parameter
is ASCII-8BIT, should recognize as filesystem encoding, and convert
  to UTF-8 on Windows.

* file.c (realpath_rec): should convert to ospath encoding before
  calling lstat().

* file.c (rb_realpath_internal): resolved string should take over
  the encoding of base string.

* transcode.c (rb_str_encode): should return new string always.
  fixed #3444.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-17 09:46:30 +00:00
marcandre 7729de4d91 * array.c: Documentation: change => in call-seq to ->.
Harmonize "#=>" in examples. [ruby-core:30206]

* bignum.c: ditto

* class.c: ditto

* compar.c: ditto

* cont.c: ditto

* dir.c: ditto

* encoding.c: ditto

* enum.c: ditto

* enumerator.c: ditto

* error.c: ditto

* eval.c: ditto

* file.c: ditto

* gc.c: ditto

* io.c: ditto

* load.c: ditto

* marshal.c: ditto

* math.c: ditto

* numeric.c: ditto

* object.c: ditto

* pack.c: ditto

* proc.c: ditto

* process.c: ditto

* random.c: ditto

* range.c: ditto

* re.c: ditto

* ruby.c: ditto

* signal.c: ditto

* sprintf.c: ditto

* string.c: ditto

* struct.c: ditto

* thread.c: ditto

* time.c: ditto

* transcode.c: ditto

* variable.c: ditto

* vm_eval.c: ditto

* vm_method.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-17 21:07:33 +00:00
marcandre 1dee5e34a3 * error.c: RDoc for subclasses of Exception. [ruby-core:28394]
* cont.c: ditto

* enumerator.c: ditto

* io.c: ditto

* math.c: ditto

* numeric.c: ditto

* proc.c: ditto

* re.c: ditto

* thread.c: ditto

* transcode.c: ditto. Thanks to Run Paint for some of the documentation.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-08 04:50:09 +00:00
nobu 4d82ba512c * transcode.c (transcode_loop): suppressed a warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27386 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-18 03:28:12 +00:00
naruse c871aee96b * transcode.c (transcode_loop): insert output the value when
fallback hash has a related key. [ruby-dev:40540]
  [ruby-dev:40829] #3036

* transcode.c (rb_econv_prepare_opts): pass to newhash
  a value with the key :fallback.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-13 01:26:46 +00:00
nobu c2f7ed2f24 * transcode.c (str_transcode0): confirm the code range.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-11 08:32:03 +00:00
naruse f453c3c0da * transcode.c (econv_opts): set :undef => :replace when
:replace is given and :invalid is not given. [ruby-dev:40554]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-05 10:39:56 +00:00
duerst b32ee85f97 * transcode_data.h, transcode.c, tool/transcode-tblgen.rb: Added
support for new transcoding instruction FUNsio (with Tatsuya Mizuno)

* enc/trans/gb18030.trans: Significantly reduced GB18030 conversion
  table footprint using FUNsio and differences (with Tatsuya Mizuno)

* test/ruby/test_transcode.rb: Minor name fix (from Tatsuya Mizuno)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26065 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-10 11:59:12 +00:00
nobu 4d786d21e3 * removed spaces just before tabs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-26 05:25:08 +00:00
duerst 80b54214b2 * transcode.c: Added a check for an internal error
(with Tatsuya Mizuno)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25919 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-25 10:28:45 +00:00
akr b9e0294eda fix typos.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-03 17:46:28 +00:00
nobu 5d4b63d2fd * transcode.c (rb_transcoding, str_transcoding_resize): fixed
types.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25289 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-10 14:51:25 +00:00
nobu 89154445fb * transcode.c: reverted r25277.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-10 12:11:11 +00:00
nobu c4ff156d91 * transcode.c (rb_transcoding, str_transcoding_resize): fixed
types.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-10 03:21:33 +00:00
nobu 913fdf25bc * transcode.c (econv_data_type): typed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-09 03:56:58 +00:00
usa a436212282 * transcode.c (str_encode_bang): C99ism.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-31 04:16:01 +00:00
duerst 5e85648b77 * transcode.c: added check for frozen string for encode! (see Bug #1836)
* test/ruby/test_transcode.rb: added tests for the above


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-30 09:40:06 +00:00
nobu 3448160b24 * transcode.c (enc_arg): default interanl encoding may not be set.
[ruby-core:23932]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-21 01:46:37 +00:00
ko1 3caa4ee5e5 * array.c (rb_ary_memsize): added.
* io.c (rb_io_memsize): added.
* regcomp.c (onig_memsize): added.
* string.c (rb_str_memsize): added.
* transcode.c (rb_transcoding_memsize, rb_econv_memsize): added.
* variable.c (rb_geneic_ivar_memsize): added.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-16 22:36:27 +00:00
naruse e54f880643 * transcode.c (transcode_restartable0): refix can't build with VC9.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-16 11:10:10 +00:00
ko1 d3027870ee * transcode.c (transcode_restartable0): revert last commit because
this change cause SEGV at test-all.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-14 05:50:46 +00:00
naruse 44a8a15037 * transcode.c (transcode_restartable0): can't build with VC9.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-13 16:54:53 +00:00
naruse 6066cfadab Fix rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-13 09:59:46 +00:00
matz 91e5ba1cb8 * encoding.c (rb_enc_codepoint_len): combine rb_enc_codepoint()
and rb_enc_codelen() in one function to reduce calls.

* encoding.c (rb_enc_codepoint): compatibility function.

* sprintf.c (rb_str_format): use rb_enc_codepoint_len().

* string.c (rb_str_inspect, rb_str_upcase_bang,
  rb_str_downcase_bang, rb_str_capitalize_bang,
  rb_str_swapcase_bang, trnext, tr_trans, rb_str_delete_bang,
  rb_str_squeeze_bang, rb_str_count, rb_str_split_m,
  rb_str_each_line, rb_str_each_codepoint, rb_str_lstrip_bang,
  sym_printable): ditto.

* transcode.c (make_econv_exception): use rb_enc_mbc_to_codepoint()

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-19 16:59:22 +00:00
naruse 3abca796f4 Fix: DON'T move in_p because before in_p is replaced by buffered data.
* transcode.c: NOMAP is now multibyte direct map.

* transcode.c: remove ASIS.

* transcode_data.h: ditto.

* tool/transcode-tb (ActionMap#generate_info): remove :asis.

* tool/transcode-tb (ActionMap#generate_info): add :nomap0.

* enc/trans/utf8_mac.trans: replace :asis by :nomap0.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23344 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-05 00:05:11 +00:00
naruse 0881a39acd * transcode.c (ASIS): added for multi byte direct map.
* transcode.c (transcode_restartable0): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-26 13:03:50 +00:00
nobu d1abc53721 * array.c, bignum.c, dln.c, error.c, gc.c, io.c, marshal.c,
numeric.c, pack.c, strftime.c, string.c, thread.c, transcode.c,
  transcode_data.h, util.c, variable.c, vm_dump.c,
  include/ruby/encoding.h, missing/crypt.c, missing/vsnprintf.c:
  suppress VC type warnings.  [ruby-core:22726]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-12 09:16:15 +00:00
nobu 12d2c8ba41 stripped trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22 14:23:33 +00:00
akr b916afddc9 * transcode.c (make_econv_exception): refine error message for
undefined conversion.  [ruby-core:21828]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-04 16:45:31 +00:00
akr e193fa79d6 * transcode.c (make_econv_exception): show U+XXXX form for undefined
conversion error from UTF-8.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22039 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-04 13:01:12 +00:00
akr 07aeaa0686 * transcode.c (rb_econv_init_by_convpath_i): make it static.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21883 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-29 17:57:13 +00:00
nobu 882cb2e37d * transcode.c (struct rb_transcoding): added ary member for debug.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-27 01:15:37 +00:00
naruse 69ee4246e5 * transcode.c (str_transcode0): fix: :xml option doesn't
work on str.encode([options]) form without default_internal.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-18 18:32:24 +00:00
naruse 81bdf8a1f2 Add rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-15 13:47:47 +00:00
duerst 82c673d3a1 * enc/trans/gb18030.trans, gb18030-tbl.rb:
new Chinese GB18030 transcoding (from Yoshihiro Kambayashi)

* test/ruby/test_transcode.rb: added tests for the above
  (from Yoshihiro Kambayashi)

* transcode_data.h, transcode.c, tool/transcode_tblgen.rb:
  added support for GB18030-specific 4-byte sequences
  (with Yoshihiro Kambayashi)



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-14 11:12:30 +00:00
naruse 7371086f68 Add dummy definition for fake rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21488 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-13 08:18:16 +00:00
duerst bf6c750c35 * transcode.c: Minor fixes and tweaks in documentation.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-30 09:03:04 +00:00
akr 415d59e3e4 * transcode.c (make_econv_exception): show source and destination
encoding.  [ruby-dev:37285]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-27 06:28:34 +00:00
akr b17c5eba46 * io.c (fptr_finalize): close the IO object even if finish_writeconv or
flush is failed.
  (finish_writeconv): don't raise.  return errno or exception.
  (finish_writeconv_arg): removed.
  (finish_writeconv_sync): follow finish_writeconv change.

* transcode.c (rb_econv_make_exception): new function.

* include/ruby/encoding.h (rb_econv_make_exception): declared.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-26 05:04:39 +00:00
naruse 20f5c2a3ba * transcode.c (str_transcode0): set encoding when String#encode was
given explicit but the same destination and source encoding.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-25 11:59:57 +00:00
naruse df4699320d * transcode.c (sym_ignore): remove useless symbol.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-25 10:43:35 +00:00
naruse d42b3e5c88 * transcode.c (decorate_convpath): show type of escaping for
xml_attr_quote or some conversions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-25 08:54:51 +00:00
yugui 5677106ec9 * io.c: rdoc for File::open and 1.9 feature in file modes.
* transcode.c: rdoc for String#encode

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20946 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-23 11:30:44 +00:00
duerst da1ffe490d * transcode.c: in transcode_search_path, elimintated a warning
on cygwin about pathlen potentially not being initialized


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-18 07:41:09 +00:00
matz 5ef37965fc * transcode.c (str_transcode0): String#encode without argument now
behave as if :undef => :replace, :invalid => :replace specified.

* transcode.c (rb_econv_prepare_opts): should preserve options in
  any case.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-17 09:13:04 +00:00
akr c2b9d34f62 * transcode.c (transcode_restartable0): in_pos and out_pos never be
NULL, now.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-16 16:26:53 +00:00
matz 80cdf946f7 * transcode.c (str_transcode0): should not raise error when
default_internal is not set.  [ruby-core:19309]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-14 14:05:11 +00:00
nobu a09a8ea86d * transcode.c (rb_econv_init_by_convpath): suppressed warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19769 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-13 00:56:40 +00:00
matz 284f4c8431 * transcode.c (str_transcode0): String#encode() with no encoding
specified transcode the string into Encoding.default_internal.
  inspired by [ruby-core:19298].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-12 22:52:01 +00:00
mame fc9c37dfc9 * transcode.c (rb_econv_add_coverter): remove unnecessary NULL check.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-09 15:12:20 +00:00
akr a3bebd5564 * include/ruby/encoding.h (rb_str_encode): renamed from
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: svn+ssh://ci.ruby-lang.org/ruby/trunk@19589 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-26 10:35:00 +00:00
matz 3deb806a06 * error.c (Init_Exception): introduce EncodingError which is a
superclass for all encoding related exception classes,
  e.g. Encoding::CompatibilityError.  [ruby-dev:36371]

* transcode.c (Init_transcode): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-26 03:53:11 +00:00
usa e76b1a11ca * transcode.c, include/ruby/encoding.c (rb_transcode_convertible):
new function. checking the existance of converter.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-26 02:07:19 +00:00
akr 2a608fed88 update rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-25 17:42:52 +00:00
akr d7dbdef4e5 * transcode.c (rb_eUndefinedConversionError): renamed from
rb_eConversionUndefinedError.
  (rb_eConverterNotFoundError): renamed from rb_eNoConverterError.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-25 12:47:30 +00:00
akr fee3bb664a update rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-25 11:42:49 +00:00
akr a7dd79c1b4 update rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-24 16:02:37 +00:00
akr 2cbc7b69b7 * transcode.c (enc_arg): must take pointer argument to avoid GC
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: svn+ssh://ci.ruby-lang.org/ruby/trunk@19408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-18 09:29:01 +00:00
matz d5ec36c486 * transcode.c: add "Error" suffix for Encoding exception classes.
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: svn+ssh://ci.ruby-lang.org/ruby/trunk@19407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-18 08:57:33 +00:00
matz 45ee7d2e78 * transcode.c (enc_arg): revert last change. too early exception
raising.

* transcode.c (enc_arg): need not to take pointer argument.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19406 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-18 08:27:17 +00:00
naruse bad9a9ad0d * transcode.c (enc_arg): raise exception when unknown encoding is
given.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19388 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-16 16:18:32 +00:00
akr 6eb3843b17 * transcode_data.h (STR1_LENGTH): defined.
(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: svn+ssh://ci.ruby-lang.org/ruby/trunk@19366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-15 15:42:30 +00:00
akr e0f064cf3c * transcode.c (econv_opts): don't use to_sym.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19363 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-15 14:38:12 +00:00
akr c767be3039 * transcode_data.h: return output functions ssize_t.
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@19351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-14 18:35:17 +00:00
akr a3c8c0adec * transcode_data.h: output function takes output buffer size.
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@19350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-14 18:06:20 +00:00
nobu 2f67b43aec * transcode.c (str_encode): returns duplicated string if nothing
changed.  [ruby-core:18578]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-14 17:37:35 +00:00
akr 0a3fc5be05 * transcode.c (rb_transcoding): align state field.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-13 09:52:02 +00:00
akr d4c7473841 * transcode.c (DECORATOR_P): renamed from SUPPLEMENTAL_CONVERSION.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-13 09:21:34 +00:00
akr 8d7e774f5f * io.c (make_writeconv): use rb_enc_name.
(make_readconv): ditto.

* transcode.c (rb_econv_open_opts): ditto.
  (econv_args): ditto.
  (decorate_convpath): ditto.
  (econv_set_replacement): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-13 09:06:51 +00:00
akr 2cc9b488a0 * transcode.c (rb_econv_prepare_opts): raise ArgumentError if
a broken string is specified as a replacement.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19316 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-12 18:45:44 +00:00
akr 7e58885f0a * transcode.c (rb_econv_prepare_opts): initialize *opt and return 0
if opthash is nil. 


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-12 17:53:26 +00:00
akr 41d3a01486 * enc/trans/escape.trans: transcoder name renamed to use underscore.
* transcode.c: follow the renaming.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19311 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-12 17:30:07 +00:00
akr 248acf0025 * transcode.c (rb_econv_init_by_convpath_i): new function.
(rb_econv_init_by_convpath): new function.
  (econv_init): use rb_econv_init_by_convpath.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-12 17:13:04 +00:00
akr cf86176338 * transcode.c (econv_args): take snamev_p and dnamev_p to prevent
possible GC problem.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-12 16:13:02 +00:00
akr aa423b9311 * transcode.c (enc_arg): take arg as VALUE * to prevent GC problem.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-12 15:39:46 +00:00
akr c0bd38eb94 * transcode.c (rb_econv_add_transcoder_at): fix loop condition.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-12 14:20:27 +00:00
akr 2d80b1695d * transcode.c (decorator_names): extracted from rb_econv_open.
(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: svn+ssh://ci.ruby-lang.org/ruby/trunk@19305 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-12 13:53:42 +00:00
akr 89a5c998c7 * transcode.c (rb_econv_t): new field: num_allocated.
(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: svn+ssh://ci.ruby-lang.org/ruby/trunk@19304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-12 12:58:23 +00:00
akr 19438eee8b * transcode.c (rb_econv_t): new field: started.
(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: svn+ssh://ci.ruby-lang.org/ruby/trunk@19303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-12 12:23:25 +00:00
akr 10ddce3833 * transcode.c (make_encoding): new function.
(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: svn+ssh://ci.ruby-lang.org/ruby/trunk@19288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-10 17:26:49 +00:00
akr 4e93ace24e * transcode.c (econv_convpath): new method.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19286 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-10 17:15:08 +00:00
akr 2d26208a55 * include/ruby/encoding.h (econv_after_output): renamed from
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: svn+ssh://ci.ruby-lang.org/ruby/trunk@19278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-09 16:27:02 +00:00
akr 3cc7c9d0dd * transcode.c (get_replacement_character): don't return ASCII
incompatible replacements.
  (make_replacement): don't convert the result of
  get_replacement_character.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-09 16:18:29 +00:00
akr 817a623d13 * enc/trans/newline.trans (rb_universal_newline): swap src_encoding
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: svn+ssh://ci.ruby-lang.org/ruby/trunk@19276 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-09 16:06:54 +00:00
akr d456f7e357 * include/ruby/encoding.h (ECONV_DECORATOR_MASK): merge
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: svn+ssh://ci.ruby-lang.org/ruby/trunk@19271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-09 12:22:43 +00:00
akr 8c2d4076f0 * transcode.c (rb_econv_open0): make it static.
(rb_econv_open): place decorators at last.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-09 11:57:31 +00:00
akr 40c31d5b75 * transcode.c (rb_econv_t): last_trans_index removed.
(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: svn+ssh://ci.ruby-lang.org/ruby/trunk@19267 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-09 11:37:23 +00:00
akr b96c3dfe67 * transcode.c (rb_econv_open): reverse the order of decorders.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-09 11:22:17 +00:00