summaryrefslogtreecommitdiffstats
path: root/eval.c
Commit message (Collapse)AuthorAgeFilesLines
* * eval.c (ev_const_defined, ev_const_get), variable.cnobu2003-05-291-10/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | (rb_const_get_at, rb_const_get, rb_mod_remove_const): use Qundef as autoload marker. [ruby-dev:18103], [ruby-dev:18184] * eval.c (rb_mod_autoload, rb_mod_autoload_p): new method; Module#autoload, Module#autoload?. * variable.c (rb_autoload, rb_autoload_load, rb_autoload_p): manage autoload constants per classes/modules. * variable.c (rb_const_defined_at, rb_const_defined): return false for autoloading constants. * class.c (rb_define_class, rb_define_module), eval.c (rb_eval), variable.c (rb_mod_const_at, rb_const_assign): removed autoload stuff. * intern.h: prototypes; rb_autoload, rb_autoload_load, rb_autoload_p. * lib/optparse.rb (OptionParser::Switch::PlacedArgument::parse): do not treat unmatched argument as an option. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c, util.c: removed duplicated includes/defines.nobu2003-05-271-8/+0
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (Init_Proc): Block/Proc separation. [huge change]matz2003-05-261-132/+190
| | | | | | | | | | | | | | * 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: http://svn.ruby-lang.org/repos/ruby/trunk@3867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (rb_longjmp): wrong jump.nobu2003-05-231-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (rb_longjmp): get rid of reentering while debug warning.nobu2003-05-231-5/+30
| | | | | | | (ruby-bugs-ja:PR473) git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (ruby_finalize): turn off ruby_debug flag before callingmatz2003-05-231-0/+1
| | | | | | | | | | at_exit procs and finalizers. (ruby-bugs-ja:PR473) * ext/tcltklib/tcltklib.c (lib_mainloop_core): OK to block if there's no other thread. (ruby-bugs:PR#861) git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3859 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (rb_define_alloc_func): need not to disablematz2003-05-221-3/+3
| | | | | | | rb_call_super() for allocation functions. [ruby-core:1065] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (rb_eval): splat NODE_RESTARY. [ruby-dev:20268]nobu2003-05-211-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3845 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (rb_thread_fd_close): raise for writing threads.nobu2003-05-211-1/+5
| | | | | | | | | | | | [ruby-dev:20269] * io.c (rb_io_close, io_reopen): ditto. * io.c (io_reopen): keep stdio objects for stdin, stdout, and stderr. [ruby-dev:19442] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * error.c (syserr_initialize): prohibit specifying errno formatz2003-05-211-1/+0
| | | | | | | | | | | | subclasses of SystemCallError. in addition, if initialize is called for SystenCallError instance, its class be changed. [ruby-dev:20257] * gc.c (run_final): to protect thread context switch, finalizers are wrapped in DEFER_INTS/ENABLE_INTS. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (rb_thread_save_context): prohibit rb_gc_force_recycle()matz2003-05-201-0/+2
| | | | | | | on thread saved ruby_dyna_vars. [ruby-dev:20236] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (rb_yield_0): give warning for multiple values for amatz2003-05-201-7/+42
| | | | | | | | | | | | | | | | | | | | | | | | | block parameter. * eval.c (rb_yield_values): a function to yield multiple values. * array.c (sort_1): use rb_yield_values. * enum.c (min_ii, max_ii): ditto. * hash.c (rb_hash_update_block_i, delete_if_i, select_i, each_pair_i, env_each, env_reject_bang, env_select, env_update_i): ditto. * struct.c (rb_struct_each_pair): ditto. * eval.c (top_include): should include module in the current self, not ruby_top_self. [ruby-dev:20198] * eval.c (top_include): stop inclusion to ruby_wrapper; give warning. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (rb_f_missing): create exception instance by ordinalnobu2003-05-201-3/+8
| | | | | | | | | | | | | | | | method. * error.c (rb_name_error, rb_sys_fail): ditto. * error.c (exc_to_s, exit_status, name_err_name, nometh_err_args, syserr_errno, syserr_eqq): access attributes. * error.c (name_err_initialize, nometh_err_initialize, syserr_initialize): initialize attributes. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/pty/pty.c (pty_finalize_syswait): join (using Thread#value)matz2003-05-191-17/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | before detach pid. [ruby-talk:71519] * eval.c (PUSH_FRAME): save outer ruby_block. [ruby-list:37677], [ruby-dev:20202] * eval.c (BEGIN_CALLARGS): restore outer block by using ruby_block->outer. * eval.c (block_pass): do not alter block->prev, but block->outer. * array.c (get_inspect_tbl): warning on wrong condition. * eval.c (localjump_xvalue): renamed exitstatus to exit_value since it's not exit "status" after all. * eval.c (localjump_error): add reason to LocalJumpError. * compar.c (rb_cmpint): raise error via rb_cmperr(), if cmp value is nil. now take new 2 arguments. * time.c (time_cmp): 2003-05-16 fix was incomplete. (ruby-bugs-ja:PR#458) git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * object.c (init_copy): rename copy_object as initialize_copy,matz2003-05-191-20/+20
| | | | | | | | | | since it works as copy constructor. * eval.c (rb_add_method): initialize_copy should always be private, like initialize. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3820 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (get_inspect_tbl): check whether inspect_tbl value is amatz2003-05-191-1/+5
| | | | | | | | | | | | | | | | | valid array. (ruby-bugs-ja PR#65) * array.c (inspect_ensure,rb_protect_inspect,rb_inspecting_p): use get_inspect_tbl(). * eval.c (rb_f_abort): call exit(1) if exception is raised. This patch was made by Nobuyoshi Nakada <nobu.nokada@softhome.net> on 2002-05-30. (ruby-bugs-ja PR#236) * signal.c: disable Ruby's interrupt handler at the beginning. (ruby-bugs-ja PR#236) git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3817 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (block_pass): chain previous block to the pushing block.matz2003-05-161-0/+1
| | | | | | | | * time.c (time_cmp): does not compare with numbers for interchangeability. (ruby-bugs-ja PR#458) git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (error_pos): use $deferr for output instead of stderrmatz2003-05-131-46/+62
| | | | | | | | | | | | | | | | | | | | | directly. * eval.c (error_print,error_handle,rb_longjmp,rb_thread_schedule): ditto. * io.c (Init_IO): new variable $deferr which is default output port of error messages. * io.c (rb_warn_m): new method "warn". [new] * error.c (warn_print): use $deferr. * error.c (rb_bug): ditto. * error.c (err_append): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (rb_str_ljust): now takes optional argument to specifymatz2003-05-021-20/+8
| | | | | | | | | | | | | | | | | | | | | | | 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: http://svn.ruby-lang.org/repos/ruby/trunk@3742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (splat_value): split splat_value() and avalue_splat().matz2003-04-251-2/+2
| | | | | | | | * io.c: there's no way to set non-IO value to current_file, thus no need for argf_forward(). git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (proc_invoke): Proc#yield should pass through retry andmatz2003-04-251-44/+58
| | | | | | | | | | | | | | break like keyword yield. [ruby-talk:70034] * eval.c (proc_invoke): orphan Proc now raises LocalJumpError for break and retry again. * eval.c (rb_eval): ARGSCAT should splat the argument. * eval.c (splat_value): splat operation function. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * variable.c (rb_mod_name): always return empty string formatz2003-04-101-14/+15
| | | | | | | | | | | | | | anonymous class/module. (ruby-bugs-ja PR#424) * config.sub: stop forcing addition of -gnu to -linux. * variable.c (classname): refactoring. * variable.c (rb_class_path): __tmp__classpath__ handling moved from classname(). git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3664 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (rb_obj_is_method): indefinite return value.nobu2003-04-091-0/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * variable.c (rb_obj_remove_instance_variable): better message.matz2003-04-091-12/+17
| | | | | | | | | | | | | | | | | | [ruby-talk:68987] * variable.c (rb_mod_remove_const): ditto. * object.c (rb_obj_ivar_get): ditto. * object.c (rb_obj_ivar_set): ditto. * parse.y (yylex): ditto. * eval.c (rb_mod_define_method): Allow UnboundMethod as parameter. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (BIGZEROP): macro to determine if x is a bignum zero.matz2003-04-091-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (Init_Proc): make Method and UnboundMethod independent.matz2003-04-081-2/+8
| | | | | | | | | | | | | | | | They are like instance and its class. [ruby-core:00941] * parse.y (yylex): disallow global variables like "$1ve". [ruby-core:00945] * marshal.c (marshal_dump): Marshal.dump(0, false) should cause an error. (ruby-bugs-ja PR#421) * regex.c (re_compile_pattern): warn if '-' is the edge of character range. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/socket/socket.c (sock_s_unpack_sockaddr_in): remove structmatz2003-04-071-8/+5
| | | | | | | | | | | | | | | | | | | size check. getnameinfo(3) can handle. [ruby-dev:19967] * io.c (io_read): do not call rb_sys_fail() when required data length is zero. (ruby-bugs-ja PR#420) * eval.c (umethod_proc): should raise TypeError, instead of returning error causing Proc. Following the principle of "fail early". [ruby-core:00927] * pack.c (pack_pack): small but serious typo. * eval.c (backtrace): skip internal allocator frame. (ruby-bugs-ja PR#416) git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (assign): should prepare mrhs by svalue_to_mrhs().matz2003-04-041-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3642 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (rb_f_missing): use "inspect" for T_OBJECT as well.matz2003-04-031-4/+4
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (avalue_to_svalue): use rb_check_array_type() again.matz2003-03-291-25/+49
| | | | | | | | | | | | | | | | | | | | | | | | Clarify how "to_ary" and "to_a" work. [ruby-talk:68155] * eval.c (svalue_to_avalue): ditto. * eval.c (svalue_to_mrhs): ditto. * eval.c (rb_eval): unary splat to use to_a, but we need a hack to exclude Object#to_a until it's removed. * object.c (rb_Array): check obj.respond_to?("to_a"). Currently all object respond_to "to_a", but Object#to_a will be removed. * range.c (Init_Range): undefine to_ary. * re.c (Init_Regexp): ditto. * regex.c (re_compile_pattern): do not warn if "-" is at the top or last of character class. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3633 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (avalue_splat): new function to do unary * (splat)matz2003-03-261-39/+28
| | | | | | | | | | | | | | | | | | | operator. * eval.c (avalue_to_svalue,svalue_to_avalue,svalue_to_mrhs): do not use implicit "to_ary" conversion. * ext/curses/curses.c (GetWINDOW,GetMOUSE): add taint check. * ext/curses/curses.c (curses_init_screen): ditto. * ext/curses/curses.c (window_initialize): ditto. * gc.c (os_each_obj): prohibit ObjectSpace#each_object in safe mode ($SAFE >= 4). git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3616 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (rb_yield_0): call avalue_to_mrhs() to assign blockmatz2003-03-251-1/+1
| | | | | | | | | parameter |a|. [ruby-dev:19897] * ruby.c (ruby_set_argv): freeze argument strings. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_initialize): should check rb_secure(4).matz2003-03-251-0/+7
| | | | | | | | | | | * dir.c (dir_s_getwd): should check rb_secure(4). * object.c (rb_obj_infect): function version of OBJ_INFECT(). * eval.c (rb_secure_update): new function to check object update. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* security enhancement of dl library (need test).matz2003-03-241-1/+8
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3609 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * regex.c (re_compile_pattern): give warning for unescaped squarematz2003-03-211-2/+4
| | | | | | | brackets and minus in character class. [ruby-dev:19868] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (bmcall): missing type.nobu2003-03-211-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (load_dyna): clear ruby_errinfo. (ruby-bugs-ja PR#409)matz2003-03-201-6/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | * io.c (read_all): make str empty if given. (ruby-bugs-ja PR#408) * io.c (io_read): ditto. * io.c (rb_io_sysread): ditto. * range.c: do not override min and max. * sprintf.c (remove_sign_bits): octal left most digit for negative numbers may be '3'. (ruby-bugs-ja PR#407) * sprintf.c (rb_f_sprintf): should prefix sign bits if bignum is negative, using sign_bits(). * eval.c (avalue_to_mrhs): split argument passing and assignment conversion. * eval.c (svalue_to_mrhs): ditto. * eval.c (avalue_to_svalue): avalue_to_svalue([[1,2]]) should be [[1,2]], not [1,2] to wrap-around. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3584 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (bmcall): add volatile to avoid GC problem.akr2003-03-201-2/+2
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (massign): remove unnecessary array unpacking; it shouldmatz2003-03-101-31/+27
| | | | | | | | | | | | | | | | be handled before massign() by svalue_to_mrhs(). * eval.c (svalue_to_mrhs): '*a = v' value conversion to avalue (i.e. [1] => [[1]], [1,2] => [1,2]). * eval.c (rb_eval): use svalue_to_mrhs. * eval.c (rb_yield_0): ditto. * eval.c (proc_invoke): break from "Proc#yield" is legal. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * file.c (rb_find_file): need world writable directory check formatz2003-03-101-1/+1
| | | | | | | | | | relative paths too. * file.c (rb_find_file): world writable directory check if $SAFE >= 1 (was $SAFE >= 2). git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (massign): fix a bug not to expand in assigment to solenobu2003-03-081-1/+1
| | | | | | | lhs. [ruby-dev:19766] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (dsym): :"symbol string" style should not contain `\0'.matz2003-03-071-5/+7
| | | | | | | | | | | | | | | | | * 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: http://svn.ruby-lang.org/repos/ruby/trunk@3561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * string.c (str_new): need no MEMZERO().matz2003-02-271-6/+18
| | | | | | | | | | | | * 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: http://svn.ruby-lang.org/repos/ruby/trunk@3536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (rb_f_require): do not need to abort if a DLEXT fileeban2003-02-211-3/+0
| | | | | | | is not found. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (rb_thread_remove): back outt changes.matz2003-02-211-1/+0
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (rb_thread_remove): thread may die in the process ofmatz2003-02-201-0/+2
| | | | | | | | | | | | rb_thread_die(). this change was suggested by Rudi Cilibrasi <cilibrar@drachma.ugcs.caltech.edu>. * eval.c (rb_thread_start_0): main thread swapped by fork() may terminate rb_thread_start_0() successfully. call ruby_stop(0); this change too was suggested by Rudi. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* *** empty log message ***nobu2003-02-201-0/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (clhs): allow "Foo::Bar = x".matz2003-02-201-15/+39
| | | | | | | | | | | | | | | | | | | | | * parse.y (primary): "self[n]=x" can be legal even when "[]=" is private. changes submitted in [ruby-talk:63982] * parse.y (aryset): ditto. * parse.y (attrset): "self.foo=x" can be legal even when "foo=" is private. * eval.c (is_defined): private "[]=" and "foo=" support. * eval.c (rb_eval): ditto. * eval.c (assign): ditto. * eval.c (rb_eval): "foo=" should not always be public. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (rb_thread_restore_context): inhibit interrupts innobu2003-02-191-1/+2
| | | | | | | critical section while context switching. [ruby-talk:64785] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3508 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * node.h (nd_cpath): nested class/module declaration.nobu2003-02-191-18/+55
| | | | | | | | | | | | | [EXPREIMENTAL] * eval.c (rb_eval): ditto. * gc.c (rb_gc_mark_children): ditto. * parse.y (cpath): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e