add mruby-eval mrbgem (no activation though)

This commit is contained in:
Yukihiro Matz Matsumoto
2013-03-23 10:59:23 +09:00
parent 5717994452
commit a7dc817add
3 changed files with 31 additions and 1 deletions
+4 -1
View File
@@ -38,9 +38,12 @@ MRuby::Build.new do |conf|
# Use extensional Hash class
conf.gem "#{root}/mrbgems/mruby-hash-ext"
# No use eval method
# conf.gem "#{root}/mrbgems/mruby-eval
# Generate binaries
# conf.bins = %w(mrbc mruby mirb)
# C compiler settings
# conf.cc do |cc|
# cc.command = ENV['CC'] || 'gcc'
+4
View File
@@ -0,0 +1,4 @@
MRuby::Gem::Specification.new('mruby-eval') do |spec|
spec.license = 'MIT'
spec.authors = 'mruby developers'
end
+23
View File
@@ -0,0 +1,23 @@
#include "mruby.h"
#include "mruby/compile.h"
static mrb_value
f_eval(mrb_state *mrb, mrb_value self)
{
char *s;
int len;
mrb_get_args(mrb, "s", &s, &len);
return mrb_load_nstring(mrb, s, len);
}
void
mrb_mruby_eval_gem_init(mrb_state* mrb)
{
mrb_define_class_method(mrb, mrb->kernel_module, "eval", f_eval, ARGS_REQ(1));
}
void
mrb_mruby_eval_gem_final(mrb_state* mrb)
{
}