add new mrbgem mruby-exit

This commit is contained in:
Yukihiro "Matz" Matsumoto
2013-07-31 11:53:48 +09:00
parent 1b6b00e2d0
commit 0166403247
2 changed files with 28 additions and 0 deletions
+4
View File
@@ -0,0 +1,4 @@
MRuby::Gem::Specification.new('mruby-exit') do |spec|
spec.license = 'MIT'
spec.author = 'mruby developers'
end
+24
View File
@@ -0,0 +1,24 @@
#include <stdlib.h>
#include "mruby.h"
static mrb_value
f_exit(mrb_state *mrb, mrb_value self)
{
mrb_int i = EXIT_SUCCESS;
mrb_get_args(mrb, "|i", &i);
exit(i);
/* not reached */
return mrb_nil_value();
}
void
mrb_mruby_exit_gem_init(mrb_state* mrb)
{
mrb_define_method(mrb, mrb->kernel_module, "exit", f_exit, MRB_ARGS_REQ(1));
}
void
mrb_mruby_exit_gem_final(mrb_state* mrb)
{
}