matz
588d870234
* include/ruby/node.h (NODE_FL_NEWLINE): renamed from NODE_NEWLINE
...
to denote its a flag. [ruby-core:15529]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-18 05:33:01 +00:00
naruse
8dd8dfce21
* encoding.c (ENC_CODERANGE_AND): fix broken case. [ruby-dev:33826]
...
* string.c (rb_str_times): fix broken case. [ruby-dev:33826]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-17 13:01:52 +00:00
naruse
7a257b0110
* encoding.c (ENC_CODERANGE_AND): added.
...
* string.c (rb_str_plus, srb_str_times): keep coderange.
* parse.y (STR_NEW0) use rb_usascii_str_new.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-17 06:49:11 +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
akr
8f842d71e9
* include/ruby/ruby.h (RObject): add iv_index_tbl for shortcut of
...
RCLASS_IV_INDEX_TBL(rb_obj_class(obj)).
(ROBJECT_IV_INDEX_TBL): defined.
* object.c (init_copy): initialize iv_index_tbl in struct RObject.
* variable.c (ivar_get): use ROBJECT_IV_INDEX_TBL.
(rb_ivar_defined): ditto.
(obj_ivar_each): ditto.
(rb_obj_remove_instance_variable): ditto.
(rb_ivar_set): update iv_index_tbl in struct RObject.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15458 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-13 11:52:46 +00:00
matz
38694016bc
* string.c (rb_str_hash_cmp): lighter version of rb_str_cmp() for
...
hash comparison function.
* hash.c (rb_any_cmp): use rb_str_hash_cmp().
* string.c (rb_str_casecmp): should return nil for incompatible
comparison.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-12 03:17:43 +00:00
matz
f3ac3dc79c
* numeric.c (rb_num_coerce_bin): add ID argument to specify
...
caller's method name. [ruby-dev:33663]
* numeric.c (rb_num_coerce_cmp): ditto.
* numeric.c (rb_num_coerce_relop): ditto.
* ext/bigdecimal/bigdecimal.c (DoSomeOne): add function name argument.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-12 02:46:21 +00:00
akr
14373fc4db
* math.c (math_gamma): new method Math.gamma.
...
(math_lgamma): new method Math.lgamma.
* include/ruby/missing.h (tgamma): declared unless HAVE_TGAMMA.
(lgamma_r): declared unless HAVE_LGAMMA_R.
* configure.in (tgamma): check for replacement funtions.
(lgamma_r): ditto.
* missing/tgamma.c: new file. based on gamma.c from
"C-gengo niyoru saishin algorithm jiten" (New Algorithm handbook
in C language) (Gijyutsu hyouron sha, Tokyo, 1991)
by Haruhiko Okumura.
* missing/lgamma_r.c: ditto.
* LEGAL (missing/tgamma.c): describe as public domain.
(missing/lgamma_r.c): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15388 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-07 01:43:43 +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
nobu
1f7db0db75
* include/ruby/encoding.h (rb_usascii_encindex): added prototype.
...
* include/ruby/intern.h (rb_usascii_str_new, rb_usascii_str_new2):
ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-26 00:30:28 +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
nobu
5e7d638a4c
* include/ruby/encoding.h (rb_enc_is_newline): parenthesized arguments.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-24 09:19:44 +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
naruse
1ccb0642ed
* encoding.{c, h} (rb_usascii_encoding): added.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-23 16:03:29 +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
2402ecabb0
* file.c (sys_fail2): get rid of unlimited alloca.
...
* io.c (mode_enc, pipe_open, rb_io_s_popen): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-16 05:55:22 +00:00
nobu
ce2652c9d4
* include/ruby/intern.h (rb_str_tmp_new, rb_str_shared_replace):
...
prototype moved.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-16 03:51:32 +00:00
naruse
edc61cf4c1
* encoding.c (ENC_REGISTER): use &OnigEncoding*.
...
(ENCINDEX_UTF_8): renamed from ENCINDEX_UTF8.
(rb_enc_init): use ENC_REGISTER.
* include/ruby/oniguruma.h (OnigEncodingUTF8, ONIG_ENCODING_UTF8):
removed.
* enc/*.c: remove use of &encoding_*; use enc argument instead.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15067 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-15 13:36:18 +00:00
naruse
8f15b8128c
* include/ruby/oniguruma.h: remove ONIG_ENCODING_* and OnigEncoding*
...
which are not builtin.
* regenc.{c,h} (onigenc_mb2_code_to_mbclen, onigenc_mb4_code_to_mbclen):
fix prototype.
* enc/big5.c, enc/euc_kr.c, enc/euc_tw.c, enc/gb18030.c,
enc/koi8_r.c, enc/windows_1251.c: imported from Oniguruma.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-13 17:16:09 +00:00
nobu
82bf2c1ac7
* defines.h (WORDS_BIGENDIAN): honor __BIG_ENDIAN__ than the result of
...
configure.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14987 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-11 02:57:38 +00:00
naruse
ed540e8bdf
* encoding.c, Makefile.in, include/ruby/oniguruma.h,
...
enc/Makefile.in: fix rules for UTF-{16,32}{BE,LE}.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14956 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-08 13:35:24 +00:00
akr
4e4d4331ca
* include/ruby/oniguruma.h (OnigEncodingType): new member
...
ruby_encoding_index to avoid linear search in rb_enc_to_index.
* include/ruby/encoding.h (rb_enc_to_index): macro defined to use
ruby_encoding_index.
* encoding.c (rb_enc_to_index): removed.
(enc_register_at): initialize ruby_encoding_index member.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-07 07:48:24 +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
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
akr
9eab58ee03
* include/ruby/ruby.h (rb_intern): memorize interned ID for constant
...
string, using gcc's __builtin_constant_p and statement expression.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-04 17:21:53 +00:00
nobu
8638ee26e7
* include/ruby/intern.h, re.c (rb_reg_new): keep interface same as
...
1.8. [ruby-core:14583]
* include/ruby/intern.h, re.c (rb_reg_new_str): renamed, and defines
HAVE_RB_REG_NEW_STR macro to tell if it is available.
* include/ruby/encoding.h (rb_enc_reg_new): added.
* insns.def (toregexp), marshal.c (r_object0): use rb_reg_new_str().
* re.c (rb_reg_regcomp, rb_reg_s_union): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-04 16:30:33 +00:00
akr
e395327e8e
parenthesize macro arguments.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14882 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-04 09:41:44 +00:00
nobu
97751bbd5a
* win32.h: only VC6 needs extern "C++" for math.h. [ruby-talk:285660]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14875 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-03 16:20:29 +00:00
matz
52ed8c4edd
* include/ruby/oniguruma.h: Oniguruma 1.9.1 merged.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-03 15:55:04 +00:00
akr
b661bfe319
* include/ruby/ruby.h (st_strcasecmp): declared for STRCASECMP.
...
(st_strncasecmp): declared for STRNCASECMP.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-03 12:57:26 +00:00
akr
b1d373308f
* regenc.h (onigenc_ascii_is_code_ctype): put back.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-03 08:56:08 +00:00
akr
5f237d7903
* encoding.c (rb_isalnum): defined.
...
(rb_isalpha): ditto.
(rb_isblank): ditto.
(rb_iscntrl): ditto.
(rb_isdigit): ditto.
(rb_isgraph): ditto.
(rb_islower): ditto.
(rb_isprint): ditto.
(rb_ispunct): ditto.
(rb_isspace): ditto.
(rb_isupper): ditto.
(rb_isxdigit): ditto.
(rb_tolower): ditto.
(rb_toupper): ditto.
* include/ruby/ruby.h: don't include include/ruby/encoding.h.
(rb_isascii): defined.
(rb_isalnum): declared.
(rb_isalpha): ditto.
(rb_isblank): ditto.
(rb_iscntrl): ditto.
(rb_isdigit): ditto.
(rb_isgraph): ditto.
(rb_islower): ditto.
(rb_isprint): ditto.
(rb_ispunct): ditto.
(rb_isspace): ditto.
(rb_isupper): ditto.
(rb_isxdigit): ditto.
(rb_tolower): ditto.
(rb_toupper): ditto.
(ISASCII): simplified.
(ISPRINT): ditto.
(ISSPACE): ditto.
(ISUPPER): ditto.
(ISLOWER): ditto.
(ISALNUM): ditto.
(ISALPHA): ditto.
(ISDIGIT): ditto.
(ISXDIGIT): ditto.
(TOUPPER): ditto.
(TOLOWER): ditto.
* include/ruby/encoding.h (rb_isascii): removed.
(rb_isalnum): ditto.
(rb_isalpha): ditto.
(rb_isblank): ditto.
(rb_iscntrl): ditto.
(rb_isdigit): ditto.
(rb_isgraph): ditto.
(rb_islower): ditto.
(rb_isprint): ditto.
(rb_ispunct): ditto.
(rb_isspace): ditto.
(rb_isupper): ditto.
(rb_isxdigit): ditto.
(rb_tolower): ditto.
(rb_toupper): ditto.
* common.mk: dependency updated.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-03 08:44:01 +00:00
akr
155fda385e
* include/ruby/encoding.h (rb_isascii): simplified.
...
(rb_isalnum): call onigenc_ascii_is_code_ctype without indirect call.
(rb_isalpha): ditto.
(rb_isblank): ditto.
(rb_iscntrl): ditto.
(rb_isdigit): ditto.
(rb_isgraph): ditto.
(rb_islower): ditto.
(rb_isprint): ditto.
(rb_ispunct): ditto.
(rb_isspace): ditto.
(rb_isupper): ditto.
(rb_isxdigit): ditto.
* include/ruby/oniguruma.h (onigenc_ascii_is_code_ctype): declaration
moved from regenc.h.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14864 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-03 06:13:31 +00:00
akr
0352d32f05
* util.c (ruby_strtoul): locale independent strtoul is implemented to
...
avoid "i".to_i(36) cause 0 under tr_TR locale.
This is newly implemented, not a copy of missing/strtoul.c.
* include/ruby/ruby.h (ruby_strtoul): declared.
(STRTOUL): defined to use ruby_strtoul.
* bignum.c, pack.c, ext/socket/socket.c: use STRTOUL.
* configure.in (strtoul): don't check.
* missing/strtoul.c: removed.
* include/ruby/missing.h (strtoul): removed.
* common.mk (strtoul.o): removed.
* LEGAL (missing/strtoul.c): removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-02 06:24:27 +00:00
akr
aac5220c66
* include/ruby/missing.h (strcasecmp): removed.
...
(strncasecmp): removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-02 05:41:47 +00:00
akr
041e829127
* include/ruby/encoding.h (rb_isascii): defined.
...
(rb_isalnum): ditto.
(rb_isalpha): ditto.
(rb_isblank): ditto.
(rb_iscntrl): ditto.
(rb_isdigit): ditto.
(rb_isgraph): ditto.
(rb_islower): ditto.
(rb_isprint): ditto.
(rb_ispunct): ditto.
(rb_isspace): ditto.
(rb_isupper): ditto.
(rb_isxdigit): ditto.
(rb_tolower): ditto.
(rb_toupper): ditto.
* include/ruby/st.h (st_strcasecmp): declared.
(st_strncasecmp): ditto.
* st.c (type_strcasehash): use st_strcasecmp instead of strcasecmp.
(st_strcasecmp): defined.
(st_strncasecmp): ditto.
* include/ruby/ruby.h: include include/ruby/encoding.h.
(ISASCII): use rb_isascii.
(ISPRINT): use rb_isprint.
(ISSPACE): use rb_isspace.
(ISUPPER): use rb_isupper.
(ISLOWER): use rb_islower.
(ISALNUM): use rb_isalnum.
(ISALPHA): use rb_isalpha.
(ISDIGIT): use rb_isdigit.
(ISXDIGIT): use rb_isxdigit.
(TOUPPER): defined.
(TOLOWER): ditto.
(STRCASECMP): ditto.
(STRNCASECMP): ditto.
* dir.c, encoding.c, file.c, hash.c, process.c, ruby.c, time.c,
transcode.c, ext/readline/readline.c: use locale insensitive
functions. [ruby-core:14662]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14829 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-01 12:24:04 +00:00
nobu
3d0260cc94
* include/ruby/encoding.h (rb_enc_sprintf, rb_enc_vsprintf): prototyped.
...
* sprintf.c (rb_enc_sprintf, rb_enc_vsprintf): new functions to format
arguments with encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-30 21:08:36 +00:00
akr
1c0416e6ee
* ext/strscan/strscan.c (str_new): new function for allocate an string
...
with encoding propagation.
(extract_range): use str_new.
(extract_beg_len): ditto.
(strscan_peek): ditto.
(strscan_rest): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-28 14:55:43 +00:00
akr
371977ff3d
* encoding.c (rb_locale_encoding): defined.
...
* include/ruby/encoding.h (rb_locale_encoding): declared.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-28 10:12:13 +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
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
shugo
8e4c6d8482
* vm.c (rb_frame_method_id_and_class): new function to get the
...
method id and class of the current frame.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-25 08:49:09 +00:00
ko1
b79c868296
* include/ruby/ruby.h, thread.c: rename is_ruby_native_thread() to
...
ruby_native_thread_p().
* ext/tk/tcltklib.c: apply it.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-25 07:28:51 +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
akr
30f1eb1856
* include/ruby/intern.h, random.c, array.c:
...
change exported name.
genrand_int32 -> rb_genrand_int32.
genrand_real -> rb_genrand_real.
[ruby-core:14335]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14588 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-24 08:19:28 +00:00
nobu
efed292c43
* load.c (rb_feature_p): returns loading path name too.
...
* load.c (search_required): returns path too if feature is being
loaded. [ruby-dev:32048] [TODO: refactoring]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-24 08:06:16 +00:00
akr
80e38ad66b
comment updated.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-23 15:19:23 +00:00
akr
cf36df97fb
* encoding.c (rb_enc_codepoint): implemented to raise invalid
...
encoding.
* include/ruby/encoding.h (rb_enc_codepoint): macro is replaced as a
declaration.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-23 14:06:00 +00:00
akr
5b809a28f8
* include/ruby/encoding.h, encoding.c, re.c, io.c, parse.y, numeric.c,
...
ruby.c, transcode.c: rename rb_ascii_encoding. to
rb_ascii8bit_encoding. rb_ascii_encoding is ambiguous with
ASCII-8BIT and US-ASCII.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-22 23:47:18 +00:00
davidflanagan
b83cbb0c7c
* io.c, io.h: temporary patch to partially implement transcode-on-read and transcode-on-write
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-22 16:21:09 +00:00
nobu
aefc34a041
* common.mk (encs, ext/ripper/ripper.c): needs MFLAGS.
...
* configure.in (STRINGIZE): stringizing macro.
* include/ruby/defines.h (STRINGIZE): fallback.
* tool/make-snapshot: new file.
* version.c (ruby_description, ruby_copyright): string constants for
-v option.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-22 06:14:50 +00:00
matz
d7cc14d436
* encoding.c (rb_ascii_encoding): renamed from previous
...
rb_default_encoding().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 18:55:30 +00:00
nobu
7c2ae80d70
* include/ruby/ruby.h (rb_catch_obj, rb_throw_obj): prototyped.
...
* include/ruby/intern.h (rb_fiber_alive_p): prototyped.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 11:13:53 +00:00
nobu
5f2e5c07a7
* encoding.c (rb_enc_replicate): now creates first class encoding.
...
* encoding.c (rb_define_dummy_encoding): always based on the default
encoding.
* encoding.c (rb_enc_dummy_p): check if dummy.
* encoding.c (enc_inspect): shows if dummy.
* encoding.c (Init_Encoding): added dummy? method
* include/ruby/encoding.h (ENCODING_INLINE_MAX): increased.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14429 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 11:00:04 +00:00
nobu
e791259e00
* enumerator.c (enumerator_iter_i): adjusted for rb_block_call_func.
...
* include/ruby/ruby.h (rb_block_call_func): function to be called back
as block.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 07:33:31 +00:00
nobu
12df6cf7ce
* encoding.c (rb_enc_init): use enc_register_at() directly.
...
* encoding.c (rb_utf8_encoding): returns utf-8 encoding.
* include/ruby/encoding.h (rb_utf8_encoding): prototyped.
* parse.y (UTF8_ENC): uses rb_utf8_encoding().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 06:59:48 +00:00
akr
0530cf9ff8
* encoding.c: include locale.h
...
(rb_locale_charmap): new method Encoding.locale_charmap for
nl_langinfo(CODESET).
* include/ruby/encoding.h (rb_locale_charmap): declared.
* main.c (main): call setlocale with LC_CTYPE.
* ruby.c (locale_encoding): use rb_locale_charmap.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 02:52:23 +00:00
matz
2521b33ed7
* object.c (rb_obj_freeze): preserve frozen state of immediate
...
values in internal hash table, a la generic_ivar.
* object.c (rb_obj_frozen_p): check immediate values too.
* variable.c (generic_ivar_set): add frozen check fro immediate
values.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-18 08:28:39 +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
266d186bcf
* include/ruby/io.h (MakeOpenFile): fptr->enc should be
...
intialized to zero. [ruby-dev:32569]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-13 04:10:24 +00:00
akr
646f27b822
* encoding.c (rb_enc_ascget): renamed from rb_enc_get_ascii.
...
* include/ruby/encoding.h: follow the renaming.
* re.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-11 07:39:16 +00:00
akr
5802768b40
* encoding.c (rb_enc_get_ascii): add an argument to provide the
...
length of the returned character.
* include/ruby/encoding.h (rb_enc_get_ascii): add the argument.
* re.c (rb_reg_expr_str): modify rb_enc_get_ascii call.
(rb_reg_quote): ditto.
(rb_reg_regsub): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-11 03:08:50 +00:00
akr
9ee1ab0e28
* include/ruby/oniguruma.h (ONIGENC_CONSTRUCT_MBCLEN_NEEDMORE):
...
parenthesize an argument.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-11 00:41:56 +00:00
nobu
6d7999c132
* transcode.c (str_transcode): allow non-registered encodings.
...
[ruby-dev:32520]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14182 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-10 12:47:55 +00:00
matz
9d8075b99c
* parse.y (expr): redefinable not (!) operator.
...
* parse.y (arg): ditto.
* object.c (rb_obj_not): new method "!".
* object.c (rb_obj_not_equal): new method "!=".
* object.c (rb_obj_not_match): new method "!~".
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-09 16:39:49 +00:00
akr
3a8f7f1d7f
* include/ruby/ruby.h (FilePathStringValue): defined. similar to
...
FilePathValue but no taint check.
* file.c (rb_get_path_no_checksafe): implementation of
FilePathStringValue.
(rb_file_s_basename): use FilePathStringValue.
(rb_file_s_dirname): ditto.
(rb_file_s_extname): ditto.
(rb_file_s_split): ditto.
(rb_file_join): ditto.
* dir.c (file_s_fnmatch): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-09 05:12:31 +00:00
akr
f1b7e60cb9
* encoding.c (rb_enc_mbclen): make it never fail.
...
(rb_enc_nth): don't check the return value of rb_enc_mbclen.
(rb_enc_strlen): ditto.
(rb_enc_precise_mbclen): return needmore(1) if e <= p.
(rb_enc_get_ascii): new function for extracting ASCII character.
* include/ruby/encoding.h (rb_enc_get_ascii): declared.
* include/ruby/regex.h (ismbchar): removed.
* re.c (rb_reg_expr_str): use rb_enc_get_ascii.
(unescape_escaped_nonascii): use rb_enc_precise_mbclen to determine
the termination of escaped non-ASCII character.
(unescape_nonascii): use rb_enc_precise_mbclen.
(rb_reg_quote): use rb_enc_get_ascii.
(rb_reg_regsub): use rb_enc_get_ascii.
* string.c (rb_str_reverse) don't check the return value of
rb_enc_mbclen.
(rb_str_split_m): don't call rb_enc_mbclen with e <= p.
* parse.y (is_identchar): use ISASCII.
(parser_ismbchar): removed.
(parser_precise_mbclen): new macro.
(parser_isascii): new macro.
(parser_tokadd_mbchar): use parser_precise_mbclen to check invalid
character precisely.
(parser_tokadd_string): use parser_isascii.
(parser_yylex): ditto.
(is_special_global_name): don't call is_identchar with e <= p.
(rb_enc_symname_p): ditto.
[ruby-dev:32455]
* ext/tk/sample/tkextlib/vu/canvSticker2.rb: remove coding cookie
because the encoding is not UTF-8. [ruby-dev:32475]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-08 02:50:43 +00:00
akr
69406aad50
* encoding.c (rb_enc_precise_mbclen): new function for mbclen with
...
validation.
* include/ruby/encoding.h (rb_enc_precise_mbclen): declared.
(MBCLEN_CHARFOUND): new macro.
(MBCLEN_INVALID): new macro.
(MBCLEN_NEEDMORE): new macro.
* include/ruby/oniguruma.h (OnigEncodingTypeST): replace mbc_enc_len
by precise_mbc_enc_len.
(ONIGENC_PRECISE_MBC_ENC_LEN): new macro.
(ONIGENC_CONSTRUCT_MBCLEN_CHARFOUND): new macro.
(ONIGENC_CONSTRUCT_MBCLEN_INVALID): new macro.
(ONIGENC_CONSTRUCT_MBCLEN_NEEDMORE): new macro.
(ONIGENC_MBCLEN_CHARFOUND): new macro.
(ONIGENC_MBCLEN_INVALID): new macro.
(ONIGENC_MBCLEN_NEEDMORE): new macro.
(ONIGENC_MBC_ENC_LEN): use ONIGENC_PRECISE_MBC_ENC_LEN.
* enc/euc_jp.c: validation implemented.
* enc/sjis.c: ditto.
* enc/utf8.c: ditto.
* string.c (rb_str_inspect): use rb_enc_precise_mbclen for invalid
encoding.
(rb_str_valid_encoding_p): new method String#valid_encoding?.
* io.c (rb_io_getc): use rb_enc_precise_mbclen.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-06 09:28:26 +00:00
akr
7ff702406a
* include/ruby/intern.h (rb_uv_to_utf8): declared.
...
* re.c (rb_reg_preprocess): new function for dynamic regexp with
\u{} such as Regexp.new("\\u{6666}").
(rb_reg_prepare_re): preprocess regexp for recompiling.
(read_escaped_byte): new function.
(unescape_escaped_nonascii): new function.
(append_utf8): new function.
(unescape_unicode_list): new function.
(unescape_unicode_bmp): new function.
(unescape_nonascii): new function.
(rb_reg_initialize): preprocess regexp.
* pack.c (rb_uv_to_utf8): renamed from uv_to_utf8.
* parse.y (STR_NEW3): take func instead of has8 and hasmb.
(parser_str_new): use default coderange mechanism except for regexp.
(parser_tokadd_utf8): copy regexp source as-is.
(parser_read_escape): UTF-8 stuff removed.
(parser_tokadd_escape): has8bit and hasmb removed.
(parser_tokadd_string): fix 8-bit single byte character with \u.
(parser_parse_string): has8bit and hasmb removed.
(parser_here_document): has8bit and hasmb removed.
(parser_yylex): call parser_tokadd_utf8 instead of read_escape for
UTF-8 character.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-01 16:56:19 +00:00
matz
d5bd9d1593
* encoding.c: rename primary_encoding -> default_external (encoding).
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-01 14:05:53 +00:00
ko1
6fafbfd63e
* insnhelper.ci (vm_yield_with_cfunc): fix to passing argc on third
...
parameter of IFUNC. [ruby-dev:32329]
* enumerator.c: fix to pass exact number of argument.
* eval.c (rb_yield_values2): added.
* include/ruby/ruby.h: ditto.
* bootstraptest/test_knownbug.rb: move a fixed test.
* bootstraptest/test_block.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14062 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-01 04:30:19 +00:00
matz
da42035b09
* signal.c (ruby_signal): use SA_SIGINFO if available.
...
[ ruby-Patches-6418 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-30 14:49:45 +00:00
matz
29c7c72e09
* signal.c (trap_signm): SIGVTALRM no longer used for green
...
thread. [ruby-talk:281318]
* signal.c (ruby_sig_finalize): do not install SIG_DFL handler if
previous handler is sighandler().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-30 14:08:58 +00:00
akr
f5ee0fd521
* include/ruby/encoding.h, encoding.c, re.c, string.c, parse.y:
...
rename ENC_CODERANGE_SINGLE to ENC_CODERANGE_7BIT.
rename ENC_CODERANGE_MULTI to ENC_CODERANGE_8BIT.
Because single byte 8bit character, such as Shift_JIS 1byte katakana,
is represented by ENC_CODERANGE_MULTI even if it is not multi byte.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-27 02:21:17 +00:00
akr
b2e60b2ce7
* include/ruby/encoding.h (rb_enc_str_asciionly_p): declared.
...
(rb_enc_str_asciicompat_p): defined.
* re.c (rb_reg_initialize_str): use rb_enc_str_asciionly_p.
(rb_reg_quote): return ascii-8bit string if the argument is
ascii-only to generate encoding generic regexp if possible.
(rb_reg_s_union): fix encoding handling. [ruby-dev:32094]
* string.c (rb_enc_str_asciionly_p): defined.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-25 13:25:34 +00:00
akr
0d89567252
* struct.c (rb_struct_alloc_noinit): new function.
...
(rb_struct_define_without_accessor): add allocator to the arguments.
* range.c (range_alloc): re-introduced using rb_struct_alloc_noinit.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-23 07:00:50 +00:00
akr
0dbdad7599
* struct.c (rb_struct_define_without_accessor): new function.
...
* range.c (range_alloc): removed.
(Init_Range): use rb_struct_define_without_accessor.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-23 04:35:53 +00:00
matz
d73f08d56d
* re.c (match_begin): should return offset by character.
...
[ruby-dev:32331]
* re.c (match_end): ditto.
* re.c (rb_reg_search): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-23 02:10:44 +00:00
ko1
01dacec2b4
* include/ruby/ruby.h: rename RFloat#double_value -> float_value.
...
* numeric.c, parse.y: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-20 11:35:12 +00:00
ko1
3453b2bd0e
* gc.h, vm_core.h: decl of rb_gc_save_machine_context()
...
should be at vm_core.h.
* include/ruby/ruby.h, intern.h: remove type rb_thread_t.
* include/ruby/intern.h: change rb_unblock_function_t,
rb_unblock_function_t.
* file.c, process.c: apply above changes.
* thread.c, thread_pthread.ci, thread_win32.ci: ditto.
* io.c: support blocking open (2). [ruby-core:13614]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-20 10:47:53 +00:00
usa
cae4fb76dc
* include/ruby/win32.h win32/win32.c (rb_w32_pipe_exec): use dual fd
...
instead of socketpair when mode is RDWR.
* io.c (pipe_open): pass &write_fd to rb_w32_pipe_exec().
* io.c (popen_redirect): define only when HAVE_FORK.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13978 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-20 04:04:51 +00:00
akr
0d8ac93f58
* include/ruby/io.h (rb_io_t): add tied_io_for_writing member.
...
* io.c: use tied_io_for_writing for duplex popen.
* gc.c: mark tied_io_for_writing.
* common.mk: gc.o depends io.h.
[ruby-dev:32205]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-20 03:16:53 +00:00
akr
a070c4fbe3
* configure.in: check struct timespec, clock_gettime, utimensat,
...
struct stat.st_atim,
struct stat.st_atimespec,
struct stat.st_atimensec,
struct stat.st_mtim,
struct stat.st_mtimespec,
struct stat.st_mtimensec,
struct stat.st_ctim,
struct stat.st_ctimespec,
struct stat.st_ctimensec.
* include/ruby/missing.h: provide struct timespec if not available.
* time.c: support nanosecond-resolution using struct timespec.
* include/ruby/intern.h: provide rb_time_nano_new.
* file.c (utime_internal): use utimensat if available.
(rb_file_s_utime): refactored.
(rb_f_test): use stat_atime, stat_mtime, stat_ctime.
(rb_stat_cmp): check tv_nsec.
(stat_atimespec): new function.
(stat_atime): ditto.
(stat_mtimespec): ditto.
(stat_mtime): ditto.
(stat_ctimespec): ditto.
(stat_ctime): ditto.
(rb_stat_atime): use stat_atime.
(rb_file_s_atime): ditto.
(rb_file_atime): ditto.
(rb_stat_mtime): use stat_mtime.
(rb_file_s_mtime): ditto.
(rb_file_mtime): ditto.
(rb_file_ctime): use stat_ctime.
(rb_file_s_ctime): ditto.
(rb_stat_ctime): ditto.
* variable.c (rb_copy_generic_ivar): clear clone's instance variables
if obj has no instance variable.
* marshal.c (w_object): dump instance variables of generated string
for TYPE_USERDEF, even if original object has instance variables.
* lib/time.rb (Time#xmlschema): use nsec instead of usec.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-19 09:09:38 +00:00
shugo
731aa0d0a8
* include/ruby/ruby.h: added some declarations for event hooks.
...
* lib/profile.rb: set VM::InstructionSequence.compile_option.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13946 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-16 07:29:44 +00:00
ko1
25c0cb981a
* include/ruby/ruby.h: introduce 2 macros:
...
RFLOAT_VALUE(v), DOUBLE2NUM(dbl).
Rename RFloat#value -> RFloat#double_value.
Do not touch RFloat#double_value directly.
* bignum.c, insns.def, marshal.c, math.c, numeric.c, object.c,
pack.c, parse.y, process.c, random.c, sprintf.c, string.c,
time.c: apply above changes.
* ext/dl/mkcallback.rb, ext/json/ext/generator/generator.c:
ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-13 16:00:53 +00:00
nobu
00befb4b3f
* encoding.c (rb_enc_compatible): check if two objects have compatible
...
encodings.
* encoding.c (enc_compatible_p): added Encoding.compatible?.
* include/ruby/encoding.h (rb_enc_compatible): prototype.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-22 01:57:08 +00:00
nobu
b2c81746ac
* encoding.c (rb_enc_default, rb_enc_primary): return pointers to
...
rb_encoding of default and primary respectively. [ruby-core:12795]
* encoding.c (set_primary_encoding): removed primary_encoding setter.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-21 09:29:19 +00:00
matz
fada885be6
* range.c (range_first): takes first n element if argument is
...
given. [ruby-core:12697]
* range.c (range_last): returns last n elements if argument is
given.
* array.c (rb_ary_subseq, rb_ary_last): export.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-18 06:58:35 +00:00
nobu
3cd040b6ef
* encoding.c (rb_primary_encoding): added Encoding.primary_encoding.
...
* parse.y (rb_parser_encoding): added.
* ruby.c (proc_options): added -E and --encoding options.
* ruby.c (process_options): set primary encoding from command line
option if set, or source encoding.
* include/ruby/encoding.h (rb_enc_from_encoding,
rb_get_primary_encoding, rb_set_primary_encoding): prototypes.
* include/ruby/node.h (rb_parser_encoding): prototype.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-16 20:07:20 +00:00
nobu
9c24fed339
* encoding.c (rb_cEncoding): new Encoding class.
...
* encoding.c (rb_to_encoding, rb_to_encoding_index): helper functions.
* encoding.c (rb_obj_encoding): return Encoding object now.
* gc.c (garbage_collect): mark Encoding objects.
* string.c (rb_str_force_encoding): accept Encoding object as well as
encoding name.
* include/ruby/encoding.h (rb_to_encoding_index, rb_to_encoding):
prototypes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-13 16:32:40 +00:00
matz
9bcbd08b0b
* include/ruby/node.h (NOEX_LOCAL): remove unused local visibility.
...
* class.c (ins_methods_push): ditto.
* class.c (rb_class_local_methods): method removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-11 13:20:14 +00:00
matz
5fc7312d1b
* include/ruby/oniguruma.h (OnigEncodingTypeST): add OnigEncoding
...
parameter to every function members.
* include/ruby/oniguruma.h (OnigEncodingTypeST): add auxiliary
data member to provide user defined data for an encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-10 15:05:32 +00:00
akr
a6e5b6d660
* include/ruby/node.h: make node flags as VALUE type.
...
enum ruby_node_flags removed.
* ruby.c: define RUBY_NODE_* as const for gdb.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-07 13:03:05 +00:00
akr
775eece15a
refined again.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-07 10:41:23 +00:00
akr
fe1ecef302
refine previous change.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-07 10:18:09 +00:00
akr
c2115fe8f4
* include/ruby/ruby.h: enum ruby_value_flags removed.
...
* ruby.c: define RUBY_FL_* as const VALUE for gdb.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-07 09:58:26 +00:00
nobu
6845578c92
* insns.def (opt_eq): get rid of gcc bug.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-06 05:32:37 +00:00
matz
bd00bb3ef7
* include/ruby/defines.h: no longer provide DEFAULT_KCODE.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-05 17:39:59 +00:00
matz
c953283d7e
revert rb_memcmp() change to pacify GCC optimizer
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13623 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-04 09:54:53 +00:00
matz
1677425e9d
* re.c (rb_memcmp): no longer useful without ruby_ignorecase.
...
* re.c (rb_reg_prepare_re): revert recompile condition.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-04 09:24:00 +00:00
matz
1c9a2e1154
* re.c (kcode_setter): Perl-ish global variable `$=' no longer
...
effective.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13616 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-04 07:31:50 +00:00
nobu
19dee8af57
* encoding.c (rb_obj_encoding): returns encoding of the given object.
...
* re.c (Init_Regexp): new method Regexp#encoding.
* string.c (str_encoding): moved to encoding.c
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13613 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-04 06:57:19 +00:00
nobu
eb64f5de06
* string.c (rb_str_append): always set encoding, and coderange
...
cache bits.
* include/ruby/encoding.h (ENC_CODERANGE_SET): fixed a bug not to
set chache bits.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13578 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-30 08:13:28 +00:00
nobu
400202f6a5
* main.c (main): use platform-independent per-process initialization.
...
[ruby-dev:31900]
* ruby.c (ruby_sysinit): new function for per-process initialization.
* include/ruby/ruby.h (RUBY_GLOBAL_SETUP): toplevel setup declaration.
* include/ruby/win32.h, win32/mkexports.rb: alias NtInitialize
ruby_sysinit.
* win32/win32.c (rb_w32_sysinit): renamed from NtInitialize.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-29 08:45:24 +00:00
nobu
affcfc9e7a
* include/ruby/win32.h (strcasecmp): needed for type_strcasehash.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-28 23:57:17 +00:00
nobu
29621688c7
* io.c (rb_io_fdopen): create IO object from fd.
...
* parse.y (yycompile): use encoding of the source as default.
* ruby.c (proc_options, load_file): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-28 20:29:32 +00:00
nobu
c351afc372
* encoding.c (rb_enc_alias): allow encodings multiple aliases.
...
* encoding.c (rb_enc_find_index): search the encoding which has the
given name and return its index if found, or -1.
* st.c (type_strcasehash): case-insensitive string hash type.
* string.c (rb_str_force_encoding): force encoding of self. this name
comes from [ruby-dev:31894] by Martin Duerst. [ruby-dev:31744]
* include/ruby/encoding.h (rb_enc_find_index, rb_enc_associate_index):
prototyped.
* include/ruby/encoding.h (rb_enc_isctype): direct interface to ctype.
* include/ruby/st.h (st_init_strcasetable): prototyped.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-28 19:27:10 +00:00
akr
d6c43c45ea
rb_classext_t member order exchanged to
...
make frequently accessed member at first.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-28 11:57:30 +00:00
akr
5c0e68c39c
* include/ruby/intern.h: export rb_ivar_foreach.
...
* include/ruby/ruby.h: modify struct RObject and RClass for optimizing
T_OBJECT space. [ruby-dev:31853]
(ROBJECT_LEN, ROBJECT_PTR)
(RCLASS_IV_TBL, RCLASS_M_TBL, RCLASS_SUPER, RCLASS_IV_INDEX_TBL)
(RMODULE_IV_TBL, RMODULE_M_TBL, RMODULE_SUPER): abstract accessor
defined.
* variable.c: support the modified RObject and RClass.
* object.c: ditto.
* class.c: ditto.
* gc.c: ditto.
* marshal.c: ditto.
* eval_method.ci: use the abstract accessor.
* insns.def: ditto.
* proc.c: ditto.
* struct.c: ditto.
* eval.c: ditto.
* error.c: ditto.
* vm.c: ditto.
* insnhelper.ci: ditto.
* ext/digest/digest.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-28 06:21:46 +00:00
nobu
e41b84895e
* encoding.c (rb_enc_associate_index): deal with ASCII compatible
...
flags.
* encoding.c (rb_enc_check): allow ASCII compatible strings.
* parse.y (rb_intern_str): use ASCII encoding for ASCII string.
* string.c (rb_enc_str_coderange): check for code-range.
* string.c (rb_str_modify): clear code-range flags.
* string.c (rb_str_hash, rb_str_eql): ASCII compatible strings are
comparable.
* include/ruby/encoding.h: added code-range flags.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-26 19:46:58 +00:00
nobu
b416cc6f3f
* gc.c (rb_mark_set): new function to mark keys.
...
* marshal.c (struct dump_arg, struct load_arg): added wrappers to mark
data and compat_tbl entries. [ruby-dev:31870]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-26 19:40:49 +00:00
nobu
94a0db11e7
* encoding.c (rb_enc_check): check for ASCII-compatibilities.
...
* parse.y (parser_tokadd_string, parser_parse_string,
parser_here_document, parser_yylex): set encoding to US-ASCII.
* parse.y (rb_enc_symname_p): check if valid with encoding.
* parse.y (rb_intern3): let symbols have encoding.
* string.c (rb_str_hash): add encoding index.
* string.c (rb_str_comparable, rb_str_equal, rb_str_eql): check if
compatible encoding.
* string.c (sym_inspect): made encoding aware.
* insns.def (opt_eq): compare with encoding.
* include/ruby/encoding.h (rb_enc_asciicompat): check if ASCII
compatible.
* include/ruby/encoding.h (rb_enc_get_index): added prototype.
* include/ruby/intern.h (rb_str_comparable, rb_str_equal): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-26 09:39:08 +00:00
akr
a8b4677b14
* marshal.c (r_object0): don't call user-defined initialize for
...
T_STRUCT objects.
* include/ruby/intern.h (rb_struct_initialize): declared.
* struct.c (rb_struct_initialize): export.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-08 16:19:13 +00:00
akr
2a37152f3f
* eval_method.ci (rb_get_alloc_func): new function to get allocation
...
function.
* include/ruby/intern.h (rb_alloc_func_t): declared.
(rb_define_alloc_func): declared.
(rb_marshal_define_compat): declared.
* range.c: use T_STRUCT for Range.
* inits.c: move Init_marshal() prior to Init_Range() because
Init_Range calls rb_marshal_define_compat which needs
marshal's compat_allocator_tbl initialized.
* marshal.c: support marshal format compatibility layer designed for
marshaling T_STRUCT Range using T_OBJECT format.
(rb_marshal_define_compat): defined.
[ruby-dev:31710]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-08 15:07:18 +00:00
matz
edd7c787ad
* array.c (rb_ary_cycle): typo in rdoc. a patch from Yugui
...
<yugui@yugui.sakura.ne.jp>. [ruby-dev:31748]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13348 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-06 12:33:45 +00:00
nobu
629b1e4324
* string.c (rb_str_succ, rb_str_chop_bang, rb_str_chop): m17n support.
...
[ruby-dev:31734]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13347 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-06 03:42:12 +00:00
akr
15c8e4618b
* include/ruby/st.h (struct st_table): make num_entries bitfield
...
instead of num_bins for speed. num_entries has less access.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-02 14:40:47 +00:00
akr
2c8e7a50c1
* include/ruby/ruby.h (struct RBignum): embed digits in RBignum for
...
small bignums.
* bignum.c: RBignum embeded digits implemented.
* include/ruby/intern.h: declare rb_big_resize.
* gc.c: don't free embedded digits.
* numeric.c: replace direct bignum field accessor by abstract field
accessor such as RBIGNUM(val)->sign to RBIGNUM_SIGN(val).
* sprintf.c: ditto.
* compar.c: ditto.
* marshal.c: ditto.
* random.c: ditto.
* .gdbinit: support embedded small bignums.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-01 12:02:36 +00:00
nobu
ec2beed3b2
* include/ruby/st.h (rb_index_t): use st_data_t for the platforms it
...
is larger than int.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-01 05:24:25 +00:00
nobu
d4cbf95002
* st.c (st_numcmp, st_numhash): use st_data_t instead of long, because
...
the former may be larger than the latter.
* include/ruby/st.h (CHAR_BIT): get rid of magic number.
* include/ruby/st.h (struct st_table): num_entries never exceed
num_bins.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-01 02:14:40 +00:00
akr
b39e00d39d
fix comment.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-31 07:20:38 +00:00
akr
c8b8b7438e
add comment.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-30 01:54:51 +00:00
akr
eee95e67b9
enclose RHASH_XXX macros by parenthesis.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-29 23:16:55 +00:00
akr
2a4c4f7b0c
* include/ruby/intern.h: declare rb_hash_tbl.
...
* include/ruby/ruby.h (RHash): delay st_table allocation.
rename tbl field to ntbl to detect direct reference to the st_table
as a compile error.
(RHASH_TBL): abstract accessor defined.
(RHASH_ITER_LEV): ditto.
(RHASH_IFNONE): ditto.
(RHASH_SIZE): ditto.
(RHASH_EMPTY_P): ditto.
* hash.c: delay st_table allocation.
* gc.c: replace tbl by ntbl.
* array.c: replace direct field accessor by abstract field accessor
such as RHASH(hash)->tbl to RHASH_TBL(hash).
* marshal.c: ditto.
* insns.def: ditto.
* ext/iconv/iconv.c: ditto.
* ext/json/ext/generator/generator.c: ditto.
* ext/json/ext/parser/parser.c: ditto.
* ext/syck/rubyext.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-29 23:12:21 +00:00
matz
3d7f8c2320
* string.c (str_gsub): should not use mbclen2() which has broken API.
...
* re.c: remove rb_reg_mbclen2().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-29 19:16:02 +00:00
akr
167358d000
* include/ruby/st.h (struct st_table): add entries_packed 1-bit
...
bitfield. decrease num_bins 1-bit.
* st.c: pack numhash which have 5 or less entries in bins.
(st_init_table_with_size): setup entries_packed flag.
(st_clear): support packed mode.
(st_lookup): ditto.
(st_insert): ditto.
(st_add_direct): ditto.
(st_copy): ditto.
(st_delete): ditto.
(st_foreach): ditto.
(st_reverse_foreach): ditto.
(unpack_entries): new function for converting to unpacked mode.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-29 02:36:54 +00:00
matz
3783246a2e
* include/ruby/defines.h (flush_register_windows): call "ta 0x03"
...
even on Linux/Sparc. [ruby-dev:31674]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-29 02:15:03 +00:00
matz
51b4cc11d1
* string.c (rb_str_subseq): retrieve substring based on byte offset.
...
* string.c (rb_str_rindex_m): was confusing character offset and
byte offset.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-28 06:45:32 +00:00
ko1
6244e502cc
* thread.c: fix Mutex to be interruptable lock.
...
* thread_win32.ci, thread_win32.h, thread_pthread.ci, thread_pthread.h:
prepare native_cond_*() which are based on pthread_cond_*() spec.
* prelude.rb: fix Mutex#synchronize method.
* vm_core.h, include/ruby/intern.h: change unblock function interface
(to pass some user data).
* file.c, process.c: ditto.
* benchmark/bm_vm2_mutex.rb: add a benchmark for mutex.
* benchmark/bm_vm3_thread_mutex.rb: add a benchmark for mutex
with contension.
* benchmark/run.rb: fix to remove ENV['RUBYLIB'] for matzruby.
* test/ruby/test_thread.rb: add a test.
* common.mk: fix benchmark options.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13290 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-27 16:48:14 +00:00
matz
4461bd2f1f
* encoding.c (rb_enc_codelen): raises invalid sequence exception
...
if ONIGENC_CODE_TO_MBCLEN() returns zero. [ruby-dev:31661]
* encoding.c (rb_enc_mbclen): check invalid sequence.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-27 13:48:09 +00:00
matz
1ba65ebfe9
* include/ruby/encoding.h: remove unused rb_enc_ismbchar().
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-25 15:27:08 +00:00
ko1
5ba27573a0
* string.c, include/ruby/intern.h: export rb_str_length().
...
* insns.def: use rb_str_lengt() in opt_length.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-25 08:54:29 +00:00
nobu
2d888a8f33
* include/ruby/encoding.h (rb_enc_str_new): prototype added.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-25 08:05:08 +00:00
matz
000b6e22f4
include/ruby/encoding.h: added.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-25 04:14:26 +00:00
matz
a25fbe3b3e
* encoding.c: provide basic features for M17N.
...
* parse.y: encoding aware parsing.
* parse.y (pragma_encoding): encoding specification pragma.
* parse.y (rb_intern3): encoding specified symbols.
* string.c (rb_str_length): length based on characters.
for older behavior, bytesize method added.
* string.c (rb_str_index_m): index based on characters. rindex as
well.
* string.c (succ_char): encoding aware succeeding string.
* string.c (rb_str_reverse): reverse based on characters.
* string.c (rb_str_inspect): encoding aware string description.
* string.c (rb_str_upcase_bang): encoding aware case conversion.
downcase, capitalize, swapcase as well.
* string.c (rb_str_tr_bang): tr based on characters. delete,
squeeze, tr_s, count as well.
* string.c (rb_str_split_m): split based on characters.
* string.c (rb_str_each_line): encoding aware each_line.
* string.c (rb_str_each_char): added. iteration based on
characters.
* string.c (rb_str_strip_bang): encoding aware whitespace
stripping. lstrip, rstrip as well.
* string.c (rb_str_justify): encoding aware justifying (ljust,
rjust, center).
* string.c (str_encoding): get encoding attribute from a string.
* re.c (rb_reg_initialize): encoding aware regular expression
* sprintf.c (rb_str_format): formatting (i.e. length count) based
on characters.
* io.c (rb_io_getc): getc to return one-character string.
for older behavior, getbyte method added.
* ext/stringio/stringio.c (strio_getc): ditto.
* io.c (rb_io_ungetc): allow pushing arbitrary string at the
current reading point.
* ext/stringio/stringio.c (strio_ungetc): ditto.
* ext/strscan/strscan.c: encoding support.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-25 03:29:39 +00:00
ko1
977d66ec99
* cont.c: separate Continuation and Fiber from core.
...
* ext/continuation/*, ext/fiber/*: ditto.
* include/ruby/ruby.h: remove rb_cFiber.
* include/ruby/intern.h: add the rb_fiber_new() declaration.
* enumerator.c (next_init): fix to use rb_fiber_new().
* test/ruby/test_enumerator.rb: remove next? tests.
* test/ruby/test_continuation.rb: add a require 'continuation'.
* test/ruby/test_fiber.rb: add a require 'fiber'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-25 02:03:44 +00:00
ko1
c5e4cd0638
* cont.c: add Fiber#resume and Fiber.yield.
...
and Fiber::Core class to realize Coroutine.
* include/ruby/intern.h: declare rb_fiber_yield(), rb_fiber_resume(),
* enumerator.c: use above api.
* test/ruby/test_fiber.rb: fix and add tests for above changes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13130 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-21 18:51:39 +00:00
nobu
be4fc7941b
* st.c (struct st_table_entry): add new members, fore and back, to
...
iterate in inserted order.
* include/ruby/st.h (struct st_table): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-21 04:43:51 +00:00
ko1
b982cff67c
* eval.c (rb_call), eval_method.ci (rb_add_method, rb_alias),
...
insnhelper.ci (vm_call_method): fix to save safelevel for
method node.
* include/ruby/node.h: ditto.
* bootstraptest/test_method.rb: add a test for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-17 12:25:47 +00:00
matz
c186fdb90b
* enumerator.c (enumerator_next_p): should check correctly even when
...
e.next has not been called before.
* enumerator.c (enumerator_next): raise StopIteration (name taken
from Python) instead of IndexError.
* enum.c (enum_zip): catch StopIteration exception.
* enumerator.c (enumerator_with_index): return Enumerator if no
block is given.
* test/ruby/test_iterator.rb (TestIterator::test_enumerator): add
test for enumerators.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-08 07:07:03 +00:00
nobu
f800cdbabc
* include/ruby/ruby.h (ruby_special_consts): added RUBY_SPECIAL_SHIFT.
...
* .gdbinit: some improvements.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-07 04:58:07 +00:00
matz
57b0b6c7b1
* cont.c (rb_fiber_yield): change argument ordering. export.
...
* cont.c (rb_fiber_current): export
* include/ruby/intern.h: export several functions from cont.c.
* enumerator.c (enumerator_next): new method to implement external
iterator (generator) using fiber.
* enumerator.c (enumerator_next_p): new method to check whether
any element is left in the generator sequence.
* enumerator.c (enumerator_rewind): a new method to rewind the
generator sequence.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12891 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-06 16:41:17 +00:00
nobu
d9274e7d6b
* parse.y (reg_compile_gen): set error if failed to compile regexp
...
literal. [ruby-dev:31336]
* re.c (rb_reg_compile): should not use regexp which could not get
initialized. [ruby-dev:31333]
return error message to let the parser know it.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-02 14:36:25 +00:00
matz
e1def8a987
* include/ruby/oniguruma.h: upgrade to Oniguruma 5.9.0. fixes
...
some memory violation. [ruby-dev:31070]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-23 09:39:30 +00:00
nobu
fb00d61acf
* thread.c (is_ruby_native_thread): made an int function as
...
well as version 1.8.
* include/ruby/ruby.h (is_ruby_native_thread): moved prototype
from intern.h as well as version 1.8.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-22 07:07:12 +00:00
nobu
f1622c195d
* file.c (rb_file_s_rename): deleted code to get rid of a bug of
...
old Cygwin.
* file.c (rb_file_truncate): added prototype of GetLastError()
on cygwin. [ruby-dev:31239]
* include/ruby/intern.h (is_ruby_native_thread): prototype.
* missing/strftime.c (strftime): fix printf format and actual
arguments.
* ext/Win32API/Win32API.c (Win32API_initialize): ditto.
* ext/tk/tcltklib.c (ip_finalize): ditto.
* ext/win32ole/win32ole.c (lcid_installed): ditto.
* ext/socket/getnameinfo.c: include stdio.h always.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-22 05:33:54 +00:00
nobu
09ce106ab3
* bignum.c (rb_big_lshift, rb_big_rshift): separated functions
...
to get rid of infinite recursion. fixed calculation in edge
cases. [ruby-dev:31244]
* numeric.c (rb_fix_lshift, rb_fix_rshift): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12814 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-19 05:38:48 +00:00
nobu
cba32dcaa6
* ext/dl/cfunc.c (rb_dlcfunc_call): adjust format. [ruby-dev:31222]
...
* ext/digest/digest.c (rb_digest_instance_update,
rb_digest_instance_finish, rb_digest_instance_reset,
rb_digest_instance_block_length): %s in rb_raise() expects char*.
[ruby-dev:31222]
* ext/openssl/ossl.h: include ossl_pkcs5.h. [ruby-dev:31231]
* ext/openssl/ossl_pkcs5.h: new file for PKCS5. [ruby-dev:31231]
* ext/openssl/ossl_x509name.c (ossl_x509name_to_s): use ossl_raise()
instead of rb_raise(). [ruby-dev:31222]
* ext/sdbm/_sdbm.c: DOSISH platforms need io.h. [ruby-dev:31232]
* ext/syck/syck.h: include stdlib.h for malloc() and free().
[ruby-dev:31232]
* ext/syck/syck.h (syck_parser_set_input_type): prototype added.
[ruby-dev:31231]
* win32/win32.c: include mbstring.h for _mbspbrk(). [ruby-dev:31232]
* include/ruby/win32.h (rb_w32_getcwd): prototype added.
[ruby-dev:31232]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-15 13:24:39 +00:00
ko1
b626539e9b
* include/ruby/intern.h: remove unused function declarations.
...
* include/ruby/ruby.h: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-13 09:36:04 +00:00