aboutsummaryrefslogtreecommitdiffstats
path: root/array.c
Commit message (Collapse)AuthorAgeFilesLines
* * include/ruby/intern.h (rb_str_tmp_new, rb_str_shared_replace):nobu2008-01-161-1/+0
| | | | | | | prototype moved. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_zip): honor length of the receiver, not thematz2008-01-081-0/+79
| | | | | | | | | | | | | shortest length. [ruby-core:14738] * enum.c (enum_zip): returns array not enumerator for no block form. [ruby-core:14738] * enumerator.c (next_ii): do not ignore multiple values yielded. * array.c (rb_ary_zip): faster version without creating generators. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * $Date$ keyword removed to avoid inclusion of locale dependentakr2008-01-061-1/+0
| | | | | | | string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix typos.akr2007-12-311-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (tmpbuf): use rb_str_tmp_new().nobu2007-12-261-8/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/intern.h, random.c, array.c:akr2007-12-241-2/+2
| | | | | | | | | | 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
* * array.c (rb_ary_at): updated documentation. a patch from Tadashimatz2007-12-231-2/+0
| | | | | | Saito <shiba AT mail2.accsnet.ne.jp> in [ruby-core:14330]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_permutation): add volatile to avoid GC problem.ko12007-12-221-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_slice_bang): If an invalid range is given, doknu2007-12-101-2/+12
| | | | | | | not raise an exception but return nil just like slice() does. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_slice_bang): should return nil if position outmatz2007-12-101-0/+1
| | | | | | | of range. a patch from Akinori MUSHA <knu AT iDaemons.org>. [ruby-dev:32518] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (flatten): some performance improvements, based on a patchnobu2007-12-071-48/+59
| | | | | | | | from Yusuke ENDOH <mame AT tsg.ne.jp> in [ruby-core:13877]. [ruby-core:13851] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * insns.def (concatarray, splatarray): use to_a instead ofmatz2007-12-011-1/+0
| | | | | | | | to_splat. * insnhelper.ci (caller_setup_args): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_permutation): add gc guard codes.ko12007-11-211-2/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_permutation): gives all permutations of elementsmatz2007-11-191-5/+11
| | | | | | | 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
* * array.c (rb_ary_product): core dumped with non array arguments.matz2007-11-061-1/+1
| | | | | | 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
* * array.c (rb_ary_each_index): should return meaningful value.matz2007-11-061-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13829 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* array.c: raise IndexError for negative length in rb_ary_filldavidflanagan2007-10-261-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_assoc): check and convert inner arrays (assocs)matz2007-10-251-3/+2
| | | | | | using #to_ary. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * range.c (range_first): takes first n element if argument ismatz2007-10-181-2/+2
| | | | | | | | | | | 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
* * array.c (rb_ary_combination): fixed memory corruption due to toomatz2007-10-121-2/+2
| | | | | | | | | 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
* * array.c (rb_ary_permutation): use frozen shared hidden array.nobu2007-10-091-4/+3
| | | | | | | [ruby-dev:31985] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_permutation, rb_ary_combination): missing typenobu2007-10-091-19/+19
| | | | | | | | | 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
* * array.c: remove to_a completely.matz2007-10-091-19/+17
| | | | | | * 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
* * array.c (rb_ary_permutation, rb_ary_combination, rb_ary_product):nobu2007-10-091-1/+11
| | | | | | | hide internal buffer objects. [ruby-dev:31982] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13664 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_permutation, rb_ary_product): support non C99usa2007-10-041-3/+4
| | | | | | | compilers. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_permutation): remove C99 dependency.matz2007-10-041-5/+8
| | | | | | | | [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
* * array.c (rb_ary_product): generalized product, now takesmatz2007-10-021-14/+58
| | | | | | | 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
* * array.c (rb_ary_permutation): small dirty hack by Matz to avoidmatz2007-10-011-2/+5
| | | | | | arrays on stack. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_permutation): implementation contributed frommatz2007-10-011-24/+88
| | | | | | | | | 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
* * array.c (rb_ary_combination): revisit #combination behavior.matz2007-10-011-5/+3
| | | | | | suggested by David Flanagan. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13588 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_combination): new method to give all combinationmatz2007-09-291-0/+140
| | | | | | | | | | | | | 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
* * array.c (rb_ary_equal): should handle recursive array.matz2007-09-241-7/+14
| | | | | | * 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
* * array.c (rb_ary_cycle): avoid infinite loop for empty array.matz2007-09-101-1/+1
| | | | | | 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
* * array.c (rb_ary_cycle): typo in rdoc. a patch from Yuguimatz2007-09-061-1/+1
| | | | | | <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
* * array.c (rb_ary_subseq): need integer overflow check.matz2007-09-051-5/+6
| | | | | | | | | | [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
* * include/ruby/intern.h: declare rb_hash_tbl.akr2007-08-291-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* * encoding.c: provide basic features for M17N.matz2007-08-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* * array.c (rb_ary_s_try_convert): more document description.matz2007-08-251-1/+10
| | | | | | * 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
* * array.c (rb_ary_s_try_convert): a new class method to convertmatz2007-08-241-0/+18
| | | | | | | | | | | | | | | 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
* * io.c (rb_io_s_foreach): argument count check before makingmatz2007-08-201-1/+1
| | | | | | Enumerator. [ruby-dev:31525] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_zip): zip no longer converts arguments intomatz2007-08-061-60/+0
| | | | | | arrays, uses enumerators. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * enum.c (enum_cycle): new method to cycle enumerable forever.matz2007-08-061-0/+26
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_flatten_bang): check argument if validnobu2007-07-131-2/+1
| | | | | | | integer. [ruby-dev:31197] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * blockinlining.c: remove "yarv" prefix.ko12007-07-121-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* * hash.c (rb_hash_assoc): new method.matz2007-06-221-2/+2
| | | | | | | | * 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
* * include/ruby: moved public headers.nobu2007-06-101-3/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_zip): a.zip(b,c) should return an array, notmatz2007-05-131-9/+9
| | | | | | | | | | 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
* * array.c (rb_ary_choice): should return nil when the array ismatz2007-05-131-2/+4
| | | | | | empty. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12276 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_choice): fixed mistake from RDoc.matz2007-05-011-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_choice): a new method to choose an elementmatz2007-05-011-1/+20
| | | | | | randomly from an array. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e