source: EcnlProtoTool/trunk/mruby-2.1.1/mrbgems/mruby-exit/src/mruby-exit.c@ 439

Last change on this file since 439 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
RevLine 
[270]1#include <stdlib.h>
[331]2#include <mruby.h>
[270]3
4static mrb_value
5f_exit(mrb_state *mrb, mrb_value self)
6{
[439]7 mrb_value status = mrb_true_value();
8 int istatus;
[270]9
[439]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
[270]16 /* not reached */
[439]17 return status;
[270]18}
19
20void
21mrb_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
26void
27mrb_mruby_exit_gem_final(mrb_state* mrb)
28{
29}
Note: See TracBrowser for help on using the repository browser.