[前][次][番号順一覧][スレッド一覧]

ruby-changes:6430

From: usa <ko1@a...>
Date: Tue, 8 Jul 2008 00:35:00 +0900 (JST)
Subject: [ruby-changes:6430] Ruby:r17946 (win32-unicode-test): * ruby.c (process_options): re-set e_script.

usa	2008-07-08 00:34:43 +0900 (Tue, 08 Jul 2008)

  New Revision: 17946

  Modified files:
    branches/win32-unicode-test/ChangeLog
    branches/win32-unicode-test/ruby.c

  Log:
    * ruby.c (process_options): re-set e_script.
    


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=17946

Index: win32-unicode-test/ChangeLog
===================================================================
--- win32-unicode-test/ChangeLog	(revision 17945)
+++ win32-unicode-test/ChangeLog	(revision 17946)
@@ -1,3 +1,7 @@
+Tue Jul  8 00:33:46 2008  NAKAMURA Usaku  <usa@r...>
+
+	* ruby.c (process_options): re-set e_script.
+
 Tue Jul  8 00:03:20 2008  NAKAMURA Usaku  <usa@r...>
 
 	* win32/win32.c, include/win32/win32.c (rb_w32_parse_cmndline): new
Index: win32-unicode-test/ruby.c
===================================================================
--- win32-unicode-test/ruby.c	(revision 17945)
+++ win32-unicode-test/ruby.c	(revision 17946)
@@ -90,6 +90,7 @@
     const char *script;
     VALUE script_name;
     VALUE e_script;
+    VALUE e_script_pos;
     struct {
 	struct {
 	    VALUE name;
@@ -719,9 +720,11 @@
 		opt->e_script = rb_str_new(0, 0);
 		if (opt->script == 0)
 		    opt->script = "-e";
+		opt->e_script_pos = rb_ary_new();
 	    }
 	    rb_str_cat2(opt->e_script, s);
 	    rb_str_cat2(opt->e_script, "\n");
+	    rb_ary_push(opt->e_script_pos, INT2FIX(argc0 - argc));
 	    break;
 
 	  case 'r':
@@ -1100,6 +1103,15 @@
     rb_enc_set_default_external(rb_enc_from_encoding(enc));
 #ifdef _WIN32
     if ((argc = rb_w32_parse_cmdline(&argv, rb_enc_name(enc))) != 0) {
+	if (opt->e_script && opt->e_script_pos) {
+	    opt->e_script = rb_str_new(0, 0);
+	    for (i = 0; i < RARRAY_LEN(opt->e_script_pos); ++i) {
+		int pos = FIX2INT(RARRAY_PTR(opt->e_script_pos)[i]);
+		rb_enc_str_buf_cat(opt->e_script, argv[pos], strlen(argv[pos]),
+				   enc);
+		rb_str_cat2(opt->e_script, "\n");
+	    }
+	}
 	argc -= opnum;
 	argv += opnum;
 	ruby_set_argv(argc, argv);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]