summaryrefslogtreecommitdiff
path: root/string.c
AgeCommit message (Collapse)Author
2003-08-27* eval.c (rb_eval): *a = [1,2] now assigns [[1,2]] to a.matz
consistent with *a = [1], which set [[1]] to a. * node.h: merge NODE_RESTARY to NODE_SPLAT. * parse.y: rules simplified a bit by removing NODE_RESTARY. * sample/test.rb: updated for new assignment behavior. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-22* enum.c (inject_i): use rb_yield_values.matz
* enum.c (each_with_index_i): ditto. * eval.c (rb_yield_splat): new function to call "yield *values". * string.c (rb_str_scan): use rb_yield_splat(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-05* lib/shell/command-processor.rb (Shell::CommandProcessor::rmdir):matz
simple typo. * string.c (str_new4): ptr may refer null_str. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-30* ruby.c (proc_options): -F set compiled regular expression to $;.matz
[ruby-talk:77381] * string.c (Init_String): no setter type check for $; git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4230 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-27* string.c (rb_str_chomp_bang): defer rb_str_modify() to actualmatz
modify point. other methods, replace, tr, delete, squeeze, lstrip, and rstrip as well. * string.c (rb_str_rstrip_bang): remove trailing '\0' at the end of string. * string.c (rb_str_lstrip_bang): do not strip '\0' from the left. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4184 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-24* eval.c (thgroup_add): no warning for terminated threads.matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-23* string.c (rb_str_lstrip_bang): strip NUL along with whitematz
spaces. [ruby-talk:76659] * string.c (rb_str_rstrip_bang): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-21* string.c (rb_str_equal): should return nil for non stringmatz
operand to conform comparable convention. [ruby-dev:20759] * object.c (rb_equal): preserve nil if "==" returns nil. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4112 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-20* string.c: use StringValueCStr to retrieve paths to system calls.matz
* string.c (rb_string_value_cstr): check null byte in the string before retrieving C ptr. accessed via macro StringValueCStr. * file.c (sys_fail2): raise error for two operand system calls such as rename, link, symlink. (ruby-bugs PR#1047) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-19* string.c (rb_str_match2): add warning to "~string".matz
[ruby-list:37751] * lib/net/ftp.rb (Net::FTP::open): takes block. suggested by Gavin Sinclair in [ruby-core:01237]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-03* array.c (rb_values_at): extract common procedure frommatz
rb_ary_values_at. follow DRY principle. * re.c (match_values_at): values_at should understand ranges. * struct.c (rb_struct_values_at): ditto. * struct.c (inspect_struct): inspect format changed; add "struct " at the top. * sprintf.c (rb_f_sprintf): "%p" specifier for inspect output. (RCR#68) * eval.c (rb_mod_undef_method): allow "undef_method" to accept multiple arguments. (RCR#146) * lib/timeout.rb: put timeout in Timeout module. (RCR#121) [ruby-talk:61028] * re.c (match_groups): new method added. (RCR#139) * variable.c (rb_mod_const_of): should exclude constant defined in Object, unless retrieving constants of Object. * string.c (rb_str_new4): do not allocate new string if original is frozen or already have copy-on-write entry. [ruby-talk:74940] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4031 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-02* string.c (rb_str_shared_replace): clear flags before copy.matz
* string.c (rb_str_replace): ditto. * eval.c (rb_yield_0): override visibility mode for module_eval etc. (ruby-bugs-ja PR#505) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4028 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-06-27* string.c (rb_str_split_m): remove white spaces on the head ofnobu
the last element, when limit is specified. [ruby-talk:74506] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-06-26* io.c (io_fflush): need to check if closed after thread switch.nobu
[ruby-dev:20351] * io.c (fptr_finalize): ditto. * string.c (rb_str_rindex_m): fixed wrong fix. should move backward first only when matching from the end. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-06-23sorry, typo again.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-06-23typonobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-06-23* dir.c (find_dirsep): get rid of warnings.nobu
* eval.c (error_print): temporary value might be disposed by GC. * hash.c (env_has_value, env_index): should not increment NULL. * io.c (io_read, rb_io_sysread): not read when length is 0. * io.c (rb_io_reopen): ensure initialized IO. * io.c (rb_io_init_copy): sychronize file pointer. * io.c (rb_io_s_pipe): make exception proof. * string.c (rb_str_rindex_m): Fixnum 0 matched end of string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-06-23* string.c (rb_str_upto): generate sequence according to "succ"matz
order. formerly check was done by dictionary order. [ruby-talk:74138] * string.c (rb_string_value): fill constant empty string along with setting ELTS_SHARED if str->ptr is NULL. [ruby-core:01179] * string.c (rb_string_value_ptr): ditto. * string.c (rb_check_string_type): ditto. * string.c (str_gsub): move END(0) check before mbclen2(). * string.c (scan_once): reduce END(0) check. * io.c (rb_io_initialize): accept fixnum mode. * eval.c (error_print): replace strchr() by memchr(), einfo may contain "\0". * pack.c (pack_unpack): range check for "@" move; initialize check for "m". * error.c (syserr_initialize): avoid buffer overflow. * file.c (rb_file_s_readlink): expand buffer until readlink succeed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-26* eval.c (Init_Proc): Block/Proc separation. [huge change]matz
* eval.c (block_arity): returns exact arity number for Procs out of methods. also gives 1 for {|a|..}. * string.c (rb_str_match): revert use of String#index for invocation like string =~ string. * eval.c (rb_Array): move Object#to_a exclusion hack from splat_value(). need to be in eval.c for a while. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-19* class.c: add #include "version.h".aamine
* hash.c: ditto. * string.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-19* object.c (init_copy): rename copy_object as initialize_copy,matz
since it works as copy constructor. * eval.c (rb_add_method): initialize_copy should always be private, like initialize. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3820 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-05-02* string.c (rb_str_ljust): now takes optional argument to specifymatz
pad string. [ruby-talk:70482] * string.c (rb_str_rjust): ditto. * string.c (rb_str_center): ditto. * string.c (rb_str_justify): utility function. * eval.c (rb_add_method): call singleton_method_added or method_added for every method definition (after ruby_running). [ruby-talk:70471] * array.c (rb_ary_reverse_bang): Array#reverse! should not return nil even for arrays sized less than 2. * io.c (argf_eof): should not block after reading all argument files. (ruby-bugs-ja PR#449) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-04-27* string.c (rb_str_to_i): disallow negative radix.nobu
[ruby-dev:20087] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-04-14* rubyio.h (struct OpenFile): add error raise flag to finalizer.matz
* io.c (Init_IO): define $/, $-0, and $\ as string-only variables. * string.c (rb_str_split_m): does not generate empty string if there's no match in the receiver. * io.c (fptr_finalize): should raise error on EBADF for readable IOs as well. * file.c (rb_stat): use rb_check_convert_type() to retrieve IO. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-04-14* bignum.c (rb_cstr_to_inum, rb_big2str): allow 2-36 as radix.nobu
* numeric.c (rb_fix2str): ditto. * string.c (rb_str_to_i): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-03-26* string.c (rb_str_capitalize_bang): check length before upcasenobu
first character. (ruby-bugs:PR#697) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-03-07* parse.y (dsym): :"symbol string" style should not contain `\0'.matz
* process.c (proc_detach): new method Proc#detach(pid) which create background watcher thread to issue waitpid. [new] * process.c (rb_detach_process): utility function to detach process from C code. * ext/pty/pty.c (pty_finalize_syswait): terminate watcher thread, and detach child process (by creating new idle waitpid watcher thread). * ext/pty/pty.c (pty_syswait): may lost signal stopped child. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-02-27* string.c (str_new): need no MEMZERO().matz
* numeric.c (fix_gt): use rb_num_coerce_cmp() instead of rb_num_coerce_bin. * numeric.c (fix_ge, fix_lt, fix_le): ditto. * numeric.c (flo_gt, flo_ge, flo_lt, flo_le): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-02-21* string.c (rb_str_cmp_m): should use LONG2NUM().matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-02-21* string.c (rb_str_cmp_m): two small bugs fixed.matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-02-20* string.c (rb_str_cmp_m): return nil if str2 does not respond tomatz
both "to_str" and "<=>". * compar.c (cmp_gt): return nil if "<=>" returns nil (means incomparable). * compar.c (cmp_ge): ditto. * compar.c (cmp_lt): ditto. * compar.c (cmp_between): use RTEST(), since cmp_lt and cmp_gt may return nil. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-02-10* array.c (rb_ary_to_a): return value should be an Array if thematz
receiver is an instance of subclass of Array. * string.c (rb_str_to_s): return value should be a String if the receiver is an instance of subclass of String. * eval.c (rb_call): calls method_missing when superclass method does not exist. * eval.c (rb_f_missing): now handles "no super" case. * object.c (rb_obj_ivar_get): Object#instance_variable_get: new method to get instance variable value without eval(). [new] * object.c (rb_obj_ivar_set): Object#instance_variable_set: new method to set instance variable value without eval(). [new] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-02-07re-indented.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-02-07* intern.h, re.c (rb_memsearch): returns long.nobu
* string.c (rb_str_index): should return offset position. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-02-06* re.c (rb_reg_initialize_m): 3rd argument was ignored.matz
* string.c (rb_str_count): return 0 for empty string (was returning nil). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3449 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-02-04* array.c (rb_ary_equal): a == b is true when b is non T_ARRAYmatz
object, if b has "to_ary" and b == a. * hash.c (rb_hash_equal): a == b is true when b is non T_HASH object, if b has "to_hash" and b == a. * string.c (rb_str_equal): a == b is true when b is non T_STRING object, if b has "to_str" and b == a. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3442 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-02-03* object.c (Init_Object): default Object#=== now calls "=="matz
internally. * re.c (rb_reg_initialize_m): should honor option status of original regexp. * array.c (rb_ary_equal): ary2 should be T_ARRAY (no to_ary conversion). * array.c (rb_ary_eql): ditto. * string.c (rb_str_equal): str2 should be T_STRING (no to_str conversion). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-02-03* re.c (rb_memsearch): algolithm body of String#index.matz
* error.c (Init_Exception): "to_str" removed. * eval.c (eval): should not rely on Exception#to_str * eval.c (compile_error): ditto. * error.c (err_append): ditto. * hash.c (rb_hash_merge): Hash#merge, non destructive "update". now there's also Hash#merge! which is an alias to "update". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-31* string.c (rb_str_index): search using Karp-Rabin algolithm.matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3429 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-31* variable.c (rb_obj_classname): new function.matz
* string.c (rb_str_dup): should preserve original's class (but not hidden singleton class). * string.c (rb_str_substr): ditto. * parse.y: backout EXPR_CMDARG removal. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-31* parse.y (yylex): remove EXPR_CMDARG according to the RHG book.matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-16Updated Copyrights of Matz to 2003.michal
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-30* string.c (rb_str_substr): should share the shared string ifnobu
present, instead of the original string. (ruby-bugs:PR#528) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-21* array.c (ary_alloc), dir.c (dir_s_alloc), eval.c (thgroup_s_alloc),usa
file.c (rb_stat_s_alloc), hash.c (hash_alloc), io.c (io_alloc), object.c (rb_module_s_alloc, rb_class_allocate_instance), re.c (match_alloc, rb_reg_s_alloc), string.c (str_alloc), time.c (time_s_alloc), ext/digest/digest.c (rb_digest_base_alloc), ext/tcltklib/tcltklib.c (ip_alloc), ext/win32ole/win32ole.c (fole_s_allocate, fev_s_allocate) : add prototype to get rid of VC++ warnings. * ext/sdbm/init.c (fsdbm_alloc): allocator takes only one argument. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-20* parse.y (do_block): split "do" block and tLBRACE_ARG block.matz
* parse.y (cmd_brace_block): new tLBRACE_ARG block rule * parse.y (command): can take optional cmd_brace_block; use %prec to resolve shift/reduce conflict. (ruby-bugs-ja PR#372) * eval.c (ruby_finalize): trace_func should be cleared here (after executing exit procs and finalizers). * eval.c (rb_define_alloc_func): new allocation framework, based on Nobu's work [ruby-dev:19116]. "allocate" method is no longer used for object allocation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-19* numeric.c (num_step): use DBL_EPSILON.matz
* array.c (rb_check_array_type): new function: return an array (convert if possible), or nil. * string.c (rb_check_string_type): new function: return a string (convert if possible), or nil. * numeric.c (rb_dbl_cmp): returns nil if values are not comparable. * numeric.c (fix_cmp,flo_cmp): use rb_num_coerce_cmp() * bignum.c (rb_big_cmp): ditto. * numeric.c (rb_num_coerce_cmp): new coercing function for "<=>", which does not raise TypeError. * numeric.c (do_coerce): can be supress exception now. * object.c (rb_mod_cmp): should return nil for non class/module objects. * re.c (rb_reg_eqq): return false if the argument is not a string. now returns boolean value. * class.c (rb_include_module): argument should be T_MODULE, not T_class, nor T_ICLASS. * eval.c (is_defined): "defined?" should return "assignment" for attribute assignment (e.g. a.foo=b) and indexed assignment (e.g. a[2] = 44). * parse.y (aryset): use NODE_ATTRASGN. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-18* string.c (rb_str_dup_frozen): handle tail shared string.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-17* string.c (rb_str_new4): handle tail shared string.nobu
(ruby-bugs-ja:PR#370) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3164 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-17* node.h (NODE_ATTRASGN): new node, assignment to attribute.nobu
[ruby-core:00637]. * eval.c (is_defined, rb_eval): ditto. * parse.y (attrset, node_assign): ditto. * string.c (rb_str_substr): tail sharing. [ruby-core:00650] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-10* sprintf.c (rb_f_sprintf): preceding ".." for negative numbersmatz
still left; removed. * sprintf.c (rb_f_sprintf): should not prepend '0' if width > prec for example "%5.3d". * process.c (Init_process): add Process.exit and Process.abort * pack.c (utf8_to_uv): raise ArgumentError for malformed/redundant UTF-8 sequences. * process.c (last_status_set): add pid attribute to Process::Status. * pack.c (uv_to_utf8): limit maximum length of the encoded string to 6 bytes, even when the platform supports 8 bytes long integers. * pack.c (utf8_to_uv): do not decode sequences longer than 6 bytes. * object.c (copy_object): use "copy_object" method, not "become". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e