diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-18 07:44:51 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-18 07:44:51 +0000 |
commit | 115a3d21e49a887f615b2b85c3eb4dd11701ab51 (patch) | |
tree | f50c0942f11decea605b64558b714075584d897b /eval_jump.ci | |
parent | 6e0c6ac3be8069e939748b00febcf4411ce905cb (diff) | |
download | ruby-115a3d21e49a887f615b2b85c3eb4dd11701ab51.tar.gz |
* eval_error.ci (ruby_error_print): call error_print.
* eval_jump.ci, process.c (rb_exit, rb_f_exit, rb_f_abort): moved.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval_jump.ci')
-rw-r--r-- | eval_jump.ci | 129 |
1 files changed, 0 insertions, 129 deletions
diff --git a/eval_jump.ci b/eval_jump.ci index 6d1e730d0f..ddb99c9271 100644 --- a/eval_jump.ci +++ b/eval_jump.ci @@ -133,133 +133,6 @@ rb_catch(const char *tag, VALUE (*func)(), VALUE data) /* exit */ -NORETURN(static VALUE terminate_process _((int, const char *, long))); - -static VALUE -terminate_process(int status, const char *mesg, long mlen) -{ - VALUE args[2]; - - args[0] = INT2NUM(status); - args[1] = rb_str_new(mesg, mlen); - - rb_exc_raise(rb_class_new_instance(2, args, rb_eSystemExit)); -} - - -void -rb_exit(int status) -{ - if (GET_THREAD()->tag) { - terminate_process(status, "exit", 4); - } - ruby_finalize(); - exit(status); -} - -/* - * call-seq: - * exit(integer=0) - * Kernel::exit(integer=0) - * Process::exit(integer=0) - * - * Initiates the termination of the Ruby script by raising the - * <code>SystemExit</code> exception. This exception may be caught. The - * optional parameter is used to return a status code to the invoking - * environment. - * - * begin - * exit - * puts "never get here" - * rescue SystemExit - * puts "rescued a SystemExit exception" - * end - * puts "after begin block" - * - * <em>produces:</em> - * - * rescued a SystemExit exception - * after begin block - * - * Just prior to termination, Ruby executes any <code>at_exit</code> functions - * (see Kernel::at_exit) and runs any object finalizers (see - * ObjectSpace::define_finalizer). - * - * at_exit { puts "at_exit function" } - * ObjectSpace.define_finalizer("string", proc { puts "in finalizer" }) - * exit - * - * <em>produces:</em> - * - * at_exit function - * in finalizer - */ - -VALUE -rb_f_exit(int argc, VALUE *argv) -{ - VALUE status; - int istatus; - - rb_secure(4); - if (rb_scan_args(argc, argv, "01", &status) == 1) { - switch (status) { - case Qtrue: - istatus = EXIT_SUCCESS; - break; - case Qfalse: - istatus = EXIT_FAILURE; - break; - default: - istatus = NUM2INT(status); -#if EXIT_SUCCESS != 0 - if (istatus == 0) - istatus = EXIT_SUCCESS; -#endif - break; - } - } - else { - istatus = EXIT_SUCCESS; - } - rb_exit(istatus); - return Qnil; /* not reached */ -} - - -/* - * call-seq: - * abort - * Kernel::abort - * Process::abort - * - * Terminate execution immediately, effectively by calling - * <code>Kernel.exit(1)</code>. If _msg_ is given, it is written - * to STDERR prior to terminating. - */ - -VALUE -rb_f_abort(int argc, VALUE *argv) -{ - rb_secure(4); - if (argc == 0) { - if (!NIL_P(GET_THREAD()->errinfo)) { - error_print(); - } - rb_exit(EXIT_FAILURE); - } - else { - VALUE mesg; - - rb_scan_args(argc, argv, "1", &mesg); - StringValue(argv[0]); - rb_io_puts(argc, argv, rb_stderr); - terminate_process(EXIT_FAILURE, RSTRING_PTR(argv[0]), - RSTRING_LEN(argv[0])); - } - return Qnil; /* not reached */ -} - static void call_end_proc _((VALUE data)); static void @@ -405,7 +278,5 @@ Init_jump(void) { rb_define_global_function("catch", rb_f_catch, 1); rb_define_global_function("throw", rb_f_throw, -1); - rb_define_global_function("exit", rb_f_exit, -1); - rb_define_global_function("abort", rb_f_abort, -1); rb_define_global_function("at_exit", rb_f_at_exit, 0); } |