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

ruby-changes:7450

From: nobu <ko1@a...>
Date: Sun, 31 Aug 2008 11:50:32 +0900 (JST)
Subject: [ruby-changes:7450] Ruby:r18969 (mvm): properties.

nobu	2008-08-31 11:50:17 +0900 (Sun, 31 Aug 2008)

  New Revision: 18969

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

  Log:
    properties.

  Modified files:
    branches/mvm/sampledriver/main.c

Index: mvm/sampledriver/main.c
===================================================================
--- mvm/sampledriver/main.c	(revision 18968)
+++ mvm/sampledriver/main.c	(revision 18969)
@@ -1,77 +1,77 @@
-/*
- * SampleDriver [mruby]
- * This file is a sample driver of MVM.
- *
- * This sample driver [mruby] do:
- *   - creats (argc-1) VMs.
- *   - lets each VM run ruby script specified by argv[i]
- *     in parallel.
- *   - exit sample driver when all VMs are terminated.
- *
- * Terminology:
- *   - Driver: A generator/controller/manager of VMs with Ruby MVM C API.
- *   - Virtual Machine (VM): VM executs ruby program which is passed by Driver.
- *   - Ruby MVM C API: APIs for managing MVMs, which includes generation,
- *     sending events, sending messages and termination.
- */
-
-#include <ruby/mvm.h>
-
-/* mruby main */
-
-int
-main(int argc, char *argv[])
-{
-    int i, n = argc - 1;
-    rb_vm_t **vms = alloca(sizeof(rb_vm_t *) * n);
-
-    ruby_sysinit(&argc, &argv); /* process level initialize */
-
-    /* mruby a.rb b.rb c.rb */
-    /* => run parallel as:
-     *    ruby a.rb & ruby b.rb & ruby c.rb
-     */
-    
-    for (i=0; i<n; i++) {
-	rb_vm_t *vm;
-	rb_vm_attr_t *attr;
-	static void IntiVM_mruby(rb_vm_t *vm);
-
-	/* set option */
-	attr = ruby_vm_attr_create(1, &argv[i+1]); /* initaialize with arguments */
-
-	ruby_vm_attr_add_initializ_function(attr, InitVM_mruby);
-	ruby_vm_attr_own_timer(attr, 1);
-	ruby_vm_attr_create_thread(attr, 1); /* default */
-	ruby_vm_attr_add_expression(attr, "p true");
-	ruby_vm_attr_add_option(attr, "baz");
-	ruby_vm_attr_set_verbose(attr, 1);
-	ruby_vm_attr_set_debug(attr, 1);
-
-	/* set stdin, out, err */
-	ruby_vm_attr_set_stdin(attr, 0);  /* default */
-	ruby_vm_attr_set_stdout(attr, 1); /* default */
-	ruby_vm_attr_set_stderr(attr, 2); /* default */
-
-	/* create and invoke virtual machine instance */
-	vm = vms[i] = ruby_vm_new(attr);
-
-	ruby_vm_attr_destruct(attr);
-    }
-
-    for (i=0; i<n; i++) {
-	int err = rb_vm_join(vms[i]);
-	printf("VM %d was terminated with error code %d.\n", i, err);
-    }
-
-    return 0;
-}
-
-#include <ruby/ruby.h>
-
-static void
-IntiVM_mruby(rb_vm_t *vm)
-{
-    rb_define_method(...);
-}
-
+/*
+ * SampleDriver [mruby]
+ * This file is a sample driver of MVM.
+ *
+ * This sample driver [mruby] do:
+ *   - creats (argc-1) VMs.
+ *   - lets each VM run ruby script specified by argv[i]
+ *     in parallel.
+ *   - exit sample driver when all VMs are terminated.
+ *
+ * Terminology:
+ *   - Driver: A generator/controller/manager of VMs with Ruby MVM C API.
+ *   - Virtual Machine (VM): VM executs ruby program which is passed by Driver.
+ *   - Ruby MVM C API: APIs for managing MVMs, which includes generation,
+ *     sending events, sending messages and termination.
+ */
+
+#include <ruby/mvm.h>
+
+/* mruby main */
+
+int
+main(int argc, char *argv[])
+{
+    int i, n = argc - 1;
+    rb_vm_t **vms = alloca(sizeof(rb_vm_t *) * n);
+
+    ruby_sysinit(&argc, &argv); /* process level initialize */
+
+    /* mruby a.rb b.rb c.rb */
+    /* => run parallel as:
+     *    ruby a.rb & ruby b.rb & ruby c.rb
+     */
+    
+    for (i=0; i<n; i++) {
+	rb_vm_t *vm;
+	rb_vm_attr_t *attr;
+	static void IntiVM_mruby(rb_vm_t *vm);
+
+	/* set option */
+	attr = ruby_vm_attr_create(1, &argv[i+1]); /* initaialize with arguments */
+
+	ruby_vm_attr_add_initializ_function(attr, InitVM_mruby);
+	ruby_vm_attr_own_timer(attr, 1);
+	ruby_vm_attr_create_thread(attr, 1); /* default */
+	ruby_vm_attr_add_expression(attr, "p true");
+	ruby_vm_attr_add_option(attr, "baz");
+	ruby_vm_attr_set_verbose(attr, 1);
+	ruby_vm_attr_set_debug(attr, 1);
+
+	/* set stdin, out, err */
+	ruby_vm_attr_set_stdin(attr, 0);  /* default */
+	ruby_vm_attr_set_stdout(attr, 1); /* default */
+	ruby_vm_attr_set_stderr(attr, 2); /* default */
+
+	/* create and invoke virtual machine instance */
+	vm = vms[i] = ruby_vm_new(attr);
+
+	ruby_vm_attr_destruct(attr);
+    }
+
+    for (i=0; i<n; i++) {
+	int err = rb_vm_join(vms[i]);
+	printf("VM %d was terminated with error code %d.\n", i, err);
+    }
+
+    return 0;
+}
+
+#include <ruby/ruby.h>
+
+static void
+IntiVM_mruby(rb_vm_t *vm)
+{
+    rb_define_method(...);
+}
+

Property changes on: mvm/sampledriver/main.c
___________________________________________________________________
Name: svn:eol-style
   + LF
Name: svn:keywords
   + Author Id Revision


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

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