ko1
53b3bf961c
* array.c (rb_ary_permutation): add gc guard codes.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-21 06:06:10 +00:00
matz
03c4e447fa
* array.c (rb_ary_permutation): gives all permutations of elements
...
if no argument given. a patch from Yusuke ENDOH <mame AT tsg.ne.jp>.
[ruby-dev:32309]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-19 07:06:03 +00:00
matz
53f22d3a05
* array.c (rb_ary_product): core dumped with non array arguments.
...
a patch from Yusuke ENDOH <mame AT tsg.ne.jp>. [ruby-dev:32180]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-06 18:54:02 +00:00
matz
d9ebaef79b
* array.c (rb_ary_each_index): should return meaningful value.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13829 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-06 18:36:49 +00:00
davidflanagan
27b35eddd6
array.c: raise IndexError for negative length in rb_ary_fill
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-26 05:52:16 +00:00
matz
d9ff0a6c22
* array.c (rb_ary_assoc): check and convert inner arrays (assocs)
...
using #to_ary.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-25 16:52:40 +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
matz
7927f32a19
* array.c (rb_ary_combination): fixed memory corruption due to too
...
small memory allocation
* array.c (rb_ary_product): accessing out of memory bounds.
condition fixed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-12 14:34:37 +00:00
nobu
7550659a33
* array.c (rb_ary_permutation): use frozen shared hidden array.
...
[ruby-dev:31985]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-09 12:35:31 +00:00
nobu
f6a26d06a2
* array.c (rb_ary_permutation, rb_ary_combination): missing type
...
names.
* array.c (rb_ary_permutation): used buffer should be t1.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-09 12:29:21 +00:00
matz
1c65de7284
* array.c: remove to_a completely.
...
* array.c (tmpbuf): keep DRY to clear klass of temporary objects.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-09 09:11:36 +00:00
nobu
81b55c0ff3
* array.c (rb_ary_permutation, rb_ary_combination, rb_ary_product):
...
hide internal buffer objects. [ruby-dev:31982]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13664 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-09 07:33:35 +00:00
usa
b618f011b7
* array.c (rb_ary_permutation, rb_ary_product): support non C99
...
compilers.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-04 11:18:14 +00:00
matz
612b2ed6a7
* array.c (rb_ary_permutation): remove C99 dependency.
...
[ruby-dev:31934]
* array.c (rb_ary_product): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-04 06:51:17 +00:00
matz
77a6c82eab
* array.c (rb_ary_product): generalized product, now takes
...
arbitrary number of arrays. a patch from David Flanagan
<david AT davidflanagan.com>. [ruby-core:12346]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-02 03:33:53 +00:00
matz
209b950f3f
* array.c (rb_ary_permutation): small dirty hack by Matz to avoid
...
arrays on stack.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-01 23:37:02 +00:00
matz
04bc87e582
* array.c (rb_ary_permutation): implementation contributed from
...
David Flanagan. [ruby-core:12344]
* array.c (rb_ary_combination): RDoc update to clarify. a patch
from David Flanagan. [ruby-core:12344]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-01 23:35:30 +00:00
matz
25ff7ef4c6
* array.c (rb_ary_combination): revisit #combination behavior.
...
suggested by David Flanagan.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13588 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-01 14:46:07 +00:00
matz
43c4d80930
* array.c (rb_ary_combination): new method to give all combination
...
of elements from an array. [ruby-list:42671]
* array.c (rb_ary_product): a new method to get all combinations
of elements from two arrays. can be extended to combinations of
n-arrays, e.g. a.product(b,c,d). anyone volunteer?
* array.c (rb_ary_permutation): empty function body to calculate
permutations of array elements. need volunteer.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-29 08:43:59 +00:00
matz
c1a432a7d9
* array.c (rb_ary_equal): should handle recursive array.
...
* hash.c (hash_equal): should handle recursive hash.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-24 13:43:58 +00:00
matz
b3fc59837a
* array.c (rb_ary_cycle): avoid infinite loop for empty array.
...
based on a patch from David Flanagan. [ruby-core:12085]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-10 05:05:49 +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
matz
9df2b5fd0c
* array.c (rb_ary_subseq): need integer overflow check.
...
[ruby-dev:31736]
* array.c (rb_ary_splice): ditto. [ruby-dev:31737]
* array.c (rb_ary_fill): ditto. [ruby-dev:31738]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-05 13:37:18 +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
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
matz
bdf32ff14f
* array.c (rb_ary_s_try_convert): more document description.
...
* re.c (rb_reg_s_try_convert): typo fixed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13256 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-25 00:43:13 +00:00
matz
5e1c401ff5
* array.c (rb_ary_s_try_convert): a new class method to convert
...
object or nil if it's not target-type. this mechanism is used
to convert types in the C implemented methods.
* hash.c (rb_hash_s_try_convert): ditto.
* io.c (rb_io_s_try_convert): ditto.
* re.c (rb_reg_s_try_convert): ditto.
* string.c (rb_str_s_try_convert): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-24 17:47:09 +00:00
matz
009debfd02
* io.c (rb_io_s_foreach): argument count check before making
...
Enumerator. [ruby-dev:31525]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-20 14:46:03 +00:00
matz
ecb93c3fdf
* enum.c (enum_zip): zip no longer converts arguments into
...
arrays, uses enumerators.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-06 16:53:36 +00:00
matz
b3e977a4c0
* enum.c (enum_cycle): new method to cycle enumerable forever.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-06 16:26:17 +00:00
nobu
f64a557efd
* array.c (rb_ary_flatten_bang): check argument if valid
...
integer. [ruby-dev:31197]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-13 01:33:31 +00:00
ko1
6b6bf4dd48
* blockinlining.c: remove "yarv" prefix.
...
* array.c, numeric.c: ditto.
* insnhelper.ci, insns.def, vm_evalbody.ci: ditto.
* yarvcore.c: removed.
* yarvcore.h: renamed to core.h.
* cont.c, debug.c, error.c, process.c, signal.c : ditto.
* ext/probeprofiler/probeprofiler.c: ditto.
* id.c, id.h: added.
* inits.c: ditto.
* compile.c: rename internal functions.
* compile.h: fix debug flag.
* eval.c, object.c, vm.c: remove ruby_top_self.
use rb_vm_top_self() instead.
* eval_intern.h, eval_load: ditto.
* gc.c: rename yarv_machine_stack_mark() to
rb_gc_mark_machine_stack().
* insnhelper.h: remove unused macros.
* iseq.c: add iseq_compile() to create iseq object
from source string.
* proc.c: rename a internal function.
* template/insns.inc.tmpl: remove YARV prefix.
* thread.c:
* vm.c (rb_iseq_eval): added.
* vm.c: move some functions from yarvcore.c.
* vm_dump.c: fix to remove compiler warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-12 04:25:46 +00:00
matz
fdf213b71a
* hash.c (rb_hash_assoc): new method.
...
* hash.c (rb_hash_rassoc): ditto.
* hash.c (rb_hash_flatten): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-22 16:26:07 +00:00
nobu
2b592580bf
* include/ruby: moved public headers.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-10 03:06:15 +00:00
matz
46590a4132
* array.c (rb_ary_zip): a.zip(b,c) should return an array, not
...
enumerator.
* array.c (rb_ary_zip): a.zip(b,c) should return array with size
truncated to the size of its shortest argument array.
[incompatible]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-13 17:15:25 +00:00
matz
aa77090aef
* array.c (rb_ary_choice): should return nil when the array is
...
empty.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12276 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-13 16:54:58 +00:00
matz
82d5106e09
* array.c (rb_ary_choice): fixed mistake from RDoc.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-01 08:57:54 +00:00
matz
2b6252e64e
* array.c (rb_ary_choice): a new method to choose an element
...
randomly from an array.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-01 08:45:28 +00:00
nobu
f9b349adb5
* Makefile.in, configure.in, */Makefile.sub (THREAD_MODEL): system
...
specific thread model.
* compile.h, regint.h, vm.h, array.c: removed unnecessary #include.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-28 01:33:57 +00:00
ko1
44aef0b53f
* this commit is a result of refactoring. only renaming functions,
...
moving definitions place, add/remove prototypes, deleting
unused variables and removing yarv.h.
This commit doesn't change any behavior of ruby/vm.
* yarv.h, common.mk: remove yarv.h (contents are moved to yarvcore.h).
* error.c, eval_intern.h: include yarvcore.h instead yarv.h
* rename some functions:
* debug.[ch]: debug_*() -> ruby_debug_*()
* iseq.c: iseq_*() -> rb_iseq_*(), ruby_iseq_disasm()
* iseq.c: node_name() -> ruby_node_name()
* vm.c: yarv_check_redefinition_opt_method() ->
rb_vm_check_redefinition_opt_method()
* some refactoring with checking -Wall.
* array.c: remove rb_ary_ptr() (unused) and remove unused
local variables.
* object.c: add a prototype of rb_mod_module_exec().
* eval_intern.h (ruby_cref): set it inline.
* eval_load.c (rb_load), yarvcore.c: yarv_load() -> rb_load_internal().
* parse.y: add a prototype of rb_parse_in_eval() (in eval.c).
* process.c: add a prototype of rb_thread_stop_timer_thread() (in thread.c).
* thread.c: remove raw_gets() function (unused) and fix some format
mismatch (format mismatchs have remained yet. this is todo).
* thread.c (rb_thread_wait_fd_rw): fix typo on label name.
* thread_pthread.ci: comment out codes with USE_THREAD_CACHE.
* vm.c (rb_svar, rb_backref_get, rb_backref_get,
rb_lastline_get, rb_lastline_set) : moved from yarvcore.c.
* vm.c (yarv_init_redefined_flag): add a prototype and rename
yarv_opt_method_table to vm_opt_method_table.
* vm.c (rb_thread_eval): moved from yarvcore.c.
* yarvcore.c: remove unused global variables and fix to use nsdr().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-07 01:25:05 +00:00
nobu
82e937f511
* array.c (rb_ary_replace): use ptr and len of orig instead of
...
shared. fixed: [ruby-dev:30116]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-01-09 15:11:01 +00:00
ko1
a3e1b1ce7e
* Merge YARV
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-12-31 15:02:22 +00:00
drbrain
3e7566d8fb
Fix Array#reject, was working like Array#reject\!
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-12-31 07:24:56 +00:00
matz
465fa424f0
* array.c (ary_iter_check): should check modification (size
...
change) during iteration.
* array.c (rb_ary_initialize, rb_ary_shift, rb_ary_unshift,
rb_ary_splice, rb_ary_reverse, rb_ary_sort, rb_ary_delete,
rb_ary_delete_at, rb_ary_reject_bang, rb_ary_replace,
rb_ary_clear, rb_ary_fill, rb_ary_uniq_bang, rb_ary_compact,
rb_ary_shuffle): add iteration check.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11429 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-12-29 19:25:11 +00:00
matz
eca2b4b068
* array.c: revert lfree shift/unshift boost patch to avoid unknown
...
memory error.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11257 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-11-02 00:19:57 +00:00
matz
15df557a4d
* ruby.h (struct RArray): revert embedding ptr in RVALUE.
...
* array.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11256 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-11-01 14:42:39 +00:00
matz
7ab214d982
* array.c (ary_shared_first): should address offset after
...
ary_shared_array(). [ruby-core:09358]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11247 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-10-31 07:28:37 +00:00
nobu
6da8a20bb7
* array.c (rb_ary_shift): shorten copy size. fixed: [ruby-list:42907]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-10-18 13:57:43 +00:00
matz
fd4b559c95
* array.c (ary_shared_array): should set NOEMBED flag for a copied
...
array.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11185 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-10-18 04:29:44 +00:00
matz
58c0100a77
* array.c (rb_ary_unshift_m): a bug in lfree shift length
...
calculation.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-10-16 14:35:51 +00:00