matz
0472db84c5
* range.c (range_include): specialize single character string
...
case (e.g. (?a ..?z).include(?x)) for performance.
[ruby-core:15481]
* string.c (rb_str_upto): specialize single character case.
* string.c (rb_str_hash): omit coderange scan for performance.
* object.c (rb_check_to_integer): check Fixnum first.
* object.c (rb_to_integer): ditto.
* string.c (rb_str_equal): inline memcmp to avoid unnecessary
rb_str_comparable().
* parse.y (rb_intern2): use US-ASCII encoding.
* parse.y (rb_intern_str): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15433 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-11 17:46:52 +00:00
akr
8f9fb1a820
* string.c (rb_str_new4): copy encoding from orig, instead of shared
...
one.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-09 01:04:29 +00:00
nobu
1809782c3e
* string.c (rb_str_replace): makes frozen shared string before
...
sharing.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-07 10:11:40 +00:00
nobu
fb506c3000
* string.c (rb_str_dup): reverted unneeded change. [ruby-dev:33634]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-07 09:57:06 +00:00
nobu
89941dffb5
* string.c (str_replace_shared): replaces string with sharing.
...
* string.c (rb_str_new4, rb_str_associate, rb_str_associated): allows
associated strings shared.
* string.c (rb_str_dup, rb_str_substr, rb_str_replace): shares memory.
[ruby-core:15400]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-07 07:33:50 +00:00
nobu
6c6ae98663
* string.c (rb_str_end_with): compares with the suffix.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-07 06:42:44 +00:00
akr
84fe384383
* string.c (rb_str_succ): use wrapped character as a carry for
...
ASCII incompatible encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-30 05:29:37 +00:00
naruse
3c6969ec11
* string.c, parse.y, re.c: use rb_ascii8bit_encoding.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-28 09:03:09 +00:00
akr
fc208c1bd5
* include/ruby/oniguruma.h: precise mbclen API redesigned to avoid
...
inline functions.
(onigenc_mbclen_charfound): removed.
(onigenc_mbclen_needmore): removed.
(onigenc_mbclen_recover): removed.
(ONIGENC_MBCLEN_CHARFOUND): removed.
(ONIGENC_MBCLEN_CHARFOUND_P): defined.
(ONIGENC_MBCLEN_CHARFOUND_LEN): defined.
(ONIGENC_MBCLEN_INVALID): removed.
(ONIGENC_MBCLEN_INVALID_P): defined.
(ONIGENC_MBCLEN_NEEDMORE): removed.
(ONIGENC_MBCLEN_NEEDMORE_P): defined.
(ONIGENC_MBCLEN_NEEDMORE_LEN): defined.
(ONIGENC_MBC_ENC_LEN): use onigenc_mbclen_approximate.
* regenc.c (onigenc_mbclen_approximate): defined.
* include/ruby/encoding.h (MBCLEN_CHARFOUND): removed.
(MBCLEN_INVALID): removed.
(MBCLEN_NEEDMORE): removed.
(MBCLEN_CHARFOUND_P): defined.
(MBCLEN_INVALID_P): defined.
(MBCLEN_NEEDMORE_P): defined.
(MBCLEN_CHARFOUND_LEN): defined.
(MBCLEN_NEEDMORE_LEN): defined.
* encoding.c: use new API.
* re.c: ditto.
* string.c: ditto.
* parse.y: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-27 14:27:07 +00:00
akr
b8b0f6fd46
* string.c (rb_str_inspect): avoid exception by
...
"\#\xa1".force_encoding("euc-jp").inspect.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15272 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-27 11:09:41 +00:00
akr
36b4d1a1dc
* string.c (rb_str_succ): warning suppressed.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-27 10:08:58 +00:00
akr
b1e6c052cd
* string.c (rb_str_succ): don't increment/decrement codepoint.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-27 08:21:24 +00:00
naruse
df17bd4313
* string.c (rb_str_new): set US-ASCII and ENC_CODERANGE_7BIT when
...
empty string (len == 0).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15247 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-26 00:18:50 +00:00
naruse
42dcda08ae
* string.c (rb_str_usascii_new{,2}: defined.
...
(rb_str_new): set US-ASCII and ENC_CODERANGE_7BIT when empty
string.
* encoding.c (rb_usascii_encoding, rb_usascii_encindex): defined.
(rb_enc_inspect, enc_name, rb_locale_charmap, rb_enc_name_list_i):
use rb_str_ascii_new.
* array.c (recursive_join, inspect_ary): ditto.
* object.c (nil_to_s, nil_inspect, true_to_s, false_to_s,
rb_mod_to_s): ditto.
* hash.c (inspect_hash, rb_hash_inspect, rb_f_getenv, env_fetch,
env_clear, env_to_s, env_inspect): ditto.
* numeric.c (flo_to_s, int_chr, rb_fix2str): ditto.
* bignum.c (rb_big2str): ditto.
* file.c (rb_file_ftype, rb_file_s_dirname, rb_file_s_extname,
file_inspect_join, Init_file): ditto.
* test/ruby/test_ruby_m17n.rb: add checks for encoding of string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-25 16:40:02 +00:00
akr
3a783ba707
* string.c (rb_str_buf_cat_ascii): use rb_enc_cr_str_buf_cat.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-25 12:50:12 +00:00
akr
1e41069754
* include/ruby/intern.h (rb_str_buf_cat_ascii): declared.
...
* string.c (rb_str_buf_cat_ascii): defined.
* re.c (rb_reg_s_union): use rb_str_buf_cat_ascii to support ASCII
incompatible encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-25 07:35:27 +00:00
akr
968e404220
* string.c (rb_enc_cr_str_buf_cat): ASCII incompatible encoding is
...
not compatible with any other encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-24 02:17:26 +00:00
matz
9580a9ca91
* string.c (rb_str_each_line): use memchr(3) for faster newline
...
search.
* io.c (appendline): remove unused arguments
* io.c (rb_io_getline_fast): make much simpler (and faster).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-23 18:43:51 +00:00
nobu
e94ece76d8
* string.c (str_make_independent): should set length.
...
* string.c (rb_str_associate): hide associated array from ObjectSpace.
* string.c (rb_str_associated): return associated array with freezing
instead of false. [ruby-dev:33282]
* string.c (rb_str_freeze): freeze associated array together.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-23 06:04:13 +00:00
nobu
0c8106ded6
* string.c (str_mod_check, str_nth, str_offset): consitfied.
...
* string.c (rb_str_dump): dump in ASCII-8BIT always.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-23 02:53:28 +00:00
matz
65a8185eb2
* configure.in (MINIRUBY): remove -I$(EXTOUT)/$(arch) from
...
MINIRUBY since miniruby might not be able to load DLL.
* test/ruby/test_m17n.rb: move tests from bootstrap test.
* encoding.c (enc_find): should check name if ASCII compatible.
* string.c (rb_str_end_with): should check character boundary.
* encoding.c (rb_enc_compatible): encoding must be ASCII
compatible before checking ENC_CODERANGE_7BIT.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-22 03:59:53 +00:00
nobu
157664b9f3
* string.c (rb_str_each_char): iterates over a shadow.
...
[ruby-dev:33243]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-22 00:26:49 +00:00
matz
56be84e293
* parse.y (rb_intern3): do not call rb_enc_mbclen() if *m is
...
ASCII. [ruby-talk:287225]
* string.c (rb_str_each_line): use rb_enc_is_newline() to gain
performance if the record separator ($/) is not modified.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-21 19:47:26 +00:00
nobu
76e19bc534
* string.c (rb_str_each_char): move forward. [ruby-dev:33231]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15149 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-21 02:59:02 +00:00
nobu
ea64014c56
* string.c (rb_str_each_char): advance offset before get next char
...
length. [ruby-dev:33211]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-20 18:45:51 +00:00
nobu
00190701e0
* string.c (rb_str_each_char): performance improvement, and stop if
...
shortened in the block. [ruby-dev:33189]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-20 04:06:03 +00:00
akr
35a4fb5ef6
* string.c (coderange_scan): don't call mbclen functions for ASCII
...
characters with ASCII compatible encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-19 13:42:50 +00:00
matz
c58736dbdc
* string.c (rb_str_dump): preserve the encoding of source string
...
if it is ASCII compatible. otherwise, add '.force_encoding()'
for ugly work around. maybe we should implement some other way
to keep non ASCII encoding in dumped string. [ruby-dev:33142]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15108 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-18 04:49:14 +00:00
akr
e350fe247a
* string.c (string.c): call rb_str_buf_append to update encoding of
...
str1, even if str2 is empty.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-11 14:26:26 +00:00
nobu
1267156698
* string.c (rb_str_append): performance improvement.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-11 07:55:23 +00:00
akr
0ada40e2b1
update rdoc: force_encoding doesn't accept nil.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-11 06:03:51 +00:00
akr
8786b8a282
* string.c (rb_enc_cr_str_buf_cat): fix self appending.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-09 08:00:26 +00:00
nobu
9874fdbc86
* string.c (rb_enc_cr_str_buf_cat, rb_str_buf_append): deal with self
...
appending.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-09 05:52:20 +00:00
matz
251dec5cf1
* string.c (rb_enc_cr_str_buf_cat): do not recalculate coderange
...
value if it's given from outside.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14960 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-09 04:07:11 +00:00
akr
389abf1b3b
* string.c (str_gsub): avoid appending empty pre-match substr.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-08 06:04:26 +00:00
akr
fc5a26c2d4
* string.c (rb_str_buf_append): fix append itself.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-07 22:57:00 +00:00
akr
7425f59f10
* string.c (STR_ENC_GET): defined. same as rb_enc_get without
...
enc_capable.
(coderange_scan): ASCII-8BIT test refined.
(rb_enc_cr_str_buf_cat): new internal function to accumulate
strings with encoding.
(rb_enc_str_buf_cat): use rb_enc_cr_str_buf_cat.
(rb_str_buf_append): ditto
(str_gsub): use rb_str_buf_append.
(rb_str_hash): use ENCODING_GET.
(rb_str_comparable): ditto.
(rb_str_cmp): compare encoding index, not rb_encoding address.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-07 16:28:43 +00:00
matz
f2707db2dc
* string.c (Init_String): sym_match arity spec was wrong. a patch
...
from Hiroyuki Iwatsuki <don at na.rim.or.jp> in [ruby-dev:32957].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-07 10:12:45 +00:00
akr
3e2fe4a1eb
* string.c (str_gsub): move rb_enc_get(str) to out of loop.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14932 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-07 09:11:28 +00:00
akr
063beac343
* encoding.c (rb_enc_internal_get_index): extracted from
...
rb_enc_get_index.
(rb_enc_internal_set_index): extracted from rb_enc_associate_index
* include/ruby/encoding.h (ENCODING_SET): work over ENCODING_INLINE_MAX.
(ENCODING_GET): ditto.
(ENCODING_IS_ASCII8BIT): defined.
(ENCODING_CODERANGE_SET): defined.
* re.c (rb_reg_fixed_encoding_p): use ENCODING_IS_ASCII8BIT.
* string.c (rb_enc_str_buf_cat): use ENCODING_IS_ASCII8BIT.
* parse.y (reg_fragment_setenc_gen): use ENCODING_IS_ASCII8BIT.
* marshal.c (has_ivars): use ENCODING_IS_ASCII8BIT.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-07 02:49:01 +00:00
akr
9f808343c8
* string.c (coderange_scan): avoid rb_enc_to_index.
...
(rb_enc_str_buf_cat): ditto.
(str_cat_char): use rb_enc_str_buf_cat.
(rb_str_inspect): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-06 17:37:54 +00:00
akr
b2168c5a2a
* string.c (coderange_scan): optimize ASCII-8BIT string.
...
(rb_enc_str_buf_cat): don't call coderange_scan if possible.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14915 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-06 16:38:04 +00:00
akr
6cdef2dc7e
* $Date$ keyword removed to avoid inclusion of locale dependent
...
string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-06 15:49:38 +00:00
akr
8987b97ca9
* include/ruby/encoding.h (rb_enc_str_buf_cat): declared.
...
* string.c (coderange_scan): extracted from rb_enc_str_coderange.
(rb_enc_str_coderange): use coderange_scan.
(rb_str_shared_replace): copy encoding and coderange.
(rb_enc_str_buf_cat): new function for linear complexity string
accumulation with encoding.
(rb_str_sub_bang): don't conflict substituted part and replacement.
(str_gsub): use rb_enc_str_buf_cat.
(rb_str_clear): clear coderange.
* re.c (rb_reg_regsub): use rb_enc_str_buf_cat.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14910 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-06 09:25:09 +00:00
nobu
76c2550b5b
* string.c (rb_str_resize): copy if old data is not empty
...
[ruby-core:14785]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-05 07:50:50 +00:00
nobu
80de7a2fe1
* string.c (rb_str_resize): copy at old length but not new length.
...
[ruby-core:14785]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-05 05:45:40 +00:00
akr
8702c4d0d7
update rdoc.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-05 03:35:13 +00:00
matz
f3fa37e8e5
* string.c (trnext): should enable backslash escape.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-04 17:15:22 +00:00
matz
96e7713754
* string.c (rb_str_substr): offset movement bug. a patch from
...
Vincent Isambart <vincent.isambart at gmail.com> in
[ruby-core:14647]. [ruby-core:14644]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-01 05:16:49 +00:00
nobu
de3f2adb53
* string.c (rb_str_resize): embeds if ptr is null. [ruby-dev:32819]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14817 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-31 14:27:20 +00:00
akr
ca122fa53b
* string.c (IS_7BIT): removed.
...
(single_byte_optimizable): new function to test optimizationability
using single byte string.
(str_strlen): use single_byte_optimizable instead of
is_ascii_string.
(str_nth): rename argument: asc -> singlebyte.
(str_offset): ditto.
(rb_str_substr): use single_byte_optimizable instead of IS_7BIT.
(rb_str_index): ditto.
(rb_str_rindex): ditto.
(rb_str_splice): ditto.
(rb_str_justify): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-31 10:39:20 +00:00
akr
e21907e0f8
fix typos.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-31 05:52:59 +00:00
akr
486dd97e74
update force_encoding document.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-30 09:19:09 +00:00
nobu
5ee7f4b0b5
* re.c (rb_reg_regsub): returns the given string itself if nothing
...
changed.
* string.c (rb_str_sub_bang): keeps code-range as possible.
* string.c (str_gsub): adjusts code-range. [ruby-core:14566]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-29 13:44:32 +00:00
akr
ce2b982cd2
* encoding.c (rb_enc_codelen): show codepoint in error message.
...
* include/ruby/encoding.h (rb_enc_codelen): comment it returns
positive integer.
* string.c (rb_str_concat): rb_enc_codelen doesn't return 0.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-27 06:27:39 +00:00
nobu
6aef04f338
* string.c (rb_str_casecmp): fixed using a wrong variable.
...
[ruby-list:44402]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-27 06:02:55 +00:00
nobu
c2d54ce2a0
* string.c (Init_String): defines chars method.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-26 07:10:20 +00:00
nobu
0ee5a49dd4
* encoding.h (rb_enc_mbc_to_codepoint): wrapper for
...
ONIGENC_MBC_TO_CODE().
* string.c (rb_str_succ): deal with invalid sequence as binary.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-25 10:01:06 +00:00
akr
0eb5c917e0
* string.c (rb_str_each_line): don't call rb_enc_codepoint with empty
...
string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-25 09:28:31 +00:00
akr
ead329fd8e
* string.c (rb_str_inspect): don't call rb_enc_codepoint with empty
...
string. fix '#'.inspect.
* encoding.c (rb_enc_codepoint): raise on empty string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-25 09:07:32 +00:00
nobu
f1fc4bbecb
* string.c (rb_str_succ): fix for string with non-alphanumeric chars.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14673 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-25 06:55:16 +00:00
matz
a04a812ed0
* include/ruby/encoding.h (rb_enc_left_char_head): new utility macro.
...
* include/ruby/encoding.h (rb_enc_right_char_head): ditto.
* io.c (appendline): does multibyte RS search in the function.
* io.c (prepare_getline_args): RS may be nil.
* io.c (rb_io_getc): should process character based on external
encoding, when transcoding required.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-24 16:36:14 +00:00
matz
37855698ff
* string.c (rb_str_comparable): fixed to keep transitivity.
...
[ruby-dev:32693]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-24 02:40:55 +00:00
matz
19cf57f21c
* string.c (tr_trans): should associate new encoding if modified.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-23 20:13:55 +00:00
matz
65a0050268
* string.c (str_new_shared): was setting embedding flag of wrong
...
string object. [ruby-dev:32685]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-23 18:58:09 +00:00
matz
fa1e530063
* string.c (rb_str_comparable): comparison including broken
...
coderange strings do not consider encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-23 16:07:09 +00:00
nobu
e3897c538c
* string.c (sym_call): use exact argument array interface.
...
[ruby-core:14279]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-23 02:26:45 +00:00
akr
b2a1dc616c
add rdoc.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-22 08:38:53 +00:00
nobu
7f59e105d1
* string.c (rb_str_buf_append): improvement for non-broken coded
...
strings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 23:29:56 +00:00
nobu
977eea57a3
* string.c (rb_str_succ): retry increasing until valid char is found.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 11:09:19 +00:00
matz
3ec3412d83
* string.c (rb_str_chomp_bang): avoid unnecessary loop using
...
rb_enc_prev_char().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14392 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 04:03:19 +00:00
akr
2b62714866
* string.c (rb_str_is_ascii_only_p): new method ascii_only?.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 03:18:37 +00:00
akr
4cf437519f
* regerror.c, string.c, io.c, lib/getoptlong.rb, lib/net/imap.rb,
...
compile.c, sprintf.c, parse.y, ext/win32ole/win32ole.c,
ext/tk/sample/demos-en/entry3.rb, ext/tk/lib/tcltk.rb,
ext/openssl/ossl_bn.c, numeric.c, vm.c,
benchmark/bm_so_meteor_contest.rb, bignum.c, ruby.c: don't "illegal"
for non law violation context.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 02:31:11 +00:00
matz
cfb91bc2f5
* string.c (tr_trans): wrong encoding check for tree strings.
...
* test/ruby/test_m17n.rb (TestM17N::test_tr_s): "invalid mbstring
sequence" is not an error to be tested.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-20 15:27:35 +00:00
matz
1c32ff927f
* string.c (rb_str_index): wrong starting position.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-20 00:08:23 +00:00
matz
d874dde282
* string.c (rb_str_each_line): should consider rslen.
...
* string.c (rb_str_buf_append): should propagate encoding.
* string.c (rb_str_each_line): ditto.
* test/ruby/test_m17n.rb (TestM17N::test_str_each_line): should
check encoding as well.
* test/ruby/test_m17n.rb (TestM17N::test_str_each_line): empty
array can not propagate encoding; should not check.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-19 17:46:17 +00:00
matz
77629d2cbe
* string.c (rb_str_rindex_m): too much adjustment.
...
* re.c (reg_match_pos): pos adjustment should be based on
characters.
* test/ruby/test_m17n.rb (TestM17N::test_str_insert): test updated
to check negative offset behavior.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-19 17:02:29 +00:00
matz
a329b77348
* string.c (rb_str_rindex): comparison length should be based on
...
bytes, not characters.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-19 14:43:37 +00:00
matz
3e212b0484
* string.c (rb_str_chomp_bang): wrong adjust condition.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-19 14:38:46 +00:00
matz
1c7f24d5b1
* string.c (str_sublen): adjust position if position is not at the
...
head of a character.
* string.c (rb_str_chomp_bang): check if match start at the head
of a character.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14334 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-19 14:15:05 +00:00
nobu
474a88f041
* re.c (rb_reg_regsub): should set checked encoding.
...
* string.c (rb_str_sub_bang): applied r14212 too.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-19 12:42:19 +00:00
matz
ac5250098d
* string.c (rb_str_justify): should propagate encoding from pad
...
string too.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-19 06:15:35 +00:00
matz
ec69dddc0d
* string.c (rb_str_splice): propagate encoding.
...
* string.c (rb_str_subpat_set): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-18 09:14:46 +00:00
matz
a3a6ba9584
* string.c (str_nth): need not to raise out-of-range exception.
...
* test/ruby/test_m17n.rb (TestM17N::test_str_aref_len): removed
debug print.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-18 05:44:30 +00:00
matz
ebfcc5d933
* re.c (rb_reg_initialize): raise error if non-Unicode fixed
...
encoding option is specified for regexp literals with \u{}
escapes.
* string.c (rb_str_squeeze_bang): should squeeze multibyte
characters as well.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-17 16:06:21 +00:00
matz
d6a70c4bb7
* string.c (scan_once): need no encoding compatibility check.
...
it's done inside of re_reg_seach().
* string.c (rb_str_split_m): ditto.
* re.c (rb_reg_regsub): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-17 09:44:06 +00:00
matz
ea1b9d58b9
* string.c (rb_str_index): check if substring is broken.
...
* string.c (rb_str_rindex): ditto.
* string.c (rb_str_succ): should carry over.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-17 09:08:27 +00:00
akr
33ecb05d51
* string.c (rb_enc_str_asciionly_p): use rb_enc_str_coderange.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14263 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-17 08:08:23 +00:00
akr
0d0a8a55fc
* string.c (rb_enc_str_coderange): set ENC_CODERANGE_BROKEN using
...
rb_enc_precise_mbclen.
(rb_str_valid_encoding_p): just check coderange is
ENC_CODERANGE_BROKEN or not.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-17 07:41:21 +00:00
akr
3f07e548fc
* include/ruby/encoding.h (ENC_CODERANGE_VALID): rename from
...
ENC_CODERANGE_8BIT.
* string.c (rb_enc_str_coderange): follow the renaming.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14257 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-17 05:07:37 +00:00
matz
5a41626dea
* string.c (tr_find): wrong condition fixed.
...
* sprintf.c (rb_str_format): check encoding based on result, not
the format string.
* string.c (rb_str_upto): add encoding check.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14256 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-17 05:01:47 +00:00
matz
11f3462fb7
* io.c (rb_f_p): RDoc update. a patch from murphy <murphy AT rubychan.de>.
...
[ruby-core:14010]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-14 08:38:18 +00:00
matz
269bd16b28
* string.c (rb_str_cmp): encoding aware comparison.
...
* string.c (rb_str_casecmp): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14227 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-14 08:37:39 +00:00
matz
c958d9a9c6
* string.c (str_nth): direct jump if string is 7bit only. great
...
performance boost for worst case.
* string.c (str_strlen): direct size if string is 7bit only.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-13 18:00:50 +00:00
akr
9595af4ad5
* string.c (rb_str_shared_replace): make str noembed after free.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14215 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-13 11:52:15 +00:00
matz
7987f38467
* string.c (rb_str_succ): should not enter infinite loop for
...
non-ASCII, non-alphanumeric character at the bottom.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-13 09:20:13 +00:00
matz
66bae8ad6d
* string.c (str_gsub): should copy encoding to the result.
...
* sprintf.c (rb_str_format): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-13 09:05:49 +00:00
matz
fb14b7eb05
* string.c (rb_str_split_m): need not to check encoding if regexp
...
is empty.
* string.c (rb_str_justify): associate encoding of original to the
result.
* string.c (rb_str_chomp_bang): need to check encoding of record
separator.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14211 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-13 08:28:40 +00:00
akr
b92cee1ddb
* re.c, regerror.c, string.c, parse.y, ruby.c, file.c:
...
use capital letter for \xHH notation. [ruby-dev:32511]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-12 14:30:54 +00:00
nobu
ad72efa269
* re.c (rb_reg_regsub): should copy encoding.
...
* string.c (rb_str_sub_bang, str_gsub): should check and copy encoding
to be replaced.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-12 03:11:44 +00:00