mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
add mruby-eval mrbgem (no activation though)
This commit is contained in:
+4
-1
@@ -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'
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
MRuby::Gem::Specification.new('mruby-eval') do |spec|
|
||||
spec.license = 'MIT'
|
||||
spec.authors = 'mruby developers'
|
||||
end
|
||||
@@ -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)
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user