Граф коммитов

1060 Коммитов

Автор SHA1 Сообщение Дата
matz a4d6f2265a * include/ruby/node.h: add new constants for rb_call()'s scope.
* eval.c (iterate_method): use CALL_* scope constant to specify
  proper scope value.

* eval.c (rb_each, rb_apply, rb_funcall, rb_funcall2, rb_funcall3):
  ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-01 21:30:36 +00:00
nobu d728efc96d * eval.c (rb_obj_instance_eval): invalid comment syntax.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15820 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-21 06:51:21 +00:00
nobu 96240c6d2d * eval_intern.h (rb_thread_raised_set): use generic flags.
* eval.c (rb_longjmp): clear all raised flags.

* eval.c (stack_check): leave clearing flag to rb_longjmp.

* gc.c (rb_memerror): use thread raised flag instead of static flag.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-12 05:47:10 +00:00
matz eb1f89015e * eval.c (rb_f_local_variables): local_variables should return an
array of symbols.  [ruby-dev:34008]

* vm.c (collect_local_variables_in_env): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-10 15:48:35 +00:00
akr 861219ce4a fix doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-09 01:04:46 +00:00
nobu ecd35c0d96 * eval.c (stack_check): made flag per threads.
* thread.c (rb_thread_set_raised, rb_thread_reset_raised): prefixed.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-28 04:52:01 +00:00
nobu e4021207fb * eval.c (rb_raise_jump): moved adjustment for control frame.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-19 11:49:51 +00:00
nobu b81a66d1ef * eval.c (ruby_exec_node): no thread starts inside iseq compilation.
* eval.c (rb_f_raise): skip current control frame.  [ruby-core:15589]

* insns.def (opt_div): raise as the ordinary method. [ruby-core:15589]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-19 02:14:14 +00:00
mame a707f6249f * eval.c (eval): allow to eval in a binding that has a singleton method.
[ruby-dev:33763]

* test/ruby/test_proc.rb: add tests to achieve over 70% test coverage
  of time.c.

* test/ruby/test_method.rb: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-13 15:03:59 +00:00
nobu 1c5640855f * eval.c (eval): check if backtrace is empty. [ruby-core:15040]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-14 18:41:44 +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
matz 373d43f61e * eval.c (Init_eval): move instance_eval and instance_exec to
BasicObject.  [ruby-core:14747]

* lib/delegate.rb: should preserve new methods in BasicObject.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14886 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-04 16:51:16 +00:00
matz 3410fd6812 * README.EXT.ja, dir.c, eval.c, eval_intern.h, lex.c.src,
lex.c.blt, keywords, load.c, thread.c: more ANSI'ize.
  a patch from Tadashi Saito <shiba AT mail2.accsnet.ne.jp>
  in [ruby-dev:32725]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-25 04:17:06 +00:00
akr 96438d2bd8 * eval.c (rb_exc_raise): ANSI style.
(rb_exc_fatal): ditto.
  (rb_raise_jump): ditto.
  (rb_jump_tag): ditto.
  (rb_block_given_p): ditto.

* variable.c (original_module): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-24 09:25:27 +00:00
akr c332266ee0 * eval_method.c (Init_eval_method): extracted from Init_eval
for rdoc to find rb_mod_remove_method, rb_mod_undef_method and
  rb_mod_alias_method.

* eval.c (Init_eval): call Init_eval_method.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-24 09:07:20 +00:00
akr dc18845c23 * eval.c (function_call_may_return_twice_jmp_buf): removed.
(function_call_may_return_twice_false): removed.
  [ruby-core:14335]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-24 08:51:38 +00:00
akr e01c045a8b enable several rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14584 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-24 07:52:39 +00:00
akr e8b7ad0f5c enable documents for raise and local_variables.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-23 15:43:00 +00:00
ko1 85143195da * eval.c (rb_obj_instance_eval): use class of immediate objects.
* test/ruby/test_eval.rb: fix a test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-22 02:52:27 +00:00
matz d65ae590d0 * eval.c (rb_f_method_name): now __method__ and __callee__ are
aliases.  [ruby-core:14244]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-22 01:20:57 +00:00
ko1 c334a09f7a * common.mk, *.ci: renamed to *.c.
* eval_laod.c: renamed to load.c.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14364 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-20 09:29:46 +00:00
ko1 9bd91ea3b0 * eval.c (errinfo_place): skip if error is Fixnum. [ruby-dev:32608]
* bootstraptest/test_exception.rb, test_known_bug.rb: move fixed bug.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-19 08:02:03 +00:00
akr 30c5d612c2 * eval.c (rb_protect): restore root_jmpbuf even if proc exits by
break such as dbm.delete_if { break }.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14222 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-13 23:19:14 +00:00
akr 719841ca37 * eval.c (rb_protect): restore root_jmpbuf to avoid SEGV by
'IO.pipe; [].each.next' with gcc version 3.3.5 (Debian 1:3.3.5-13)
  on IA64.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-13 11:10:46 +00:00
matz 2db98d937a * object.c (Init_Object): singleton_method_{added,removed,undefined}
hooks should be defined for BasicObject.  [ruby-dev:32531]

* eval.c (Init_eval): method_missing should be defined for all
  objects; moved to BasicObject.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-11 06:23:21 +00:00
matz 0dd39db036 * eval.c (rb_method_missing): RDoc update patch from Hugh Sasse
<hgs AT dmu.ac.uk>.  [ruby-core:12932]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-10 17:24:52 +00:00
matz 5ee029f62c * eval.c (rb_f_public_send): rename invoke_method to public_send.
it now invokes public method only no matter how it's called.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-10 05:34:50 +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 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
ko1 9c7aab17a5 * eval.c (rb_method_missing): fix stack trace.
* bootstraptest/test_knownbug.rb: move solved tests.
* bootstraptest/test_method.rb, test/ruby/test_regexp.rb: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14026 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-27 01:47:34 +00:00
ko1 28c0aec1d8 * eval.c (eval): should be volatile value for GC.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-09 12:49:03 +00:00
nobu 4155206ebd * eval.c (send_internal): use self in the previous frame to check for
protected methods.  [ruby-core:13254]

* insnhelper.ci (vm_call_method): send! method has gone.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-09 01:43:57 +00:00
nobu 4c040861c8 * eval.c (rb_invoke_method): check if invoked in function style.
[ruby-core:13245]

* insnhelper.ci (vm_call_cfunc, vm_cfunc_flags): stores and returns VM
  calling flags.

* vm.c (rb_vm_cfunc_funcall_p): returns if the current method is
  invoked in function style.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-09 01:29:24 +00:00
davidflanagan ba80fd2bbf * eval.c: fix typo in invoke_method documentation
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-06 20:21:50 +00:00
matz 6a24fdb09d * eval.c (Init_eval): move #send to Kernel module from BasicObject.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-05 03:21:54 +00:00
matz 1eee78b876 * eval.c (rb_f_send): allow send/__send__ to call methods of all
visibility again.  we no longer provide __send, __send!.

* eval.c (rb_invoke_method): new method to honor private
  visibility.  if it's invoked in a function call style, it calls
  private methods as well (previous 1.9 send behavior).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-04 20:36:20 +00:00
nobu b9b34059a6 * eval.c (ruby_options), ruby.c (proc_options, process_options): not
call exit(2) directly.  [ruby-dev:31912]

* eval.c (ruby_run_node): deal with direct exit code.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-01 01:52:32 +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
ko1 67aa07f44d * eval.c (eval): fix to check stack overflow.
* eval_intern.h, vm.h: move CHECK_STACK_OVERFLOW() macro.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-26 10:39:49 +00:00
matz 72ea36112c * eval.c (rb_longjmp): source file information may be NULL.
[ruby-dev:31849]

* eval.c (ruby_finalize_0): clear trace_func before finalization.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-25 12:40:17 +00:00
ko1 d5e687b724 * vm.h, eval_intern.h: move some macros to eval_intern.h.
* eval_jump.ci (rb_f_throw): fix to use NEW_THROW_OBJECT().
* eval.c (rb_f_loop): remove additional macro.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-14 07:17:17 +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 901343a761 * enumerator.c (enumerator_next): stop pre-fetching.
* enumerator.c (Init_Enumerator): remove next? method.

* eval.c (rb_f_loop): now handles StopIteration exception.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-24 10:48:43 +00:00
matz 99ab1fed49 * eval.c (rb_f_send_bang): abandon the name funcall for private
aware method call.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-24 08:15:37 +00:00
ko1 42cf6ee753 * eval.c: $! should not be writable.
* eval.c (rb_rubylevel_errinfo): added.  rb_errinfo() returns
  rb_threa_t#errinfo.  rb_rubylevel_errinfo() returns $! value.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13091 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-18 04:26:48 +00:00
nobu 69dd06ae68 * eval.c (frame_func_id): return proper method ID.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-17 16:12:03 +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
ko1 14c3aa52ae * proc.c (Init_Proc), eval.c (Init_eval), eval_intern.h: move
init place of exception_error.
* inits.c: ditto.
* eval.c (Init_eval): set exception_error#throwed_state as TAG_FATAL.
  [ruby-dev:31407]
* bootstraptest/test_exception.rb: add a test for above.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-14 10:53:53 +00:00
nobu f5da26fc34 * eval.c (rb_clear_trace_func, rb_thread_stop_timer_thread):
declarations for forward refernces.

* eval.c (rb_longjmp, eval): use local variable.

* eval.c (rb_longjmp): string object not to be optimized.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-13 08:23:12 +00:00
nobu 39c56c3349 * compile.c, compile.h (DECL_ANCHOR, INIT_ANCHOR): split not to
initialize aggregations with dynamic values.  [ruby-talk:259306]

* eval.c (rb_protect): not to initialize aggregations with dynamic
  values.  [ruby-talk:259306]

* gc.c (mark_current_machine_context): ditto.

* thread.c (thgroup_list, call_trace_func): ditto.

* vm.c (vm_init_redefined_flag): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-20 07:11:35 +00:00