[#45910] [ruby-trunk - Bug #6694][Open] Thread.new without block. — "ko1 (Koichi Sasada)" <redmine@...>

24 messages 2012/07/04

[#45913] [ruby-trunk - Bug #6698][Open] MacOSXではDir.globが返すファイル名の内容はUTF8-MACですがencodingがUTF-8になっている — "imkira (Mario Freitas)" <imkira@...>

10 messages 2012/07/04

[#45933] [ruby-trunk - Bug #6716][Open] FileUtils.mv でリンク先がないシンボリックリンクファイルを指定すると ENOENT エラーになる — "tommy (Masahiro Tomita)" <tommy@...>

8 messages 2012/07/10

[#45976] [ruby-trunk - Bug #6756][Open] FileUtils.rm_rf がアクセス権のない空ディレクトリを削除しない — "fumiyas (Fumiyasu SATOH)" <fumiyas@...>

9 messages 2012/07/20

[#46012] [ruby-trunk - Feature #6812][Open] Refactor gc.c — "authorNari (Narihiro Nakamura)" <authorNari@...>

13 messages 2012/07/30

[ruby-dev:45936] Re: [ruby-changes:24312] yugui:r36363 (trunk): * vm_eval.c (rb_eval_string_from_file,

From: SASADA Koichi <ko1@...>
Date: 2012-07-11 06:03:40 UTC
List: ruby-dev #45936
yugui さんへ

(2012/07/11 12:25), yugui wrote:
> Index: vm_eval.c
+/** @note This function name is not stable. */
 VALUE
+ruby_eval_string_from_file(const char *str, const char *filename) {
+    return eval_string(rb_vm_top_self(), rb_str_new2(str), Qnil,
filename, 1);
+}
+
...
> +VALUE
> +ruby_eval_string_from_file_protect(const char *str, const char *filename, int *state) {
> +    struct eval_string_from_file_arg arg = { str, filename };
> +    return rb_protect((VALUE (*)(VALUE))eval_string_from_file_helper, (VALUE)&arg, state);
> +}

 結局 encoding はどうしたんですか? あと,protect だけで良さそうな気が
します.

> +/**
> + * Evaluates the given string in an isolated binding.
> + *
> + * Here "isolated" means the binding does not inherit any other binding. This
> + * behaves same as the binding for required libraries.
> + *
> + * __FILE__ will be "(eval)", and __LINE__ starts from 1 in the evaluation.
> + *
> + * @param str Ruby code to evaluate.
> + * @return The evaluated result.
> + * @throw Exception   Raises an exception on error.
> + */
> +VALUE
>  rb_eval_string(const char *str)
>  {
> -    return eval_string(rb_vm_top_self(), rb_str_new2(str), Qnil, "(eval)", 1);
> +    return ruby_eval_string_from_file(str, "eval");
>  }

 "(eval)" じゃなくて "eval" で良いですか?


----

 将来的には,IRC で言いましたが,ruby_call_as_main(funcptr, data,
state) 的なものだけにするかも. main な環境で funcptr(data) を呼び出す,
呼び出された場所では rb_ な C API を使い放題,例外は state に記録,的な.

-- 
// SASADA Koichi at atdot dot net



In This Thread

Prev Next