[macruby-changes] [2046] MacRuby/branches/experimental

source_changes at macosforge.org source_changes at macosforge.org
Wed Jul 22 13:25:10 PDT 2009


Revision: 2046
          http://trac.macosforge.org/projects/ruby/changeset/2046
Author:   lsansonetti at apple.com
Date:     2009-07-22 13:25:09 -0700 (Wed, 22 Jul 2009)
Log Message:
-----------
delay the require of -r libs until the compiler is available

Modified Paths:
--------------
    MacRuby/branches/experimental/eval.c
    MacRuby/branches/experimental/ruby.c

Modified: MacRuby/branches/experimental/eval.c
===================================================================
--- MacRuby/branches/experimental/eval.c	2009-07-22 16:47:51 UTC (rev 2045)
+++ MacRuby/branches/experimental/eval.c	2009-07-22 20:25:09 UTC (rev 2046)
@@ -180,9 +180,12 @@
 
 extern VALUE rb_progname;
 
+void rb_require_libraries(void);
+
 int
 ruby_run_node(void *n)
 {
+    rb_require_libraries();
     if ((VALUE)n == Qtrue) {
 	return EXIT_SUCCESS;
     }

Modified: MacRuby/branches/experimental/ruby.c
===================================================================
--- MacRuby/branches/experimental/ruby.c	2009-07-22 16:47:51 UTC (rev 2045)
+++ MacRuby/branches/experimental/ruby.c	2009-07-22 20:25:09 UTC (rev 2046)
@@ -292,9 +292,15 @@
 extern void Init_ext(void);
 extern VALUE rb_vm_top_self(void);
 
-static void
-require_libraries(void)
+void
+rb_require_libraries(void)
 {
+    static bool init = false;
+    if (init) {
+	return;
+    }
+    init = true;
+
     Init_ext();		/* should be called here for some reason :-( */
 
     if (req_list != NULL) {
@@ -962,7 +968,7 @@
 	else {
 	    eenc = lenc;
 	}
-	require_libraries();
+	//require_libraries();
 	tree = rb_parser_compile_string(parser, opt->script, opt->e_script, 1);
     }
     else {
@@ -1147,7 +1153,7 @@
 	else if (!NIL_P(c)) {
 	    rb_io_ungetc(f, 0, c);
 	}
-	require_libraries();	/* Why here? unnatural */
+	//require_libraries();	/* Why here? unnatural */
     }
     if (opt->src.enc.enc != NULL) {
     	enc = opt->src.enc.enc;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090722/739bf933/attachment.html>


More information about the macruby-changes mailing list