Last change
on this file since 446 was 439, checked in by coas-nagasima, 4 years ago |
mrubyを2.1.1に更新
|
-
Property svn:eol-style
set to
native
-
Property svn:mime-type
set to
text/x-csrc;charset=UTF-8
|
File size:
562 bytes
|
Line | |
---|
1 | #include <stdlib.h>
|
---|
2 | #include <mruby.h>
|
---|
3 |
|
---|
4 | static mrb_value
|
---|
5 | f_exit(mrb_state *mrb, mrb_value self)
|
---|
6 | {
|
---|
7 | mrb_value status = mrb_true_value();
|
---|
8 | int istatus;
|
---|
9 |
|
---|
10 | mrb_get_args(mrb, "|o", &status);
|
---|
11 | istatus = mrb_true_p(status) ? EXIT_SUCCESS :
|
---|
12 | mrb_false_p(status) ? EXIT_FAILURE :
|
---|
13 | (int)mrb_int(mrb, status);
|
---|
14 | exit(istatus);
|
---|
15 |
|
---|
16 | /* not reached */
|
---|
17 | return status;
|
---|
18 | }
|
---|
19 |
|
---|
20 | void
|
---|
21 | mrb_mruby_exit_gem_init(mrb_state* mrb)
|
---|
22 | {
|
---|
23 | mrb_define_method(mrb, mrb->kernel_module, "exit", f_exit, MRB_ARGS_OPT(1));
|
---|
24 | }
|
---|
25 |
|
---|
26 | void
|
---|
27 | mrb_mruby_exit_gem_final(mrb_state* mrb)
|
---|
28 | {
|
---|
29 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.