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

1504 Коммитов

Автор SHA1 Сообщение Дата
akr 6f1fe004f7 * io.c (io_shift_crbuf): add strp argument to append into existing
string.
  (read_all): use econv if enc2 is set.
  (io_getc): follow the io_shift_crbuf change.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-18 03:13:53 +00:00
akr 815fd8536b * io.c (io_enc_str_converted): new function.
(make_readconv): extracted from io_getc.
  (more_char): ditto.
  (appendline): use econv via make_readconv and more_char for code
  conversion.
  (prepare_getline_args): don't convert record separator.
  (rb_io_getline_1): don't use rb_io_getline_fast if enc2 is set.
  (io_getc): use make_readconv and more_char.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-18 01:40:01 +00:00
akr f072d0464f add tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-18 00:41:54 +00:00
akr f3a42261fb * io.c (appendline): appendline cannot check character boundary.
(rb_io_getline_1): relax limit until character boundary.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-17 19:41:39 +00:00
gotoyuzo d4835a2703 * lib/webrick/cgi.rb (WEBrick::CGI::Socket#eof?): added lacked method.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-17 17:33:13 +00:00
akr 0ff4061ef7 * io.c (prepare_getline_args): io.gets(10,nil) should cause TypeError.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18675 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-17 12:54:26 +00:00
akr 128abaede6 * transcode.c (econv_primitive_putback): new method.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-17 04:40:59 +00:00
akr 0051d4a077 * include/ruby/encoding.h (rb_econv_putbackable): declared.
(rb_econv_putback): ditto.

* transcode.c (rb_econv_putbackable): implemented.
  (rb_econv_putback): ditto.

* io.c (io_getc): put back bytes if possible.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-17 04:25:56 +00:00
akr 04bbc1df12 * transcode.c (make_econv_exception): add several instance variables
to exception object.
  (ecerr_source_encoding): new method:
  Encoding::ConversionUndefined#source_encoding and 
  Encoding::InvalidByteSequence#source_encoding.
  (ecerr_destination_encoding): new method:
  Encoding::ConversionUndefined#destination_encoding and 
  Encoding::InvalidByteSequence#destination_encoding.
  (econverr_error_char): new method:
  Encoding::ConversionUndefined#error_char.
  (econverr_error_bytes): new method:
  Encoding::ConversionUndefined#error_bytes.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-17 03:05:40 +00:00
naruse 067f704f64 * test/iconv/test_option.rb (test_ignore_option): skip if iconv
doesn't have transliterate.

* test/iconv/test_option.rb (test_translit_option): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-16 23:40:46 +00:00
akr 63daa7c07d * include/ruby/io.h (rb_io_t): new fields: readconv, crbuf, crbuf_off,
crbuf_len, crbuf_capa.
  (MakeOpenFile): initialize them.

* io.c (io_shift_crbuf): new function.
  (io_getc): use econv.
  (rb_io_fptr_finalize): finalize readconv and crbuf.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-16 17:06:35 +00:00
akr 7a0bea4fd3 * 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
2008-08-16 05:32:42 +00:00
akr c3d0206e04 add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-15 16:41:16 +00:00
akr 3a427c6199 * transcode.c (econv_just_convert): extracted from rb_econv_output.
(rb_econv_output): use econv_just_convert.
  (econv_primitive_output): new method.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-15 14:17:11 +00:00
akr 131e194cec * include/ruby/encoding.h (rb_econv_t): new field: last_error.
* transcode.c (rb_trans_conv): new argument: result_position_ptr.
  (rb_econv_convert): fill last_error.
  (econv_result_to_symbol): extracted from econv_primitive_convert.
  (econv_primitive_errinfo): new method.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-15 09:12:56 +00:00
nobu fa9a533d0b * test/ruby/test_settracefunc.rb (test_call, test_class):
RubyVM::FrozenCore is no longer visible.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-15 08:01:17 +00:00
akr e4e2ef3975 add tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-15 02:32:47 +00:00
akr 8b04d998ae add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18636 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-15 00:27:03 +00:00
akr b9d5d6a137 add tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-15 00:18:42 +00:00
akr 520cd6d186 * transcode.c (econv_init): don't create dummy encoding if
rb_econv_open is failed.
  (make_dummy_encoding): new function extracted from make_encoding.
  (make_encoding): removed.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-15 00:05:06 +00:00
akr 8eda80ff2c * transcode.c (econv_primitive_convert): set destination_buffer
encoding.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18630 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-14 16:06:33 +00:00
akr c82aee31b4 * include/ruby/encoding.h (rb_econv_result_t): moved from
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: svn+ssh://ci.ruby-lang.org/ruby/trunk@18625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-14 14:28:10 +00:00
akr a6daaf16b0 * transcode.c (econv_init): accept Encoding object as source_encoding
and destination_encoding.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18623 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-14 12:35:19 +00:00
akr bd9bd52954 * transcode_data.h (transcode_invalid_byte_sequence): renamed from
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: svn+ssh://ci.ruby-lang.org/ruby/trunk@18618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-14 11:31:27 +00:00
akr 7db5e184c2 add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18616 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-14 10:38:41 +00:00
akr a99e6c15b8 * transcode.c (rb_econv_conv): new function. it don't consume input
too much, even for multilevel conversion.
  (transcode_loop): use rb_econv_conv.
  (econv_primitive_convert): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-14 06:35:33 +00:00
akr bcae240f19 * transcode_data.h (rb_trans_result_t): new enumeration constant:
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: svn+ssh://ci.ruby-lang.org/ruby/trunk@18608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-14 06:12:27 +00:00
akr 81be10bd85 test updated.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-14 00:40:25 +00:00
kazu efdcaba210 * test/ruby/test_file_exhaustive.rb (TestFileExhaustive#setup): set group of tmpdir.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-13 17:46:47 +00:00
akr fde26b7d7a * transcode.c (econv_primitive_convert): add output_byteoffset
argument.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-13 17:24:42 +00:00
shugo 31ad92b2f3 * test/ruby/test_thread.rb (test_list): call Thread.pass to run t1.
fixed [ruby-core:18264].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-13 14:22:48 +00:00
knu d4b7cc796c * golf_prelude.rb, lib/set.rb (TC_Set#test_each),
test/readline/test_readline_history.rb (Readline#test_each__enumerator),
  test/ruby/test_array.rb (TestArray#test_collect),
  test/ruby/test_enumerator.rb (TestEnumerator#test_initialize):
  Enumerable::Enumerator is now called Enumerator.

* lib/rinda/tuplespace.rb (Rinda::TupleBag#initialize): Use
  enum_for instead of hardcoding Enumerable::Enumerator.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-13 08:03:30 +00:00
ko1 16612b360b * thread.c, vm_core.h: add manual priority support
using time slice.  if you enable USE_NATIVE_THREAD_PRIORITY
  macro, this mechanism is ignored.  [ruby-dev:33124]
* thread_pthread.c, thread_win32.c: ditto.
* test/ruby/test_thread.rb: fix test parameter.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-13 07:53:35 +00:00
shugo f433d710d0 * object.c (rb_obj_untrusted): new method Object#untrusted?.
(rb_obj_untrust): new method Object#untrust.
  (rb_obj_trust): new method Object#trust.
* array.c, debug.c, time.c, include/ruby/ruby.h, re.c, variable.c,
  string.c, io.c, dir.c, vm_method.c, struct.c, class.c, hash.c,
  ruby.c, marshal.c: fixes for Object#untrusted?.
* test/ruby/test_module.rb, test/ruby/test_array.rb,
  test/ruby/test_object.rb, test/ruby/test_string.rb,
  test/ruby/test_marshal.rb, test/ruby/test_hash.rb: added tests for
  Object#untrusted?.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-13 07:25:05 +00:00
naruse 55c141c624 * test/ruby/test_m17n.rb: follow EncodingCompatibilityError.
* test/ruby/test_mixed_unicode_escapes.rb: ditto.

* test/ruby/enc/test_utf16.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18567 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-13 07:14:56 +00:00
akr 4aa251999d * transcode.c (econv_init): make flags argument optional.
(econv_primitive_convert): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-13 06:08:56 +00:00
akr a14d5eb09b * enc/trans/newline.trans (rb_crlf_newline): new transcoder.
(rb_cr_newline): new transcoder.

* transcode.c (trans_open_i): one more exra room for input newline
  converter.
  (rb_trans_open): crlf newline and cr newline implemented.
  (Init_transcode): Encoding::Converter::CRLF_NEWLINE and
  Encoding::Converter::LF_NEWLINE defined.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-13 05:48:57 +00:00
akr 74a2a7bdbf * enc/trans/newline.trans: new file.
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@18556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-13 05:30:42 +00:00
akr 5501d84ceb * transcode.c (econv_primitive_convert): add output_size argument.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-12 23:03:46 +00:00
akr 9d4bb3b969 * transcode.c (rb_trans_conv): report last transcode_obuf_full.
(econv_max_output): new method Encoding::Converter#max_output.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-12 22:43:17 +00:00
naruse 85c41f4fbc * error.c (rb_eEncCompatError): add Exception.
* include/ruby/ruby.h: ditto.

* encoding.c (rb_enc_check): use rb_eEncCompatError.

* string.c (rb_enc_cr_str_buf_cat): ditto.

* string.c (rb_str_sub_bang): ditto.

* string.c (rb_str_hex): ditto.

* string.c (rb_str_oct): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-12 18:17:05 +00:00
akr edcd02cb5a * transcode.c (rb_cEncodingConverter): new class Encoding::Converter.
(econv_free): new function.
  (econv_s_allocate): ditto.
  (econv_init): ditto.
  (check_econv): ditto.
  (econv_primitive_convert): new method.
  (Init_transcode): define Encoding::Converter.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-12 14:46:18 +00:00
akr 5ade93542f * transcode_data.h (TRANSCODE_ERROR): removed.
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@18524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-12 07:20:10 +00:00
kouji fa9ef4bf00 * test/readline/test_readline.rb (TestReadline#test_safe_level_4):
tested Readline.vi_editing_mode? and Readline.emacs_editing_mode?.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18516 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-12 06:17:48 +00:00
matz c2e85dfa8f * test/win32ole/test_err_in_callback.rb: do not require 'mkmf'
unless WIN32OLE is defined.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-12 04:35:13 +00:00
akr 61f512a357 add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-11 22:49:15 +00:00
akr 94ca2d94de * transcode_data.h (rb_transcoder): add resetstate_func field for
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: svn+ssh://ci.ruby-lang.org/ruby/trunk@18503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-11 22:44:23 +00:00
akr 425098de96 * transcode.c (rb_trans_conv): find second last error.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-11 21:49:38 +00:00
akr a2901a7c75 * transcode_data.h (rb_trans_result_t): new type.
(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: svn+ssh://ci.ruby-lang.org/ruby/trunk@18498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-11 15:50:42 +00:00
matz 9295fd4b59 * array.c (rb_ary_sample): rename #choice to #sample. in
addition, sample takes optional argument, a la #first.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18494 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-11 10:00:47 +00:00