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

11840 Коммитов

Автор SHA1 Сообщение Дата
naruse 8984fa6742 * enc/{euc_jp.c,gbk.c,iso_8859_1.c,iso_8859_11.c,iso_8859_13.c,
iso_8859_2.c,iso_8859_6.c,iso_8859_7.c,iso_8859_8.c,iso_8859_9.c,
  shift_jis.c,windows_1251.c}: add document about encodings.

* enc/cp949.c: divided into new file.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15516 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-17 03:21:20 +00:00
akr 0f4199fb56 * re.c (rb_reg_quote): return US-ASCII string consistently.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15515 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-17 02:00:05 +00:00
akr 35cb0f807b * string.c (rb_str_times): reduce loop overhead.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-17 00:18:16 +00:00
akr 71c5e48598 * include/ruby/re.h (struct rmatch_offset): new struct for character
offsets.
  (struct rmatch): new struct.
  (struct RMatch): reference struct rmatch.
  (RMATCH_REGS): new macro.

* re.c (match_alloc): initialize struct rmatch.
  (pair_byte_cmp): new function.
  (update_char_offset): update character offsets.
  (match_init_copy): copy regexp and character offsets.
  (match_sublen): removed.
  (match_offset): use update_char_offset.
  (match_begin): ditto.
  (match_end): ditto.
  (rb_reg_search): make character offset updated flag false.
  (match_size): use RMATCH_REGS.
  (match_backref_number): ditto.
  (rb_reg_nth_defined): ditto.
  (rb_reg_nth_match): ditto.
  (rb_reg_match_pre): ditto.
  (rb_reg_match_post): ditto.
  (rb_reg_match_last): ditto.
  (match_array): ditto.
  (match_aref): ditto.
  (match_values_at): ditto.
  (match_inspect): ditto.

* string.c (rb_str_subpat_set): use RMATCH_REGS.
  (rb_str_sub_bang): ditto.
  (str_gsub): ditto.
  (rb_str_split_m): ditto.
  (scan_once): ditto.

* gc.c (obj_free): free character offsets.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-16 20:08:35 +00:00
usa 5b461c6996 * win32/resource.rb: made version infos confirm to OS spec.
* {bcc32,win32}/Makefile.sub (*.rc): add dependency.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15512 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-16 18:16:21 +00:00
naruse 66583d9663 * string.c (rb_str_substr): optimized for UTF-8.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-16 11:53:04 +00:00
akr 8bcfa698a0 * encoding.c (rb_enc_compatible): check encoding incapable arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-16 11:43:12 +00:00
akr 60fa63b819 * re.c (match_inspect): avoid SEGV with MatchData.allocate.inspect.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-16 11:13:47 +00:00
naruse bb831578c5 * string.c (str_strlen): revert r15507. [ruby-dev:33810]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15508 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-16 10:06:15 +00:00
naruse 0ad3d7ce2d * string.c (str_strlen): little more optimize.
(rb_enc_nth): remove needless variable 'c'.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-16 09:30:03 +00:00
akr 7eeba5f440 * encoding.c (rb_enc_compatible): empty strings are always compatible.
* string.c (rb_enc_cr_str_buf_cat): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-16 09:02:12 +00:00
akr de7c3793c0 add ML ref.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-16 07:18:49 +00:00
akr a47e8e776c * string.c (rb_enc_strlen): UTF-8 character count moved to str_strlen.
(str_strlen): UTF-8 character count is only applicable for valid
  UTF-8 string.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-16 07:16:36 +00:00
akr c2459f35ac add a test for [ruby-dev:33807]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-16 05:48:42 +00:00
suke d3f565ef2c modify test according to changing WIN32OLE.codepage behavior.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-16 04:38:06 +00:00
akr 2df0301c72 add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-16 04:21:46 +00:00
akr 9b3ab49b5d * string.c (rb_str_sub_bang): stringize replacing hash values.
(str_gsub): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-16 04:17:52 +00:00
naruse 327673a43b * string.c (rb_enc_strlen): add search_nonascii like character
counter for UTF-8.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-16 04:05:58 +00:00
akr af75cc01bc * encoding.c (rb_enc_strlen): moved to string.c.
* string.c (rb_enc_strlen): use search_nonascii.
  (str_strlen): don't use search_nonascii.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-16 02:55:08 +00:00
akr 125c0a0d93 * lib/require_relative.rb: check require_relative call in eval.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-16 02:46:27 +00:00
naruse 9a431fd58c * ruby.c (process_options): set default_external before loading
libraries. [ruby-dev:33801]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-15 23:03:22 +00:00
naruse a2d85d61bd * enc/iso_8859_{4,13}.c: Windows-1257 is replica of ISO-8859-13.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-15 20:55:27 +00:00
naruse fc46d89b6d * ChangeLog
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15494 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-15 20:42:34 +00:00
naruse 132e3f54f2 * string.c (single_byte_optimizable): rb_enc_mbminlen must be 1
when rb_enc_mbmaxlen is 1.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-15 20:41:29 +00:00
akr 0831222a91 * encoding.c (rb_enc_nth): moved to string.c.
* string.c (rb_enc_nth): moved from string.c.  use search_nonascii
  for ASCII compatible string.
  (str_nth): wrong optimization removed to fix
  "a".force_encoding("EUC-JP").slice!(0,10) returns
  "a\x00\x00\x00\x00\x00\x00\x00\x00\x00"


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-15 18:48:27 +00:00
akr 0040ed4020 add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15491 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-15 18:16:14 +00:00
nobu 9c0be2d516 * range.c (rb_range_beg_len): check if responds to "begin" and "end"
methods for non-Range object.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-15 15:21:51 +00:00
suke 41ca14e8ac * ext/win32ole/win32ole.c (ole_init_cp): initialize WIN32OLE.codepage
according to Encoding.default_external.

* test/win32ole/test_win32ole.rb: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15488 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-15 11:36:24 +00:00
nobu a05337f14d * string.c (rb_str_sub_bang, str_gsub): allows hash for replacement.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15487 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-15 09:23:55 +00:00
matz 8b09f7015a * string.c (str_strlen): use search_nonascii() for performance.
* string.c (str_nth): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-15 08:14:40 +00:00
matz 878bbd1199 * io.c (open_key_args): allow specifying both :mode and :encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-15 07:35:11 +00:00
akr 12b1578cab * string.c (rb_str_getbyte): new method.
(rb_str_setbyte): new method.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15484 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-15 06:35:20 +00:00
akr b0333388ab * lib/require_relative.rb: new file.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15483 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-15 06:29:32 +00:00
nobu 748beee825 * ext/iconv/iconv.c (iconv_convert): check upper bound. a patch from
Daniel Luz at [ruby-Bugs-17910].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-15 06:23:14 +00:00
nobu 17fb1248af * re.c (rb_reg_quote): set US-ACII for ASCII-only string.
[ruby-dev:33785]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15481 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-15 01:35:56 +00:00
nobu 5b7bdd56ad * {win,bcc}32/Makefile.sub (config.h): added HAVE_FTRUNCATE.
[ruby-dev:33786]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-15 01:27:48 +00:00
nobu 04e7cc6411 * parse.y (reg_compile_gen): reg_fragment_setenc might not raise an
exception before rb_reg_compile.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-15 00:44:13 +00:00
drbrain ab3e8e6143 Preserve ri compatibility with 1.8
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-14 22:38:20 +00:00
nobu 4804658649 * configure.in (ftruncate): check if available.
* file.c (rb_file_truncate): check if ftruncate instead of truncate.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-14 17:42:27 +00:00
nobu 82f631ac57 * configure.in (sigsetmask): check when signal semantics is not POSIX.
* signal.c (USE_TRAP_MASK): set true if sigprocmask or sigsetmask is
  available.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15476 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-14 17:40:56 +00:00
nobu 67d0ce36f5 * parse.y (reg_compile_gen): appends error message from
rb_reg_compile() to one from reg_fragment_setenc().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15475 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-14 14:56:40 +00:00
nobu 5aa388c23c * eval_error.c (error_print): append a newline to rest lines.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-14 14:51:08 +00:00
akr 433fbebfbc * io.c (io_reopen): check STDIN, STDOUT and STDERR mode according to
stdio streams.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-14 12:01:50 +00:00
akr a5c05a9ace add a test for [ruby-dev:33072].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-14 08:23:56 +00:00
matz c4b18d3cc5 * test/ruby/test_math.rb: actual-expected argument ordering for
test_math.rb fixed.  a patch from Tadashi Saito
  <shiba AT mail2.accsnet.ne.jp> in [ruby-dev:33770].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-14 07:09:36 +00:00
nobu 3a9bf2f124 * file.c (rb_file_s_utime): inhibits with secure level 2 or higher.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-14 07:02:54 +00:00
akr 23db145b07 add a test for named class in regexp.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15467 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-14 06:01:05 +00:00
akr bf88192354 more tests for embedding regexps.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-14 05:03:07 +00:00
akr ec4756f633 * re.c (rb_reg_preprocess_dregexp): use non-preprocessed regexp source
for result.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-14 03:34:12 +00:00
nobu 8435c6bb8c * lib/timeout.rb (Timeout::timeout): made sensitive to location on the
stack.  [ruby-core:15458]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-13 16:43:18 +00:00